--- ./hw/xfree86/os-support/bsd/bsd_mouse.c.orig 2006-09-18 15:04:18.000000000 +0900 +++ ./hw/xfree86/os-support/bsd/bsd_mouse.c 2008-04-06 13:57:42.000000000 +0900 @@ -55,12 +55,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 */ @@ -71,6 +74,8 @@ static void usbSigioReadInput (int fd, void *closure); #endif +#define TSTOMILLI(ts) (((ts).tv_nsec/1000000)+((ts).tv_sec*1000)) + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) /* These are for FreeBSD and DragonFly */ #define DEFAULT_MOUSE_DEV "/dev/mouse" @@ -391,7 +396,7 @@ wsconsReadInput(InputInfoPtr pInfo) { MouseDevPtr pMse; static struct wscons_event eventList[NUMEVENTS]; - int n, c; + int n, c, x, y; struct wscons_event *event = eventList; unsigned char *pBuf; @@ -430,6 +435,33 @@ wsconsReadInput(InputInfoPtr pInfo) dz = event->value; break; #endif +#ifdef WSCONS_EVENT_MOUSE_DELTA_W + case WSCONS_EVENT_MOUSE_DELTA_W: + dw = event->value; + break; +#endif + case WSCONS_EVENT_MOUSE_ABSOLUTE_X: + miPointerPosition (&x, &y); + miPointerAbsoluteCursor (event->value, y, TSTOMILLI(event->time)); + ++event; + continue; + + case WSCONS_EVENT_MOUSE_ABSOLUTE_Y: + miPointerPosition (&x, &y); + miPointerAbsoluteCursor (x, event->value, TSTOMILLI(event->time)); + ++event; + continue; + + case WSCONS_EVENT_MOUSE_ABSOLUTE_Z: + ++event; + continue; + +#ifdef WSCONS_EVENT_MOUSE_ABSOLUTE_W + case WSCONS_EVENT_MOUSE_ABSOLUTE_W: + ++event; + continue; +#endif + default: xf86Msg(X_WARNING, "%s: bad wsmouse event type=%d\n", pInfo->name, event->type); @@ -491,6 +523,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; /* w (pan) locator item */ hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */ unsigned char *buffer; } UsbMseRec, *UsbMsePtr; @@ -610,6 +643,7 @@ usbReadInput(InputInfoPtr pInfo) dx = hid_get_data(pBuf, &pUsbMse->loc_x); dy = hid_get_data(pBuf, &pUsbMse->loc_y); dz = hid_get_data(pBuf, &pUsbMse->loc_z); + dw = hid_get_data(pBuf, &pUsbMse->loc_w); buttons = 0; for (n = 0; n < pMse->buttons; n++) { @@ -701,6 +735,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) { @@ -713,6 +750,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++) {