Re: Talking to parallel port in 2.6 kernel without using parport

From: Alan Cox
Date: Mon Apr 14 2008 - 08:44:20 EST


> ***** However, I am still unable to open my device. Can someone tell me
> what I am missing?
> What do I need to do to talk to the parallel port myself and NOT go through
> parport?

You should go through parport. The parport layer is there for a reason.
You drive on the road not through fields (even if shorter distances)
please show the same respect for the kernel and your users (plus it'll
make your job easier).

If you need to hog the device because it doesn't follow 1284 or other
sharing standards the parport_register_device can be called with
PARPORT_DEV_EXCL in flags, which means you want to sit on it.

So for something like a standard PC built in port (for the little time
they have left before they go away in hardware..)

struct parport *p = parport_find_base(0x378 /* etc */);

parport_register_device(p, "mywidget", NULL,
my_irq_handler, PARPORT_DEV_EXCL, &mystruct)
parport_enable_irq(p);

where mystruct is a private object that will be passed back to you in the
callbacks. If you don't use the IRQ then don't call parport_enable_irq
and my_irq_handler can also be NULL.

Alan

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