LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   getting "extra keys" to work on a keyboard (https://www.linuxquestions.org/questions/linux-hardware-18/getting-extra-keys-to-work-on-a-keyboard-292643/)

bobbens 02-20-2005 12:41 PM

getting "extra keys" to work on a keyboard
 
So my old keyboard was dying on me and it was time to find a heir. I wanted to get a silent keyboard so i wouldn't wake up anyone with the mad clattering of my midnight working sprees. I got this snazzy keyboard with LED's under the keys. It also comes with a "Command Pad" which has 9 keys and two modes, so technically you should be able to add 18 hotkeys (maybe the mode buttons work like shift keys, so you would be able to get 36 hotkeys). The keyboard also has 3 volumne buttons for more volumne, less volumne and a mute toggle. Is there a way to get this buttons working? Like an app that will read input from the keyboard so you can set the keys to do things? Like maybe open thunderbird in desktop 4, or mount/umount some nfs drives? Thanks.

BTW it's a usb keyboard (don't really thing this matters at all).

david_ross 02-20-2005 01:09 PM

Take a look at xbindkeys:
http://hocwp.free.fr/xbindkeys/xbindkeys.html

bobbens 02-20-2005 01:31 PM

Quote:

Originally posted by david_ross
Take a look at xbindkeys:
http://hocwp.free.fr/xbindkeys/xbindkeys.html

Works great except for the "command pad". That's funny. The command pad is an external pad connected via "ethernet cable" to the keyboard. It is connected because it lights up with LED's, but i can't get any input from it. What could be the problem?

EDIT: BTW, you know the code for raising the mixer volumne on master, lowering it and toggling mute? Thanks.

Brian1 02-20-2005 01:47 PM

One can find the keycodes for each key by running ' xev '.

Now don't know which gui you are running but in KDE if you have the program open like thunderbird (move it to the virtual window you want it in). Right click on the title bar > select Advanced > Special Window Settings. Once here Go to the Geometry tab, check the Desktop box, Change default DO Not Affect to Remember, then select which Desktop you want to it to start in.

Back to keycodes.
Also Like above xbindkeys does a great job. Problably be the best option.

Antoher way If using KDE then in control panel goto khotkeys and add them that way. Also check out a post I did a few years back. I don't do it that way anymore. I do it the khotkeys way control center.
http://www.linuxquestions.org/questi...388#post536388

In Control Center > Reginoal & Accessibilty > Khotkeys
1. I would create a new group first. Then in this new group add New Action.
2. Change Action Type to Keyboard ShortCut/Command URL.
3. Create a new Action Name for the key also.
4. Next tab called Keyboard Shortcut. hit the Key to record.
5. Next tab Command/URL Settings. Point it to the program to start.


Brian1
" Google the Linux way @ http://www.google.com/linux "

Brian1 02-20-2005 02:10 PM

For volume I did the following using F10 for mute. F11 for lower volume, F12 to raise volume. Ended up creating 5 scripts. One to raise volume. One to lower volume. And three that does the mute. Follow some info from the link in my above post.

But I will post the contents of each script I am using now.
/opt/volumekeys/volumeup
Code:

#!/bin/sh
aumix -v +5 -S

/opt/volumekeys/volumedn
Code:

#!/bin/sh
aumix -v -5 -S

edit: Updated mute scripts to save volume settings before muting then restoring to previous volume level when unmuting.

Contents of /opt/volumekeys/volumemute2
Code:

#!/bin/sh
# copy of volumemute2
aumix -S
aumix -v0
cp /opt/volumekeys/volumemute1 /opt/volumekeys/volumemute

Contents of /opt/volumekeys/volumemute1
Code:

#!/bin/sh
# copy of volumemute1
aumix -L
cp /opt/volumekeys/volumemute2 /opt/volumekeys/volumemute

Contents of /opt/volumekeys/volumemute
Code:

#!/bin/sh
# copy of volumemute2
aumix -S
aumix -v0
cp /opt/volumekeys/volumemute1 /opt/volumekeys/volumemute

I would copy over volumemute2 contents to volumemute script for the first time. I also add the command ' cp /opt/volumekeys/volumemute2 /opt/volumekeys/volumemute ' to /etc/rc.local file so it is set to go from a reboot. Using the command aumix -L is problably overkill since the ~/.aumixrc should not change from point A to point B but helps to make since of it all.

edit:

Now if using KDE I used the khotkeys in the Control Panel to map the keys to the action like in the above post. Also one might want to run the script /opt/volumemute1 at start to make sure the mute key is set correctly to mute the first time it is pressed. This can be added to /etc/rc.local file.
Example of my rc.local on my notebook.
Code:

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

# Install misc modules
echo "Loading modules pcspkr, bttv, ohci1394, ieee1394, raw1394, sbp2, snd-intel8x0m,..."
modprobe pcspkr
modprobe bttv
modprobe ohci1394
modprobe ieee1394
modprobe raw1394
modprobe sbp2
modprobe snd-intel8x0m

# Lid buuton
echo "Setting up default Lid Button..."
cp /etc/acpi/actions/lidbtnoff.sh /etc/acpi/actions/lidbtn.sh

# Mute Script setup
/opt/volumekeys/volumemute1

# 3 sec pause
ping -c10 127.0.0.1 > /dev/null

touch /var/lock/subsys/local

Hope this helps.
Brian1
" Google the Linux way @ http://www.google.com/linux "

Brian1 02-20-2005 02:18 PM

Also a simply way to turn volume up and down is if you know the keycode to the key you wish to use for each then you can add the following to Xmodmap. This is not Gui Specific.
etc/X11/Xmodmap
Code:

keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume

These values are what I get when I press the volume buttons on my notebook. I also do it this way. I don't have a mute button but one can do this.
Code:

keycode 180 = XF86AudioRaiseMute
There is more than one way to do just about anything under linux.

Brian1
" Google the Linux way @ http://www.google.com/linux "

bobbens 02-20-2005 02:35 PM

Quote:

Originally posted by Brian1
Also a simply way to turn volume up and down is if you know the keycode to the key you wish to use for each then you can add the following to Xmodmap. This is not Gui Specific.
etc/X11/Xmodmap

If this Xmodmap doesn't exist should i create one? How do i get it running without rebooting? Or do i have to restart X? Thanks. It looks like the easiest way out. BTW you have any idea for getting the "command pad" working? It doesn't seem to give any output with xev, xbindkeys, or whatever. Thanks again.

Brian1 02-20-2005 03:16 PM

Sounds like the pad is driver specific. Contact the manufactor and see if they have a linux module or driver for it. If xev can't see it then I am not much help. Not knowing your system, you can create the Xmodmap file, just a plain text file. You might search your drive and see if Xmodmap is somewhere else. Not ever distro puts files in the same place. Also one can create it in your own home directory and name it ' .xmodmap '. Hope this helps. Not sure but I believe it will require X to be restarted. It can be done without restarting but I would have to figure it out. Problalby have to restart the dcopserver.

Brian1
" Google the Linux way @ http://www.google.com/linux "

bobbens 02-21-2005 12:37 PM

Quote:

Hi,

The command pad is a HID-compliant device and should make all the same
'calls' that a USB joystick does.

Best Regards
Richard Neville
Tech Support
Saitek UK
Ok, so how would i get about to emulating a joystick at the usb slot my keyboard is? I've checked and i only see /dev/input/js0, /dev/input/js1 and /dev/input/js2, which are my gamepads, but i don't see js3, of course i don't have discover installed. Anyone know how i can get around to getting this pad to work? Thanks.

Brian1 02-21-2005 04:29 PM

Go under your current modules for /lib/modules/kernel_version_running_number/kernel/drivers/usb/input. Try modprobe wacom and see if it loads. Try some of the others and see what happens. Might also need to modprobe evdev if some of the others load. Also I believe you will need to modify the xorg.conf.

Check out this link for starters. http://linuxwacom.sourceforge.net/index.php/howto/all This may not be right but may give you a starting point.

Brian1
" Google the Linux way @ http://www.google.com/linux "

bobbens 02-22-2005 07:29 AM

Quote:

Originally posted by Brian1
Check out this link for starters. http://linuxwacom.sourceforge.net/index.php/howto/all This may not be right but may give you a starting point.

Brian1
" Google the Linux way @ http://www.google.com/linux "

??? this would be to try to get some joystick input from my keyboard, that would technically allow it's "command pad" to work. I have a wacom installed, though i still have to get the correct drivers to get it working better. I just want to see if i can use two modules on one USB device to be able to get both the command pad and keyboard input. I'm not sure if it's possible to have two modules for one USB device and would like to know that. I'll probably have to attempt to make a driver someday based off the usb keyboard driver.

efanning 02-23-2005 08:41 PM

Quote:

Originally posted by Brian1
Also a simply way to turn volume up and down is if you know the keycode to the key you wish to use for each then you can add the following to Xmodmap. This is not Gui Specific.
etc/X11/Xmodmap
Code:

keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume

These values are what I get when I press the volume buttons on my notebook. I also do it this way. I don't have a mute button but one can do this.
Code:

keycode 180 = XF86AudioRaiseMute
There is more than one way to do just about anything under linux.

Brian1
" Google the Linux way @ http://www.google.com/linux "

How do I find out what my keycode would be for say the volume buttons on the side of my laptop?

bobbens 02-24-2005 11:28 AM

type xev in the console and then hit the keys, itll display all information of the event you just triggered. i think they made 174 and 176 default, just try it anywys.

rrheault 06-24-2008 08:59 AM

I have a similar problem with my hp 8710p laptop with a touch panel at the top of the keyboard for volume up, down, mute, etc... None of these buttons work with Fedora 9. Is anyone else experiencing this same issue and if so has anyone come up with a fix yet? If I run xev to capture the keycode nothing shows up.


All times are GMT -5. The time now is 04:37 AM.