2 * (c) 2009 Technische Universität Dresden
3 * This file is part of TUD:OS and distributed under the terms of the
4 * GNU General Public License 2.
5 * Please see the COPYING-GPL-2 file for details.
7 #include <linux/kernel.h>
8 #include <linux/module.h>
9 #include <linux/init.h>
10 #include <linux/input.h>
12 #include <l4/sys/ipc.h>
13 #include <l4/sys/utcb.h>
18 MODULE_AUTHOR("Alexander Warg");
19 MODULE_DESCRIPTION("L4 Proxy input injector");
20 MODULE_LICENSE("GPL");
22 static char proxy_name[] = "L4 input event injector";
23 static char proxy_phys[] = "l4/sys";
25 static struct input_dev l4proxy_dev;
27 static pthread_t irq_tid;
29 static void *irq_handler(void *dummy)
31 //l4thread_started(NULL);
32 printk("%s: IRQ handler up\n", proxy_name);
33 l4_umword_t input_server;
34 l4_umword_t d0 = 0, d1 = 0;
36 /* FIXME protocol hard-coded here */
39 /*l4_msgtag_t res = */l4_ipc_wait(l4_utcb(), &input_server, L4_IPC_NEVER);
40 enter_kdebug("IMPLEMENT ME!");
41 input_event(&l4proxy_dev,
42 d0 & (unsigned short)0xffff,
43 (d0 >> 16) & (unsigned short)0xffff,
49 //static int __init proxy_init(int prio)
50 int l4input_internal_proxy_init(int prio)
52 init_input_dev(&l4proxy_dev);
53 l4proxy_dev.name = proxy_name;
54 l4proxy_dev.phys = proxy_phys;
55 l4proxy_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS) | BIT(EV_MSC);
58 for (i = 0; i < NBITS(KEY_MAX); i++) l4proxy_dev.keybit[i] = ~0UL;
59 for (i = 0; i < NBITS(REL_MAX); i++) l4proxy_dev.relbit[i] = ~0UL;
60 for (i = 0; i < NBITS(ABS_MAX); i++) l4proxy_dev.absbit[i] = ~0UL;
61 for (i = 0; i < NBITS(MSC_MAX); i++) l4proxy_dev.mscbit[i] = ~0UL;
63 /* XXX this is no touchpad */
64 clear_bit(BTN_TOOL_FINGER, l4proxy_dev.keybit);
66 input_register_device(&l4proxy_dev);
68 printk(KERN_INFO "input: %s\n", proxy_name);
70 /* FIXME name hard-coded here */
72 irq_tid = l4thread_create_named((l4thread_fn_t) irq_handler,
74 L4THREAD_CREATE_SYNC);
76 if (L4THREAD_IS_ERR(irq_tid)) {
78 if (pthread_create(&irq_tid, NULL, irq_handler, NULL)) {
79 printf("Error creating IRQ thread!");