Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a1cf704

Browse files
committed
Fixed HID Reports >255 bytes
1 parent b97b251 commit a1cf704

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎hardware/arduino/avr/libraries/HID/HID.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static u8 HID_INTERFACE;
4343
HIDDescriptor _hidInterface;
4444

4545
static HIDDescriptorListNode* rootNode = NULL;
46-
static uint8_t sizeof_hidReportDescriptor = 0;
46+
static uint16_t sizeof_hidReportDescriptor = 0;
4747
static uint8_t modules_count = 0;
4848
//================================================================================
4949
//================================================================================
@@ -91,7 +91,7 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
9191
current->next = node;
9292
}
9393
modules_count++;
94-
sizeof_hidReportDescriptor += node->cb->length;
94+
sizeof_hidReportDescriptor += (uint16_t)node->cb->length;
9595
}
9696

9797
void HID_::SendReport(u8 id, const void* data, int len)

‎hardware/arduino/avr/libraries/HID/HID.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
4646

4747
typedef struct __attribute__((packed)) {
48-
u8 length;
48+
uint16_t length;
4949
const void* descriptor;
5050
} HID_Descriptor;
5151

@@ -88,10 +88,10 @@ typedef struct
8888
#define HID_TX HID_ENDPOINT_INT
8989

9090
#define D_HIDREPORT(_descriptorLength) \
91-
{ 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 }
91+
{ 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength & 0xFF, _descriptorLength >> 8 }
9292

9393
#define WEAK __attribute__ ((weak))
9494

9595
#endif
9696

97-
#endif
97+
#endif

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /