Skip to content

Commit 070521c

Browse files
committed
Remove unused OUTPUT endpoint to simplify
The HIDPowerDevice HID report descriptor only contains INPUT and FEATURE reports, and no OUTPUT reports. It therefore makes little sense to configure a USB input endpoint for INPUT reports. This also makes the implementation more similar to the upstream Arduino code on https://github.com/arduino/ArduinoCore-avr/blob/master/libraries/HID/src/HID.cpp
1 parent 6f6442f commit 070521c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/HID/HID.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ int HID_::getInterface(uint8_t* interfaceCount)
3131
{
3232
*interfaceCount += 1; // uses 1
3333
HIDDescriptor hidInterface = {
34-
D_INTERFACE(pluggedInterface, 2, USB_DEVICE_CLASS_HUMAN_INTERFACE, HID_SUBCLASS_NONE, HID_PROTOCOL_NONE),
34+
D_INTERFACE(pluggedInterface, 1, USB_DEVICE_CLASS_HUMAN_INTERFACE, HID_SUBCLASS_NONE, HID_PROTOCOL_NONE),
3535
D_HIDREPORT(descriptorSize),
36-
D_ENDPOINT(USB_ENDPOINT_IN(HID_TX), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x14),
37-
D_ENDPOINT(USB_ENDPOINT_OUT(HID_RX), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x0A)
36+
D_ENDPOINT(USB_ENDPOINT_IN(HID_TX), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x14)
3837
};
3938
return USB_SendControl(0, &hidInterface, sizeof(hidInterface));
4039
}
@@ -254,12 +253,11 @@ bool HID_::setup(USBSetup& setup)
254253
return false;
255254
}
256255

257-
HID_::HID_(void) : PluggableUSBModule(2, 1, epType),
256+
HID_::HID_(void) : PluggableUSBModule(1, 1, epType),
258257
rootNode(NULL), descriptorSize(0),
259258
protocol(HID_REPORT_PROTOCOL), idle(1)
260259
{
261260
epType[0] = EP_TYPE_INTERRUPT_IN;
262-
epType[1] = EP_TYPE_INTERRUPT_OUT;
263261
PluggableUSB().plug(this);
264262
}
265263

src/HID/HID.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ typedef struct
8787
InterfaceDescriptor hid;
8888
HIDDescDescriptor desc;
8989
EndpointDescriptor in;
90-
EndpointDescriptor out; //added
9190
} HIDDescriptor;
9291

9392
class HIDReport {
@@ -139,7 +138,7 @@ class HID_ : public PluggableUSBModule
139138
uint8_t getShortName(char* name) override;
140139

141140
private:
142-
uint8_t epType[2];
141+
uint8_t epType[1];
143142

144143
HIDSubDescriptor* rootNode;
145144
uint16_t descriptorSize;

0 commit comments

Comments
 (0)