summaryrefslogtreecommitdiff
path: root/x11/xf86-input-mouse/patches/patch-ac
blob: 3f9c919657ea0ff6dbe890ac4edbfec142be4924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
$NetBSD: patch-ac,v 1.2 2012/05/08 11:20:13 drochner Exp $

Changes from NetBSD xsrc/external/mit/xorg-server/dist/\
hw/xfree86/os-support/bsd/bsd_mouse.c

----------------------------
revision 1.5
date: 2009/02/09 09:49:39;  author: plunky;  state: Exp;  lines: +16 -0
add horizontal mouse-wheel functionality to USB and WSMOUSE drivers
----------------------------
revision 1.4
date: 2009/02/02 03:06:37;  author: christos;  state: Exp;  lines: +7 -11
add a SetupMouse proc to condition the fd. Convert NetBSD's SetupAuto to
SetupMouse.
----------------------------
revision 1.3
date: 2009/01/19 00:54:29;  author: christos;  state: Exp;  lines: +2 -1
fix ioctl.
----------------------------
revision 1.2
date: 2009/01/13 18:43:46;  author: christos;  state: Exp;  lines: +25 -0
Set the mouse event protocol version. (untested, but head will be broken
unless I add this).
----------------------------

--- src/bsd_mouse.c.orig	2012-03-16 06:34:27.000000000 +0000
+++ src/bsd_mouse.c
@@ -53,12 +53,15 @@
 
 #define HUP_GENERIC_DESKTOP     0x0001
 #define HUP_BUTTON              0x0009
+#define HUP_CONSUMER            0x000c
 
 #define HUG_X                   0x0030
 #define HUG_Y                   0x0031
 #define HUG_Z                   0x0032
 #define HUG_WHEEL               0x0038
 
+#define HUC_AC_PAN              0x0238
+
 #define HID_USAGE2(p,u) (((p) << 16) | u)
 
 /* The UMS mices have middle button as number 3 */
@@ -98,7 +101,7 @@ static int
 SupportedInterfaces(void)
 {
 #if defined(__NetBSD__)
-    return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
+    return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC;
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
     return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC;
 #else
@@ -339,6 +342,23 @@ FindDevice(InputInfoPtr pInfo, const cha
 }
 #endif
 
+#if defined(__NetBSD__)
+static Bool
+SetupMouse(InputInfoPtr pInfo)
+{
+#ifdef WSCONS_SUPPORT
+#ifdef WSMOUSEIO_SETVERSION
+        int version = WSMOUSE_EVENT_VERSION;
+        if (ioctl(pInfo->fd, WSMOUSEIO_SETVERSION, &version) == -1) {
+            xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name);
+            return FALSE;
+        }
+#endif
+#endif
+        return TRUE;
+}
+#endif
+
 #if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
 
 /* Only support wsmouse configuration for now */
@@ -473,7 +493,7 @@ typedef struct _UsbMseRec {
     hid_item_t loc_x;		/* x locator item */
     hid_item_t loc_y;		/* y locator item */
     hid_item_t loc_z;		/* z (wheel) locator item */
-    hid_item_t loc_w;		/* z (wheel) locator item */
+    hid_item_t loc_w;		/* w (pan) locator item */
     hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */
    unsigned char *buffer;
 } UsbMseRec, *UsbMsePtr;
@@ -688,6 +708,9 @@ usbPreInit(InputInfoPtr pInfo, const cha
     if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
 		   hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) {
     }
+    if (hid_locate(reportDesc, HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN),
+		   hid_input, &pUsbMse->loc_w, pUsbMse->iid) < 0) {
+    }
 #else
     if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
 		   hid_input, &pUsbMse->loc_x) < 0) {
@@ -700,6 +723,9 @@ usbPreInit(InputInfoPtr pInfo, const cha
     if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
 		   hid_input, &pUsbMse->loc_z) < 0) {
     }
+    if (hid_locate(reportDesc, HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN),
+		   hid_input, &pUsbMse->loc_w) < 0) {
+    }
 #endif
     /* Probe for number of buttons */
     for (i = 1; i <= MSE_MAXBUTTONS; i++) {
@@ -772,6 +798,9 @@ OSMouseInit(int flags)
     p->SetupAuto = SetupAuto;
     p->SetMiscRes = SetMouseRes;
 #endif
+#if defined(__NetBSD__)
+    p->SetupMouse = SetupMouse;
+#endif
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
     p->FindDevice = FindDevice;
 #endif