Hi,

I'm going to ask re@'s approval to MFC the attached patches to
RELENG_6 in 3 days.  I'd appreciate it if some of you who have
issues listed below could test it and report back if it got
better with these patches.  What has been fixed:

- If PS/2 keyboard is attached *after* the system has booted,
  the keyboard LEDs now work as expected, with or without
  kbdmux(4).

- CAPS LED now works on USB keyboards under X.

- It's now possible to build a release with -P in installation
  /boot.config, similar to how this was possible for a long
  time on i386.  (amd64 only.)

- It's now possible to plug a PS/2 keyboard after boot, and
  have it working during the initial installation.  Previously
  it's been disabled by a hint.atkbd.0.flags="0x1" in the
  installation /boot/device.hints.  It doesn't break USB
  keyboard installations which this was a workaround for
  before we had kbdmux(4).  (amd64 and i386.)

- Related to the previous change; if /boot/device.hints is
  updated with a fresh copy of GENERIC.hints, the PS/2
  keyboard can be plugged after the system has already booted,
  and will work.  (amd64 only.)


Cheers,
-- 
Ruslan Ermilov
[EMAIL PROTECTED]
FreeBSD committer
Index: sys/amd64/conf/GENERIC.hints
===================================================================
RCS file: /home/ncvs/src/sys/amd64/conf/GENERIC.hints,v
retrieving revision 1.15
diff -u -p -r1.15 GENERIC.hints
--- sys/amd64/conf/GENERIC.hints        22 Jul 2004 22:28:34 -0000      1.15
+++ sys/amd64/conf/GENERIC.hints        25 Oct 2006 13:56:37 -0000
@@ -11,7 +11,6 @@ hint.atkbdc.0.at="isa"
 hint.atkbdc.0.port="0x060"
 hint.atkbd.0.at="atkbdc"
 hint.atkbd.0.irq="1"
-hint.atkbd.0.flags="0x1"
 hint.psm.0.at="atkbdc"
 hint.psm.0.irq="12"
 hint.vga.0.at="isa"
Index: sys/dev/atkbdc/atkbd.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/atkbdc/atkbd.c,v
retrieving revision 1.47.2.2
diff -u -p -r1.47.2.2 atkbd.c
--- sys/dev/atkbdc/atkbd.c      4 Oct 2006 06:09:08 -0000       1.47.2.2
+++ sys/dev/atkbdc/atkbd.c      25 Oct 2006 13:08:08 -0000
@@ -482,6 +482,22 @@ atkbd_intr(keyboard_t *kbd, void *arg)
        int delay[2];
        int c;
 
+       if (!KBD_HAS_DEVICE(kbd)) {
+               /*
+                * The keyboard was not detected before;
+                * it must have been reconnected!
+                */
+               state = (atkbd_state_t *)kbd->kb_data;
+               init_keyboard(state->kbdc, &kbd->kb_type,
+                             kbd->kb_config);
+               KBD_FOUND_DEVICE(kbd);
+               atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state);
+               get_typematic(kbd);
+               delay[0] = kbd->kb_delay1;
+               delay[1] = kbd->kb_delay2;
+               atkbd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
+       }
+
        if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) {
                /* let the callback function to process the input */
                (*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT,
@@ -491,22 +507,6 @@ atkbd_intr(keyboard_t *kbd, void *arg)
                do {
                        c = atkbd_read_char(kbd, FALSE);
                } while (c != NOKEY);
-
-               if (!KBD_HAS_DEVICE(kbd)) {
-                       /*
-                        * The keyboard was not detected before;
-                        * it must have been reconnected!
-                        */
-                       state = (atkbd_state_t *)kbd->kb_data;
-                       init_keyboard(state->kbdc, &kbd->kb_type,
-                                     kbd->kb_config);
-                       atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state);
-                       get_typematic(kbd);
-                       delay[0] = kbd->kb_delay1;
-                       delay[1] = kbd->kb_delay2;
-                       atkbd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
-                       KBD_FOUND_DEVICE(kbd);
-               }
        }
        return 0;
 }
Index: sys/dev/usb/ukbd.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.52.2.2
diff -u -p -r1.52.2.2 ukbd.c
--- sys/dev/usb/ukbd.c  4 Oct 2006 06:09:10 -0000       1.52.2.2
+++ sys/dev/usb/ukbd.c  25 Oct 2006 12:17:27 -0000
@@ -1208,7 +1208,8 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, 
                }
                i = *(int *)arg;
                /* replace CAPS LED with ALTGR LED for ALTGR keyboards */
-               if (kbd->kb_keymap->n_keys > ALTGR_OFFSET) {
+               if (state->ks_mode == K_XLATE &&
+                   kbd->kb_keymap->n_keys > ALTGR_OFFSET) {
                        if (i & ALKED)
                                i |= CLKED;
                        else
Index: release/Makefile
===================================================================
RCS file: /home/ncvs/src/release/Makefile,v
retrieving revision 1.887.2.17
diff -u -p -r1.887.2.17 Makefile
--- release/Makefile    15 Sep 2006 19:27:40 -0000      1.887.2.17
+++ release/Makefile    25 Oct 2006 13:58:35 -0000
@@ -953,9 +953,6 @@ cdrom.1:
        # Break the link to device.hints so we can modify it
        @rm -f ${CD_LIVEFS}/boot/device.hints
        @cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints
-.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
-       @echo 'hint.atkbd.0.flags="0x1"' >> ${CD_LIVEFS}/boot/device.hints
-.endif
 .endif
        @echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf
        touch ${.TARGET}
@@ -1262,9 +1259,6 @@ buildBootFloppy:
            ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot
 .if exists(${HINTSFILE})
        @cp ${HINTSFILE} ${IMAGEDIR}/boot/device.hints
-.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
-       @echo 'hint.atkbd.0.flags="0x1"' >> ${IMAGEDIR}/boot/device.hints
-.endif
        @gzip -9n ${IMAGEDIR}/boot/device.hints
 .endif
        @gzip -9n ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \
@@ -1285,9 +1279,11 @@ buildBootFloppy:
 .if defined(SPLIT_MFSROOT)
        @echo 'mfsroot_after="read -p \"Insert boot floppy and press Enter\""' 
>> ${IMAGEDIR}/boot/loader.conf
 .endif
-.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
+.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
+.if ${AUTO_KEYBOARD_DETECT}
        @echo "-P" >> ${IMAGEDIR}/boot.config
 .endif
+.endif
        @rm -f ${IMAGEFILE}
        @cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR}
        sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \

Attachment: pgp5vz3vCcxlP.pgp
Description: PGP signature

Reply via email to