Date: Mon, 3 Aug 2009 18:40:34 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 166980 for review Message-ID: <200908031840.n73IeY7L087324@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166980 Change 166980 by hselasky@hselasky_laptop001 on 2009/08/03 18:39:51 Avoid using microtime() in polling mode. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/input/ukbd.c#27 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/input/ukbd.c#27 (text+ko) ==== @@ -170,7 +170,6 @@ int32_t sc_state; /* shift/lock key state */ int32_t sc_accents; /* accent key index (> 0) */ - uint16_t sc_microtime; /* used when polling */ uint16_t sc_inputs; uint16_t sc_inputhead; uint16_t sc_inputtail; @@ -303,8 +302,8 @@ static void ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) { - struct timeval tv; - uint16_t temp; + uint8_t i; + uint8_t j; DPRINTFN(2, "polling\n"); @@ -312,21 +311,17 @@ usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); - microtime(&tv); + /* Delay-optimised support for repetition of keys */ - temp = tv.tv_usec / 25000; + for (j = i = 0; i < UKBD_NKEYCODE; i++) + j |= sc->sc_odata.keycode[i]; - /* support repetition of keys: */ + if (j) { + /* a key is pressed - need timekeeping */ + DELAY(1000); - if (sc->sc_microtime != temp) { - - /* wait for next delta */ - - sc->sc_microtime = temp; - - /* 25 milliseconds have passed */ - - sc->sc_time_ms += 25; + /* 1 millisecond has passed */ + sc->sc_time_ms += 1; } ukbd_interrupt(sc);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908031840.n73IeY7L087324>