Search

kbleds.c for linux kernel version 3.7.5

The example of blinking led given at "http://www.tldp.org/LDP/lkmpg/2.6/html/lkmpg.html#AEN1201 " works fine for kernel versions before 2.6.36, but for version above that it fails to compile due the changes in the structure vc_data and ioctl call of tty_driver.

Here is the modified code tested and working on 3.7.5.

The changes are

1. change the the vc_tty pointer to port.tty



2. Remove the argument "NULL" being passed to the ioctl call of tty driver.



Full code:



Now save the file as kbleds.c

Compile it using the makefile



Insert it into the kernel using insmod



The key board leds should start to blink as soon as the module is inserted and will continue to blink as long as we do not remove the module using rmmmod



or reboot the system.

Follow by Email