Tweak HID protocol defines

USG_1.0
Robert Fisk 7 years ago
parent e890e9df7a
commit 3276449378

@ -263,8 +263,8 @@ HID_HandleTypeDef;
/* Interface Descriptor field values for HID Boot Protocol */ /* Interface Descriptor field values for HID Boot Protocol */
#define HID_BOOT_CODE 0x01 #define HID_BOOT_CODE 0x01
#define HID_KEYBRD_BOOT_CODE 0x01 #define HID_KEYBRD_PROTOCOL 0x01
#define HID_MOUSE_BOOT_CODE 0x02 #define HID_MOUSE_PROTOCOL 0x02
/** /**

@ -147,12 +147,12 @@ static USBH_StatusTypeDef USBH_HID_InterfaceInit (USBH_HandleTypeDef *phost)
#ifdef CONFIG_MOUSE_ENABLED #ifdef CONFIG_MOUSE_ENABLED
interface = USBH_FindInterface(phost, phost->pActiveClass->ClassCode, HID_BOOT_CODE, HID_MOUSE_BOOT_CODE); //Search for mouse interfaces first interface = USBH_FindInterface(phost, phost->pActiveClass->ClassCode, HID_BOOT_CODE, HID_MOUSE_PROTOCOL); //Search for mouse interfaces first
#endif #endif
#ifdef CONFIG_KEYBOARD_ENABLED #ifdef CONFIG_KEYBOARD_ENABLED
if (interface == 0xFF) if (interface == 0xFF)
{ {
interface = USBH_FindInterface(phost, phost->pActiveClass->ClassCode, HID_BOOT_CODE, HID_KEYBRD_BOOT_CODE); interface = USBH_FindInterface(phost, phost->pActiveClass->ClassCode, HID_BOOT_CODE, HID_KEYBRD_PROTOCOL);
} }
#endif #endif
@ -315,7 +315,7 @@ static USBH_StatusTypeDef USBH_HID_ClassRequest(USBH_HandleTypeDef *phost)
//Mouse in 'report' mode, //Mouse in 'report' mode,
//Keyboard in 'boot' mode //Keyboard in 'boot' mode
if (USBH_HID_SetProtocol(phost, if (USBH_HID_SetProtocol(phost,
(HID_Handle->Protocol == HID_MOUSE_BOOT_CODE ? 1 : 0)) == USBH_OK) (HID_Handle->Protocol == HID_MOUSE_PROTOCOL ? 1 : 0)) == USBH_OK)
{ {
HID_Handle->ctl_state = HID_REQ_IDLE; HID_Handle->ctl_state = HID_REQ_IDLE;
@ -681,12 +681,12 @@ HID_TypeTypeDef USBH_HID_GetDeviceType(USBH_HandleTypeDef *phost)
{ {
if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol \ if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol \
== HID_KEYBRD_BOOT_CODE) == HID_KEYBRD_PROTOCOL)
{ {
type = HID_KEYBOARD; type = HID_KEYBOARD;
} }
else if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol \ else if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol \
== HID_MOUSE_BOOT_CODE) == HID_MOUSE_PROTOCOL)
{ {
type= HID_MOUSE; type= HID_MOUSE;
} }

@ -55,7 +55,7 @@ InterfaceCommandClassTypeDef Downstream_HID_ApproveConnectedDevice(void)
HID_HandleTypeDef* HID_Handle = (HID_HandleTypeDef*)hUsbHostFS.pActiveClass->pData; HID_HandleTypeDef* HID_Handle = (HID_HandleTypeDef*)hUsbHostFS.pActiveClass->pData;
#ifdef CONFIG_MOUSE_ENABLED #ifdef CONFIG_MOUSE_ENABLED
if (HID_Handle->Protocol == HID_MOUSE_BOOT_CODE) if (HID_Handle->Protocol == HID_MOUSE_PROTOCOL)
{ {
if (Downstream_HID_Mouse_ParseReportDescriptor() == HAL_OK) if (Downstream_HID_Mouse_ParseReportDescriptor() == HAL_OK)
{ {
@ -64,7 +64,7 @@ InterfaceCommandClassTypeDef Downstream_HID_ApproveConnectedDevice(void)
} }
#endif #endif
#ifdef CONFIG_KEYBOARD_ENABLED #ifdef CONFIG_KEYBOARD_ENABLED
if (HID_Handle->Protocol == HID_KEYBRD_BOOT_CODE) if (HID_Handle->Protocol == HID_KEYBRD_PROTOCOL)
{ {
return COMMAND_CLASS_HID_KEYBOARD; //success! return COMMAND_CLASS_HID_KEYBOARD; //success!
} }

@ -74,8 +74,8 @@
#define HID_REQ_SET_REPORT 0x09 #define HID_REQ_SET_REPORT 0x09
#define HID_REQ_GET_REPORT 0x01 #define HID_REQ_GET_REPORT 0x01
#define HID_KEYBRD_BOOT_CODE 0x01 #define HID_KEYBRD_PROTOCOL 0x01
#define HID_MOUSE_BOOT_CODE 0x02 #define HID_MOUSE_PROTOCOL 0x02
/** /**
* @} * @}

@ -310,7 +310,7 @@ void USBD_HID_PreinitMouse(void)
OutReportSize = HID_MOUSE_OUTPUT_DATA_LEN; OutReportSize = HID_MOUSE_OUTPUT_DATA_LEN;
USBD_HID.USBDevPid = USBD_PID_MOUSE; USBD_HID.USBDevPid = USBD_PID_MOUSE;
USBD_HID_CfgDesc[USB_HID_CFGDESC__INTERFACE_PROTOCOL_OFFSET] = HID_MOUSE_BOOT_CODE; USBD_HID_CfgDesc[USB_HID_CFGDESC__INTERFACE_PROTOCOL_OFFSET] = HID_MOUSE_PROTOCOL;
USBD_HID_CfgDesc[USB_HID_CFGDESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_MOUSE_REPORT_DESC_SIZE; USBD_HID_CfgDesc[USB_HID_CFGDESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_MOUSE_REPORT_DESC_SIZE;
USBD_HID_CfgDesc[USB_HID_CFGDESC__EPIN_SIZE_OFFSET] = HID_MOUSE_INPUT_DATA_LEN; USBD_HID_CfgDesc[USB_HID_CFGDESC__EPIN_SIZE_OFFSET] = HID_MOUSE_INPUT_DATA_LEN;
USBD_HID_Desc[USB_HID_DESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_MOUSE_REPORT_DESC_SIZE; USBD_HID_Desc[USB_HID_DESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_MOUSE_REPORT_DESC_SIZE;
@ -327,7 +327,7 @@ void USBD_HID_PreinitKeyboard(void)
OutReportSize = HID_KEYBOARD_OUTPUT_DATA_LEN; OutReportSize = HID_KEYBOARD_OUTPUT_DATA_LEN;
USBD_HID.USBDevPid = USBD_PID_KEYBOARD; USBD_HID.USBDevPid = USBD_PID_KEYBOARD;
USBD_HID_CfgDesc[USB_HID_CFGDESC__INTERFACE_PROTOCOL_OFFSET] = HID_KEYBRD_BOOT_CODE; USBD_HID_CfgDesc[USB_HID_CFGDESC__INTERFACE_PROTOCOL_OFFSET] = HID_KEYBRD_PROTOCOL;
USBD_HID_CfgDesc[USB_HID_CFGDESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_KEYBOARD_REPORT_DESC_SIZE; USBD_HID_CfgDesc[USB_HID_CFGDESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_KEYBOARD_REPORT_DESC_SIZE;
USBD_HID_CfgDesc[USB_HID_CFGDESC__EPIN_SIZE_OFFSET] = HID_KEYBOARD_INPUT_DATA_LEN; USBD_HID_CfgDesc[USB_HID_CFGDESC__EPIN_SIZE_OFFSET] = HID_KEYBOARD_INPUT_DATA_LEN;
USBD_HID_Desc[USB_HID_DESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_KEYBOARD_REPORT_DESC_SIZE; USBD_HID_Desc[USB_HID_DESC__HID_REPORT_DESC_SIZE_OFFSET] = HID_KEYBOARD_REPORT_DESC_SIZE;

Loading…
Cancel
Save