1 /* $NetBSD: btkbd.c,v 1.21 2021/08/07 16:19:09 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson (lennart@augustsson.net) at
9 * Carlstedt Research & Technology.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 /*-
34 * Copyright (c) 2006 Itronix Inc.
35 * All rights reserved.
36 *
37 * Written by Iain Hibbert for Itronix Inc.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 * 3. The name of Itronix Inc. may not be used to endorse
48 * or promote products derived from this software without specific
49 * prior written permission.
50 *
51 * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
52 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
53 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
54 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
55 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
56 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
57 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
58 * ON ANY THEORY OF LIABILITY, WHETHER IN
59 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
61 * POSSIBILITY OF SUCH DAMAGE.
62 */
63
64 /*
65 * based on dev/usb/ukbd.c
66 */
67
68 #include <sys/cdefs.h>
69 __KERNEL_RCSID(0, "$NetBSD: btkbd.c,v 1.21 2021/08/07 16:19:09 thorpej Exp $");
70
71 #include <sys/param.h>
72 #include <sys/callout.h>
73 #include <sys/conf.h>
74 #include <sys/device.h>
75 #include <sys/kernel.h>
76 #include <sys/proc.h>
77 #include <sys/systm.h>
78
79 #include <netbt/bluetooth.h>
80
81 #include <dev/bluetooth/bthid.h>
82 #include <dev/bluetooth/bthidev.h>
83
84 #include <dev/hid/hid.h>
85 #include <dev/usb/usb.h>
86 #include <dev/usb/usbhid.h>
87
88 #include <dev/wscons/wsconsio.h>
89 #include <dev/wscons/wskbdvar.h>
90 #include <dev/wscons/wsksymdef.h>
91 #include <dev/wscons/wsksymvar.h>
92
93 #include "opt_wsdisplay_compat.h"
94 #include "opt_btkbd.h"
95
96 #define MAXKEYCODE 6
97 #define MAXMOD 8 /* max 32 */
98 #define MAXKEYS (MAXMOD + (2 * MAXKEYCODE))
99
100 struct btkbd_data {
101 uint32_t modifiers;
102 uint8_t keycode[MAXKEYCODE];
103 };
104
105 struct btkbd_mod {
106 uint32_t mask;
107 uint8_t key;
108 };
109
110 struct btkbd_softc {
111 struct bthidev sc_hidev; /* device+ */
112 device_t sc_wskbd; /* child */
113 int sc_enabled;
114
115 int (*sc_output) /* output method */
116 (struct bthidev *, uint8_t *, int);
117
118 /* stored data */
119 struct btkbd_data sc_odata;
120 struct btkbd_data sc_ndata;
121
122 /* input reports */
123 int sc_nmod;
124 struct hid_location sc_modloc[MAXMOD];
125 struct btkbd_mod sc_mods[MAXMOD];
126
127 int sc_nkeycode;
128 struct hid_location sc_keycodeloc;
129
130 /* output reports */
131 struct hid_location sc_numloc;
132 struct hid_location sc_capsloc;
133 struct hid_location sc_scroloc;
134 int sc_leds;
135
136 #ifdef WSDISPLAY_COMPAT_RAWKBD
137 int sc_rawkbd;
138 #ifdef BTKBD_REPEAT
139 callout_t sc_repeat;
140 int sc_nrep;
141 char sc_rep[MAXKEYS];
142 #endif
143 #endif
144 };
145
146 /* autoconf(9) methods */
147 static int btkbd_match(device_t, cfdata_t, void *);
148 static void btkbd_attach(device_t, device_t, void *);
149 static int btkbd_detach(device_t, int);
150
151 CFATTACH_DECL_NEW(btkbd, sizeof(struct btkbd_softc),
152 btkbd_match, btkbd_attach, btkbd_detach, NULL);
153
154 /* wskbd(4) accessops */
155 static int btkbd_enable(void *, int);
156 static void btkbd_set_leds(void *, int);
157 static int btkbd_ioctl(void *, unsigned long, void *, int, struct lwp *);
158
159 static const struct wskbd_accessops btkbd_accessops = {
160 btkbd_enable,
161 btkbd_set_leds,
162 btkbd_ioctl
163 };
164
165 /* wskbd(4) keymap data */
166 extern const struct wscons_keydesc hidkbd_keydesctab[];
167
168 const struct wskbd_mapdata btkbd_keymapdata = {
169 hidkbd_keydesctab,
170 #if defined(BTKBD_LAYOUT)
171 BTKBD_LAYOUT,
172 #elif defined(PCKBD_LAYOUT)
173 PCKBD_LAYOUT,
174 #else
175 KB_US,
176 #endif
177 };
178
179 /* bthid methods */
180 static void btkbd_input(struct bthidev *, uint8_t *, int);
181
182 /* internal prototypes */
183 static const char *btkbd_parse_desc(struct btkbd_softc *, int, const void *, int);
184
185 #ifdef WSDISPLAY_COMPAT_RAWKBD
186 #ifdef BTKBD_REPEAT
187 static void btkbd_repeat(void *);
188 #endif
189 #endif
190
191 /*****************************************************************************
192 *
193 * btkbd autoconf(9) routines
194 */
195
196 static int
btkbd_match(device_t self,cfdata_t cfdata,void * aux)197 btkbd_match(device_t self, cfdata_t cfdata, void *aux)
198 {
199 struct bthidev_attach_args *ba = aux;
200
201 if (hid_is_collection(ba->ba_desc, ba->ba_dlen, ba->ba_id,
202 HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD)))
203 return 1;
204
205 return 0;
206 }
207
208 static void
btkbd_attach(device_t parent,device_t self,void * aux)209 btkbd_attach(device_t parent, device_t self, void *aux)
210 {
211 struct btkbd_softc *sc = device_private(self);
212 struct bthidev_attach_args *ba = aux;
213 struct wskbddev_attach_args wska;
214 const char *parserr;
215
216 sc->sc_output = ba->ba_output;
217 ba->ba_input = btkbd_input;
218
219 parserr = btkbd_parse_desc(sc, ba->ba_id, ba->ba_desc, ba->ba_dlen);
220 if (parserr != NULL) {
221 aprint_error("%s\n", parserr);
222 return;
223 }
224
225 aprint_normal("\n");
226
227 #ifdef WSDISPLAY_COMPAT_RAWKBD
228 #ifdef BTKBD_REPEAT
229 callout_init(&sc->sc_repeat, 0);
230 callout_setfunc(&sc->sc_repeat, btkbd_repeat, sc);
231 #endif
232 #endif
233
234 wska.console = 0;
235 wska.keymap = &btkbd_keymapdata;
236 wska.accessops = &btkbd_accessops;
237 wska.accesscookie = sc;
238
239 sc->sc_wskbd = config_found(self, &wska, wskbddevprint, CFARGS_NONE);
240
241 pmf_device_register(self, NULL, NULL);
242 }
243
244 static int
btkbd_detach(device_t self,int flags)245 btkbd_detach(device_t self, int flags)
246 {
247 struct btkbd_softc *sc = device_private(self);
248 int err = 0;
249
250 pmf_device_deregister(self);
251
252 #ifdef WSDISPLAY_COMPAT_RAWKBD
253 #ifdef BTKBD_REPEAT
254 callout_halt(&sc->sc_repeat, NULL);
255 callout_destroy(&sc->sc_repeat);
256 #endif
257 #endif
258
259 if (sc->sc_wskbd != NULL) {
260 err = config_detach(sc->sc_wskbd, flags);
261 sc->sc_wskbd = NULL;
262 }
263
264 return err;
265 }
266
267 static const char *
btkbd_parse_desc(struct btkbd_softc * sc,int id,const void * desc,int dlen)268 btkbd_parse_desc(struct btkbd_softc *sc, int id, const void *desc, int dlen)
269 {
270 struct hid_data *d;
271 struct hid_item h;
272 int imod;
273
274 imod = 0;
275 sc->sc_nkeycode = 0;
276 d = hid_start_parse(desc, dlen, hid_input);
277 while (hid_get_item(d, &h)) {
278 if (h.kind != hid_input || (h.flags & HIO_CONST) ||
279 HID_GET_USAGE_PAGE(h.usage) != HUP_KEYBOARD ||
280 h.report_ID != id)
281 continue;
282
283 if (h.flags & HIO_VARIABLE) {
284 if (h.loc.size != 1) {
285 hid_end_parse(d);
286 return ("bad modifier size");
287 }
288
289 /* Single item */
290 if (imod < MAXMOD) {
291 sc->sc_modloc[imod] = h.loc;
292 sc->sc_mods[imod].mask = 1 << imod;
293 sc->sc_mods[imod].key = HID_GET_USAGE(h.usage);
294 imod++;
295 } else {
296 hid_end_parse(d);
297 return ("too many modifier keys");
298 }
299 } else {
300 /* Array */
301 if (h.loc.size != 8) {
302 hid_end_parse(d);
303 return ("key code size != 8");
304 }
305 if (h.loc.count > MAXKEYCODE) {
306 hid_end_parse(d);
307 return ("too many key codes");
308 }
309 if (h.loc.pos % 8 != 0) {
310 hid_end_parse(d);
311 return ("key codes not on byte boundary");
312 }
313 if (sc->sc_nkeycode != 0) {
314 hid_end_parse(d);
315 return ("multiple key code arrays\n");
316 }
317 sc->sc_keycodeloc = h.loc;
318 sc->sc_nkeycode = h.loc.count;
319 }
320 }
321 sc->sc_nmod = imod;
322 hid_end_parse(d);
323
324 hid_locate(desc, dlen, HID_USAGE2(HUP_LEDS, HUD_LED_NUM_LOCK),
325 id, hid_output, &sc->sc_numloc, NULL);
326
327 hid_locate(desc, dlen, HID_USAGE2(HUP_LEDS, HUD_LED_CAPS_LOCK),
328 id, hid_output, &sc->sc_capsloc, NULL);
329
330 hid_locate(desc, dlen, HID_USAGE2(HUP_LEDS, HUD_LED_SCROLL_LOCK),
331 id, hid_output, &sc->sc_scroloc, NULL);
332
333 return (NULL);
334 }
335
336 /*****************************************************************************
337 *
338 * wskbd(9) accessops
339 */
340
341 static int
btkbd_enable(void * cookie,int on)342 btkbd_enable(void *cookie, int on)
343 {
344 struct btkbd_softc *sc = cookie;
345
346 sc->sc_enabled = on;
347 return 0;
348 }
349
350 static void
btkbd_set_leds(void * cookie,int leds)351 btkbd_set_leds(void *cookie, int leds)
352 {
353 struct btkbd_softc *sc = cookie;
354 uint8_t report;
355
356 if (sc->sc_leds == leds)
357 return;
358
359 sc->sc_leds = leds;
360
361 /*
362 * This is not totally correct, since we did not check the
363 * report size from the descriptor but for keyboards it should
364 * just be a single byte with the relevant bits set.
365 */
366 report = 0;
367 if ((leds & WSKBD_LED_SCROLL) && sc->sc_scroloc.size == 1)
368 report |= 1 << sc->sc_scroloc.pos;
369
370 if ((leds & WSKBD_LED_NUM) && sc->sc_numloc.size == 1)
371 report |= 1 << sc->sc_numloc.pos;
372
373 if ((leds & WSKBD_LED_CAPS) && sc->sc_capsloc.size == 1)
374 report |= 1 << sc->sc_capsloc.pos;
375
376 if (sc->sc_output)
377 (*sc->sc_output)(&sc->sc_hidev, &report, sizeof(report));
378 }
379
380 static int
btkbd_ioctl(void * cookie,unsigned long cmd,void * data,int flag,struct lwp * l)381 btkbd_ioctl(void *cookie, unsigned long cmd, void *data, int flag,
382 struct lwp *l)
383 {
384 struct btkbd_softc *sc = cookie;
385
386 switch (cmd) {
387 case WSKBDIO_GTYPE:
388 *(int *)data = WSKBD_TYPE_BLUETOOTH;
389 break;
390
391 case WSKBDIO_SETLEDS:
392 btkbd_set_leds(sc, *(int *)data);
393 break;
394
395 case WSKBDIO_GETLEDS:
396 *(int *)data = sc->sc_leds;
397 break;
398
399 #ifdef WSDISPLAY_COMPAT_RAWKBD
400 case WSKBDIO_SETMODE:
401 sc->sc_rawkbd = (*(int *)data == WSKBD_RAW);
402 #ifdef BTKBD_REPEAT
403 callout_stop(&sc->sc_repeat);
404 #endif
405 break;
406 #endif
407
408 default:
409 return EPASSTHROUGH;
410 }
411
412 return 0;
413 }
414
415 /*****************************************************************************
416 *
417 * btkbd input routine, called from our parent
418 */
419
420 #ifdef WSDISPLAY_COMPAT_RAWKBD
421 #define NN 0 /* no translation */
422 /*
423 * Translate USB keycodes to US keyboard XT scancodes.
424 * Scancodes >= 0x80 represent EXTENDED keycodes.
425 *
426 * See http://www.microsoft.com/HWDEV/TECH/input/Scancode.asp
427 */
428 static const u_int8_t btkbd_trtab[256] = {
429 NN, NN, NN, NN, 0x1e, 0x30, 0x2e, 0x20, /* 00 - 07 */
430 0x12, 0x21, 0x22, 0x23, 0x17, 0x24, 0x25, 0x26, /* 08 - 0f */
431 0x32, 0x31, 0x18, 0x19, 0x10, 0x13, 0x1f, 0x14, /* 10 - 17 */
432 0x16, 0x2f, 0x11, 0x2d, 0x15, 0x2c, 0x02, 0x03, /* 18 - 1f */
433 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, /* 20 - 27 */
434 0x1c, 0x01, 0x0e, 0x0f, 0x39, 0x0c, 0x0d, 0x1a, /* 28 - 2f */
435 0x1b, 0x2b, 0x2b, 0x27, 0x28, 0x29, 0x33, 0x34, /* 30 - 37 */
436 0x35, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, /* 38 - 3f */
437 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xaa, 0x46, /* 40 - 47 */
438 0x7f, 0xd2, 0xc7, 0xc9, 0xd3, 0xcf, 0xd1, 0xcd, /* 48 - 4f */
439 0xcb, 0xd0, 0xc8, 0x45, 0xb5, 0x37, 0x4a, 0x4e, /* 50 - 57 */
440 0x9c, 0x4f, 0x50, 0x51, 0x4b, 0x4c, 0x4d, 0x47, /* 58 - 5f */
441 0x48, 0x49, 0x52, 0x53, 0x56, 0xdd, NN, 0x59, /* 60 - 67 */
442 0x5d, 0x5e, 0x5f, NN, NN, NN, NN, NN, /* 68 - 6f */
443 NN, NN, NN, NN, NN, NN, NN, NN, /* 70 - 77 */
444 NN, NN, NN, NN, NN, NN, NN, NN, /* 78 - 7f */
445 NN, NN, NN, NN, NN, 0x7e, NN, 0x73, /* 80 - 87 */
446 0x70, 0x7d, 0x79, 0x7b, 0x5c, NN, NN, NN, /* 88 - 8f */
447 NN, NN, 0x78, 0x77, 0x76, NN, NN, NN, /* 90 - 97 */
448 NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9f */
449 NN, NN, NN, NN, NN, NN, NN, NN, /* a0 - a7 */
450 NN, NN, NN, NN, NN, NN, NN, NN, /* a8 - af */
451 NN, NN, NN, NN, NN, NN, NN, NN, /* b0 - b7 */
452 NN, NN, NN, NN, NN, NN, NN, NN, /* b8 - bf */
453 NN, NN, NN, NN, NN, NN, NN, NN, /* c0 - c7 */
454 NN, NN, NN, NN, NN, NN, NN, NN, /* c8 - cf */
455 NN, NN, NN, NN, NN, NN, NN, NN, /* d0 - d7 */
456 NN, NN, NN, NN, NN, NN, NN, NN, /* d8 - df */
457 0x1d, 0x2a, 0x38, 0xdb, 0x9d, 0x36, 0xb8, 0xdc, /* e0 - e7 */
458 NN, NN, NN, NN, NN, NN, NN, NN, /* e8 - ef */
459 NN, NN, NN, NN, NN, NN, NN, NN, /* f0 - f7 */
460 NN, NN, NN, NN, NN, NN, NN, NN, /* f8 - ff */
461 };
462 #endif
463
464 #define KEY_ERROR 0x01
465 #define PRESS 0x000
466 #define RELEASE 0x100
467 #define CODEMASK 0x0ff
468 #define ADDKEY(c) ibuf[nkeys++] = (c)
469 #define REP_DELAY1 400
470 #define REP_DELAYN 100
471
472 static void
btkbd_input(struct bthidev * hidev,uint8_t * data,int len)473 btkbd_input(struct bthidev *hidev, uint8_t *data, int len)
474 {
475 struct btkbd_softc *sc = (struct btkbd_softc *)hidev;
476 struct btkbd_data *ud = &sc->sc_ndata;
477 uint16_t ibuf[MAXKEYS];
478 uint32_t mod, omod;
479 int nkeys, i, j;
480 int key;
481 int s;
482
483 if (sc->sc_wskbd == NULL || sc->sc_enabled == 0)
484 return;
485
486 /* extract key modifiers */
487 ud->modifiers = 0;
488 for (i = 0 ; i < sc->sc_nmod ; i++)
489 if (hid_get_data(data, &sc->sc_modloc[i]))
490 ud->modifiers |= sc->sc_mods[i].mask;
491
492 /* extract keycodes */
493 memcpy(ud->keycode, data + (sc->sc_keycodeloc.pos / 8),
494 sc->sc_nkeycode);
495
496 if (ud->keycode[0] == KEY_ERROR)
497 return; /* ignore */
498
499 nkeys = 0;
500 mod = ud->modifiers;
501 omod = sc->sc_odata.modifiers;
502 if (mod != omod)
503 for (i = 0 ; i < sc->sc_nmod ; i++)
504 if ((mod & sc->sc_mods[i].mask) !=
505 (omod & sc->sc_mods[i].mask))
506 ADDKEY(sc->sc_mods[i].key |
507 (mod & sc->sc_mods[i].mask
508 ? PRESS : RELEASE));
509
510 if (memcmp(ud->keycode, sc->sc_odata.keycode, sc->sc_nkeycode) != 0) {
511 /* Check for released keys. */
512 for (i = 0 ; i < sc->sc_nkeycode ; i++) {
513 key = sc->sc_odata.keycode[i];
514 if (key == 0)
515 continue;
516
517 for (j = 0 ; j < sc->sc_nkeycode ; j++)
518 if (key == ud->keycode[j])
519 goto rfound;
520
521 ADDKEY(key | RELEASE);
522
523 rfound:
524 ;
525 }
526
527 /* Check for pressed keys. */
528 for (i = 0 ; i < sc->sc_nkeycode ; i++) {
529 key = ud->keycode[i];
530 if (key == 0)
531 continue;
532
533 for (j = 0; j < sc->sc_nkeycode; j++)
534 if (key == sc->sc_odata.keycode[j])
535 goto pfound;
536
537 ADDKEY(key | PRESS);
538 pfound:
539 ;
540 }
541 }
542 sc->sc_odata = *ud;
543
544 if (nkeys == 0)
545 return;
546
547 #ifdef WSDISPLAY_COMPAT_RAWKBD
548 if (sc->sc_rawkbd) {
549 u_char cbuf[MAXKEYS * 2];
550 int c;
551 #ifdef BTKBD_REPEAT
552 int npress = 0;
553 #endif
554
555 for (i = j = 0 ; i < nkeys ; i++) {
556 key = ibuf[i];
557 c = btkbd_trtab[key & CODEMASK];
558 if (c == NN)
559 continue;
560
561 if (c & 0x80)
562 cbuf[j++] = 0xe0;
563
564 cbuf[j] = c & 0x7f;
565 if (key & RELEASE)
566 cbuf[j] |= 0x80;
567 #ifdef BTKBD_REPEAT
568 else {
569 /* remember pressed keys for autorepeat */
570 if (c & 0x80)
571 sc->sc_rep[npress++] = 0xe0;
572
573 sc->sc_rep[npress++] = c & 0x7f;
574 }
575 #endif
576
577 j++;
578 }
579
580 s = spltty();
581 wskbd_rawinput(sc->sc_wskbd, cbuf, j);
582 splx(s);
583 #ifdef BTKBD_REPEAT
584 callout_stop(&sc->sc_repeat);
585 if (npress != 0) {
586 sc->sc_nrep = npress;
587 callout_schedule(&sc->sc_repeat, hz * REP_DELAY1 / 1000);
588 }
589 #endif
590 return;
591 }
592 #endif
593
594 s = spltty();
595 for (i = 0 ; i < nkeys ; i++) {
596 key = ibuf[i];
597 wskbd_input(sc->sc_wskbd,
598 key & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN,
599 key & CODEMASK);
600 }
601 splx(s);
602 }
603
604 #ifdef WSDISPLAY_COMPAT_RAWKBD
605 #ifdef BTKBD_REPEAT
606 static void
btkbd_repeat(void * arg)607 btkbd_repeat(void *arg)
608 {
609 struct btkbd_softc *sc = arg;
610 int s;
611
612 s = spltty();
613 wskbd_rawinput(sc->sc_wskbd, sc->sc_rep, sc->sc_nrep);
614 splx(s);
615 callout_schedule(&sc->sc_repeat, hz * REP_DELAYN / 1000);
616 }
617 #endif
618 #endif
619