mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
fix HID descriptors bigger than 127 bytes
This commit is contained in:
parent
a989b72a1b
commit
9074b1ed18
@ -36,9 +36,9 @@ static u8 modules_count = 0;
|
||||
static PUSBListNode* rootNode = NULL;
|
||||
static PUSBListNode* lastNode = NULL;
|
||||
|
||||
int8_t PUSB_GetInterface(u8* interfaceNum)
|
||||
int PUSB_GetInterface(u8* interfaceNum)
|
||||
{
|
||||
int8_t ret = 0;
|
||||
int ret = 0;
|
||||
PUSBListNode* node = rootNode;
|
||||
for (u8 i=0; i<modules_count; i++) {
|
||||
ret = node->cb->getInterface(interfaceNum);
|
||||
@ -47,9 +47,9 @@ int8_t PUSB_GetInterface(u8* interfaceNum)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int8_t PUSB_GetDescriptor(int8_t t)
|
||||
int PUSB_GetDescriptor(int8_t t)
|
||||
{
|
||||
int8_t ret = 0;
|
||||
int ret = 0;
|
||||
PUSBListNode* node = rootNode;
|
||||
for (u8 i=0; i<modules_count && ret == 0; i++) {
|
||||
ret = node->cb->getDescriptor(t);
|
||||
|
@ -28,8 +28,8 @@
|
||||
typedef struct
|
||||
{
|
||||
bool (*setup)(Setup& setup, u8 i);
|
||||
int8_t (*getInterface)(u8* interfaceNum);
|
||||
int8_t (*getDescriptor)(int8_t t);
|
||||
int (*getInterface)(u8* interfaceNum);
|
||||
int (*getDescriptor)(int8_t t);
|
||||
int8_t numEndpoints;
|
||||
int8_t numInterfaces;
|
||||
uint8_t *endpointType;
|
||||
@ -50,9 +50,9 @@ public:
|
||||
|
||||
int8_t PUSB_AddFunction(PUSBListNode *node, u8 *interface);
|
||||
|
||||
int8_t PUSB_GetInterface(u8* interfaceNum);
|
||||
int PUSB_GetInterface(u8* interfaceNum);
|
||||
|
||||
int8_t PUSB_GetDescriptor(int8_t t);
|
||||
int PUSB_GetDescriptor(int8_t t);
|
||||
|
||||
bool PUSB_Setup(Setup& setup, u8 i);
|
||||
|
||||
|
@ -51,13 +51,13 @@ HIDDescriptor _hidInterface;
|
||||
u8 _hid_protocol = 1;
|
||||
u8 _hid_idle = 1;
|
||||
|
||||
int8_t WEAK HID_GetInterface(u8* interfaceNum)
|
||||
int HID_GetInterface(u8* interfaceNum)
|
||||
{
|
||||
interfaceNum[0] += 1; // uses 1
|
||||
return USB_SendControl(0,&_hidInterface,sizeof(_hidInterface));
|
||||
}
|
||||
|
||||
int8_t WEAK HID_GetDescriptor(int8_t t)
|
||||
int HID_GetDescriptor(int8_t t)
|
||||
{
|
||||
if (HID_REPORT_DESCRIPTOR_TYPE == t) {
|
||||
return USB_SendControl(TRANSFER_PGM,_hidReportDescriptor,getsizeof_hidReportDescriptor());
|
||||
@ -66,13 +66,13 @@ int8_t WEAK HID_GetDescriptor(int8_t t)
|
||||
}
|
||||
}
|
||||
|
||||
void WEAK HID_SendReport(u8 id, const void* data, int len)
|
||||
void HID_SendReport(u8 id, const void* data, int len)
|
||||
{
|
||||
USB_Send(HID_TX, &id, 1);
|
||||
USB_Send(HID_TX | TRANSFER_RELEASE,data,len);
|
||||
}
|
||||
|
||||
bool WEAK HID_Setup(Setup& setup, u8 i)
|
||||
bool HID_Setup(Setup& setup, u8 i)
|
||||
{
|
||||
if (HID_INTERFACE != i) {
|
||||
return false;
|
||||
|
@ -39,8 +39,8 @@ public:
|
||||
};
|
||||
|
||||
int8_t HID_Plug(void);
|
||||
int8_t HID_GetInterface(u8* interfaceNum);
|
||||
int8_t HID_GetDescriptor(int8_t t);
|
||||
int HID_GetInterface(u8* interfaceNum);
|
||||
int HID_GetDescriptor(int8_t t);
|
||||
bool HID_Setup(Setup& setup, u8 i);
|
||||
void HID_SendReport(uint8_t id, const void* data, int len);
|
||||
|
||||
|
@ -39,18 +39,18 @@ ring_bufferMIDI midi_rx_buffer = {{0,0,0,0 }, 0, 0};
|
||||
|
||||
static MIDIDescriptor _midiInterface;
|
||||
|
||||
int8_t WEAK MIDI_GetInterface(uint8_t* interfaceNum)
|
||||
int MIDI_GetInterface(uint8_t* interfaceNum)
|
||||
{
|
||||
interfaceNum[0] += 2; // uses 2
|
||||
return USB_SendControl(0,&_midiInterface,sizeof(_midiInterface));
|
||||
}
|
||||
bool WEAK MIDI_Setup(Setup& setup, u8 i)
|
||||
bool MIDI_Setup(Setup& setup, u8 i)
|
||||
{
|
||||
//Support requests here if needed. Typically these are optional
|
||||
return false;
|
||||
}
|
||||
|
||||
int8_t WEAK MIDI_GetDescriptor(int8_t t)
|
||||
int MIDI_GetDescriptor(int8_t t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user