From owner-freebsd-drivers@FreeBSD.ORG Sun Jun 3 03:37:02 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 95DE216A46B for ; Sun, 3 Jun 2007 03:37:02 +0000 (UTC) (envelope-from nslay@comcast.net) Received: from alnrmhc14.comcast.net (alnrmhc14.comcast.net [204.127.225.94]) by mx1.freebsd.org (Postfix) with ESMTP id 6438A13C46A for ; Sun, 3 Jun 2007 03:37:02 +0000 (UTC) (envelope-from nslay@comcast.net) Received: from lightbulb.local (c-68-35-224-189.hsd1.fl.comcast.net[68.35.224.189]) by comcast.net (alnrmhc14) with ESMTP id <20070603032559b140040e05e>; Sun, 3 Jun 2007 03:26:00 +0000 Message-ID: <4662348F.4060306@comcast.net> Date: Sat, 02 Jun 2007 23:25:03 -0400 From: Nathan Lay User-Agent: Thunderbird 2.0.0.0 (X11/20070522) MIME-Version: 1.0 To: freebsd-drivers@freebsd.org Content-Type: multipart/mixed; boundary="------------040503000102060204010206" Subject: Microsoft Wireless Notebook Presenter Mouse (patch) X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2007 03:37:02 -0000 This is a multi-part message in MIME format. --------------040503000102060204010206 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi everyone, I got this wireless mouse for free from a friend and noticed it didn't work with ums. The mouse uses a bluetooth dongle, but the dongle can also impersonate a USB hub with the mouse plugged in, however the mouse's usage flags are HUP_CONSUMER and HUG_POINTER instead of the usage flags ums expects HUP_GENERIC_DESKTOP and HUG_MOUSE. The mouse also lies about the bit positions of the X, Y, Z, T and 5 buttons, and the size of the ibuf. I created a patch for sys/dev/usb/ums.c and sys/dev/usb/usbdevs Anyway I can make this patch better? cd /usr/src patch < /path/to/ums.c.patch patch < /path/to/usbdevs.patch Best Regards, Nathan Lay --------------040503000102060204010206 Content-Type: text/plain; name="ums.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ums.c.patch" *** sys/dev/usb/ums.c Mon Feb 6 15:29:17 2006 --- /root/ums.c Sat Jun 2 22:41:10 2007 *************** *** 195,198 **** --- 195,204 ---- ret = UMATCH_NONE; + /* Odd usage flags in Presenter mice! */ + if (hid_is_collection(desc, size, HID_USAGE2(HUP_CONSUMER, HUG_POINTER))) + ret = UMATCH_IFACECLASS; + else + ret = UMATCH_NONE; + free(desc, M_TEMP); return (ret); *************** *** 313,317 **** --- 319,342 ---- hid_input, &sc->sc_loc_btn[i-1], 0); + sc->sc_isize = hid_report_size(desc, size, hid_input, &sc->sc_iid); + + /* Mouse quirks, add here! */ + switch ( uaa->product ) { + case USB_PRODUCT_MICROSOFT_PRESENTER: + /* This mouse lies about its buttons and x,y,z positions * Offset by 16 instead of 8 because of UMS_T *ibuff++ thingy + */ + /* XXX Not sure if UMS_T is on all Presenter mice! */ + sc->sc_loc_x.pos -= 16; + sc->sc_loc_y.pos -= 16; + sc->sc_loc_z.pos -= 16; + sc->sc_loc_t.pos -= 16; + for (i = 1; i <= sc->nbuttons; i++ ) sc->sc_loc_btn[i-1].pos -= 16; + /* This mouse also lies about the size! */ + sc->sc_isize = 6; + break; + } + + sc->sc_ibuf = malloc(sc->sc_isize, M_USB, M_NOWAIT); if (!sc->sc_ibuf) { --------------040503000102060204010206 Content-Type: text/plain; name="usbdevs.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="usbdevs.patch" *** sys/dev/usb/usbdevs Tue Nov 14 07:54:38 2006 --- /root/usbdevs Sat Jun 2 22:48:52 2007 *************** *** 1250,1253 **** --- 1250,1254 ---- product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro product MICROSOFT MN110 0x007a 10/100 USB NIC + product MICROSOFT PRESENTER 0x0713 Microsoft Wireless Presenter Mouse /* Microtech products */ --------------040503000102060204010206--