* [Qemu-devel] qemu qmp [info usb] and [info hostusb]
@ 2014-07-11 21:52 Pascal Heinrich
2014-07-12 1:14 ` Gonglei (Arei)
2014-07-14 7:13 ` Markus Armbruster
0 siblings, 2 replies; 4+ messages in thread
From: Pascal Heinrich @ 2014-07-11 21:52 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 358 bytes --]
Hi,
I am trying to implement a qtprogram to bind and unbind usb devices from
an qemu instance.
Via device_add I am able to bind a device to the vm but there is no
command in qmp to list binded devices or I do not find them.
I am searching for something like >"query-usb"<
Is there something implemented like that?
best regards,
Pascal
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] qemu qmp [info usb] and [info hostusb]
2014-07-11 21:52 [Qemu-devel] qemu qmp [info usb] and [info hostusb] Pascal Heinrich
@ 2014-07-12 1:14 ` Gonglei (Arei)
2014-07-14 7:13 ` Markus Armbruster
1 sibling, 0 replies; 4+ messages in thread
From: Gonglei (Arei) @ 2014-07-12 1:14 UTC (permalink / raw)
To: Pascal Heinrich, qemu-devel@nongnu.org
> -----Original Message-----
> From: qemu-devel-bounces+arei.gonglei=huawei.com@nongnu.org
> [mailto:qemu-devel-bounces+arei.gonglei=huawei.com@nongnu.org] On
> Behalf Of Pascal Heinrich
> Sent: Saturday, July 12, 2014 5:52 AM
> To: qemu-devel@nongnu.org
> Subject: [Qemu-devel] qemu qmp [info usb] and [info hostusb]
>
> Hi,
>
> I am trying to implement a qtprogram to bind and unbind usb devices from
> an qemu instance.
>
> Via device_add I am able to bind a device to the vm but there is no
> command in qmp to list binded devices or I do not find them.
>
> I am searching for something like >"query-usb"<
>
> Is there something implemented like that?
>
AFAICT, there is nothing batch interface like that, not just usb device,
but pci or all other devices.
BTW, I don't think this kind of interface is a good idea. Because the error
process logic is troubled, about failure and revert.
Best regards,
-Gonglei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] qemu qmp [info usb] and [info hostusb]
2014-07-11 21:52 [Qemu-devel] qemu qmp [info usb] and [info hostusb] Pascal Heinrich
2014-07-12 1:14 ` Gonglei (Arei)
@ 2014-07-14 7:13 ` Markus Armbruster
2014-07-15 20:12 ` Pascal Heinrich
1 sibling, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2014-07-14 7:13 UTC (permalink / raw)
To: Pascal Heinrich; +Cc: qemu-devel, Andreas Färber
Pascal Heinrich <pascalheinrich.de@googlemail.com> writes:
> Hi,
>
> I am trying to implement a qtprogram to bind and unbind usb devices from
> an qemu instance.
>
> Via device_add I am able to bind a device to the vm but there is no
> command in qmp to list binded devices or I do not find them.
>
> I am searching for something like >"query-usb"<
>
> Is there something implemented like that?
In the human monitor, there's "info qtree", but programs really should
use QMP. It provides qom-list and qom-get, but that's rather low level.
Andreas, any further advice?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] qemu qmp [info usb] and [info hostusb]
2014-07-14 7:13 ` Markus Armbruster
@ 2014-07-15 20:12 ` Pascal Heinrich
0 siblings, 0 replies; 4+ messages in thread
From: Pascal Heinrich @ 2014-07-15 20:12 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel, Andreas Färber
[-- Attachment #1.1: Type: text/plain, Size: 2593 bytes --]
The only problem I have is to get already bind device id's so I can
unbind them.
I do not find a qmp command where the binded usb devices show up.
With query-pci I do not get all devices.
I implemented a new command "query-usb" and copied the logic from
hw/usb/bus.c
But it seems that the QTAILQ macros doesn't work is this context.
#include "qemu-common.h"
#include "sysemu/sysemu.h"
#include "qmp-commands.h"
#include "sysemu/char.h"
#include "ui/qemu-spice.h"
#include "ui/vnc.h"
#include "sysemu/kvm.h"
#include "sysemu/arch_init.h"
#include "hw/qdev.h"
#include "sysemu/blockdev.h"
#include "qom/qom-qobject.h"
#include "qapi/qmp/qobject.h"
#include "qapi/qmp-input-visitor.h"
#include "hw/boards.h"
#include "qom/object_interfaces.h"
#include "hw/mem/pc-dimm.h"
#include "hw/acpi/acpi_dev_interface.h"
#include "include/hw/usb.h"
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
...
UsbInfoList *qmp_query_usb(Error **errp)
{
UsbInfoList *infos = NULL;
USBBus *bus;
USBDevice *dev;
USBPort *port;
QTAILQ_FOREACH(bus, &busses, next) {
QTAILQ_FOREACH(port, &bus->used, next) {
dev = port->dev;
if (!dev)
continue;
UsbInfoList *entry = g_malloc0(sizeof(*entry));
entry->value = g_malloc0(sizeof(UsbInfo));
entry->next = infos;
infos = entry;
entry->value->desc = g_strdup(dev->product_desc);
entry->value->hostbus = bus->busnr;
entry->value->hostaddr = dev->addr;
entry->value->vendorID = 1;
entry->value->productID = 1;
// monitor_printf(mon, " Device %d.%d, Port %s, Speed %s
Mb/s, Product %s\n", bus->busnr, dev->addr, port->path,
usb_speed(dev->speed), dev->product_desc);
}
}
return infos;
}
any ideas?
thanks :)
On 07/14/14 09:13, Markus Armbruster wrote:
> Pascal Heinrich <pascalheinrich.de@googlemail.com> writes:
>
>> Hi,
>>
>> I am trying to implement a qtprogram to bind and unbind usb devices from
>> an qemu instance.
>>
>> Via device_add I am able to bind a device to the vm but there is no
>> command in qmp to list binded devices or I do not find them.
>>
>> I am searching for something like >"query-usb"<
>>
>> Is there something implemented like that?
> In the human monitor, there's "info qtree", but programs really should
> use QMP. It provides qom-list and qom-get, but that's rather low level.
> Andreas, any further advice?
[-- Attachment #1.2: Type: text/html, Size: 5033 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-15 20:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11 21:52 [Qemu-devel] qemu qmp [info usb] and [info hostusb] Pascal Heinrich
2014-07-12 1:14 ` Gonglei (Arei)
2014-07-14 7:13 ` Markus Armbruster
2014-07-15 20:12 ` Pascal Heinrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).