I keep having an issue where the USB path changes. I'm using a zstick plugged into one of the USB ports on my supermicro motherboard. I run this to see where the USB is mapped to:
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
(
syspath="${sysdevpath%/dev}"
devname="$(udevadm info -q name -p $syspath)"
[[ "$devname" == "bus/"* ]] && continue
[[ "$devname" == "input/"* ]] && continue
[[ "$devname" == "video0"* ]] && continue
eval "$(udevadm info -q property --export -p $syspath)"
[[ -z "$ID_SERIAL" ]] && continue
busnum="$(udevadm info -a -p $(udevadm info -q path -n /dev/$devname) | awk -F "==" '/busnum/ {gsub("\"","");print $2}' | head -1)"
devnum="$(udevadm info -a -p $(udevadm info -q path -n /dev/$devname) | awk -F "==" '/devnum/ {gsub("\"","");print $2}' | head -1)"
bus_dev=${busnum}:${devnum}
lsusb="$(lsusb -s $bus_dev)"
echo "$lsusb - /dev/$devname"
)
done
This will show something like this:
So I'll enter that in the container, discover all my zwave devices, set everything up fine. And maybe several days later, maybe after a reboot, maybe after removing the zstick to go include some devices and reinserting (into the same USB slot) the path has changed. I know this becuase all of a sudden openHAB isn't seeing any of my devices or the zstick. So I run that same command above, and all of a sudden the zstick usb location is /dev/ttyACM1 instead of /dev/ttyACM0. Why is this happening? Is there a better, permanent path that I am not seeing? This is driving me nuts.
EDIT: OK, just happened again. I unplugged it, included a new zwave switch, plugged back into the same USB port, and now its showing the location as /dev/ttyACM1
What is going on??