Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268571
b: refs/heads/master
c: ff169c1
h: refs/heads/master
i:
  268569: a4a1503
  268567: eb7479c
v: v3
  • Loading branch information
Julian Andres Klode authored and Greg Kroah-Hartman committed Sep 30, 2011
1 parent bf615c2 commit 25874b1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 791c4a642721552204d8defdbd6a3e93cd411f79
refs/heads/master: ff169c1487381aa522b92b9f0c87bd92577bfc80
19 changes: 19 additions & 0 deletions trunk/drivers/staging/nvec/nvec_kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,30 @@

#define ACK_KBD_EVENT {'\x05', '\xed', '\x01'}

static const char led_on[3] = "\x05\xed\x07";
static const char led_off[3] = "\x05\xed\x00";
static unsigned char keycodes[ARRAY_SIZE(code_tab_102us)
+ ARRAY_SIZE(extcode_tab_us102)];

struct nvec_keys {
struct input_dev *input;
struct notifier_block notifier;
struct nvec_chip *nvec;
bool caps_lock;
};

static struct nvec_keys keys_dev;

static void nvec_kbd_toggle_led(void)
{
keys_dev.caps_lock = !keys_dev.caps_lock;

if (keys_dev.caps_lock)
nvec_write_async(keys_dev.nvec, led_on, sizeof(led_on));
else
nvec_write_async(keys_dev.nvec, led_off, sizeof(led_off));
}

static int nvec_keys_notifier(struct notifier_block *nb,
unsigned long event_type, void *data)
{
Expand All @@ -53,6 +66,9 @@ static int nvec_keys_notifier(struct notifier_block *nb,
code = msg[1] & 0x7f;
state = msg[1] & 0x80;

if (code_tabs[_size][code] == KEY_CAPSLOCK && state)
nvec_kbd_toggle_led();

input_report_key(keys_dev.input, code_tabs[_size][code],
!state);
input_sync(keys_dev.input);
Expand Down Expand Up @@ -133,6 +149,9 @@ static int __devinit nvec_kbd_probe(struct platform_device *pdev)
or until we have a sync write */
mdelay(1000);

/* Disable caps lock LED */
nvec_write_async(nvec, led_off, sizeof(led_off));

return 0;

fail:
Expand Down

0 comments on commit 25874b1

Please sign in to comment.