https://github.com/bcanozter/capslock_notifier
https://github.com/bcanozter/capslock_notifier
linux-kernel linux-kernel-module linux-kernel-modules procfs
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bcanozter/capslock_notifier
- Owner: bcanozter
- License: mit
- Created: 2025-07-14T17:21:01.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-07-18T19:55:18.000Z (5 months ago)
- Last Synced: 2025-07-19T00:25:47.679Z (5 months ago)
- Topics: linux-kernel, linux-kernel-module, linux-kernel-modules, procfs
- Language: C
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Caps Lock Notifier Kernel Module
This Linux kernel module is written for learning purposes. It registers an input handler to capture keyboard events and monitors the Caps Lock LED state. The current state is exposed via the proc file system for user-space access.
## Features
- Registers an input handler to listen for keyboard events
- Detects and reports the Caps Lock LED state (ON/OFF)
- Exposes the state via `/proc/capslock_state`
## Environment Details
- Linux kernel headers: `linux-headers-6.8.0-64-generic`
- GCC: `12.3.0-1ubuntu1~22.04`
## Build
```
make
```
## Load the Module
```
sudo insmod capslock_notifier.ko
```
## Usage
Read the current Caps Lock LED state:
```
cat /proc/capslock_state
```
- Output is `1` if Caps Lock is ON, `0` if OFF.
## Example Output
```bash
[12747.354555] Init capslock_notifier module
[12747.354563] Connected input device: AT Translated Set 2 keyboard
[12747.354564] (AT Translated Set 2 keyboard): Initial Caps Lock state: OFF
[12747.354569] Connected input device: Corsair Corsair Gaming K95 RGB PLATINUM Keyboard
[12747.354571] (Corsair Corsair Gaming K95 RGB PLATINUM Keyboard): Initial Caps Lock state: OFF
[12748.564202] (Corsair Corsair Gaming K95 RGB PLATINUM Keyboard): Caps Lock LED state: ON
[12749.356137] (Corsair Corsair Gaming K95 RGB PLATINUM Keyboard): Caps Lock LED state: OFF
```
## Unload the Module
```
sudo rmmod capslock_notifier
```
---
**Author:** Burak Ozter