Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Toggling keyboard LEDs?

Toggling keyboard LEDs?
Thread Tools
parallax
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Sep 14, 2002, 02:48 PM
 
Anyone know how to do this to a USB keyboard in OS X (programmatically of course)?
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
IamBob
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Sep 16, 2002, 11:30 PM
 
I doubt the keyboard would let you. Why would it? If that makes sense..

You might be able to find something in the keyboard drivers...? For some reason I doubt there are setXXX type methods/functions for something like that.
     
00101001
Mac Enthusiast
Join Date: Jan 2001
Status: Offline
Reply With Quote
Sep 17, 2002, 12:12 AM
 
Of course there are functions... I checked apple's site -- they've got a bunch of info on the ADB Manager, but that does you no good... I think what you're looking for is in the HID Manager -- searching for that *kinda* returned some code that did something to the hardware of the keyboard -- but I have no clue what I'm talking about.

do a search on developer.apple.com for USB Manager and HID Manager...
     
parallax  (op)
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Sep 17, 2002, 12:53 PM
 
Originally posted by IamBob:
I doubt the keyboard would let you. Why would it? If that makes sense..

You might be able to find something in the keyboard drivers...? For some reason I doubt there are setXXX type methods/functions for something like that.
I'm pretty sure it was easy in OS 9. In Linux you can just make an ioctl call on /dev/tty.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
IamBob
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Sep 18, 2002, 01:56 PM
 
Seriously?..

That seems really strange to me. The only LEDs on my keyboard are caps and num lock. I'm not sure I'd want "someone else" to use them..

Oh well(back on-topic..), best of luck on figuring it out!
     
parallax  (op)
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Sep 18, 2002, 07:49 PM
 
Originally posted by IamBob:
Seriously?..

That seems really strange to me. The only LEDs on my keyboard are caps and num lock. I'm not sure I'd want "someone else" to use them..

Oh well(back on-topic..), best of luck on figuring it out!
Thanks. ;o)

I have a scroll lock as well, and I've heard of people writing programs to use them as indicators for little things, e.g. network activity.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
IamBob
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Sep 18, 2002, 08:57 PM
 
Ok, the geek in me can admit it...that would be cool!
     
Evinyatar
Mac Enthusiast
Join Date: May 2000
Location: Belgium
Status: Offline
Reply With Quote
Sep 19, 2002, 04:53 AM
 
I've done this in MacOS 9 where it was really easy. I think that with the HID Manager you'd just toggle a few flags, kinda like how you'd make force feedback work with gamepads/joysticks.
     
Glennfield
Junior Member
Join Date: Dec 2001
Location: My own personal purgatory
Status: Offline
Reply With Quote
Sep 20, 2002, 11:25 PM
 
Bonus points to whoever can make it so that the Num Lock light doesn't toggle when I hit Clear while running the Calculator.
"A scientist can discover a new star but he cannot make one. He would have to ask an engineer to do it for him."
     
Gul Banana
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Sep 21, 2002, 09:31 AM
 
Have a look in IOKit.framework - it includes all the HID stuff. I'm not experienced enough with the IOKit to do it myself, I'm afraid.
[vash:~] banana% killall killall
Terminated
     
00101001
Mac Enthusiast
Join Date: Jan 2001
Status: Offline
Reply With Quote
Sep 21, 2002, 02:54 PM
 
hmmm....
/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/usb/USBSpec.h defines

enum {
kUSBCapsLockKey = 0x39,
kUSBNumLockKey = 0x53,
kUSBScrollLockKey = 0x47
};

still looking for what the hell you can do with this though...
     
IamBob
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Sep 21, 2002, 09:28 PM
 
Has anyone gone looking through the IORegistryExplorer?

I wouldn't know what to look for but there seems to be much info buried in there.
     
   
 
Forum Links
Forum 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 On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:02 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,