当前位置:网站首页>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 :

边栏推荐
猜你喜欢

RAID磁盘阵列

MOOC翁恺C语言 第四周:进一步的判断与循环:3.多路分支4.循环的例子5.判断和循环常见的错误

DNS域名解析

Svg understanding and drawing application

DOM -- page rendering, style attribute operation, preloading and lazy loading, anti shake and throttling

VNC Timed out waiting for a response from the computer

Remotely access the local website of services such as neo4j on the ECS

Use powercli to create a custom esxi ISO image

metasploit渗透ms7_010练习

MOOC Weng Kai C language fourth week: further judgment and circulation: 1. Logical types and operations 2. Judgment of cascading and nesting
随机推荐
My deployment notes
Svg understanding and drawing application
Standard C language learning summary 6
Event_ Loop event loop mechanism
VLAN configuration
Multiprocessing (multiprocessing)
Remotely access the local website of services such as neo4j on the ECS
Neo4j运行报错Error occurred during initialization of VM Incompatible minimum and maximum heap sizes spec
MOOC翁恺C语言 第四周:进一步的判断与循环:3.多路分支4.循环的例子5.判断和循环常见的错误
Forward and backward slash notes
bond模式配置
Esxi arm edition version 1.10 update
Generate create table creation SQL statement according to excel
Blue Bridge Cup square filling number
Standard C language learning summary 5
360 compatibility issues
As a result, fill in the birthday candles
登录进oracle10g的oem,想管理监听程序却总是弹出帐号密码输入页面
Shell--- sed statement exercise
Shell --- conditional statement practice