summary refs log tree commit diff
path: root/devices/src/virtio/input/mod.rs
diff options
context:
space:
mode:
authorJorge E. Moreira <jemoreira@google.com>2019-03-07 10:59:54 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-09 01:18:59 -0800
commit99d3f08dc5d4ad63d8596c349f9d207144e2c949 (patch)
treec3f2b3a7236d51b2ae1de66a8bcfbd37c028c0e4 /devices/src/virtio/input/mod.rs
parente5828e7ecdb1b92645161e0b0b66e7645da92447 (diff)
downloadcrosvm-99d3f08dc5d4ad63d8596c349f9d207144e2c949.tar
crosvm-99d3f08dc5d4ad63d8596c349f9d207144e2c949.tar.gz
crosvm-99d3f08dc5d4ad63d8596c349f9d207144e2c949.tar.bz2
crosvm-99d3f08dc5d4ad63d8596c349f9d207144e2c949.tar.lz
crosvm-99d3f08dc5d4ad63d8596c349f9d207144e2c949.tar.xz
crosvm-99d3f08dc5d4ad63d8596c349f9d207144e2c949.tar.zst
crosvm-99d3f08dc5d4ad63d8596c349f9d207144e2c949.zip
Add a (single touch only) touch screen input device
Very similar to the trackpad device, it has the INPUT_PROP_DIRECT
property and does not support any buttons, just touch events.

Change-Id: I2c963013e402ff2aa1b4b529c6c494dd57f4add9
Reviewed-on: https://chromium-review.googlesource.com/1509697
Commit-Ready: Jorge Moreira Broche <jemoreira@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'devices/src/virtio/input/mod.rs')
-rw-r--r--devices/src/virtio/input/mod.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/devices/src/virtio/input/mod.rs b/devices/src/virtio/input/mod.rs
index 22ef168..98dac60 100644
--- a/devices/src/virtio/input/mod.rs
+++ b/devices/src/virtio/input/mod.rs
@@ -687,6 +687,22 @@ where
     })
 }
 
+/// Creates a new virtio touch device which supports single touch only.
+pub fn new_single_touch<T>(
+    source: T,
+    width: u32,
+    height: u32,
+) -> Result<Input<SocketEventSource<T>>>
+where
+    T: Read + Write + AsRawFd,
+{
+    Ok(Input {
+        kill_evt: None,
+        config: defaults::new_single_touch_config(width, height),
+        source: Some(SocketEventSource::new(source)),
+    })
+}
+
 /// Creates a new virtio trackpad device which supports (single) touch, primary and secondary
 /// buttons as well as X and Y axis.
 pub fn new_trackpad<T>(source: T, width: u32, height: u32) -> Result<Input<SocketEventSource<T>>>