@samitouri / QOSamiQemu / commits / 926fc22ed7

hw/display/xenfb: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those codes directly instead of translating between internal key code representations. Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260520-input-v3-10-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

Akihiko Odaki committed May 20, 2026 at 15:47 UTC 926fc22ed793332bada8e5d10a8e0cf539c044c8
1 file changed +3 -18
hw/display/xenfb.c
+3 -18
@@ -191,29 +191,14 @@ static int xenfb_send_position(struct XenInput *xenfb,
191 return xenfb_kbd_event(xenfb, &event);
192 }
193
194 -/*
195 - * Send a key event from the client to the guest OS
196 - * QEMU gives us a QCode.
197 - * We have to turn this into a Linux Input layer keycode.
198 - *
199 - * Wish we could just send scancodes straight to the guest which
200 - * already has code for dealing with this...
201 - */
194 +/* Send a key event from the client to the guest OS */
195 static void xenfb_key_event(DeviceState *dev, QemuConsole *src,
196 QemuInputEvent *evt)
197 {
198 struct XenInput *xenfb = (struct XenInput *)dev;
206 - int qcode = qemu_input_linux_to_qcode(evt->key.key);
207 - int lnx;
199
209 - if (qcode < qemu_input_map_qcode_to_linux_len) {
210 - lnx = qemu_input_map_qcode_to_linux[qcode];
211 -
212 - if (lnx) {
213 - trace_xenfb_key_event(xenfb, lnx, evt->key.down);
214 - xenfb_send_key(xenfb, evt->key.down, lnx);
215 - }
216 - }
200 + trace_xenfb_key_event(xenfb, evt->key.key, evt->key.down);
201 + xenfb_send_key(xenfb, evt->key.down, evt->key.key);
202 }
203
204 /*