This README provides step-by-step instructions on how to create and use a custom interrupt handler for keyboard input on a Linux system. The custom handler will capture key presses and record them in a file named input.txt
. This guide assumes that you have some familiarity with using the terminal on a Linux system.
Before you begin, make sure you have the following prerequisites:
- A Linux-based operating system.
- Administrative privileges or the ability to switch to the root user.
- Basic knowledge of using the terminal.
Follow these instructions to create and use the custom interrupt handler:
- Open the terminal and navigate to the path where you want to work.
cd /path/to/your/directory
- Switch to the root user. You can use the
sudo
command to execute commands with root privileges.
sudo su
- Run the 'make' command to compile your custom interrupt handler code. This will generate several files, including
interrupt.o
,interrupt.ko
,interrupt.mod.c
, andinterrupt.mod.o
.
make
- The 'insmod interrupt.ko' command will remove the existing interrupt handler and insert your custom handler.
insmod interrupt.ko
-
To verify that the command executed successfully, check the current directory. You should see a new
input.txt
file created. This file will be used to store all the keys pressed by the user. -
With the custom interrupt handler in place, you are now ready to capture keyboard input. Simply press any key on the keyboard, and the keypresses will be recorded in the
input.txt
file.
Note: The text will only be visible in the input.txt
file when you press the Enter key or reach the 128-character limit.
You can now use this custom interrupt handler to capture and record keyboard input in real-time. To access the recorded keypresses, open the input.txt
file located in the same directory where you executed the commands.
Feel free to customize the code and further enhance the functionality of the interrupt handler as needed for your specific use case.