The below code shows a keyboard interrupt program. The Keyboard interrupt line number on an x86 based system is “1“. The program attempts to obtain the key press from the user and act upon it.
In the program – the key press and key release both trigger the interrupt line and the ISR – “keyboard_isr” gets invoked twice. Once for key-press and another for key-release for each character pressed on the keyboard.
The “/proc/interrupts” output shows the “keyboard_isr_example” sharing the keyboard interrupt with the “i8042” keyboard handler.
The dmesg output provides the ISR being invoked for each key press/release on the keyboard.
Pingback: Interrupt Service Routine (ISR) | Hitch Hiker's Guide to Learning