[PARPORT] make lp driver use ECP mode

From: Philip.Blundell@pobox.com
Date: Thu Mar 22 2001 - 15:19:40 EST

  • Next message: Mark Cianfaglione: "[PARPORT] FW: results from EPP mode"

    Here's a small patch to make the lp driver use ECP transfers on hardware that
    supports such things.

    p.

    Index: drivers/char/lp.c
    ===================================================================
    RCS file: /cvs/linux/drivers/char/lp.c,v
    retrieving revision 1.83
    diff -u -p -u -r1.83 lp.c
    --- drivers/char/lp.c 2001/03/07 00:44:37 1.83
    +++ drivers/char/lp.c 2001/03/22 20:15:31
    @@ -246,6 +246,7 @@ static ssize_t lp_write(struct file * fi
             ssize_t retv = 0;
             ssize_t written;
             size_t copy_size = count;
    + int ret;
     
     #ifdef LP_STATS
             if (jiffies-lp_table[minor].lastcall > LP_TIME(minor))
    @@ -269,7 +270,11 @@ static ssize_t lp_write(struct file * fi
              parport_claim_or_block (lp_table[minor].dev);
     
             /* Go to compatibility mode. */
    - parport_negotiate (port, IEEE1284_MODE_COMPAT);
    + if (ret = parport_negotiate (port, lp_table[minor].mode)) {
    + printk(KERN_DEBUG "lp%d: selecting compatibility mode (%d).\n",
    + minor, ret);
    + lp_table[minor].mode = IEEE1284_MODE_COMPAT;
    + }
     
             parport_set_timeout (lp_table[minor].dev,
                                  lp_table[minor].timeout);
    @@ -681,6 +686,12 @@ static int lp_register(int nr, struct pa
             if (lp_table[nr].dev == NULL)
                     return 1;
             lp_table[nr].flags |= LP_EXIST;
    +
    + if (port->probe_info[0].class != PARPORT_CLASS_LEGACY
    + && (port->modes & PARPORT_MODE_ECP))
    + lp_table[nr].mode = IEEE1284_MODE_ECP;
    + else
    + lp_table[nr].mode = IEEE1284_MODE_COMPAT;
     
             if (reset)
                     lp_reset(nr);
    Index: include/linux/lp.h
    ===================================================================
    RCS file: /cvs/linux/include/linux/lp.h,v
    retrieving revision 1.19
    diff -u -p -u -r1.19 lp.h
    --- include/linux/lp.h 2000/02/17 05:49:19 1.19
    +++ include/linux/lp.h 2001/03/22 20:15:31
    @@ -145,6 +145,7 @@ struct lp_struct {
             struct semaphore port_mutex;
             wait_queue_head_t dataq;
             long timeout;
    + unsigned int mode;
     };
     
     /*

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Thu Mar 22 2001 - 15:19:03 EST