15 #include <linux/module.h>
16 #include <linux/slab.h>
17 #include <linux/input.h>
24 #define ACK_KBD_EVENT {'\x05', '\xed', '\x01'}
26 static const char led_on[3] =
"\x05\xed\x07";
27 static const char led_off[3] =
"\x05\xed\x00";
28 static unsigned char keycodes[
ARRAY_SIZE(code_tab_102us)
40 static void nvec_kbd_toggle_led(
void)
42 keys_dev.caps_lock = !keys_dev.caps_lock;
44 if (keys_dev.caps_lock)
54 unsigned char *
msg = (
unsigned char *)data;
57 int _size = (msg[0] & (3 << 5)) >> 5;
67 state = msg[1] & 0x80;
70 nvec_kbd_toggle_led();
72 input_report_key(keys_dev.input, code_tabs[_size][code],
74 input_sync(keys_dev.input);
82 static int nvec_kbd_event(
struct input_dev *
dev,
unsigned int type,
83 unsigned int code,
int value)
107 struct input_dev *
idev;
112 keycodes[j++] = code_tab_102us[i];
114 for (i = 0; i <
ARRAY_SIZE(extcode_tab_us102); ++
i)
115 keycodes[j++] = extcode_tab_us102[i];
117 idev = input_allocate_device();
118 idev->name =
"nvec keyboard";
122 idev->event = nvec_kbd_event;
123 idev->keycode = keycodes;
124 idev->keycodesize =
sizeof(
unsigned char);
128 set_bit(keycodes[i], idev->keybit);
131 err = input_register_device(idev);
135 keys_dev.input =
idev;
136 keys_dev.notifier.notifier_call = nvec_keys_notifier;
137 keys_dev.nvec = nvec;
158 input_free_device(idev);
164 input_unregister_device(keys_dev.input);
165 input_free_device(keys_dev.input);
171 .probe = nvec_kbd_probe,