Bug 752730

Summary: [RFE] Support multiple keyboards (e.g. PS/2 & USB) sanely, just like mice
Product: Red Hat Enterprise Linux 6 Reporter: juzhang <juzhang>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: acathrow, armbru, bsarathy, michen, mkenneth, tburke, virt-maint
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-08 09:42:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description juzhang 2011-11-10 09:07:41 UTC
Description of problem:
Boot guest with isa keyboard and usb keyboard simultaneous,then hot unplug usb keyboard,we can not type anything in guest.the keyboard is out of work. 

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.209.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Boot guest with usb keyboard and isa keyboard simutaneous
#..qemu-kvm -usb -device usb-kbd,id=kbd1
2.hot remove usb keyboard
#(qemu) device_del kdb1

  
Actual results:
In guest,keyboard is out of work. 

Expected results:
ISA keyboard should take over when usb keyboard is hot removed,like usb mouse.


Additional info:
I also tried boot guest with usb mouse and isa mouse simultaneous.
1.#qemu-kvm -usb -device usb-mouse,id=mouse1 
2.check mouse info
(qemu) info mice
* Mouse #1: QEMU USB Mouse(usb is using)
  Mouse #0: QEMU PS/2 Mouse
3.hot remove usb mouse
(qemu) device_del mouse1
4.check mouse info again,ps mouse take over at once.
(qemu) info mice
* Mouse #0: QEMU PS/2 Mouse

Results.
ps mouse take over at once,mouse still works in guest.

Comment 1 Markus Armbruster 2011-11-10 09:25:53 UTC
Works as designed.  Fair RFE.

When a mouse device registers, it's put into list mouse_handlers. First one is the "active" mouse.  You can activate another one with monitor command "mouse_set".  When a mouse device gets unplugged, it's removed from mouse_handlers.  If it was the active mouse, then whatever mouse is now first in the list becomes the active mouse, if any.

When a keyboard device registers, it's put into qemu_put_kbd_event, i.e. it becomes *the* keyboard.  When a keyboard device gets unplugged, it sets qemu_put_kbd_event to null.  Thus, the last keyboard to register makes all other keyboards in the system unusable forever.

There have been patches for real multiple keyboard support posted upstream.  Last iteration here:
http://lists.gnu.org/archive/html/qemu-devel/2011-05/msg00312.html