Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

mark boot report as padding #99

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 6 additions & 30 deletions src/BootKeyboard/BootKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,25 @@ THE SOFTWARE.
#include "HIDReportObserver.h"
#include "HID-Settings.h"

// See Appendix B of USB HID spec
// This is not from Appendix B of USB HID spec. This report intentionally
// sends everything as padding, so HID-aware hosts will ignore it.
static const uint8_t boot_keyboard_hid_descriptor_[] PROGMEM = {
// Keyboard
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP,
D_USAGE, D_USAGE_KEYBOARD,

D_COLLECTION, D_APPLICATION,
// Modifiers
D_USAGE_PAGE, D_PAGE_KEYBOARD,
D_USAGE_MINIMUM, 0xe0,
D_USAGE_MAXIMUM, 0xe7,
D_LOGICAL_MINIMUM, 0x0,
D_LOGICAL_MAXIMUM, 0x1,
D_REPORT_SIZE, 0x1,
D_REPORT_COUNT, 0x8,
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE),

// Reserved byte
D_REPORT_COUNT, 0x1,
// Report 8 bytes of padding, so HID-aware hosts will ignore
D_REPORT_COUNT, 0x8,
D_REPORT_SIZE, 0x8,
D_INPUT, (D_CONSTANT),

// LEDs
D_REPORT_COUNT, 0x5,
D_REPORT_SIZE, 0x1,
D_USAGE_PAGE, D_PAGE_LEDS,
D_USAGE_MINIMUM, 0x1,
D_USAGE_MAXIMUM, 0x5,
D_OUTPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE),
// Pad LEDs up to a byte
// 1 byte of padding for output report, so HID-aware hosts will ignore
D_REPORT_COUNT, 0x1,
D_REPORT_SIZE, 0x3,
D_REPORT_SIZE, 0x8,
D_OUTPUT, (D_CONSTANT),

// Non-modifiers
D_REPORT_COUNT, 0x6,
D_REPORT_SIZE, 0x8,
D_LOGICAL_MINIMUM, 0x0,
D_LOGICAL_MAXIMUM, 0xff,
D_USAGE_PAGE, D_PAGE_KEYBOARD,
D_USAGE_MINIMUM, 0x0,
D_USAGE_MAXIMUM, 0xff,
D_INPUT, (D_DATA | D_ARRAY | D_ABSOLUTE),
D_END_COLLECTION
};

Expand Down
2 changes: 2 additions & 0 deletions src/BootKeyboard/BootKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ THE SOFTWARE.
#include "HIDTables.h"
#include "HIDAliases.h"

#define BOOTKB_AS_PADDING 1

typedef union {
// Low level key report: up to 6 keys and shift, ctrl etc at once
struct {
Expand Down