rt-thread icon indicating copy to clipboard operation
rt-thread copied to clipboard

USB CDC驱动在win11下无法识别,看了微软的描述修改子类后正常

Open kylongmu opened this issue 3 years ago • 1 comments

拉取/合并请求描述:(PR description)

[ 解决win11下USB CDC自动安装驱动的问题,在win11下设备显示黄色感叹号,无法自动安装USB串口驱动。

NUC980-IOT开发板已测试

这是微软关于此问题的链接: https://learn.microsoft.com/zh-cn/windows-hardware/drivers/usbcon/usb-driver-installation-based-on-compatible-ids#usbsersys-installation Windows 10 及更高版本 从 Windows 10 开始,Usbser.inf 已添加到 %Systemroot%\INF 目录,该目录加载 Usbser.sys 作为设备堆栈中功能设备对象 (FDO) 。 如果设备属于通信和 CDC 控制设备类, Usbser.sys 加载。 无需编写自己的 INF 来引用驱动程序。 驱动程序是基于与包含在 Windows 中的其他 USB 设备类驱动程序相似的兼容 ID 匹配来加载的。

USB\Class_02

USB\Class_02&SubClass_02

如果要自动 加载Usbser.sys, 在设备描述符中将类代码设置为 02,将子类代码 设置为 02。 有关详细信息,请参阅 USB 通信设备类。 使用此方法时,无需为设备分发 INF 文件,因为系统使用的是 Usbser.inf。 如果设备指定类代码 02,但子类代码值不是 02,则 Usbser.sys不会自动加载 。 即插即用管理器尝试查找驱动程序。 如果找不到合适的驱动程序,则设备可能未加载驱动程序。 在这种情况下,你可能需要加载自己的驱动程序或编写引用另一个内置驱动程序的 INF。

你的解决方案是什么 (what is your solution)

更改cdc_vcom.c里面USB CDC的子类定义

在什么测试环境下测试通过 (what is the test environment)

win11 ]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • [x] 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • [x] 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • [x] 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • [x] 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • [x] 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • [x] 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • [x] 代码是高质量的 Code in this PR is of high quality
  • [x] 已经使用formatting等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

kylongmu avatar Dec 26 '22 16:12 kylongmu

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 26 '22 16:12 CLAassistant