Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hid/hkbd.c
Show First 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | hkbd_put_key(struct hkbd_softc *sc, uint32_t key) | ||||
DPRINTF("0x%02x (%d) %s\n", key, key, | DPRINTF("0x%02x (%d) %s\n", key, key, | ||||
(key & KEY_RELEASE) ? "released" : "pressed"); | (key & KEY_RELEASE) ? "released" : "pressed"); | ||||
#ifdef EVDEV_SUPPORT | #ifdef EVDEV_SUPPORT | ||||
if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) | if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) | ||||
evdev_push_event(sc->sc_evdev, EV_KEY, | evdev_push_event(sc->sc_evdev, EV_KEY, | ||||
evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); | evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); | ||||
if (sc->sc_evdev != NULL && evdev_is_grabbed(sc->sc_evdev)) | |||||
return; | |||||
#endif | #endif | ||||
tail = (sc->sc_inputtail + 1) % HKBD_IN_BUF_SIZE; | tail = (sc->sc_inputtail + 1) % HKBD_IN_BUF_SIZE; | ||||
if (tail != atomic_load_acq_32(&sc->sc_inputhead)) { | if (tail != atomic_load_acq_32(&sc->sc_inputhead)) { | ||||
sc->sc_input[sc->sc_inputtail] = key; | sc->sc_input[sc->sc_inputtail] = key; | ||||
atomic_store_rel_32(&sc->sc_inputtail, tail); | atomic_store_rel_32(&sc->sc_inputtail, tail); | ||||
} else { | } else { | ||||
DPRINTF("input buffer is full\n"); | DPRINTF("input buffer is full\n"); | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | if (dtime <= 0) { | ||||
hkbd_put_key(sc, sc->sc_repeat_key | KEY_PRESS); | hkbd_put_key(sc, sc->sc_repeat_key | KEY_PRESS); | ||||
sc->sc_repeat_time = now + sc->sc_kbd.kb_delay2; | sc->sc_repeat_time = now + sc->sc_kbd.kb_delay2; | ||||
} | } | ||||
} | } | ||||
#ifdef EVDEV_SUPPORT | #ifdef EVDEV_SUPPORT | ||||
if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) | if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) | ||||
evdev_sync(sc->sc_evdev); | evdev_sync(sc->sc_evdev); | ||||
if (sc->sc_evdev != NULL && evdev_is_grabbed(sc->sc_evdev)) | |||||
return; | |||||
#endif | #endif | ||||
/* wakeup keyboard system */ | /* wakeup keyboard system */ | ||||
if (!HID_IN_POLLING_MODE()) | if (!HID_IN_POLLING_MODE()) | ||||
taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task); | taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 1,479 Lines • Show Last 20 Lines |