Re: LDD3: tiny_serial and tiny_tty

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

 



Hello Greg,

On Sat, Oct 25, 2008 at 3:59 AM, Greg KH <greg@xxxxxxxxx> wrote:
> On Thu, Oct 23, 2008 at 06:38:43PM +0530, Anuz Pratap Singh Tomar wrote:
>> There are some issues with drivers in that book, infact my par_port driver
>> couldn't run because there was no interrupt generation. I am not sure
>> whether that is issue with driver or the h/w(which is  less likely).
>>
>> I once sent a mail to Greg to update the book somewhere online or something
>> like that, but I guess the mail got lost in the huge chunk of mails he
>> receive.
>
> Well, any email telling me to "just update the book to the latest kernel
> version" probably got dropped on the floor due to my laughing so hard :)
>
> Updating the linux driver book is something that the LDD authors have
> been talking about for a while now, it's just due to schedules and other
> things, it is still in the planning phase.  The biggest thing we are
> trying to work on solving is to keep it from going out of date so soon,
> to find a way to keep it up to date with the rapid pace of kernel
> development.
>
> sorry,

Fully agree with your dilemma.   Everyone has to take care of their
priorities.   For Greg, it is commercial and real-world problem.   For
others, it is their schoolwork and learning.   With Internet, it is
much faster and easier to help each other now.   For those who have
the time, I would appreciate if u can supply patches (to
HERE.....kernelnewbies!!!!) to baker's 2.6.25 LDD3 examples.

Focusing on the problem at hand now, I zoomed to the tty subdirectory.
  Only two file there - tiny_serial.c and tiny_tty.c.

Compiling it in the latest kernel 2.6.27 reveal some errors.   After
some trial and errors, I got it fixed, below is the patch:

/mnt/lv1/download/ldd3_examples/tty>diff -Nurp tiny_serial.c.orig  tiny_serial.c
--- tiny_serial.c.orig  2008-10-25 16:34:00.000000000 +0800
+++ tiny_serial.c       2008-10-25 16:32:39.000000000 +0800
@@ -103,7 +103,7 @@ static void tiny_timer(unsigned long dat
                return;
        if (!port->info)
                return;
-       tty = port->info->tty;
+       tty = port->info->port.tty;
        if (!tty)
                return;

@@ -289,4 +289,3 @@ static int __init tiny_init(void)
 }

 module_init(tiny_init);
-

/mnt/lv1/download/ldd3_examples/tty>diff -Nurp tiny_tty.c.orig  tiny_tty.c
--- tiny_tty.c.orig     2008-10-25 16:15:09.000000000 +0800
+++ tiny_tty.c  2008-10-25 16:26:26.000000000 +0800
@@ -507,10 +507,36 @@ static struct tty_operations serial_ops
        .write = tiny_write,
        .write_room = tiny_write_room,
        .set_termios = tiny_set_termios,
+
+/* with reference to drivers/char/synclinkmp.c */
+
+        .ioctl = tiny_ioctl, /* tiny */
+        .read_proc = tiny_read_proc, /* tiny */
+        .tiocmget = tiny_tiocmget, /* tiny */
+        .tiocmset = tiny_tiocmset, /* tiny */
 };

 static struct tty_driver *tiny_tty_driver;

+/*
+
+static const struct tty_operations ops = {
+        .put_char = put_char,
+        .flush_chars = flush_chars,
+        .chars_in_buffer = chars_in_buffer,
+        .flush_buffer = flush_buffer,
+        .throttle = throttle,
+        .unthrottle = unthrottle,
+        .send_xchar = send_xchar,
+        .break_ctl = set_break,
+        .wait_until_sent = wait_until_sent,
+        .stop = tx_hold,
+        .start = tx_release,
+        .hangup = hangup,
+};
+*/
+
+
 static int __init tiny_init(void)
 {
        int retval;
@@ -538,10 +564,6 @@ static int __init tiny_init(void)
        /* hack to make the book purty, yet still use these functions in the
         * real driver.  They really should be set up in the serial_ops
         * structure above... */
-       tiny_tty_driver->read_proc = tiny_read_proc;
-       tiny_tty_driver->tiocmget = tiny_tiocmget;
-       tiny_tty_driver->tiocmset = tiny_tiocmset;
-       tiny_tty_driver->ioctl = tiny_ioctl;

        /* register the tty driver */
        retval = tty_register_driver(tiny_tty_driver);

Now it compile successfully.

Good luck!!!!

-- 
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