From 11072320a9f0797350ad6a2bfcf850bef36fb632 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 27 May 2016 15:27:41 +0200 Subject: [PATCH] use ff01 usage page for debuglink --- firmware/usb.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/firmware/usb.c b/firmware/usb.c index d8ba6d9..a9af880 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -68,6 +68,26 @@ static const uint8_t hid_report_descriptor[] = { 0xc0 // END_COLLECTION }; +static const uint8_t hid_report_descriptor_debug[] = { + 0x06, 0x01, 0xff, // USAGE_PAGE (Vendor Defined) + 0x09, 0x01, // USAGE (1) + 0xa1, 0x01, // COLLECTION (Application) + 0x09, 0x20, // USAGE (Input Report Data) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x40, // REPORT_COUNT (64) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x09, 0x21, // USAGE (Output Report Data) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x40, // REPORT_COUNT (64) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0xc0 // END_COLLECTION +}; + + static const struct { struct usb_hid_descriptor hid_descriptor; struct { @@ -195,8 +215,13 @@ static int hid_control_request(usbd_device *dev, struct usb_setup_data *req, uin return 0; /* Handle the HID report descriptor. */ - *buf = (uint8_t *)hid_report_descriptor; - *len = sizeof(hid_report_descriptor); + if (req->wIndex == 1) { + *buf = (uint8_t *)hid_report_descriptor_debug; + *len = sizeof(hid_report_descriptor_debug); + } else { + *buf = (uint8_t *)hid_report_descriptor; + *len = sizeof(hid_report_descriptor); + } return 1; }