[erlang-questions] sl module from jungerl/CEAN

Mikl Kurkov mkurkov@REDACTED
Wed Feb 27 10:23:44 CET 2008

Hi, Kirill!
In my current project I have to work with some device via serial port too.
After looking at several C drivers I found it much more easier just to open
file descriptors to that port directly in start script and work with them
via ordinal erlang port, created as 
open_port({fd, FdPortIn, FdPortOut}, [stream, binary]). Also you will have
to setup port parameters via stty. 

It works pretty well for me in Linux, but may be you will find this approach
usefull too.

Here is example of start.sh

export DEV=/dev/ttyUSB0

#serial port config
stty -F $DEV \
115200 rows 0 columns 0 line 0 min 1 time 0 \
intr ^- quit ^-  erase ^- kill ^- eof ^- \
eol ^- eol2 ^- swtch ^- start ^- stop ^- \
susp ^- rprnt ^- werase ^- lnext ^- flush ^- \
-parenb -parodd cs8 -hupcl -cstopb cread clocal crtscts \
ignbrk -brkint ignpar -parmrk -inpck -istrip \
-inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8 \
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel \
nl0 cr0 tab0 bs0 vt0 ff0 \
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop
-echoprt \
-echoctl -echoke

#port file descriptors variables (will be used by application to open port)
export DEV_FDIN=7
export DEV_FDOUT=8

exec 7< $DEV
exec 8> $DEV

# application start
erl -boot start_sasl -config sys.config -pa ./ebin  -s app start_script 

Kirill Zaborski wrote:
> Recently I've sumbled on task of getting connection to serial port
> from Erlang. I have found sl module from jungerl (and in CEAN) which
> should do the task. But I could not compile it using  MSYS+MinGW. It
> looks like there are some bugs in source code (e.g. undeclared field
> in struct).
> Has anyone get it compiled on Windows? Or maybe author (Tony Rogvall)
> is on the list?
> Best regards,
> Kirill.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

View this message in context: http://www.nabble.com/sl-module-from-jungerl-CEAN-tp15707101p15709314.html
Sent from the Erlang Questions mailing list archive at Nabble.com.

More information about the erlang-questions mailing list