Hi Greg, I screwed around with this for quite a while (and looked into writing some XInput code). Eventually I took the lazy man's approach and did the following:
1) Patched the kernel mousedev.c driver to forward "unknown" buttons as keyboard events (with high value keycodes) (see attached patch). It's not very pretty, but then neither is the kernel/X mouse interface in general -- good lord, what a crufty hack. It will be *very* nice when X can handle the /dev/input/* devices properly. I've been using it for months without problems, but please don't get upset if your console melts... 2) Used the 'hotkeys' program to make those keycodes do useful things. (Hotkeys seems to become unresponsive sometimes -- killall hotkeys and restart it. I've never had to do this more than once per session...) 3) Here's the relevant snippet from my hotkeys keyboard.def file: <!-- Turbomouse upper buttons --> <userdef keycode="247" command="xmms --pause">xmms pause</userdef> <userdef keycode="248" command="xmms --rew">xmms rew</userdef> <userdef keycode="249" command="xmms --fwd">xmms fwd</userdef> <userdef keycode="250" command="xmms --play">xmms play</userdef> <userdef keycode="251" command="xvkbd -xsendevent -text \Aw">xevent</userdef> <userdef keycode="252" command="xvkbd -xsendevent -text \A\[Left]">xevent</userdef> The xvkbd business allows one to assign keyboard shortcuts to the mouse buttons. 4) I've also found the 'imwheel' software to be very useful with my Expert Mouse. Have fun, -- Brad On Tue, 24 Jun 2003, Gregory Seidman wrote: > On Sun, Jun 22, 2003 at 09:51:39PM -0400, Gregory Seidman wrote: > } I have a Kensington Expert Mouse Pro (it's a trackball), which has six > } non-mouse buttons. These are a lot like the multimedia buttons on some > } keyboards. I'd kind of like them to do something, but the USB driver > } doesn't seem to register them (cat /dev/input/mice then pressing these > } buttons gives no output; they also don't seem to give any keyboard input). > [...] > > Okay, new information. Based on a recent post to the list, I loaded the > evdev module and did a cat /dev/input/event0. It worked! I get output from > the device when I press the multimedia buttons on the trackball. > > Now the question is how to make X usefully aware of /dev/input/event0. Maybe > with XInput or something? Any thoughts? -- Brad Sawatzky <[EMAIL PROTECTED]> University of Virginia Physics Department Ph: (434) 924-6580 Fax: (434) 924-7909
--- linux-2.4.21-pre4-orig/drivers/input/mousedev.c 2001-09-30 15:26:05.000000000 -0400 +++ linux-2.4.21-pre4/drivers/input/mousedev.c 2003-04-16 21:01:47.000000000 -0400 @@ -40,6 +40,7 @@ #include <linux/config.h> #include <linux/smp_lock.h> #include <linux/random.h> +#include <linux/kbd_ll.h> #ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X #define CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024 @@ -82,12 +83,15 @@ static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X; static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y; static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL }; struct mousedev **mousedev = mousedevs; struct mousedev_list *list; int index, size; + unsigned char keycode; add_mouse_randomness((type << 4) ^ code ^ (code >> 4) ^ value); @@ -125,17 +129,31 @@ case BTN_0: case BTN_TOUCH: case BTN_LEFT: index = 0; break; + case BTN_4: case BTN_EXTRA: if (list->mode == 2) { index = 4; break; } + case BTN_STYLUS: case BTN_1: case BTN_RIGHT: index = 1; break; + case BTN_3: case BTN_SIDE: if (list->mode == 2) { index = 3; break; } + case BTN_2: case BTN_STYLUS2: case BTN_MIDDLE: index = 2; break; - default: return; + + /* defalut: pass unknown buttons through as keyboard events */ + default: + keycode=code-30; /* move button code into keycode range */ + if(keycode > 0 && keycode < 255) { + handle_scancode(0xe0, 1); + handle_scancode(keycode & 0x7f, value); + } else { + printk(KERN_WARNING "mousedev: keycode: %d\n",keycode); /* BDS */ + }; + return; } switch (value) { case 0: clear_bit(index, &list->buttons); break;