Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWqyQ-0002t0-S1 for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:44:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWqyM-0002q3-AN for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:44:50 -0500 Received: from [199.232.76.173] (port=39208 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWqyM-0002ps-2F for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:44:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16341) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWqyL-0004Q3-Lr for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:44:45 -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> <4B543977.8050206@redhat.com> Date: Mon, 18 Jan 2010 13:44:40 +0100 In-Reply-To: <4B543977.8050206@redhat.com> (Gerd Hoffmann's message of "Mon, 18 Jan 2010 11:35:35 +0100") 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: Gerd Hoffmann Cc: Nathan Baum , qemu-devel@nongnu.org Gerd Hoffmann writes: > On 01/18/10 11:15, Markus Armbruster wrote: >> Nathan Baum writes: >> >>>>> +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. > > You want be able to figure which bus the device is attached to. > > I think you actually can because the command returns the device tree > converted into a qobject tree, correct? Correct. [...]