My friend always uses an external mouse with his laptop, and accidentally brushes the touch pad when he's typing. So he wanted to find a way to shut off the touch pad.
In Ubuntu Karmic Koala (9.10), xorg now autodetects my 3dConnexion Space Navigator and uses its events for mouse X and Y, which is not what I want.
I just discovered xinput, though, which is extremely cool. Thanks Philip Langdale and Frederic Lepied for writing it!
root@lg1:~# xinput list
...
"3Dconnexion SpaceNavigator" id=9 [XExtensionPointer]
Type is MOUSE
Num_buttons is 5
Num_axes is 6
Mode is Relative
Motion_buffer is 256
Axis 0 :
Min_value is -1
Max_value is -1
Resolution is 1
Axis 1 :
Min_value is -1
Max_value is -1
Resolution is 1
Axis 2 :
Min_value is -1
Max_value is -1
Resolution is 1
Axis 3 :
Min_value is -1
Max_value is -1
Resolution is 1
Axis 4 :
Min_value is -1
Max_value is -1
Resolution is 1
Axis 5 :
Min_value is -1
Max_value is -1
Resolution is 1
root@lg1:~# xinput list-props "3Dconnexion SpaceNavigator"
Device '3Dconnexion SpaceNavigator':
Device Enabled (93): 1
Evdev Reopen Attempts (227): 10
Evdev Axis Inversion (228): 0, 0
Evdev Axis Calibration (229):
Evdev Axes Swap (230): 0
Evdev Middle Button Emulation (231): 2
Evdev Middle Button Timeout (232): 50
Evdev Wheel Emulation (233): 0
Evdev Wheel Emulation Axes (234): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (235): 10
Evdev Wheel Emulation Timeout (236): 200
Evdev Wheel Emulation Button (237): 4
Evdev Drag Lock Buttons (238): 0
root@lg1:~# xinput get-feedbacks "3Dconnexion SpaceNavigator"
1 feedback class
PtrFeedbackClass id=0
accelNum is 2
accelDenom is 1
threshold is 4
root@lg1:~# xinput set-ptr-feedback "3Dconnexion SpaceNavigator" 4 8 1 # very sensitive X pointer
root@lg1:~# xinput set-ptr-feedback "3Dconnexion SpaceNavigator" 4 1 8 # much less sensitive.
The threshold parameter doesn't seem to do anything.
Ah, here's the magic to make it stop influencing the pointer:
root@lg1:~# xinput set-int-prop "3Dconnexion SpaceNavigator" 93 8 0 # property 93 from list-props
Also works as:
root@lg1:~# xinput set-int-prop "3Dconnexion SpaceNavigator" "Device Enabled" 8 0
root@lg1:~# xinput set-int-prop "3Dconnexion SpaceNavigator" "Device Enabled" 8 1 # reenable
Unfortunately, I don't see any way to re-zero if it drifts (often happens when they're cold or hot or brand new), or turn on the LED. Here's C code to do it, though:
#include <sys/ioctl.h>
#include <error.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <linux/input.h>
main(int argc, char **argv) {
int fd;
int retval;
struct input_event ev; /* the event */
if (argc != 3) {
printf("Usage: %s device 1|0\n", argv[0]);
exit(2);
}
if ((fd = open(argv[1], O_WRONLY)) < 0) {
perror("opening the file you specified");
exit(1);
}
ev.type = EV_LED;
ev.code = LED_MISC;
ev.value = (argv[2][0] == '1') ? 1:0;
write(fd, &ev, sizeof(struct input_event));
}
1 comment:
Awesome info! Ubuntu 10.04 was recognizing the touchpad on my EEE PC as a regular mouse, so I couldn't disable it while typing. Thanks to this post I was able to setup a couple bash aliases for turning the device on and off. Great stuff.
Post a Comment