Skip to content

Commit

Permalink
Add Android uinput bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
spencercw committed Nov 7, 2022
1 parent a90993e commit 6dbe488
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libc-test/build.rs
Expand Up @@ -1627,6 +1627,7 @@ fn test_android(target: &str) {
"linux/seccomp.h",
"linux/sched.h",
"linux/sockios.h",
"linux/uinput.h",
"linux/vm_sockets.h",
"linux/wait.h",

Expand Down Expand Up @@ -1663,6 +1664,17 @@ fn test_android(target: &str) {
s if s.ends_with("_nsec") && struct_.starts_with("stat") => s.to_string(),
// FIXME: appears that `epoll_event.data` is an union
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
// The following structs have a field called `type` in C,
// but `type` is a Rust keyword, so these fields are translated
// to `type_` in Rust.
"type_"
if struct_ == "input_event"
|| struct_ == "input_mask"
|| struct_ == "ff_effect" =>
{
"type".to_string()
}

s => s.to_string(),
}
});
Expand Down Expand Up @@ -1792,6 +1804,8 @@ fn test_android(target: &str) {
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
// sigval is actually a union, but we pretend it's a struct
(struct_ == "sigevent" && field == "sigev_value") ||
// this one is an anonymous union
(struct_ == "ff_effect" && field == "u") ||
// FIXME: `sa_sigaction` has type `sighandler_t` but that type is
// incorrect, see: https://github.com/rust-lang/libc/issues/1359
(struct_ == "sigaction" && field == "sa_sigaction") ||
Expand Down
45 changes: 45 additions & 0 deletions libc-test/semver/android.txt
@@ -1,3 +1,5 @@
ABS_CNT
ABS_MAX
ADDR_COMPAT_LAYOUT
ADDR_LIMIT_32BIT
ADDR_LIMIT_3GB
Expand Down Expand Up @@ -568,6 +570,8 @@ ETXTBSY
EUCLEAN
EUNATCH
EUSERS
EV_CNT
EV_MAX
EWOULDBLOCK
EXDEV
EXFULL
Expand Down Expand Up @@ -595,6 +599,8 @@ FD_ZERO
FF0
FF1
FFDLY
FF_CNT
FF_MAX
FILE
FILENAME_MAX
FIOCLEX
Expand Down Expand Up @@ -786,6 +792,8 @@ INADDR_LOOPBACK
INADDR_NONE
INLCR
INPCK
INPUT_PROP_CNT
INPUT_PROP_MAX
INT_MAX
INT_MIN
IN_ACCESS
Expand Down Expand Up @@ -1020,6 +1028,8 @@ IXANY
IXOFF
IXON
JFFS2_SUPER_MAGIC
KEY_CNT
KEY_MAX
LC_ADDRESS
LC_ADDRESS_MASK
LC_ALL
Expand All @@ -1046,6 +1056,8 @@ LC_TELEPHONE
LC_TELEPHONE_MASK
LC_TIME
LC_TIME_MASK
LED_CNT
LED_MAX
LINUX_REBOOT_CMD_CAD_OFF
LINUX_REBOOT_CMD_CAD_ON
LINUX_REBOOT_CMD_HALT
Expand Down Expand Up @@ -1170,6 +1182,8 @@ MPOL_F_STATIC_NODES
MPOL_INTERLEAVE
MPOL_LOCAL
MPOL_PREFERRED
MSC_CNT
MSC_MAX
MSDOS_SUPER_MAGIC
MSG_CMSG_CLOEXEC
MSG_CONFIRM
Expand Down Expand Up @@ -1860,9 +1874,13 @@ REG_PEND
REG_STARTEND
REG_TRACE
REISERFS_SUPER_MAGIC
REL_CNT
REL_MAX
RENAME_EXCHANGE
RENAME_NOREPLACE
RENAME_WHITEOUT
REP_CNT
REP_MAX
RLIMIT_AS
RLIMIT_CORE
RLIMIT_CPU
Expand Down Expand Up @@ -2131,6 +2149,8 @@ SIOCSIFSLAVE
SIOCSRARP
SI_LOAD_SHIFT
SMB_SUPER_MAGIC
SND_CNT
SND_MAX
SOCK_CLOEXEC
SOCK_DCCP
SOCK_DGRAM
Expand Down Expand Up @@ -2227,6 +2247,10 @@ ST_NOSUID
ST_RDONLY
ST_RELATIME
ST_SYNCHRONOUS
SW_CNT
SW_MAX
SYN_CNT
SYN_MAX
SYS_accept4
SYS_acct
SYS_add_key
Expand Down Expand Up @@ -2579,6 +2603,8 @@ TIOCSWINSZ
TMPFS_MAGIC
TMP_MAX
TOSTOP
UINPUT_MAX_NAME_SIZE
UINPUT_VERSION
UIO_MAXIOV
USBDEVICE_SUPER_MAGIC
USER_PROCESS
Expand Down Expand Up @@ -2923,6 +2949,15 @@ feof
ferror
fexecve
fflush
ff_condition_effect
ff_constant_effect
ff_effect
ff_envelope
ff_periodic_effect
ff_ramp_effect
ff_replay
ff_rumble_effect
ff_trigger
fgetc
fgetpos
fgets
Expand Down Expand Up @@ -3045,6 +3080,11 @@ inotify_event
inotify_init
inotify_init1
inotify_rm_watch
input_absinfo
input_event
input_id
input_keymap_entry
input_mask
int16_t
int32_t
int64_t
Expand Down Expand Up @@ -3509,6 +3549,11 @@ ttyname_r
ucontext_t
ucred
uid_t
uinput_abs_setup
uinput_ff_erase
uinput_ff_upload
uinput_setup
uinput_user_dev
uint16_t
uint32_t
uint64_t
Expand Down

0 comments on commit 6dbe488

Please sign in to comment.