Re: Writing Virtual Serial Comm port Driver

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

 



On Wed, Sep 10, 2008 at 12:44 PM, mayank rana
<mayank_rana_it@xxxxxxxxxxx> wrote:
> Hi All,
>
> 1. I looked at Linux Device Drive 3rd Edition for TTY driver. I tried with
> tiny_tty driver mentioned in book. I am able to open the /dev/ttty0 and also
> get the attribute using TCGETA ioctl from user space. As I am trying to
> write e.g. echo "hi" > /dev/ttty0. I am not getting any data in tiny_write
> function.
>

Seemed like your comment this description and the answer may be given
by Theodore Tso:

http://lkml.org/lkml/2007/2/18/62

On Sun, Feb 18, 2007 at 11:52:58AM +0300, Mockern wrote:
> Thank you for you respond.
>
> I asked this question since I have one problem with my tty driver.
> It based on serial_core.c. It works well except Linux cat operation:(.
> (e.g. cat < ttyS10). I thought in tty driver there is no function
> for this operation and I wanted to know that maybe serial driver has it.
>
> Could it be the reason that cat operation in tty driver does not work
> (but I can write and read from user space application!)?
> Or maybe I need to implement a special function in my tty driver to support Linux
> cat operation?

If you do something like "cat < ttyS10" it will work by opening the
device just like a user space application --- but the shell, which is
opening /dev/ttyS10, won't use any of the special flags that a user
space application might use to not wait for the carrier detect line to
go high, for example.

I'd have to see the sources of the driver and your user space
application to be sure, but one thing you should try is "stty -F
/dev/ttyS10 clocal" and see if that allows "cat < /dev/ttyS10" to
work.


> 2. Any information on when to use function related to flushing the data  as
> flush_chars, wait_until_sent etc.
>
in include/linux/tty_driver.h:

 * void (*flush_chars)(struct tty_struct *tty);
 *
 *      This routine is called by the kernel after it has written a
 *      series of characters to the tty device using put_char().
 *
 *      Optional:
 *
 *      Note: Do not call this function directly, call tty_driver_flush_chars
 *

 *
 * void (*wait_until_sent)(struct tty_struct *tty, int timeout);
 *
 *      This routine waits until the device has written out all of the
 *      characters in its transmitter FIFO.
 *
 *      Optional: If not provided the device is assumed to have no FIFO
 *
 *      Note: Usually correct to call tty_wait_until_sent
 *


> Any information on above will be helpful.
>
> Thanks.
>
> Regards,
> _-_Mayank Rana_-_
>
>
> --- On Mon, 9/8/08, Greg KH <greg@xxxxxxxxx> wrote:
>
> From: Greg KH <greg@xxxxxxxxx>
> Subject: Re: Writing Virtual Serial Comm port Driver
> To: "mayank rana" <mayank_rana_it@xxxxxxxxxxx>
> Cc: "kernelgroup linux" <kernelnewbies@xxxxxxxxxxxx>
> Date: Monday, September 8, 2008, 11:24 AM
>
> On Fri, Sep 05, 2008 at 11:45:45AM +0530, mayank rana wrote:
>> Hi All,
>>
>> Is there any way to write virtual serial comm port driver in Linux ?
>
> Yes, it's not that hard.
>
>> I tried to get some information from all standard Linux Drivers book
>> and google, but not able to get anything on it.
>
> What specific problems are you having?
> Have you tried starting with the tiny-tty driver in the Linux Device
> Drivers book?
>
> thanks,
>
> greg k-h
>
>



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux