Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

eGalax USB touch panel on ExoPC Slate vs. FreeBSD and X11

30 views
Skip to first unread message

Bill Paul

unread,
Nov 15, 2012, 7:11:34 PM11/15/12
to
Okay. I have my doubts that anyone will be able to answer this question
but I'm going to try anyway.

I have an ExoPC Slate tablet with FreeBSD 9.0 freshly installed on it,
and it has the following touch screen device:

ugen0.2: <eGalax Inc.> at usbus0
ums0: <eGalax Inc. USB TouchController, class 0/0, rev 1.10/10.06, addr 2> on usbus0

tablet# usbconfig -u 0 -a 2 dump_device_desc
ugen0.2: <USB TouchController eGalax Inc.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON

bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0110
bDeviceClass = 0x0000
bDeviceSubClass = 0x0000
bDeviceProtocol = 0x0000
bMaxPacketSize0 = 0x0040
idVendor = 0x0eef
idProduct = 0x72a1
bcdDevice = 0x1006
iManufacturer = 0x0001 <eGalax Inc.>
iProduct = 0x0002 <USB TouchController>
iSerialNumber = 0x0000 <no string>
bNumConfigurations = 0x0001

I put the complete dmesg.boot from FreeBSD 9.0 on the tablet at:

http://people.freebsd.org/~wpaul/exopc/dmesg.boot

This device is detected by the ums(4) driver as a USB mouse. However, it
doesn't quite work right as the ums(4) driver doesn't support multitouch
gestures. It senses taps on the screen as button presses, but the cursor
doesn't move.

My question is:

Can someone please tell me how to get this device to work with Xorg in
FreeBSD (in this case, FreeBSD 9.0)?

Here are some things I'd prefer you didn't tell me:

- "Try the uep(4) driver!" Yes, I know about the uep(4) driver. It's for
a different class of device. It doesn't support this one.

- "Try this patch!" I'm hoping for an officially supported solution
rather than an experimental patch. I mean, it's not that I don't
appreciate someone's hard work and all, but these things have been
around for a while now; you'd think support for it would already
be integrated. And besides, it works with Linux. (You don't know
how long I've been wanting to say that.)

- "Go to this web page!" This _might_ be an acceptable answer _IF_ the
said page contains specific instructions which are known to work. I
already searched through many web pages before I came here.

- "Hey Bill, why don't you just write your own driver?" Because I don't
write FreeBSD drivers anymore, and I certainly don't write USB HID
drivers, and because fuck you, that's why. (Note: I said that last
part with a smile on my face, just in case it wasn't clear. Sometimes
people have a hard time grasping my particular brand of humor.)

This particular touch screen is basically a USB HID class device. I
suspect there's some kind of gimmick you can do with libusb to get it
to work with the X server, but I've already spent some time on various
experimenmts and come up empty. As I said, I'm hoping there's official
support for this kind of device, and I just need to know the right
magic incantation to turn it on.

Any help would be appreciated.

-Bill

--
=============================================================================
-Bill Paul (510) 749-2329 | Member of Technical Staff,
wp...@windriver.com | Master of Unix-Fu - Wind River Systems
=============================================================================
"I put a dollar in a change machine. Nothing changed." - George Carlin
=============================================================================
_______________________________________________
freebsd-...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

Bill Paul

unread,
Nov 16, 2012, 2:04:39 PM11/16/12
to

Well... apparently I was able to get this to work on my own. To recap, I
have an ExoPC Slate running FreeBSD 9.0 and xorg 1.7 with an eGalax
USB HID touch screen. Out of the box, ums(4) claims it but doesn't
like it.

After investigating a bit more, I found that the screen has multiple HID
collections associated with it:

Collection type=Application page=Digitizer usage=Touch_Screen
Collection type=Physical page=Digitizer usage=Finger

Collection type=Application page=Generic_Desktop usage=Pointer
Collection type=Physical page=Generic_Desktop usage=Pointer

Collection type=Application page=Microsoft usage=0x0001

Collection type=Application page=Digitizer usage=Touch_Screen
Collection type=Physical page=Digitizer usage=Stylus

Collection type=Application page=Digitizer usage=Device_Configuration
Collection type=Physical page=Digitizer usage=Finger

The ums(4) driver is trying to use the 'Pointer' collection, but I think
it may be getting confused by the X/Y ranges:

Collection type=Application page=Generic_Desktop usage=Pointer
Collection type=Physical page=Generic_Desktop usage=Pointer
Input rid=1 size=1 count=1 page=Button usage=Button_1, logical range 0..1, physical range 1..2047
Input rid=1 size=1 count=1 page=Button usage=Button_2, logical range 0..1, physical range 1..2047
Input rid=1 size=16 count=1 page=Generic_Desktop usage=X, logical range 0..4095, physical range 0..4095
Input rid=1 size=16 count=1 page=Generic_Desktop usage=Y, logical range 0..4095, physical range 0..4095
End collection
End collection

There are two problems. First, the ranges are a little unusual. I think
other mouse devices only have ranges from -127 to +127. Second, the input
flags for the X and Y axis entries are 0x2 (HI_VARIABLE) and not HI_RELATIVE,
which is what the usm(4) driver expects. This causes it to ignore the X and Y
axis entries and only handle the button entries. I tried changing the code to
accept just the HI_VARIABLE flag, but that still didn't make the cursor move.
In any case, I was wrong that the problem is that the FreeBSD ums(4) driver
doesn't handle gestures: it's just not flexible enough to handle this
oddball pointer design.

Anyway, go get it to work with X as a standard pointer device, I finally
ended up doing the following:

1) Edited the uhid_probe() function in sys/dev/usb/input/uhid.c to comment
out the code that excludes UIPROTO_MOUSE devices:

/*
* Don't attach to mouse and keyboard devices, hence then no
* "nomatch" event is generated and then ums and ukbd won't
* attach properly when loaded.
*/
if ((uaa->info.bInterfaceClass == UICLASS_HID) &&
(uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
((uaa->info.bInterfaceProtocol == UIPROTO_BOOT_KEYBOARD)/* ||
(uaa->info.bInterfaceProtocol == UIPROTO_MOUSE) */)) {
return (ENXIO);
}

Note: this will make it match all mice. I could have fixed it to
be more selective, but for now I just wanted things to work.

2) Recompiled the kernel with the ums(4) and uhid(4) drivers removed.
3) Edited /boot/loader.conf to load the uhid(4) module:

uhid_load="YES"

4) Renamed /boot/kernel/ums.ko to something else so that the system would
stop trying to automatically load it all the time. (Grrr...)

5) Installed the ports collection.
6) Downloaded the following file:

http://people.freebsd.org/~mav/patch-zz-input-mouse9

6) Copied it to /usr/ports/x11-drivers/xf86-input-mouse/files
7) Recompiled and re-installed the xf86-input-mouse driver:

# cd /usr/ports/x11-drivers/xf86-input-mouse
# make
# make deinstall
# make install

8) Edited my xorg.conf to include the following:

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Collection" "2"
Option "Protocol" "usb"
Option "Device" "/dev/uhid0"
Option "Emulate3Timeout" "10"
EndSection

The touch panel is now detected as uhid0 instead of ums0 and the mouse
input driver now handles it directly instead of going through /dev/sysmouse.

Note that the '"Collection" "2"' option line is critical here. The driver
defaults to using collection 1, which is the touch screen. However this
doesn't provide a working pointer. Collection 2 is for the mouse emulation
mode, which is not ideal, but at least it allows me to move the cursor with
my finger now.

Button presses are a little tricky. There are 3 possible results:

1) Quick press -- button 1
2) Press and hold for a few seconds - button 2
3) Tap, release for a second, then press and hold -- button 3

I put the complete output of usbuhidctl -r and my xorg.conf file here:

http://people.freebsd.org/~wpaul/expoc

Note that I'm using the VESA driver for now as the Intel driver seems to
lock up when used with the Intel Pineview graphics controller in this
tablet.

Also note that it looks like you can use pretty much any other USB mouse
this way too, just remember to remove the '"Collection" "2"' line. For
example, I plugged in a Dell USB mouse which was detected as /dev/uhid2, and
modified the xorg.conf file to use it, and it worked fine.

Long story short, the ums(4) driver just isn't smart enough to seamlessly
handle the mouse emulation mode of the eGalax touch streen correctly. Maybe
some day someone will fix it. I might take a look at it again if I can
figure out how it works.
0 new messages