[PARPORT] Re: Detecting parallel ports


Tim Waugh (tim@cyberelk.demon.co.uk)
Sat, 10 Apr 1999 16:53:38 +0100 (GMT)


Thomas,

Here's a quick patch to 2.2.5-tmw4 (but it will apply to pretty much any
recent tmw tree) to try to figure out what it is that parport_pc does that
makes your printer decide not to print.

It adds some module parameters: ecr, ecp, ecpps2, epp, ecpepp, ps2, and
init. They default to 1, but you can set them to 0 to disable the
corresponding code (insmod parport_pc init=0, for instance).

Cc'd to linux-parport in case anyone else finds it useful.

Tim.
*/

--- linux/drivers/misc/parport_pc.c.orig Thu Apr 8 19:49:33 1999
+++ linux/drivers/misc/parport_pc.c Sat Apr 10 16:43:33 1999
@@ -1223,6 +1223,15 @@
 
 /* --- Initialisation code -------------------------------- */
 
+/* Probe options */
+static int ecr __initdata = 1;
+static int ecp __initdata = 1;
+static int ecpps2 __initdata = 1;
+static int epp __initdata = 1;
+static int ecpepp __initdata = 1;
+static int ps2 __initdata = 1;
+static int init __initdata = 1;
+
 static int __init probe_one_port(unsigned long int base,
                                  unsigned long int base_hi,
                                  int irq, int dma)
@@ -1239,20 +1248,20 @@
         p->ops = &parport_pc_ops;
         if (base != 0x3bc) {
                 if (base_hi && !check_region(base_hi,3)) {
- p->modes |= parport_ECR_present(p);
- p->modes |= parport_ECP_supported(p);
- p->modes |= parport_ECPPS2_supported(p);
+ p->modes |= ecr ? parport_ECR_present(p) : 0;
+ p->modes |= ecp ? parport_ECP_supported(p) : 0;
+ p->modes |= ecpps2 ? parport_ECPPS2_supported(p) : 0;
                 }
                 if (!check_region(base+0x3, 5)) {
- p->modes |= parport_EPP_supported(p);
- p->modes |= parport_ECPEPP_supported(p);
+ p->modes |= epp ? parport_EPP_supported(p) : 0;
+ p->modes |= ecpepp ? parport_ECPEPP_supported(p) : 0;
                 }
         }
         if (!parport_SPP_supported (p))
                 /* No port. */
                 return 0;
         
- p->modes |= PARPORT_MODE_PCSPP | parport_PS2_supported (p);
+ p->modes |= PARPORT_MODE_PCSPP | (ps2 ? parport_PS2_supported (p) : 0);
 
                if (!(p = parport_register_port(base, PARPORT_IRQ_NONE,
                                         PARPORT_DMA_NONE, &parport_pc_ops)))
@@ -1351,13 +1360,16 @@
                  * Put the ECP detected port in the more SPP like mode.
                  */
                 parport_pc_write_econtrol(p, 0x0);
- parport_pc_write_data(p, 0);
- parport_pc_write_control(p, PARPORT_CONTROL_SELECT);
- udelay (50);
- parport_pc_write_control(p,
- PARPORT_CONTROL_SELECT
- | PARPORT_CONTROL_INIT);
- udelay (50);
+
+ if (init) {
+ parport_pc_write_data(p, 0);
+ parport_pc_write_control(p, PARPORT_CONTROL_SELECT);
+ udelay (50);
+ parport_pc_write_control(p,
+ PARPORT_CONTROL_SELECT
+ | PARPORT_CONTROL_INIT);
+ udelay (50);
+ }
 
         /* Now that we've told the sharing engine about the port, and
            found out its characteristics, let the high-level drivers
@@ -1461,6 +1473,15 @@
 MODULE_PARM(io, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "i");
 MODULE_PARM(irq, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
 MODULE_PARM(dma, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
+
+/* Probe options. */
+MODULE_PARM(ecr, "i");
+MODULE_PARM(ecp, "i");
+MODULE_PARM(ecpps2, "i");
+MODULE_PARM(epp, "i");
+MODULE_PARM(ecpepp, "i");
+MODULE_PARM(ps2, "i");
+MODULE_PARM(init, "i");
 
 int init_module(void)
 {

-- 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 Sat 10 Apr 1999 - 12:09:49 EDT