From 823261a3e188b81c3983b0db5db723e1cff47e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Tue, 27 Jan 2004 15:40:30 +0000 Subject: [PATCH] While USB keyboards attach as ukbd[0-9]+, the device node created by kbd_attach() is called kbd[0-9]+, with a different unit number. This makes it impossible to write a devd rule which will automatically switch to a USB keyboard when one is attached, because there is no way to guess the correct device node to pass to kbdcontrol. Therefore, change kbd_attach() to create a device node using the keyboard device's real name (atkbd0, ukbd0...), and create the kbd[0-9]+ node as an alias for backward compatibility. --- sys/dev/kbd/kbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index f5dd583fd1d6..f4910e1ef34c 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -454,7 +454,8 @@ kbd_attach(keyboard_t *kbd) return EINVAL; kbd->kb_dev = make_dev(&kbd_cdevsw, kbd->kb_index, UID_ROOT, GID_WHEEL, 0600, - "kbd%r", kbd->kb_index); + "%s%r", kbd->kb_name, kbd->kb_unit); + make_dev_alias(kbd->kb_dev, "kbd%r", kbd->kb_index); kbd->kb_dev->si_drv1 = malloc(sizeof(genkbd_softc_t), M_DEVBUF, M_WAITOK | M_ZERO); printf("kbd%d at %s%d\n", kbd->kb_index, kbd->kb_name, kbd->kb_unit);