2 * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>,
4 * Christian Helmuth <ch12@os.inf.tu-dresden.de>,
5 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
6 * economic rights: Technische Universität Dresden (Germany)
8 * This file is part of TUD:OS and distributed under the terms of the
9 * GNU General Public License 2.
10 * Please see the COPYING-GPL-2 file for details.
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/input.h>
17 #include <l4/sys/ipc.h>
18 #include <l4/sys/utcb.h>
23 MODULE_AUTHOR("Alexander Warg");
24 MODULE_DESCRIPTION("L4 Proxy input injector");
25 MODULE_LICENSE("GPL");
27 static char proxy_name[] = "L4 input event injector";
28 static char proxy_phys[] = "l4/sys";
30 static struct input_dev l4proxy_dev;
32 static pthread_t irq_tid;
34 static void *irq_handler(void *dummy)
36 //l4thread_started(NULL);
37 printk("%s: IRQ handler up\n", proxy_name);
38 l4_umword_t input_server;
39 l4_umword_t d0 = 0, d1 = 0;
41 /* FIXME protocol hard-coded here */
44 /*l4_msgtag_t res = */l4_ipc_wait(l4_utcb(), &input_server, L4_IPC_NEVER);
45 enter_kdebug("IMPLEMENT ME!");
46 input_event(&l4proxy_dev,
47 d0 & (unsigned short)0xffff,
48 (d0 >> 16) & (unsigned short)0xffff,
54 //static int __init proxy_init(int prio)
55 int l4input_internal_proxy_init(int prio)
57 init_input_dev(&l4proxy_dev);
58 l4proxy_dev.name = proxy_name;
59 l4proxy_dev.phys = proxy_phys;
60 l4proxy_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS) | BIT(EV_MSC);
63 for (i = 0; i < NBITS(KEY_MAX); i++) l4proxy_dev.keybit[i] = ~0UL;
64 for (i = 0; i < NBITS(REL_MAX); i++) l4proxy_dev.relbit[i] = ~0UL;
65 for (i = 0; i < NBITS(ABS_MAX); i++) l4proxy_dev.absbit[i] = ~0UL;
66 for (i = 0; i < NBITS(MSC_MAX); i++) l4proxy_dev.mscbit[i] = ~0UL;
68 /* XXX this is no touchpad */
69 clear_bit(BTN_TOOL_FINGER, l4proxy_dev.keybit);
71 input_register_device(&l4proxy_dev);
73 printk(KERN_INFO "input: %s\n", proxy_name);
75 /* FIXME name hard-coded here */
77 irq_tid = l4thread_create_named((l4thread_fn_t) irq_handler,
79 L4THREAD_CREATE_SYNC);
81 if (L4THREAD_IS_ERR(irq_tid)) {
83 if (pthread_create(&irq_tid, NULL, irq_handler, NULL)) {
84 printf("Error creating IRQ thread!");