From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD7Pk-0002v4-FP for qemu-devel@nongnu.org; Wed, 15 Jun 2016 05:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bD7Pd-0001f4-BK for qemu-devel@nongnu.org; Wed, 15 Jun 2016 05:47:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD7Pd-0001eu-5X for qemu-devel@nongnu.org; Wed, 15 Jun 2016 05:47:05 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B43177D0CC for ; Wed, 15 Jun 2016 09:47:04 +0000 (UTC) From: Gerd Hoffmann Date: Wed, 15 Jun 2016 11:46:59 +0200 Message-Id: <1465984019-28963-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1465984019-28963-1-git-send-email-kraxel@redhat.com> References: <1465984019-28963-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH v2 5/5] usb-uas: hotplug support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Make attached property settable and turns off auto-attach in case the device was hotplugged. Hotplugging works simliar to usb-bot now. Signed-off-by: Gerd Hoffmann Reviewed-by: Markus Armbruster --- hw/usb/dev-uas.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index 0678b1b..3a8ff18 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -900,9 +900,13 @@ static void usb_uas_handle_destroy(USBDevice *dev) static void usb_uas_realize(USBDevice *dev, Error **errp) { UASDevice *uas = USB_UAS(dev); + DeviceState *d = DEVICE(dev); usb_desc_create_serial(dev); usb_desc_init(dev); + if (d->hotplugged) { + uas->dev.auto_attach = 0; + } QTAILQ_INIT(&uas->results); QTAILQ_INIT(&uas->requests); @@ -940,6 +944,7 @@ static void usb_uas_class_initfn(ObjectClass *klass, void *data) uc->handle_control = usb_uas_handle_control; uc->handle_data = usb_uas_handle_data; uc->handle_destroy = usb_uas_handle_destroy; + uc->attached_settable = true; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); dc->fw_name = "storage"; dc->vmsd = &vmstate_usb_uas; -- 1.8.3.1