Comment 4 for bug 1377095

Revision history for this message
123p (123p) wrote :

Thanks Thomas for Your suggestion. Unfortunately I cannot achieve the reconnection:

KVM runs with following parameters:

-usb -device usb-host,vendorid=0x04e8,productid=0x3242,id=drucker -monitor unix:qemu-monitor-socket,server,nowait

With the Unix socket, I can now pipe commands to the qemu monitor. This info command works:

echo 'info status' | socat - unix-connect:/qemu-monitor-socket
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) info status
VM status: running

What I have is this:
- disconnect USB printer (Product Samsung ML-1510_700)
- stop KVM
- connect USB printer
- start KVM

echo 'info usb' | socat - unix-connect:/qemu-monitor-socket
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 0.2, Port 2, Speed 12 Mb/s, Product QEMU USB Hub
  Device 0.3, Port 2.1, Speed 12 Mb/s, Product Samsung ML-1510_700, ID: drucker

Printer works.
- disconnect printer

echo 'info usb' | socat - unix-connect:/qemu-monitor-socket
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) info usb
  Device 0.2, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 0.3, Port 2, Speed 12 Mb/s, Product QEMU USB Hub
  Device 0.4, Port 2.1, Speed 12 Mb/s, Product Samsung ML-1510_700, ID: drucker

USB Info still shows the printer, allthough it is disconnected.

Remove device from KVM:

echo 'device_del drucker' | socat - unix-connect:/qemu-monitor-socket

Printer is removed from the device list:

info usbdrucker' | socat - unix-connect:/qemu-monitor-socket
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) info usb
  Device 0.2, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 0.3, Port 2, Speed 12 Mb/s, Product QEMU USB Hub

-connect printer

printer is not shown:

echo 'info usb' | socat - unix-connect:/qemu-monitor-socket
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) info usb
  Device 0.2, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 0.3, Port 2, Speed 12 Mb/s, Product QEMU USB Hub

Add printer device:

echo 'device_add usb-host,vendorid=0x04e8,productid=0x3242,id=drucker ' | socat - unix-connect:/qemu-monitor-socket
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) device_add usb-host,vendorid=0x04e8,productid=0x3242,id=drucker

echo 'info usb' | socat - unix-connect:/qemu-monitor-socket
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) info usb
  Device 0.2, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 0.3, Port 2, Speed 12 Mb/s, Product QEMU USB Hub
  Device 0.0, Port 2.2, Speed 1.5 Mb/s, Product USB Host Device, ID: drucker

Device is shown, but not like when KVM is started with connected printer: Speed only 1.5 Mb/s, no vendor and product info.

Printer does _not_ work.