View previous topic :: View next topic |
Author |
Message |
Nondysjunction n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 18 Jun 2005 Posts: 6 Location: Kitchener, Ont
|
Posted: Tue Dec 13, 2005 4:55 am Post subject: On-keyboard LCD support. Details within. |
|
|
The logitech G15 keyboard is an interesting piece of technology. It features a volume knob, multimedia keys, a backlit keyboard, and configurable macro keys, not to mention an LCD display built right into the keyboard.
I have got mostly everything working, except the LCD, and I was wondering if the kernel-level USB-based LCD support might work for this. On my system, the support is embodied by the kernel module usblcd. I am running on 2.6.14-gentoo-r3 currently.
If anyone had any resources related to small-scale LCDs under Linux or the usblcd kernel support, I would greatly appreciate any input.
Edit: I do realize that is not the purpose of the usblcd kernel support. However; maybe this may work?
Thank you for your time, cheers. ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
porsche08 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 25 Mar 2005 Posts: 4
|
Posted: Thu Dec 15, 2005 2:25 pm Post subject: |
|
|
I'm wondering if you were able to get macros working. I just bought one of these, but haven't hooked it up to my linux box yet. All I'm really interested in is using the G keys speed up programming a bit. For example, hitting G1 drops an if / else statement into my code.
Ryan |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Fri Jan 13, 2006 12:00 am Post subject: |
|
|
i got one too, and its pretty sweet but drivers make a world of difference.
i have been doing some research, and i have found some interesting tools. i am not a device programmer though, so instead of taking a crack at this myself i would like to share what i have found with you folks and see if anybody makes ground on this freakin thing.
first of all, its a good idea to get a windows box and install USB snoopy on it http://www.wingmanteam.com/usbsnoopy/
using USB snoopy you can listen to the transmission between the bus and device. Filter through the nonsense and find sent messages that seem to occur during image changes on the LCD.
next use the usb skel driver (drivers/usb/usb-skeleton.c) in the kernel source tree for a template. i dont know how this is accomplished, but the fops and minor variables in the declaration of the driver can be used to register your new driver with a TTY subsystem (!!).
of course then you have to write in functions for register/deregister and whatever other standard usb driver requirements are out there. but if you can register this thing with a tty subsystem, talking to the LCD in userspace would be cake!
...that doesnt help at all does it? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Fri Jan 13, 2006 9:19 pm Post subject: |
|
|
Hi,
I started writing a driver for this one. It seems to work pretty well.
http://www.waug.at/g15lcd/
Basically you have to patch your kernel a little bit (nothing dangerous though) and then compile a userspace app with libusb which will print text to the screen. The code for drawing pixels is already in there, so just be creative
Also I'll put a more advanced (smaller / better font etc) version up soon.
Oh, and i hope no one minds the spelling, this keyboard is strange to type on
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Fri Jan 13, 2006 10:35 pm Post subject: |
|
|
nice work! im a little confused about something though; in one of the images on your page i can barely make out that you are pipeing "hello world" into a file in /var... did i miss something? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Fri Jan 13, 2006 11:37 pm Post subject: |
|
|
nosenseofhumor1 wrote: | nice work! im a little confused about something though; in one of the images on your page i can barely make out that you are pipeing "hello world" into a file in /var... did i miss something? |
Ok, this little program just reads 5 lines from stdin and displays them, in an endless loop, as soon as it gets another 5 lines it will display these instead.
So I wanted to simply pipe the output from a script which generates the actual data I want to diplay into g15lcd.
The problem is if you
mknod foo p
cat foo | g15lcd &
echo "foobar" > foo
then stdin of g15lcd will get an eof as soon as echo "foobar" terminates.
-> g15lcd will stop reading
now you could either always pipe into a new g15lcd process (costly since the usb device opening will be done all the time) or, and thats what i did, create a second process which will simply read data from fifo A and write to stdout. If it gets an EOF from fifo A it will simply reopen it again. So, my setup is the following
a pipe in /var/run/g15lcd called g15_lcd_pipe, and another one called g15_lcd_pipe_internal
then I'm running
fifo_redir_helper g15_lcd_pipe > g15_lcd_pipe_internal &
cat g15_lcd_pipe_internal | g15lcd &
thus I can simply cat / echo data into g15_lcd_pipe and everything works.
(And my two pipes are in /var/run/g15lcd/, thats what you saw in the terminal)
For instance the last screenshot on the page is from a simple script (php, run by cron every minute) which will echo 5 lines into g15_lcd_pipe (the stock quotes which i get from yahoo).
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Sat Jan 14, 2006 12:46 am Post subject: |
|
|
wow, good trick! i have a few more questions though; are you looping the "display stdin" because the LCD requires that you are constantly sending data to it or it will clear the display, or because there wasnt a better way to watch it for changes and the loop's load is rather insignificant?
also,
Quote: |
then I'm running
fifo_redir_helper g15_lcd_pipe > g15_lcd_pipe_internal &
cat g15_lcd_pipe_internal | g15lcd &
|
when? once? after you send to g15_lcd_pipe? is this also in an endless loop? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sat Jan 14, 2006 10:59 am Post subject: |
|
|
nosenseofhumor1 wrote: | wow, good trick! i have a few more questions though; are you looping the "display stdin" because the LCD requires that you are constantly sending data to it or it will clear the display, or because there wasnt a better way to watch it for changes and the loop's load is rather insignificant? |
No, the LCD stores the data and I only have to update it when it changes. So, I'm not constantly looping but simply wait for another 5 lines of input. Until I get these the program does nothing. So, there is _zero_ load due to this.
nosenseofhumor1 wrote: |
Quote: |
then I'm running
fifo_redir_helper g15_lcd_pipe > g15_lcd_pipe_internal &
cat g15_lcd_pipe_internal | g15lcd &
|
when? once? after you send to g15_lcd_pipe? is this also in an endless loop? |
These two processes (fifo_redir_helper and g15lcd) will run forever untill you kill them. But non of these does any sort of polling. Until you send something to g15_lcd_pipe nothing happens. What will happen if you echo somthing into g15lcdpipe is that fifo_redir_helper will read the input until it gets an EOF, then it will print it out to stdout (which will write into g15_lcd_pipe_internal) and then it will reopen g15_lcd_pipe.
Then g15lcd will read from g15_lcd_pipe_internal (but it wont get and eof) and print that to the lcd
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sat Jan 14, 2006 1:57 pm Post subject: |
|
|
Ok, I've updated the page (http://www.waug.at/g15lcd/) with a newer version.
You now don't need any fifo helpers anymore, the program does it itself. Also you can have three different fonts now. As another bonus the ability to directly draw pictures (simply set active / inactive pixels) was added.
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Sat Jan 14, 2006 2:58 pm Post subject: |
|
|
ooooooooooo
hey, youre one hell of a programmer! thanks, you are a valuable asset to the community! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sat Jan 14, 2006 4:14 pm Post subject: |
|
|
nosenseofhumor1 wrote: | ooooooooooo
hey, youre one hell of a programmer! thanks, you are a valuable asset to the community! |
Thanks a lot.
Did you actually try it? I'd really like some feedback if this thing works for someone besides me.
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Sat Jan 14, 2006 5:36 pm Post subject: |
|
|
not yet, since im going to have to patch my kernel i wanted to make a few tweaks on my menuconfig first... in the next couple of days i should have it going ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
holycow n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 04 Jul 2005 Posts: 29
|
Posted: Sat Jan 14, 2006 11:25 pm Post subject: |
|
|
Man, am I glad I found this thread. You've done some outstanding work.
I got my g15 keyboard a couple days ago and have been looking for ways to use it's capability under Linux. Your patch and utility open the door for using the lcd.
I patched my 2.6.15 kernel and got it going without any issues. The g15lcd util compiled fine and I was putting text on the lcd in no time at all. I like the image support you've added too.
I will say that having to format the text lines to a single line of quoted text is a bit awkward, but works. Converting images to the "0" and "1" format is also a bit awkward, but doable. I'll have to write a conversion utility for this.
Now, if only the G-keys worked...
If you haven't yet, check out http://phyreskull.ithium.net/g15wiki/wiki/Main_Page. Some good work going on there too.
Thanks! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sun Jan 15, 2006 12:46 pm Post subject: |
|
|
holycow wrote: | Man, am I glad I found this thread. You've done some outstanding work.
I got my g15 keyboard a couple days ago and have been looking for ways to use it's capability under Linux. Your patch and utility open the door for using the lcd.
I patched my 2.6.15 kernel and got it going without any issues. The g15lcd util compiled fine and I was putting text on the lcd in no time at all. I like the image support you've added too.
I will say that having to format the text lines to a single line of quoted text is a bit awkward, but works. Converting images to the "0" and "1" format is also a bit awkward, but doable. I'll have to write a conversion utility for this.
|
Well, that actually was the more practical approach. At first I tried it with each line of text as a seperate line but when I did this I had to change my helper programs everytime I changed the fonts on the display (becaues more or less lines of text can be displayed)
holycow wrote: |
Now, if only the G-keys worked...
|
The problem is that I'd have to handle the G keys in my code because the kernel cant share the usb interface with my program. So, no G keys for at least a while if you want to use my stuff
Well, they should be slapped for not releasing the sourcecode but only binaries. Aw, I objdump -d their libg15 and found a neat way to detach the device from the kernel. I'll post a new version soon (needs some testing) and this new version wont require the kernel patch anymore.
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sun Jan 15, 2006 1:49 pm Post subject: |
|
|
Version 0.3 is on the homepage now ( http://waug.at/g15lcd/ )
The only change is that you do not need the kernel patch anymore. If you do have it applied already you do not need to recompile your kernel, it will work even with the patch applied.
Edit: please give me some feedback if this new version works for you without the kernel patch.
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Sun Jan 15, 2006 4:52 pm Post subject: |
|
|
let it be known, it works!
good job! Amazing! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sun Jan 15, 2006 5:00 pm Post subject: |
|
|
nosenseofhumor1 wrote: | let it be known, it works!
good job! Amazing! |
Thats good to hear. I'm currently trying to figure out how to inject events back into the event system from userspace. Then the G keys could be made working too without any kernel drivers.
But, I have _no_ idea on how to do that sadly
kind regards Philip |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Sun Jan 15, 2006 5:24 pm Post subject: |
|
|
why not attack it a similar way? eat the button presses into a buffer that feeds a function in an infinate loop? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sun Jan 15, 2006 5:31 pm Post subject: |
|
|
nosenseofhumor1 wrote: | why not attack it a similar way? eat the button presses into a buffer that feeds a function in an infinate loop? |
And do what with it?
No, frankly, do what with it?
All I could do is launch an application for a button press or the like, but I really dislike the idea of writing yet another stupid launcher program.
Aw, about 2 minutes after writing to the lkml I found the solution (doh'). I can simply send the keypresses up into the kernel and from there back into userspace. So, if you press Gxx when you're in X then X will receive this keypress.
Thats the way it should be (imo).
Now all thats left is to actually write the code
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sun Jan 15, 2006 6:14 pm Post subject: |
|
|
Would anyone have windows here?
I'm trying to figure out the behaviour of the keys but they're actually quite strange and someone with the logitech driver on windows could help me a great deal.
.) Is it possible to press more than 5 g keys at once in windows? I'd like to know if thats possible. What _should_ happen is that if you've already pressed 5 keys then pressing a 6th key will do _nothing_ at all.
.) The M and "L" (the small ones below the display) do not actually have a state (pressed or not pressed) but rather just send press events. This means that for instance there should be no "repeat key" function for these keys. Also it should make no difference if one key is pressed when you press a second key.
Edit: Also the M and L keys seem to only send an event when they are released. So, pressing and holding any of these keys should not have any effekt until you release the key
kind regards |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Sun Jan 15, 2006 8:52 pm Post subject: |
|
|
I really do like posting a lot
Aw, version 1.0 is online now. All the G M and L keys work now. Keypresses are send to the kernel which will pass them down the normal keyboard chain. This means that if you run g15lcd and press G13 or so then your X server (if your're running X, otherwise the console) will get the keypress. This is 100% compatible with the gnome keyboard shortcuts for instance. Also one could hook the input chain and react to this events to do some more advanced stuff.
This version will require you to compile a special kernel module (userspace input helper) which is included with vanilla kernel (so no patches necessary). Since v1.0 will refuse to start without the uinput stuff I've also left the old souce on the page in case you only want to display something.
Also note that g15lcd never exists anymore, so echo "foobar" | g15lcd is a pretty bad idea. Rather really create a pipe and use it.
kind regards Philip |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Nondysjunction n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 18 Jun 2005 Posts: 6 Location: Kitchener, Ont
|
Posted: Mon Jan 16, 2006 12:58 am Post subject: ID3 tag display |
|
|
I am currently working on an id3-tag displaying script based on the techniques associated with this post. Thank you all for responding to my initial post.
I do have an inquiry to make, though. When refreshing the lcd, the logitech logo that is present by default will flash momentarily. I was wondering if there was a way to make the transition more smooth. Please note I am still using g15lcd.
If anyone is interested, the script I am writing is written in php, and currently supports single-line scrolling output, but will soon support multi-line output. Essentially, there is a pre-text which stays constant, such as an identifier for what is scrolling, and to the right is the scrolling contiguous looping text. Configurable scroll-rate is available. I will make this available as soon as I deem it to be of high enough quality to unleash upon the world. ![Razz :P](images/smiles/icon_razz.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nosenseofhumor1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 04 May 2005 Posts: 146
|
Posted: Mon Jan 16, 2006 1:11 am Post subject: |
|
|
use the pipe to file method
Code: |
mknod pipe p
nohup ./g15lcd pipe &
echo "TM \"Line 1\"\"Line2\"" > pipe
|
heres a little script i wrote just now that i thought was handy... though it could probably use some improvements
Code: |
while [ 0 -ne 1 ]
do
echo "TS \""`date`\"\"amixer get Master|grep ' Front L'` \"\"`amixer get Master|grep ' Front R'`\"\"`free -m|grep '\-'`\"\"`top -bn2|grep "Cpu"|grep \3`\" `sleep 3` >pipe
done &
|
just to explain the top thing... it seems as though top returns 6.6% for cpu usage every time if you take a -bn1 so i took a -bn2 and grepped for the second line.
next on the list will be to display etho tx/rx and if i have time i might clean it up, make it into a real script, and have it display screens showing the weather and graphs of cpu/net/mem/sensors/available disk space
if anybody beats me to it, let me know
my goal is to replace gkrellm... hope thats not an unreasonable task |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Mon Jan 16, 2006 10:54 am Post subject: Re: ID3 tag display |
|
|
Nondysjunction wrote: | I am currently working on an id3-tag displaying script based on the techniques associated with this post. Thank you all for responding to my initial post.
I do have an inquiry to make, though. When refreshing the lcd, the logitech logo that is present by default will flash momentarily. I was wondering if there was a way to make the transition more smooth. Please note I am still using g15lcd. |
The Logitech logo is displayed everytime i reset the controller. That is only done on startup of g15lcd however. Since there is no way to avoid this thing you really should use a pipe and let g15lcd live all the time instead of always piping into a new process. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nomenquis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2005 Posts: 22
|
Posted: Mon Jan 16, 2006 10:58 am Post subject: |
|
|
nosenseofhumor1 wrote: | use the pipe to file method
Code: |
mknod pipe p
nohup ./g15lcd pipe &
echo "TM \"Line 1\"\"Line2\"" > pipe
|
heres a little script i wrote just now that i thought was handy... though it could probably use some improvements
Code: |
while [ 0 -ne 1 ]
do
echo "TS \""`date`\"\"amixer get Master|grep ' Front L'` \"\"`amixer get Master|grep ' Front R'`\"\"`free -m|grep '\-'`\"\"`top -bn2|grep "Cpu"|grep \3`\" `sleep 3` >pipe
done &
|
just to explain the top thing... it seems as though top returns 6.6% for cpu usage every time if you take a -bn1 so i took a -bn2 and grepped for the second line.
|
Dont use top for that. The better way to do it would be to use /proc/stat. In there you have time spend in usr / sys / nice / hi /low etc. Because if you plan on starting your script every second or so you can save a lot of cpu cycles if you do not have to start top. However if you use /proc/stat you will have to remember the previous values sind you're interested in the deltas. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|