aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/adbhid.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh/adbhid.c')
-rw-r--r--drivers/macintosh/adbhid.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 6e9afe26db89..b7f41d3823a6 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -225,6 +225,7 @@ struct adbhid {
225#define FLAG_CAPSLOCK_TRANSLATE 0x00000008 225#define FLAG_CAPSLOCK_TRANSLATE 0x00000008
226#define FLAG_CAPSLOCK_DOWN 0x00000010 226#define FLAG_CAPSLOCK_DOWN 0x00000010
227#define FLAG_CAPSLOCK_IGNORE_NEXT 0x00000020 227#define FLAG_CAPSLOCK_IGNORE_NEXT 0x00000020
228#define FLAG_POWER_KEY_PRESSED 0x00000040
228 229
229static struct adbhid *adbhid[16]; 230static struct adbhid *adbhid[16];
230 231
@@ -301,9 +302,11 @@ adbhid_input_keycode(int id, int scancode, int repeat)
301 ahid->flags |= FLAG_CAPSLOCK_TRANSLATE 302 ahid->flags |= FLAG_CAPSLOCK_TRANSLATE
302 | FLAG_CAPSLOCK_DOWN; 303 | FLAG_CAPSLOCK_DOWN;
303 } 304 }
304 } else if (scancode == 0xff) { 305 } else if (scancode == 0xff &&
306 !(ahid->flags & FLAG_POWER_KEY_PRESSED)) {
305 /* Scancode 0xff usually signifies that the capslock 307 /* Scancode 0xff usually signifies that the capslock
306 * key was either pressed or released. */ 308 * key was either pressed or released, or that the
309 * power button was released. */
307 if (ahid->flags & FLAG_CAPSLOCK_TRANSLATE) { 310 if (ahid->flags & FLAG_CAPSLOCK_TRANSLATE) {
308 keycode = ADB_KEY_CAPSLOCK; 311 keycode = ADB_KEY_CAPSLOCK;
309 if (ahid->flags & FLAG_CAPSLOCK_DOWN) { 312 if (ahid->flags & FLAG_CAPSLOCK_DOWN) {
@@ -317,7 +320,7 @@ adbhid_input_keycode(int id, int scancode, int repeat)
317 } 320 }
318 } else { 321 } else {
319 printk(KERN_INFO "Spurious caps lock event " 322 printk(KERN_INFO "Spurious caps lock event "
320 "(scancode 0xff)."); 323 "(scancode 0xff).\n");
321 } 324 }
322 } 325 }
323 } 326 }
@@ -344,6 +347,12 @@ adbhid_input_keycode(int id, int scancode, int repeat)
344 } 347 }
345 break; 348 break;
346 case ADB_KEY_POWER: 349 case ADB_KEY_POWER:
350 /* Keep track of the power key state */
351 if (up_flag)
352 ahid->flags &= ~FLAG_POWER_KEY_PRESSED;
353 else
354 ahid->flags |= FLAG_POWER_KEY_PRESSED;
355
347 /* Fn + Command will produce a bogus "power" keycode */ 356 /* Fn + Command will produce a bogus "power" keycode */
348 if (ahid->flags & FLAG_FN_KEY_PRESSED) { 357 if (ahid->flags & FLAG_FN_KEY_PRESSED) {
349 keycode = ADB_KEY_CMD; 358 keycode = ADB_KEY_CMD;