Linux Device Driver to disable/enable keyboard
Theory:
As we have seen in our earlier posts, that there are three registers for keyboard controller.
We have loaded the module using the command "sleep 1 && insmod ./kbd_disable.ko". If you try only "insmod ./kbd_disable.ko", the keyboard will disable at "Enter Press", so the console will be continuously receiving Enter Press Keys, until keyboard gets enabled back
As we have seen in our earlier posts, that there are three registers for keyboard controller.
- Control Register (0x64) -- Write Operation
- Data Register (0x60) -- Write/Read Operation
- Status Register (0x60) -- Read Operation
Process to disable Keyboard:
- Wait until the keyboard controller is not busy by reading the status register
- Send the command 0xAD to Control Register
Process to Enable Keyboard:
- Wait until the keyboard controller is not busy by reading the status register
- Send the command 0xAE to Control Register.
Code:
Output:
Notes:
We have loaded the module using the command "sleep 1 && insmod ./kbd_disable.ko". If you try only "insmod ./kbd_disable.ko", the keyboard will disable at "Enter Press", so the console will be continuously receiving Enter Press Keys, until keyboard gets enabled back
Comments
Post a Comment