Don't check the value of alternateSetting because it's always 0.

This commit is contained in:
László Monda
2016-02-29 15:52:26 +01:00
parent 44234f15ca
commit 9585c2c8cb

View File

@@ -62,11 +62,12 @@ usb_status_t UsbGenericHidCallback(class_handle_t handle, uint32_t event, void *
return error; return error;
} }
usb_status_t UsbGenericHidSetConfiguration(class_handle_t handle, uint8_t configuration) usb_status_t UsbGenericHidSetConfiguration(class_handle_t handle, uint8_t configuration)
{ {
if (USB_COMPOSITE_CONFIGURATION_INDEX == configuration) { if (USB_COMPOSITE_CONFIGURATION_INDEX == configuration) {
return USB_DeviceHidRecv( return USB_DeviceHidRecv(
UsbCompositeDevice.genericHidHandle, USB_GENERIC_HID_ENDPOINT_OUT_ID, UsbCompositeDevice.genericHidHandle, USB_GENERIC_HID_ENDPOINT_OUT_ID,
(uint8_t *)&UsbGenericHidDevice.buffer[UsbGenericHidDevice.bufferIndex][0], (uint8_t *)&UsbGenericHidDevice.buffer[UsbGenericHidDevice.bufferIndex][0],
USB_GENERIC_HID_OUT_BUFFER_LENGTH); USB_GENERIC_HID_OUT_BUFFER_LENGTH);
} }
@@ -77,13 +78,10 @@ usb_status_t UsbGenericHidSetInterface(class_handle_t handle, uint8_t interface,
{ {
if (USB_KEYBOARD_INTERFACE_INDEX == interface) { if (USB_KEYBOARD_INTERFACE_INDEX == interface) {
UsbCompositeDevice.currentInterfaceAlternateSetting[interface] = alternateSetting; UsbCompositeDevice.currentInterfaceAlternateSetting[interface] = alternateSetting;
if (alternateSetting == 0U) return USB_DeviceHidRecv(
{ UsbCompositeDevice.genericHidHandle, USB_GENERIC_HID_ENDPOINT_OUT_ID,
return USB_DeviceHidRecv( (uint8_t *)&UsbGenericHidDevice.buffer[UsbGenericHidDevice.bufferIndex][0],
UsbCompositeDevice.genericHidHandle, USB_GENERIC_HID_ENDPOINT_OUT_ID, USB_GENERIC_HID_OUT_BUFFER_LENGTH);
(uint8_t *)&UsbGenericHidDevice.buffer[UsbGenericHidDevice.bufferIndex][0],
USB_GENERIC_HID_OUT_BUFFER_LENGTH);
}
} }
return kStatus_USB_Error; return kStatus_USB_Error;
} }