Amazing Keyboard Disco
#1
Try running this Python script as root and look at your keyboard.
Don't do this on VPS because there is no physical keyboard out there.
Use at your own caution. I am not responsible for anything even though this is harmless.
Code:
import fcntl
import os
import time

KDSETLED = 0x4B32
SCR_LED  = 0x01
NUM_LED  = 0x02
CAP_LED  = 0x04

console_fd = os.open('/dev/console', os.O_NOCTTY)

all_on = SCR_LED | NUM_LED | CAP_LED
all_off = 0
scr_on  = SCR_LED
num_on = NUM_LED
cap_on = CAP_LED


while 1:
    fcntl.ioctl(console_fd, KDSETLED, all_on)
    #time.sleep(1)
    fcntl.ioctl(console_fd, KDSETLED, all_off)
    #time.sleep(1)
    fcntl.ioctl(console_fd, KDSETLED, num_on)
    #time.sleep(1)
    fcntl.ioctl(console_fd, KDSETLED, cap_on)
    #time.sleep(1)
    fcntl.ioctl(console_fd, KDSETLED, scr_on)
    #time.sleep(1)
Don't worry about the world coming to an end today. It's already tomorrow in Australia.
Reply
#2
It's a shame my keyboard doesn't have those lights.
Reply
#3
aatish,
i suggest you to put a screenshot,
bcuz i doesn't really know how the "disco" look like Big Grin
Reply
#4
There is nothing to screenshot. It doesn't happen in screen. By running this script, you will be able to see for yourself right on your Keyboard. The fun of hardware programming is beyond the explanation.
Literally, "disco light" means vibrant lights switching in a pattern.
Don't worry about the world coming to an end today. It's already tomorrow in Australia.
Reply
#5
Windows way:

1. Open Notepad or any IDE you would like to use.
2. Paste:
Code:
Set wshShell =wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
wshshell.sendkeys "{CAPSLOCK}"
wshshell.sendkeys "{NUMLOCK}"
wshshell.sendkeys "{SCROLLLOCK}"
loop
3. Save it as whateveryouwant.vbs (e.g: disco.vbs).
4. Run the vbs file.

[attachment=307]
Reply
#6
On my laptop, which has no Scroll Lock key and has the Caps and Num Lock key leds right on the keys itself, it's not so nice as with a standard desktop keyboard with the three leds on the right top corner...
Reply
#7
Just a little note:

To stop it (in Windows), stop the process wscript.exe.
Reply
#8
doesnt work for me! What am I missing?
Blush
IMITATING is so IRRITATING!


Share with us - www.GeeksGH.com
where BEST MINDS meet!
Wink
Reply
#9
Oh sO THIs iS HoW pEoplE TYpE lIke tHiS..

To clear the confusion, it cycles through the caps lock, num lock and scroll lock on-off, which also turns the keyboard lights on and off. It's fun!
"I like to put random quotes, to make myself look clever."
- WiseMannnn
Reply
#10
I am writing a Morse code to keyboard lights converter. Wait for some days.
Don't worry about the world coming to an end today. It's already tomorrow in Australia.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)