Re: PATCH: uep(4) support for (my) eGalax touchscreen

2017-07-25 Thread Anthony Jenkins via freebsd-usb


On 07/24/2017 04:18 PM, Hans Petter Selasky wrote:
> 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?
>
It's been a while, and multimedia/webcamd + xf86-input-evdev /had/
worked, but it's been months since I'd gotten it to work, and it would
always drop the first touch event.  I can try again to get that
configuration to work, but I like the native (stub) driver architecture
(except for the maintenance needed).  Linux'
drivers/input/touchscreen/usbtouchscreen.c driver pretty much does the
same thing

Anthony

> --HPS
>

-- 
Anthony Jenkins


___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: PATCH: uep(4) support for (my) eGalax touchscreen

2017-07-24 Thread Hans Petter Selasky

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

___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: PATCH: uep(4) support for (my) eGalax touchscreen

2017-07-24 Thread Anthony Jenkins via freebsd-usb

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
>
> ___
> freebsd-usb@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

-- 
Anthony Jenkins


___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"