Skip to content

Commit 6dbe488

Browse files
committed
Add Android uinput bindings
1 parent a90993e commit 6dbe488

File tree

3 files changed

+300
-0
lines changed

3 files changed

+300
-0
lines changed

libc-test/build.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,7 @@ fn test_android(target: &str) {
16271627
"linux/seccomp.h",
16281628
"linux/sched.h",
16291629
"linux/sockios.h",
1630+
"linux/uinput.h",
16301631
"linux/vm_sockets.h",
16311632
"linux/wait.h",
16321633

@@ -1663,6 +1664,17 @@ fn test_android(target: &str) {
16631664
s if s.ends_with("_nsec") && struct_.starts_with("stat") => s.to_string(),
16641665
// FIXME: appears that `epoll_event.data` is an union
16651666
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
1667+
// The following structs have a field called `type` in C,
1668+
// but `type` is a Rust keyword, so these fields are translated
1669+
// to `type_` in Rust.
1670+
"type_"
1671+
if struct_ == "input_event"
1672+
|| struct_ == "input_mask"
1673+
|| struct_ == "ff_effect" =>
1674+
{
1675+
"type".to_string()
1676+
}
1677+
16661678
s => s.to_string(),
16671679
}
16681680
});
@@ -1792,6 +1804,8 @@ fn test_android(target: &str) {
17921804
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
17931805
// sigval is actually a union, but we pretend it's a struct
17941806
(struct_ == "sigevent" && field == "sigev_value") ||
1807+
// this one is an anonymous union
1808+
(struct_ == "ff_effect" && field == "u") ||
17951809
// FIXME: `sa_sigaction` has type `sighandler_t` but that type is
17961810
// incorrect, see: https://github.com/rust-lang/libc/issues/1359
17971811
(struct_ == "sigaction" && field == "sa_sigaction") ||

libc-test/semver/android.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
ABS_CNT
2+
ABS_MAX
13
ADDR_COMPAT_LAYOUT
24
ADDR_LIMIT_32BIT
35
ADDR_LIMIT_3GB
@@ -568,6 +570,8 @@ ETXTBSY
568570
EUCLEAN
569571
EUNATCH
570572
EUSERS
573+
EV_CNT
574+
EV_MAX
571575
EWOULDBLOCK
572576
EXDEV
573577
EXFULL
@@ -595,6 +599,8 @@ FD_ZERO
595599
FF0
596600
FF1
597601
FFDLY
602+
FF_CNT
603+
FF_MAX
598604
FILE
599605
FILENAME_MAX
600606
FIOCLEX
@@ -786,6 +792,8 @@ INADDR_LOOPBACK
786792
INADDR_NONE
787793
INLCR
788794
INPCK
795+
INPUT_PROP_CNT
796+
INPUT_PROP_MAX
789797
INT_MAX
790798
INT_MIN
791799
IN_ACCESS
@@ -1020,6 +1028,8 @@ IXANY
10201028
IXOFF
10211029
IXON
10221030
JFFS2_SUPER_MAGIC
1031+
KEY_CNT
1032+
KEY_MAX
10231033
LC_ADDRESS
10241034
LC_ADDRESS_MASK
10251035
LC_ALL
@@ -1046,6 +1056,8 @@ LC_TELEPHONE
10461056
LC_TELEPHONE_MASK
10471057
LC_TIME
10481058
LC_TIME_MASK
1059+
LED_CNT
1060+
LED_MAX
10491061
LINUX_REBOOT_CMD_CAD_OFF
10501062
LINUX_REBOOT_CMD_CAD_ON
10511063
LINUX_REBOOT_CMD_HALT
@@ -1170,6 +1182,8 @@ MPOL_F_STATIC_NODES
11701182
MPOL_INTERLEAVE
11711183
MPOL_LOCAL
11721184
MPOL_PREFERRED
1185+
MSC_CNT
1186+
MSC_MAX
11731187
MSDOS_SUPER_MAGIC
11741188
MSG_CMSG_CLOEXEC
11751189
MSG_CONFIRM
@@ -1860,9 +1874,13 @@ REG_PEND
18601874
REG_STARTEND
18611875
REG_TRACE
18621876
REISERFS_SUPER_MAGIC
1877+
REL_CNT
1878+
REL_MAX
18631879
RENAME_EXCHANGE
18641880
RENAME_NOREPLACE
18651881
RENAME_WHITEOUT
1882+
REP_CNT
1883+
REP_MAX
18661884
RLIMIT_AS
18671885
RLIMIT_CORE
18681886
RLIMIT_CPU
@@ -2131,6 +2149,8 @@ SIOCSIFSLAVE
21312149
SIOCSRARP
21322150
SI_LOAD_SHIFT
21332151
SMB_SUPER_MAGIC
2152+
SND_CNT
2153+
SND_MAX
21342154
SOCK_CLOEXEC
21352155
SOCK_DCCP
21362156
SOCK_DGRAM
@@ -2227,6 +2247,10 @@ ST_NOSUID
22272247
ST_RDONLY
22282248
ST_RELATIME
22292249
ST_SYNCHRONOUS
2250+
SW_CNT
2251+
SW_MAX
2252+
SYN_CNT
2253+
SYN_MAX
22302254
SYS_accept4
22312255
SYS_acct
22322256
SYS_add_key
@@ -2579,6 +2603,8 @@ TIOCSWINSZ
25792603
TMPFS_MAGIC
25802604
TMP_MAX
25812605
TOSTOP
2606+
UINPUT_MAX_NAME_SIZE
2607+
UINPUT_VERSION
25822608
UIO_MAXIOV
25832609
USBDEVICE_SUPER_MAGIC
25842610
USER_PROCESS
@@ -2923,6 +2949,15 @@ feof
29232949
ferror
29242950
fexecve
29252951
fflush
2952+
ff_condition_effect
2953+
ff_constant_effect
2954+
ff_effect
2955+
ff_envelope
2956+
ff_periodic_effect
2957+
ff_ramp_effect
2958+
ff_replay
2959+
ff_rumble_effect
2960+
ff_trigger
29262961
fgetc
29272962
fgetpos
29282963
fgets
@@ -3045,6 +3080,11 @@ inotify_event
30453080
inotify_init
30463081
inotify_init1
30473082
inotify_rm_watch
3083+
input_absinfo
3084+
input_event
3085+
input_id
3086+
input_keymap_entry
3087+
input_mask
30483088
int16_t
30493089
int32_t
30503090
int64_t
@@ -3509,6 +3549,11 @@ ttyname_r
35093549
ucontext_t
35103550
ucred
35113551
uid_t
3552+
uinput_abs_setup
3553+
uinput_ff_erase
3554+
uinput_ff_upload
3555+
uinput_setup
3556+
uinput_user_dev
35123557
uint16_t
35133558
uint32_t
35143559
uint64_t

0 commit comments

Comments
 (0)