sl module from jungerl/CEAN

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

sl module from jungerl/CEAN

Kirill Zaborski
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
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

sl module from jungerl/CEAN

Mikl Kurkov-2

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.
--
Mikl

Here is example of start.sh
<code>
#!/bin/sh

#device
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
</code>




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
> 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.



Reply | Threaded
Open this post in threaded view
|

Re: sl module from jungerl/CEAN

Mikl Kurkov
In reply to this post by Kirill Zaborski
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.
--
Mikl

Here is example of start.sh
<code>
#!/bin/sh

#device
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
</code>



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@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Fwd: sl module from jungerl/CEAN

Kirill Zaborski
In reply to this post by Mikl Kurkov-2
Forgot to add cc: to erlang questions :)

---------- Forwarded message ----------
From: Kirill Zaborski <[hidden email]>
Date: Wed, Feb 27, 2008 at 12:34 PM
Subject: Re: [erlang-questions] sl module from jungerl/CEAN
To: Mikl Kurkov <[hidden email]>


Thanks for the code, but at the moment main target OS is Windows :(
 So I'd like to get somewhat closer to native support, using extra code
 like http://gnuwin32.sourceforge.net/packages/coreutils.htm isn't very
 good from maintenance point of view.
 So I'll try to get sl working. Did you found any difficulties using it?

 Best regards,
 Kirill



 On Wed, Feb 27, 2008 at 12:23 PM, Mikl Kurkov <[hidden email]> wrote:
 >
 >  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.
 >  --
 >  Mikl
 >
 >  Here is example of start.sh
 >  <code>
 >  #!/bin/sh
 >
 >  #device
 >  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
 >  </code>
 >
 >
 >
 >
 >
 >
 >  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
 >  > [hidden email]
 >  > 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.
 >
 >
 >
 >  _______________________________________________
 >  erlang-questions mailing list
 >  [hidden email]
 >  http://www.erlang.org/mailman/listinfo/erlang-questions
 >
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: sl module from jungerl/CEAN

raison
I am facing the same issue.  I took a look at the C code (sl_drv.c), and it appears that there are some minor issues that a win32 expert could probably fix with ease.  Unfortunately, I am not that guy.  It looks like the struct "sl_t" relies on a "stat" field (only under Windows), while the definition of that struct does not contain a "stat" line with a type definition.  Are there any win32 experts out there who might know what this mysterious stat field is all about?  There are a couple of other compile errors, which I have included below.  Thanks in advance for any assistance.

$ mingw32-make -f Makefile.win32
gcc -c -o sl_drv.obj sl_drv.c -I"c:/Program Files/erl5.6.5"/usr/include -mno-cygwin -D__WIN32__
sl_drv.c: In function `do_open':
sl_drv.c:1044: error: structure has no member named `stat'
sl_drv.c:1048: error: structure has no member named `stat'
sl_drv.c: In function `sl_ready_input':
sl_drv.c:1239: error: structure has no member named `stat'
sl_drv.c:1242: error: `mask' undeclared (first use in this function)
sl_drv.c:1242: error: (Each undeclared identifier is reported only once
sl_drv.c:1242: error: for each function it appears in.)
sl_drv.c:1242: error: structure has no member named `stat'
sl_drv.c: In function `sl_ready_output':
sl_drv.c:1273: error: `n' undeclared (first use in this function)
sl_drv.c: In function `sl_ctl':
sl_drv.c:1544: error: structure has no member named `stat'
mingw32-make: *** [sl_drv.obj] Error 1

Cheers.
Kevin Raison


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?
Reply | Threaded
Open this post in threaded view
|

Fwd: sl module from jungerl/CEAN

raison-2
In reply to this post by Kirill Zaborski

I am facing the same issue.  I took a look at the C code (sl_drv.c), and it
appears that there are some minor issues that a win32 expert could probably
fix with ease.  Unfortunately, I am not that guy.  It looks like the struct
"sl_t" relies on a "stat" field (only under Windows), while the definition
of that struct does not contain a "stat" line with a type definition.  Are
there any win32 experts out there who might know what this mysterious stat
field is all about?  There are a couple of other compile errors, which I
have included below.  Thanks in advance for any assistance.

$ mingw32-make -f Makefile.win32
gcc -c -o sl_drv.obj sl_drv.c -I"c:/Program Files/erl5.6.5"/usr/include
-mno-cygwin -D__WIN32__
sl_drv.c: In function `do_open':
sl_drv.c:1044: error: structure has no member named `stat'
sl_drv.c:1048: error: structure has no member named `stat'
sl_drv.c: In function `sl_ready_input':
sl_drv.c:1239: error: structure has no member named `stat'
sl_drv.c:1242: error: `mask' undeclared (first use in this function)
sl_drv.c:1242: error: (Each undeclared identifier is reported only once
sl_drv.c:1242: error: for each function it appears in.)
sl_drv.c:1242: error: structure has no member named `stat'
sl_drv.c: In function `sl_ready_output':
sl_drv.c:1273: error: `n' undeclared (first use in this function)
sl_drv.c: In function `sl_ctl':
sl_drv.c:1544: error: structure has no member named `stat'
mingw32-make: *** [sl_drv.obj] Error 1

Cheers.
Kevin Raison



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?
>
>

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



Reply | Threaded
Open this post in threaded view
|

Re: Fwd: sl module from jungerl/CEAN

raison
In reply to this post by Kirill Zaborski
I am facing the same issue.  I took a look at the C code (sl_drv.c), and
it appears that there are some minor issues that a win32 expert could
probably fix with ease.  Unfortunately, I am not that guy.  It looks
like the struct "sl_t" relies on a "stat" field (only under Windows),
while the definition of that struct does not contain a "stat" line with
a type definition.  Are there any win32 experts out there who might know
what this mysterious stat field is all about?  There are a couple of
other compile errors, which I have included below.  Thanks in advance
for any assistance.

$ mingw32-make -f Makefile.win32
gcc -c -o sl_drv.obj sl_drv.c -I"c:/Program Files/erl5.6.5"/usr/include
-mno-cygwin -D__WIN32__
sl_drv.c: In function `do_open':
sl_drv.c:1044: error: structure has no member named `stat'
sl_drv.c:1048: error: structure has no member named `stat'
sl_drv.c: In function `sl_ready_input':
sl_drv.c:1239: error: structure has no member named `stat'
sl_drv.c:1242: error: `mask' undeclared (first use in this function)
sl_drv.c:1242: error: (Each undeclared identifier is reported only once
sl_drv.c:1242: error: for each function it appears in.)
sl_drv.c:1242: error: structure has no member named `stat'
sl_drv.c: In function `sl_ready_output':
sl_drv.c:1273: error: `n' undeclared (first use in this function)
sl_drv.c: In function `sl_ctl':
sl_drv.c:1544: error: structure has no member named `stat'
mingw32-make: *** [sl_drv.obj] Error 1

Cheers.
Kevin Raison


<quote author="Kirill Zaborski">
  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?
</quote>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions