mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
devices: input: fix ioctl handling
- EVIOCGABS returns zero on success * https://github.com/torvalds/linux/blob/master/drivers/input/evdev.c#L1204 - Rename ret to map BUG=b:213929977 TEST=run Cuttlefish Change-Id: I25a07e5449163a340cc220a7d885966d71b83edc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3475441 Reviewed-by: Jorge Moreira Broche <jemoreira@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Noah Gold <nkgold@google.com> Reviewed-by: Michael Hoyle <mikehoyle@google.com> Reviewed-by: Dennis Kempin <denniskempin@google.com> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
18c6548614
commit
f49acedb83
1 changed files with 5 additions and 5 deletions
|
@ -234,12 +234,12 @@ pub fn supported_events<T: AsRawDescriptor>(
|
||||||
|
|
||||||
/// Gets the absolute axes of an event device (see EVIOCGABS ioctl for details).
|
/// Gets the absolute axes of an event device (see EVIOCGABS ioctl for details).
|
||||||
pub fn abs_info<T: AsRawDescriptor>(descriptor: &T) -> BTreeMap<u16, virtio_input_absinfo> {
|
pub fn abs_info<T: AsRawDescriptor>(descriptor: &T) -> BTreeMap<u16, virtio_input_absinfo> {
|
||||||
let mut ret: BTreeMap<u16, virtio_input_absinfo> = BTreeMap::new();
|
let mut map: BTreeMap<u16, virtio_input_absinfo> = BTreeMap::new();
|
||||||
|
|
||||||
for abs in 0..ABS_MAX {
|
for abs in 0..ABS_MAX {
|
||||||
// Create a new one, zero-ed out every time to avoid carry-overs.
|
// Create a new one, zero-ed out every time to avoid carry-overs.
|
||||||
let mut abs_info = evdev_abs_info::new();
|
let mut abs_info = evdev_abs_info::new();
|
||||||
let len = unsafe {
|
let ret = unsafe {
|
||||||
// Safe because the kernel won't write more than size of evdev_buffer and we check the
|
// Safe because the kernel won't write more than size of evdev_buffer and we check the
|
||||||
// return value
|
// return value
|
||||||
ioctl_with_mut_ref(
|
ioctl_with_mut_ref(
|
||||||
|
@ -248,11 +248,11 @@ pub fn abs_info<T: AsRawDescriptor>(descriptor: &T) -> BTreeMap<u16, virtio_inpu
|
||||||
&mut abs_info,
|
&mut abs_info,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
if len > 0 {
|
if ret == 0 {
|
||||||
ret.insert(abs, virtio_input_absinfo::from(abs_info));
|
map.insert(abs, virtio_input_absinfo::from(abs_info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Grabs an event device (see EVIOCGGRAB ioctl for details). After this function succeeds the given
|
/// Grabs an event device (see EVIOCGGRAB ioctl for details). After this function succeeds the given
|
||||||
|
|
Loading…
Reference in a new issue