From e52a1635444e10f625e11fafc3b968075714c8e6 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Gerd Hoffmann Date: Thu, 16 Aug 2012 11:39:19 +0200 Subject: [PATCH 17/18] usb-host: attach only to running guest RH-Author: Gerd Hoffmann Message-id: <1345117160-21046-18-git-send-email-kraxel@redhat.com> Patchwork-id: 40932 O-Subject: [RHEL-6.4 qemu-kvm PATCH 17/18] usb-host: attach only to running guest Bugzilla: 805172 RH-Acked-by: Paolo Bonzini RH-Acked-by: Hans de Goede RH-Acked-by: Laszlo Ersek Signed-off-by: Gerd Hoffmann (cherry picked from commit a844ed842d9a9d929645c09ae0f52f753d7a02e0) Conflicts: usb-linux.c --- usb-linux.c | 31 +++++++++++++++++-------------- 1 files changed, 17 insertions(+), 14 deletions(-) Signed-off-by: Michal Novotny --- usb-linux.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 961e2cf..fdcc43d 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1867,23 +1867,26 @@ static void usb_host_auto_check(void *unused) struct USBHostDevice *s; int unconnected = 0; - usb_host_scan(NULL, usb_host_auto_scan); + if (runstate_is_running()) { + usb_host_scan(NULL, usb_host_auto_scan); - QTAILQ_FOREACH(s, &hostdevs, next) { - if (s->fd == -1) { - unconnected++; - } - if (s->seen == 0) { - s->errcount = 0; + QTAILQ_FOREACH(s, &hostdevs, next) { + if (s->fd == -1) { + unconnected++; + } + if (s->seen == 0) { + s->errcount = 0; + } + s->seen = 0; } - s->seen = 0; - } - if (unconnected == 0) { - /* nothing to watch */ - if (usb_auto_timer) - qemu_del_timer(usb_auto_timer); - return; + if (unconnected == 0) { + /* nothing to watch */ + if (usb_auto_timer) { + qemu_del_timer(usb_auto_timer); + } + return; + } } if (!usb_auto_timer) { -- 1.7.11.4