qemu/hw
Peter Korsgaard 86f3bf0ebe hw/input/hid: support alternative sysrq/break scancodes for gtk-vnc
The printscreen/sysrq and pause/break keys currently don't work for guests
using -usbdevice keyboard when accessed through vnc with a gtk-vnc based
client.

The reason for this is a mismatch between gtk-vnc and qemu in how these keys
should be mapped to XT keycodes.

On the original IBM XT these keys behaved differently than other keys.

Quoting from https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html:

The keys PrtSc/SysRq and Pause/Break are special. The former produces
scancode e0 2a e0 37 when no modifier key is pressed simultaneously, e0 37
together with Shift or Ctrl, but 54 together with (left or right) Alt.  (And
one gets the expected sequences upon release.  But see below.) The latter
produces scancode sequence e1 1d 45 e1 9d c5 when pressed (without modifier)
and nothing at all upon release.  However, together with (left or right)
Ctrl, one gets e0 46 e0 c6, and again nothing at release.  It does not
repeat.

Gtk-vnc supports the 'QEMU Extended Key Event Message' RFB extension to send
raw XT keycodes directly to qemu, but the specification doesn't explicitly
specify how to map such long/complicated keycode sequences.  From the spec
(https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#qemu-extended-key-event-message)

The keycode is the XT keycode that produced the keysym. An XT keycode is an
XT make scancode sequence encoded to fit in a single U32 quantity.  Single
byte XT scancodes with a byte value less than 0x7f are encoded as is.
2-byte XT scancodes whose first byte is 0xe0 and second byte is less than
0x7f are encoded with the high bit of the first byte set

hid.c currently expects the keycode sequence with shift/ctl for sysrq (e0 37
-> 0xb7 in RFB), whereas gtk-vnc uses the sequence with alt (0x54).
Likewise, hid.c expects the code without modifiers (e1 1d 45 -> 0xc5 in
RFB), whereas gtk-vnc sends the keycode sequence with ctrl for pause (e0 46
-> 0xc6 in RFB).

See keymaps.cvs in gtk-vnc for the mapping used:
https://git.gnome.org/browse/gtk-vnc/tree/src/keymaps.csv#n150

Now, it isn't obvious to me which sequence is really "right", but as the
0x54/0xc6 keycodes are currently unused in hid.c, supporting both seems like
the pragmatic solution to me.  The USB HID keyboard boot protocol used by
hid.c doesn't have any other mapping applicable to these keys.

The other guest keyboard interfaces (ps/2, virtio, ..) are not affected,
because they handle these keys differently.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Message-id: 20161028145132.1702-1-peter@korsgaard.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-10 15:29:58 +00:00
..
9pfs 9pfs: drop excessive error message from virtfs_reset() 2016-11-01 12:03:03 +01:00
acpi acpi: fix assert failure caused by commit 35c5a52d 2016-11-01 19:21:09 +02:00
adc STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00
alpha sun4uv: fix serial initialization regression 2016-10-24 15:27:20 +02:00
arm hw/arm/tosa: Fix reset handling 2016-10-28 15:51:27 +01:00
audio audio: intel-hda: check stream entry count during transfer 2016-10-26 14:51:44 +02:00
block virtio, pc: fixes and features 2016-11-03 14:41:53 +00:00
bt char: replace avail_connections 2016-10-24 15:46:10 +02:00
char char: cadence: check baud rate generator and divider values 2016-11-07 10:00:24 +00:00
core nvdimm acpi: introduce fit buffer 2016-11-01 19:21:09 +02:00
cpu
cris
display Xen 2016/10/28 2016-10-31 12:35:39 +00:00
dma hw/dma/pl080: Fix bad bit mask (PL080_CONF_M1 | PL080_CONF_M1) 2016-10-17 19:22:17 +01:00
gpio i.MX: Fix GPIO ISR register write 2016-10-28 15:51:27 +01:00
i2c hw/i2c/bitbang_i2c: Handle NACKs from devices 2016-11-07 10:01:15 +00:00
i386 Xen 2016/11/02 2016-11-04 09:26:24 +00:00
ide macio: switch over to new byte-aligned DMA helpers 2016-10-27 16:29:13 -04:00
input hw/input/hid: support alternative sysrq/break scancodes for gtk-vnc 2016-11-10 15:29:58 +00:00
intc nvic: set pending status for not active interrupts 2016-11-07 10:00:24 +00:00
ipack
ipmi ipmi: Add graceful shutdown handling to the external BMC 2016-11-01 19:21:09 +02:00
isa char: remove init callback 2016-10-24 15:27:20 +02:00
lm32
m68k m68k: change default system clock for m5208evb 2016-10-08 11:25:29 +03:00
mem pc: memhp: enable nvdimm device hotplug 2016-11-01 19:21:09 +02:00
microblaze clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
mips clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
misc milkymist-pfpu: fix potential integer overflow 2016-10-28 18:17:23 +03:00
moxie
net xen: Rename xen_be_send_notify 2016-10-28 17:54:21 -07:00
nvram trivial patches for 2016-10-28 2016-10-31 11:58:30 +00:00
openrisc
pci
pci-bridge clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
pci-host
pcmcia
ppc Base patches for MTTCG enablement. 2016-10-31 15:29:12 +00:00
s390x virtio, pc: fixes and features 2016-11-03 14:41:53 +00:00
scsi virtio, pc: fixes and features 2016-11-03 14:41:53 +00:00
sd
sh4
smbios smbios: fix uuid copy 2016-09-29 11:43:22 +08:00
sparc nvram: Rename openbios_firmware_abi.h into sun_nvram.h 2016-10-28 09:36:58 +11:00
sparc64 nvram: Rename openbios_firmware_abi.h into sun_nvram.h 2016-10-28 09:36:58 +11:00
ssi xilinx: fix buffer overflow on realize 2016-10-24 15:27:20 +02:00
timer clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
tpm clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
tricore
unicore32 clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
usb usbredir: free vm_change_state_handler in usbredir destroy dispatch 2016-11-10 15:29:58 +00:00
vfio vfio: Add support for mmapping sub-page MMIO BARs 2016-10-31 09:53:04 -06:00
virtio virtio-crypto: using bh to handle dataq's requests 2016-11-01 19:21:08 +02:00
watchdog
xen hw/xen/xen_pvdev: Include qemu/log.h for qemu_log_vprintf() 2016-11-02 12:26:04 -07:00
xenpv xenpv: Fix qemu_uuid compiling error 2016-09-29 11:43:17 +08:00
xtensa char: remove init callback 2016-10-24 15:27:20 +02:00
Makefile.objs STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00