aboutsummaryrefslogtreecommitdiff
path: root/hw/input
AgeCommit message (Collapse)AuthorFilesLines
2017-06-28vmstate: error hint for failed equal checksHalil Pasic1-1/+1
In some cases a failing VMSTATE_*_EQUAL does not mean we detected a bug, but it's actually the best we can do. Especially in these cases a verbose error message is required. Let's introduce infrastructure for specifying a error hint to be used if equal check fails. Let's do this by adding a parameter to the _EQUAL macros called _err_hint. Also change all current users to pass NULL as last parameter so nothing changes for them. Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Message-Id: <20170623144823.42936-1-pasic@linux.vnet.ibm.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2017-06-23ps2: reset queue in ps2_reset_keyboardGerd Hoffmann1-0/+1
When the guest resets the keyboard also clear the queue. It is highly unlikely that the guest is still interested in the events stuck in the queue, and it avoids confusing the guest in case the queue is full and the ACK can't be queued up. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1372583 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170606112105.13331-4-kraxel@redhat.com
2017-06-23ps2: add ps2_reset_queueGerd Hoffmann1-5/+10
Factor out ps2 queue reset to a separate function. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170606112105.13331-3-kraxel@redhat.com
2017-06-23ps2: add and use PS2State typedefGerd Hoffmann1-7/+5
Cleanup: Create and use a typedef for PS2State and stop passing void pointers. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170606112105.13331-2-kraxel@redhat.com
2017-06-23hid: Reset kbd modifiers on resetAlexander Graf1-0/+1
When resetting the keyboard, we need to reset not just the pending keystrokes, but also any pending modifiers. Otherwise there's a race when we're getting reset while running an escape sequence (modifier 0x100). Cc: qemu-stable@nongnu.org Signed-off-by: Alexander Graf <agraf@suse.de> Message-id: 1498117295-162030-1-git-send-email-agraf@suse.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-05-23shutdown: Add source information to SHUTDOWN and RESETEric Blake1-2/+2
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch. It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers. Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests. Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts] Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part] Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts] Message-Id: <20170515214114.15442-5-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-05-17qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatableEduardo Habkost1-1/+1
cannot_instantiate_with_device_add_yet was introduced by commit efec3dd631d94160288392721a5f9c39e50fb2bc to replace no_user. It was supposed to be a temporary measure. When it was introduced, we had 54 cannot_instantiate_with_device_add_yet=true lines in the code. Today (3 years later) this number has not shrunk: we now have 57 cannot_instantiate_with_device_add_yet=true lines. I think it is safe to say it is not a temporary measure, and we won't see the flag go away soon. Instead of a long field name that misleads people to believe it is temporary, replace it a shorter and less misleading field: user_creatable. Except for code comments, changes were generated using the following Coccinelle patch: @@ expression DC; @@ ( -DC->cannot_instantiate_with_device_add_yet = false; +DC->user_creatable = true; | -DC->cannot_instantiate_with_device_add_yet = true; +DC->user_creatable = false; ) @@ typedef ObjectClass; expression dc; identifier class, data; @@ static void device_class_init(ObjectClass *class, void *data) { ... dc->hotpluggable = true; +dc->user_creatable = true; ... } @@ @@ struct DeviceClass { ... -bool cannot_instantiate_with_device_add_yet; +bool user_creatable; ... } @@ expression DC; @@ ( -!DC->cannot_instantiate_with_device_add_yet +DC->user_creatable | -DC->cannot_instantiate_with_device_add_yet +!DC->user_creatable ) Cc: Alistair Francis <alistair.francis@xilinx.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Marcel Apfelbaum <marcel@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Thomas Huth <thuth@redhat.com> Acked-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Acked-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20170503203604.31462-2-ehabkost@redhat.com> [ehabkost: kept "TODO remove once we're there" comment] Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-05-11ui: Support non-zero minimum values for absolute input axesPhilippe Voinov1-2/+4
This patch refactors ui/input.c to support absolute axis minimum values other than 0. All dependent calls to qemu_input_queue_abs have been updated to explicitly supply 0 as the axis minimum value. Signed-off-by: Philippe Voinov <philippevoinov@gmail.com> Message-id: 20170505133952.29885-1-philippevoinov@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-05-03input: Add trace event for empty keyboard queueAlexander Graf2-0/+5
When driving QEMU from the outside, we have basically no chance to determine how quickly the guest OS picks up key events, so we usually have to limit ourselves to very slow keyboard presses to make sure the guest always has enough chance to pick them up. This patch adds a trace events when the keyboarde queue is drained. An external driver can use that as hint that new keys can be pressed. Signed-off-by: Alexander Graf <agraf@suse.de> Message-id: 1490883775-94658-1-git-send-email-agraf@suse.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-03-27virtio-input: fix eventq batchingLadi Prosek1-15/+14
virtio_input_send buffers input events until it sees a SYNC. Then it either sends or drops the entire batch, depending on whether eventq has enough space available. The case to avoid here is partial sends where only part of the batch would get to the guest. Using virtqueue_get_avail_bytes to check the state of eventq was not correct. The queue may have a smaller number of larger buffers available so bytes may be enough but the batch would still not be possible to send, leading to the "Huh? No vq elem available" error. Instead of checking available bytes, this patch optimistically pops buffers from the queue and puts them back in case it runs out of space and the batch needs to be dropped. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1490365490-4854-3-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-03-27virtio-input: free event queue when finalizingLadi Prosek1-2/+4
VirtIOInput.queue was never freed. This commit adds an explicit g_free to virtio_input_finalize and switches the allocation function from realloc to g_realloc in virtio_input_send. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1490365490-4854-2-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-02Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' ↵Peter Maydell1-2/+0
into staging # gpg: Signature made Wed 01 Feb 2017 13:44:32 GMT # gpg: using RSA key 0x9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/tracing-pull-request: trace: clean up trace-events files qapi: add missing trace_visit_type_enum() call trace: improve error reporting when parsing simpletrace header trace: update docs to reflect new code generation approach trace: switch to modular code generation for sub-directories trace: move setting of group name into Makefiles trace: move hw/i386/xen events to correct subdir trace: move hw/xen events to correct subdir trace: move hw/block/dataplane events to correct subdir make: move top level dir to end of include search path # Conflicts: # Makefile Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-01-31trace: clean up trace-events filesStefan Hajnoczi1-2/+0
There are a number of unused trace events that scripts/cleanup-trace-events.pl finds. The "hw/vfio/pci-quirks.c" filename was typoed and "qapi/qapi-visit-core.c" was missing the qapi/ directory prefix. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20170126171613.1399-3-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-01-31ps2: add support for mice with extra/side buttonsFabian Lesniak1-3/+5
This enables the ps2 controller to process mouse events for buttons 4 and 5. Additionally, distinct definitions for the ps2 mouse button state are introduced. The legacy definitions from console.h are not used anymore. Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de> Message-id: 20161206190007.7539-3-fabian@lesniak-it.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20170110-1' into ↵Peter Maydell1-0/+10
staging gtk,vnc: misc bugfixes. kbd: add jp keys, fix ps2 regressions. sdl: export window id for baum, remove sdl hooks from baum. egl: egl-helpers.c license change. # gpg: Signature made Tue 10 Jan 2017 07:16:05 GMT # gpg: using RSA key 0x4CB6D8EED3E87138 # 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>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/pull-ui-20170110-1: ps2: Fix lost scancodes by recent changes curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT) ui/vnc: Fix problem with sending too many bytes as server name gtk: avoid oob array access egl-helpers: Change file licensing to LGPLv2 sdl2: set window ID console: move window ID code from baum to sdl console: add API to get underlying gui window ID ui: use evdev keymap when running under wayland ui/gtk: fix crash at startup when no console is available Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-01-10ps2: Fix lost scancodes by recent changesOGAWA Hirofumi1-0/+10
With "ps2: use QEMU qcodes instead of scancodes", key handling was changed to qcode base. But all scancodes are not converted to new one. This adds some missing qcodes/scancodes what I found in using. [set1 and set3 are from <hpoussin@reactos.org>] Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Reviewed-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-09i2c: Allow I2C devices to NAK start eventsCorey Minyard1-1/+3
Add a return value to the event handler. Some I2C devices will NAK if they have no data, so allow them to do this. This required the following changes: Go through all the event handlers and change them to return int and return 0. Modify i2c_start_transfer to terminate the transaction on a NAK. Modify smbus handing to not assert if a NAK occurs on a second operation, and terminate the transaction and return -1 instead. Add some information on semantics to I2CSlaveClass. Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-11-10hw/input/hid: support alternative sysrq/break scancodes for gtk-vncPeter Korsgaard1-2/+2
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-10-28adb: change handler only when recognizedHervé Poussineau1-3/+23
ADB devices must take new handler into account only when they recognize it. This lets operating systems probe for valid/invalid handles, to know device capabilities. Add a FIXME in keyboard handler, which should use a different translation table depending of the selected handler. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-10virtio: cleanup VMSTATE_VIRTIO_DEVICEHalil Pasic1-2/+0
Now all the usages of the old version of VMSTATE_VIRTIO_DEVICE are gone, so we can get rid of the conditionals, and the old macro. Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-10-10virtio-input: convert VMSTATE_VIRTIO_DEVICEHalil Pasic1-10/+13
Use the new VMSTATE_VIRTIO_DEVICE macro. Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-10-04vmstateify tsc210xDr. David Alan Gilbert1-123/+104
I'm now saving all 3 of the pll entries; only 2 were saved before. There are a couple of times that were previously stored as offsets from 'now' calculated before saving; with vmstate it's easier to store the 'now' and fix it up on reload. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 1474977735-10156-3-git-send-email-dgilbert@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-10-04vmstateify tsc2005Dr. David Alan Gilbert1-115/+75
I've converted the fields in it's main data structure to fixed size types in ways that look sane. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 1474977735-10156-2-git-send-email-dgilbert@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-09-28ps2: do not generate invalid key codes for unknown keysHervé Poussineau1-13/+7
Instead, print a warning message. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1473969987-5890-6-git-send-email-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-09-28ps2: use QEMU qcodes instead of scancodesHervé Poussineau1-48/+485
This fixes problems with translated set 1, where most make code were wrong. This fixes problems with set 3 for extended keys (like arrows) and lot of other keys. Added a FIXME for set 3, where most keys must not (by default) deliver a break code. Detailed list of changes on untranslated set 2: - change of ALTGR break code from 0xe4 to 0xf0 0x08 - change of ALTGR_R break code from 0xe0 0xe4 to 0xe0 0xf0 0x08 - change of F7 make code from 0x02 to 0x83 - change of F7 break code from 0xf0 0x02 to 0xf0 0x83 - change of PRINT make code from 0xe0 0x7c to 0xe0 0x12 0xe0 0x7c - change of PRINT break code from 0xe0 0xf0 0x7c to 0xe0 0xf0 0x7c 0xe0 0xf0 0x12 - change of PAUSE key: new make code = old make code + old break code, no more break code - change on RO break code from 0xf3 to 0xf0 0x51 - change on KP_COMMA break code from 0xfe to 0xf0 0x6d Detailed list of changes on translated set 2 (the most commonly used): - change of PRINT make code from 0xe0 0x37 to 0xe0 0x2a 0xe0 0x37 - change of PRINT break code from 0xe0 0xb7 to 0xe0 0xb7 0xe0 0xaa - change of PAUSE key: new make code = old make code + old break code, no more break code Reference: http://www.computer-engineering.org/ps2keyboard/scancodes1.html http://www.computer-engineering.org/ps2keyboard/scancodes2.html http://www.computer-engineering.org/ps2keyboard/scancodes3.html Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1473969987-5890-5-git-send-email-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-09-28ps2: allow keycode translation for all scancode setsHervé Poussineau1-26/+97
Change ps2_put_keycode to get an untranslated scancode, which is translated if needed. As qemu_input_key_value_to_scancode() gives translated scancodes, untranslate them in ps2_keyboard_event first before giving them to ps2_put_keycode. Results are not changed, except for some keys in translated set 3. Translation table is available at https://www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1473969987-5890-4-git-send-email-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-09-28ps2: correctly handle 'get/set scancode' commandHervé Poussineau1-3/+5
When getting scancode, current scancode must be preceded from reply ack. When setting scancode, we must reject invalid scancodes. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1473969987-5890-3-git-send-email-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-09-28ps2: reject unknown commands, instead of blindly accepting themHervé Poussineau1-1/+1
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1473969987-5890-2-git-send-email-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-09-23adb.c: prevent NO_KEY value from going to guestJohn Arbuckle1-14/+9
The NO_KEY value should not be sent to the guest. This patch drops that value. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-23adb.c: correct several key assignmentsJohn Arbuckle1-6/+6
The original pc_to_adb_keycode mapping did have several keys that were incorrectly mapped. This patch fixes these mappings. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-23adb.c: add support for QKeyCodeJohn Arbuckle1-45/+189
The old pc scancode translation is replaced with QEMU's QKeyCode. This is just a mechanical substitution, which a number of broken mappings left in. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-08pc: simplify passing qemu_irqMarc-André Lureau1-2/+2
qemu_irq is already a pointer, no need to have an extra pointer level. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-08-12trace-events: fix first line comment in trace-eventsLaurent Vivier1-1/+1
Documentation is docs/tracing.txt instead of docs/trace-events.txt. find . -name trace-events -exec \ sed -i "s?See docs/trace-events.txt for syntax documentation.?See docs/tracing.txt for syntax documentation.?" \ {} \; Signed-off-by: Laurent Vivier <lvivier@redhat.com> Message-id: 1470669081-17860-1-git-send-email-lvivier@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-08-08virtio-input: free config listMarc-André Lureau1-0/+11
Clear the list when finalizing. The list is created during realize with virtio_input_idstr_config() and later by further calls to virtio_input_init_config() and virtio_input_add_config(). This leak can be reproduced with device-introspect-test -p /x86_64/device/introspect/concrete. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2016-07-21virtio-input: Wrap in vmstateDr. David Alan Gilbert1-20/+6
Forcibly convert it to a vmstate wrapper; proper conversion comes later. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-07-12input: add trace events for full queuesGerd Hoffmann3-2/+10
It isn't unusual to happen, for example during reboot when the guest doesn't reveice events for a while. So better don't flood stderr with alarming messages. Turn them into tracepoints instead so they can be enabled in case they are needed for trouble-shooting. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1466675495-28797-1-git-send-email-kraxel@redhat.com
2016-06-29pckbd: handle A20 IRQ as GPIOEfimov Vasily1-14/+7
The i8042 device has outgouing IRQ line A20. Currently the IRQ is referenced by a pointer which normally is set during machine initialization. The pointer is never changed at runtime. So common GPIO model can be applied to A20 IRQ line. Note that checking for IRQ to be connected as in previous version of code is not required because qemu_set_irq will do it. Signed-off-by: Efimov Vasily <real@ispras.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-06-20trace: split out trace events for hw/input/ directoryDaniel P. Berrange1-0/+25
Move all trace-events for files in the hw/input/ directory to their own file. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1466066426-16657-19-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-05-19hw: explicitly include qemu/log.hPaolo Bonzini1-0/+1
Move the inclusion out of hw/hw.h, most files do not need it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-04-13virtio-input: support absolute axis config in pass-throughLadi Prosek2-5/+47
VIRTIO_INPUT_CFG_ABS_INFO was not implemented for pass-through input devices. This patch follows the existing design and pre-fetches the config for all absolute axes using EVIOCGABS at realize time. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1460558603-18331-1-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-04-13virtio-input: fix emulated tablet axis rangesLadi Prosek1-2/+2
The reported maximum was wrong. The X and Y coordinates are 0-based so if size is 8000 maximum must be 7FFF. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1460128893-10244-1-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-04-13virtio-input: add live migration supportGerd Hoffmann1-0/+40
virtio-input is simple enough that it doesn't need to xfer any state. Still we have to wire up savevm manually, so the generic pci and virtio are saved correctly. Additionally we need to do some post-load processing to figure whenever the guest uses the device or not, so we can give input routing hints to the qemu input layer using qemu_input_handler_{activate,deactivate}. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1459859501-16965-1-git-send-email-kraxel@redhat.com
2016-04-13virtio-input: implement pass-through evdev writesLadi Prosek1-0/+23
The write path for pass-through devices, commonly used for controlling keyboard LEDs via EV_LED, was not implemented. This commit adds the necessary plumbing to connect the status virtio queue to the host evdev file descriptor. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1459511146-12060-1-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-04-13virtio-input: retrieve EV_LED host config bitsLadi Prosek1-0/+1
VIRTIO_INPUT_CFG_EV_BITS with subsel of EV_LED was always returning an empty bitmap for pass-through input devices. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1459418028-7473-1-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-04-13virtio-input: add missing key mappingsLadi Prosek1-0/+2
KEY_PAUSE is flat out missing. KEY_SYSRQ already has a keycode assigned but it's not what I'm seeing on my system. The mapping doesn't appear to have to be unique so both keycodes now map to KEY_SYSRQ which is what the "Keyboard PrintScreen", HID usage ID 0x46, translates to. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1459343240-19483-1-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-04-08ps2kbd: default to scancode_set 2, as with KBD_CMD_RESETHervé Poussineau1-1/+1
This line has been added in commit ef74679a810fe6858f625b9d52b68cc3fc61eb3d with other initializations. However, scancode set 0 doesn't exist (only 1, 2, 3). This works well as long as operating system is resetting keyboard, or overwriting the current scancode set with the one it wants. This fixes IBM 40p firmware, which doesn't bother sending KBD_CMD_RESET or KBD_CMD_SCANCODE. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-Id: <1458714100-28885-1-git-send-email-hpoussin@reactos.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22Replaced get_tick_per_sec() by NANOSECONDS_PER_SECONDRutuja Shah3-3/+5
This patch replaces get_ticks_per_sec() calls with the macro NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec() is then removed. This replacement improves the readability and understandability of code. For example, timer_mod(fdctrl->result_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50)); NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns matches the unit of the expression on the right side of the plus. Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22include/qemu/osdep.h: Don't include qapi/error.hMarkus Armbruster3-0/+3
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the Error typedef. Since then, we've moved to include qemu/osdep.h everywhere. Its file comment explains: "To avoid getting into possible circular include dependencies, this file should not include any other QEMU headers, with the exceptions of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which are doing a similar job to this file and are under similar constraints." qapi/error.h doesn't do a similar job, and it doesn't adhere to similar constraints: it includes qapi-types.h. That's in excess of 100KiB of crap most .c files don't actually need. Add the typedef to qemu/typedefs.h, and include that instead of qapi/error.h. Include qapi/error.h in .c files that need it and don't get it now. Include qapi-types.h in qom/object.h for uint16List. Update scripts/clean-includes accordingly. Update it further to match reality: replace config.h by config-target.h, add sysemu/os-posix.h, sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h comment quoted above similarly. This reduces the number of objects depending on qapi/error.h from "all of them" to less than a third. Unfortunately, the number depending on qapi-types.h shrinks only a little. More work is needed for that one. Signed-off-by: Markus Armbruster <armbru@redhat.com> [Fix compilation without the spice devel packages. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-18qapi: Don't special-case simple union wrappersEric Blake3-11/+11
Simple unions were carrying a special case that hid their 'data' QMP member from the resulting C struct, via the hack method QAPISchemaObjectTypeVariant.simple_union_type(). But by using the work we started by unboxing flat union and alternate branches, coupled with the ability to visit the members of an implicit type, we can now expose the simple union's implicit type in qapi-types.h: | struct q_obj_ImageInfoSpecificQCow2_wrapper { | ImageInfoSpecificQCow2 *data; | }; | | struct q_obj_ImageInfoSpecificVmdk_wrapper { | ImageInfoSpecificVmdk *data; | }; ... | struct ImageInfoSpecific { | ImageInfoSpecificKind type; | union { /* union tag is @type */ | void *data; |- ImageInfoSpecificQCow2 *qcow2; |- ImageInfoSpecificVmdk *vmdk; |+ q_obj_ImageInfoSpecificQCow2_wrapper qcow2; |+ q_obj_ImageInfoSpecificVmdk_wrapper vmdk; | } u; | }; Doing this removes asymmetry between QAPI's QMP side and its C side (both sides now expose 'data'), and means that the treatment of a simple union as sugar for a flat union is now equivalent in both languages (previously the two approaches used a different layer of dereferencing, where the simple union could be converted to a flat union with equivalent C layout but different {} on the wire, or to an equivalent QMP wire form but with different C representation). Using the implicit type also lets us get rid of the simple_union_type() hack. Of course, now all clients of simple unions have to adjust from using su->u.member to using su->u.member.data; while this touches a number of files in the tree, some earlier cleanup patches helped minimize the change to the initialization of a temporary variable rather than every single member access. The generated qapi-visit.c code is also affected by the layout change: |@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member | } | switch (obj->type) { | case IMAGE_INFO_SPECIFIC_KIND_QCOW2: |- visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err); |+ visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err); | break; | case IMAGE_INFO_SPECIFIC_KIND_VMDK: |- visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err); |+ visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err); | break; | default: | abort(); Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-03-05ui: Shorten references into InputEventEric Blake3-39/+57
An upcoming patch will alter how simple unions, like InputEvent, are laid out, which will impact all lines of the form 'evt->u.XXX' (expanding it to the longer 'evt->u.XXX.data'). For better legibility in that patch, and less need for line wrapping, it's better to use a temporary variable to reduce the effect of a layout change to just the variable initializations, rather than every reference within an InputEvent. There was one instance in hid.c:hid_pointer_event() where the code was referring to evt->u.rel inside the case label where evt->u.abs is the correct name; thankfully, both members of the union have the same type, so it happened to work, but it is now cleaner. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1457021813-10704-8-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>