Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Solved USB device class issue. #3643
Conversation
| //rt_usbd_device_set_qualifier(device, &dev_qualifier); | ||
|
|
||
| /* support HS */ | ||
| rt_usbd_device_set_qualifier(device, &dev_qualifier); |
balanceTWK
Sep 29, 2020
Member
cdc_vcom 支持 HS 应该没这么简单。可能还需要改些其他的(甚至是重构)。
//not support HS
//rt_usbd_device_set_qualifier(device, &dev_qualifier);
这笔代码是 大法师 @lymzzyh 当年注释掉,这个应该是有原因的。
下面的当年修改的 Commit 信息:
Commit: 5035662cd95d9fae90d31608329f31fac3a67362
...
...
[Components][USB Device]各个class对HS进行了适配
部分class还不支持HS,RNDIS存在暂时无法解决的已知bug
-----------------------------
components/drivers/usb/usbdevice/class/cdc_vcom.c | 19 +++++++------
components/drivers/usb/usbdevice/class/ecm.c | 30 +++++++++++---------
components/drivers/usb/usbdevice/class/hid.c | 22 +++++++++------
components/drivers/usb/usbdevice/class/mstorage.c | 30 +++++++++++---------
components/drivers/usb/usbdevice/class/rndis.c | 34 ++++++++++++-----------
5 files changed, 76 insertions(+), 59 deletions(-)
cdc_vcom 支持 HS 应该没这么简单。可能还需要改些其他的(甚至是重构)。
//not support HS
//rt_usbd_device_set_qualifier(device, &dev_qualifier);这笔代码是 大法师 @lymzzyh 当年注释掉,这个应该是有原因的。
下面的当年修改的 Commit 信息:
Commit: 5035662cd95d9fae90d31608329f31fac3a67362
...
...
[Components][USB Device]各个class对HS进行了适配
部分class还不支持HS,RNDIS存在暂时无法解决的已知bug
-----------------------------
components/drivers/usb/usbdevice/class/cdc_vcom.c | 19 +++++++------
components/drivers/usb/usbdevice/class/ecm.c | 30 +++++++++++---------
components/drivers/usb/usbdevice/class/hid.c | 22 +++++++++------
components/drivers/usb/usbdevice/class/mstorage.c | 30 +++++++++++---------
components/drivers/usb/usbdevice/class/rndis.c | 34 ++++++++++++-----------
5 files changed, 76 insertions(+), 59 deletions(-)
wosayttn
Oct 12, 2020
Author
Contributor
我們在 M487 平台上,使用 HS USB DEVICE 整合測試過 RTT USB device 的 classes 包含 VCOM, HID, Mass storage, WinUSB; 未測試過 RNDIS。
我們在 M487 平台上,使用 HS USB DEVICE 整合測試過 RTT USB device 的 classes 包含 VCOM, HID, Mass storage, WinUSB; 未測試過 RNDIS。
| @@ -246,7 +246,7 @@ static struct udevice_descriptor _dev_desc = | |||
| USB_DESC_LENGTH_DEVICE, //bLength; | |||
| USB_DESC_TYPE_DEVICE, //type; | |||
| USB_BCD_VERSION, //bcdUSB; | |||
| USB_CLASS_HID, //bDeviceClass; | |||
| 0x0, //bDeviceClass; | |||
balanceTWK
Sep 29, 2020
Member
为啥要改成 0x0 。
为啥要改成 0x0 。
wosayttn
Oct 12, 2020
Author
Contributor
改為 USB_CLASS_DEVICE(0),由 interface 指定 own class code。
改為 USB_CLASS_DEVICE(0),由 interface 指定 own class code。
| USB_CLASS_MASS_STORAGE, //bDeviceClass | ||
| 0x06, //bDeviceSubClass | ||
| 0x0, //bDeviceClass | ||
| 0x0, //bDeviceSubClass |
balanceTWK
Sep 29, 2020
Member
同上,能不能贴下这样改的相关依据不?(比如 usb 白皮书之类的截图)
同上,能不能贴下这样改的相关依据不?(比如 usb 白皮书之类的截图)
wosayttn
Oct 12, 2020
Author
Contributor
(1) 修正錯誤宣告 - USB_CLASS_MASS_STORAGE。
(2) 同步上述 "USB_CLASS_DEVICE(0),由 interface 指定 own class code。" 的做法。
(1) 修正錯誤宣告 - USB_CLASS_MASS_STORAGE。
(2) 同步上述 "USB_CLASS_DEVICE(0),由 interface 指定 own class code。" 的做法。
| @@ -347,7 +347,7 @@ const static struct uhid_comm_descriptor _hid_comm_desc = | |||
| USB_DYNAMIC | USB_DIR_IN, | |||
| USB_EP_ATTR_INT, | |||
| 0x40, | |||
| 0x01, | |||
| 0x0A, | |||
balanceTWK
Sep 29, 2020
Member
额 这样直接改成 0x0A 应该不合适吧,我这边查到的资料是:轮询间隔值 4,但对高速设备来说是 8 。 如果这个值没有严格要求,那么是不是可以改成宏,默认值 0x0A。然后开发者可以根据自己的实际情况修改调节。
额 这样直接改成 0x0A 应该不合适吧,我这边查到的资料是:轮询间隔值 4,但对高速设备来说是 8 。 如果这个值没有严格要求,那么是不是可以改成宏,默认值 0x0A。然后开发者可以根据自己的实际情况修改调节。
| @@ -486,7 +487,7 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) | |||
| dcd_ep0_send_status(func->device->dcd); | |||
| break; | |||
| case USB_HID_REQ_GET_PROTOCOL: | |||
| rt_usbd_ep0_write(func->device, &data->protocol,2); | |||
| rt_usbd_ep0_write(func->device, &data->protocol,1); | |||
balanceTWK
Sep 29, 2020
Member
还是和前面一样,贴下 USB HID 白皮书里的内容吧,需要给出依据来,才能合并。👀
还是和前面一样,贴下 USB HID 白皮书里的内容吧,需要给出依据来,才能合并。
wosayttn
Oct 12, 2020
Author
Contributor
See hid1_11.pdf

HID USB device should response Data length is 1 byte to HOST by wLength=1 in this Get_Protocol request.
See hid1_11.pdf

HID USB device should response Data length is 1 byte to HOST by wLength=1 in this Get_Protocol request.
|
M487 :虚拟串口,以及 模拟鼠标 验证 OK STM32F407-ATK : 虚拟串口 验证 OK |

拉取/合并请求描述:(PR description)
[
Enable HS device functions(VCOM, HID, MSTORAGE) for Nuvoton M487 platform.
]
以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use web browser to visit PR, and check items one by one, and ticked them if no problem.
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up