summaryrefslogtreecommitdiffstats
path: root/sys/dev/kbd
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2005-07-13 23:58:57 +0000
committeremax <emax@FreeBSD.org>2005-07-13 23:58:57 +0000
commitd48616b5a759cc8eca7d3cac8b37e3e0d383662d (patch)
tree6d2a37162c3c680337538d594955c3a7c0e843d4 /sys/dev/kbd
parentfbc6f8c90bc866966059aaea49d9b5e8e06fcddb (diff)
downloadFreeBSD-src-d48616b5a759cc8eca7d3cac8b37e3e0d383662d.zip
FreeBSD-src-d48616b5a759cc8eca7d3cac8b37e3e0d383662d.tar.gz
kbdmux(4) keyboard multiplexer integration
o Add two new ioctl's KBADDKBD and KBRELKBD. These are used to add and remove keyboard to (and from) kbdmux(4) keyboard multiplexer; o Introduce new kbd_find_keyboard2() function. It does exactly the same job as kbd_find_keyboard() function except it allows to specify starting index. This function can be used to iterate over keyboards array; o Re-implement kbd_find_keyboard() as call to kbd_find_keyboard2() with starting index of zero; o Make sure syscons(4) passed KBADDKBD and KBRELKBD ioctl's onto currently active keyboard. These changes should not have any visible effect. MFC after: 1 week
Diffstat (limited to 'sys/dev/kbd')
-rw-r--r--sys/dev/kbd/kbd.c20
-rw-r--r--sys/dev/kbd/kbdreg.h1
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
index da6ee39..9786441 100644
--- a/sys/dev/kbd/kbd.c
+++ b/sys/dev/kbd/kbd.c
@@ -282,13 +282,19 @@ keyboard_switch_t
* exclusive use.
*/
-/* find the keyboard specified by a driver name and a unit number */
+/*
+ * find the keyboard specified by a driver name and a unit number
+ * starting at given index
+ */
int
-kbd_find_keyboard(char *driver, int unit)
+kbd_find_keyboard2(char *driver, int unit, int index)
{
int i;
- for (i = 0; i < keyboards; ++i) {
+ if ((index < 0) || (index >= keyboards))
+ return (-1);
+
+ for (i = index; i < keyboards; ++i) {
if (keyboard[i] == NULL)
continue;
if (!KBD_IS_VALID(keyboard[i]))
@@ -299,9 +305,17 @@ kbd_find_keyboard(char *driver, int unit)
continue;
return (i);
}
+
return (-1);
}
+/* find the keyboard specified by a driver name and a unit number */
+int
+kbd_find_keyboard(char *driver, int unit)
+{
+ return (kbd_find_keyboard2(driver, unit, 0));
+}
+
/* allocate a keyboard */
int
kbd_allocate(char *driver, int unit, void *id, kbd_callback_func_t *func,
diff --git a/sys/dev/kbd/kbdreg.h b/sys/dev/kbd/kbdreg.h
index 78a5af4..184c607 100644
--- a/sys/dev/kbd/kbdreg.h
+++ b/sys/dev/kbd/kbdreg.h
@@ -196,6 +196,7 @@ int kbd_release(keyboard_t *kbd, void *id);
int kbd_change_callback(keyboard_t *kbd, void *id,
kbd_callback_func_t *func, void *arg);
int kbd_find_keyboard(char *driver, int unit);
+int kbd_find_keyboard2(char *driver, int unit, int index);
keyboard_t *kbd_get_keyboard(int index);
/* a back door for the console driver to tickle the keyboard driver XXX */
OpenPOWER on IntegriCloud