LogicMachine Forum
Port name issue - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: Port name issue (/showthread.php?tid=2036)



Port name issue - oveh - 20.04.2019

I have a USB to M-Bus adapter(Prolific) connected to my LM5, via a powered USB-hub.
From time to time my LM stop receiving telegrams from the M-Bus adapter.
When I check the serial port name, in the system status window, the port name might have changed from  "/dev/ttyUSB0" to "/dev/ttyUSB1", and my script handling the data needs to be changed accordingly to work again....

Is it possible to connect to LM via telnet/ssh and give my device a static name with udev rules?


RE: Port name issue - admin - 23.04.2019

If you only have a single USB converter you can use a function to find port name:
Code:
function findttyusb()   for _, dev in ipairs(io.ls('/dev')) do     if dev:find('ttyUSB') then       return '/dev/' .. dev     end   end end tty = findttyusb() if tty then   require('serial')   port = serial.open(tty) end