From nobody@FreeBSD.org  Thu Jan 23 18:42:42 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id B323F290
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jan 2014 18:42:42 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 8507B1D59
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jan 2014 18:42:42 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0NIgfVQ039811
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jan 2014 18:42:41 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0NIgfBX039807;
	Thu, 23 Jan 2014 18:42:41 GMT
	(envelope-from nobody)
Message-Id: <201401231842.s0NIgfBX039807@oldred.freebsd.org>
Date: Thu, 23 Jan 2014 18:42:41 GMT
From: Brock Williams <brock@cottonwoodcomputer.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: patch to xf86-input-mouse to support FlipXY
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         186045
>Category:       ports
>Synopsis:       patch to x11-drivers/xf86-input-mouse to support FlipXY
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-x11
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 23 18:50:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Fri Jan 24 01:13:46 UTC 2014
>Originator:     Brock Williams
>Release:        9.2-RELEASE
>Organization:
Cottonwood Computer
>Environment:
FreeBSD touchscreentest 9.2-RELEASE FreeBSD 9.2-RELEASE #0: Mon Oct 21 16:18:54 MDT 2013     ccs@touchscreentest:/usr/obj/usr/src/sys/NO_HID  i386
>Description:
Additional patch for x11-drivers/xf86-input-mouse to support FlipXY/SwapXY option.  This allows us to use an eGalax based usb hid touchscreen where the axes are inverted.  See kern/183032 for more discussion.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- src/bsd_mouse.c	2014-01-23 11:30:52.000000000 -0700
+++ /home/ccs/bsd_mouse.c	2014-01-23 11:30:40.000000000 -0700
@@ -916,7 +916,7 @@
     hid_item_t h;
     struct UsbMseAcol *acol;
     struct UsbMseLcol *lcol;
-    int mdepth, rsize, *rsizep, acolused, lcolused, used;
+    int mdepth, rsize, *rsizep, acolused, lcolused, used, swapxy;
 
     pUsbMse = malloc(sizeof(UsbMseRec));
     if (pUsbMse == NULL) {
@@ -939,6 +939,10 @@
             return FALSE;
         }
     }
+
+    swapxy=xf86SetBoolOption(pInfo->options, "SwapXY", 0);
+    swapxy|=xf86SetBoolOption(pInfo->options, "FlipXY", 0);
+
     /* Get USB informations */
     reportDesc = hid_get_report_desc(pInfo->fd);
     mdepth = 0;
@@ -991,7 +995,7 @@
 	    if (mdepth == 0)
 		break;
 	    used = 1;
-	    if (h.usage == 0x00010030) { /* X */
+	    if ( (swapxy==0 && h.usage == 0x00010030) || (swapxy==1 && h.usage==0x00010031)) { /* X */
 		lcol->loc_x = h;
 		if ((h.flags & 0x04) == 0) {
 		    if (acol->xmin == acol->xmax) {
@@ -1002,7 +1006,7 @@
 			acol->xmax = max(acol->xmax, h.logical_maximum);
 		    }
 		}
-	    } else if (h.usage == 0x00010031) { /* Y */
+	    } else if ( (swapxy==0 && h.usage == 0x00010031) || (swapxy==1 && h.usage==0x00010030)) { /* Y */
 		lcol->loc_y = h;
 		if ((h.flags & 0x04) == 0) {
 		    if (acol->ymin == acol->ymax) {


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->freebsd-x11 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Jan 24 01:13:45 UTC 2014 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=186045 
>Unformatted:
