Re: eGalax USB touchscreen issues

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Wed, 11 Aug 2021 22:12:13 UTC
On 10.08.2021 07:03, Mark Kane wrote:
> On 2021-08-07 05:56, Vladimir Kondratyev wrote:
>> Try attached patch (on top of previous one)
> 
> The screen we've been testing works perfectly with this patch on top of
> previous one (with usbhid_load="YES" and hw.usb.usbhid.enable=1). Thanks
> very much for all of your work on this! :)

Great! You wrote very descriptive crash report which made tracking the
bug rather easy task!

> 
> I have many of these egalax screens for an application being migrated
> from Linux to FreeBSD. Physically they all look identical but after
> trying a few others it seems that some are very different inside. Below
> is one that is not working with or without the patches. Is there any
> possibility of also supporting this variant on FreeBSD?
> 
> Screen #2 - With your 2 patches and usbhid/hidraw:
> 
> ugen0.3: <eGalax Inc. USB TouchController> at usbus0
> usbhid0 on uhub1
> usbhid0: <eGalax Inc. USB TouchController, class 0/0, rev 1.10/1.00,
> addr 3> on usbus0
> hidbus0: <HID bus> on usbhid0
> hidraw0: <eGalax Inc. USB TouchController Raw HID Device> on hidbus0
> hidraw0: no report descriptor
> 
> # hid-decode /dev/hidraw0
> (no output)
> # usbhid-dump
> 000:003:000:DESCRIPTOR         1628551474.564813
>  8D 0F 00 09 42 09 32 15 00 25 01 95 02 75 01 81
>  02 95 06 75 01 81 03 05 01 09 30 75 10 95 01 A4
>  55 00 65 00 36 00 00 46 00 00 16 1E 00 26 C8 0F
>  81 02 09 31 16 3C 00 26
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This one looks like corrupted fragment of touch device HID report
descriptor. Check wires, USB port, device itself and so on. Most
probably, it is a standard eGalax HID device with some USB transport
problems.

> 000:004:001:DESCRIPTOR         1628551474.567569
>  05 0C 09 01 A1 01 85 01 19 00 2A 3C 02 15 00 26
>  3C 02 95 01 75 10 81 00 C0 05 01 09 80 A1 01 85
>  02 19 81 29 83 25 01 75 01 95 03 81 02 95 05 81
>  01 C0
> 
> 000:004:000:DESCRIPTOR         1628551474.570559
>  05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
>  95 08 75 01 81 02 95 08 75 01 81 01 05 08 19 01
>  29 03 95 03 75 01 91 02 95 01 75 05 91 01 05 07
>  19 00 2A FF 00 15 00 26 FF 00 95 06 75 08 81 00
>  C0
> #
> 
> Based on that and a lot of forums/bugzilla reading it seems that the
> vendor re-used hardware IDs that makes older non-HID touchscreens look
> the same as their newer HID screens. This "screen #2" was manufactured
> in 2012 compared to the 2018 unit that works with your patches now. So I
> suspect this may be one of the older non-HID screens that uep(4) should
> support (?).

I don't think so. I have a sample of non-HID eGalax touchscreen built in
2009. It advertises bInterfaceClass = 0x00ff rather than 0x0003 (HID) in
your touchscreen.

> With usbhid disabled uep(4) attaches in evdev mode and X gets the input
> device but no events are heard:
> 
> Trying uep(4) in native mode with xf86-input-egalax also had the same,
> uep(4) attached but no events when testing with xinput.
> 
xf86-input-egalax can not work with kernels compiled with EVDEV_SUPPORT.
This options disables native interface of uep(4)

> # usbconfig -d ugen0.3 dump_all_desc
> ugen0.3: <eGalax Inc. USB TouchController> at usbus0, cfg=0 md=HOST
> spd=FULL (12Mbps) pwr=ON (100mA)
> 
>   bLength = 0x0012
>   bDescriptorType = 0x0001
>   bcdUSB = 0x0110
>   bDeviceClass = 0x0000  <Probed by interface class>
>   bDeviceSubClass = 0x0000
>   bDeviceProtocol = 0x0000
>   bMaxPacketSize0 = 0x0040
>   idVendor = 0x0eef
>   idProduct = 0x0001
>   bcdDevice = 0x0100
>   iManufacturer = 0x0001  <eGalax Inc.>
>   iProduct = 0x0002  <USB TouchController>
>   iSerialNumber = 0x0000  <no string>
>   bNumConfigurations = 0x0001
> 
>  Configuration index 0
> 
>     bLength = 0x0009
>     bDescriptorType = 0x0002
>     wTotalLength = 0x0022
>     bNumInterfaces = 0x0001
>     bConfigurationValue = 0x0001
>     iConfiguration = 0x0001  <eGalax Inc.>
>     bmAttributes = 0x00a0
>     bMaxPower = 0x0032
> 
>     Interface 0
>       bLength = 0x0009
>       bDescriptorType = 0x0004
>       bInterfaceNumber = 0x0000
>       bAlternateSetting = 0x0000
>       bNumEndpoints = 0x0001
>       bInterfaceClass = 0x0003  <HID device>
                               ^------HID

>       bInterfaceSubClass = 0x0000
>       bInterfaceProtocol = 0x0000
>       iInterface = 0x0000  <no string>
> 
>       Additional Descriptor
> 
>       bLength = 0x09
>       bDescriptorType = 0x21
>       bDescriptorSubType = 0x10
>        RAW dump:
>        0x00 | 0x09, 0x21, 0x10, 0x02, 0x00, 0x01, 0x22, 0x8d,
>        0x08 | 0x00
> 
>      Endpoint 0
>         bLength = 0x0007
>         bDescriptorType = 0x0005
>         bEndpointAddress = 0x0081  <IN>
>         bmAttributes = 0x0003  <INTERRUPT>
>         wMaxPacketSize = 0x0008
>         bInterval = 0x0003
>         bRefresh = 0x0000
>         bSynchAddress = 0x0000
> #


-- 
WBR
Vladimir Kondratyev