maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Flashing Keyboard lights as patterns (https://talk.maemo.org/showthread.php?t=52239)

MohammadAG 2010-05-09 15:18

Flashing Keyboard lights as patterns
 
After putting the device into R&D 4-5 months ago, I got the idea of using the keyboard lights as a VU meter. Last week I started looking into it and came up with a flashing pattern (similar to Knight Rider, as lcuk likes to call it ;))

http://www.youtube.com/watch?v=g3pvdFpA1II

Here's the script for this pattern:
http://mohammadag.ucoz.com/maemo/KR.sh
As it is, the above script is just for fun (won't do anything other than flashing the keyboard)

lcuk also pythonized it and added it to two apps, one is mostly just a proof of concept (should also play the Knight Rider music if you have mplayer installed)

.deb package: http://mohammadag.ucoz.com/maemo/kni...er_0.1_all.deb run it from terminal as root, by executing "python /opt/liqbase/KR/KR.py" (without the quotes)
.py file (for developers, it can be imported and used as a loading/busy indicator), by lcuk, http://mohammadag.ucoz.com/maemo/KR.py

lcuk 2010-05-09 15:45

Re: Flashing Keyboard lights as patterns
 
maemo.org. A shadowy flight into the dangerous world of a man who does not exist.

Mohammad AG, a young loner on a crusade to champion the cause of the innocent, the helpless, the powerless, in a world of criminals who operate above the law.

brog 2010-05-09 16:35

Re: Flashing Keyboard lights as patterns
 
Is it possible to tell the script to run e.g. 5 times in a row so it lasts a little longer?

lcuk 2010-05-09 16:38

Re: Flashing Keyboard lights as patterns
 
yeah brog
thats easy
you see on the KR.py script it flashes a couple of times on startup

its simple to just adjust the loop and make it longer


i took this script and used it to make a 6key chord - pressing keys anywhere near the LED makes it light up and stay lit up indicating the mode.
turns the keyboard from 38 keys to 6

a bit of example code is posted here

http://twitter.com/lcuk/status/13642303906
http://liqbase.net/stuff/liqbubbles2.py

MohammadAG 2010-05-09 16:41

Re: Flashing Keyboard lights as patterns
 
Which reminds me, here's a manually made (yes, it was a pain) list of keycodes for the N900's QWERTY keymat - sorted by LEDs (which LED is closest to the key) (thanks go to qwerty12 for the xev binary)
Code:

LED1:
Backspace - 22
Enter - 36
Up - 111
Down - 116
Left - 113
Right - 114

LED2:
; - 59
. - 60
P - 33
O - 32
L - 46
Space - 65

LED3:
I - 31
J - 44
K - 45
U - 30
M - 58

LED4:
Y - 29
H - 43
N - 57
T - 28
G - 42
B - 56
F - 41
R - 27

LED5:
V - 55
E - 26
D - 40
C - 54
W - 25
S - 39
X - 53

LED6:
Ctrl - 37
Shift - 50
Blue arrow - 108
Z - 52
A - 38
Q - 24


brog 2010-05-09 16:43

Re: Flashing Keyboard lights as patterns
 
This could be nice when playing emulators. Thinking of having only the keys lit that you use

Rapparee 2010-05-09 16:53

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by brog (Post 650616)
Is it possible to tell the script to run e.g. 5 times in a row so it lasts a little longer?


Can you point out where i can maybe slow it down a little

lcuk 2010-05-09 17:08

Re: Flashing Keyboard lights as patterns
 
rapparee - in the scripts there are pauses added by different means

bash
gsleep 0.05

python:
time.sleep(0.02)


alter as required

santiago 2010-05-09 17:25

Re: Flashing Keyboard lights as patterns
 
is it possible to make an app that wokrs with different patterns for

sms, mms, call, simple digits etc?

lcuk 2010-05-09 17:29

Re: Flashing Keyboard lights as patterns
 
santiago - sure eventually i see that happening
it makes a really bright indicator for some things and its eye catching
however it only works when the keyboard is slid open for obvious reasons

xperto 2010-05-09 17:45

Re: Flashing Keyboard lights as patterns
 
Can someone temme how do i change the script please. i mean how do i do this in my phone. thanks :)

lcuk 2010-05-09 17:48

Re: Flashing Keyboard lights as patterns
 
xperto,
wait until an app come out which allow messing with it is the simplest answer

it should be simple to wire it through using python slide bars to adjust settings etc

xperto 2010-05-09 17:50

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by lcuk (Post 650704)
xperto,
wait until an app come out which allow messing with it is the simplest answer

it should be simple to wire it through using python slide bars to adjust settings etc


Thanks :) as i have no idea about the python i'll wait for the app :)

santiago 2010-05-09 18:04

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by lcuk (Post 650690)
santiago - sure eventually i see that happening
it makes a really bright indicator for some things and its eye catching
however it only works when the keyboard is slid open for obvious reasons

ummm.... do u mean that that pattern works without run the py file? i understood that it works just when u run it from a terminal... can u confirm that it works on open slide???

lcuk 2010-05-09 18:11

Re: Flashing Keyboard lights as patterns
 
santiago,
i meant its pretty damned useless when the keyboard is closed....

santiago 2010-05-09 18:14

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by lcuk (Post 650729)
santiago,
i meant its pretty damned useless when the keyboard is closed....

wh" i run from xterm it downloads some infos and no more... but it doesnt start automatically

AgentZ 2010-05-09 23:46

Re: Flashing Keyboard lights as patterns
 
is it possible to change the colour of the keyboard LED ?

santiago 2010-05-09 23:53

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by AgentZ (Post 651052)
is it possible to change the colour of the keyboard LED ?

no. they are just white i think...

6sicSIX 2010-05-09 23:57

Re: Flashing Keyboard lights as patterns
 
Not unless you want to replace the surface mount LED's.. They are tiny!!
I would love some red ones in my keyboard, but no way am I going near this with a soldering iron heh heh

Cue 2010-05-10 00:50

Re: Flashing Keyboard lights as patterns
 
this is great. would love to replace the initial 5 "lights" loading screen when you turn on the N900 with this instead, though with a closed keyboard it would be a bit pointless.

lcuk 2010-05-10 01:05

Re: Flashing Keyboard lights as patterns
 
interesting..

mybsearch 2010-05-10 01:12

Re: Flashing Keyboard lights as patterns
 
Hi

I am trying to install the .deb package but it says Incompatible application package. Is it because i have the leaked PR1.2 installed and titans kernel ???

santiago 2010-05-10 01:13

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by Cue (Post 651078)
this is great. would love to replace the initial 5 "lights" loading screen when you turn on the N900 with this instead, though with a closed keyboard it would be a bit pointless.

you can replace them!!! they are in /usr/share/hicolor/scalable/hildon and they are indicator-update*.png ;)

M A S T E R 2010-05-10 01:16

Re: Flashing Keyboard lights as patterns
 
How about this guys. This is a cool app but i personally think the best thing to use it for is when you are loading new apps onto the device or when the Phone is on the browser loading up a page. I personally have my keyboard out when i am surfing the web. Have those lights flash would be cool as it loads a web page or maybe an emulator or sms/mms. or just processing in general. Just some food for though.

-MASTER

santiago 2010-05-10 01:21

Re: Flashing Keyboard lights as patterns
 
i'd like to have it like led pattern editor... shure... one led pattern editor just for the keyboard... will be gorgeus to have effects like cascade... or like fog... or pulsing... ecc ecc

mybsearch 2010-05-10 01:27

Re: Flashing Keyboard lights as patterns
 
http://www.gadgets.dk/images/75_image2_500x500.gif

mybsearch 2010-05-10 01:31

Re: Flashing Keyboard lights as patterns
 
sorry about the last post

What i wanted to add with that shirt was that

What if this app could act like a graphical equalizer detecting music being played with the built in media player and then the left leds would work based on the bass, the middle on the vocals and the right ones on treble.

If that is too much work then just work like the Knight rider (or some other pattern) to any media being played and it would just detect music being played just like Tune Wiki does

MohammadAG 2010-05-10 01:38

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by mybsearch (Post 651116)
sorry about the last post

What i wanted to add with that shirt was that

What if this app could act like a graphical equalizer detecting music being played with the built in media player and then the left leds would work based on the bass, the middle on the vocals and the right ones on treble.

If that is too much work then just work like the Knight rider (or some other pattern) to any media being played and it would just detect music being played just like Tune Wiki does

That was my initial goal, but I never got around on to how I'd implement it (see Youtube comment and script comments at the top)
(if anyone's willing to do it use arecord -vv /dev/null)

lcuk 2010-05-10 01:39

Re: Flashing Keyboard lights as patterns
 
yeah moh, it was just simpler making a sweep initially
proof of concept ftw

nokiaboy97 2010-05-10 05:57

Re: Flashing Keyboard lights as patterns
 
This is definately interesting and has a lot of potential uses. I'm a noob at anything pertaining to scripts and everything, could someone PM or e-mail me a step by step walk throuhgh of how to apply scripts? I know NOTHING!! Where do I even begin? Is it an app for download? Thanks for any help, sorry for asking questions that I'm sure is common knowledge amongst the majority of this forum's users.

Andre Klapper 2010-05-10 10:48

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by nokiaboy97 (Post 651280)
could someone PM or e-mail me a step by step walk throuhgh of how to apply scripts?

Google for "linux shell script"? :)
Basically you mark a script file as executable and then you can run it.
chmod is your friend.

Pigro 2010-05-10 11:13

Re: Flashing Keyboard lights as patterns
 
ah, shiny toys! As an enhancement proposal: if you place a solar cell beside the keyboard during the light show, and wire it up to the phone's power input, you will have cracked the battery life issue too :-)

(sorry, couldn't resist ... I know the LED flashing is just harmless fun, but it did make me smile to run it on a device that is so "mAh-challenged").

rash.m2k 2010-05-10 14:45

Re: Flashing Keyboard lights as patterns
 
This is cool!

Lets see and iphone do this - oh wait it don't have a keyboard! :D

F2thaK 2010-05-11 11:07

Re: Flashing Keyboard lights as patterns
 
this looks so much better when you do it yourself!

cddiede 2010-05-11 16:51

Re: Flashing Keyboard lights as patterns
 
I'm trying to make a KR.desktop entry that will let me run this from a menu Icon, but I'm stuck due to the root access requirement.

I tried making a script that ran something like:

sudo gainroot;/usr/bin/python /opt/liqbase/KR/KR.py
or
sudo gainroot /usr/bin/python /opt/liqbase/KR/KR.py

But that just dumps the script out at a root prompt and fails to execute KR.py until after the root shell is exited.

Is it possible to post a script to that would not require root privileges to flash the keyboard lights?

lcuk 2010-05-11 16:54

Re: Flashing Keyboard lights as patterns
 
cddiede the script is a prototype and we are looking at how to enable playing with the lighting combinations without requiring root for every single app that uses it.
tho its most likely going to be a bit tricky

qwerty12 2010-05-11 16:58

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by lcuk (Post 653809)
cddiede the script is a prototype and we are looking at how to enable playing with the lighting combinations without requiring root for every single app that uses it.
tho its most likely going to be a bit tricky

Do an MCE and make a D-Bus service! Or, more simply, just add exceptions in sudoers

MohammadAG 2010-05-11 16:59

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by qwerty12 (Post 653821)
Do an MCE and make a D-Bus service! Or, more simply, just add exceptions in sudoers

afaik, sudoers would work for echoing into sysfs (I have sudo enabled for all binaries)

Edit: wouldn't*

lcuk 2010-05-11 17:06

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by MohammadAG (Post 653829)
afaik, sudoers would work for echoing into sysfs (I have sudo enabled for all binaries)

i think MohammadAG is a pretty cool guy
eh runs all binaries as root as doesn't afraid of anything ;)

for normal users however I think a simpler approach would be required.

MohammadAG 2010-05-11 17:08

Re: Flashing Keyboard lights as patterns
 
Quote:

Originally Posted by lcuk (Post 653841)
i think MohammadAG is a pretty cool guy
eh runs all binaries as root as doesn't afraid of anything ;)

for normal users however I think a simpler approach would be required.

lol it shouldn't affect security, a lot... :P
Code:

~ $ sudo echo 0 > /sys/class/i2c-adapter/i2c-2/2-0032/leds\:lp5523\:kb1/brightness     
-sh: cannot create /sys/class/i2c-adapter/i2c-2/2-0032/leds:lp5523:kb1/brightness: Permission denied

Code:

echo "/path/to/script.sh" | root
should work though

On its own I can't see why it needs a .desktop file and .deb package, otherwise I would've made them. It doesn't even have a GUI (yet)


All times are GMT. The time now is 17:21.

vBulletin® Version 3.8.8