Linux just hands out a logical port assignment. Sometimes it isn't the one you expect. There are ways of locking down the port name, but it isn't worth the effort. And can be a pain later if you forget, AND forgot how you did this.
I use this to locate my USB device. In this case, the device is one of my Raspberry Pis.
Code: Select all
dim as string result
dim as integer fnum
fnum = freefile
open pipe "ls -l /dev/serial/by-id |grep FTDI" for input as #fnum
line input #fnum, result
close fnum
if instr(result, "FTDI_FT232R_USB_UART_A60275PX") <> 0 then
fnum = instrrev(result, "tty")
result = right(result, len(result) - fnum - 2)
end if
print result
or USB1, sometimes. My program can deal with info as I wish.
These commands are helpful to locate the info you need to do this.
lsusb
udevadm info -q all /dev/ttyUSB0 | grep DEVPATH
ls -l /dev/serial/by-id
udevadm info -q all /dev/ttyUSB* | grep DEVNAME
Either way, my program does not have to be recompiled/restarted or wait for a timeout and try an alternate to connect to the device.
david