hi
i am working my way through "essential linux device drivers"
it has an example of a driver for an led attached to the parallel port
in the init function, a call to parport_register_driver is made, but it's
not well explained whats going on here
this function takes a pointer to a struct parport_driver with socalled
attach and detach functions
the attach function simply calls parport_register_device with a pointer to
yet another function called led_preempt
the book says "when the kernel finds the led board during led attach, it
registers the device by invoking parport_register_device()"
how does the kernel know if the led board is connected? if it finds
something is connected to the parport, how does it know its the led board,
and not, say, a printer?
when is led_detach called?
and what about led_preempt?
can someone shed some light on this?
the code im talking about can be found here

http://elinuxdd.com/~elinuxdd/elinuxdd.docs/listings/listing05.6.html

i would like to try this out but dont know how to build the hardware to do
that

is there a simpler way i can try this out without much electronics work
involved?

thanks

martin

Reply via email to