Skip to content

Commit ff1b073

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 cef7b0d commit ff1b073

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class HID_ : public PluggableUSBModule
139139
uint8_t getShortName(char* name) override;
140140

141141
private:
142-
uint8_t epType[2];
142+
uint8_t epType[1];
143143

144144
HIDSubDescriptor* rootNode;
145145
uint16_t descriptorSize;

0 commit comments

Comments
 (0)