From nobody Wed Nov 5 22:17:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538386400171453.1787037858601; Mon, 1 Oct 2018 02:33:20 -0700 (PDT) Received: from localhost ([::1]:36565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uZn-0007cQ-Jt for importer@patchew.org; Mon, 01 Oct 2018 05:33:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uVe-0004Yw-MN for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6uVd-0000ZW-PG for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:28:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52910) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6uVd-0000Z8-I1 for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:28:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D84B0C025D20 for ; Mon, 1 Oct 2018 09:28:56 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5087669206; Mon, 1 Oct 2018 09:28:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 543139D367; Mon, 1 Oct 2018 11:28:48 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 11:28:44 +0200 Message-Id: <20181001092848.11082-2-kraxel@redhat.com> In-Reply-To: <20181001092848.11082-1-kraxel@redhat.com> References: <20181001092848.11082-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 01 Oct 2018 09:28:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/5] usb-mtp: fix error conditions for write operation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bandan , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bandan Return STORE_FULL if we can't write all the bytes but return incomplete transfer if data received is less then what was specified in the metadata. Also, use d->offset as the file size which is valid for all file sizes. Signed-off-by: Bandan Message-id: 20180907220851.9658-2-bsd@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/dev-mtp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 3fdc4b0da1..15edf3bb82 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1665,13 +1665,14 @@ static void usb_mtp_write_data(MTPState *s) goto success; } =20 - rc =3D write_retry(d->fd, d->data, s->dataset.size); - if (!rc) { + rc =3D write_retry(d->fd, d->data, d->offset); + if (rc !=3D d->offset) { usb_mtp_queue_result(s, RES_STORE_FULL, d->trans, 0, 0, 0, 0); goto done; } - if (rc !=3D s->dataset.size) { + /* Only for < 4G file sizes */ + if (s->dataset.size !=3D 0xFFFFFFFF && rc !=3D s->dataset.size) { usb_mtp_queue_result(s, RES_INCOMPLETE_TRANSFER, d->trans, 0, 0, 0, 0); goto done; --=20 2.9.3 From nobody Wed Nov 5 22:17:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538386529599656.0012954453964; Mon, 1 Oct 2018 02:35:29 -0700 (PDT) Received: from localhost ([::1]:36572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6ubq-0002Li-DY for importer@patchew.org; Mon, 01 Oct 2018 05:35:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uVq-0004hr-GN for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6uVn-0000l1-Pe for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6uVn-0000kH-BS for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 318964CEAA for ; Mon, 1 Oct 2018 09:29:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 602A077E24; Mon, 1 Oct 2018 09:28:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5CFFD9D374; Mon, 1 Oct 2018 11:28:48 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 11:28:45 +0200 Message-Id: <20181001092848.11082-3-kraxel@redhat.com> In-Reply-To: <20181001092848.11082-1-kraxel@redhat.com> References: <20181001092848.11082-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 01 Oct 2018 09:29:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/5] doc: replace x-root with rootdir for usb-mtp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bandan , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bandan Signed-off-by: Bandan Message-id: 20180907220851.9658-3-bsd@redhat.com Signed-off-by: Gerd Hoffmann --- qemu-doc.texi | 2 +- scripts/device-crash-test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 7bd449f398..f7ad1dfe4b 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -943,7 +943,7 @@ for details Bulk-only transport storage device, see @url{https://git.qemu.org/?p=3Dqemu.git;a=3Dblob_plain;f=3Ddocs/usb-storag= e.txt,usb-storage.txt} for details here, too -@item usb-mtp,x-root=3D@var{dir} +@item usb-mtp,rootdir=3D@var{dir} Media transfer protocol device, using @var{dir} as root of the file tree that is presented to the guest. @item usb-host,hostbus=3D@var{bus},hostaddr=3D@var{addr} diff --git a/scripts/device-crash-test b/scripts/device-crash-test index e6c233e9bf..7045594bd4 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -125,7 +125,7 @@ ERROR_WHITELIST =3D [ {'device':'tpm-tis', 'expected':True}, # tpm_tis: back= end driver with id (null) could not be found {'device':'unimplemented-device', 'expected':True}, # property 'siz= e' not specified or zero {'device':'usb-braille', 'expected':True}, # Property char= dev is required - {'device':'usb-mtp', 'expected':True}, # x-root proper= ty must be configured + {'device':'usb-mtp', 'expected':True}, # rootdir prope= rty must be configured {'device':'usb-redir', 'expected':True}, # Parameter 'ch= ardev' is missing {'device':'usb-serial', 'expected':True}, # Property char= dev is required {'device':'usb-storage', 'expected':True}, # drive propert= y not set --=20 2.9.3 From nobody Wed Nov 5 22:17:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538386269995233.27740857668334; Mon, 1 Oct 2018 02:31:09 -0700 (PDT) Received: from localhost ([::1]:36554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uXk-0005kB-V1 for importer@patchew.org; Mon, 01 Oct 2018 05:31:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uVq-0004ht-Gw for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6uVn-0000kj-Ax for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53392) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6uVn-0000k2-2r for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 34B0031649A4 for ; Mon, 1 Oct 2018 09:29:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 506285C1B2; Mon, 1 Oct 2018 09:28:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 651E59D375; Mon, 1 Oct 2018 11:28:48 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 11:28:46 +0200 Message-Id: <20181001092848.11082-4-kraxel@redhat.com> In-Reply-To: <20181001092848.11082-1-kraxel@redhat.com> References: <20181001092848.11082-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 01 Oct 2018 09:29:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/5] usb-mtp: reset ObjectInfo dataset size on cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bandan Das , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bandan Das Stale values in this field may result in qemu expecting more data on the next operation Signed-off-by: Bandan Das Message-id: 20180907220851.9658-4-bsd@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/dev-mtp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 15edf3bb82..00a3691bae 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1568,6 +1568,7 @@ static void usb_mtp_handle_control(USBDevice *dev, US= BPacket *p, if (s->write_pending) { g_free(s->dataset.filename); s->write_pending =3D false; + s->dataset.size =3D 0; } usb_mtp_data_free(s->data_out); s->data_out =3D NULL; @@ -1693,6 +1694,7 @@ done: } free: g_free(s->dataset.filename); + s->dataset.size =3D 0; g_free(path); s->write_pending =3D false; } --=20 2.9.3 From nobody Wed Nov 5 22:17:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538386246953184.00427297814826; Mon, 1 Oct 2018 02:30:46 -0700 (PDT) Received: from localhost ([::1]:36549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uXN-0005SD-O2 for importer@patchew.org; Mon, 01 Oct 2018 05:30:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uVc-0004XN-6v for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:28:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6uVa-0000X9-6P for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:28:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46482) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6uVZ-0000WW-Uv for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:28:54 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4DC0680476 for ; Mon, 1 Oct 2018 09:28:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C7A0D843A; Mon, 1 Oct 2018 09:28:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6D1089D376; Mon, 1 Oct 2018 11:28:48 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 11:28:47 +0200 Message-Id: <20181001092848.11082-5-kraxel@redhat.com> In-Reply-To: <20181001092848.11082-1-kraxel@redhat.com> References: <20181001092848.11082-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 01 Oct 2018 09:28:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/5] usb-hub: clear suspend on detach X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Message-id: 20180912114012.6034-1-kraxel@redhat.com --- hw/usb/dev-hub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 5d9743ef93..dc368179d1 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -191,6 +191,10 @@ static void usb_hub_detach(USBPort *port1) port->wPortStatus &=3D ~PORT_STAT_ENABLE; port->wPortChange |=3D PORT_STAT_C_ENABLE; } + if (port->wPortStatus & PORT_STAT_SUSPEND) { + port->wPortStatus &=3D ~PORT_STAT_SUSPEND; + port->wPortChange |=3D PORT_STAT_C_SUSPEND; + } usb_wakeup(s->intr, 0); } =20 --=20 2.9.3 From nobody Wed Nov 5 22:17:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153838650341060.977869917488306; Mon, 1 Oct 2018 02:35:03 -0700 (PDT) Received: from localhost ([::1]:36571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6ubW-00025a-9n for importer@patchew.org; Mon, 01 Oct 2018 05:35:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6uVi-0004b3-R6 for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6uVh-0000cR-RT for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55640) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6uVh-0000bd-Ga for qemu-devel@nongnu.org; Mon, 01 Oct 2018 05:29:01 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B925030014C2; Mon, 1 Oct 2018 09:29:00 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06B6D6C8C1; Mon, 1 Oct 2018 09:28:54 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 756CA9D377; Mon, 1 Oct 2018 11:28:48 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 11:28:48 +0200 Message-Id: <20181001092848.11082-6-kraxel@redhat.com> In-Reply-To: <20181001092848.11082-1-kraxel@redhat.com> References: <20181001092848.11082-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 01 Oct 2018 09:29:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/5] ohci: set effectively usb frame rate to 1kHz X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Miguel GAIO Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Miguel GAIO USB frame rate is slightly lower than 1kHz: ie. ~950Hz. Thus usb-audio device is not able to perform a simple audio playback without underruns on audio backend. eg. "-device pci-ohci,id=3Dohci -device usb-audio,bus=3Dohci.0" vs PulseAud= io backend. more than 50 underruns are observed per second. Update ohci_sof_time computation, using QEMU_CLOCK_VIRTUAL in ohci_usb_start(), and increment by usb_frame_time in ohci_sof() makes USB frame rate close to 1kHz. This way, no audio underrun are observed during audio playback. Signed-off-by: Miguel GAIO Message-Id: <20180927151936.3647-1-mgaio35@gmail.com> Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ohci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 98da5f0f04..66656a1133 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1253,12 +1253,12 @@ static int ohci_service_ed_list(OHCIState *ohci, ui= nt32_t head, int completion) /* set a timer for EOF */ static void ohci_eof_timer(OHCIState *ohci) { - ohci->sof_time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); timer_mod(ohci->eof_timer, ohci->sof_time + usb_frame_time); } /* Set a timer for EOF and generate a SOF event */ static void ohci_sof(OHCIState *ohci) { + ohci->sof_time +=3D usb_frame_time; ohci_eof_timer(ohci); ohci_set_interrupt(ohci, OHCI_INTR_SF); } @@ -1362,6 +1362,7 @@ static int ohci_bus_start(OHCIState *ohci) * can meet some race conditions */ =20 + ohci->sof_time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ohci_eof_timer(ohci); =20 return 1; @@ -1476,6 +1477,9 @@ static uint32_t ohci_get_frame_remaining(OHCIState *o= hci) * set already. */ tks =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ohci->sof_time; + if (tks < 0) { + tks =3D 0; + } =20 /* avoid muldiv if possible */ if (tks >=3D usb_frame_time) --=20 2.9.3