Re: Handling Devices with GIO



I have read the docs, but it doesnt make clear how can i use it with
/dev/* devices.

I supouse that GSeekable can be used with /dev/port but this part is
better to do with normal rutines like ioperm, outb, inb, etc.

And GUnixInputStream or GDataInputStream to handle inputs from
/dev/ttyS0, but again, it doesnt makes easy configuring the device
like BaudRate, parity, etc. (if it does) and i think that i have to
create 2 file descriptors, one for Input and one for Output.

Also i never know how many characters will i get or when from the
serial port, so a concept of interrupts is necessary to not make my
device be polling too much. Thats why i use select with /dev/ttyS0 and
/dev/tty.

With GInputStream i have g_input_stream_read_async which gets N
specified bytes asyncronously, and what i would better need is
g_input_stream_read_LINE_async.
I cant find if _read_async can call any other callback function like a
GCallable each time that it gets a new character and then i can cancel
after getting a '\n' character.
Also cancelling means not calling the callback? or stopping the _async
operation without calling anything?


I cant find on google any code related too google and devices. Does
somebody worked on it?

Cheers.



2008/8/19 Alexander Jones <alex weej com>:
> http://library.gnome.org/devel/gio/stable/streaming.html
>
> ?
>
> 2008/8/18 Diego Jacobi <jacobidiego gmail com>:
>> Hi.
>>
>> Is it possible to handle the serial/parallel/tty/etc device files with GIO?
>>
>>
>> I am writing a code for a Project in my Uni which only needs to chat
>> with another computer through the Serial Port.
>>
>> In my Uni linux is not very popular, instead they ask for programs for
>> DOS. Thats why i want to make something useful and make it under
>> linux.
>>
>> The program have to wait for keypresses or serial port input. When a
>> keypress ocurs it haves to send the data through the configurable
>> serial interface, and when data is incomming, it haves to just print
>> it out. This should look like a chat and should be testable with a
>> null modem.
>>
>> After tons of hours reading lots of howtos, i have a code working in C
>> with the kernel rutines and polling with "select" on /dev/tty and
>> /dev/ttyS0.
>> It gets in a very intricated code for a very simple task, so i wonder
>> if GIO can handle such tasks.
>>
>> Cheers.
>> Diego
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtk-list
>>
>


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