Table of Contents
ebindkeys for Zipit
UPDATE2: I have rewritten ebindkeys and created a new page for it (both general linux and zipit specific).
UPDATE: Mozzwald has put modified ebindkeys source on github. He's added a few improvements specific to the zipit. The source on this page can be compiled to run on any linux system pretty much, but you'll have to look up key codes yourself.
ebindkeys-zipit lets you bind a key or key-combo to a command. It uses the kernel's input event interface.
Some good examples of its use are using a button (like the options button) to toggle the brightness level or binding the play and stop buttons to mpc commands for controlling mpd.
I've also provided along with the source code a statically compiled version (which should theoretically work on any zipit, as long as it supports the input event interface) and a dynamically linked version for z2sid.
It is very important to note that this does not in any way trap input. If you bind a command to the m key, your command will be ran everytime m is pressed, but an m will also be sent to whatever program is currently in the foreground (be it an X program or a console program).
Thus this program is best used for buttons that have not been mapped to a character, such as shift, alt, options and home. You can also remove the play and stop buttons from your keymap since they are (on z2sid, at least) redudnantly used for ] and [.
Download
Current
Latest release: ebindkeys-zipit-2010.12.22.tar.bz2
Out of Date
z2sid compiled binary: ebindkeys.gz
static binary: ebindkeys-static.gz
Compile
Unpack the tarball, change into the directory created and run make. Dependecies are gcc and a libc of somesort.
Install
Copy the ebindkeys binary to any directory you, preferably one in your path. Copy the ebindkeysrc.sample to /root/.ebindkeysrc and edit it to your liking.
Somewhere in your startup scripts, call ebindkeys; it will fork to the background automatically.
Alternatively you can copy ebindkeysrc.sample to /etc/ebindkeys.conf and then launch ebindkeys like so:
ebindkeys -f /etc/ebindkeys.conf
Command Line Options
ebindkeys is still pretty feature light, so there are not a lot of options.
Argument | Description |
---|---|
-r | Enables reporting. Shows when a key is pressed and released |
-d | Do not fork. Probably best used in combination with -r or to make sure you're seeing any error messages you might otherwise be missing |
-f <config file> | Specifies an alternative config file. Default is ~/.ebindkeysrc |
Configuration File
The configuration file should be easy enough to figure out from the examples. The most important line is
dev = /dev/input/eventX
where X is a number. On z2sid the event device you want to use is number 0, which is already set in all the sample config files.
To bind a key to a single button:
# home toggles headphone mute event { action = "amixer sset Headphone toggle" keys = {0x66} }
Note that commenting works like in shell scripts, a hash denotes comment.
To bind a key combo:
# home+m toggles headphone mute event { action = "amixer sset Headphone toggle" keys = {0x66,0x32} }
Currently, key press order doesn't matter. That is not ideal and will probably be changed in the future.
The binds can be toggled on and off if you add a sepecial event:
# toggle events event { action = "TOGGLE" keys = {0x01} }
When you press the key assocaited with the action “TOGGLE” all key presses will be ignored except TOGGLE, which will reenable the other events.
Feature Wish List
- Multiple Event device nodes
- Key order importance
- Toggling (DONE)
Key Mappings for Zipit
This is a key mapping I obtained using ./ebindkeys -r -d -f ebindkeysrc.sample on z2sid.
TOP BUTTONS
Key | Scancode |
---|---|
emote (smilely face) | 0x01 |
options | 0x165 |
home | 0x66 |
Prev | 0x68 |
Next | 0x6d |
[Z] | 0x0F |
[play] | 0xC8 |
[stop] | 0xa6 |
D-Pad
Key | Scancode |
---|---|
left | 0x69 |
up | 0x67 |
right | 0x6a |
down | 0x6c |
center | 0x6b |
Row 1
Key | Scancode |
---|---|
q | 0x10 |
w | 0x11 |
e | 0x12 |
r | 0x13 |
t | 0x14 |
y | 0x15 |
u | 0x16 |
i | 0x17 |
o | 0x18 |
p | 0x19 |
Row 2
Key | Scancode |
---|---|
a | 0x1e |
s | 0x1f |
d | 0x20 |
f | 0x21 |
g | 0x22 |
h | 0x23 |
j | 0x24 |
k | 0x25 |
l | 0x26 |
backspace | 0x0E |
Row 3
Key | Scancode |
---|---|
… | 0x1d |
z | 0x2c |
x | 0x2d |
c | 0x2e |
v | 0x2f |
b | 0x30 |
n | 0x31 |
m | 0x32 |
; | 0x27 |
enter | 0x1c |
Row 4
Key | Scancode |
---|---|
alt | 0x38 |
shift | 0x2a |
space | 0x39 |
, | 0x33 |
. | 0x34 |
Volume Buttons
volume - | 0x4a |
volume + | 0x4e |
Suggestions, Bugs, Requests
Please use the comments section to add any suggestions, bugs, or requests. UPDATE: A spam bot has been murdering the comments on this page, so I've disabled comments.