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 just picked up a Logitech Cordless Internet Pro (should be the samething as Logitech Cordless Desktop Pro) today. I've read several HOWTOs on how to map keys, but they make no sense to me.
I'm running SuSE 9.1 with KDE 3.2. There are two things I'd like to do: 1) map the Win button to pop up the KDE "start menu" and 2) assign the multimedia buttons to work appropriately. The multimedia buttons on my keyboard are media (which I would like execute xmms, Juk, Kaffeine, or the like), play/pause (which obviously resumes or pauses playback from that player), mute (turn off master volume), volume (changes master volume in increments), favorites (I'd leave this blank), email (map to Thunderbird), and www (to Firefox).
So far, all I know how to do is use xev to find the keycode to those buttons. I've also tried making a .Xmodmap script in my home directory. Where do I begin?
I did some tinkering by myself using xev. It turned out that Microsoft Natural Keyboard Pro OEM better described the keys. I managed to map favorites, email, and www as I desired. However, how do I tell the master volume (KAmix?) from the command line to adjust the volume? I know from reading other sites that GNOME uses aumix-minimal with various switches. But I have no idea how to run a shell command to lower the volume in KDE.
I have almost everything working now, except for the single Win key to pop up the Start Menu. Just in case anyone else wants to know how I did this:
I changed my Logitech's keyboard layout to Microsoft Natural Keyboard Pro OEM, which actually fits the keys better.
I then opened KHotKeys. I mapped www (XF86HomePage) to "firefox", email (XF86Mail) to "thunderbird", favorites (XF86Fav) to "konqueror file:'~'", volume to "amixer set Master 1+" and "1-" respectively, mute to "amixer set Master toggle", and play/pause to "xmms -t". I left media alone for now because I have no reason to use it.
Again, if anyone knows how to map the Win key to pop up the start menu (a single-key shortcut, not a two-key combo), please let me know!
Last edited by apachedude; 11-28-2004 at 04:42 PM.
One way to map the Win key to open the launch menu involves using xmodmap to define the symbol for it to F13. You can do this in ~/.Xmodmap:
Code:
!~/.Xmodmap
!
keycode 115 = F13
Then you just have to go into Keyboard Shortcuts in Control Center and then define "Popup Launch Menu" to the left Win key. Somehow in Mandrake 10 the Win keys popup the launch menu and the audio multimedia keys use hooks into kmix to change the volume. I looked into the dcop hooks in kamix to and didn't find anything there. Hopefully the developer of kamix will expose dcop hooks to at least allow the master volume level changed using something like khotkeys [edit: it looks like the latest version of kamix might have the required hooks].
Hazaa, thanks for the help, but I had tried this previous. What still happens is that I open Keyboard Shortcuts in the KDE menu, and when I press the left Win button (keycode 115), it still flashes "Win+" for a split second, clearly expecting a two-key combo. Then because I let go without pressing a second key, it goes away from the screen.
Been following this thread because I've been trying to do a similar thing with my LX700. I'm curios how you can map a button to just a random button combination. Like I want the zoom keys to send Ctrl+ and Ctrl-. and the forward and back to do Alt left and Alt right.
when I press the left Win button (keycode 115), it still flashes "Win+" for a split second, clearly expecting a two-key combo.
It looks like even though xmodmap is configured to define keycode 115 (Win key) as F13 it is being overriden elsewhere. It might just be that you have to select your keyboard layout in /etc/X11/XF86Config and leave "Enable keyboard layouts" under Keyboard Layout in the Control Center unchecked. This means that you have to find the keyboard section in /etc/X11/XF86Config and set the model in there.
You will have to change the XkbModel option to that of your keyboard. The list of model names and keyboard descriptions is in /etc/X11/xkb/rules/xfree86.lst. So mine can be found by doing something like:
Been following this thread because I've been trying to do a similar thing with my LX700. I'm curios how you can map a button to just a random button combination. Like I want the zoom keys to send Ctrl+ and Ctrl-. and the forward and back to do Alt left and Alt right.
Thanks
Matt W
I haven't actually defined any of the multimedia keys to multiple key combinations myself. My suggestion would be first to find out what the keycode the keys you mentioned generate when you press them by using xev.
An extract from the output of xev when I press Messenger multimedia key on my Logitech Access Keyboard is:
KeyRelease event, serial 28, synthetic NO, window 0x3600001,
root 0x38, subw 0x0, time 8852489, (833,-215), root:(838,434),
state 0x0, keycode 236 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes: ""
The part to look for is a keycode that has no symbol assigned to it. You can then use xmodmap to define the keys:
Fill in the the blanks with the keycode that xev shows when you press those keys. You might note in the above post about how loading a keyboard layout in KDE will override any settings made with xmodmap.
Once you have the those keys defined it then becomes a matter of getting defining your application shortkey keys to them. In KDE there's an Application Shortcuts tab under Keyboard Shortcuts. I remember that GNOME had an equivalent place to change the settings. I can't remember if you can define an second alternative for the same action in GNOME though.
It might also be worthwhile creating a keyboard layout for your LX700 (Logitech Cordless Desktop LX700 I presume). I could come up with a template of a patch to add the layout but first I'd need a decent photo of the keyboard in which I can actually see and read the description under each multimedia key.
I use the Microsoft Multimedia Natural Keyboard, and I too try to assign the multimedia buttons to work appropriately.
With xev I can only see some of the buttons responding, and when I switch between different Keyboard Layouts, I get different buttons responding.
How can I make all buttons work?
I am sure that it is worthwhile creating a Keyboard Layout for the this keyboard because it is one of the most popular natural keyboards in the market.
I use the Microsoft Multimedia Natural Keyboard, and I too try to assign the multimedia buttons to work appropriately.
With xev I can only see some of the buttons responding, and when I switch between different Keyboard Layouts, I get different buttons responding.
How can I make all buttons work?
I am sure that it is worthwhile creating a Keyboard Layout for the this keyboard because it is one of the most popular natural keyboards in the market.
Thanks,
Maor
This is what a patch I created to add one of my keyboards to SUSE 9.1 looks like:
That patch is for the Logitech Deluxe Access Keyboard model. From that you can see that the files modified are:
/etc/X11/xkb/rules/xfree86 (file name may be xorg)
/etc/X11/xkb/rules/xfree86.lst (file name may be xorg.lst)
/etc/X11/xkb/symbols/inet
/etc/X11/xkb/symbols.dir
Make a backup copy of each of those files by adding a suffix like ".orig" so when you're done you can create a patch by running "gendiff xkb .orig >xkb-keymodel.patch".
You need to pick a one word model name, which was logidak in my case, and add a line with that in the files where I added a line. The main part of mapping the keycodes the multimedia keys to key symtols is in xkb/symbols/inet.
Change your keyboard layout to "Generic 104-key PC" so the multimedia keys will be easier to spot in xev. The multimedia keys you can map to key symbols will show up with keycodes but without key symbols in xev. For example:
KeyRelease event, serial 28, synthetic NO, window 0x3400001,
root 0x38, subw 0x0, time 34880040, (557,384), root:(562,410),
state 0x0, keycode 236 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes: ""
For keycodes above 128 you can convert them to "I" key numbers by subtracting 128 and then converting the answer to hexadecimal:
I_number = keycode - 128
= 236 - 128
= 108 (0x6C)
On my logidak keyboard the key that generated that keycode was the Mail multimedia key so I chose to map it to XF86Mail. I found key symbols that match the multimedia keys by searching through xkb/symbols/inet. When you've finished all the changes make a patch by doing the following in /etc/X11:
Code:
# gendiff xkb .orig
That way next time you upgrade X you can reapply the patch and won't lose the new keyboard layout you've created.
Cool. I got half the buttons to work.
The other half do not do respond in xev on the "Generic 104-key PC" layout. Any idea how to identiry those?
Thanks!
PS. When I am done, is there a place that I can submit my patch, so it would be available on the internet, and on the next version of Suse? (and maybe other distributions)
Originally posted by maorc
Cool. I got half the buttons to work.
The other half do not do respond in xev on the "Generic 104-key PC" layout. Any idea how to identiry those?
Thanks!
PS. When I am done, is there a place that I can submit my patch, so it would be available on the internet, and on the next version of Suse? (and maybe other distributions)
My keyboard doesn't have multimedia keys that don't generate key events so I haven't had to deal with that problem yet. That problem does look similar to what's said in Bug 320 - Keymapping for MS natural USB keyboard. My method of mapping the multimedia keys needs keycodes to be reported so you might have to wait until X is patched to report them.
I've now noticed that under a 2.6.x version of the kernel I have the same problem of multimedia keys not having keycodes. Whenever one of these keys is pressed the kernel prints a message:
Code:
Dec 23 01:33:55 sonic kernel: Count = 1 Count = 1 Count = 1 Count = 1 Count = 1 Count = 1 <4>atkbd.c: Unknown key pressed (translated set 2, code 0x91 on isa0060/serio0).
Dec 23 01:33:55 sonic kernel: atkbd.c: Use 'setkeycodes e011 <keycode>' to make it known.
Dec 23 01:33:55 sonic kernel: atkbd.c: Unknown key released (translated set 2, code 0x91 on isa0060/serio0).
Dec 23 01:33:55 sonic kernel: atkbd.c: Use 'setkeycodes e011 <keycode>' to make it known.
The message suggests using setkeycodes to map the scancode listed to a keycode but I haven't had any success with it yet.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.