Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104186
b: refs/heads/master
c: 5b7c407
h: refs/heads/master
v: v3
  • Loading branch information
Rodney Lorrimar authored and Dmitry Torokhov committed May 16, 2008
1 parent b072dcc commit 0349601
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2e75f044c717b85f65d74c8c90624428ba31078c
refs/heads/master: 5b7c407baa9501e49ebd3b6eac30cd4bcb60ca9d
15 changes: 12 additions & 3 deletions trunk/drivers/macintosh/adbhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ struct adbhid {
#define FLAG_CAPSLOCK_TRANSLATE 0x00000008
#define FLAG_CAPSLOCK_DOWN 0x00000010
#define FLAG_CAPSLOCK_IGNORE_NEXT 0x00000020
#define FLAG_POWER_KEY_PRESSED 0x00000040

static struct adbhid *adbhid[16];

Expand Down Expand Up @@ -301,9 +302,11 @@ adbhid_input_keycode(int id, int scancode, int repeat)
ahid->flags |= FLAG_CAPSLOCK_TRANSLATE
| FLAG_CAPSLOCK_DOWN;
}
} else if (scancode == 0xff) {
} else if (scancode == 0xff &&
!(ahid->flags & FLAG_POWER_KEY_PRESSED)) {
/* Scancode 0xff usually signifies that the capslock
* key was either pressed or released. */
* key was either pressed or released, or that the
* power button was released. */
if (ahid->flags & FLAG_CAPSLOCK_TRANSLATE) {
keycode = ADB_KEY_CAPSLOCK;
if (ahid->flags & FLAG_CAPSLOCK_DOWN) {
Expand All @@ -317,7 +320,7 @@ adbhid_input_keycode(int id, int scancode, int repeat)
}
} else {
printk(KERN_INFO "Spurious caps lock event "
"(scancode 0xff).");
"(scancode 0xff).\n");
}
}
}
Expand All @@ -344,6 +347,12 @@ adbhid_input_keycode(int id, int scancode, int repeat)
}
break;
case ADB_KEY_POWER:
/* Keep track of the power key state */
if (up_flag)
ahid->flags &= ~FLAG_POWER_KEY_PRESSED;
else
ahid->flags |= FLAG_POWER_KEY_PRESSED;

/* Fn + Command will produce a bogus "power" keycode */
if (ahid->flags & FLAG_FN_KEY_PRESSED) {
keycode = ADB_KEY_CMD;
Expand Down

0 comments on commit 0349601

Please sign in to comment.