Thanks all
@Futzle - I thought the same but, I’m not sure how to test the connection from the Pi itself, however I can see messages come back from the HDMI switch when I send certain commands (I can see the Ser2net banner reported back to me)
Hold on - I may have stumbled onto a potential contributing factor !! My ser2net.conf had the following
4001:telnet:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner
It was set to the telnet prorocol, not raw, which I assume is what I need - so i have updated the .conf to the following to see if that improves things…
4001:raw:600:/dev/ttyUSB0:9600 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
4002:telnet:0:/dev/ttyUSB0:9600 NONE 1STOPBIT 8DATABITS banner1
Update : Using’s Rex’s bit of code (below) I’ve tried the following combinations, but no joy so far.
local socket = require("socket")
host = "192.168.1.77"
c = assert(socket.connect(host, 4001))
c:settimeout(5)
local sres, serr = c:send(string.char(0x02,0x32,0x31,0x33,0x03))
print("Send:", sres, serr)
local data, rerr = c:receive(25)
luup.log (data)
print ("Receive:", data, rerr)
c:close()
Results via Lua Test are.
[b]Print output[/b]
Send: 5
Receive: nil close
@Rex , not sure what the Send value us but it can vary depending on what I send.
Other variations of line 5 tried so far.
HEX - failed
local sres, serr = c:send(string.char(0x02,0x32,0x31,0x33,0x03))
Numbers (removing the 0x) - Failed
local sres, serr = c:send(0232313303)
Text - Failed
local sres, serr = c:send("0x02,0x32,0x31,0x33,0x03")
local sres, serr = c:send("02,32,31,33,03")
----oo0oo----
If I retry it with luup.io.write
luup.io.write(string.char(0x02, 0x32, 0x31, 0x33, 0x03), "192.168.1.77", 4001)
I get the following error in the logs
01 04/24/14 11:21:16.138 GetLuaInterface can't find device type: 4/0x90ee20 str: 192.168.1.77 <0x30254680>
01 04/24/14 11:21:16.139 luup_io_write 0x953878 args 3 <0x30254680>