0001
0002 #ifndef _INPUT_COMPAT_H
0003 #define _INPUT_COMPAT_H
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/compiler.h>
0012 #include <linux/compat.h>
0013 #include <linux/input.h>
0014
0015 #ifdef CONFIG_COMPAT
0016
0017 struct input_event_compat {
0018 compat_ulong_t sec;
0019 compat_ulong_t usec;
0020 __u16 type;
0021 __u16 code;
0022 __s32 value;
0023 };
0024
0025 struct ff_periodic_effect_compat {
0026 __u16 waveform;
0027 __u16 period;
0028 __s16 magnitude;
0029 __s16 offset;
0030 __u16 phase;
0031
0032 struct ff_envelope envelope;
0033
0034 __u32 custom_len;
0035 compat_uptr_t custom_data;
0036 };
0037
0038 struct ff_effect_compat {
0039 __u16 type;
0040 __s16 id;
0041 __u16 direction;
0042 struct ff_trigger trigger;
0043 struct ff_replay replay;
0044
0045 union {
0046 struct ff_constant_effect constant;
0047 struct ff_ramp_effect ramp;
0048 struct ff_periodic_effect_compat periodic;
0049 struct ff_condition_effect condition[2];
0050 struct ff_rumble_effect rumble;
0051 } u;
0052 };
0053
0054 static inline size_t input_event_size(void)
0055 {
0056 return (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) ?
0057 sizeof(struct input_event_compat) : sizeof(struct input_event);
0058 }
0059
0060 #else
0061
0062 static inline size_t input_event_size(void)
0063 {
0064 return sizeof(struct input_event);
0065 }
0066
0067 #endif
0068
0069 int input_event_from_user(const char __user *buffer,
0070 struct input_event *event);
0071
0072 int input_event_to_user(char __user *buffer,
0073 const struct input_event *event);
0074
0075 int input_ff_effect_from_user(const char __user *buffer, size_t size,
0076 struct ff_effect *effect);
0077
0078 #endif