descriptor changes + always force report id

This commit is contained in:
dnaq 2021-09-27 21:06:15 +02:00
parent 71d7f67efd
commit 8dc4d2a9ea
4 changed files with 13 additions and 12 deletions

View file

@ -1100,19 +1100,19 @@ void console_task(void) {
#ifdef PLOVER_HID_ENABLE
static bool plover_hid_report_updated = false;
static uint8_t plover_hid_current_report[PLOVER_HID_EPSIZE] = {0};
static uint8_t plover_hid_current_report[PLOVER_HID_EPSIZE] = {0x50};
void plover_hid_update(uint8_t button, bool pressed) {
if (pressed) {
plover_hid_current_report[button/8] |= (1 << (7 - (button % 8)));
plover_hid_current_report[1 + button/8] |= (1 << (7 - (button % 8)));
} else {
plover_hid_current_report[button/8] &= ~(1 << (7 - (button % 8)));
plover_hid_current_report[1 + button/8] &= ~(1 << (7 - (button % 8)));
}
plover_hid_report_updated = true;
}
void plover_hid_task(void) {
if (plover_hid_report_updated) {
chnWrite(&drivers.plover_hid_driver.driver, plover_hid_current_report, PLOVER_HID_EPSIZE);
chnWrite(&drivers.plover_hid_driver.driver, plover_hid_current_report, sizeof(plover_hid_current_report));
plover_hid_report_updated = false;
}
}

View file

@ -215,12 +215,12 @@ static void raw_hid_task(void) {
#ifdef PLOVER_HID_ENABLE
static bool plover_hid_report_updated = false;
static uint8_t plover_hid_current_report[PLOVER_HID_EPSIZE] = {0};
static uint8_t plover_hid_current_report[PLOVER_HID_EPSIZE] = {0x50};
void plover_hid_update(uint8_t button, bool pressed) {
if (pressed) {
plover_hid_current_report[button/8] |= (1 << (7 - (button % 8)));
plover_hid_current_report[1 + button/8] |= (1 << (7 - (button % 8)));
} else {
plover_hid_current_report[button/8] &= ~(1 << (7 - (button % 8)));
plover_hid_current_report[1 + button/8] &= ~(1 << (7 - (button % 8)));
}
plover_hid_report_updated = true;
}
@ -239,7 +239,7 @@ void plover_hid_task(void) {
if (Endpoint_IsINReady()) {
// Write data
Endpoint_Write_Stream_LE(plover_hid_current_report, PLOVER_HID_EPSIZE, NULL);
Endpoint_Write_Stream_LE(plover_hid_current_report, sizeof(plover_hid_current_report), NULL);
// Finalize The stream transfer to send the last packet
Endpoint_ClearIN();
plover_hid_report_updated = false;

View file

@ -327,12 +327,13 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM PloverReport[] = {
0x06, 0x50, 0xff, // UsagePage (65360)
0x0a, 0x56, 0x4c, // Usage (19542)
0xa1, 0x02, // Collection (Logical)
0x85, 0x50, // ReportID (80)
0x25, 0x01, // LogicalMaximum (1)
0x75, 0x01, // ReportSize (1)
0x95, 0x40, // ReportCount (64)
0x05, 0x09, // UsagePage (button)
0x19, 0x00, // UsageMinimum (Button(0))
0x29, 0x3f, // UsageMaximum (Button(63))
0x05, 0x0a, // UsagePage (ordinal)
0x19, 0x00, // UsageMinimum (Ordinal(0))
0x29, 0x3f, // UsageMaximum (Ordinal(63))
0x81, 0x02, // Input (Variable)
0xc0, // EndCollection
};

View file

@ -319,7 +319,7 @@ enum usb_endpoints {
#define SHARED_EPSIZE 32
#define MOUSE_EPSIZE 8
#define RAW_EPSIZE 32
#define PLOVER_HID_EPSIZE 8
#define PLOVER_HID_EPSIZE 9
#define CONSOLE_EPSIZE 32
#define MIDI_STREAM_EPSIZE 64
#define CDC_NOTIFICATION_EPSIZE 8