PATCH: uep(4) support for (my) eGalax touchscreen
Hans Petter Selasky
hps at selasky.org
Mon Jul 24 20:21:01 UTC 2017
On 07/24/17 22:10, Anthony Jenkins via freebsd-usb wrote:
>
> On 07/24/2017 03:28 PM, Anthony Jenkins via freebsd-usb wrote:
>> I'm trying to add support for uep(4) to detect and properly emit touch
>> events to x11-drivers/xf86-input-egalax. What I have works, but has some
>> issues, particularly:
>>
>> - close(2)ing the device node causes a USB_ST_ERROR in the
>> uep_intr_callback(); it's probably from my attempt to port an
>> initialization control message from Linux
>> - I massage the touch events from my device into the legacy uep(4)
>> event structure since my multitouch-supporting touchscreen has 12-bits
>> of resolution per axis, but legacy uep(4) only had 11
>> - For some reason my Y-axis is inverted; I had to subtract its
>> coordinate from the max Y value. I'll probably add an ioctl(2) to set
>> axis inversion behavior dynamically rather than hardcode it.
>> - I capture all the multitouch info from the USB packets, but I don't
>> know (yet) if xf86-input-egalax can do anything with it
>> - x11-drivers/xf86-input-egalax's default min/max ranges are "silly"
>> (500/1500), but I didn't add the trivial patch to it. I'd like to add
>> an ioctl(2) that lets xf86-input-egalax query uep(4) for axis ranges,
>> but as I've written my patch, uep(4) doesn't know its ranges until it
>> gets a touch packet.
>> - I started adding support for evdev(4) reporting (added header files
>> and device struct members), but it's nowhere near finished.
>> - I have no idea how common this eGalax protocol is or how to determine
>> what protocol to use from the driver. Right now I assume a byte 0 of
>> 0x06 means "multitouch event".
>> - My x11-servers/xorg-server is patched to associate /dev/uep0 with the
>> xf86-input-egalax driver; I guess I'll have to make that available too.
>> My config/devd.c is substantially different from stock.
>
> The main problem with uep(4) was either xorg-server or xf86-input-egalax
> started doing asynchronous I/O on the device node using fcntl(F_SETOWN);
> the original uep(4) expected userland to open(2)/read(2) the device
> node. I had to add the FIOSETOWN support, but I don't know if there's a
> way to remove a process as owner (call fcntl(F_SETOWN, NULL)?). If so,
> I'll need to handle that case.
>
> I can stick this up in the FreeBSD code review site if desired.
>
> Anthony
>
>> Logging is sort of noisy at the moment when touching the screen, but it
>> "Just Works (TM)" with my touchscreen, my slightly-patched
>> xf86-input-egalax driver and KDE4.
>>
>> uep(4) patch:
>> https://github.com/ScoobiFreeBSD/freebsd/commit/62c11d484d5fb61749240b439612f852c5148222
>> x11-servers/xorg-server patch:
>> https://github.com/ScoobiFreeBSD/freebsd-ports/commit/9465237f83ab8fb27249abfe803f94b6b8c3b945
>>
>> Suggestions/comments welcome. Currently looking for help with the
>> USB_ST_ERROR issue, although I think I may know what's wrong (this is my
>> 1st attempt at USB stack programming).
>>
>> Anthony Jenkins
>>
Just a dumb question: Have you tried to use webcamd with your device?
--HPS
More information about the freebsd-usb
mailing list