This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 47ddca21973 drivers/virtio/virtio-input: Report every key of an update.
47ddca21973 is described below

commit 47ddca219733ad9620552e2561d1a305742658ea
Author: raiden00pl <[email protected]>
AuthorDate: Thu Nov 19 13:05:29 2026 +0100

    drivers/virtio/virtio-input: Report every key of an update.
    
    The keyboard handler kept one key per update and reported it at
    SYN_REPORT, so when one update changed several keys only the last one
    was reported. Report each EV_KEY event at once.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 drivers/virtio/virtio-input.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/virtio/virtio-input.c b/drivers/virtio/virtio-input.c
index c611b2f612d..d2e678fc8c3 100644
--- a/drivers/virtio/virtio-input.c
+++ b/drivers/virtio/virtio-input.c
@@ -77,7 +77,6 @@ struct virtio_input_priv
   union
   {
     struct mouse_report_s       mousesample;    /* Mouse event */
-    struct keyboard_event_s     keyboardsample; /* Keyboard event */
     struct touch_sample_s       touchsample;    /* Touchpad event */
   };
 };
@@ -133,16 +132,11 @@ virtio_input_send_keyboard_event(FAR struct 
virtio_input_priv *priv,
       uint32_t trans_key;
       bool is_special;
 
+      /* Report each key at once: one update can change several keys */
+
       trans_key = keyboard_translate_virtio_code(event->code, &is_special);
-      priv->keyboardsample.code = trans_key;
-      priv->keyboardsample.type = types[is_special][event->value & 1];
-    }
-  else if (event->type == EV_SYN && event->code == SYN_REPORT)
-    {
-      keyboard_event(&(priv->keyboardlower),
-                     priv->keyboardsample.code,
-                     priv->keyboardsample.type);
-      memset(&priv->keyboardsample, 0, sizeof(priv->keyboardsample));
+      keyboard_event(&(priv->keyboardlower), trans_key,
+                     types[is_special][event->value & 1]);
     }
 }
 

Reply via email to