On 10/6/24 10:33, Daniel P. Berrangé wrote:
On Mon, Jun 10, 2024 at 08:38:47AM +0200, Philippe Mathieu-Daudé wrote:
This is a counterpart to the HMP "info usbhost" command. It is being
added with an "x-" prefix because this QMP command is intended as an
adhoc debugging tool and will thus not be modelled in QAPI as fully
structured data, nor will it have long term guaranteed stability.
The existing HMP command is rewritten to call the QMP command.

'info usb' host is one of the problem scenarios i mentioned in

https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berra...@redhat.com/

Its HMP impl is within a dynamically loadable module. So if you
run it initially you'll get

(qemu) info usbhost
Command "info usbhost" is not available.


but if you have a usb host on the cli:

(qemu) info usbhost
   Bus 3, Addr 6, Port 8, Speed 480 Mb/s
     Class ef: USB device 04f2:b74f
   Bus 3, Addr 11, Port 7.3, Speed 1.5 Mb/s
   ...snip...


Anyway, the end result is that this patch fails to link when modules
are enabled:

cc -m64 @qemu-system-x86_64.rsp
/usr/bin/ld: libqemuutil.a.p/meson-generated_.._qapi_qapi-commands-machine.c.o: 
in function `qmp_marshal_x_query_usbhost':
/var/home/berrange/src/virt/qemu/build/qapi/qapi-commands-machine.c:1514: 
undefined reference to `qmp_x_query_usbhost'

Indeed I missed that.

IMHO the solution to this is to refactor the cdoe to split
hw/usb/host-libusb.c into two parts.

One part provides the monitor API impls, and some callbacks
for feeding data to them. The other part provides the actual
impl, and registers the callbacks needed by the monitor cmd.

Yeah something like that will do.


Reply via email to