[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gforth] Bug? termios functions not working in serial.fs
From: |
Bernd Paysan |
Subject: |
Re: [gforth] Bug? termios functions not working in serial.fs |
Date: |
Sat, 25 Oct 2014 23:36:05 +0200 |
User-agent: |
KMail/4.11.5 (Linux/3.11.10-21-desktop; KDE/4.11.5; x86_64; ; ) |
Am Samstag, 25. Oktober 2014, 09:08:24 schrieb Jerry DeLisle:
> Hi folks,
>
> I instrumented set-baud in serial.fs as follows.
>
> : set-baud ( baud fd -- ) >r
>
> r@ t_old tcgetattr .
> t_old t_buf termios move
> t_buf cfmakeraw
> t_buf over cfsetispeed .
> t_buf swap cfsetospeed .
> r> 0 t_buf tcsetattr . ;
>
> replacing the DROP with .
>
> I wanted to check the return values for tcgetattr and tcsetattr.
>
> I am using a simple driver setup in file port-io.fs:
>
> \ port-io.fs
> marker forget
> include serial.fs
>
> 0 value port
>
> : open-port open-file throw to port ;
>
> s" /dev/ttyUSB0" r/w open-port
>
> The result is:
>
> include port-io.fs ok
> cr B9600 port set-baud
> -1 0 0 -1 ok
>
> I can write to the port using write-file with no error and see the data
> activity on the port lights.
>
> Am I missing something here or is this a bug?
You are missing fileno; to maintain compatibility, I will add some comments to
explain what "fd" is here (it's the Unix file descriptor, not a Forth file
descriptor).
B9600 port fileno setbaud
should work without errors.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/
signature.asc
Description: This is a digitally signed message part.