Skip to content

ganeshnischayp/Mouse_Device_Driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

USB Mouse Driver for linux which adjusts brightness on left and right clicks.

Using the device driver file :

After downloading the project, run make This will create a .ko file which we will use to load the device driver

  1. You need to register a device with a major number (same as in device driver code ) and minor number. sudo mknod /dev/myDev c 91 1

  2. Now remove the default usb driver (usbhid) sudo rmmod usbhid

  3. Now your usb mouse should stop working. Now load our device driver. sudo insmod usbmouse.ko

  4. Check whether clicks are working. you can do dmesg | tail after after pressing left click and right click to check if clicks are getting registered.

  5. compile adjustBrightness_exiting.c gcc adjustBrightness_exiting.c This file basically reads from /dev/myDev and adjusts brightness.

  6. Now run the compiled file sudo ./a.out on pressing left and right clicks, the brightness should change. (note the brightness file and values can be different for different machines. On mine the brightness varies from 0 - 10 and the file is /sys/class/backlight/acpi_video0/brightness.) middle click exits the program.

  7. Removing our driver sudo rmmod usbmouse

  8. Loading default usb driver back sudo modprobe usbhid

About

Device Driver for mouse to control screen brightness.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published