2007-02-17 10:06:44

by Mockern

[permalink] [raw]
Subject: Linux tty driver question

Hi,

I'm working on Linux tty driver (based on tiny_tty).

How can I provide in my driver Linux cat operation (e.g.cat < ttyS3)?

What should I implement exactly?

Thankx


2007-02-17 11:01:35

by Jiri Slaby

[permalink] [raw]
Subject: Re: Linux tty driver question

Mockern napsal(a):
> Hi,
>
> I'm working on Linux tty driver (based on tiny_tty).
>
> How can I provide in my driver Linux cat operation (e.g.cat < ttyS3)?

call tty_insert_flip_*() from somewhere to put some data into tty recieve
buffer, which is pushed into ldisc by tty_flip_buffer_push() and then sent by
tty_read function (where ldisc read is called) to userspace for reading process.

> What should I implement exactly?

open, settermios, write_room (note that this is minimal and will probably oops
when poll or write is invoked) + some isr or timer to fill the buffer mentioned
above.

regards,
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E

Hnus <[email protected]> is an alias for /dev/null

2007-02-17 11:28:13

by Mockern

[permalink] [raw]
Subject: Re: Linux tty driver question

Thank you,

I have no problem with my tty driver, except one thing: it does not work with cat (but there are no problems to write,read from user space application). I'll try to follow your adwise to support cat.


>Mockern napsal(a):
>> Hi,
>>
>> I'm working on Linux tty driver (based on tiny_tty).
>>
>> How can I provide in my driver Linux cat operation (e.g.cat < ttyS3)?
>
>call tty_insert_flip_*() from somewhere to put some data into tty recieve
>buffer, which is pushed into ldisc by tty_flip_buffer_push() and then sent by
>tty_read function (where ldisc read is called) to userspace for reading process.
>
>> What should I implement exactly?
>
>open, settermios, write_room (note that this is minimal and will probably oops
>when poll or write is invoked) + some isr or timer to fill the buffer mentioned
>above.
>
>regards,

--
??????? ??????? ????, ????? ??????? ????? ?? ??????? http://mail.yandex.ru

2007-02-17 12:55:53

by Jiri Slaby

[permalink] [raw]
Subject: Re: Linux tty driver question

Mockern napsal(a):
> Thank you,
>
> I have no problem with my tty driver, except one thing: it does not work with cat (but there are no problems to write,read from user space application). I'll try to follow your adwise to support cat.

And where does it stuck? use ptrace (e.g. strace) to investigate.

regards,
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E

Hnus <[email protected]> is an alias for /dev/null

2007-02-17 13:05:16

by Mockern

[permalink] [raw]
Subject: Re: Linux tty driver question

The problem is (probably???) that I did not implement ready_til_block
in my driver.

OK, thank you, i need to investigate it with strace.

>Mockern napsal(a):
>> Thank you,
>>
>> I have no problem with my tty driver, except one thing: it does not work with cat (but there are no problems to write,read from user space application). I'll try to follow your adwise to support cat.
>
>And where does it stuck? use ptrace (e.g. strace) to investigate.
>
>regards,

--
??????.?????: ????? ????????? ????? ?? ?????????! http://mail.yandex.ru/monitoring/

2007-02-27 09:46:24

by Jiri Slaby

[permalink] [raw]
Subject: Re: Linux tty driver question

Mockern napsal(a):
> Thank you,
>
> I have no problem with my tty driver, except one thing: it does not work with cat (but there are no problems to write,read from user space application). I'll try to follow your adwise to support cat.

But the read *works* according to the strace output, which you've post in the
another thread. Just don't send garbage to the discipline, send some chars.

regards,
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E