summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-07-24 22:37:44 +0700
committerhathach <[email protected]>2018-07-24 22:37:44 +0700
commit67e52af936fe85c11300355293b34b5523439d55 (patch)
treea6e3d246183d0203bb7f597fe3bdea28b78e4f54 /src/device
parenta6fede4962fb65bfb353c3a4a4f927c3fc501eb2 (diff)
fix boot mouse descriptor issue
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c9
-rw-r--r--src/device/usbd_desc.c15
2 files changed, 14 insertions, 10 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 7ae2f44c5..2b294cd3e 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -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;
diff --git a/src/device/usbd_desc.c b/src/device/usbd_desc.c
index 27bf272b2..d065ed352 100644
--- a/src/device/usbd_desc.c
+++ b/src/device/usbd_desc.c
@@ -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 =