LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-05-2003, 09:09 AM   #1
dummyagain
Member
 
Registered: Sep 2003
Posts: 74

Rep: Reputation: 15
ioctl


Can u tell me how to use ioctl to switch on and off the keyboard LED ??
 
Old 10-06-2003, 12:27 AM   #2
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
i dont know much ..but from the header file

in /usr/include/linux/keyboard.h ..what i make is there isnt a way of switching on/off an LED without the associated keys:
like num-lock,caps-lock,scroll lock.

so if you want to use these, you could use the key maps of those keys..but i really dont think there is a way of switching on or off an LED on its own..

also when the system starts up, the keyboard is checked, that is when all the LEDs glow and then go off...

perhaps you might find some relevant answers in that code...though am sure it is similar to what i am saying
 
Old 10-06-2003, 07:22 AM   #3
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
i quick man ioctl_list followed by a search for LED reveals the following ioctls

Code:
0x00004B31  KDGETLED               char *
0x00004B32  KDSETLED               int
0x00004B64  KDGKBLED               int *
0x00004B65  KDSKBLED               int
and just like a good little man page it tells us there in include/linux/kd.h

so we have a peek there and find

Code:
#define KDGETLED        0x4B31  /* return current led state */
#define KDSETLED        0x4B32  /* set led state [lights, not flags] */
#define         LED_SCR         0x01    /* scroll lock led */
#define         LED_NUM         0x02    /* num lock led */
#define         LED_CAP         0x04    /* caps lock led */

#define KDGKBLED        0x4B64  /* get led flags (not lights) */
#define KDSKBLED        0x4B65  /* set led flags (not lights) */
so with a few minutes of writing a test program it shouldnt be that hard to figure out how to do it.

<edit> it looks like jinksys gave you a pretty good start in this post, if you had more questions you should have posted them there, 1 thread per topic please.

Last edited by kev82; 10-06-2003 at 07:26 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ioctl cdrommsf fof3 Linux - Newbie 4 06-01-2005 02:44 PM
Serial / IOCTL fgordon Programming 2 08-24-2004 08:51 AM
ioctl.h blackzone Programming 1 07-26-2004 03:30 AM
ioctl question h/w Programming 2 10-26-2003 01:28 AM
ioctl unosoft Linux - Software 0 09-12-2003 06:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration