Loading...
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
20struct input_event_compat {
21 struct compat_timeval time;
22 __u16 type;
23 __u16 code;
24 __s32 value;
25};
26
27struct ff_periodic_effect_compat {
28 __u16 waveform;
29 __u16 period;
30 __s16 magnitude;
31 __s16 offset;
32 __u16 phase;
33
34 struct ff_envelope envelope;
35
36 __u32 custom_len;
37 compat_uptr_t custom_data;
38};
39
40struct ff_effect_compat {
41 __u16 type;
42 __s16 id;
43 __u16 direction;
44 struct ff_trigger trigger;
45 struct ff_replay replay;
46
47 union {
48 struct ff_constant_effect constant;
49 struct ff_ramp_effect ramp;
50 struct ff_periodic_effect_compat periodic;
51 struct ff_condition_effect condition[2]; /* One for each axis */
52 struct ff_rumble_effect rumble;
53 } u;
54};
55
56static inline size_t input_event_size(void)
57{
58 return (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) ?
59 sizeof(struct input_event_compat) : sizeof(struct input_event);
60}
61
62#else
63
64static inline size_t input_event_size(void)
65{
66 return sizeof(struct input_event);
67}
68
69#endif /* CONFIG_COMPAT */
70
71int input_event_from_user(const char __user *buffer,
72 struct input_event *event);
73
74int input_event_to_user(char __user *buffer,
75 const struct input_event *event);
76
77int input_ff_effect_from_user(const char __user *buffer, size_t size,
78 struct ff_effect *effect);
79
80#endif /* _INPUT_COMPAT_H */
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
20struct input_event_compat {
21 compat_ulong_t sec;
22 compat_ulong_t usec;
23 __u16 type;
24 __u16 code;
25 __s32 value;
26};
27
28struct ff_periodic_effect_compat {
29 __u16 waveform;
30 __u16 period;
31 __s16 magnitude;
32 __s16 offset;
33 __u16 phase;
34
35 struct ff_envelope envelope;
36
37 __u32 custom_len;
38 compat_uptr_t custom_data;
39};
40
41struct ff_effect_compat {
42 __u16 type;
43 __s16 id;
44 __u16 direction;
45 struct ff_trigger trigger;
46 struct ff_replay replay;
47
48 union {
49 struct ff_constant_effect constant;
50 struct ff_ramp_effect ramp;
51 struct ff_periodic_effect_compat periodic;
52 struct ff_condition_effect condition[2]; /* One for each axis */
53 struct ff_rumble_effect rumble;
54 } u;
55};
56
57static inline size_t input_event_size(void)
58{
59 return (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) ?
60 sizeof(struct input_event_compat) : sizeof(struct input_event);
61}
62
63#else
64
65static inline size_t input_event_size(void)
66{
67 return sizeof(struct input_event);
68}
69
70#endif /* CONFIG_COMPAT */
71
72int input_event_from_user(const char __user *buffer,
73 struct input_event *event);
74
75int input_event_to_user(char __user *buffer,
76 const struct input_event *event);
77
78int input_ff_effect_from_user(const char __user *buffer, size_t size,
79 struct ff_effect *effect);
80
81#endif /* _INPUT_COMPAT_H */