[PATCH] Revamp mouse support in GPE
Paul Sokolovsky <[email protected]> Tue, 22 Aug 2006 14:46:28 +0300
| Newsgroups | gmane.comp.handhelds.gpe |
|---|---|
| Message-ID | <[email protected]> |
Hello GPE,
I'm working on QEMU support for running OpenEmbedded images.
Specifically, my aim is to be able to run the same rootfs image on
both real device and QEMU.
And this mostly works, the immediate problem (with GPE) being
that mouse doesn't work out of the box, even though there's a mouse
support per se. I was able to fix this with two pretty trivial
patches, which I'd like to share now. I don't think that they in their
present form mergeable, but I'd like to see QEMU mouse support in
mainline, so hope to get suggestion how to improve the patches.
So, the issues being fixed are:
1. Touchscreen calibration utility (xtscal) is hardcoded to expect
tocuhscreen device. The obvious solution is just skip it in case
[there's only] mouse in use. Logic of this detection is a question,
and I alreday posted about this recently. I ended up backporting
OE.dev udev rule for /dev/input/touchscreen0 to Familiar 0.8.4 I'm
doing experiments on and checking for its presence:
Index: xserver-common/X11/Xinit.d/30xTs_Calibrate
===================================================================
RCS file: /cvs/gpe/base/xserver-common/X11/Xinit.d/30xTs_Calibrate,v
retrieving revision 1.1
diff -u -r1.1 30xTs_Calibrate
--- xserver-common/X11/Xinit.d/30xTs_Calibrate 29 Aug 2005 11:57:23 -0000 1.1
+++ xserver-common/X11/Xinit.d/30xTs_Calibrate 22 Aug 2006 11:38:32 -0000
@@ -1,5 +1,11 @@
#!/bin/sh
-if [ ! -f /etc/pointercal ]; then
- /usr/bin/run-calibrate.sh
+# Calibrate touchscreen only if it is detected.
+# Otherwise, assume we have a mouse.
+if [ -e /dev/input/touchscreen0 ]; then
+
+ if [ ! -f /etc/pointercal ]; then
+ /usr/bin/run-calibrate.sh
+ fi
+
fi
Positive logic sounds natural here - if there's touchscreen,
calibrate it, but that doesn't work in generic enough manner, as not
all 2.6 distros support /dev/input/touchscreen0 yet, plus there're 2.4
ones. Likely, checking for absence of /dev/input/mouse0 is better (sic, not
/dev/input/mice - this one is always preent regardless if actual mouse
is attached).
2. It turned out that that tslib conflicts with Xfbdev's -mouse
switch. While Xfbdev is compiled with both mouse and tslib input
handlers, the latter appears to have presedence. If there's a device
passed via -mouse, it is first checked by tslib, and if it's not
touchscreen, it reports error and keeps device grabbed, not bothering
to let other handlers try it. (note: this is the behavior which is
exhibited with Familiar 0.8.4 version of Xfbdev (0.0cvs20050207-r11)).
The solution was, while ensuring that TSLIB_TSDEVICE is not set, not
pass -mouse argument at all. tslib handler then will fail to grab
something, and normal Xfbdev's detection procedure will happen, and
/dev/input/mice will be used.
Index: xserver-common/X11/Xserver
===================================================================
RCS file: /cvs/gpe/base/xserver-common/X11/Xserver,v
retrieving revision 1.9
diff -u -r1.9 Xserver
--- xserver-common/X11/Xserver 14 Jun 2006 21:36:04 -0000 1.9
+++ xserver-common/X11/Xserver 22 Aug 2006 11:38:32 -0000
@@ -37,7 +37,12 @@
# use usb mouse if present
# Xorg doesn't support "-mouse" option, and uses /dev/input/mice automatically
if [ -z "$TSLIB_TSDEVICE" ] && [ -e /dev/input/mice ] && [ "$XSERVER" != "Xorg" ]; then
- ARGS="$ARGS -mouse /dev/input/mice"
+ # And if Xfbdev is compiled against tslib, it tries to treat any -mouse
+ # argument as touchscreen, and disallows it to be used as mouse. Workaround
+ # - don't pass -mouse at all and let Xfbdev select it based on compiled in
+ # defaults.
+ #ARGS="$ARGS -mouse /dev/input/mice"
+ echo "Touchscreen device not detected - letting Xfbdev use mouse mode."
fi
# start off server in conventional location.
The caveat of this patch is that it is based on pretty old
xserver-kdrive version.
Suggestions regarding merging this upstream are welcome.
--
Best regards,
Paul mailto:[email protected]