lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


G'Day,

	Thanks for the responses.

	1) I tried tty:setvbuf("no"), but that seems to be 5.1 (I am using 5.0
until 5.1 stable is released)
	2) luafs. I checked this out, but it does not seem like it would help
much for this.
	3) I tried with \r, but there was no change.  You could well be right
(I suspect you may be), but there seems to be another problem in the
way.
	4) I know this is easy in Python, so I do not think I should have to
fall back to C.  If it were anything more complicated, I probably would,
but I just want a quick "check this one thing" script.
	5) I checked with stty -F /dev/ttyS0 -a, and have made a couple of
adjustments now.
	6) tty:flush() does not seem to solve the problem.

	It is still not reading back an `OK' (though if I run minicom and type
`AT' I get back an `OK').  The script now looks like this:
		os.execute("stty -F /dev/ttyS0 115200 cols 80 rows 24")
		tty = io.open("/dev/ttyS0", "rw")
		--tty:setvbuf("no") Lua 5.1 only
		tty:write("AT\r")
		tty:flush()
		if (tty:read("*line") ~= "OK") then
			print "Modem Failed!\n"
		else
			print "Modem OK!\n"
		end
		tty:close()

	-- Matthew