From 58a1b901a48dccc815bfbd085b4cc8daa118b51a Mon Sep 17 00:00:00 2001 From: des Date: Tue, 27 Jan 2004 15:40:30 +0000 Subject: 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 f5dd583..f4910e1 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); -- cgit v1.1