| @@ -1,106 +1,115 @@ | | | @@ -1,106 +1,115 @@ |
1 | $NetBSD: patch-ac,v 1.1 2009/05/22 19:05:57 tnn Exp $ | | 1 | $NetBSD: patch-ac,v 1.2 2012/05/08 11:20:13 drochner Exp $ |
2 | | | 2 | |
3 | Changes from NetBSD xsrc/external/mit/xorg-server/dist/\ | | 3 | Changes from NetBSD xsrc/external/mit/xorg-server/dist/\ |
4 | hw/xfree86/os-support/bsd/bsd_mouse.c | | 4 | hw/xfree86/os-support/bsd/bsd_mouse.c |
5 | | | 5 | |
6 | ---------------------------- | | 6 | ---------------------------- |
7 | revision 1.5 | | 7 | revision 1.5 |
8 | date: 2009/02/09 09:49:39; author: plunky; state: Exp; lines: +16 -0 | | 8 | date: 2009/02/09 09:49:39; author: plunky; state: Exp; lines: +16 -0 |
9 | add horizontal mouse-wheel functionality to USB and WSMOUSE drivers | | 9 | add horizontal mouse-wheel functionality to USB and WSMOUSE drivers |
10 | ---------------------------- | | 10 | ---------------------------- |
11 | revision 1.4 | | 11 | revision 1.4 |
12 | date: 2009/02/02 03:06:37; author: christos; state: Exp; lines: +7 -11 | | 12 | date: 2009/02/02 03:06:37; author: christos; state: Exp; lines: +7 -11 |
13 | add a SetupMouse proc to condition the fd. Convert NetBSD's SetupAuto to | | 13 | add a SetupMouse proc to condition the fd. Convert NetBSD's SetupAuto to |
14 | SetupMouse. | | 14 | SetupMouse. |
15 | ---------------------------- | | 15 | ---------------------------- |
16 | revision 1.3 | | 16 | revision 1.3 |
17 | date: 2009/01/19 00:54:29; author: christos; state: Exp; lines: +2 -1 | | 17 | date: 2009/01/19 00:54:29; author: christos; state: Exp; lines: +2 -1 |
18 | fix ioctl. | | 18 | fix ioctl. |
19 | ---------------------------- | | 19 | ---------------------------- |
20 | revision 1.2 | | 20 | revision 1.2 |
21 | date: 2009/01/13 18:43:46; author: christos; state: Exp; lines: +25 -0 | | 21 | date: 2009/01/13 18:43:46; author: christos; state: Exp; lines: +25 -0 |
22 | Set the mouse event protocol version. (untested, but head will be broken | | 22 | Set the mouse event protocol version. (untested, but head will be broken |
23 | unless I add this). | | 23 | unless I add this). |
24 | ---------------------------- | | 24 | ---------------------------- |
25 | | | 25 | |
26 | --- src/bsd_mouse.c.orig 2009-05-19 15:12:28 +0300 | | 26 | --- src/bsd_mouse.c.orig 2012-03-16 06:34:27.000000000 +0000 |
27 | +++ src/bsd_mouse.c 2009-05-19 15:13:13 +0300 | | 27 | +++ src/bsd_mouse.c |
28 | @@ -53,12 +53,15 @@ | | 28 | @@ -53,12 +53,15 @@ |
29 | | | 29 | |
30 | #define HUP_GENERIC_DESKTOP 0x0001 | | 30 | #define HUP_GENERIC_DESKTOP 0x0001 |
31 | #define HUP_BUTTON 0x0009 | | 31 | #define HUP_BUTTON 0x0009 |
32 | +#define HUP_CONSUMER 0x000c | | 32 | +#define HUP_CONSUMER 0x000c |
33 | | | 33 | |
34 | #define HUG_X 0x0030 | | 34 | #define HUG_X 0x0030 |
35 | #define HUG_Y 0x0031 | | 35 | #define HUG_Y 0x0031 |
36 | #define HUG_Z 0x0032 | | 36 | #define HUG_Z 0x0032 |
37 | #define HUG_WHEEL 0x0038 | | 37 | #define HUG_WHEEL 0x0038 |
38 | | | 38 | |
39 | +#define HUC_AC_PAN 0x0238 | | 39 | +#define HUC_AC_PAN 0x0238 |
40 | + | | 40 | + |
41 | #define HID_USAGE2(p,u) (((p) << 16) | u) | | 41 | #define HID_USAGE2(p,u) (((p) << 16) | u) |
42 | | | 42 | |
43 | /* The UMS mices have middle button as number 3 */ | | 43 | /* The UMS mices have middle button as number 3 */ |
| | | 44 | @@ -98,7 +101,7 @@ static int |
| | | 45 | SupportedInterfaces(void) |
| | | 46 | { |
| | | 47 | #if defined(__NetBSD__) |
| | | 48 | - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; |
| | | 49 | + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; |
| | | 50 | #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
| | | 51 | return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; |
| | | 52 | #else |
44 | @@ -339,6 +342,23 @@ FindDevice(InputInfoPtr pInfo, const cha | | 53 | @@ -339,6 +342,23 @@ FindDevice(InputInfoPtr pInfo, const cha |
45 | } | | 54 | } |
46 | #endif | | 55 | #endif |
47 | | | 56 | |
48 | +#if defined(__NetBSD__) | | 57 | +#if defined(__NetBSD__) |
49 | +static Bool | | 58 | +static Bool |
50 | +SetupMouse(InputInfoPtr pInfo) | | 59 | +SetupMouse(InputInfoPtr pInfo) |
51 | +{ | | 60 | +{ |
52 | +#ifdef WSCONS_SUPPORT | | 61 | +#ifdef WSCONS_SUPPORT |
53 | +#ifdef WSMOUSEIO_SETVERSION | | 62 | +#ifdef WSMOUSEIO_SETVERSION |
54 | + int version = WSMOUSE_EVENT_VERSION; | | 63 | + int version = WSMOUSE_EVENT_VERSION; |
55 | + if (ioctl(pInfo->fd, WSMOUSEIO_SETVERSION, &version) == -1) { | | 64 | + if (ioctl(pInfo->fd, WSMOUSEIO_SETVERSION, &version) == -1) { |
56 | + xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name); | | 65 | + xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name); |
57 | + return FALSE; | | 66 | + return FALSE; |
58 | + } | | 67 | + } |
59 | +#endif | | 68 | +#endif |
60 | +#endif | | 69 | +#endif |
61 | + return TRUE; | | 70 | + return TRUE; |
62 | +} | | 71 | +} |
63 | +#endif | | 72 | +#endif |
64 | + | | 73 | + |
65 | #if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) | | 74 | #if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) |
66 | | | 75 | |
67 | /* Only support wsmouse configuration for now */ | | 76 | /* Only support wsmouse configuration for now */ |
68 | @@ -496,7 +516,7 @@ typedef struct _UsbMseRec { | | 77 | @@ -473,7 +493,7 @@ typedef struct _UsbMseRec { |
69 | hid_item_t loc_x; /* x locator item */ | | 78 | hid_item_t loc_x; /* x locator item */ |
70 | hid_item_t loc_y; /* y locator item */ | | 79 | hid_item_t loc_y; /* y locator item */ |
71 | hid_item_t loc_z; /* z (wheel) locator item */ | | 80 | hid_item_t loc_z; /* z (wheel) locator item */ |
72 | - hid_item_t loc_w; /* z (wheel) locator item */ | | 81 | - hid_item_t loc_w; /* z (wheel) locator item */ |
73 | + hid_item_t loc_w; /* w (pan) locator item */ | | 82 | + hid_item_t loc_w; /* w (pan) locator item */ |
74 | hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */ | | 83 | hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */ |
75 | unsigned char *buffer; | | 84 | unsigned char *buffer; |
76 | } UsbMseRec, *UsbMsePtr; | | 85 | } UsbMseRec, *UsbMsePtr; |
77 | @@ -708,6 +728,9 @@ usbPreInit(InputInfoPtr pInfo, const cha | | 86 | @@ -688,6 +708,9 @@ usbPreInit(InputInfoPtr pInfo, const cha |
78 | if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), | | 87 | if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), |
79 | hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) { | | 88 | hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) { |
80 | } | | 89 | } |
81 | + if (hid_locate(reportDesc, HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN), | | 90 | + if (hid_locate(reportDesc, HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN), |
82 | + hid_input, &pUsbMse->loc_w, pUsbMse->iid) < 0) { | | 91 | + hid_input, &pUsbMse->loc_w, pUsbMse->iid) < 0) { |
83 | + } | | 92 | + } |
84 | #else | | 93 | #else |
85 | if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), | | 94 | if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), |
86 | hid_input, &pUsbMse->loc_x) < 0) { | | 95 | hid_input, &pUsbMse->loc_x) < 0) { |
87 | @@ -720,6 +743,9 @@ usbPreInit(InputInfoPtr pInfo, const cha | | 96 | @@ -700,6 +723,9 @@ usbPreInit(InputInfoPtr pInfo, const cha |
88 | if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), | | 97 | if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), |
89 | hid_input, &pUsbMse->loc_z) < 0) { | | 98 | hid_input, &pUsbMse->loc_z) < 0) { |
90 | } | | 99 | } |
91 | + if (hid_locate(reportDesc, HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN), | | 100 | + if (hid_locate(reportDesc, HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN), |
92 | + hid_input, &pUsbMse->loc_w) < 0) { | | 101 | + hid_input, &pUsbMse->loc_w) < 0) { |
93 | + } | | 102 | + } |
94 | #endif | | 103 | #endif |
95 | /* Probe for number of buttons */ | | 104 | /* Probe for number of buttons */ |
96 | for (i = 1; i <= MSE_MAXBUTTONS; i++) { | | 105 | for (i = 1; i <= MSE_MAXBUTTONS; i++) { |
97 | @@ -790,6 +816,9 @@ xf86OSMouseInit(int flags) | | 106 | @@ -772,6 +798,9 @@ OSMouseInit(int flags) |
98 | p->SetupAuto = SetupAuto; | | 107 | p->SetupAuto = SetupAuto; |
99 | p->SetMiscRes = SetMouseRes; | | 108 | p->SetMiscRes = SetMouseRes; |
100 | #endif | | 109 | #endif |
101 | +#if defined(__NetBSD__) | | 110 | +#if defined(__NetBSD__) |
102 | + p->SetupMouse = SetupMouse; | | 111 | + p->SetupMouse = SetupMouse; |
103 | +#endif | | 112 | +#endif |
104 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__) | | 113 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__) |
105 | p->FindDevice = FindDevice; | | 114 | p->FindDevice = FindDevice; |
106 | #endif | | 115 | #endif |