News : The level of daily SPAM has reached insane proportions, all registrations are now manual.
I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

As chrimo said, luax had it and Asko Kauppi was going to port it to luarocks anytime but not yet. He had some newer code available at svn://slugak.dyndns.org/public/2007 under Serial. Unfortunately it is way above my head.

In my case, I am building an small Linux image that boots a Xvesa server and acts as an AVL (automatic vehicle locator) device. The app itself is written in Lua, and I am looking forward to make it murgaLua. The nice stuff is that it all fits in a 24mb image and run under 32mb RAM... and there may be still some shrinking to do.

Since there is no working serial for lua (very close to, but nothing buildable by mortals like me), I am using socat to convert serial to sockets, and then use copas. I found no other way to accessing serial ports in a non-blocking way. It is a pity, since Lua is THE natural language to deal with GPSs, GPRS modems, etc.

YES, I agree full with you :-)
I want to use murgaLua with my robots and GPS.
Workarounds with simple open(/dev/ACM0) and read/write works, but not very stable.
I'm missing some more ioctrl-features (e.g. speed, flowcontrol).
Using socat work fine, but I'd like to do it native with excellent murgaLua...

YES, I agree full with you :-)
I want to use murgaLua with my robots and GPS.
Workarounds with simple open(/dev/ACM0) and read/write works, but not very stable.
I'm missing some more ioctrl-features (e.g. speed, flowcontrol).
Using socat work fine, but I'd like to do it native with excellent murgaLua...

Christian aka Chrimo :-)

First, there are command line tools under Linux to read and set the status of the serial port (like setserial for example).

Also if there are already modules out there you could use them. I think there is no reason to not ship such a module with the script and load it dynamically.

And finally, in the original post John mentioned to include C/Invoke. This should take care of your problems. Once it is available you can use ioctl(2) and if necessary use the open(2), fcntl(2), read2) and write(2) C-functions directly. Which should give you even greater flexibility.

YES, I agree full with you :-)
I want to use murgaLua with my robots and GPS.
Workarounds with simple open(/dev/ACM0) and read/write works, but not very stable.
I'm missing some more ioctrl-features (e.g. speed, flowcontrol).
Using socat work fine, but I'd like to do it native with excellent murgaLua...

Christian aka Chrimo :-)

First, there are command line tools under Linux to read and set the status of the serial port (like setserial for example).

Also if there are already modules out there you could use them. I think there is no reason to not ship such a module with the script and load it dynamically.

And finally, in the original post John mentioned to include C/Invoke. This should take care of your problems. Once it is available you can use ioctl(2) and if necessary use the open(2), fcntl(2), read2) and write(2) C-functions directly. Which should give you even greater flexibility.

Juergen

Juergen,

there is no portable way to access serial devices...
I'm using OSX and Linux - I have no problems.
But try it at WindowsDerivates :-) Good luck.

Old Luax serial-libs can do that all!
This is the reason, why we like to have it at murgaLua.
One portable code for all platforms.

In my case, i would like to see both things: Stable serial modules for lua 5.1 and have these modules in murgaLua (perhaps as a compile time build option).

I don't know much about cinvoke, but would it allow me to read a serial port without blocking while on a coroutine? I guess that is the key point to handle concurrent events the way copas handles them.

But I agree with you, Juerguen, that we may be asking John something that should ask from Lua people.... the fact is, as I see, Lua developers out there seems to be quite happy with the state of affairs right now.

John seems to be open to ideas about making murgaLua a powerful swiss-knife-tool, and serial support looks a reasonable and light feature to add to it.

I was talking with another user yesterday about the growth of murgaLua (and the performance decrease which is always associated with size increase). The subject of Lua modules was raised, as Juergen also mentioned, and that sounds like a completely logical path. Why should murgaLua continue to gain weight when functionality can be added with existing modules? Using modules for extra functionality would keep murgaLua small, fast, stable, and allow John to concentrate on making it better rather than bigger.

Quote:

there is no portable way to access serial devices...
I'm using OSX and Linux - I have no problems.
But try it at WindowsDerivates :-) Good luck.