void ukbd_set_leds(void *v, int leds) { struct ukbd_softc *sc = v; u_int8_t res; DPRINTF(("ukbd_set_leds: sc=%p leds=%d, sc_leds=%d\n", sc, leds, sc->sc_leds)); if (sc->sc_dying) return; if (sc->sc_leds == leds) return; sc->sc_leds = leds; res = 0; /* XXX not really right */ if ((leds & WSKBD_LED_SCROLL) && sc->sc_scroloc.size == 1) res |= 1 << sc->sc_scroloc.pos; if ((leds & WSKBD_LED_NUM) && sc->sc_numloc.size == 1) res |= 1 << sc->sc_numloc.pos; if ((leds & WSKBD_LED_CAPS) && sc->sc_capsloc.size == 1) res |= 1 << sc->sc_capsloc.pos; uhidev_set_report_async(&sc->sc_hdev, UHID_OUTPUT_REPORT, &res, 1); }
void ukbd_set_leds(void *v, int leds) { struct ukbd_softc *sc = v; struct hidkbd *kbd = &sc->sc_kbd; u_int8_t res; if (usbd_is_dying(sc->sc_hdev.sc_udev)) return; if (sc->sc_ledsize && hidkbd_set_leds(kbd, leds, &res) != 0) uhidev_set_report_async(&sc->sc_hdev, UHID_OUTPUT_REPORT, &res, 1); }