diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2016-06-13 20:53:19 -0400 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2016-06-13 20:53:19 -0400 |
| commit | f9a740d3798ad0b17a3dd1f4bf51bef187b1dcd3 (patch) | |
| tree | f48ae52433fbfd7186dc9c71112c786237cd4cbc /firmware/usbstack | |
| parent | 68a2cca843b109bb84f8479e76bd2aea869ab48d (diff) | |
| parent | 6cf15b3627fec293d8801223175f50ae747fed45 (diff) | |
| download | rockbox-f9a740d3798ad0b17a3dd1f4bf51bef187b1dcd3.zip rockbox-f9a740d3798ad0b17a3dd1f4bf51bef187b1dcd3.tar.gz rockbox-f9a740d3798ad0b17a3dd1f4bf51bef187b1dcd3.tar.bz2 rockbox-f9a740d3798ad0b17a3dd1f4bf51bef187b1dcd3.tar.xz | |
Merge branch 'otp' into working
Diffstat (limited to 'firmware/usbstack')
| -rw-r--r-- | firmware/usbstack/usb_hid.c | 8 | ||||
| -rw-r--r-- | firmware/usbstack/usb_hid.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/firmware/usbstack/usb_hid.c b/firmware/usbstack/usb_hid.c index ed08163..2b05f5c 100644 --- a/firmware/usbstack/usb_hid.c +++ b/firmware/usbstack/usb_hid.c @@ -169,6 +169,7 @@ typedef struct } usb_hid_report_t; static usb_hid_report_t usb_hid_reports[REPORT_ID_COUNT]; +static uint8_t usb_hid_led_buf; static unsigned char report_descriptor[HID_BUF_SIZE_REPORT] USB_DEVBSS_ATTR __attribute__((aligned(32))); @@ -668,7 +669,7 @@ static int usb_hid_set_report(struct usb_ctrlrequest *req) } memset(buf, 0, length); - usb_drv_recv(EP_CONTROL, buf, length); + usb_drv_recv_blocking(EP_CONTROL, buf, length); #ifdef LOGF_ENABLE if (buf[1] & 0x01) @@ -688,6 +689,11 @@ static int usb_hid_set_report(struct usb_ctrlrequest *req) return 0; } +uint8_t usb_hid_leds(void) +{ + return usb_hid_led_buf; +} + /* called by usb_core_control_request() */ bool usb_hid_control_request(struct usb_ctrlrequest *req, unsigned char *dest) { diff --git a/firmware/usbstack/usb_hid.h b/firmware/usbstack/usb_hid.h index 917992c..f004d33 100644 --- a/firmware/usbstack/usb_hid.h +++ b/firmware/usbstack/usb_hid.h @@ -35,6 +35,9 @@ void usb_hid_transfer_complete(int ep, int dir, int status, int length); bool usb_hid_control_request(struct usb_ctrlrequest* req, unsigned char* dest); void usb_hid_send(usage_page_t usage_page, int id); +/* return led bitmap: bit 0 is num lock, 1 is caps lock, 2 is scroll lock, + * 3 is compose, 4 is kana */ +uint8_t usb_hid_leds(void); #endif |