45#include <sys/stdint.h>
46#include <sys/stddef.h>
51#include <sys/kernel.h>
53#include <sys/module.h>
56#include <sys/condvar.h>
57#include <sys/sysctl.h>
59#include <sys/unistd.h>
60#include <sys/callout.h>
61#include <sys/malloc.h>
65#include <dev/hid/hid.h>
72#define USB_DEBUG_VAR ukbd_debug
78#include <dev/evdev/input.h>
79#include <dev/evdev/evdev.h>
82#include <sys/ioccom.h>
86#include <dev/kbd/kbdreg.h>
89#if defined(UKBD_DFLT_KEYMAP) && !defined(KLD_MODULE)
90#define KBD_DFLT_KEYMAP
95#include <dev/kbd/kbdtables.h>
98static int ukbd_debug = 0;
99static int ukbd_no_leds = 0;
100static int ukbd_pollrate = 0;
102static SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
105 &ukbd_debug, 0,
"Debug level");
106SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, no_leds, CTLFLAG_RWTUN,
107 &ukbd_no_leds, 0,
"Disables setting of keyboard leds");
108SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, pollrate, CTLFLAG_RWTUN,
109 &ukbd_pollrate, 0,
"Force this polling rate, 1-1000Hz");
112#define UKBD_EMULATE_ATSCANCODE 1
113#define UKBD_DRIVER_NAME "ukbd"
114#define UKBD_NKEYCODE 256
115#define UKBD_IN_BUF_SIZE (4 * UKBD_NKEYCODE)
116#define UKBD_IN_BUF_FULL ((UKBD_IN_BUF_SIZE / 2) - 1)
117#define UKBD_NFKEY (sizeof(fkey_tab)/sizeof(fkey_tab[0]))
118#define UKBD_BUFFER_SIZE 64
119#define UKBD_KEY_PRESSED(map, key) ({ \
120 CTASSERT((key) >= 0 && (key) < UKBD_NKEYCODE); \
121 ((map)[(key) / 64] & (1ULL << ((key) % 64))); \
124#define MOD_EJECT 0x01
159 struct evdev_dev *sc_evdev;
168#ifdef UKBD_EMULATE_ATSCANCODE
172#define UKBD_FLAG_COMPOSE 0x00000001
173#define UKBD_FLAG_POLLING 0x00000002
174#define UKBD_FLAG_SET_LEDS 0x00000004
175#define UKBD_FLAG_ATTACHED 0x00000010
176#define UKBD_FLAG_GONE 0x00000020
178#define UKBD_FLAG_HID_MASK 0x003fffc0
179#define UKBD_FLAG_APPLE_EJECT 0x00000040
180#define UKBD_FLAG_APPLE_FN 0x00000080
181#define UKBD_FLAG_APPLE_SWAP 0x00000100
182#define UKBD_FLAG_NUMLOCK 0x00080000
183#define UKBD_FLAG_CAPSLOCK 0x00100000
184#define UKBD_FLAG_SCROLLLOCK 0x00200000
213#define KEY_ERROR 0x01
216#define KEY_RELEASE 0x400
217#define KEY_INDEX(c) ((c) & 0xFF)
220#define SCAN_RELEASE 0x80
221#define SCAN_PREFIX_E0 0x100
222#define SCAN_PREFIX_E1 0x200
223#define SCAN_PREFIX_CTL 0x400
224#define SCAN_PREFIX_SHIFT 0x800
225#define SCAN_PREFIX (SCAN_PREFIX_E0 | SCAN_PREFIX_E1 | \
226 SCAN_PREFIX_CTL | SCAN_PREFIX_SHIFT)
227#define SCAN_CHAR(c) ((c) & 0x7f)
229#define UKBD_LOCK() USB_MTX_LOCK(&Giant)
230#define UKBD_UNLOCK() USB_MTX_UNLOCK(&Giant)
231#define UKBD_LOCK_ASSERT() USB_MTX_ASSERT(&Giant, MA_OWNED)
251 0, 0, 0, 0, 30, 48, 46, 32,
252 18, 33, 34, 35, 23, 36, 37, 38,
253 50, 49, 24, 25, 16, 19, 31, 20,
254 22, 47, 17, 45, 21, 44, 2, 3,
255 4, 5, 6, 7, 8, 9, 10, 11,
256 28, 1, 14, 15, 57, 12, 13, 26,
257 27, 43, 43, 39, 40, 41, 51, 52,
258 53, 58, 59, 60, 61, 62, 63, 64,
259 65, 66, 67, 68, 87, 88, 92, 70,
260 104, 102, 94, 96, 103, 99, 101, 98,
261 97, 100, 95, 69, 91, 55, 74, 78,
262 89, 79, 80, 81, 75, 76, 77, 71,
263 72, 73, 82, 83, 86, 107, 122,
NN,
266 109, 110, 112, 118, 114, 116, 117, 119,
268 124, 125, 126, 127, 128,
NN,
NN,
NN,
279 29, 42, 56, 105, 90, 54, 93, 106,
286 0x05, 0x01, 0x09, 0x06, 0xa1,
287 0x01, 0x05, 0x07, 0x19, 0xe0,
288 0x29, 0xe7, 0x15, 0x00, 0x25,
289 0x01, 0x75, 0x01, 0x95, 0x08,
290 0x81, 0x02, 0x95, 0x01, 0x75,
291 0x08, 0x81, 0x01, 0x95, 0x03,
292 0x75, 0x01, 0x05, 0x08, 0x19,
293 0x01, 0x29, 0x03, 0x91, 0x02,
294 0x95, 0x05, 0x75, 0x01, 0x91,
295 0x01, 0x95, 0x06, 0x75, 0x08,
296 0x15, 0x00, 0x26, 0xff, 0x00,
297 0x05, 0x07, 0x19, 0x00, 0x2a,
298 0xff, 0x00, 0x81, 0x00, 0xc0
305#ifdef UKBD_EMULATE_ATSCANCODE
311static int ukbd_ioctl(keyboard_t *, u_long, caddr_t);
323static evdev_event_t ukbd_ev_event;
325static const struct evdev_methods ukbd_evdev_methods = {
326 .ev_event = ukbd_ev_event,
356 return (key >= 0xe0 && key <= 0xe7);
362 sbintime_t delay, now, prec;
379 prec = qmin(delay >> 7, SBT_1MS * 10);
390 DPRINTF(
"0x%02x (%d) %s\n", key, key,
394 if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL)
395 evdev_push_event(sc->sc_evdev, EV_KEY,
407 DPRINTF(
"input buffer is full\n");
417 (
"ukbd_do_poll called when not polling\n"));
418 DPRINTFN(2,
"polling\n");
433 kern_yield(PRI_UNCHANGED);
467 (
"not polling in kdb or panic\n"));
501 for (key = 0xe0; key != 0xe8; key++) {
502 const uint64_t mask = 1ULL << (key % 64);
503 const uint64_t delta =
517 const uint64_t mask = 1ULL << (key % 64);
518 const uint64_t delta =
522 if (mask == 1 && delta == 0) {
527 }
else if (delta & mask) {
563 if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL)
564 evdev_sync(sc->sc_evdev);
584 if (KBD_IS_ACTIVE(&sc->
sc_kbd) &&
585 KBD_IS_BUSY(&sc->
sc_kbd)) {
587 (sc->
sc_kbd.kb_callback.kc_func) (&sc->
sc_kbd, KBDIO_KEYINPUT,
588 sc->
sc_kbd.kb_callback.kc_arg);
593 }
while (c != NOKEY);
621 case 0x28:
return 0x49;
622 case 0x2a:
return 0x4c;
623 case 0x50:
return 0x4a;
624 case 0x4f:
return 0x4d;
625 case 0x52:
return 0x4b;
626 case 0x51:
return 0x4e;
627 default:
return keycode;
635 case 0x35:
return 0x64;
636 case 0x64:
return 0x35;
637 default:
return keycode;
706 const uint64_t mask = 1ULL << (i % 64);
708 if (mask == 1 && valid == 0) {
711 }
else if (~valid & mask) {
716 struct hid_location tmp_loc = sc->
sc_loc_key[0];
720 while (tmp_loc.count--) {
724 tmp_loc.pos += tmp_loc.size;
753 DPRINTF(
"modifiers = 0x%04x\n", modifiers);
756 const uint64_t mask = 1ULL << (i % 64);
759 DPRINTF(
"Key 0x%02x pressed\n", i);
770 DPRINTF(
"input queue is full!\n");
808 sc->
sc_flags &= ~UKBD_FLAG_SET_LEDS;
896 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
905 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
954 return (BUS_PROBE_DEFAULT);
962 if (hid_is_keyboard(d_ptr, d_len)) {
963 if (hid_is_mouse(d_ptr, d_len)) {
971 error = BUS_PROBE_DEFAULT;
987 sc->
sc_flags &= ~UKBD_FLAG_HID_MASK;
997 if (hid_locate(ptr,
len,
998 HID_USAGE2(HUP_CONSUMER, HUG_APPLE_EJECT),
1001 if (flags & HIO_VARIABLE)
1004 DPRINTFN(1,
"Found Apple eject-key\n");
1006 if (hid_locate(ptr,
len,
1007 HID_USAGE2(0xFFFF, 0x0003),
1010 if (flags & HIO_VARIABLE)
1012 DPRINTFN(1,
"Found Apple FN-key\n");
1016 if (hid_locate(ptr,
len,
1017 HID_USAGE2(HUP_KEYBOARD, 0x00),
1020 if (flags & HIO_VARIABLE) {
1021 DPRINTFN(1,
"Ignoring keyboard event control\n");
1024 DPRINTFN(1,
"Found keyboard event array\n");
1030 if (hid_locate(ptr,
len,
1031 HID_USAGE2(HUP_KEYBOARD, key),
1034 if (flags & HIO_VARIABLE) {
1037 DPRINTFN(1,
"Found key 0x%02x\n", key);
1046 if (hid_locate(ptr,
len,
1047 HID_USAGE2(HUP_LEDS, 0x01),
1050 if (flags & HIO_VARIABLE)
1052 DPRINTFN(1,
"Found keyboard numlock\n");
1054 if (hid_locate(ptr,
len,
1055 HID_USAGE2(HUP_LEDS, 0x02),
1058 if (flags & HIO_VARIABLE)
1060 DPRINTFN(1,
"Found keyboard capslock\n");
1062 if (hid_locate(ptr,
len,
1063 HID_USAGE2(HUP_LEDS, 0x03),
1066 if (flags & HIO_VARIABLE)
1068 DPRINTFN(1,
"Found keyboard scrolllock\n");
1077 int unit = device_get_unit(
dev);
1078 keyboard_t *kbd = &sc->
sc_kbd;
1079 void *hid_ptr = NULL;
1084 struct evdev_dev *evdev;
1094 kbd->kb_data = (
void *)sc;
1106#ifdef UKBD_NO_POLLING
1142 KBD_FOUND_DEVICE(kbd);
1150 KBD_PROBE_DONE(kbd);
1157 DPRINTF(
"Parsing HID descriptor of %d bytes\n",
1162 free(hid_ptr, M_TEMP);
1168 DPRINTF(
"Forcing boot protocol\n");
1174 DPRINTF(
"Set protocol error=%s (ignored)\n",
1188 if (kbd_register(kbd) < 0) {
1191 KBD_CONFIG_DONE(kbd);
1195#ifdef KBD_INSTALL_CDEV
1196 if (kbd_attach(kbd)) {
1202 evdev = evdev_alloc();
1203 evdev_set_name(evdev, device_get_desc(
dev));
1204 evdev_set_phys(evdev, device_get_nameunit(
dev));
1208 evdev_set_methods(evdev, kbd, &ukbd_evdev_methods);
1209 evdev_support_event(evdev, EV_SYN);
1210 evdev_support_event(evdev, EV_KEY);
1213 evdev_support_event(evdev, EV_LED);
1214 evdev_support_event(evdev, EV_REP);
1216 for (i = 0x00; i <= 0xFF; i++)
1217 evdev_support_key(evdev, evdev_hid2key(i));
1219 evdev_support_led(evdev, LED_NUML);
1221 evdev_support_led(evdev, LED_CAPSL);
1223 evdev_support_led(evdev, LED_SCROLLL);
1225 if (evdev_register_mtx(evdev, &Giant))
1228 sc->sc_evdev = evdev;
1234 kbdd_diag(kbd, bootverbose);
1239 rate = ukbd_pollrate;
1291#ifdef KBD_INSTALL_CDEV
1296 device_printf(
dev,
"WARNING: kbd_detach() "
1297 "returned non-zero! (ignored)\n");
1303 evdev_free(sc->sc_evdev);
1306 if (KBD_IS_CONFIGURED(&sc->
sc_kbd)) {
1310 device_printf(
dev,
"WARNING: kbd_unregister() "
1311 "returned non-zero! (ignored)\n");
1321 device_get_nameunit(
dev));
1340ukbd_ev_event(
struct evdev_dev *evdev, uint16_t type, uint16_t code,
1343 keyboard_t *kbd = evdev_get_softc(evdev);
1345 if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD &&
1346 (type == EV_LED || type == EV_REP)) {
1348 kbd_ev_event(kbd, type, code, value);
1424 KBD_DEACTIVATE(kbd);
1439 if (!KBD_IS_ACTIVE(kbd))
1445#ifdef UKBD_EMULATE_ATSCANCODE
1464 if (!KBD_IS_ACTIVE(kbd))
1493#ifdef UKBD_EMULATE_ATSCANCODE
1501 if (!KBD_IS_ACTIVE(kbd))
1504#ifdef UKBD_EMULATE_ATSCANCODE
1519 if (!KBD_IS_ACTIVE(kbd) || (usbcode == -1))
1524#ifdef UKBD_EMULATE_ATSCANCODE
1526 if (keycode ==
NN) {
1544#ifdef UKBD_EMULATE_ATSCANCODE
1550 if (!KBD_IS_ACTIVE(kbd))
1562 if (action > 0xFF) {
1567#ifdef UKBD_EMULATE_ATSCANCODE
1588 if (usbcode == -1) {
1593#ifdef UKBD_EMULATE_ATSCANCODE
1596 if (keycode ==
NN) {
1612 if (keycode ==
NN) {
1621 sc->
sc_flags &= ~UKBD_FLAG_COMPOSE;
1652 goto check_composed;
1659 goto check_composed;
1666 goto check_composed;
1670 goto check_composed;
1690 sc->
sc_flags &= ~UKBD_FLAG_COMPOSE;
1698 action = genkbd_keyaction(kbd,
SCAN_CHAR(keycode),
1701 if (action == NOKEY) {
1734#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
1735 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
1746#
if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
1747 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
1749 ival = IOCPARM_IVAL(arg);
1750 arg = (caddr_t)&ival;
1754 switch (*(
int *)arg) {
1764 if (sc->
sc_mode != *(
int *)arg) {
1776 *(
int *)arg = KBD_LED_VAL(kbd);
1778#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
1779 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
1781 ival = IOCPARM_IVAL(arg);
1782 arg = (caddr_t)&ival;
1787 if (*(
int *)arg & ~LOCK_MASK)
1794 kbd->kb_keymap->n_keys > ALTGR_OFFSET) {
1800 if (KBD_HAS_DEVICE(kbd))
1803 KBD_LED_VAL(kbd) = *(
int *)arg;
1806 *(
int *)arg = sc->
sc_state & LOCK_MASK;
1808#
if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
1809 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
1811 ival = IOCPARM_IVAL(arg);
1812 arg = (caddr_t)&ival;
1816 if (*(
int *)arg & ~LOCK_MASK) {
1827 if (!KBD_HAS_DEVICE(kbd)) {
1836 kbd->kb_delay1 = imax(((
int *)arg)[0], 250);
1837 kbd->kb_delay2 = imax(((
int *)arg)[1], 34);
1839 if (sc->sc_evdev != NULL)
1840 evdev_push_repeats(sc->sc_evdev, kbd);
1844#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
1845 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
1847 ival = IOCPARM_IVAL(arg);
1848 arg = (caddr_t)&ival;
1860 case PIO_DEADKEYMAP:
1864 return (genkbd_commonioctl(kbd, cmd, arg));
1878 if (curthread->td_critnest != 0)
1918#ifdef UKBD_EMULATE_ATSCANCODE
1932 return (
len == 0) ? 1 : -1;
1961 sc->
sc_flags &= ~UKBD_FLAG_POLLING;
1976 DPRINTF(
"leds=0x%02x\n", leds);
1979 if (sc->sc_evdev != NULL)
1980 evdev_push_leds(sc->sc_evdev, leds);
1997 static const int delays[] = {250, 500, 750, 1000};
1998 static const int rates[] = {34, 38, 42, 46, 50, 55, 59, 63,
1999 68, 76, 84, 92, 100, 110, 118, 126,
2000 136, 152, 168, 184, 200, 220, 236, 252,
2001 272, 304, 336, 368, 400, 440, 472, 504};
2006 kbd->kb_delay1 = delays[(code >> 5) & 3];
2007 kbd->kb_delay2 = rates[code & 0x1f];
2009 if (sc->sc_evdev != NULL)
2010 evdev_push_repeats(sc->sc_evdev, kbd);
2015#ifdef UKBD_EMULATE_ATSCANCODE
2036 if ((keycode == 0x5c || keycode == 0x7e) &&
2046 static const int scan[] = {
2100 if ((code >= 89) && (code < (
int)(89 + nitems(scan)))) {
2101 code = scan[code - 89];
2104 if (code == 0x137 && (!(
2112 if ((code == 0x146) && (!(
2167 kbd_add_driver(&ukbd_kbd_driver);
2170 kbd_delete_driver(&ukbd_kbd_driver);
static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB DWC OTG")
SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, phy_type, CTLFLAG_RDTUN, &dwc_otg_phy_type, 0, "DWC OTG PHY TYPE - 0/1/2/3 - ULPI/HSIC/INTERNAL/UTMI+")
uint64_t bitmap[howmany(UKBD_NKEYCODE, 64)]
uint64_t sc_loc_key_valid[howmany(UKBD_NKEYCODE, 64)]
struct usb_device * sc_udev
struct hid_location sc_loc_numlock
uint32_t sc_input[UKBD_IN_BUF_SIZE]
struct hid_location sc_loc_scrolllock
uint8_t sc_id_apple_eject
struct usb_callout sc_callout
struct ukbd_data sc_odata
struct hid_location sc_loc_apple_fn
struct usb_xfer * sc_xfer[UKBD_N_TRANSFER]
fkeytab_t sc_fkeymap[UKBD_NFKEY]
uint32_t sc_buffered_char[2]
struct ukbd_data sc_ndata
uint8_t sc_buffer[UKBD_BUFFER_SIZE]
struct usb_interface * sc_iface
uint8_t sc_id_loc_key[UKBD_NKEYCODE]
struct thread * sc_poll_thread
struct hid_location sc_loc_capslock
struct hid_location sc_loc_key[UKBD_NKEYCODE]
uint32_t sc_composed_char
sbintime_t sc_co_basetime
struct hid_location sc_loc_apple_eject
enum usb_hc_mode usb_mode
struct usbd_lookup_info info
struct usb_interface * iface
struct usb_device * device
uint8_t bInterfaceSubClass
uint8_t bInterfaceProtocol
static void ukbd_interrupt(struct ukbd_softc *)
static void ukbd_parse_hid(struct ukbd_softc *sc, const uint8_t *ptr, uint32_t len)
DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0)
static void ukbd_start_timer(struct ukbd_softc *sc)
#define UKBD_FLAG_APPLE_SWAP
#define SCAN_PREFIX_SHIFT
static int ukbd_check(keyboard_t *kbd)
static uint32_t ukbd_read_char_locked(keyboard_t *kbd, int wait)
static int ukbd_get_state(keyboard_t *kbd, void *buf, size_t len)
#define UKBD_FLAG_COMPOSE
#define UKBD_FLAG_APPLE_EJECT
static int ukbd_ioctl(keyboard_t *, u_long, caddr_t)
static bool ukbd_any_key_pressed(struct ukbd_softc *sc)
KEYBOARD_DRIVER(ukbd, ukbdsw, ukbd_configure)
static void ukbd_event_keyinput(struct ukbd_softc *)
#define UKBD_FLAG_SET_LEDS
static void ukbd_put_key(struct ukbd_softc *sc, uint32_t key)
#define UKBD_FLAG_ATTACHED
static int32_t ukbd_get_key(struct ukbd_softc *sc, uint8_t wait)
static int ukbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
static uint32_t ukbd_atkeycode(int, const uint64_t *)
static int ukbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
static uint32_t ukbd_read_char(keyboard_t *, int)
static const uint8_t ukbd_trtab[256]
static void ukbd_timeout(void *)
static void ukbd_intr_callback(struct usb_xfer *xfer, usb_error_t error)
#define UKBD_KEY_PRESSED(map, key)
static int ukbd_driver_load(module_t mod, int what, void *arg)
static int ukbd_configure(int flags)
static bool ukbd_any_key_valid(struct ukbd_softc *sc)
#define UKBD_FLAG_POLLING
#define UKBD_FLAG_NUMLOCK
MODULE_DEPEND(ukbd, usb, 1, 1, 1)
static int ukbd_lock(keyboard_t *kbd, int lock)
static device_detach_t ukbd_detach
#define UKBD_FLAG_SCROLLLOCK
static devclass_t ukbd_devclass
static const struct usb_config ukbd_config[UKBD_N_TRANSFER]
static int ukbd_disable(keyboard_t *)
static device_resume_t ukbd_resume
static int ukbd_intr(keyboard_t *kbd, void *arg)
static const STRUCT_USB_HOST_ID __used ukbd_devs[]
static int ukbd_check_char(keyboard_t *kbd)
static void ukbd_set_leds(struct ukbd_softc *, uint8_t)
static void ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error)
static device_probe_t ukbd_probe
static int ukbd_check_char_locked(keyboard_t *kbd)
static uint32_t ukbd_apple_fn(uint32_t keycode)
static void ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait)
static bool ukbd_is_modifier_key(uint32_t key)
static int ukbd_key2scan(struct ukbd_softc *, int, const uint64_t *, int)
static int ukbd_test_if(keyboard_t *kbd)
static int ukbd_read(keyboard_t *kbd, int wait)
static int ukbd_set_typematic(keyboard_t *, int)
static int ukbd_poll(keyboard_t *kbd, int on)
static const uint8_t ukbd_boot_desc[]
static keyboard_switch_t ukbdsw
static device_attach_t ukbd_attach
static int ukbd_enable(keyboard_t *)
#define UKBD_LOCK_ASSERT()
static int ukbd_term(keyboard_t *kbd)
USB_PNP_HOST_INFO(ukbd_devs)
#define UKBD_FLAG_APPLE_FN
static int ukbd_set_state(keyboard_t *kbd, void *buf, size_t len)
#define UKBD_FLAG_CAPSLOCK
static driver_t ukbd_driver
static device_method_t ukbd_methods[]
static void ukbd_clear_state(keyboard_t *)
static uint32_t ukbd_apple_swap(uint32_t keycode)
static int ukbd__probe(int unit, void *arg, int flags)
#define UT_WRITE_CLASS_INTERFACE
#define UIPROTO_BOOT_KEYBOARD
void usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset, const void *ptr, usb_frlength_t len)
void usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset, void *ptr, usb_frlength_t len)
const char * usb_get_serial(struct usb_device *udev)
#define USETW2(w, b1, b0)
const char * usbd_errstr(usb_error_t err)
#define USB_IN_POLLING_MODE_FUNC()
usb_error_t usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx, void **descp, uint16_t *sizep, struct malloc_type *mem, uint8_t iface_index)
uint8_t usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk)
usb_error_t usbd_req_set_idle(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint8_t duration, uint8_t id)
usb_error_t usbd_req_set_protocol(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint16_t report)
void usbd_transfer_submit(struct usb_xfer *xfer)
void usbd_xfer_set_frames(struct usb_xfer *xfer, usb_frcount_t n)
void usbd_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup)
void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, usb_frlength_t len)
struct usb_page_cache * usbd_xfer_get_frame(struct usb_xfer *xfer, usb_frcount_t frindex)
usb_error_t usbd_transfer_setup(struct usb_device *udev, const uint8_t *ifaces, struct usb_xfer **ppxfer, const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx)
void usbd_transfer_start(struct usb_xfer *xfer)
void usbd_transfer_poll(struct usb_xfer **ppxfer, uint16_t max)
void * usbd_xfer_softc(struct usb_xfer *xfer)
void usbd_xfer_set_stall(struct usb_xfer *xfer)
void usbd_xfer_set_interval(struct usb_xfer *xfer, int i)
void usbd_transfer_stop(struct usb_xfer *xfer)
void usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, int *aframes, int *nframes)
usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer)
void device_set_usb_desc(device_t dev)
#define USB_IFACE_SUBCLASS(isc)
#define usb_callout_init_mtx(c, m, f)
#define USB_IFACE_CLASS(ic)
#define usb_callout_drain(c)
#define USB_ST_TRANSFERRED
#define USB_IFACE_PROTOCOL(ip)
#define STRUCT_USB_HOST_ID
#define usb_callout_stop(c)
#define USB_GET_STATE(xfer)
#define usb_callout_reset_sbt(c,...)
#define UHID_OUTPUT_REPORT