cypress虚拟串口(CDC_ACM)在Linux下不出现的问题

本文介绍如何在Linux环境下使具有自定义供应商ID (VID) 和产品ID (PID) 的设备可见于CyUSB GUI。包括修改配置文件、使用modprobe及udev规则等步骤,以确保设备正确识别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

网上找的高人帖子: https://community.cypress.com/thread/14010?start=0&tstart=0

关键的yidu一段话:,

I managed to access the serial port in Linux:

- change product id in usb descriptor to 0xF139 :        < 0x39,0xF1,                      /* Product ID */ >

- use modprobe to bind the usbserial driver to the device <sudo modprobe usbserial vendor=0x04B4 product=0xF139

- the device appears now as /dev/ttyUSB0

按照这个操作,有时候会虚出两个串口,有时候会出一个。。。。很神奇

还要cypress的cyusb_linux其他VID,PID 不识别问题,

https://community.cypress.com/docs/DOC-10863

Question: How do you make a device with a custom vendor identification (VID) number / product identification (PID) number visible on the cyusb_linux GUI?

Answer:

By default, the cyusb_linux GUI (Control Center equivalent for Linux) only shows devices with a Cypress® VID (0x04B4) and PIDs contained in the /etc/cyusb.conf file.

If you are using a Cypress VID (0x04B4) and any PID that is not present in the /etc/cyusb.conf file, you will have to add the VID (0x04B4) and the PID to the end of the /etc/cyusb.conf file. You will need root permissions to do this. If the cyusb_linux GUI is already open, close it and start it again. The device will now appear in the cyusb_linux GUI.

If you are using a non-Cypress VID, follow the steps below. For this example, the VID is 0x04FF and the PID is 0xFF.

  1.   Add the VID and PID in /etc/cyusb.conf as shown in Figure 1. You will need root permissions.  

       Figure 1. FX3™ Custom VID-PID Added to cyusb.conf File

     

       FX3 custom

  2.   For a non-Cypress VID, you will need to make changes in the /etc/udev/rules.d/88-cyusb.rules file as well. You will need root permissions. Copy lines four and five of the 88-cyusb.rules file and paste it back into the file with ATTR{idVendor}==”04b4” changed to ATTR{idVendor}==””, as shown in Figure 2.  

       Figure 2. ATTR{idVendor}==”04ff” Added in the 88-cyusb.rules File

     

       rules file

  3.   Close and restart the cyusb_linux GUI. The device with a custom VID/PID will now appear in the GUI as shown in Figure 3.  

       Figure 3. Device with VID=0x04ff and PID=0x00ff Now Appears in the cyusb_linux GUI

     

       linux GUI

  4. 还有个奇葩坑,就是如果VID设成cypress的0x04b4,PID只有为0x0008时,才能虚拟出ttyACM0,但cyusb_linux无设备,采用上述方法,会出现设备列表,但ttyACM0会消失,必须用modprobe强制生成一个ttyUSB0。如果换为其他PID则ttyACM0消失,设备列表 出现。如果VID和PID设为非0x04b4,则ttyACM0会出现,再采用上述方法,自定义设备也会出现在设备列表中。这个奇葩坑害了我大概一周的时间!!!!

ubuntu@hi3798mv100:/$ lsmod | grep cdc_acm ubuntu@hi3798mv100:/$ ls /dev/ttyACM* ls: cannot access '/dev/ttyACM*': No such file or directory ubuntu@hi3798mv100:/$ ls /dev/ttyUSB* ls: cannot access '/dev/ttyUSB*': No such file or directory ubuntu@hi3798mv100:/$ sudo modprobe cdc_acm [sudo] password for ubuntu: modprobe: FATAL: Module cdc_acm not found in directory /lib/modules/4.4.35_ecoo_81032968 ubuntu@hi3798mv100:/$ sudo udevadm info --attribute-walk --path $(udevadm info -q path -n /dev/bus/usb/003/004) Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/platform/soc/f9880000.ohci/usb3/3-2': KERNEL=="3-2" SUBSYSTEM=="usb" DRIVER=="usb" ATTR{idProduct}=="614e" ATTR{product}=="stm32f407xx" ATTR{bNumConfigurations}=="1" ATTR{bcdDevice}=="0100" ATTR{version}==" 2.00" ATTR{busnum}=="3" ATTR{bDeviceSubClass}=="00" ATTR{devnum}=="4" ATTR{avoid_reset_quirk}=="0" ATTR{bNumInterfaces}==" 2" ATTR{bMaxPower}=="100mA" ATTR{bDeviceClass}=="02" ATTR{configuration}=="" ATTR{bMaxPacketSize0}=="16" ATTR{bmAttributes}=="c0" ATTR{bDeviceProtocol}=="00" ATTR{quirks}=="0x0" ATTR{serial}=="2E0027001251333233363732" ATTR{urbnum}=="13" ATTR{authorized}=="1" ATTR{devpath}=="2" ATTR{bConfigurationValue}=="1" ATTR{ltm_capable}=="no" ATTR{removable}=="unknown" ATTR{maxchild}=="0" ATTR{idVendor}=="1d50" ATTR{manufacturer}=="Klipper" ATTR{speed}=="12" looking at parent device '/devices/platform/soc/f9880000.ohci/usb3': KERNELS=="usb3" SUBSYSTEMS=="usb" DRIVERS=="usb" ATTRS{avoid_reset_quirk}=="0" ATTRS{quirks}=="0x0" ATTRS{bmAttributes}=="e0" ATTRS{version}==" 1.10" ATTRS{devnum}=="1" ATTRS{bDeviceProtocol}=="00" ATTRS{authorized_default}=="1" ATTRS{busnum}=="3" ATTRS{bMaxPower}=="0mA" ATTRS{bNumConfigurations}=="1" ATTRS{idProduct}=="0001" ATTRS{bDeviceSubClass}=="00" ATTRS{idVendor}=="1d6b" ATTRS{bMaxPacketSize0}=="64" ATTRS{bDeviceClass}=="09" ATTRS{ltm_capable}=="no" ATTRS{serial}=="f9880000.ohci" ATTRS{bConfigurationValue}=="1" ATTRS{interface_authorized_default}=="1" ATTRS{speed}=="12" ATTRS{urbnum}=="76" ATTRS{manufacturer}=="Linux 4.4.35_ecoo_81032968 ohci_hcd" ATTRS{removable}=="unknown" ATTRS{devpath}=="0" ATTRS{authorized}=="1" ATTRS{configuration}=="" ATTRS{bcdDevice}=="0404" ATTRS{bNumInterfaces}==" 1" ATTRS{product}=="Generic Platform OHCI controller" ATTRS{maxchild}=="2" looking at parent device '/devices/platform/soc/f9880000.ohci': KERNELS=="f9880000.ohci" SUBSYSTEMS=="platform" DRIVERS=="ohci-platform" ATTRS{driver_override}=="(null)" looking at parent device '/devices/platform/soc': KERNELS=="soc" SUBSYSTEMS=="platform" DRIVERS=="" ATTRS{driver_override}=="(null)" looking at parent device '/devices/platform': KERNELS=="platform" SUBSYSTEMS=="" DRIVERS==""
最新发布
06-24
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值