Add idVendor() & idProduct() to HID parser class

This commit is contained in:
PaulStoffregen 2017-10-09 14:21:30 -07:00
parent adc8a3239f
commit 0e35681c48
1 changed files with 6 additions and 2 deletions

View File

@ -405,6 +405,10 @@ private:
// Device drivers may inherit from this base class, if they wish to receive
// HID input data fully decoded by the USBHIDParser driver
class USBHIDInput {
public:
operator bool() { return (mydevice != nullptr); }
uint16_t idVendor() { return (mydevice != nullptr) ? mydevice->idVendor : 0; }
uint16_t idProduct() { return (mydevice != nullptr) ? mydevice->idProduct : 0; }
private:
virtual bool claim_collection(Device_t *dev, uint32_t topusage);
virtual void hid_input_begin(uint32_t topusage, uint32_t type, int lgmin, int lgmax);
@ -414,6 +418,8 @@ private:
void add_to_list();
USBHIDInput *next;
friend class USBHIDParser;
protected:
Device_t *mydevice = NULL;
};
/************************************************/
@ -755,7 +761,6 @@ protected:
virtual void hid_input_end();
virtual void disconnect_collection(Device_t *dev);
private:
Device_t *mydevice = NULL;
uint8_t collections_claimed = 0;
volatile bool mouseEvent = false;
uint8_t buttons = 0;
@ -780,7 +785,6 @@ protected:
virtual void hid_input_end();
virtual void disconnect_collection(Device_t *dev);
private:
Device_t *mydevice = NULL;
uint8_t collections_claimed = 0;
bool anychange = false;
volatile bool joystickEvent = false;