1
0
mirror of https://github.com/gdsports/USBHost_t36 synced 2024-11-24 18:12:16 -05:00

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

View File

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