It was thus said that the Great Jayanth Acharya once stated:
Presently I am using the library/module "luars232" installed via luarocks.
I am using this on a Debian Linux machine, on the USB-serial port
"/dev/ttyUSB0".
I can access this port perfectly well using tools like picocom or minicom,
i.e. have proper bi-directional communication.
However, when I try this snippet:
[code]
rs232 = require("luars232")
port_name = "/dev/ttyUSB0"
local e, p = rs232.open(port_name)
print(e, p)
[/code]
I get the output:
2 nil
Indicating an error in opening the port. One thing that I am pretty sure
of, is that this isn't a permission issue. Since I have already added my
userid to the "dialout" group, and use the "picocom" tool similarly. Also,
I am sure that the port is not in use by any other app/tool at the time of
running the lua snippet.
However, I am not sure how to debug this further.
Under Linux, an errno of 2 (and I'm assuming that's what's being return
from rs232.open()) means "No such file or directory" so I would double check
that "/dev/ttyUSB0" does indeed exist (perhaps you need to plug in the
USB-serial device into the computer).