From owner-freebsd-usb@freebsd.org Mon Jul 24 20:21:01 2017 Return-Path: Delivered-To: freebsd-usb@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63872D7F3F3 for ; Mon, 24 Jul 2017 20:21:01 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15DF57735D for ; Mon, 24 Jul 2017 20:21:00 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 04A0B2600E4; Mon, 24 Jul 2017 22:20:51 +0200 (CEST) Subject: Re: PATCH: uep(4) support for (my) eGalax touchscreen To: Anthony Jenkins , freebsd-usb@freebsd.org References: <9be27e1a-aada-f53a-879f-24d7da4f42be@yahoo.com> <743ccf34-cbf6-17a8-fa2c-d174ff56abee@yahoo.com> From: Hans Petter Selasky Message-ID: Date: Mon, 24 Jul 2017 22:18:42 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <743ccf34-cbf6-17a8-fa2c-d174ff56abee@yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 20:21:01 -0000 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