A how-to for Logitech keyboard multimedia keys
I've actually known this for awhile (when I had my Logitech iTouch) but when I got my new Logitech Wireless Pro, it had an extra 6 or so buttons ONTOP of the 12 buttons the iTouch already had. Needless to say, I got them all working, and now I will share my story ;)
(As a note, this is using the wireless keyboard using the PS/2 adapter, although it should *theoretically* work in USB as well.) Firstly, log in as root and open the file /usr/X11R6/lib/X11/XKeysymDB with your favorite editor. Scroll to the end of the file, and add the following to the end of the file. Code:
logitech_user :10090000 Save and close that file (its opened in read-only mode so you may have to force the write, :wq! in vim) and exit out of root. Log in as your user and edit the file ~/.xmodmap (or /home/username/.xmodmap) - the file may or may not already exist. Either way, add this to the end of the file: Code:
keycode 144 = logitech_rew Some window managers load the .xmodmap file by default, sometimes its loaded by GDM or XDM (if you use it) - however, dont quote me on that. Check the menu settings for what it does and what files it loads when starting your window manager. Or, if you're like me and start your window manager manually by typing startx at the prompt, then add this as the FIRST line in your ~/.xinitrc Code:
xmodmap ~/.xmodmap The method of binding the keys varies from WM to WM, I only know how to set binding for two; fluxbox and Sawfish. Now, assuming that fluxbox, openbox and blackbox are all relatively the same, this method should work the same for all three. Other WM's like Gnome or KDE will require you to do a little bit of reading (sorry ;) ) but it should be readily available, and chances are has a nice little wizard to help you do it. Anyway, for fluxbox commands go in the form of None {logitech_button} :ExecCommand {command} (the 'None' makes it so you dont need to press a secondary button like 'Shift' or 'Alt' for it to work) and it gets put in your ~/.fluxbox/keys file. A perfect example of this (from my setup) are as follows: Code:
None logitech_rew :ExecCommand xmms --rew & The Sawfish keybindings go in the file ~/.sawmill/custom file, and looks like this: Code:
(custom-set-keymap (quote global-keymap) (quote (keymap Then restart X. Thats it. Test your buttons by pressing them (obviously ;) ) and see if they work. If they dont work, then it might be that your ~/.xmodmap didnt get loaded. Again, a little reading up on that, but if you put that 'xmodmap' command in your .xinitrc file (if you start X manually) then its possible that the commands you bound the keys to are invalid. Check your logs (or flip to console1 if you're lucky) and check for any errors messages. Any questions, just ask I guess ;) I'll do the best to answer them. Scrapz :p |
Ok, I've got extra buttons... but the keyboard's not a logitech. I think I remember reading somewhere that there's a utility I can run, then press a key, and the utility will tell me what the equivalent scancode is (the 10090010 type number that must be entered into the keyboard DB... what is the name of that utility?
|
The program you're thinking of is xev - that will however return raw keycodes, not the '10090000' number that you need. I think that number is based on the manfacturer ID, so you cant just use any number. There are websites which list the raw key codes of any given brand of keyboard, but converting those keycodes to something you can use id the tricky part. I guess so research is in order ;)
Scrapz :p |
Actually, I could have missed a point. It would seem that scrolling through the XKeysymDB file that the Logitech definitions used the next available number in the sequence. So, theory would have it, you could rename the 'logitech' bit to whatever you want (provided you changed 'logitech' anywhere else it appeared' and it would work. That is hwoever a rough guesstimate. I dont believe that other brands would use the exact same keycodes for the multimedia buttons. Good chance most of them will, good chance some of them wont. By using xev you can press the button and it will tell you the keycode, and you subsitute it for that. If anyone wants to make a 'Microsoft Multimedia keyboard How-to' variaition, then thats probably a good thing. A bit of messing around, especially on the funkier keyboards with 20 or som buttons, but well worth it in the end ;)
Scrapz :p |
thanks for the tips and the great howto!
|
logitech howto ...
Scrapz - great howto, it's worked well so far in flux. i was wondering, how do you get the volume wheel to work? i've got a logitech elite keyboard, it's black with the multimedia keys, etc at the top.
also what is the app you use to control the pcm volume? it's just vol? Mind sending a link to get that app? thanks in advance. -jstn |
That 'vol' progam that I use is basically just a simple BASH script that tells aumix what to do. SInce I also have rear speakers, just using this one command named 'vol' helps to remember things. I use 'aumix' to set my volume, and the vol BASH script simply has:
Code:
#!/bin/bash |
Cool, I ended up just doing the same thing but i put aumix -v +2 in my flux keys file.
i thought it would be tougher to get this keyboard tweeked to my liking but it was pretty easy :D where/how did you read about how to get this keyboard working? mind posting your resource? tnx! -jstn |
Hmm, I dont have the exact link... but its over at linuxlabs.com IIRC - the one and only link I found that told me what I wanted ;)
Scrapz :p |
Thank You SOO much for writing such a great how to, i have now got my logitech cordless elite keyboard working in Gnome 2
i will quickly describe how i got the keys working in gnome 2: after adding xmodmap ~/.xmodmap to the .xinitrc file launch gconf-editor # gconf-editor now click on apps click on metacity click on global_keybindings it is in this folder that the key shortcuts are stored to make a command execute at a keypress, edit one of the keys named run_command_X where X is a number now into the Key Value text box, type the name of one of the keys you declared in ~/.xmodmap for example "logitech_search" (without the quotes) each run_command_X is linked to command_X in [/apps/metacity/keybinding_commands] when you have browsed to the dir in gconf-editor find the key command_X (obviously X in command_X and run_command_X should be the same) now edit teh command_X key, and in the Key Value type the command you wish to execute thats it :) once again, thanks for the great how-to, keep up the good posting!!! EDIT: i would just like to point out that if the volume scripts arent working try replacing %1 with $1, the $1 means first argument after the command |
Logitech Elite Keyboard for KDE
First of all follow Scrapz most excellent HOWTO to get to the point where you can actually use the keys. Then I'll show you how to get them to work in KDE. Here is the GUI method of configuring the keyboard in KDE. K Menu -> Configuration -> KDE -> Accessibility -> Keyboard Shortcuts At the top of the page select the Command Shortcuts tab. Now you get a regular menu which should resemble the normal K Menu. Lets say you want to assign KMail to the EMail button. You would click through the menu Networking -> Mail and select KMail. Below the menu are two choices None and Custom, with None being selected. Select Custom and you will get a popup menu with options Primary / Alternate and Primary is selected. So leave Primary selected and also you could select Multi-key if you wanted to make a multi-key hotkey. So we will leave multi-key un-checked. Now all you have to do is press the EMail button an you should see Logitech_email pop up beside the KMail application. You can do this for any of the keys on the Logitech Elite. For those who like to do things by hand the config file is ~/.kde/share/config/khotkeysrc and here are a few line from the file so you'll have an idea of the files format. [Main] Num_Sections=11 [Section1] Name=K Menu - Networking/WWW/konqbrowser.desktop Run=Networking/WWW/konqbrowser.desktop Shortcut=Logitech_myhome [Section2] MenuEntry=true Name=K Menu - Multimedia/Video/Camorama.desktop Run=Multimedia/Video/Camorama.desktop Shortcut=Logitech_webcam [Section3] MenuEntry=true Name=K Menu - Configuration/Configure your computer.desktop Run=Configuration/Configure your computer.desktop Shortcut=Logitech_search [Section4] MenuEntry=true Name=K Menu - Networking/Mail/KMail.desktop Run=Networking/Mail/KMail.desktop Shortcut=Logitech_email So now you are going to ask, "how do I make a key run an application or script that isn't in the menu? Well you put it in the menu. So far thats the only way I've found to do it. I tried every which way to put commands in the config file to run different applications and could not find the proper syntax to make it work. And since there seems to be no documentation or man pages for khotkeys you are stuck doing it through the menu method. But this isn't so bad as it would seem. I'll show you how I made the multimedia keys work for XMMS. Code:
xmms --help Logitech_pauseplay xmms --play-pause Logitech_stop xmms --stop Logitech_rew xmms --rew Logitech_fwd xmms --fwd So how do I get these commands in the menu? Simple, Menudrake. I startup menudrake: K Menu -> Configuration -> Other -> Menudrake Now here's the "trick". I dont want to clutter up my menu with a bunch of xmms links so I open the .hidden section, create a folder called Logitech-Elite and I put the menu items in there. Once I create the Logitech-Elite folder I select Add application. In the Title I put XMMS-pauseplay, In the command I put /usr/bin/xmms --play-pause. I save that then click Add application and do the same for stop, fwd and rew. Now I select save from Menudrake main menu. Then I go back to K Menu -> Configuration -> KDE -> Accessibility -> Keyboard Shortcuts. I follow the same procedure as before to add the new keys to khotkeys. If you are wondering what the khotkeysrc entries look like, here they are. [Section9] MenuEntry=true Name=K Menu - .hidden/Logitech-Elite/XMMS-pauseplay.desktop Run=.hidden/Logitech-Elite/XMMS-pauseplay.desktop Shortcut=Logitech_playpause [Section10] MenuEntry=true Name=K Menu - .hidden/Logitech-Elite/XMMS-Forward.desktop Run=.hidden/Logitech-Elite/XMMS-Forward.desktop Shortcut=Logitech_fwd So you could write a script that does amazing things and assign it to one of your handy-dandy Elite keys. Now in my opinion the KDE method seems way harder than the other methods presented in this thread. I was hoping I could just edit the khotkeysrc file and add stuff from there but like I said I had no luck doing it that way. Maybe someone smarter than me can tell me what I was doing wrong. Anyway I hope maybe this helps someone. |
I tried /bin/bash's technique but every time I press a key there's a new taskbar item that appears named 'Pause', 'Previous', etc (depending on wich keys I pressed). The item has a revolving sand-clock, after 30 seconds it closes the window. I am using the command "xmms -p". I have also tried this command "xmms-shell -e previous" with the same effect.
|
Much easier way is to use the tool here. http://lineak.sourceforge.net/
http://lineak.sourceforge.net/index.php?nav=screenshots I have been using it with several different keyboards for quite some time. |
OK the Prev and Next or Fwd Rew keys send multiple key strokes if you're not quick when you press them. But the keys work.
I agree the "spinning hourglass" is annoying. I'm posting another thread on this subject as the new XFree86 has this built in and makes all this mute. I'll post it here to, just in case someone searching finds this thread first. |
OK this is gonna be a brief tutorial on setting up the Logitech Elite Keyboard for use under KDE and X. XFree86 already has a keyboard layout premade for the Logitech-Elite keyboard. It's actually slightly different (the Elite has 2 additional keys, Go and Back) but other than that the layout is the same.
Look in the file /etc/X11/xkb/symbols/inet At approximately line #1118 you should have an entry like this: partial alphanumeric_keys xkb_symbols "logicdn" { name[Group1]= "Logitech Cordless Desktop Navigator"; ... ... ... } If your inet file doesn't have this entry then you probably have an older version. I got mine from XFree86 beta. But not to fear you can copy mine (copy everything between the code tags below into /etc/X11/xkb/symbols/inet) into your inet file and it will work just the same. Just choose an appropriate place to paste it, be careful not to paste between any { of these } only on the outside of them i.e. after } and before the next {. I wanted to make the Go and Back keys work (the two little keys on the left side of the keyboard next to the scroll wheel) so what I did was I copied thew whole entry for the "Logitech Cordless Desktop Navigator" and modified it and renamed it like this: Code:
partial alphanumeric_keys Now if you go to K Menu -> Configuration -> KDE -> Accessibility -> Keyboard Layout. Now check Enable Layouts and this should allow you to select a Keyboard from the Keyboard model pull-down menu. There are quite a few if you have the latest XFree86 sources. But unfortunately Logitech Elite is not one of them... yet! Here's what you do to add it to the list. Edit /etc/X11/xkb/rules/xfree86.lst Scroll down to the Logitech entries and add a new entry like this. Code:
logicdn Logitech Cordless Desktop Navigator So now you can go back to K Menu -> Configuration -> KDE -> Accessibility -> Keyboard Layout and when you use the Keyboard model pull-down menu the Logitech Elite should be listed along with the others. So now your keyboard is ready to start assigning keys in KDE. But what if you don't use KDE and you want to be able to define the keyboard for say Blackbox or XFce? In that case you need to assign the keyboard from the /etc/X11/XF86Config-4 file. Everything is already setup to do that you only need to edit one more file. Edit the file /etc/X11/xkb/rules/xfree86. Scroll down to the inet keyboards section ! $inetkbds = Then I put the lable logielite in the same order I had placed it in the inet file (right after the freedom navigator), like this: Code:
! $inetkbds = airkey acpi scorpius \ Code:
Section "InputDevice" Code:
KeyPress event, serial 27, synthetic NO, window 0x2600001, Since each Window manager / Desktop environment has a different method of assigning apps to the keys on a keyboard I'll not go over that here. I believe that subject has been covered in another thread already, so you should try another search for logitech keyboard. So I guess thats about it. Hopefully this has helped you get your Logitech Elite keyboard working. Happy Linuxin' |
All times are GMT -5. The time now is 07:59 AM. |