This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Port name issue
#1
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?
Reply
#2
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
Reply


Forum Jump: