Implement basic keyboard input
It doesn't support some key combination, but basically works.
It might be an interim solution for a while until evdev is avilable.
And also refactored the code about sending evts to the socket
Bug: 325930433
Bug: 331191129
Test: connect keyboard
Change-Id: I4fb0f62fd705b52b6557737a70575f9769f864e0
diff --git a/virtualizationmanager/src/crosvm.rs b/virtualizationmanager/src/crosvm.rs
index 4be48a5..d5b9e03 100644
--- a/virtualizationmanager/src/crosvm.rs
+++ b/virtualizationmanager/src/crosvm.rs
@@ -161,6 +161,7 @@
pub enum InputDeviceOption {
EvDev(File),
SingleTouch { file: File, width: u32, height: u32, name: Option<String> },
+ Keyboard(File),
}
type VfioDevice = Strong<dyn IBoundDevice>;
@@ -982,6 +983,9 @@
InputDeviceOption::EvDev(file) => {
format!("evdev[path={}]", add_preserved_fd(&mut preserved_fds, file))
}
+ InputDeviceOption::Keyboard(file) => {
+ format!("keyboard[path={}]", add_preserved_fd(&mut preserved_fds, file))
+ }
InputDeviceOption::SingleTouch { file, width, height, name } => format!(
"single-touch[path={},width={},height={}{}]",
add_preserved_fd(&mut preserved_fds, file),