summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorgaoyichuan <[email protected]>2022-10-15 19:22:21 +0800
committergaoyichuan <[email protected]>2022-10-15 19:22:21 +0800
commit3846d5f38c465d673442db1085c69f3602e21470 (patch)
treee5c4a603b8cde812abcc5603bece78323105f12d /src/class
parent2a520fb921fceb2a8e6182bff073c4a98504127f (diff)
hid: add configurable report size for fido
Diffstat (limited to 'src/class')
-rw-r--r--src/class/hid/hid_device.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/class/hid/hid_device.h b/src/class/hid/hid_device.h
index d6cf27bd8..a9f47d644 100644
--- a/src/class/hid/hid_device.h
+++ b/src/class/hid/hid_device.h
@@ -353,7 +353,9 @@ static inline bool tud_hid_gamepad_report(uint8_t report_id, int8_t x, int8_t y
HID_COLLECTION_END \
// FIDO U2F Authenticator Descriptor Template
-#define TUD_HID_REPORT_DESC_FIDO_U2F(...) \
+// - 1st parameter is report size, which is 64 bytes maximum in U2F
+// - 2nd parameter is HID_REPORT_ID(n) (optional)
+#define TUD_HID_REPORT_DESC_FIDO_U2F(report_size, ...) \
HID_USAGE_PAGE_N ( HID_USAGE_PAGE_FIDO_ALLIANCE, 2 ) ,\
HID_USAGE ( HID_USAGE_FIDO_U2F_AUTHENTICATOR_DEVICE ) ,\
HID_COLLECTION ( HID_COLLECTION_APPLICATION ) ,\
@@ -362,16 +364,16 @@ static inline bool tud_hid_gamepad_report(uint8_t report_id, int8_t x, int8_t y
/* Usage Data In */ \
HID_USAGE ( HID_USAGE_FIDO_INPUT_REPORT_DATA ) ,\
HID_LOGICAL_MIN ( 0 ) ,\
- HID_LOGICAL_MAX_N ( 255, 2 ) ,\
+ HID_LOGICAL_MAX_N ( 0xff, 2 ) ,\
HID_REPORT_SIZE ( 8 ) ,\
- HID_REPORT_COUNT ( 64 ) ,\
+ HID_REPORT_COUNT ( report_size ) ,\
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
/* Usage Data Out */ \
HID_USAGE ( HID_USAGE_FIDO_OUTPUT_REPORT_DATA ) ,\
HID_LOGICAL_MIN ( 0 ) ,\
- HID_LOGICAL_MAX_N ( 255, 2 ) ,\
+ HID_LOGICAL_MAX_N ( 0xff, 2 ) ,\
HID_REPORT_SIZE ( 8 ) ,\
- HID_REPORT_COUNT ( 64 ) ,\
+ HID_REPORT_COUNT ( report_size ) ,\
HID_OUTPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
HID_COLLECTION_END \