Commit graph

18 commits

Author SHA1 Message Date
Nick Kralevich
38e9f2320a getevent: O_RDWR -> O_RDONLY | O_CLOEXEC
No need to open the device read write. Just open it read-only.

This is a partial redo of
https://android-review.googlesource.com/c/platform/system/core/+/334583
which was reverted in
https://android-review.googlesource.com/c/platform/system/core/+/342483

Bug: 30861057
Test: ran getevent, saw correct output, played with device
Change-Id: I426efd68f39dcd97d3ee23c13ed1a9ed96cb4c2e
2018-08-24 12:16:17 -07:00
Michael Wright
14667c19cd Revert "Only allow system to write to existing input nodes."
This reverts commit 344e929e6d.

Bug: 35301292
Change-Id: Ib6805c986c0aa88d14652de59ad4602b1cce8b56
2017-02-21 17:12:59 +00:00
Michael Wright
344e929e6d Only allow system to write to existing input nodes.
This prevents the shell user from injecting input as if it were coming
from an existing input device, which in turn makes it easier for malware
/ abuse analysis to detect when someone is injecting input via the
command line vs a real user using a device.

(cherrypick of 95637eb2a332b9a09914b1bf32c10fccfba4a175.)

Bug: 30861057
Test: ran getevent, saw correct output, played with device
Change-Id: Ib53eea1b7767f25510b5d36fe6109101a9fad8e0
2017-02-09 14:45:25 -08:00
Ting-Yuan Huang
1c2f612c18 toolbox: exit when failed to allocate buffer for ioctl
This is a "shouldn't happen" case.

Test: make WITH_TIDY=1 mmma system/core/toolbox
Change-Id: I51e44e17837b03d6df6f8c4c3e1aeab8253e094d
2016-11-22 15:33:34 -08:00
Elliott Hughes
c7f3c5c10c Auto-generate the getevent labels from <linux/input.h>.
Now we only have to remember to update the kernel uapi headers, which
we're pretty good at.

Change-Id: If04eb8c50882fff5e5e2a5d72664f5d4c4c538b1
2015-03-25 17:34:22 -07:00
Elliott Hughes
0badbd6565 Fix missing #includes in system/core.
Change-Id: I4736e8c4f7bb8bb03640d26d58243efaa67dc75c
2014-12-29 12:24:25 -08:00
Sasha Levitskiy
140b13546a Getevent: make sure the monotonic timestamp is displayed; warning cleanup.
Change-Id: I6c500ab55470155ddf692fe5f655bdd575f195f5
Signed-off-by: Sasha Levitskiy <sanek@google.com>
2014-06-11 11:10:28 -07:00
Mark Salyzyn
aa907768af toolbox: turn on -Werror
- Deal with some signedness issues
- Deal with some size issues
- Deal with NULL pointer issues
- Deal with some -Wunused issues

Change-Id: I1479dd90d690084491bae3475f2c547833519a57
2014-05-14 12:41:24 -07:00
Elliott Hughes
ccecf14254 system/core 64-bit cleanup.
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.

Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
2014-01-16 12:54:18 -08:00
Jeff Brown
e4e21796f7 Make timestamps friendlier.
Change-Id: I378c3028630a7f805c3f730da02bbbfe07ec3654
2011-11-23 15:02:41 -08:00
Jeff Brown
9de370e165 Show the resolution of each axis.
Change-Id: I81c4b7e6480b98e59fb389060ab2c8d34257ae5f
2011-08-16 17:19:30 -07:00
Jeff Brown
4ac87154c1 Dump the HID descriptor when available.
Also, always print the input properties when -p is
specified.

Change-Id: Ibacb6dd26ccab68c85b76928df60fdc2a53c198c
2011-07-24 14:30:44 -07:00
Jeff Brown
f6d0f8af17 getevent: Fix a couple of bugs.
Fixed a bug printing the event value when using labels.

Stop trying to print the available codes for EV_SYN because
we cannot actually query them.  EVIOCGBIT(0, size) is a special
case that returns the set of events that are supported, and
EV_SYN == 0.

Change-Id: Iea086ba24300ca0815e4814a3bc5ff60756612c2
2011-06-29 20:52:08 -07:00
Jeff Brown
f8754337d8 Enhance getevent to print event labels.
Added -l argument to print labels for event types, codes and values.
Added -i argument to print all device info.
Added support for printing input properties.

Change-Id: I3cacb716dbc38f50217b9dfc24ba44d08f352603
2011-06-15 17:44:52 -07:00
Dianne Hackborn
477b430700 Improvements to get events: -p, better output.
Add new -p option to easily get the output showing which events are reported by the devices.

Improve the reported events output a bit by including a name for each event type.

Extend help text to include a description of each options, so I don't have to look in the source code next time. :)
2009-04-08 15:43:31 -07:00
The Android Open Source Project
dd7bc3319d auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
The Android Open Source Project
e54eebbf1a auto import from //depot/cupcake/@135843 2009-03-03 18:29:04 -08:00
The Android Open Source Project
4f6e8d7a00 Initial Contribution 2008-10-21 07:00:00 -07:00