mirror of https://github.com/xemu-project/xemu.git
input: fixes for 2.4
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJVqKR9AAoJEEy22O7T6HE44kcP/3IifsLCdCm4yODTcVKy7Dae y+qsb4eBjuv5HZKl7TX4Hk/gPyrqCOgSK+3ktV9GevRFpagdlW3/Is5TJzJoCY0+ JVFglihBeji3OxizVHpqLnxRXRlj4gLgZ8X5pa0dMSJsVlHZp1LgVJspqRJrWUz2 /x7DNB9eEAHFB+ab6rdgqwyQYJ0FtoTCTrDOilt+0E4Am9FyMfSNAM6B/NGWgqey TC4DWAxsTdYECFGeSDraw8OG5ot6/rXUF537N+homJNL+9rzRoPwrgyEoLXewASG 44yVxXtpiMAA+iZOp3/A4xWWXlivQnu0pGBvW2n0iiAisA6gc+U+rMOEaqFeiqk3 BCRAIH5vcrbSPN6WEOVao8XMAtJhmM9u7QgSCZ3i+/lP+Sh92WvIO0b0Ot1CICT4 g0XPt3/CxyUJhV979LxWNUdK5nyhdu5p7gPrfq4bRSNQsYHyIMG2RbrmtIAJN0Fq O4ZkNeDmpmMS7otCiJPWxQ1IrR7d+5wGQFaekSvqbQ00BG8VS5q89AG0sOdWboz4 aegoN6HgbuLkS7RJRBqD3DkskG4zAtenodFkEQjDX3TRPJsf+gqkgLUmQs4yz8Re wxCYMG4ZtYPIHIscnKgEVcVAD+VGNJ+EsOc+bZoic2fzn0/QKSKbCqFZtkx418Ov dqXneY5M9mRCWbcPtU5S =+mFI -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150717-1' into staging input: fixes for 2.4 # gpg: Signature made Fri Jul 17 07:45:17 2015 BST using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-input-20150717-1: hid: clarify hid_keyboard_process_keycode virtio-input: move sys/ioctl.h include virtio-input: fix segfault in virtio_input_hid_properties Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
fd1a9ef9c2
|
@ -239,7 +239,7 @@ static void hid_keyboard_event(DeviceState *dev, QemuConsole *src,
|
|||
|
||||
static void hid_keyboard_process_keycode(HIDState *hs)
|
||||
{
|
||||
uint8_t hid_code, key;
|
||||
uint8_t hid_code, index, key;
|
||||
int i, keycode, slot;
|
||||
|
||||
if (hs->n == 0) {
|
||||
|
@ -249,7 +249,8 @@ static void hid_keyboard_process_keycode(HIDState *hs)
|
|||
keycode = hs->kbd.keycodes[slot];
|
||||
|
||||
key = keycode & 0x7f;
|
||||
hid_code = hid_usage_keys[key | ((hs->kbd.modifiers >> 1) & (1 << 7))];
|
||||
index = key | ((hs->kbd.modifiers & (1 << 8)) >> 1);
|
||||
hid_code = hid_usage_keys[index];
|
||||
hs->kbd.modifiers &= ~(1 << 8);
|
||||
|
||||
switch (hid_code) {
|
||||
|
@ -257,18 +258,41 @@ static void hid_keyboard_process_keycode(HIDState *hs)
|
|||
return;
|
||||
|
||||
case 0xe0:
|
||||
assert(key == 0x1d);
|
||||
if (hs->kbd.modifiers & (1 << 9)) {
|
||||
hs->kbd.modifiers ^= 3 << 8;
|
||||
/* The hid_codes for the 0xe1/0x1d scancode sequence are 0xe9/0xe0.
|
||||
* Here we're processing the second hid_code. By dropping bit 9
|
||||
* and setting bit 8, the scancode after 0x1d will access the
|
||||
* second half of the table.
|
||||
*/
|
||||
hs->kbd.modifiers ^= (1 << 8) | (1 << 9);
|
||||
return;
|
||||
}
|
||||
/* fall through to process Ctrl_L */
|
||||
case 0xe1 ... 0xe7:
|
||||
/* Ctrl_L/Ctrl_R, Shift_L/Shift_R, Alt_L/Alt_R, Win_L/Win_R.
|
||||
* Handle releases here, or fall through to process presses.
|
||||
*/
|
||||
if (keycode & (1 << 7)) {
|
||||
hs->kbd.modifiers &= ~(1 << (hid_code & 0x0f));
|
||||
return;
|
||||
}
|
||||
case 0xe8 ... 0xef:
|
||||
/* fall through */
|
||||
case 0xe8 ... 0xe9:
|
||||
/* USB modifiers are just 1 byte long. Bits 8 and 9 of
|
||||
* hs->kbd.modifiers implement a state machine that detects the
|
||||
* 0xe0 and 0xe1/0x1d sequences. These bits do not follow the
|
||||
* usual rules where bit 7 marks released keys; they are cleared
|
||||
* elsewhere in the function as the state machine dictates.
|
||||
*/
|
||||
hs->kbd.modifiers |= 1 << (hid_code & 0x0f);
|
||||
return;
|
||||
|
||||
case 0xea ... 0xef:
|
||||
abort();
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (keycode & (1 << 7)) {
|
||||
|
|
|
@ -308,6 +308,7 @@ static void virtio_input_hid_handle_status(VirtIOInput *vinput,
|
|||
static Property virtio_input_hid_properties[] = {
|
||||
DEFINE_PROP_STRING("display", VirtIOInputHID, display),
|
||||
DEFINE_PROP_UINT32("head", VirtIOInputHID, head, 0),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void virtio_input_hid_class_init(ObjectClass *klass, void *data)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/virtio/virtio-input.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include "standard-headers/linux/input.h"
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include "standard-headers/linux/types.h"
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ cp_virtio() {
|
|||
-e 's/__bitwise__//' \
|
||||
-e 's/__attribute__((packed))/QEMU_PACKED/' \
|
||||
-e 's/__inline__/inline/' \
|
||||
-e '/sys\/ioctl.h/d' \
|
||||
"$f" > "$to/$header";
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue