8000 usb hid consumer control works · sparkfun/circuitpython@ef58ada · GitHub
[go: up one dir, main page]

Skip to content
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

Appearance settings

Commit ef58ada

Browse files
committed
usb hid consumer control works
1 parent fd661c1 commit ef58ada

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

ports/nrf/common-hal/usb_hid/Device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// 1 to enable device, 0 to disable
4040
#define USB_HID_DEVICE_KEYBOARD 1
4141
#define USB_HID_DEVICE_MOUSE 1
42-
#define USB_HID_DEVICE_CONSUMER 0
42+
#define USB_HID_DEVICE_CONSUMER 1
4343
#define USB_HID_DEVICE_GAMEPAD 0
4444

4545
enum {

ports/nrf/common-hal/usb_hid/__init__.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "common-hal/usb_hid/Device.h"
3232
#include "shared-bindings/usb_hid/Device.h"
33+
#include "tusb.h"
3334

3435
#define USB_HID_REPORT_LENGTH_KEYBOARD 8
3536
#define USB_HID_REPORT_LENGTH_MOUSE 4
@@ -66,8 +67,8 @@ usb_hid_device_obj_t usb_hid_devices[USB_HID_NUM_DEVICES] = {
6667
.report_buffer = keyboard_report_buffer,
6768
.report_id = USB_HID_REPORT_ID_KEYBOARD,
6869
.report_length = USB_HID_REPORT_LENGTH_KEYBOARD,
69-
.usage_page = 0x01,
70-
.usage = 0x06,
70+
.usage_page = HID_USAGE_PAGE_DESKTOP,
71+
.usage = HID_USAGE_DESKTOP_KEYBOARD,
7172
},
7273
#endif
7374

@@ -77,28 +78,26 @@ usb_hid_device_obj_t usb_hid_devices[USB_HID_NUM_DEVICES] = {
7778
.report_buffer = mouse_report_buffer,
7879
.report_id = USB_HID_REPORT_ID_MOUSE,
7980
.report_length = USB_HID_REPORT_LENGTH_MOUSE,
80-
.usage_page = 0x01,
81-
.usage = 0x02,
81+
.usage_page = HID_USAGE_PAGE_DESKTOP,
82+
.usage = HID_USAGE_DESKTOP_MOUSE,
8283
},
8384
#endif
8485

8586
#if USB_HID_DEVICE_CONSUMER
8687
{
8788
.base = { .type = &usb_hid_device_type },
8889
.report_buffer = consumer_report_buffer,
89-
.endpoint = USB_HID_ENDPOINT_IN,
9090
.report_id = USB_HID_REPORT_ID_CONSUMER,
9191
.report_length = USB_HID_REPORT_LENGTH_CONSUMER,
92-
.usage_page = 0x0C,
93-
.usage = 0x01,
92+
.usage_page = HID_USAGE_PAGE_CONSUMER,
93+
.usage = HID_USAGE_CONSUMER_CONTROL,
9494
},
9595
#endif
9696

9797
#ifdef USB_HID_REPORT_ID_SYS_CONTROL
9898
{
9999
.base = { .type = &usb_hid_device_type },
100100
.report_buffer = sys_control_report_buffer,
101-
.endpoint = USB_HID_ENDPOINT_IN,
102101
.report_id = USB_HID_REPORT_ID_SYS_CONTROL,
103102
.report_length = USB_HID_REPORT_LENGTH_SYS_CONTROL,
104103
.usage_page = 0x01,
@@ -109,7 +108,6 @@ usb_hid_device_obj_t usb_hid_devices[USB_HID_NUM_DEVICES] = {
109108
{
110109
.base = { .type = &usb_hid_device_type },
111110
.report_buffer = gamepad_report_buffer,
112-
.endpoint = USB_HID_ENDPOINT_IN,
113111
.report_id = USB_HID_REPORT_ID_GAMEPAD,
114112
.report_length = USB_HID_REPORT_LENGTH_GAMEPAD,
115113
.usage_page = 0x01,

ports/nrf/usb/usb_desc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ uint8_t const usb_desc_hid_generic_report[] =
150150
#endif
151151

152152
#if USB_HID_DEVICE_CONSUMER
153-
HID_REPORT_DESC_MOUSE( HID_REPORT_ID(USB_HID_REPORT_ID_CONSUMER), )
153+
HID_REPORT_DESC_CONSUMER( HID_REPORT_ID(USB_HID_REPORT_ID_CONSUMER), )
154154
#endif
155155
};
156156

0 commit comments

Comments
 (0)
0