ubuntu中绑定USB串口

参考:
关于Ubuntu 16.04绑定USB串口号的坑-(1): https://blog.csdn.net/ckkboy/article/details/83005904
ubuntu中绑定USB串口的方法,包括同一型号的USB串口: https://blog.csdn.net/zqxdsy/article/details/85610165
ubuntu绑定usb设备固定路径:https://www.jianshu.com/p/7e8789eb6991
1.用下面命令进行查询硬件号:
udevadm info --attribute-walk --name=/dev/ttyUSB0
如下:
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/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2/1-3.2:1.0/video4linux/video2':
    KERNEL=="video2"
    SUBSYSTEM=="video4linux"
    DRIVER==""
    ATTR{dev_debug}=="0"
    ATTR{index}=="0"
    ATTR{name}=="USB 2.0 Camera: HD USB Camera"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2/1-3.2:1.0':
    KERNELS=="1-3.2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="uvcvideo"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="0e"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{bInterfaceSubClass}=="01"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{iad_bFirstInterface}=="00"
    ATTRS{iad_bFunctionClass}=="0e"
    ATTRS{iad_bFunctionProtocol}=="00"
    ATTRS{iad_bFunctionSubClass}=="03"
    ATTRS{iad_bInterfaceCount}=="02"
    ATTRS{interface}=="HD USB Camera"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2':
    KERNELS=="1-3.2"

2.可以一个脚本如下:
会将硬件上属于2-2.2的设备号映射到device_0上 ,也就是该设备的别名
echo  'KERNELS=="2-2.2:1",  MODE:="0666", GROUP:="dialout",  SYMLINK+="device_0"' >/etc/udev/rules.d/USBLink.rules  
3.激活配置
sudo udevadm trigger
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值