From fab8321b68896a8a9ff085586652ed4d834ba173 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Thu, 27 Feb 2014 23:15:10 +0100 Subject: HID: added get_feature_report(). --- usb/hid.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/usb/hid.h b/usb/hid.h index bb5b9d7..1d3c8c1 100644 --- a/usb/hid.h +++ b/usb/hid.h @@ -225,9 +225,10 @@ constexpr auto padding_out(uint8_t size) -> decltype( } class USB_HID : public USB_class_driver { - private: + protected: USB_generic& usb; + private: desc_t report_desc_p; enum ControlState { @@ -285,6 +286,11 @@ class USB_HID : public USB_class_driver { return SetupStatus::Ok; } + // Get feature report. + if(bmRequestType == 0xa1 && wIndex == interface_num && bRequest == 0x01 && (wValue & 0xff00) == 0x0300) { + return get_feature_report(wValue & 0xff) ? SetupStatus::Ok : SetupStatus::Stall; + } + return SetupStatus::Unhandled; } @@ -329,6 +335,10 @@ class USB_HID : public USB_class_driver { virtual bool set_feature_report(uint32_t* buf, uint32_t len) { return false; } + + virtual bool get_feature_report(uint8_t report_id) { + return false; + } }; #endif -- cgit v1.2.3