serial port Linux

BlitzMax Forums/BlitzMax Programming/serial port Linux

splinux(Posted 2005) [#1]
How could i access the serial port from Linux using BMax?
Maybe using c includes from gcc?
Or are there any modules, code and libs?


splinux(Posted 2005) [#2]
so, anyone knows?
i heard about using /dev/ttys0 as stream, but then?


Hummelpups(Posted 2005) [#3]
I am writing a module for win32. Today i try to engage a coffe
machine. I can turn on and off a LED already.

The C files are complete. Just hae to put it into BMax.

But as is said, just fr win.

IMurDOOM


splinux(Posted 2005) [#4]
and for Lin, do you plane any release? it won't be too difficult, i think, 'cause its hardware.
however you might use win interrupts, so i don't know...


Hummelpups(Posted 2005) [#5]
thats the problem at the time. I don't use interrupts at the moment,
I can write bytes to a stream. Changing the baudrate and so on
will follow but that has to be coded in BMax.

The serial connection will be give, the rest has to be coded in Max.
Changing the baud rate will be seperate function.

It isn't difficult, i am no pro in C bute creating functions and handle
them isn't the problem. You might get it to work under Linux


splinux(Posted 2005) [#6]
could you send me your code, so i'll can learn more?
PS: mail at: spiglerg @ gmail . com(without the spaces)


splinux(Posted 2005) [#7]
PS: do you use pointers to the serial port memory area or direct access with /dev/ttys0?


Chris C(Posted 2005) [#8]
not tried it (in max) but under linux /dev/ttys0 should be like any other stream, so open an stream and read from it, check the docs about TStream.


splinux(Posted 2005) [#9]
ok.
now the problem is: i have to do all the functions to set the options and use the serial port buffer.

is IMurDOOM could send me the code, maybe i could translate it to Linux.


Hummelpups(Posted 2005) [#10]
yes, it isn't ready yet. Whether i have finished the
MaxModule ill send it to you.

Yes i use pointers. The serial port is used like
a file. Youll see it, on linux it will be completely
different it'll be easier to write a new module, There's
enough support on the internet.

Google for it, my code won't help you.

IMurDOOM


splinux(Posted 2005) [#11]
ok. thanks.


splinux(Posted 2006) [#12]
Finally, i've programmed the module, using C mixed to BMax.
The main problem was with baud setting, and it hasn't the read function yet.
If anyone would like to try it, please mail me at spiglerg @ gmail . com, because i have no time or intention to put it online. It's mainly for personal usage and i'll make it less compatible.