Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    caps lock, num lock & scroll lock

    Does anyone know how to turn the caps lock, num lock & scroll lock LED in keyborad on and off in C or Python. Thanks

  2. #2
    Linux Engineer
    Join Date
    Sep 2003
    Knoxhell, TN
    you have to send a scancode to the keyboard.. i'm not sure exactly which one is sent, but there are a few resources on the web about scancodes...

    once you find the scancode, you should be able to just do something like this:

    FILE *openkbd(char *file)
          FILE *fp=NULL;
          return (fp)
    int main()
           char *file=NULL;
           FILE *fp=NULL;
           write&#40;fp, "<scancode goes here>"&#41;;
           return 0;
    that's just a rough example and some of my syntax may be off.. i'm a bit tired atm.... but the idea is to open the /dev file for the keyboard and write the scancode to it.
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  3. #3
    Linux Guru
    Join Date
    Mar 2003
    Here is a link some code that blinks the keyboard LEDs. It might help or give you a start. From here there's also a link to a program called tled on freshmeat

    Good Luck!
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts