Fixed protocol reset on reenumeration
This commit is contained in:
parent
e43f12c85e
commit
26e87b482a
5 changed files with 25 additions and 5 deletions
|
|
@ -70,7 +70,7 @@ static const uint8_t _hidReportDescriptorKeyboard[] PROGMEM = {
|
|||
0xc0 /* END_COLLECTION */
|
||||
};
|
||||
|
||||
BootKeyboard_::BootKeyboard_(void) : PluggableUSBModule(1, 1, epType), protocol(1), idle(1), leds(0)
|
||||
BootKeyboard_::BootKeyboard_(void) : PluggableUSBModule(1, 1, epType), protocol(HID_REPORT_PROTOCOL), idle(1), leds(0)
|
||||
{
|
||||
epType[0] = EP_TYPE_INTERRUPT_IN;
|
||||
PluggableUSB().plug(this);
|
||||
|
|
@ -96,6 +96,10 @@ int BootKeyboard_::getDescriptor(USBSetup& setup)
|
|||
// In a HID Class Descriptor wIndex cointains the interface number
|
||||
if (setup.wIndex != pluggedInterface) { return 0; }
|
||||
|
||||
// Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol
|
||||
// due to the USB specs, but Windows and Linux just assumes its in report mode.
|
||||
protocol = HID_REPORT_PROTOCOL;
|
||||
|
||||
return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorKeyboard, sizeof(_hidReportDescriptorKeyboard));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static const uint8_t _hidReportDescriptorMouse[] PROGMEM = {
|
|||
0xc0 /* END_COLLECTION */
|
||||
};
|
||||
|
||||
BootMouse_::BootMouse_(void) : PluggableUSBModule(1, 1, epType), protocol(1), idle(1)
|
||||
BootMouse_::BootMouse_(void) : PluggableUSBModule(1, 1, epType), protocol(HID_REPORT_PROTOCOL), idle(1)
|
||||
{
|
||||
epType[0] = EP_TYPE_INTERRUPT_IN;
|
||||
PluggableUSB().plug(this);
|
||||
|
|
@ -80,6 +80,10 @@ int BootMouse_::getDescriptor(USBSetup& setup)
|
|||
// In a HID Class Descriptor wIndex cointains the interface number
|
||||
if (setup.wIndex != pluggedInterface) { return 0; }
|
||||
|
||||
// Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol
|
||||
// due to the USB specs, but Windows and Linux just assumes its in report mode.
|
||||
protocol = HID_REPORT_PROTOCOL;
|
||||
|
||||
return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorMouse, sizeof(_hidReportDescriptorMouse));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ static const uint8_t _hidReportDescriptorRawHID[] PROGMEM = {
|
|||
0xC0 /* end collection */
|
||||
};
|
||||
|
||||
RawHID_::RawHID_(void) : PluggableUSBModule(1, 1, epType), protocol(1), idle(1), dataLength(0)
|
||||
RawHID_::RawHID_(void) : PluggableUSBModule(1, 1, epType), protocol(HID_REPORT_PROTOCOL), idle(1), dataLength(0)
|
||||
{
|
||||
epType[0] = EP_TYPE_INTERRUPT_IN;
|
||||
PluggableUSB().plug(this);
|
||||
|
|
@ -75,6 +75,10 @@ int RawHID_::getDescriptor(USBSetup& setup)
|
|||
// In a HID Class Descriptor wIndex cointains the interface number
|
||||
if (setup.wIndex != pluggedInterface) { return 0; }
|
||||
|
||||
// Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol
|
||||
// due to the USB specs, but Windows and Linux just assumes its in report mode.
|
||||
protocol = HID_REPORT_PROTOCOL;
|
||||
|
||||
return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorRawHID, sizeof(_hidReportDescriptorRawHID));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ static const uint8_t _hidReportDescriptorGamepad[] PROGMEM = {
|
|||
0xc0 /* END_COLLECTION */
|
||||
};
|
||||
|
||||
SingleGamepad_::SingleGamepad_(void) : PluggableUSBModule(1, 1, epType), protocol(1), idle(1)
|
||||
SingleGamepad_::SingleGamepad_(void) : PluggableUSBModule(1, 1, epType), protocol(HID_REPORT_PROTOCOL), idle(1)
|
||||
{
|
||||
epType[0] = EP_TYPE_INTERRUPT_IN;
|
||||
PluggableUSB().plug(this);
|
||||
|
|
@ -96,6 +96,10 @@ int SingleGamepad_::getDescriptor(USBSetup& setup)
|
|||
// In a HID Class Descriptor wIndex cointains the interface number
|
||||
if (setup.wIndex != pluggedInterface) { return 0; }
|
||||
|
||||
// Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol
|
||||
// due to the USB specs, but Windows and Linux just assumes its in report mode.
|
||||
protocol = HID_REPORT_PROTOCOL;
|
||||
|
||||
return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorGamepad, sizeof(_hidReportDescriptorGamepad));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static const uint8_t _hidReportDescriptorNKRO[] PROGMEM = {
|
|||
0xC0 /* End Collection */
|
||||
};
|
||||
|
||||
SingleNKROKeyboard_::SingleNKROKeyboard_(void) : PluggableUSBModule(1, 1, epType), protocol(1), idle(1), leds(0)
|
||||
SingleNKROKeyboard_::SingleNKROKeyboard_(void) : PluggableUSBModule(1, 1, epType), protocol(HID_REPORT_PROTOCOL), idle(1), leds(0)
|
||||
{
|
||||
epType[0] = EP_TYPE_INTERRUPT_IN;
|
||||
PluggableUSB().plug(this);
|
||||
|
|
@ -101,6 +101,10 @@ int SingleNKROKeyboard_::getDescriptor(USBSetup& setup)
|
|||
// In a HID Class Descriptor wIndex cointains the interface number
|
||||
if (setup.wIndex != pluggedInterface) { return 0; }
|
||||
|
||||
// Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol
|
||||
// due to the USB specs, but Windows and Linux just assumes its in report mode.
|
||||
protocol = HID_REPORT_PROTOCOL;
|
||||
|
||||
return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorNKRO, sizeof(_hidReportDescriptorNKRO));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue