问题
I want to Send my machine an hardware event so that my caps-lock key becomes enable. When I send enable interrupt, light on Caps-lock key should be on and when I send enable interrupt, light on Caps-lock key should be off.
I am using Qt, Mac, C++, Carbon.
回答1:
No need for an interrupt. The Caps Lock, Num Lock, and Scroll Lock lights are programmatically controllable.
Note that this won't actually turn the Caps Lock on (causing the user to enter all-capital text), but you shouldn't do that. If you need text input to be in a specific format, then you should make any needed repairs to it—which may include capitalizing it—yourself.
回答2:
Can you even generate a HW interrupt from a non-privileged userspace application on OS X. It sound to me as if this is something that you should request the OS to do (i.e. turn on or off Caps Lock)
来源:https://stackoverflow.com/questions/2334022/generate-the-hardware-interupt-which-will-enable-the-capslock