From: Pascal Heinrich <pascalheinrich.de@googlemail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] qemu qmp [info usb] and [info hostusb]
Date: Tue, 15 Jul 2014 22:12:26 +0200 [thread overview]
Message-ID: <53C58B2A.7050900@googlemail.com> (raw)
In-Reply-To: <87mwccjtu4.fsf@blackfin.pond.sub.org>
[-- 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 --]
prev parent reply other threads:[~2014-07-15 20:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C58B2A.7050900@googlemail.com \
--to=pascalheinrich.de@googlemail.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.