Date: Tue, 14 Jul 2009 10:28:02 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 166075 for review Message-ID: <200907141028.n6EAS29j063795@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166075 Change 166075 by hselasky@hselasky_laptop001 on 2009/07/14 10:27:47 USB input - add support for setting the UMS polling rate through -F option passed to moused. - reminded by Alexander Best PR: usb/125264 Affected files ... .. //depot/projects/usb/src/sys/dev/usb/input/ums.c#19 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/input/ums.c#19 (text+ko) ==== @@ -140,6 +140,8 @@ struct usb_xfer *sc_xfer[UMS_N_TRANSFER]; + int sc_pollrate; + uint8_t sc_buttons; uint8_t sc_iid; uint8_t sc_temp[64]; @@ -514,6 +516,8 @@ DPRINTF("error=%s\n", usbd_errstr(err)); goto detach; } + + /* Get HID descriptor */ err = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex); @@ -653,6 +657,23 @@ ums_start_read(struct usb_fifo *fifo) { struct ums_softc *sc = usb_fifo_softc(fifo); + int rate; + + /* Check if we should override the default polling interval */ + rate = sc->sc_pollrate; + /* Range check rate */ + if (rate > 1000) + rate = 1000; + /* Check for set rate */ + if ((rate > 0) && (sc->sc_xfer[UMS_INTR_DT] != NULL)) { + DPRINTF("Setting pollrate = %d\n", rate); + /* Stop current transfer, if any */ + usbd_transfer_stop(sc->sc_xfer[UMS_INTR_DT]); + /* Set new interval */ + usbd_xfer_set_interval(sc->sc_xfer[UMS_INTR_DT], 1000 / rate); + /* Only set pollrate once */ + sc->sc_pollrate = 0; + } usbd_transfer_start(sc->sc_xfer[UMS_INTR_DT]); } @@ -791,6 +812,9 @@ sc->sc_mode.level = mode.level; } + /* store polling rate */ + sc->sc_pollrate = mode.rate; + if (sc->sc_mode.level == 0) { if (sc->sc_buttons > MOUSE_MSC_MAXBUTTON) sc->sc_hw.buttons = MOUSE_MSC_MAXBUTTON;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907141028.n6EAS29j063795>