Re: use gio with serialport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This task is infact MUTCH more complicated than you can
imagine.

First you have to program the serial chip to
send and receive bytes when sertain amount of bytes
have been put in its buffer. The serial device driver
can also been programmed to timeout if the buffer is
not full. Then you have to consider this for booth outgooing
and incomming characters.

I recommend that you read chapter 18 "A modem dialer" in "Advanced Programming
in the UNIX environment" ISBN-0-201-56317-7. g_unix_input_stream... works good for
a TCP/IP stream but NOT for hardware oriented stuff.

/gh

Den 2014-09-23 09:48, Matrix skrev:
> Hi,
> 
> i'm writing an app which used to auto test AT commands...
> 
> i open fd with the /dev/ttyS0, and pass it to g_unix_input_stream_new
> 
> the qustion is how read the buf as line by line ?
> 
> because of the buffer size is 4K, if directly use g_data_input_stream_read_line, it will block forever,
> 
> and then i use g_buffered_input_stream_set_buffer_size to change the buffer size to 1 byte
> 
> it works, but it should be not efficient
> 
> and good ideas for this ?
> 
> thanks, and sorry for my bad english....
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> https://mail.gnome.org/mailman/listinfo/gtk-list

- -- 
Göran Hasse
Raditex Control AB
OrgNr: 556611-8773
email: gorhas@xxxxxxxxxx
tel: 019-450105
mob: 070-5530148
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUIcZdAAoJEKvpOh6Ygi0B7KsH/1IT3NeEfnL1y2BKi8V74iE5
UQ48HHYboSeJV2tdNjHHqStpmlpenEmaRAWmTXHFaImsJh5HlrU1lpBQm8FeyiNY
QpmraOdSpDE45EwsK2Goy1/3/yeaOphQAKzKwxkRyBxQMbY/GcnxkOGljP+MnN2N
CVcBHIPBMmrCJ63Bl6prVNjZOmsDhPQd/Xm+sIc2swAPNNou07/cjs2aVM1dE0+d
MG0skDO0vsbgOV8xxwXMAp0vsbN9j3/aVuqaON+gANCbQLXKOK3oR9Ngj46iFgoo
RRR85xWe59kfghi9MtxYJGtvRSlVApZl6exKqqeK7S2h5rdvvK1Pa2+1gQS+YFg=
=K9CX
-----END PGP SIGNATURE-----
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list





[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux