Send the whole data for an out report
RawHID does not add the reportID again, so we need to see the first byte there For the keyboard led you can just ignore this byte
This commit is contained in:
parent
250ce02838
commit
a0edeebc61
5 changed files with 9 additions and 16 deletions
|
|
@ -118,8 +118,8 @@ void Keyboard_::send_now(void){
|
|||
#if defined(HID_KEYBOARD_LEDS_ENABLED)
|
||||
void Keyboard_::setReportData(const void* data, uint8_t len){
|
||||
// Save led state
|
||||
if(len == 1)
|
||||
leds = *(uint8_t*)data;
|
||||
if(len == 2)
|
||||
leds = *(uint8_t*)(data+1);
|
||||
}
|
||||
|
||||
uint8_t Keyboard_::getLeds(void){
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ THE SOFTWARE.
|
|||
#include "HID-Project.h"
|
||||
#include "ImprovedKeylayouts.h"
|
||||
|
||||
// Low level key report: up to 6 keys and shift, ctrl etc at once
|
||||
typedef union{
|
||||
// Low level key report: up to 6 keys and shift, ctrl etc at once
|
||||
uint8_t whole8[];
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ void NKROKeyboard_::send_now(void){
|
|||
#if defined(HID_KEYBOARD_LEDS_ENABLED)
|
||||
void NKROKeyboard_::setReportData(const void* data, uint8_t len){
|
||||
// Save led state
|
||||
if(len == 1)
|
||||
leds = *(uint8_t*)data;
|
||||
if(len == 2)
|
||||
leds = *(uint8_t*)(data+1);
|
||||
}
|
||||
|
||||
uint8_t NKROKeyboard_::getLeds(void){
|
||||
|
|
|
|||
|
|
@ -171,16 +171,10 @@ bool HID_::HID_Setup(USBSetup& setup, u8 i)
|
|||
uint8_t length = setup.wLength;
|
||||
uint8_t data[length];
|
||||
USB_RecvControl(data, length);
|
||||
|
||||
// Skip report ID data, if any
|
||||
if(ID){
|
||||
current->setReportData(data+1, length-1);
|
||||
}
|
||||
// TODO test this case
|
||||
else{
|
||||
current->setReportData(data, length);
|
||||
}
|
||||
|
||||
// Data may contain the report ID again (Keyboard), maybe not (RawHID)
|
||||
current->setReportData(data, length);
|
||||
|
||||
// Dont search any further
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ HIDDevice((uint8_t*)teensykeyboard_hid_report_desc, sizeof(teensykeyboard_hid_re
|
|||
#if defined(HID_KEYBOARD_LEDS_ENABLED)
|
||||
void usb_keyboard_class::setReportData(const void* data, uint8_t len){
|
||||
// Save led state
|
||||
if(len == 1)
|
||||
leds = *(uint8_t*)data;
|
||||
if(len == 2)
|
||||
leds = *(uint8_t*)(data+1);
|
||||
}
|
||||
|
||||
uint8_t usb_keyboard_class::getLeds(void){
|
||||
|
|
|
|||
Loading…
Reference in a new issue