libevdev_sys/
linux_input.rs

1//! FFI bindings for the `linux/input.h` header.
2
3use libc::timeval;
4
5pub type __u8 = u8;
6pub type __u16 = u16;
7pub type __s16 = i16;
8pub type __u32 = u32;
9pub type __s32 = i32;
10pub type __u64 = u64;
11
12// (also renamed `Union_Unnamed1` to `ff_effect_union`)
13
14/* automatically generated by rust-bindgen */
15
16#[repr(C)]
17#[derive(Copy, Clone)]
18pub struct input_event {
19    pub time: timeval,
20    pub type_: __u16,
21    pub code: __u16,
22    pub value: __s32,
23}
24impl ::std::default::Default for input_event {
25    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
26}
27#[repr(C)]
28#[derive(Copy, Clone)]
29#[derive(Debug)]
30pub struct input_id {
31    pub bustype: __u16,
32    pub vendor: __u16,
33    pub product: __u16,
34    pub version: __u16,
35}
36impl ::std::default::Default for input_id {
37    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
38}
39#[repr(C)]
40#[derive(Copy, Clone)]
41#[derive(Debug)]
42pub struct input_absinfo {
43    pub value: __s32,
44    pub minimum: __s32,
45    pub maximum: __s32,
46    pub fuzz: __s32,
47    pub flat: __s32,
48    pub resolution: __s32,
49}
50impl ::std::default::Default for input_absinfo {
51    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
52}
53#[repr(C)]
54#[derive(Copy, Clone)]
55#[derive(Debug)]
56pub struct input_keymap_entry {
57    pub flags: __u8,
58    pub len: __u8,
59    pub index: __u16,
60    pub keycode: __u32,
61    pub scancode: [__u8; 32usize],
62}
63impl ::std::default::Default for input_keymap_entry {
64    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
65}
66#[repr(C)]
67#[derive(Copy, Clone)]
68#[derive(Debug)]
69pub struct input_mask {
70    pub type_: __u32,
71    pub codes_size: __u32,
72    pub codes_ptr: __u64,
73}
74impl ::std::default::Default for input_mask {
75    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
76}
77#[repr(C)]
78#[derive(Copy, Clone)]
79#[derive(Debug)]
80pub struct ff_replay {
81    pub length: __u16,
82    pub delay: __u16,
83}
84impl ::std::default::Default for ff_replay {
85    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
86}
87#[repr(C)]
88#[derive(Copy, Clone)]
89#[derive(Debug)]
90pub struct ff_trigger {
91    pub button: __u16,
92    pub interval: __u16,
93}
94impl ::std::default::Default for ff_trigger {
95    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
96}
97#[repr(C)]
98#[derive(Copy, Clone)]
99#[derive(Debug)]
100pub struct ff_envelope {
101    pub attack_length: __u16,
102    pub attack_level: __u16,
103    pub fade_length: __u16,
104    pub fade_level: __u16,
105}
106impl ::std::default::Default for ff_envelope {
107    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
108}
109#[repr(C)]
110#[derive(Copy, Clone)]
111#[derive(Debug)]
112pub struct ff_constant_effect {
113    pub level: __s16,
114    pub envelope: ff_envelope,
115}
116impl ::std::default::Default for ff_constant_effect {
117    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
118}
119#[repr(C)]
120#[derive(Copy, Clone)]
121#[derive(Debug)]
122pub struct ff_ramp_effect {
123    pub start_level: __s16,
124    pub end_level: __s16,
125    pub envelope: ff_envelope,
126}
127impl ::std::default::Default for ff_ramp_effect {
128    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
129}
130#[repr(C)]
131#[derive(Copy, Clone)]
132#[derive(Debug)]
133pub struct ff_condition_effect {
134    pub right_saturation: __u16,
135    pub left_saturation: __u16,
136    pub right_coeff: __s16,
137    pub left_coeff: __s16,
138    pub deadband: __u16,
139    pub center: __s16,
140}
141impl ::std::default::Default for ff_condition_effect {
142    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
143}
144#[repr(C)]
145#[derive(Copy, Clone)]
146#[derive(Debug)]
147pub struct ff_periodic_effect {
148    pub waveform: __u16,
149    pub period: __u16,
150    pub magnitude: __s16,
151    pub offset: __s16,
152    pub phase: __u16,
153    pub envelope: ff_envelope,
154    pub custom_len: __u32,
155    pub custom_data: *mut __s16,
156}
157impl ::std::default::Default for ff_periodic_effect {
158    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
159}
160#[repr(C)]
161#[derive(Copy, Clone)]
162#[derive(Debug)]
163pub struct ff_rumble_effect {
164    pub strong_magnitude: __u16,
165    pub weak_magnitude: __u16,
166}
167impl ::std::default::Default for ff_rumble_effect {
168    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
169}
170#[repr(C)]
171#[derive(Copy, Clone)]
172#[derive(Debug)]
173pub struct ff_effect {
174    pub type_: __u16,
175    pub id: __s16,
176    pub direction: __u16,
177    pub trigger: ff_trigger,
178    pub replay: ff_replay,
179    pub u: ff_effect_union,
180}
181impl ::std::default::Default for ff_effect {
182    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
183}
184#[repr(C)]
185#[derive(Copy, Clone)]
186#[derive(Debug)]
187pub struct ff_effect_union {
188    pub _bindgen_data_: [u64; 4usize],
189}
190impl ff_effect_union {
191    pub unsafe fn constant(&mut self) -> *mut ff_constant_effect {
192        let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
193        ::std::mem::transmute(raw.offset(0))
194    }
195    pub unsafe fn ramp(&mut self) -> *mut ff_ramp_effect {
196        let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
197        ::std::mem::transmute(raw.offset(0))
198    }
199    pub unsafe fn periodic(&mut self) -> *mut ff_periodic_effect {
200        let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
201        ::std::mem::transmute(raw.offset(0))
202    }
203    pub unsafe fn condition(&mut self) -> *mut [ff_condition_effect; 2usize] {
204        let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
205        ::std::mem::transmute(raw.offset(0))
206    }
207    pub unsafe fn rumble(&mut self) -> *mut ff_rumble_effect {
208        let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
209        ::std::mem::transmute(raw.offset(0))
210    }
211}
212impl ::std::default::Default for ff_effect_union {
213    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
214}