Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/adb some older powerbook keyboards use the same scan...



details:   https://anonhg.NetBSD.org/src/rev/8d61af272020
branches:  trunk
changeset: 781631:8d61af272020
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Sep 19 04:55:06 2012 +0000

description:
some older powerbook keyboards use the same scancode for the power button as
later ones send on Fn-Command - now we look for that 'special' scancode only
on keyboards that actually need it

diffstat:

 sys/dev/adb/adb_kbd.c |  22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r 426476755efc -r 8d61af272020 sys/dev/adb/adb_kbd.c
--- a/sys/dev/adb/adb_kbd.c     Tue Sep 18 23:42:52 2012 +0000
+++ b/sys/dev/adb/adb_kbd.c     Wed Sep 19 04:55:06 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb_kbd.c,v 1.20 2012/09/02 21:06:54 he Exp $  */
+/*     $NetBSD: adb_kbd.c,v 1.21 2012/09/19 04:55:06 macallan Exp $    */
 
 /*
  * Copyright (C) 1998  Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.20 2012/09/02 21:06:54 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.21 2012/09/19 04:55:06 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -89,10 +89,10 @@
 #endif
        bool sc_emul_usb;
 
+       uint32_t sc_power;
        uint8_t sc_buffer[16];
        uint8_t sc_pollbuf[16];
-       uint8_t sc_us;
-       uint8_t sc_power, sc_pe;
+       uint8_t sc_us, sc_pe;
 };     
 
 /*
@@ -218,7 +218,16 @@
        sc->sc_capslock = 0;
        sc->sc_trans[1] = 103;  /* F11 */
        sc->sc_trans[2] = 111;  /* F12 */
-       sc->sc_power = 0x7f;
+       
+       /*
+        * Most ADB keyboards send 0x7f 0x7f when the power button is pressed.
+        * Some older PowerBooks, like the 3400c, will send a single scancode
+        * 0x7e instead. Unfortunately Fn-Command on some more recent *Books
+        * sends the same scancode, so by default sc_power is set to a value
+        * that can't occur as a scancode and only set to 0x7e on hardware that
+        * needs it
+        */
+       sc->sc_power = 0xffff;
        sc->sc_timestamp = 0;
        sc->sc_emul_usb = FALSE;
 
@@ -312,11 +321,9 @@
                break;
        case ADB_PBG3KBD:
                printf("PowerBook G3 keyboard\n");
-               sc->sc_power = 0x7e;
                break;
        case ADB_PBG3JPKBD:
                printf("PowerBook G3 keyboard (Japanese layout)\n");
-               sc->sc_power = 0x7e;
                break;
        case ADB_IBOOKKBD:
                printf("iBook keyboard\n");
@@ -426,7 +433,6 @@
 
                        /* power button, report to sysmon */
                        sc->sc_pe = k1;
-               
                        sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
                }
        } else {



Home | Main Index | Thread Index | Old Index