Post Reply 
Amazing Keyboard Disco
03-20-2012, 12:50 PM
Post: #1
Amazing Keyboard Disco
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.
User Tools
Quote this message in a reply


03-20-2012, 01:42 PM
Post: #2
RE: Amazing Keyboard Disco
It's a shame my keyboard doesn't have those lights.
User Tools
Quote this message in a reply
03-20-2012, 08:05 PM
Post: #3
RE: Amazing Keyboard Disco
aatish,
i suggest you to put a screenshot,
bcuz i doesn't really know how the "disco" look like Big Grin

User Tools
Quote this message in a reply
03-20-2012, 09:29 PM
Post: #4
RE: Amazing Keyboard Disco
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.
User Tools
Quote this message in a reply
03-21-2012, 03:47 AM
Post: #5
RE: Amazing Keyboard Disco
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]

Non existence
Spoiler: show
Duality. My life seems to be full of parallel events. Intricately connected, guiding me step by step, fortelling my actions, robbing me of my free will.
User Tools
Quote this message in a reply
03-24-2012, 08:49 AM
Post: #6
RE: Amazing Keyboard Disco
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...

My blog
[Image: fs.php]
User Tools
Quote this message in a reply
03-25-2012, 05:40 AM
Post: #7
RE: Amazing Keyboard Disco
Just a little note:

To stop it (in Windows), stop the process wscript.exe.

User Tools
Quote this message in a reply
03-25-2012, 05:53 AM
Post: #8
RE: Amazing Keyboard Disco
doesnt work for me! What am I missing?

Blush
IMITATING is so IRRITATING!


Share with us - www.GeeksGH.com
where BEST MINDS meet!
Wink
User Tools
Quote this message in a reply
03-25-2012, 07:50 AM
Post: #9
RE: Amazing Keyboard Disco
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
User Tools
Quote this message in a reply
03-25-2012, 10:16 AM
Post: #10
RE: Amazing Keyboard Disco
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.
User Tools
Quote this message in a reply
Post Reply 


Forum Jump:



User(s) browsing this thread:
1 Guest(s)