Re: [PARPORT] Ezflyer230 + Printer


Tim Waugh (tim@cyberelk.demon.co.uk)
Tue, 6 Apr 1999 23:36:45 +0100 (GMT)


On 6 Apr 1999, Soulier, Frederic wrote:

> I end up having the same pbm... as for the Ezflyer I guess it will be ok
> once I can get my parallel port to work with kernel 2.2.x

My latest 'latch' fix is appended ("patch-2.2.5-latch"). It _should_
detect your port when you say "insmod parport_pc" with no parameters, but
if that fails, it will believe you if you specify a base address (io=0x378
or whatever).

Let me know whether you need to specify the base address before your port
is recognised.

Tim.
*/

--- drivers/misc/parport_pc.c~ Wed Mar 24 01:42:59 1999
+++ drivers/misc/parport_pc.c Fri Mar 26 20:45:23 1999
@@ -53,6 +53,8 @@
    than PARPORT_MAX (in <linux/parport.h>). */
 #define PARPORT_PC_MAX_PORTS 8
 
+static int user_specified = 0;
+
 static void parport_pc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
         parport_generic_irq(irq, (struct parport *) dev_id, regs);
@@ -355,13 +357,23 @@
 
         /* Do a simple read-write test to make sure the port exists. */
         parport_pc_write_control(pb, 0xc);
+ if ((parport_pc_read_control (pb) & 0x3f) == 0xc)
+ return PARPORT_MODE_PCSPP;
+
+ /* Try the data register. */
         parport_pc_write_data(pb, 0xaa);
- if (parport_pc_read_data(pb) != 0xaa) return 0;
-
- parport_pc_write_data(pb, 0x55);
- if (parport_pc_read_data(pb) != 0x55) return 0;
+ if (parport_pc_read_data(pb) == 0xaa) {
+ parport_pc_write_data (pb, 0x55);
+ if (parport_pc_read_data (pb) == 0x55)
+ return PARPORT_MODE_PCSPP;
+ }
 
- return PARPORT_MODE_PCSPP;
+ /* It's possible that we can't read the control register or
+ the data register. In that case just believe the user. */
+ if (user_specified)
+ return PARPORT_MODE_PCSPP;
+
+ return 0;
 }
 
 /* Check for ECP
@@ -787,6 +799,7 @@
         int count = 0, i = 0;
         if (io && *io) {
                 /* Only probe the ports we were given. */
+ user_specified = 1;
                 do {
                         count += probe_one_port(*(io++), *(irq++), *(dma++));
                 } while (*io && (++i < PARPORT_PC_MAX_PORTS));

-- 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 2.0b3 on Tue 06 Apr 1999 - 18:43:01 EDT