[单片机芯片] WCH-LINK 在Linux 环境下发现不了

[复制链接]
9997|21
 楼主| zsm123 发表于 2021-9-30 21:41 | 显示全部楼层 |阅读模式
环境: Linux ( ubuntu, debian 都试验过)
硬件: WCH-Link, 现工作在 arm 模式下(蓝灯亮)

问题:"pyocd list" 可以在 windows 下正常发现 wch link, 但是在 Linux 下, 却无法正常适用。报告如下问题,
  1. $ pyocd list -v
  2. 0000252:DEBUG:session:Project directory: /home/myhome
  3. 0000282:DEBUG:pyusb_backend:Error accessing USB device (VID=1a86 PID=8011): The device has no langid (permission issue, no string descriptors supported or device error)
  4. 0000282:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=80ee PID=0021). This can probably be remedied with a udev rule. See <https://github.com/pyocd/pyOCD/tree/master/udev> for help.
  5. 0000303:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=80ee PID=0021). This can probably be remedied with a udev rule. See <https://github.com/pyocd/pyOCD/tree/master/udev> for help.
  6. 0000309:DEBUG:pemicro:Opened PEMicro library: /usr/local/lib/python3.7/dist-packages/pypemicro/libs/Linux/unitacmp-64.so
  7. No available debug probes are connected


我已经执行过 MRS 目录下的“beforeinstall/start.sh”, 也就意味着设备应该可以被系统发现。

这个大概是什么问题呢?
 楼主| zsm123 发表于 2021-10-3 19:16 | 显示全部楼层
沁恒的人在不?

我在如下页面中找到类似的问题,
https://github.com/pyocd/pyOCD/issues/1121

但是我的问题好像还不是这样,我机器上的输出如下,
  1. $ python3 -c "import pprint, hid ; pprint.pprint(hid.enumerate())"
  2. [{'interface_number': 0,
  3.   'manufacturer_string': 'VirtualBox',
  4.   'path': b'/dev/hidraw0',
  5.   'product_id': 33,
  6.   'product_string': 'USB Tablet',
  7.   'release_number': 256,
  8.   'serial_number': '',
  9.   'usage': 0,
  10.   'usage_page': 0,
  11.   'vendor_id': 33006},
  12. {'interface_number': 2,
  13.   'manufacturer_string': 'wch.cn',
  14.   'path': b'/dev/hidraw1',
  15.   'product_id': 32785,
  16.   'product_string': 'WCH-Link',
  17.   'release_number': 513,
  18.   'serial_number': '0001A0000001',
  19.   'usage': 0,
  20.   'usage_page': 0,
  21.   'vendor_id': 6790}]


好像这个 path 中也不包含 cmsis-dap 字样。 而且,  usage, usage_page 都是0.

沁恒, 能够不能够及时修复这个问题?

或者, 把源码开放一下?
 楼主| zsm123 发表于 2021-10-3 19:31 | 显示全部楼层
另外, Windows 下打印的信息如下,

  1. {'interface_number': 2,
  2.   'manufacturer_string': 'wch.cn',
  3.   'path': b'\\\\?\\hid#vid_1a86&pid_8011&mi_02#7&36b529fd&0&0000#{4d1e55b2-f16f'
  4.           b'-11cf-88cb-001111000030}',
  5.   'product_id': 32785,
  6.   'product_string': 'WCH CMSIS-DAP',
  7.   'release_number': 513,
  8.   'serial_number': '0001A0000001',
  9.   'usage': 1,
  10.   'usage_page': 65280,
  11.   'vendor_id': 6790},



疑问: Windows 环境下报的信息和 Linux 下报的信息怎么不同?
wonderfullook 发表于 2021-10-4 16:18 | 显示全部楼层
zsm123 发表于 2021-10-3 19:31
另外, Windows 下打印的信息如下,

现在是假期时间。等到收假后再等等回复
 楼主| zsm123 发表于 2021-10-8 12:44 | 显示全部楼层
wonderfullook 发表于 2021-10-4 16:18
现在是假期时间。等到收假后再等等回复

多谢!

更新下, 上面的Linux 的输出是在 virtualbox VM上的。 下面给出一个真实 Linux 物理机的输出,Ubuntu 20.04.3 LTS,
  1. $ python3 -c "import pprint, hid ; pprint.pprint(hid.enumerate())"
  2. [{'interface_number': 2,
  3.   'manufacturer_string': 'wch.cn',
  4.   'path': b'/dev/hidraw0',
  5.   'product_id': 32785,
  6.   'product_string': 'WCH-Link',
  7.   'release_number': 513,
  8.   'serial_number': '0001A0000001',
  9.   'usage': 57919,
  10.   'usage_page': 560,
  11.   'vendor_id': 6790}]
 楼主| zsm123 发表于 2021-10-8 13:15 | 显示全部楼层
本帖最后由 zsm123 于 2021-10-8 13:28 编辑

之前实验的固件版本是 2.1, 现在切换到了1.2, 现象一样, kernel log 如下
  1. [693466.244338] usb 1-1.1.1: new full-speed USB device number 25 using ehci-pci
  2. [693466.475020] usb 1-1.1.1: New USB device found, idVendor=1a86, idProduct=8011, bcdDevice= 1.02
  3. [693466.475028] usb 1-1.1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
  4. [693466.475031] usb 1-1.1.1: Product: WCH-Link
  5. [693466.475034] usb 1-1.1.1: Manufacturer: wch.cn
  6. [693466.475036] usb 1-1.1.1: SerialNumber: 0001A0000001
  7. [693466.475877] cdc_acm 1-1.1.1:1.0: ttyACM0: USB ACM device
  8. [693466.480197] hid-generic 0003:1A86:8011.000B: hiddev0,hidraw0: USB HID v1.00 Device [wch.cn WCH-Link] on usb-0000:00:1a.0-1.1.1/input2

更多 log,
  1. $ lsusb -d 0x1a86:0x8011 -vv

  2. Bus 001 Device 026: ID 1a86:8011 QinHeng Electronics
  3. Device Descriptor:
  4.   bLength                18
  5.   bDescriptorType         1
  6.   bcdUSB               2.00
  7.   bDeviceClass          239 Miscellaneous Device
  8.   bDeviceSubClass         2
  9.   bDeviceProtocol         1 Interface Association
  10.   bMaxPacketSize0         8
  11.   idVendor           0x1a86 QinHeng Electronics
  12.   idProduct          0x8011
  13.   bcdDevice            1.02
  14.   iManufacturer           1 wch.cn
  15.   iProduct                2 WCH-Link
  16.   iSerial                 3 0001A0000001
  17.   bNumConfigurations      1
  18.   Configuration Descriptor:
  19.     bLength                 9
  20.     bDescriptorType         2
  21.     wTotalLength       0x006b
  22.     bNumInterfaces          3
  23.     bConfigurationValue     1
  24.     iConfiguration          0
  25.     bmAttributes         0x80
  26.       (Bus Powered)
  27.     MaxPower              500mA
  28.     Interface Association:
  29.       bLength                 8
  30.       bDescriptorType        11
  31.       bFirstInterface         0
  32.       bInterfaceCount         2
  33.       bFunctionClass          2 Communications
  34.       bFunctionSubClass       2 Abstract (modem)
  35.       bFunctionProtocol       1 AT-commands (v.25ter)
  36.       iFunction               4 WCH CMSIS-DAP
  37.     Interface Descriptor:
  38.       bLength                 9
  39.       bDescriptorType         4
  40.       bInterfaceNumber        0
  41.       bAlternateSetting       0
  42.       bNumEndpoints           1
  43.       bInterfaceClass         2 Communications
  44.       bInterfaceSubClass      2 Abstract (modem)
  45.       bInterfaceProtocol      0
  46.       iInterface              4 WCH CMSIS-DAP
  47.       CDC Header:
  48.         bcdCDC               1.10
  49.       CDC Call Management:
  50.         bmCapabilities       0x01
  51.           call management
  52.         bDataInterface          1
  53.       CDC ACM:
  54.         bmCapabilities       0x02
  55.           line coding and serial state
  56.       CDC Union:
  57.         bMasterInterface        0
  58.         bSlaveInterface         1
  59.       Endpoint Descriptor:
  60.         bLength                 7
  61.         bDescriptorType         5
  62.         bEndpointAddress     0x83  EP 3 IN
  63.         bmAttributes            2
  64.           Transfer Type            Bulk
  65.           Synch Type               None
  66.           Usage Type               Data
  67.         wMaxPacketSize     0x0040  1x 64 bytes
  68.         bInterval               0
  69.     Interface Descriptor:
  70.       bLength                 9
  71.       bDescriptorType         4
  72.       bInterfaceNumber        2
  73.       bAlternateSetting       0
  74.       bNumEndpoints           2
  75.       bInterfaceClass         3 Human Interface Device
  76.       bInterfaceSubClass      0
  77.       bInterfaceProtocol      0
  78.       iInterface              6 (error)
  79.         HID Device Descriptor:
  80.           bLength                 9
  81.           bDescriptorType        33
  82.           bcdHID               1.00
  83.           bCountryCode            0 Not supported
  84.           bNumDescriptors         1
  85.           bDescriptorType        34 Report
  86.           wDescriptorLength      33
  87.          Report Descriptors:
  88.            ** UNAVAILABLE **
  89.       Endpoint Descriptor:
  90.         bLength                 7
  91.         bDescriptorType         5
  92.         bEndpointAddress     0x81  EP 1 IN
  93.         bmAttributes            3
  94.           Transfer Type            Interrupt
  95.           Synch Type               None
  96.           Usage Type               Data
  97.         wMaxPacketSize     0x0040  1x 64 bytes
  98.         bInterval               1
  99.       Endpoint Descriptor:
  100.         bLength                 7
  101.         bDescriptorType         5
  102.         bEndpointAddress     0x01  EP 1 OUT
  103.         bmAttributes            3
  104.           Transfer Type            Interrupt
  105.           Synch Type               None
  106.           Usage Type               Data
  107.         wMaxPacketSize     0x0040  1x 64 bytes
  108.         bInterval               1
  109. can't get debug descriptor: Resource temporarily unavailable
  110. cannot read device status, Resource temporarily unavailable (11)


BTW, 这个帖子的标题应该要改一下, 应该说 pyocd 发现不了 wch link.


qq172179 发表于 2021-10-8 15:04 | 显示全部楼层
UDEV规则问题吧   可以看看pyocd对UDEV规则的要求

评论

已经添加了规则了。应该已经 work了。 [code] /etc/udev/rules.d$ cat 50-wchlink.rules # wch link ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="8011", MODE:="0666", GROUP="plugdev", TAG+="uaccess" [/code]  发表于 2021-10-8 16:17
 楼主| zsm123 发表于 2021-10-8 16:18 | 显示全部楼层
本帖最后由 zsm123 于 2021-10-8 17:11 编辑
qq172179 发表于 2021-10-8 15:04
UDEV规则问题吧   可以看看pyocd对UDEV规则的要求

已经添加了规则了, 规则应该已经 work, 但是问题一直存在。 如果 不加规则, 用 sudo 应该也可以的。 sudo 现在打印出的错误信息一样。
  1. /etc/udev/rules.d$ cat 50-wchlink.rules
  2. # wch link

  3. ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="8011", MODE:="0666", GROUP="plugdev", TAG+="uaccess"
weifeng90 发表于 2021-10-9 08:16 来自手机 | 显示全部楼层
对Linux不熟悉
mutable 发表于 2021-11-2 17:25 | 显示全部楼层
都是在linux下开发么
chenjun89 发表于 2021-11-3 08:01 来自手机 | 显示全部楼层
看来楼主喜欢在Linux操作啊
uiint 发表于 2021-11-4 21:38 | 显示全部楼层
是没有驱动吗?
hellosdc 发表于 2021-11-4 21:38 | 显示全部楼层
这个驱动程序的问题。   
mituzu 发表于 2021-11-4 21:38 | 显示全部楼层
再windows系统没问题吧     
suzhanhua 发表于 2021-11-4 21:39 | 显示全部楼层
zsm123 发表于 2021-10-8 13:15
之前实验的固件版本是 2.1, 现在切换到了1.2, 现象一样, kernel log 如下

更多 log,

不是驱动吗?  
xietingfeng 发表于 2021-11-4 21:39 | 显示全部楼层
楼主解决了问题吗?   
isseed 发表于 2021-11-4 21:39 | 显示全部楼层
使用的VS吗?        
wangdezhi 发表于 2021-11-4 21:39 | 显示全部楼层
usb设备查不到吗      
biechedan 发表于 2021-11-4 21:40 | 显示全部楼层
zsm123 发表于 2021-10-8 16:18
已经添加了规则了, 规则应该已经 work, 但是问题一直存在。 如果 不加规则, 用 sudo 应该也可以的。 su ...

设备有问题?        
chenci2013 发表于 2021-11-4 21:40 | 显示全部楼层
WCH-LINK如何安装linux驱动的?  
您需要登录后才可以回帖 登录 | 注册

本版积分规则

7

主题

38

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部