Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWoe5-0004e2-KR for qemu-devel@nongnu.org; Mon, 18 Jan 2010 05:15:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWoe2-0004ct-3y for qemu-devel@nongnu.org; Mon, 18 Jan 2010 05:15:41 -0500 Received: from [199.232.76.173] (port=36805 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWoe1-0004cn-Mr for qemu-devel@nongnu.org; Mon, 18 Jan 2010 05:15:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19092) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWoe1-0004kN-7H for qemu-devel@nongnu.org; Mon, 18 Jan 2010 05:15:37 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [RFC,PATCH 08/11] qdev: Add usb_bus_dev_info References: <1261861899-1984-1-git-send-email-nathan@parenthephobia.org.uk> <1261861899-1984-9-git-send-email-nathan@parenthephobia.org.uk> <1263593691.2577.2515.camel@athens> Date: Mon, 18 Jan 2010 11:15:28 +0100 In-Reply-To: <1263593691.2577.2515.camel@athens> (Nathan Baum's message of "Fri, 15 Jan 2010 22:14:51 +0000") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nathan Baum Cc: qemu-devel@nongnu.org, Gerd Hoffmann Nathan Baum writes: > On Fri, 2010-01-15 at 19:14 +0100, Markus Armbruster wrote: >> Nathan Baum writes: >> >> > Returns a QObject with information about a USB device. >> > >> > Signed-off-by: Nathan Baum >> > --- >> > hw/usb-bus.c | 13 +++++++++++++ >> > 1 files changed, 13 insertions(+), 0 deletions(-) >> > >> > diff --git a/hw/usb-bus.c b/hw/usb-bus.c >> > index 54027df..6d02807 100644 >> > --- a/hw/usb-bus.c >> > +++ b/hw/usb-bus.c >> > @@ -3,6 +3,7 @@ >> > #include "qdev.h" >> > #include "sysemu.h" >> > #include "monitor.h" >> > +#include "qjson.h" >> > >> > static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); >> > >> > @@ -232,6 +233,18 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) >> > dev->attached ? ", attached" : ""); >> > } >> > >> > +static QObject *usb_bus_dev_info(Monitor *mon, DeviceState *qdev) >> > +{ >> > + USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); >> > + USBBus *bus = usb_bus_from_device(dev); >> > + return qobject_from_jsonf("{'busnr': %d, 'addr':%d, 'speed': %s, 'desc': %s, 'attached': %i}", >> > + bus->busnr, >> >> As for PCI, 'busnr' belongs to the bus, not the device. > > Hmm. In cases like this, is it appropriate to modify the output of the > existing "info qtree" when it is modified to use the QObject data? > > Would it be sensible to go the (probably small amount of) effort to > change the print functions to print exactly they do now, and put changes > to their output in different patches so they can easily be dropped if > necessary? We might want to change info qtree output anyway if we show bus information separately there... >> Hmm, we don't have the infrastructure to return bus information, yet. >> "info qtree" hardcodes printing of name and type. Gerd, what do you >> think? ... as I implied here. Regardless, I think we should first decide what data we want to transmit over QMP, and how to structure it, then figure out if and how to change its human readable presentation. [...]