fix boot mouse descriptor issue

This commit is contained in:
hathach 2018-07-24 22:37:44 +07:00
parent a6fede4962
commit 67e52af936
2 changed files with 14 additions and 10 deletions

View File

@ -325,9 +325,9 @@ static void usbd_reset(uint8_t rhport)
tud_desc_set.hid_report.boot_keyboard = _desc_auto_hid_kbd_report;
#endif
#if CFG_TUD_HID_MOUSE && CFG_TUD_HID_BOOT_PROTOCOL
#if CFG_TUD_HID_MOUSE
extern uint8_t const _desc_auto_hid_mse_report[];
tud_desc_set.hid_report.boot_mouse = _desc_auto_hid_kbd_report;
tud_desc_set.hid_report.boot_mouse = _desc_auto_hid_mse_report;
#endif
#else
@ -353,6 +353,8 @@ static tusb_error_t proc_control_request_st(uint8_t rhport, tusb_control_request
error = TUSB_ERROR_NONE;
//------------- Standard Request e.g in enumeration -------------//
/* Microsoft Windows will awkwardly get HID Report Descriptor with
* Recipient = Device instead of Interface */
if( TUSB_REQ_RCPT_DEVICE == p_request->bmRequestType_bit.recipient &&
TUSB_REQ_TYPE_STANDARD == p_request->bmRequestType_bit.type )
{
@ -518,6 +520,9 @@ static uint16_t get_descriptor(uint8_t rhport, tusb_control_request_t const * co
}else
{
// out of range
/* The 0xee string is indeed a Microsoft USB extension.
* It can be used to tell Windows what driver it should use for the device !!!
*/
return 0;
}
break;

View File

@ -118,7 +118,7 @@
// Keyboard Report Descriptor
//--------------------------------------------------------------------+
#if CFG_TUD_HID_KEYBOARD
uint8_t const _desc_auto_hid_kbd_report[] = {
ATTR_PACKED uint8_t const _desc_auto_hid_kbd_report[] = {
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ),
HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
@ -170,7 +170,7 @@ uint8_t const _desc_auto_hid_kbd_report[] = {
// Mouse Report Descriptor
//--------------------------------------------------------------------+
#if CFG_TUD_HID_MOUSE
uint8_t const _desc_auto_hid_mse_report[] = {
ATTR_PACKED uint8_t const _desc_auto_hid_mse_report[] = {
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ),
HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
@ -189,8 +189,8 @@ uint8_t const _desc_auto_hid_mse_report[] = {
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ),
// 3 bit padding
HID_REPORT_SIZE ( 3 ),
HID_REPORT_COUNT ( 1 ),
HID_REPORT_SIZE ( 3 ),
HID_INPUT ( HID_CONSTANT ),
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
@ -202,18 +202,17 @@ uint8_t const _desc_auto_hid_mse_report[] = {
HID_REPORT_COUNT ( 2 ),
HID_REPORT_SIZE ( 8 ),
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ),
/* mouse scroll */
HID_USAGE ( HID_USAGE_DESKTOP_WHEEL ),
HID_LOGICAL_MIN ( 0x81 ), /* -127 */
HID_LOGICAL_MAX ( 0x7f ), /* 127 */
HID_REPORT_COUNT( 1 ),
HID_REPORT_SIZE ( 8 ), /* 8-bit value */
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
HID_REPORT_SIZE ( 8 ),
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ),
HID_COLLECTION_END,
HID_COLLECTION_END
};
#endif
@ -595,7 +594,7 @@ desc_auto_cfg_t const _desc_auto_config_struct =
#else
#if CFG_TUD_HID_KEYBOARD || CFG_TUD_HID_MOUSE
//------------- HID Keyboard + Mouse 9multiple reports) -------------//
//------------- HID Keyboard + Mouse (multiple reports) -------------//
.hid_composite =
{
.itf =