From patchwork Sat Dec 26 21:19:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Baum X-Patchwork-Id: 41815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 22508B7BFF for ; Sun, 27 Dec 2009 08:37:03 +1100 (EST) Received: from localhost ([127.0.0.1]:57523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NOeJn-0002Xw-DN for incoming@patchwork.ozlabs.org; Sat, 26 Dec 2009 16:36:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NOe34-0004FW-Ow for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NOe2z-0004BT-8m for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:41 -0500 Received: from [199.232.76.173] (port=43618 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NOe2y-0004BE-Cs for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:36 -0500 Received: from smarthost.c4l.co.uk ([82.197.83.77]:53789) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NOe2y-0005ET-2W for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:36 -0500 Received: from [93.97.162.229] (helo=mx.parenthephobia.org.uk) by smarthost.c4l.co.uk with esmtp (Exim 4.69) (envelope-from ) id 1NOe2s-0007uO-Hs for qemu-devel@nongnu.org; Sat, 26 Dec 2009 21:19:31 +0000 Received: from athens (93-97-162-231.zone5.bethere.co.uk [93.97.162.231]) by mx.parenthephobia.org.uk (Postfix) with ESMTP id 5640953786 for ; Sat, 26 Dec 2009 21:26:48 +0000 (GMT) Received: by athens (Postfix, from userid 1000) id DBF845EEEE; Sat, 26 Dec 2009 21:19:23 +0000 (GMT) From: Nathan Baum To: qemu-devel@nongnu.org Date: Sat, 26 Dec 2009 21:19:19 +0000 Message-Id: <1261862362-2530-9-git-send-email-nathan@parenthephobia.org.uk> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1261862362-2530-1-git-send-email-nathan@parenthephobia.org.uk> References: <1261862362-2530-1-git-send-email-nathan@parenthephobia.org.uk> X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 08/11] qdev: Add usb_bus_dev_info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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, + dev->addr, + usb_speed(dev->speed), + dev->product_desc, + dev->attached); +} + void usb_info(Monitor *mon) { USBBus *bus;