lua-users home
lua-l archive

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




On Wed, Jan 6, 2010 at 4:51 PM, steve donovan <steve.j.donovan@gmail.com> wrote:
On Wed, Jan 6, 2010 at 4:42 PM, King, Mike <MKing@klmicrowave.com> wrote:
>> Any thought about making this cross-platform? I really need Linux and Windows.
>
> I don't know Linux will enough so probably not.

What's so cool about serial on Linux is that you really can just open
/dev/ttyS0 (aka 'COM1') and treat it like any file (tho remember to
f:flush() occaisionally). Except, you need to set the comm parameters
first.  There are several command-line utilities for that, can just
shell out to them using os.execute()

You could do this, but you don't really need to. Most (if not all) you need to know about serial programming under Linux (and other POSIX compliant systems) is here :

http://www.easysw.com/~mike/serial/serial.html

I already have a C serial library that works both under Windows and Linux (I'm using it for eLua), but it's quite small at the moment, and not really tested. If there is interest, however, I can make it public (which I'll do anyway, but I can also try make it public as a separate library, not only as part of eLua). I think it might also work under OSX, but I have yet to test this.

Best,
Bogdan