aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input-compat.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:14:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:14:01 -0500
commitdb30c70575822cc84d87b5613c19cac24734b99f (patch)
tree82945ad5813bfe6633698233981d270b5f0a310b /drivers/input/input-compat.h
parentc861ea2cb2c25c1698734d9b0540a09e253690a1 (diff)
parent9334e90d5ac5ee1fa6d8b75acb7c64a8907787d1 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (29 commits) Input: i8042 - add Dell Vostro 1510 to nomux list Input: gtco - use USB endpoint API Input: add support for Maple controller as a joystick Input: atkbd - broaden the Dell DMI signatures Input: HIL drivers - add MODULE_ALIAS() Input: map_to_7segment.h - convert to __inline__ for userspace Input: add support for enhanced rotary controller on pxa930 and pxa935 Input: add support for trackball on pxa930 and pxa935 Input: add da9034 touchscreen support Input: ads7846 - strict_strtoul takes unsigned long Input: make some variables and functions static Input: add tsc2007 based touchscreen driver Input: psmouse - add module parameters to control OLPC touchpad delays Input: i8042 - add Gigabyte M912 netbook to noloop exception table Input: atkbd - Samsung NC10 key repeat fix Input: atkbd - add keyboard quirk for HP Pavilion ZV6100 laptop Input: libps2 - handle 0xfc responses from devices Input: add support for Wacom W8001 penabled serial touchscreen Input: synaptics - report multi-taps only if supported by the device Input: add joystick driver for Walkera WK-0701 RC transmitter ...
Diffstat (limited to 'drivers/input/input-compat.h')
-rw-r--r--drivers/input/input-compat.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/drivers/input/input-compat.h b/drivers/input/input-compat.h
new file mode 100644
index 000000000000..47cd9eaee66a
--- /dev/null
+++ b/drivers/input/input-compat.h
@@ -0,0 +1,94 @@
1#ifndef _INPUT_COMPAT_H
2#define _INPUT_COMPAT_H
3
4/*
5 * 32bit compatibility wrappers for the input subsystem.
6 *
7 * Very heavily based on evdev.c - Copyright (c) 1999-2002 Vojtech Pavlik
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
12 */
13
14#include <linux/compiler.h>
15#include <linux/compat.h>
16#include <linux/input.h>
17
18#ifdef CONFIG_COMPAT
19
20/* Note to the author of this code: did it ever occur to
21 you why the ifdefs are needed? Think about it again. -AK */
22#ifdef CONFIG_X86_64
23# define INPUT_COMPAT_TEST is_compat_task()
24#elif defined(CONFIG_IA64)
25# define INPUT_COMPAT_TEST IS_IA32_PROCESS(task_pt_regs(current))
26#elif defined(CONFIG_S390)
27# define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT)
28#elif defined(CONFIG_MIPS)
29# define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR)
30#else
31# define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT)
32#endif
33
34struct input_event_compat {
35 struct compat_timeval time;
36 __u16 type;
37 __u16 code;
38 __s32 value;
39};
40
41struct ff_periodic_effect_compat {
42 __u16 waveform;
43 __u16 period;
44 __s16 magnitude;
45 __s16 offset;
46 __u16 phase;
47
48 struct ff_envelope envelope;
49
50 __u32 custom_len;
51 compat_uptr_t custom_data;
52};
53
54struct ff_effect_compat {
55 __u16 type;
56 __s16 id;
57 __u16 direction;
58 struct ff_trigger trigger;
59 struct ff_replay replay;
60
61 union {
62 struct ff_constant_effect constant;
63 struct ff_ramp_effect ramp;
64 struct ff_periodic_effect_compat periodic;
65 struct ff_condition_effect condition[2]; /* One for each axis */
66 struct ff_rumble_effect rumble;
67 } u;
68};
69
70static inline size_t input_event_size(void)
71{
72 return INPUT_COMPAT_TEST ?
73 sizeof(struct input_event_compat) : sizeof(struct input_event);
74}
75
76#else
77
78static inline size_t input_event_size(void)
79{
80 return sizeof(struct input_event);
81}
82
83#endif /* CONFIG_COMPAT */
84
85int input_event_from_user(const char __user *buffer,
86 struct input_event *event);
87
88int input_event_to_user(char __user *buffer,
89 const struct input_event *event);
90
91int input_ff_effect_from_user(const char __user *buffer, size_t size,
92 struct ff_effect *effect);
93
94#endif /* _INPUT_COMPAT_H */