From a948b7afe5266331d937134d980d4aa91fc8cca0 Mon Sep 17 00:00:00 2001 From: "Jose A. Jimenez" Date: Tue, 16 Feb 2016 12:20:39 +0100 Subject: [PATCH] Some corrections as agreed with @Lauszus. Added flag bRptProtoEnable to HIDBoot() constructor. The flag defaults to false in order to maintain current behavior (Boot Protocol). If flag is the to true, HIDBoot() will enable the Report Protocol. This modification is very useful for communication with HID devices with the full, richer, Report Protocol. --- hidboot.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hidboot.h b/hidboot.h index 7932efea..4d0b0b26 100644 --- a/hidboot.h +++ b/hidboot.h @@ -219,7 +219,7 @@ class HIDBoot : public USBHID //public USBDeviceConfig, public UsbConfigXtracter }; public: - HIDBoot(USB *p, bool bRptProtoEnable=false); + HIDBoot(USB *p, bool bRptProtoEnable = false); virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) { pRptParser[id] = prs; @@ -253,7 +253,7 @@ public: }; template -HIDBoot::HIDBoot(USB *p, bool bRptProtoEnable) : +HIDBoot::HIDBoot(USB *p, bool bRptProtoEnable/* = false*/) : USBHID(p), qNextPollTime(0), bPollEnable(false), @@ -458,7 +458,7 @@ uint8_t HIDBoot::Init(uint8_t parent, uint8_t port, bool lowspeed // Yes, mouse wants SetProtocol and SetIdle too! for(uint8_t i = 0; i < epMUL(BOOT_PROTOCOL); i++) { USBTRACE2("\r\nInterface:", i); - rcode = SetProtocol(i, bRptProtoEnable ? HID_RPT_PROTOCOL : HID_BOOT_PROTOCOL); + rcode = SetProtocol(i, bRptProtoEnable ? HID_RPT_PROTOCOL : USB_HID_BOOT_PROTOCOL); if(rcode) goto FailSetProtocol; USBTRACE2("PROTOCOL SET HID_BOOT rcode:", rcode); rcode = SetIdle(i, 0, 0);