On 08/12/2010 03:28 PM, Parmenides wrote: > Hi, > > For some traditional devices, such as floppy, keyboard, etc, the IRQ > is static, and their drivers know corresponding IRQs to register their > ISR. While for other devices hot plugged, such as USB devices, how > does the PIC or APIC allocate the IRQs for their controller? And how > does the deriver of a such device know the the corresponding IRQ so as > to register its ISR into the kernel? This is a fairly complicated system that is different based on the type of hardware (PCI, USB, more old fashioned hardware, processor type) and requires some knowledge of the actual device being used. I think the best advice to give you is to read about the way interrupts are handled in the kernel. A good resource is the Linux Device Drivers book [1], in particular chapter 10, 12, 13, and 14. (Quite a lot, but your question is a bit broad.) The short answer is that it may be polling, hotplug events, or reading a configuration register for the bus. For USB it is linked to the USB core system that allows the use of a callback function (probe) which a driver uses to get information about a device as it is connected, allowing the driver to properly register the device with the subsystem. HTH, Wouter [1] http://lwn.net/Kernel/LDD3/ -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ