본문 바로가기

RASPBERRY PI

SERIAL PORT 고정설정


pi@raspberrypi:~ $ dmesg | grep ttyUSB [4.074363] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0 [4.075590] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB1


시리얼 정보를 받아본다

pi@raspberrypi:~ $ udevadm info --name=/dev/ttyUSB0 --attribute-walk
...
pi@raspberrypi:~ $ udevadm info --name=/dev/ttyUSB1 --attribute-walk 

각각의 시리얼에 상세정보를 받아본 후

ATTRS{serial}=="A1LPXWF"

ATTRS{idProduct}=="6001"
ATTRS{idVendor}=="0403"

세가지 정보를 필요로합니다
pi@raspberrypi:~ $ sudo nano /etc/udev/rules.d/10-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="P11234567",  SYMLINK+="ttyUSB_P1"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="RFX1234567",  SYMLINK+="ttyUSB_RFX"
pi@raspberrypi:~ $ sudo udevadm trigger
pi@raspberrypi:~ $ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Nov 11 10:29 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Nov 11 10:00 /dev/ttyUSB1
lrwxrwxrwx 1 root root         7 Nov 11 10:00 /dev/ttyUSB_P1 -> ttyUSB1
lrwxrwxrwx 1 root root         7 Nov 11 10:00 /dev/ttyUSB_RFX1 -> ttyUSB0