Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Nov 2012 03:11:12 +0000 (UTC)
From:      wpaul@FreeBSD.ORG (Bill Paul)
To:        openslateproj@gmail.com (Open Slate)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: eGalax USB touch panel on ExoPC Slate vs. FreeBSD and X11
Message-ID:  <20121121031112.8EE9CDE3@hub.freebsd.org>
In-Reply-To: <CAAuBV2dWGZ5%2B2SWcoG0f5e80FKgxBqqUibVG0nPi8LJcz%2BgiPA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> I am pleased to see others having success at getting tablet input to work.
> I tried and failed with 8.x on my Fujitsu T-1010.
> 
> Question: The button emulation. Did you add that or was it already there? I
> want to use Squeak Smalltalk on a tablet and the three button mouse
> emulation is a big deal, especially without a keyboard.

The button emulation was already there. The BIOS on the ExoPC Slate
uses it itself: when you power up the tablet, there are two areas you can
press to enter the BIOS setup or the boot select menu. You can use the
touch panel to set the BIOS options or choose the boot path and then tap
the screen to select. The simulated button presses via screen taps are the
only thing that work with the ums(4) driver out of the box. If you look
at the HID collection dump from the mouse emulation mode, you can see it
supports an X axis, Y axis and two button inputs. The touch screen
synthesizes the button inputs internally based on tap patterns.

> 
> Which leads me to my next question. What are you using for input? Is anyone
> working on handwriting recognition or does Apple still have the patents
> locked up? My goal is to be as much as possible like the Newton.

Initially I was using a USB keyboard. The ExoPC Slate has two USB ports
on the side. I have this old Targus USB I/O expander that also provides
PS/2 keyboard and mouse inputs, along with RS-232 port, printer port and
USB ethernet (Pegasus chipset, aue(4) driver). At minimum, USB keyboard
is required in order to install FreeBSD. I also the USB thumbdrive
installer to load the OS. After that I used the USB ethernet to load
papckages.

Once I had the OS installed, I switched to using a bluetooth keyboard.
It's less clunky without the extra wires.

Note that this was intended to be Intel's developer reference platform
for the Meego OS (which is basically just another flavor of Linux). It
came with Meego installed (it's now dual-booting Meego and FreeBSD). Meego
includes an on-screen keyboard input widget which is something that plain
X11 lacks. So for now, I need a physical keyboard.

In addition to the eGalax touch screen, the Slate has:

Atom N450 1.66Ghz CPU (can run i386 or amd64 versions of FreeBSD)
2GB RAM
64GB SSD storage
Atheros 9285 WiFi
Atheros bluetooth
Intel Pineview graphics (1388x768 resolution)

The bluetooth requires a binary blob firmware image to be loaded and
I had to jigger the Intel xf86 video driver a little but it's all working
now.

-Bill

> 
> On Fri, Nov 16, 2012 at 9:04 AM, Bill Paul <wpaul@freebsd.org> wrote:
> 
> >
> > 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.
> >
> > -Bill
> >
> > --
> >
> > =============================================================================
> > -Bill Paul            (510) 749-2329 | Member of Technical Staff,
> >                  wpaul@windriver.com | Master of Unix-Fu - Wind River
> > Systems
> >
> > =============================================================================
> >    "I put a dollar in a change machine. Nothing changed." - George Carlin
> >
> > =============================================================================
> > _______________________________________________
> > freebsd-questions@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "
> > freebsd-questions-unsubscribe@freebsd.org"
> >
> 
> 
> 
> -- 
> Gary Dunn
> Open Slate Project
> http://openslate.org/
> 
> --14dae934089dc590fc04cea7b17f
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
> 
> I am pleased to see others having success at getting tablet input to work. =
> I tried and failed with 8.x on my Fujitsu T-1010. <br><br>Question: The but=
> ton emulation. Did you add that or was it already there? I want to use Sque=
> ak Smalltalk on a tablet and the three button mouse emulation is a big deal=
> , especially without a keyboard.<br>
> <br>Which leads me to my next question. What are you using for input? Is an=
> yone working on handwriting recognition or does Apple still have the patent=
> s locked up? My goal is to be as much as possible like the Newton.<br><div =
> class=3D"gmail_extra">
> <br><br><div class=3D"gmail_quote">On Fri, Nov 16, 2012 at 9:04 AM, Bill Pa=
> ul <span dir=3D"ltr">&lt;<a href=3D"mailto:wpaul@freebsd.org" target=3D"_bl=
> ank">wpaul@freebsd.org</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_=
> quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
> ex">
> <br>
> Well... apparently I was able to get this to work on my own. To recap, I<br=
> >
> have an ExoPC Slate running FreeBSD 9.0 and xorg 1.7 with an eGalax<br>
> USB HID touch screen. Out of the box, ums(4) claims it but doesn&#39;t<br>
> like it.<br>
> <br>
> After investigating a bit more, I found that the screen has multiple HID<br=
> >
> collections associated with it:<br>
> <br>
> Collection type=3DApplication page=3DDigitizer usage=3DTouch_Screen<br>
> Collection type=3DPhysical page=3DDigitizer usage=3DFinger<br>
> <br>
> Collection type=3DApplication page=3DGeneric_Desktop usage=3DPointer<br>
> Collection type=3DPhysical page=3DGeneric_Desktop usage=3DPointer<br>
> <br>
> Collection type=3DApplication page=3DMicrosoft usage=3D0x0001<br>
> <br>
> Collection type=3DApplication page=3DDigitizer usage=3DTouch_Screen<br>
> Collection type=3DPhysical page=3DDigitizer usage=3DStylus<br>
> <br>
> Collection type=3DApplication page=3DDigitizer usage=3DDevice_Configuration=
> <br>
> Collection type=3DPhysical page=3DDigitizer usage=3DFinger<br>
> <br>
> The ums(4) driver is trying to use the &#39;Pointer&#39; collection, but I =
> think<br>
> it may be getting confused by the X/Y ranges:<br>
> <br>
> Collection type=3DApplication page=3DGeneric_Desktop usage=3DPointer<br>
> Collection type=3DPhysical page=3DGeneric_Desktop usage=3DPointer<br>
> Input =A0 rid=3D1 size=3D1 count=3D1 page=3DButton usage=3DButton_1, logica=
> l range 0..1, physical range 1..2047<br>
> Input =A0 rid=3D1 size=3D1 count=3D1 page=3DButton usage=3DButton_2, logica=
> l range 0..1, physical range 1..2047<br>
> Input =A0 rid=3D1 size=3D16 count=3D1 page=3DGeneric_Desktop usage=3DX, log=
> ical range 0..4095, physical range 0..4095<br>
> Input =A0 rid=3D1 size=3D16 count=3D1 page=3DGeneric_Desktop usage=3DY, log=
> ical range 0..4095, physical range 0..4095<br>
> End collection<br>
> End collection<br>
> <br>
> There are two problems. First, the ranges are a little unusual. I think<br>
> other mouse devices only have ranges from -127 to +127. Second, the input<b=
> r>
> flags for the X and Y axis entries are 0x2 (HI_VARIABLE) and not HI_RELATIV=
> E,<br>
> which is what the usm(4) driver expects. This causes it to ignore the X and=
>  Y<br>
> axis entries and only handle the button entries. I tried changing the code =
> to<br>
> accept just the HI_VARIABLE flag, but that still didn&#39;t make the cursor=
>  move.<br>
> In any case, I was wrong that the problem is that the FreeBSD ums(4) driver=
> <br>
> doesn&#39;t handle gestures: it&#39;s just not flexible enough to handle th=
> is<br>
> =A0oddball pointer design.<br>
> <br>
> Anyway, go get it to work with X as a standard pointer device, I finally<br=
> >
> ended up doing the following:<br>
> <br>
> 1) Edited the uhid_probe() function in sys/dev/usb/input/uhid.c to comment<=
> br>
> =A0 =A0out the code that excludes UIPROTO_MOUSE devices:<br>
> <br>
> =A0 =A0 =A0 =A0 /*<br>
> =A0 =A0 =A0 =A0 =A0* Don&#39;t attach to mouse and keyboard devices, hence =
> then no<br>
> =A0 =A0 =A0 =A0 =A0* &quot;nomatch&quot; event is generated and then ums an=
> d ukbd won&#39;t<br>
> =A0 =A0 =A0 =A0 =A0* attach properly when loaded.<br>
> =A0 =A0 =A0 =A0 =A0*/<br>
> =A0 =A0 =A0 =A0 if ((uaa-&gt;info.bInterfaceClass =3D=3D UICLASS_HID) &amp;=
> &amp;<br>
> =A0 =A0 =A0 =A0 =A0 =A0 (uaa-&gt;info.bInterfaceSubClass =3D=3D UISUBCLASS_=
> BOOT) &amp;&amp;<br>
> =A0 =A0 =A0 =A0 =A0 =A0 ((uaa-&gt;info.bInterfaceProtocol =3D=3D UIPROTO_BO=
> OT_KEYBOARD)/* ||<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0(uaa-&gt;info.bInterfaceProtocol =3D=3D UIPROTO_=
> MOUSE) */)) {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (ENXIO);<br>
> =A0 =A0 =A0 =A0 }<br>
> <br>
> =A0 =A0Note: this will make it match all mice. I could have fixed it to<br>
> =A0 =A0be more selective, but for now I just wanted things to work.<br>
> <br>
> 2) Recompiled the kernel with the ums(4) and uhid(4) drivers removed.<br>
> 3) Edited /boot/loader.conf to load the uhid(4) module:<br>
> <br>
> uhid_load=3D&quot;YES&quot;<br>
> <br>
> 4) Renamed /boot/kernel/ums.ko to something else so that the system would<b=
> r>
> =A0 =A0stop trying to automatically load it all the time. (Grrr...)<br>
> <br>
> 5) Installed the ports collection.<br>
> 6) Downloaded the following file:<br>
> <br>
> <a href=3D"http://people.freebsd.org/~mav/patch-zz-input-mouse9" target=3D"=
> _blank">http://people.freebsd.org/~mav/patch-zz-input-mouse9</a><br>;
> <br>
> 6) Copied it to /usr/ports/x11-drivers/xf86-input-mouse/files<br>
> 7) Recompiled and re-installed the xf86-input-mouse driver:<br>
> <br>
> # cd /usr/ports/x11-drivers/xf86-input-mouse<br>
> # make<br>
> # make deinstall<br>
> # make install<br>
> <br>
> 8) Edited my xorg.conf to include the following:<br>
> <br>
> Section &quot;InputDevice&quot;<br>
> =A0 =A0 =A0 =A0 Identifier =A0 =A0 =A0&quot;Mouse0&quot;<br>
> =A0 =A0 =A0 =A0 Driver =A0 =A0 =A0 =A0 =A0&quot;mouse&quot;<br>
> =A0 =A0 =A0 =A0 Option =A0 =A0 =A0 =A0 =A0&quot;Collection&quot; &quot;2&qu=
> ot;<br>
> =A0 =A0 =A0 =A0 Option =A0 =A0 =A0 =A0 =A0&quot;Protocol&quot; &quot;usb&qu=
> ot;<br>
> =A0 =A0 =A0 =A0 Option =A0 =A0 =A0 =A0 =A0&quot;Device&quot; &quot;/dev/uhi=
> d0&quot;<br>
> =A0 =A0 =A0 =A0 Option =A0 =A0 =A0 =A0 =A0&quot;Emulate3Timeout&quot; &quot=
> ;10&quot;<br>
> EndSection<br>
> <br>
> The touch panel is now detected as uhid0 instead of ums0 and the mouse<br>
> input driver now handles it directly instead of going through /dev/sysmouse=
> .<br>
> <br>
> Note that the &#39;&quot;Collection&quot; &quot;2&quot;&#39; option line is=
>  critical here. The driver<br>
> defaults to using collection 1, which is the touch screen. However this<br>
> doesn&#39;t provide a working pointer. Collection 2 is for the mouse emulat=
> ion<br>
> mode, which is not ideal, but at least it allows me to move the cursor with=
> <br>
> my finger now.<br>
> <br>
> Button presses are a little tricky. There are 3 possible results:<br>
> <br>
> 1) Quick press -- button 1<br>
> 2) Press and hold for a few seconds - button 2<br>
> 3) Tap, release for a second, then press and hold -- button 3<br>
> <br>
> I put the complete output of usbuhidctl -r and my xorg.conf file here:<br>
> <br>
> <a href=3D"http://people.freebsd.org/~wpaul/expoc" target=3D"_blank">http:/=
> /people.freebsd.org/~wpaul/expoc</a><br>
> <br>
> Note that I&#39;m using the VESA driver for now as the Intel driver seems t=
> o<br>
> lock up when used with the Intel Pineview graphics controller in this<br>
> tablet.<br>
> <br>
> Also note that it looks like you can use pretty much any other USB mouse<br=
> >
> this way too, just remember to remove the &#39;&quot;Collection&quot; &quot=
> ;2&quot;&#39; line. For<br>
> example, I plugged in a Dell USB mouse which was detected as /dev/uhid2, an=
> d<br>
> modified the xorg.conf file to use it, and it worked fine.<br>
> <br>
> Long story short, the ums(4) driver just isn&#39;t smart enough to seamless=
> ly<br>
> handle the mouse emulation mode of the eGalax touch streen correctly. Maybe=
> <br>
> some day someone will fix it. I might take a look at it again if I can<br>
> figure out how it works.<br>
> <div class=3D"HOEnZb"><div class=3D"h5"><br>
> -Bill<br>
> <br>
> --<br>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D<br>
> -Bill Paul =A0 =A0 =A0 =A0 =A0 =A0<a href=3D"tel:%28510%29%20749-2329" valu=
> e=3D"+15107492329">(510) 749-2329</a> | Member of Technical Staff,<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<a href=3D"mailto:wpaul@windriver.com">w=
> paul@windriver.com</a> | Master of Unix-Fu - Wind River Systems<br>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D<br>
> =A0 =A0&quot;I put a dollar in a change machine. Nothing changed.&quot; - G=
> eorge Carlin<br>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D<br>
> _______________________________________________<br>
> <a href=3D"mailto:freebsd-questions@freebsd.org">freebsd-questions@freebsd.=
> org</a> mailing list<br>
> <a href=3D"http://lists.freebsd.org/mailman/listinfo/freebsd-questions" tar=
> get=3D"_blank">http://lists.freebsd.org/mailman/listinfo/freebsd-questions<=
> /a><br>
> To unsubscribe, send any mail to &quot;<a href=3D"mailto:freebsd-questions-=
> unsubscribe@freebsd.org">freebsd-questions-unsubscribe@freebsd.org</a>&quot=
> ;<br>
> </div></div></blockquote></div><br><br clear=3D"all"><br>-- <br>Gary Dunn<b=
> r>Open Slate Project<br><a href=3D"http://openslate.org/" target=3D"_blank"=
> >http://openslate.org/</a><br>;
> </div>
> 
> --14dae934089dc590fc04cea7b17f--
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121121031112.8EE9CDE3>