qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 700c85: input: use hex in ps2 keycode trace e


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 700c85: input: use hex in ps2 keycode trace events
Date: Wed, 25 Oct 2017 07:22:57 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 700c85c00c7f60d87a77fa267b01ec7c92ae4d5d
      
https://github.com/qemu/qemu/commit/700c85c00c7f60d87a77fa267b01ec7c92ae4d5d
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M hw/input/trace-events

  Log Message:
  -----------
  input: use hex in ps2 keycode trace events

Hardware scancodes are all documented in hex, so use that in trace
events to make it easier to understand.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 1d5b8d770d1215b41ae32c881984b1d048b2f932
      
https://github.com/qemu/qemu/commit/1d5b8d770d1215b41ae32c881984b1d048b2f932
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M ui/input-legacy.c

  Log Message:
  -----------
  ui: fix crash with sendkey and raw key numbers

Previously we enforced that all key events are using QKeyCodes
at time they are sent:

  commit af07e5ff02ae6d4258fc5331007811d0b1c4d35a
  Author: Daniel P. Berrange <address@hidden>
  Date:   Fri Sep 29 11:12:00 2017 +0100

    ui: convert key events to QKeyCodes immediately

This commit forget to fix the code for the legacy 'sendkey'
command which still accepts key numbers from the user, which
then need converting to QKeyCodes

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 237925baa9dd9aaa0bcbe1a506346a0c1e7d208b
      
https://github.com/qemu/qemu/commit/237925baa9dd9aaa0bcbe1a506346a0c1e7d208b
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M ui/input.c

  Log Message:
  -----------
  ui: use correct union field for key number

The code converting key numbers to QKeyCode in the 'input-send-event'
command mistakenly accessed the key->u.qcode union field instead of
the key->u.number field. This is harmless because the fields use the
same size datatype in both cases, but none the less it should be fixed
to avoid confusion.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 620775d1d8ec4e7e5d3dc6807a9355d6b15cc01d
      
https://github.com/qemu/qemu/commit/620775d1d8ec4e7e5d3dc6807a9355d6b15cc01d
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M hw/input/ps2.c
    M hw/input/trace-events

  Log Message:
  -----------
  ps2: fix scancodes sent for Alt-Print key combination (aka SysRq)

The 'Print' key is special in the AT set 1 / set 2 scancode definitions.

An unmodified 'Print' key is supposed to send

 AT Set 1:  e0 2a e0 37 (Down)  e0 b7 e0 aa (Up)
 AT Set 2:  e0 12 e0 7c (Down)  e0 f0 7c e0 f0 12 (Up)

which QEMU gets right. When pressed in combination with the 'Alt_L' or 'Alt_R'
keys (which signify SysRq), the scancodes are required to follow a different
scheme. With Alt_L, the expected sequences are

 AT set 1:  38, 54 (Down) d4, b8 (Up)
 AT set 2:  11, 84 (Down) f0 84, f0 11 (Up)

And with Alt_R

 AT set 1:  e0 38, 54 (Down) d4, e0 b8 (Up)
 AT set 2:  e0 11, 84 (Down) f0 84, f0 e0 11 (Up)

It is actually slightly more complicated than that, because (according results
of 'showkey -s', keyboards will in fact first release the currently pressed
modifier before sending the sequence above (which effectively re-presses &
then releases the modifier) and finally re-press the original modifier
afterwards. IOW, with Alt_L we need to send

 AT set 1:  b8, 38, 54 (Down) d4, b8, 38 (Up)
 AT set 2:  f0 11, 11, 84 (Down) f0 84, f0 11, 11 (Up)

And with Alt_R

 AT set 1:  e0 b8, e0 38, 54 (Down) d4, e0 b8, e0 38 (Up)
 AT set 2:  e0 f0 11, e0 11, 84 (Down) f0 84, e0 f0 11, e0 11 (Up)

The AT set 3 scancodes have no special handling for Alt-Print.

Rather than fixing the handling of the 'print' key in the ps2 driver to consider
the Alt modifiers, way back, a patch was commited that defined an extra 'sysrq'
key name:

  commit f2289cb6924afc97b2a75d21bfc9217024d11741
  Author: balrog <address@hidden>
  Date:   Wed Jun 4 10:14:16 2008 +0000

    Add sysrq to key names known by "sendkey".

    Adding sysrq keycode to the table enabling running sysrq debugging in
    the guest via the monitor sendkey command, like:

    (qemu) sendkey alt-sysrq-t

    Tested on x86-64 target and Linux guest.

    Signed-off-by: Ryan Harper <address@hidden>

With this patch QEMU would send

 AT set 1:  38, 54 (Down) d4, b8 (Up)
 AT set 2:  11, 84 (Down) f0 84, f0 11 (Up)

but this doesn't match what actual real keyboards send, as it is not releasing
the original modifier & pressing it again afterwards. In addition the original
problem remains, and a new problem was added:

  - The sequence 'alt-print-t' is still broken, acting as if 'print-t' was
    requested
  - The sequence 'sysrq-t' is broken, injecting an undefine scancode sequence
    tot he guest os (bare 0x54)

To deal with this mess we make these changes to the ps2 code, so that we track
the state of modifier keys (Alt, Shift, Ctrl - both left & right). Then we can
vary what scancodes are sent for Q_KEY_CODE_PRINT according to the Alt key
modifier state

Interestingly, it appears that of operating systems I've checked (Linux, FreeBSD
and OpenSolaris), none of them actually bother to validate the full sequences
for a unmodified 'Print' key. They all just ignore the leading "e0 2a" and
trigger based off "e0 37" alone. The latter two byte sequence is what keyboards
send with 'Print' is combined with 'Shift' or 'Ctrl' modifiers.

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 8f63458ff72e6c160db560dca494df5ffbebb15e
      
https://github.com/qemu/qemu/commit/8f63458ff72e6c160db560dca494df5ffbebb15e
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M hw/input/ps2.c

  Log Message:
  -----------
  ps2: fix scancodes sent for Shift/Ctrl+Print key combination

The 'Print' key is special in the AT set 1 / set 2 scancode definitions.

An unmodified 'Print' key is supposed to send

 AT Set 1:  e0 2a e0 37 (Down)  e0 b7 e0 aa (Up)
 AT Set 2:  e0 12 e0 7c (Down)  e0 f0 7c e0 f0 12 (Up)

which QEMU gets right. When combined with Shift/Ctrl (both left and right
variants), the leading two bytes should be dropped, resulting in

 AT Set 1:  e0 37 (Down)  e0 b7 (Up)
 AT Set 2:  e0 7c (Down)  e0 f0 7c (Up)

This difference is pretty benign, since of all the operating systems I have
checked (Linux, FreeBSD and OpenStack), none bother to check the leading two
bytes anyway. This change none the less makes the ps2 device better follow real
hardware behaviour.

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 927f0425c4e50705682a422c4a45d634d759d608
      
https://github.com/qemu/qemu/commit/927f0425c4e50705682a422c4a45d634d759d608
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M hw/input/ps2.c

  Log Message:
  -----------
  ps2: fix scancodess sent for Pause key in AT set 1

The ps2 device was previously fixed to send the special Pause/Print
scancode sequences in:

  commit 8c10e0baf0260b59a4e984744462a18016662e3e
  Author: Hervé Poussineau <address@hidden>
  Date:   Thu Sep 15 22:06:26 2016 +0200

    ps2: use QEMU qcodes instead of scancodes

The sequence used for Pause had a small typo in the AT set 1, with a 0xe1
accidentally changed to 0x91.  This is not immediately visible with Linux
guests since they run the ps2 device with AT set 2 scancodes.

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 29fd23a579f65e73cf6a4ded1d8cd472caed1426
      
https://github.com/qemu/qemu/commit/29fd23a579f65e73cf6a4ded1d8cd472caed1426
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M hw/input/ps2.c

  Log Message:
  -----------
  ps2: fix scancodes sent for Ctrl+Pause key combination

The 'Pause' key is special in the AT set 1 / set 2 scancode definitions.

An unmodified 'Pause' key is supposed to send

 AT Set 1:  e1 1d 45 91 9d c5 (Down)  <nothing> (Up)
 AT Set 2:  e1 14 77 e1 f0 14 f0 77 (Down)  <nothing> (Up)

which QEMU gets right. When combined with Ctrl (both left and right variants),
a different sequence is expected

 AT Set 1:  e0 46 e0 c6 (Down)  <nothing> (Up)
 AT Set 2:  e0 7e e0 f0 73 (Down)  <nothing> (Up)

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 80b857f0c6399570c5db06422d8b96690b522580
      
https://github.com/qemu/qemu/commit/80b857f0c6399570c5db06422d8b96690b522580
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M qapi/ui.json
    M ui/input.c

  Log Message:
  -----------
  ui: normalize the 'sysrq' key into the 'print' key

The 'sysrq' key was mistakenly added to QEMU to deal with incorrect handling
of the 'print' key in the ps2 device:

  commit f2289cb6924afc97b2a75d21bfc9217024d11741
  Author: balrog <address@hidden>
  Date:   Wed Jun 4 10:14:16 2008 +0000

    Add sysrq to key names known by "sendkey".

    Adding sysrq keycode to the table enabling running sysrq debugging in
    the guest via the monitor sendkey command, like:

    (qemu) sendkey alt-sysrq-t

    Tested on x86-64 target and Linux guest.

    Signed-off-by: Ryan Harper <address@hidden>

The ps2 device is now fixed wrt modifiers and the 'print' key. Further the
handling of the 'sysrq' key has some problems of its own, documented in the
previous commit. To cleanup this mess, we convert any use of 'sysrq' into
'print' prior to dispatching the event to device models.

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 2182608f1ca00f4559486e9173a8e4242dd2d65d
      
https://github.com/qemu/qemu/commit/2182608f1ca00f4559486e9173a8e4242dd2d65d
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-10-23 (Mon, 23 Oct 2017)

  Changed paths:
    M ui/keycodemapdb

  Log Message:
  -----------
  ui: pull in latest keycodemapdb

Latest keycodemapdb has a fix for Sun keyboard Pause mapping
and backcompat fix for QEMU's treatment of 0xb7 as an alternative
to 0x54 for triggering Print/SysRq

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 328f6f79e9916deb6e5649499f7439b0262f6f9e
      
https://github.com/qemu/qemu/commit/328f6f79e9916deb6e5649499f7439b0262f6f9e
  Author: Peter Maydell <address@hidden>
  Date:   2017-10-24 (Tue, 24 Oct 2017)

  Changed paths:
    M hw/input/ps2.c
    M hw/input/trace-events
    M qapi/ui.json
    M ui/input-legacy.c
    M ui/input.c
    M ui/keycodemapdb

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/kraxel/tags/input-20171023-pull-request' into staging

input: fixes for ui input code and ps/2 keyboard (mostly sysrq key)

# gpg: Signature made Mon 23 Oct 2017 10:19:22 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>"
# gpg:                 aka "Gerd Hoffmann <address@hidden>"
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/input-20171023-pull-request:
  ui: pull in latest keycodemapdb
  ui: normalize the 'sysrq' key into the 'print' key
  ps2: fix scancodes sent for Ctrl+Pause key combination
  ps2: fix scancodess sent for Pause key in AT set 1
  ps2: fix scancodes sent for Shift/Ctrl+Print key combination
  ps2: fix scancodes sent for Alt-Print key combination (aka SysRq)
  ui: use correct union field for key number
  ui: fix crash with sendkey and raw key numbers
  input: use hex in ps2 keycode trace events

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/3d7196d43bfe...328f6f79e991

reply via email to

[Prev in Thread] Current Thread [Next in Thread]