Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
That basically covers all the keys on the Wireless Pro. If you have an iTouch, then obviously some of those buttons arent going to be there, so you dont have to specify the ones that you dont have. I havnt tested it, but it should still work fine otherwise.
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:
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
So, we've made it that X can 'understand' the extra keys as a keypress when we press them, now we just have to bind events to them. You can bind whatever you want to whatever multimedia key you want. You might want to have it so it loads your email program when you hit the 'Email' button, and load your homepage in your favorite browser when you hit the 'My Home' button, or you can have it so it plays a certain song, or any other command... anything you want...
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:
...the parts where I specified the command 'Echo ">> foo"' is simply a placeholder for when I want to put a proper command in there. Typically, you wont see it but you can if you do a bit of searching. You could replace it with anything if you want, I just made it that. (I dont really have a use for all these buttons yet...)
The Sawfish keybindings go in the file ~/.sawmill/custom file, and looks like this:
...thats untested, but its what I've read, so it should *theoretically* work. Doesnt hurt to do a bit of reading up on it though.
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.
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
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 Multimediakeyboard 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 - 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?
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
aumix -v %1
aumix -o %1
...putting that in /usr/bin (as root of course) - then binding the command vol +5 to logitech_volup and vol -5 to logitech_voldown. You can also specify the volume in percentage. ie: vol 90 will set the colume to 90%
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
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
-h, --help Display this text and exit.
-n, --session Select XMMS session (Default: 0)
-r, --rew Skip backwards in playlist
-p, --play Start playing current playlist
-u, --pause Pause current song
-s, --stop Stop current song
-t, --play-pause Pause if playing, play otherwise
-f, --fwd Skip forward in playlist
-e, --enqueue Don't clear the playlist
-m, --show-main-window Show the main window.
-v, --version Print version number and exit.
I'll be assigning the keys like this:
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.
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.
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:
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:
NOTE: The two bold entries are what I added to enable the two side buttons Go and Back, also I renamed XF86Stanby to XF86User which matches the keyboard.
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 Keyboardmodel 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.
Once again what is in bold is what I added to the file. NOTE: I put mine in alphabetical order like the rest, I don't think it matters.
So now you can go back to K Menu -> Configuration -> KDE -> Accessibility -> Keyboard Layout and when you use the Keyboardmodel 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:
Of course you can verify the keys are working properly by running xev and pressing some keys. I verified the keys I added are working:
Code:
KeyPress event, serial 27, synthetic NO, window 0x2600001,
root 0x41, subw 0x0, time 179142, (181,2), root:(870,22),
state 0x10, keycode 234 (keysym 0x1008ff26, XF86Back), same_screen YES,
XLookupString gives 0 characters: ""
KeyRelease event, serial 27, synthetic NO, window 0x2600001,
root 0x41, subw 0x0, time 179362, (181,2), root:(870,22),
state 0x10, keycode 234 (keysym 0x1008ff26, XF86Back), same_screen YES,
XLookupString gives 0 characters: ""
KeyPress event, serial 27, synthetic NO, window 0x2600001,
root 0x41, subw 0x0, time 180752, (181,2), root:(870,22),
state 0x10, keycode 233 (keysym 0x1008ff5f, XF86Go), same_screen YES,
XLookupString gives 0 characters: ""
KeyRelease event, serial 27, synthetic NO, window 0x2600001,
root 0x41, subw 0x0, time 180945, (181,2), root:(870,22),
state 0x10, keycode 233 (keysym 0x1008ff5f, XF86Go), same_screen YES,
XLookupString gives 0 characters: ""
As you can see the XF86Go and XF86Back indicate that the keys are working.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.