diff -ruNp --exclude .libs --exclude .deps --exclude '*.orig' /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/Makefile.am src/Makefile.am --- /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/Makefile.am 2010-03-23 03:43:43.000000000 +0200 +++ src/Makefile.am 2011-06-23 14:22:23.000000000 +0300 @@ -27,7 +27,7 @@ AM_CPPFLAGS = $(XORG_CFLAGS) # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la -@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version +@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version -lusbhid @DRIVER_NAME@_drv_ladir = @inputdir@ # We have to list all the mouse drivers here, even if we don't build them, so diff -ruNp --exclude .libs --exclude .deps --exclude '*.orig' /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/Makefile.in src/Makefile.in --- /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/Makefile.in 2010-09-09 09:13:01.000000000 +0300 +++ src/Makefile.in 2011-06-23 14:25:54.000000000 +0300 @@ -276,7 +276,7 @@ AM_CPPFLAGS = $(XORG_CFLAGS) # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la -@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version +@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version -lusbhid @DRIVER_NAME@_drv_ladir = @inputdir@ # We have to list all the mouse drivers here, even if we don't build them, so diff -ruNp --exclude .libs --exclude .deps --exclude '*.orig' /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/bsd_mouse.c src/bsd_mouse.c --- /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/bsd_mouse.c 2011-06-23 13:09:28.000000000 +0300 +++ src/bsd_mouse.c 2011-06-23 14:22:23.000000000 +0300 @@ -24,6 +24,9 @@ * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ +#define USBMOUSE_SUPPORT 1 +#define HAS_LIB_USB_HID 1 +#define USB_NEW_HID 1 #include @@ -557,6 +560,10 @@ usbMouseProc(DeviceIntPtr pPointer, int UsbMsePtr pUsbMse; unsigned char map[MSE_MAXBUTTONS + 1]; int nbuttons; +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + Atom btn_labels[MSE_MAXBUTTONS] = {0}; + Atom axes_labels[2] = { 0, 0 }; +#endif pInfo = pPointer->public.devicePrivate; pMse = pInfo->private; @@ -573,15 +580,40 @@ usbMouseProc(DeviceIntPtr pPointer, int InitPointerDeviceStruct((DevicePtr)pPointer, map, min(pMse->buttons, MSE_MAXBUTTONS), - miPointerGetMotionEvents, - pMse->Ctrl, - miPointerGetMotionBufferSize()); +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + btn_labels, +#endif +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 + miPointerGetMotionEvents, +#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 + GetMotionHistory, +#endif + pMse->Ctrl, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 + miPointerGetMotionBufferSize() +#else + GetMotionHistorySize(), 2 +#endif +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + , axes_labels +#endif + ); /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); + xf86InitValuatorAxisStruct(pPointer, 0, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + axes_labels[0], +#endif + 0, 3478, 1, 0, 1); +// -1, -1, 1, 0, 1); xf86InitValuatorDefaults(pPointer, 0); /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); + xf86InitValuatorAxisStruct(pPointer, 1, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + axes_labels[1], +#endif + 0, 3478, 1, 0, 1); +// -1, -1, 1, 0, 1); xf86InitValuatorDefaults(pPointer, 1); xf86MotionHistoryAllocate(pInfo); break; @@ -635,14 +667,17 @@ usbReadInput(InputInfoPtr pInfo) { MouseDevPtr pMse; UsbMsePtr pUsbMse; - int buttons = pMse->lastButtons; + int buttons; int dx = 0, dy = 0, dz = 0, dw = 0; int n, c; unsigned char *pBuf; + static int px = -1, py = -1; pMse = pInfo->private; pUsbMse = pMse->mousePriv; + buttons = pMse->lastButtons; +next: XisbBlockDuration(pMse->buffer, -1); pBuf = pUsbMse->buffer; n = 0; @@ -651,6 +686,8 @@ usbReadInput(InputInfoPtr pInfo) } if (n == 0) return; + xf86MsgVerb(X_INFO, 3, "pkt: %d %02x %02x %02x %02x %02x %02x %02x %02x\n", + n, pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7]); if (n != pUsbMse->packetSize) { xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", pInfo->name, n); @@ -658,20 +695,32 @@ usbReadInput(InputInfoPtr pInfo) /* discard packets with an id that don't match the mouse */ /* XXX this is probably not the right thing */ if (pUsbMse->iid != 0) { - if (*pBuf++ != pUsbMse->iid) + if (*pBuf != pUsbMse->iid) return; } 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); +// 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++) { + for (n = 0; n < 2 /*pMse->buttons*/; n++) { if (hid_get_data(pBuf, &pUsbMse->loc_btn[n])) buttons |= (1 << UMS_BUT(n)); } - pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); +// xf86MsgVerb(X_INFO, 3, "dx %d dy %d buttons %02x\n", dx, dy, buttons); + if (px != dx || py != dy) + xf86PostMotionEvent(pInfo->dev, + /* is_absolute: */ TRUE, + /* first_valuator: */ 0, + /* num_valuators: */ 2, + dx, dy); +// dx * 800 / 3478, dy * 600 / 3478); +// pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); + pMse->PostEvent(pInfo, buttons, 0, 0, 0, 0); +// pMse->PostEvent(pInfo, buttons, dx - px, dy - py, 0, 0); + px = dx; py = dy; + goto next; return; } @@ -688,7 +737,9 @@ usbPreInit(InputInfoPtr pInfo, const cha MouseDevPtr pMse = pInfo->private; UsbMsePtr pUsbMse; report_desc_t reportDesc; - int i; + hid_data_t d; + hid_item_t h; + int i, mdepth; pUsbMse = xalloc(sizeof(UsbMseRec)); if (pUsbMse == NULL) { @@ -720,11 +771,14 @@ usbPreInit(InputInfoPtr pInfo, const cha reportDesc = hid_get_report_desc(pInfo->fd); /* Get packet size & iid */ #ifdef USB_NEW_HID +/* if (ioctl(pInfo->fd, USB_GET_REPORT_ID, &pUsbMse->iid) == -1) { xf86Msg(X_ERROR, "Error ioctl USB_GET_REPORT_ID on %s : %s\n", pInfo->name, strerror(errno)); return FALSE; } +*/ + pUsbMse->iid = 3; pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, pUsbMse->iid); #else @@ -744,6 +798,7 @@ usbPreInit(InputInfoPtr pInfo, const cha xf86CloseSerial(pInfo->fd); return FALSE; } +#if 0 #ifdef USB_NEW_HID if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) { @@ -779,7 +834,45 @@ usbPreInit(InputInfoPtr pInfo, const cha )) break; } - pMse->buttons = i-1; +#endif + mdepth = 0; + d = hid_start_parse(reportDesc, (1 << hid_input) | + (1 << hid_collection) | (1 << hid_endcollection), 0); + while (hid_get_item(d, &h)) { + switch (h.kind) { + case hid_collection: + if (mdepth != 0 || (h.collection == 1 && h.usage == 0x00010002)) + mdepth++; +xf86Msg(X_ERROR, "ZZZ coll %d\n", mdepth); + break; + case hid_endcollection: + if (mdepth != 0) + mdepth--; +xf86Msg(X_ERROR, "ZZZ ecoll %d\n", mdepth); + break; + case hid_input: +// if (h.flags & HIO_CONST) +// break; +xf86Msg(X_ERROR, "ZZZ input %d %08x r%d p%d s%d\n", mdepth, h.usage, h.report_ID, h.pos, h.report_size); + if (mdepth == 0) + break; + if (h.usage == 0x00010030) /* X */ + pUsbMse->loc_x = h; + if (h.usage == 0x00010031) /* Y */ + pUsbMse->loc_y = h; + if (h.usage == 0x00010032) /* Z */ + pUsbMse->loc_z = h; + if (h.usage > 0x00090000 && + h.usage <= 0x00090000 + MSE_MAXBUTTONS) /* buttons */ + pUsbMse->loc_btn[(h.usage & 0xffff) - 1] = h; + break; + default: + break; + } + } + hid_end_parse(d); + + pMse->buttons = 2; //i-1; xf86CloseSerial(pInfo->fd); pInfo->fd = -1; @@ -789,6 +882,8 @@ usbPreInit(InputInfoPtr pInfo, const cha /* Process common mouse options (like Emulate3Buttons, etc). */ pMse->CommonOptions(pInfo); + pMse->emulate3Buttons = 0; + pMse->emulate3ButtonsSoft = 0; /* Setup the local procs. */ pInfo->device_control = usbMouseProc; diff -ruNp --exclude .libs --exclude .deps --exclude '*.orig' /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/mouse.c src/mouse.c --- /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/mouse.c 2010-08-14 11:04:54.000000000 +0300 +++ src/mouse.c 2011-06-23 14:22:23.000000000 +0300 @@ -696,10 +696,10 @@ MouseHWOptions(InputInfoPtr pInfo) pMse->resolution); } - if ((mPriv->sensitivity + if ((pMse->sensitivity = xf86SetRealOption(pInfo->options, "Sensitivity", 1.0))) { xf86Msg(X_CONFIG, "%s: Sensitivity: %g\n", pInfo->name, - mPriv->sensitivity); + pMse->sensitivity); } } @@ -2356,13 +2356,11 @@ MousePostEvent(InputInfoPtr pInfo, int t /* Accumulate the scaled dx, dy in the private variables fracdx,fracdy and return the integer number part */ - if (mousepriv) { - mousepriv->fracdx += mousepriv->sensitivity*dx; - mousepriv->fracdy += mousepriv->sensitivity*dy; - mousepriv->fracdx -= ( dx=(int)(mousepriv->fracdx) ); - mousepriv->fracdy -= ( dy=(int)(mousepriv->fracdy) ); - } - + pMse->fracdx += pMse->sensitivity*dx; + pMse->fracdy += pMse->sensitivity*dy; + pMse->fracdx -= ( dx=(int)(pMse->fracdx) ); + pMse->fracdy -= ( dy=(int)(pMse->fracdy) ); + /* If mouse wheel movement has to be mapped on a button, we need to * loop for button press and release events. */ do { diff -ruNp --exclude .libs --exclude .deps --exclude '*.orig' /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/mousePriv.h src/mousePriv.h --- /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/mousePriv.h 2009-10-17 00:40:45.000000000 +0300 +++ src/mousePriv.h 2011-06-23 14:22:23.000000000 +0300 @@ -63,8 +63,6 @@ typedef struct { int acc; CARD32 pnpLast; Bool disablePnPauto; - float fracdx,fracdy; - float sensitivity; } mousePrivRec, *mousePrivPtr; /* mouse proto flags */ diff -ruNp --exclude .libs --exclude .deps --exclude '*.orig' /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/xf86OSmouse.h src/xf86OSmouse.h --- /usr/ports/x11-drivers/xf86-input-mouse/xf86-input-mouse-1.6.0.orig/src/xf86OSmouse.h 2010-08-14 11:04:54.000000000 +0300 +++ src/xf86OSmouse.h 2011-06-23 14:22:23.000000000 +0300 @@ -269,6 +269,8 @@ typedef struct _MouseDevRec { int doubleClickOldSourceState; int lastMappedButtons; int buttonMap[MSE_MAXBUTTONS]; + float fracdx,fracdy; + float sensitivity; } MouseDevRec, *MouseDevPtr; #endif /* _XF86OSMOUSE_H_ */