Skip to content

Commit e45454f

Browse files
committed
Add structs from linux/uinput.h + a couple of input-related constants
1 parent 32457dd commit e45454f

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,6 +2426,7 @@ fn test_linux(target: &str) {
24262426
"linux/rtnetlink.h",
24272427
"linux/seccomp.h",
24282428
"linux/sockios.h",
2429+
"linux/uinput.h",
24292430
"linux/vm_sockets.h",
24302431
"linux/wait.h",
24312432
"sys/fanotify.h",

src/unix/linux_like/linux/mod.rs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,40 @@ s! {
284284
pub u: [u32; 7],
285285
}
286286

287+
pub struct uinput_ff_upload {
288+
pub request_id: ::__u32,
289+
pub retval: ::__s32,
290+
pub effect: ff_effect,
291+
pub old: ff_effect,
292+
}
293+
294+
pub struct uinput_ff_erase {
295+
pub request_id: ::__u32,
296+
pub retval: ::__s32,
297+
pub effect_id: ::__u32,
298+
}
299+
300+
pub struct uinput_setup {
301+
pub id: input_id,
302+
pub name: [::c_char; UINPUT_MAX_NAME_SIZE],
303+
pub ff_effects_max: ::__u32,
304+
}
305+
306+
pub struct uinput_abs_setup {
307+
pub code: ::__u16,
308+
pub absinfo: input_absinfo,
309+
}
310+
311+
pub struct uinput_user_dev {
312+
pub name: [::c_char; UINPUT_MAX_NAME_SIZE],
313+
pub id: input_id,
314+
pub ff_effects_max: ::__u32,
315+
pub absmax: [::__s32; ABS_CNT],
316+
pub absmin: [::__s32; ABS_CNT],
317+
pub absfuzz: [::__s32; ABS_CNT],
318+
pub absflat: [::__s32; ABS_CNT],
319+
}
320+
287321
pub struct dl_phdr_info {
288322
#[cfg(target_pointer_width = "64")]
289323
pub dlpi_addr: Elf64_Addr,
@@ -2471,6 +2505,38 @@ pub const IN_ALL_EVENTS: u32 = IN_ACCESS
24712505
pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
24722506
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;
24732507

2508+
// linux/input.h
2509+
pub const FF_MAX: ::__u16 = 0x7f;
2510+
pub const FF_CNT: usize = FF_MAX as usize + 1;
2511+
2512+
// linux/input-event-codes.h
2513+
pub const INPUT_PROP_MAX: ::__u16 = 0x1f;
2514+
pub const INPUT_PROP_CNT: usize = INPUT_PROP_MAX as usize + 1;
2515+
pub const EV_MAX: ::__u16 = 0x1f;
2516+
pub const EV_CNT: usize = EV_MAX as usize + 1;
2517+
pub const SYN_MAX: ::__u16 = 0xf;
2518+
pub const SYN_CNT: usize = SYN_MAX as usize + 1;
2519+
pub const KEY_MAX: ::__u16 = 0x2ff;
2520+
pub const KEY_CNT: usize = KEY_MAX as usize + 1;
2521+
pub const REL_MAX: ::__u16 = 0x0f;
2522+
pub const REL_CNT: usize = REL_MAX as usize + 1;
2523+
pub const ABS_MAX: ::__u16 = 0x3f;
2524+
pub const ABS_CNT: usize = ABS_MAX as usize + 1;
2525+
pub const SW_MAX: ::__u16 = 0x10;
2526+
pub const SW_CNT: usize = SW_MAX as usize + 1;
2527+
pub const MSC_MAX: ::__u16 = 0x07;
2528+
pub const MSC_CNT: usize = MSC_MAX as usize + 1;
2529+
pub const LED_MAX: ::__u16 = 0x0f;
2530+
pub const LED_CNT: usize = LED_MAX as usize + 1;
2531+
pub const REP_MAX: ::__u16 = 0x01;
2532+
pub const REP_CNT: usize = REP_MAX as usize + 1;
2533+
pub const SND_MAX: ::__u16 = 0x07;
2534+
pub const SND_CNT: usize = SND_MAX as usize + 1;
2535+
2536+
// linux/uinput.h
2537+
pub const UINPUT_VERSION: ::c_uint = 5;
2538+
pub const UINPUT_MAX_NAME_SIZE: usize = 80;
2539+
24742540
// uapi/linux/fanotify.h
24752541
pub const FAN_ACCESS: u64 = 0x0000_0001;
24762542
pub const FAN_MODIFY: u64 = 0x0000_0002;

0 commit comments

Comments
 (0)