Find FTDI Serial Number from Serial Port(/dev/ttyUSBn) (Linux)¶
$ udevadm info -q property -n /dev/ttyUSB0 | grep -E "ID_SERIAL_SHORT="
ID_SERIAL_SHORT=D307RGA2
ref.USB-シリアル変換器のデバイスファイル名を固定する
Make shell script¶
checkUSB_linux.sh
#!/bin/bash
for device in $(ls -1 /dev | grep -i usb)
do
serial=`udevadm info -q property -n /dev/${device} | grep -E "ID_SERIAL_SHORT="`
printf "/dev/%s %s\n" ${device} ${serial}
done
download checkUSB_linux.sh
Copy from mac to Rpi¶
$ scp Downloads/checkUSB_linux.sh pi@192.168.0.10:/home/pi/Downloads
pi@192.168.0.10's password:
checkUSB_linux.sh 100% 193 27.6KB/s 00:00
Run .sh in Rpi¶
$ ssh pi@192.168.0.10
pi@raspberrypi4:~ $ sh Downloads/checkUSB_linux.sh
/dev/ttyUSB0 ID_SERIAL_SHORT=D307RGA2
/dev/ttyUSB1 ID_SERIAL_SHORT=D307RGA1
if Mac¶
$ ls /dev | grep usb
tty.usbserial-D307RGA2