当前位置:网站首页>Serial port configuration of raspberry pie
Serial port configuration of raspberry pie
2022-07-28 07:12:00 【The most beautiful wish must be the craziest】
Because of the raspberry pie uart Not enough use , So what we're using is usb To serial port . But there is a problem . When usb The devices are inserted in different order , Its device nodes will be different , Sometimes it's ttyUSB0, Sometimes it's ttyUSB1 Or other . According to this question , After Baidu found a simple solution . That's through udev To statically set the name of the file node . About udev No discussion here . I apply it directly .
First of all ttyUSB0 For example :
Input udevadm info -a /dev/ttyUSB0
The printed information is as follows :
looking at device
'/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/ttyUSB0/tty/ttyUSB0':
KERNEL=="ttyUSB0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device
'/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="ch341-uart"
ATTRS{port_number}=="0"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0':
KERNELS=="1-1.4:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="ch341"
ATTRS{bInterfaceClass}=="ff"
ATTRS{bInterfaceSubClass}=="01"
ATTRS{bInterfaceProtocol}=="02"
ATTRS{bNumEndpoints}=="03"
ATTRS{authorized}=="1"
ATTRS{supports_autosuspend}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4':
KERNELS=="1-1.4"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="1.4"
ATTRS{idVendor}=="1a86"
ATTRS{speed}=="12"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{busnum}=="1"
ATTRS{devnum}=="4"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="96mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="80"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="0254"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 1.10"
ATTRS{urbnum}=="20"
ATTRS{ltm_capable}=="no"
ATTRS{removable}=="removable"
ATTRS{idProduct}=="7523"
ATTRS{bDeviceClass}=="ff"
ATTRS{product}=="USB2.0-Serial"
......... The printed information is followed by , But there's no need for , So I didn't post it ........
Okay , The blue font above is the information we need .
As for why we choose this
looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4': The message inside , Not the others , My understanding is that , The system is based on the idVendor and idProduct To distinguish between ttyUSB0,ttyUSB1.... etc. USB Serial equipment .
Then get other information in the same way . And then in the catalog /etc/udev/rules.d Next new file 188-usbtty.rules This file can be named differently , But it needs to be .rules file .
Enter the content in the file
KERNEL=="ttyUSB*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", KERNELS=="1-1.2",NAME="ttyUSB0", SYMLINK+="myuart0"
KERNEL=="ttyUSB*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", KERNELS=="1-1.3",NAME="ttyUSB1", SYMLINK+="myuart1"
KERNEL=="ttyUSB*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", KERNELS=="1-1.4",NAME="ttyUSB2", SYMLINK+="myuart2"
KERNEL=="ttyUSB*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", KERNELS=="1-1.5",NAME="ttyUSB3", SYMLINK+="myuart3"
among SYMLINK+="myuart0" Is the name of the static file node you want to set . After restarting the system, you can see the following :

边栏推荐
- Result number of filled briquettes
- MySQL queries all descendant nodes under the parent node. When querying the user list, it is processed by multi-level (company) departments. According to reflection, it recurses the tree structure too
- Uni app double click event simulation
- 视频格式基础知识:让你了解MKV、MP4、H.265、码率、色深等等
- MySQL build database Series (I) -- download MySQL
- Log in to Oracle10g OEM and want to manage the monitor program, but the account password input page always pops up
- [learning notes] tool
- JS data type detection and modification detection
- Standard C language learning summary 3
- MOOC Weng Kai C language week 3: judgment and circulation: 2. circulation
猜你喜欢
随机推荐
三层交换和VRRP
shell---循环语句练习
Standard C language summary 2
视频格式基础知识:让你了解MKV、MP4、H.265、码率、色深等等
Starting point Chinese website font anti crawling technology web page can display numbers and letters, and the web page code is garbled or blank
Esxi community network card driver updated in March 2022
MOOC Weng Kai C language week 7: array operation: 1. array operation 2. Search 3. preliminary sorting
分解路径为目录名和文件名的方法
Implementation method of Bert
RAID磁盘阵列
[learning notes] tool
C language maze
Results fill in the blanks carelessly (violent solution)
[learning notes] coding ability
Firewall - iptables firewall (four tables and five links, firewall configuration method, detailed explanation of matching rules)
DOM operation cases
Uni app double click event simulation
Redis哨兵模式及集群
Blue Bridge Cup square filling number
DOM -- page rendering, style attribute operation, preloading and lazy loading, anti shake and throttling









