Is there a way to interact with keyboard LEDs (for Caps/Scroll/Num
Lock) in Python? I'd like to achieve an effect similar to the *NIX
command "setleds -L", but I'm not sure where to start, but I figured
someone out there would have an idea or maybe experience with something
similar. Thanks very much in advance for your help!
Chris 4 3397
On Friday 08 December 2006 23:18, Chris Lasher wrote:
Is there a way to interact with keyboard LEDs (for Caps/Scroll/Num
Lock) in Python? I'd like to achieve an effect similar to the *NIX
command "setleds -L", but I'm not sure where to start, but I figured
someone out there would have an idea or maybe experience with something
similar. Thanks very much in advance for your help!
Chris
Spur of the moment answer: call setleds program from within your program
better answer (fox X11): http://python-xlib.sourceforge.net/d...n-xlib_16.html
Take a look at get_keyboard_co ntrol() and change_keyboard _control(). As far as
knowing how to properly invoke them, I have no idea, maybe you could google
for examples or take a look at the setleds source?
- Jonathan
Jonathan Curran wrote:
Spur of the moment answer: call setleds program from within your program
better answer (fox X11): http://python-xlib.sourceforge.net/d...n-xlib_16.html
Take a look at get_keyboard_co ntrol() and change_keyboard _control(). As far as
knowing how to properly invoke them, I have no idea, maybe you could google
for examples or take a look at the setleds source?
- Jonathan
Thanks for your reply, Jonathan. The difficulty with setleds is that
only works from a virtual console (e.g., tty, CTRL+ALT+F1 through F6,
etc.), not from a terminal emulator inside X (e.g., pts, Xterm, Gnome
Terminal, Konsole, etc.), which is the environment where I'd like to
interact with the LEDs. The xlib package looks promising, though. One
thing I don't understand is the 32-bit mask. How does this represent
the LED states? I profess my ignorance.
Thanks!
Chris
"Chris Lasher" <ch**********@g mail.comwrote:
8<-------------------------------
interact with the LEDs. The xlib package looks promising, though. One
thing I don't understand is the 32-bit mask. How does this represent
the LED states? I profess my ignorance.
not sure if this will be of any use - but when you talk to the keyboard, then on
the wire, the bits are in a byte as follows:
LEDS EQU GBITS1 ;LEDS FOR OUTPUT TO KEYBOARD
SCROLL_LOCK_BIT EQU LEDS.0 ; - least significant bit
NUM_LOCK_BIT EQU LEDS.1 ; - bit 1
CAPS_LOCK_BIT EQU LEDS.2 ; - bit 2
They are set following a mode indicator command to the keyboard which is 0xED
I just happen to know this because we made a funny keyboard wedge box once.
Haven't a clue about how xlib achieves this, though...
- Hendrik This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: skearney |
last post by:
When I was in boy scouts, as part of learning Morse code, I was told
that the inventor of the typewriter originally put the letter 'e' under
the left middle finger, just below its present position. The typist
was often too fast and the print bars would jam. I heard the same
story when I took a typing class. This led me to wonder if 't' might
have been moved from the home row for the same reason. 'E is dit and T
is dash, under middle...
|
by: Steve Jorgensen |
last post by:
Well, it seems that Microsoft, or whatever powers that be have decided it's
time for us to have yet another standard keyboard layout change.
I think I see that the point of this one was to reduce the space occupied by
the keys on the right, so the reach to the mouse is not so bad, but the way
they chose to do it?
Ah - I see. Since most of what we type will simply be deleted at some point,
let's make sure the Delete key is big and easy...
|
by: herrcho |
last post by:
What's the difference between STDIN and Keyboard buffer ?
when i get char through scanf, i type in some characters and press
enter,
then, where do the characters go ? to STDIN or Keyboard buffer ? are
they same ?
thanks ^^
|
by: Don Riesbeck Jr. |
last post by:
I'm working on an application (OEM) using C# that utilizes input from a
keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device,
and input from it is sent to the system as if it were a keyboard. I need to
be able to identify input from the scanner and keyboard independently. I've
looked at DirectX.DirectInput, and using user32.dll to hook into the
keyboard messages, but neither method seems to allow for identification of...
|
by: rs |
last post by:
Hi guys,
I am trying to read from a USB keyboard using vb.net and HID classes. the
USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and
is detected in device manager as my keyboard. the USB keyboard is detected
as HID keyboard device. the program finds the keyboard if it is attached.
and I am getting valid handles. however, everytime I use the readfile
function I am getting "object reference not set to an instant...
| |
by: rs |
last post by:
Hi guys,
I am trying to read from a USB keyboard using vb.net and HID classes. the
USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and
is detected in device manager as my keyboard. the USB keyboard is detected
as HID keyboard device. the program finds the keyboard if it is attached.
and I am getting valid handles. however, everytime I use the readfile
function I am getting "object reference not set to an instant...
|
by: Melson |
last post by:
Hi
Can anyone help. I would like to replace the keys on the PC keyboard. For
example, when I press Q button it displays A on the screen in any programs
(MS Words, Note, Lotus....). And also when I press Ctrl + W button, it
displays G on the screen. I would like to make the keyboards configurable.
Should I write a Windows Service? Any suggestions would really appreciate.
Please help. Thanks.
|
by: yanz |
last post by:
Hi everyone. Hope you guys can help me. Attached below are VB6 codes for a hand phone to call to a modem. When the action is executed, a message box will pop out ‘Ring Ring’. I just want to know is there anyone out there have the codes for SMS where when the action is executed, a message box will pop out.
On the other hand, I also need some simple codes (VB6) for 8 LEDs lights for parallel ports.
Below is the coding for the calling with...
|
by: Xah Lee |
last post by:
http://xahlee.org/emacs/modernization.html
]
The Modernization of Emacs
----------------------------------------
THE PROBLEM
Emacs is a great editor. It is perhaps the most powerful and most
versatile text editor. And, besides text editing, it also serves as a
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |