Skip to content

Commit

Permalink
Fixing Sleep/Resume keys on macOS and Windows 10
Browse files Browse the repository at this point in the history
- macOS requires that the system control block be no larger than (129-183)
- Windows 10 requires that the array values be 0-indexed
- Linux doesn't care, and happily uses anything that follows the spec
(or even breaks it slightly)
  • Loading branch information
haata committed Feb 18, 2019
1 parent 3ba7436 commit f3af41c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Output/USB/arm/usb_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ static uint8_t sys_ctrl_report_desc[] = {
0x05, 0x01, // Usage Page (Generic Desktop),
0x75, 0x08, // Report Size (8),
0x95, 0x01, // Report Count (1),
0x15, 0x81, // Logical Minimum (129), <-- Must be 0x81/129 to fix macOS scrollbar issues
0x25, 0xB7, // Logical Maximum (183),
0x19, 0x81, // Usage Minimum (129),
0x15, 0x01, // Logical Minimum (1), <-- Must start from 1 to resolve MS Windows problems
0x25, 0x37, // Logical Maximum (55),
0x19, 0x81, // Usage Minimum (129), <-- Must be 0x81/129 to fix macOS scrollbar issues
0x29, 0xB7, // Usage Maximum (183),
0x81, 0x00, // Input (Data, Array),
0xC0, // End Collection - Consumer Control
Expand Down
2 changes: 1 addition & 1 deletion Output/USB/arm/usb_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void usb_keyboard_send( USBKeys *buffer, uint8_t protocol )

*tx_buf++ = (uint8_t)(buffer->cons_ctrl & 0x00FF);
*tx_buf++ = (uint8_t)(buffer->cons_ctrl >> 8);
*tx_buf = buffer->sys_ctrl;
*tx_buf = buffer->sys_ctrl - 0x80;
tx_packet->len = 3;

// Send USB Packet
Expand Down

0 comments on commit f3af41c

Please sign in to comment.