Submitted by alexios on

For a few years, back in simpler times, I used Jon Atkins' imwheel to get X11 to understand the many buttons on my old Primax mouse. Traditionally, X11 only allowed for up to six buttons, and mine had eight (two were used for wheel events, as always). Imwheel allowed me to translate the buttons X11 didn't know about to key events (but not before I hacked it a bit).

Unfortunately, my input devices seem to have outgrown imwheel. I now have a Logitech USB keyboard and USB mouse, both with extra buttons, wheels, knobs et cetera. None of them would work with X11 out of the box, and many weren't even detected.

This is where evrouter comes in useful. It performes the following following closely allied tasks:

  • It makes X11 aware of input devices and events it doesn't support, for one reason or another. For example, thanks to the wonders of USB HID descriptors, the wheel on my Logitech keyboard is completely ignored by X11, even though the Linux kernel reads and parses its events just fine.
  • It allows modern input events to be fed to old applications. Pine, for instance, knows nothing about wheels.
  • It allows hotkey-like operation. This is very useful for the special keys on multimedia keyboards.
  • It can act differently depending on the currently focused window.

As of 2008 and 2009, many of these tasks are obsolete, but old software and old input devices are still around, and evrouter can make your input devices do things programmers of device drivers and application software never intended (or, in some cases, never had enough imagination to anticipate).

All this is accomplished thanks to the Linux 2.4 (and above) Event Interface (CONFIG_INPUT_EVDEV), which currently evrouter depends on. The program parses input events, uses a user-specified ruleset to transform them to other events based on various conditions, and acts on them. Currently, evrouter can perform the following actions:

  • It can simulate X11 key events.
  • It can simulate X11 mouse button events.
  • It can control XMMS (note: binaries for version 0.3.4 have this feature disabled).
  • It can run shell commands (which should perform nearly every other task conceivable).

What's New?

Version 0.4: I've incorporated a patch found on this page that adds support for SW (switch) events.

Version 0.3.4: I've finally found the time to fix an annoying bug whereby removing a USB device evrouter was watching would cause the program to die with a Segmentation Fault.

Known Issues

If you have Ubuntu's Intrepid Ibex distribution, evrouter won't work. Nothing else which accesses event devices will, either — as long as you're running an X server. The X server acquires exclusive access to the event devices, precluding any other process from using them concurrently. I'm working on this one (in a way, I've been working on this one for a while. A couple of the enhancements I've been thinking about could fix this issue). You may want to peruse Ubuntu support tickets 298963 and 267682.

Many thanks to Dominik Ałaszewski for the heads-up and the links.

Download

The tool is available as source, Debian and RPM packages. It's provided under the terms of the GNU General Public License, version 2. An old version of evrouter is still hosted on Freshmeat, but this page offers the latest versions for the most architectures.

evrouter

Tags: 

Language: 

Platform: 

State: 


Comments

Ah HAH!

Ah HAH!

That was indeed the issue! evrouter was initially included with the maryjoana-powermate 'package' (to control the griffin powermate), and I didn't know what was going on.

I use a custom windows app

I use a custom windows app under wine in Ubuntu 11.10. The app can do a full-screen slideshow, and when it does this, my button mappings for the extra buttons on my Logitech mouse stopped working. I was using imwheel and then xbindkeys for the button mapping. They worked otherwise but not when this app went full-screen. I tried evrouter, and it works perfectly and solves the problem. It was much easier to configure than it looks from reading about it. I highly recommend evrouter and hope Alexios continues to maintain it. It would be really cool to have it included in Ubuntu. Thank you very much for creating evrouter.

I use a windows app in wine

I use a windows app in wine on Ubuntu 11.10, and I couldn't get the button mappings for the extra buttons on my logitech mouse to work with it. I tried both imwheel and xbindkeys. They worked for normal X apps but not for the wine app (actually, they worked only occasionally, but usually not). With evrouter they work perfectly all the time. Thanks for developing it. I hope you will want to continue to maintain it. I wish it were included in ubuntu.

Thanks for this useful tool.

Thanks for this useful tool. BTW, I have written a udev rule. The advantage is, that evrouter is automatically reloaded, if an input device is removed or added. Even you have no more problems to access /dev/input/input?, because udev runs as root. If you are interested in, simply write me an mail.

I wonder how difficult will

I wonder how difficult will it be to add actions for EV_ABS. I added a case to print them and I see this when I press and release the three "custom" buttons on my Gyration GO Plus mouse:

"Movea, Inc. Movea RF Receiver" "/dev/input/by-id/usb-Movea__Inc._Movea_RF_Receiver-event-mouse" none abs/40/64 "fill this in!" "Movea, Inc. Movea RF Receiver" "/dev/input/by-id/usb-Movea__Inc._Movea_RF_Receiver-event-mouse" none abs/40/0 "fill this in!" "Movea, Inc. Movea RF Receiver" "/dev/input/by-id/usb-Movea__Inc._Movea_RF_Receiver-event-mouse" none abs/40/16 "fill this in!" "Movea, Inc. Movea RF Receiver" "/dev/input/by-id/usb-Movea__Inc._Movea_RF_Receiver-event-mouse" none abs/40/0 "fill this in!" "Movea, Inc. Movea RF Receiver" "/dev/input/by-id/usb-Movea__Inc._Movea_RF_Receiver-event-mouse" none abs/40/8 "fill this in!" "Movea, Inc. Movea RF Receiver" "/dev/input/by-id/usb-Movea__Inc._Movea_RF_Receiver-event-mouse" none abs/40/0 "fill this in!"

The middle button (abs/40/64), while pressed, allows the relative motion events co continue as normal. This would in theory allow it to work as a modifier for motion events. The other two buttons inhibit motion events. All three buttons fire the same event on release, possibly complicating key emulation.


Add new comment

Leave a comment