[patch] make parport autoprobe more reliable

From: Tim Waugh (twaugh@redhat.com)
Date: Tue Jan 11 2000 - 07:40:58 EST


Here's a patch for 2.2.14 that I'd like as many people to test out as
possible. The idea is to make sure that a best attempt is made to make
the information in /proc/parport/*/autoprobe accurate.

So, please build _clean_ 2.2.14 with modular parport support, modular
parport_pc support, and modular 'PNP parport' support
(parport_probe). Using that kernel, 'modprobe parport_pc' and 'modprobe
parport_probe', and take a look at the autoprobe information in
/proc/parport.

Then apply this patch, recompile, and try again (after unloading the
parport modules obviously).

Relevant parts of 'dmesg' output after the patch has been applied would be
nice to see too.

Please send all results to twaugh@redhat.com, NOT to this list.

Thanks,
Tim.
*/

--- linux/drivers/pnp/parport_probe.c~ Wed Jan 20 21:29:18 1999
+++ linux/drivers/pnp/parport_probe.c Mon Jan 10 22:15:28 2000
@@ -96,6 +96,7 @@
         struct pardevice *dev = parport_register_device(port, "IEEE 1284 probe", NULL, NULL, NULL, 0, &dev);
 
         int result = 0;
+ int lives = 1;
 
         if (!dev) {
                 printk("%s: unable to register for probe.\n", port->name);
@@ -104,6 +105,7 @@
 
         parport_claim_or_block(dev);
 
+ try_again:
         switch (parport_ieee1284_nibble_mode_ok(port, 4)) {
         case 2:
                 current->state=TASK_INTERRUPTIBLE;
@@ -115,6 +117,20 @@
                 result = -EIO;
                 break;
         }
+
+ if (result < 1 && lives--) {
+ /* Reset the peripherals and try again. */
+ parport_pc_write_control(port, 0x8);
+ parport_pc_write_data(port, 0);
+ udelay (50);
+ parport_pc_write_control(port, 0xc);
+ udelay (500);
+ goto try_again;
+ }
+
+ printk (KERN_DEBUG "parport_probe: %s%s\n",
+ lives ? "" : "after reset: ",
+ result < 1 ? "failed" : "succeeded");
 
         parport_release(dev);
         parport_unregister_device(dev);
--- linux/drivers/misc/parport_pc.c~ Tue Jan 4 21:19:58 2000
+++ linux/drivers/misc/parport_pc.c Mon Jan 10 21:02:40 2000
@@ -839,11 +839,6 @@
                  * Put the ECP detected port in the more PS2 like mode.
                  */
                 parport_pc_write_econtrol(p, 0x34);
- parport_pc_write_control(p, 0x8);
- parport_pc_write_data(p, 0);
- udelay (50);
- parport_pc_write_control(p, 0xc);
- udelay (50);
 
         if (parport_probe_hook)
                 (*parport_probe_hook)(p);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:18 EST