docker-thermostat/find_ttyUSB.sh

11 lines
346 B
Bash
Raw Normal View History

2024-06-07 20:03:40 +00:00
#!/bin/bash
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
syspath="${sysdevpath%/dev}"
devname="$(udevadm info -q name -p $syspath)"
[[ "$devname" == "ttyUSB"* ]] || continue
eval "$(udevadm info -q property --export -p $syspath)"
[[ -z "$ID_SERIAL" ]] && exit
echo "/dev/$devname - $ID_SERIAL"
done