From patchwork Fri Jul 12 13:39:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1131370 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lYvq1LC1z9s8m for ; Fri, 12 Jul 2019 23:40:23 +1000 (AEST) Received: from localhost ([::1]:49506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvme-0005ha-W2 for incoming@patchwork.ozlabs.org; Fri, 12 Jul 2019 09:40:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57361) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvm6-0003ra-A3 for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:39:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvm5-0006BY-By for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:39:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45436) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hlvm3-00067S-Hl; Fri, 12 Jul 2019 09:39:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA79A59466; Fri, 12 Jul 2019 13:39:42 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-150.brq.redhat.com [10.40.204.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE44E19C67; Fri, 12 Jul 2019 13:39:39 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 15:39:22 +0200 Message-Id: <20190712133928.21394-2-philmd@redhat.com> In-Reply-To: <20190712133928.21394-1-philmd@redhat.com> References: <20190712133928.21394-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 12 Jul 2019 13:39:42 +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] [PATCH-for-4.1? 1/7] hw/arm: Nokia N-series tablet requires Bluetooth X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Miroslav Rezanina , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Missed in 4826ac6d192 because the Bluetooth devices are currently always enabled. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index ab65ecd216..11195251f3 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -106,6 +106,7 @@ config NSERIES select LM832X # GPIO keyboard chip select TWL92230 # energy-management select TUSB6010 + select BLUETOOTH config OMAP bool From patchwork Fri Jul 12 13:39:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1131368 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lYvS1GX2z9sDB for ; Fri, 12 Jul 2019 23:40:04 +1000 (AEST) Received: from localhost ([::1]:49494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvmM-0004Sw-3m for incoming@patchwork.ozlabs.org; Fri, 12 Jul 2019 09:40:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57429) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvmA-0004C6-Ip for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:39:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvm8-0006FF-KB for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:39:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46708) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hlvm6-0006Cs-OY; Fri, 12 Jul 2019 09:39:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 171A12F8BD1; Fri, 12 Jul 2019 13:39:46 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-150.brq.redhat.com [10.40.204.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5973619C58; Fri, 12 Jul 2019 13:39:43 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 15:39:23 +0200 Message-Id: <20190712133928.21394-3-philmd@redhat.com> In-Reply-To: <20190712133928.21394-1-philmd@redhat.com> References: <20190712133928.21394-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 12 Jul 2019 13:39:46 +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] [PATCH-for-4.1 2/7] hw/usb: Bluetooth HCI USB depends on USB & BLUETOOTH X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Miroslav Rezanina , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig index 564305e283..1b435ec002 100644 --- a/hw/usb/Kconfig +++ b/hw/usb/Kconfig @@ -82,7 +82,7 @@ config USB_NETWORK config USB_BLUETOOTH bool default y - depends on USB + depends on USB && BLUETOOTH config USB_SMARTCARD bool From patchwork Fri Jul 12 13:39:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1131373 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lYwM4ts8z9sN4 for ; Fri, 12 Jul 2019 23:40:51 +1000 (AEST) Received: from localhost ([::1]:49524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvn7-0008K0-IB for incoming@patchwork.ozlabs.org; Fri, 12 Jul 2019 09:40:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57482) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvmF-0004YC-AD for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:39:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvmE-0006QO-AE for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:39:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54550) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hlvmB-0006Gr-Bb; Fri, 12 Jul 2019 09:39:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A20630833A5; Fri, 12 Jul 2019 13:39:49 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-150.brq.redhat.com [10.40.204.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 861A319C58; Fri, 12 Jul 2019 13:39:46 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 15:39:24 +0200 Message-Id: <20190712133928.21394-4-philmd@redhat.com> In-Reply-To: <20190712133928.21394-1-philmd@redhat.com> References: <20190712133928.21394-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 12 Jul 2019 13:39:49 +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] [PATCH-for-4.1? 3/7] MAINTAINERS: Add an entry for the Bluetooth devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Miroslav Rezanina , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index cc9636b43a..5d8f27d9bd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1733,6 +1733,13 @@ F: hw/*/*xive* F: include/hw/*/*xive* F: docs/*/*xive* +Bluetooth +S: Orphan +F: bt-*.c +F: hw/bt/ +F: include/hw/bt.h +F: include/sysemu/bt.h + Subsystems ---------- Audio From patchwork Fri Jul 12 13:39:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1131369 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lYvk0RBVz9s8m for ; Fri, 12 Jul 2019 23:40:18 +1000 (AEST) Received: from localhost ([::1]:49500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvmZ-0005L3-HQ for incoming@patchwork.ozlabs.org; Fri, 12 Jul 2019 09:40:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57541) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvmL-00054m-TT for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:40:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvmK-0006b9-Qd for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:40:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37876) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hlvmI-0006YV-E7; Fri, 12 Jul 2019 09:39:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BBFED81DE8; Fri, 12 Jul 2019 13:39:57 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-150.brq.redhat.com [10.40.204.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8B6719C58; Fri, 12 Jul 2019 13:39:49 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 15:39:25 +0200 Message-Id: <20190712133928.21394-5-philmd@redhat.com> In-Reply-To: <20190712133928.21394-1-philmd@redhat.com> References: <20190712133928.21394-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 12 Jul 2019 13:39:57 +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] [PATCH-for-4.1? 4/7] vl: Fix 'braces' coding style issues X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Miroslav Rezanina , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since we'll move this code around, fix its style first: ERROR: braces {} are necessary for all arms of this statement style Signed-off-by: Philippe Mathieu-Daudé --- vl.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/vl.c b/vl.c index 5089fce6c5..96de4f74b9 100644 --- a/vl.c +++ b/vl.c @@ -920,8 +920,9 @@ static struct HCIInfo *hci_table[MAX_NICS]; struct HCIInfo *qemu_next_hci(void) { - if (cur_hci == nb_hcis) + if (cur_hci == nb_hcis) { return &null_hci; + } return hci_table[cur_hci++]; } @@ -937,8 +938,9 @@ static int bt_hci_parse(const char *str) } hci = hci_init(str); - if (!hci) + if (!hci) { return -1; + } bdaddr.b[0] = 0x52; bdaddr.b[1] = 0x54; @@ -957,9 +959,10 @@ static void bt_vhci_add(int vlan_id) { struct bt_scatternet_s *vlan = qemu_find_bt_vlan(vlan_id); - if (!vlan->slave) + if (!vlan->slave) { warn_report("adding a VHCI to an empty scatternet %i", vlan_id); + } bt_vhci_init(bt_new_hci(vlan)); } @@ -984,12 +987,14 @@ static struct bt_device_s *bt_device_add(const char *opt) vlan = qemu_find_bt_vlan(vlan_id); - if (!vlan->slave) + if (!vlan->slave) { warn_report("adding a slave device to an empty scatternet %i", vlan_id); + } - if (!strcmp(devname, "keyboard")) + if (!strcmp(devname, "keyboard")) { return bt_keyboard_init(vlan); + } error_report("unsupported bluetooth device '%s'", devname); return 0; @@ -1002,9 +1007,11 @@ static int bt_parse(const char *opt) if (strstart(opt, "hci", &endp)) { if (!*endp || *endp == ',') { - if (*endp) - if (!strstart(endp, ",vlan=", 0)) + if (*endp) { + if (!strstart(endp, ",vlan=", 0)) { opt = endp + 1; + } + } return bt_hci_parse(opt); } @@ -1021,14 +1028,16 @@ static int bt_parse(const char *opt) error_report("bad parameter '%s'", endp + 1); return 1; } - } else + } else { vlan = 0; + } bt_vhci_add(vlan); return 0; } - } else if (strstart(opt, "device:", &endp)) + } else if (strstart(opt, "device:", &endp)) { return !bt_device_add(endp); + } error_report("bad bluetooth parameter '%s'", opt); return 1; From patchwork Fri Jul 12 13:39:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1131371 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lYw530Wdz9sLt for ; Fri, 12 Jul 2019 23:40:37 +1000 (AEST) Received: from localhost ([::1]:49514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvmt-0006x8-57 for incoming@patchwork.ozlabs.org; Fri, 12 Jul 2019 09:40:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57594) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvmU-0005lT-OX for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:40:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvmT-0006lJ-R5 for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:40:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46972) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hlvmR-0006jA-MQ; Fri, 12 Jul 2019 09:40:07 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 051EFC057F2F; Fri, 12 Jul 2019 13:40:07 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-150.brq.redhat.com [10.40.204.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87E7019C58; Fri, 12 Jul 2019 13:39:58 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 15:39:26 +0200 Message-Id: <20190712133928.21394-6-philmd@redhat.com> In-Reply-To: <20190712133928.21394-1-philmd@redhat.com> References: <20190712133928.21394-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 12 Jul 2019 13:40:07 +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] [PATCH-for-4.1? 5/7] vl: Use qemu_strtoi() instead of strtol() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Miroslav Rezanina , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since we'll move this code around, fix this checkpatch warning first: ERROR: consider using qemu_strtol in preference to strtol Signed-off-by: Philippe Mathieu-Daudé --- vl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 96de4f74b9..c7f4d01c99 100644 --- a/vl.c +++ b/vl.c @@ -978,8 +978,7 @@ static struct bt_device_s *bt_device_add(const char *opt) pstrcpy(devname, MIN(sizeof(devname), len), opt); if (endp) { - vlan_id = strtol(endp + 6, &endp, 0); - if (*endp) { + if (qemu_strtoi(endp + 6, (const char **)&endp, 0, &vlan_id) < 0) { error_report("unrecognised bluetooth vlan Id"); return 0; } @@ -1019,8 +1018,7 @@ static int bt_parse(const char *opt) if (!*endp || *endp == ',') { if (*endp) { if (strstart(endp, ",vlan=", &p)) { - vlan = strtol(p, (char **) &endp, 0); - if (*endp) { + if (qemu_strtoi(p, &endp, 0, &vlan) < 0) { error_report("bad scatternet '%s'", p); return 1; } From patchwork Fri Jul 12 13:39:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1131374 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lYwz4FPsz9sBF for ; Fri, 12 Jul 2019 23:41:23 +1000 (AEST) Received: from localhost ([::1]:49548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvnd-0001Os-MS for incoming@patchwork.ozlabs.org; Fri, 12 Jul 2019 09:41:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57931) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvnW-0001KT-Lk for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:41:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvnV-0007aW-7C for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:41:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55362) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hlvnS-0007Xf-38; Fri, 12 Jul 2019 09:41:10 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6457F30C34D4; Fri, 12 Jul 2019 13:41:09 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-150.brq.redhat.com [10.40.204.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FF26196AB; Fri, 12 Jul 2019 13:40:07 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 15:39:27 +0200 Message-Id: <20190712133928.21394-7-philmd@redhat.com> In-Reply-To: <20190712133928.21394-1-philmd@redhat.com> References: <20190712133928.21394-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 12 Jul 2019 13:41:09 +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] [PATCH-for-4.1? 6/7] vl: Extract bt_parse() into its own file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Miroslav Rezanina , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This is required to be able to compile vl.c with CONFIG_BLUETOOTH disabled. Signed-off-by: Philippe Mathieu-Daudé --- 2300 lines less for the C preprocessor :) --- Makefile.objs | 2 +- bt-opts.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ include/sysemu/bt.h | 3 + vl.c | 128 ---------------------------------------- 4 files changed, 144 insertions(+), 129 deletions(-) create mode 100644 bt-opts.c diff --git a/Makefile.objs b/Makefile.objs index 6a143dcd57..c2845a0efc 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -65,7 +65,7 @@ common-obj-y += replay/ common-obj-y += ui/ common-obj-m += ui/ -common-obj-y += bt-host.o bt-vhci.o +common-obj-y += bt-host.o bt-vhci.o bt-opts.o bt-host.o-cflags := $(BLUEZ_CFLAGS) common-obj-y += dma-helpers.o diff --git a/bt-opts.c b/bt-opts.c new file mode 100644 index 0000000000..d14ae4836f --- /dev/null +++ b/bt-opts.c @@ -0,0 +1,140 @@ +/* + * Bluetooth command line options. + * + * Copyright (C) 2008 Andrzej Zaborowski + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qemu/cutils.h" +#include "sysemu/bt.h" +#include "net/net.h" +#include "hw/bt.h" + +static int nb_hcis; +static int cur_hci; +static struct HCIInfo *hci_table[MAX_NICS]; + +struct HCIInfo *qemu_next_hci(void) +{ + if (cur_hci == nb_hcis) { + return &null_hci; + } + + return hci_table[cur_hci++]; +} + +static int bt_hci_parse(const char *str) +{ + struct HCIInfo *hci; + bdaddr_t bdaddr; + + if (nb_hcis >= MAX_NICS) { + error_report("too many bluetooth HCIs (max %i)", MAX_NICS); + return -1; + } + + hci = hci_init(str); + if (!hci) { + return -1; + } + + bdaddr.b[0] = 0x52; + bdaddr.b[1] = 0x54; + bdaddr.b[2] = 0x00; + bdaddr.b[3] = 0x12; + bdaddr.b[4] = 0x34; + bdaddr.b[5] = 0x56 + nb_hcis; + hci->bdaddr_set(hci, bdaddr.b); + + hci_table[nb_hcis++] = hci; + + return 0; +} + +static void bt_vhci_add(int vlan_id) +{ + struct bt_scatternet_s *vlan = qemu_find_bt_vlan(vlan_id); + + if (!vlan->slave) { + warn_report("adding a VHCI to an empty scatternet %i", vlan_id); + } + + bt_vhci_init(bt_new_hci(vlan)); +} + +static struct bt_device_s *bt_device_add(const char *opt) +{ + struct bt_scatternet_s *vlan; + int vlan_id = 0; + char *endp = strstr(opt, ",vlan="); + int len = (endp ? endp - opt : strlen(opt)) + 1; + char devname[10]; + + pstrcpy(devname, MIN(sizeof(devname), len), opt); + + if (endp) { + if (qemu_strtoi(endp + 6, (const char **)&endp, 0, &vlan_id) < 0) { + error_report("unrecognised bluetooth vlan Id"); + return 0; + } + } + + vlan = qemu_find_bt_vlan(vlan_id); + + if (!vlan->slave) { + warn_report("adding a slave device to an empty scatternet %i", + vlan_id); + } + + if (!strcmp(devname, "keyboard")) { + return bt_keyboard_init(vlan); + } + + error_report("unsupported bluetooth device '%s'", devname); + return 0; +} + +int bt_parse(const char *opt) +{ + const char *endp, *p; + int vlan; + + if (strstart(opt, "hci", &endp)) { + if (!*endp || *endp == ',') { + if (*endp) { + if (!strstart(endp, ",vlan=", 0)) { + opt = endp + 1; + } + } + + return bt_hci_parse(opt); + } + } else if (strstart(opt, "vhci", &endp)) { + if (!*endp || *endp == ',') { + if (*endp) { + if (strstart(endp, ",vlan=", &p)) { + if (qemu_strtoi(p, &endp, 0, &vlan) < 0) { + error_report("bad scatternet '%s'", p); + return 1; + } + } else { + error_report("bad parameter '%s'", endp + 1); + return 1; + } + } else { + vlan = 0; + } + + bt_vhci_add(vlan); + return 0; + } + } else if (strstart(opt, "device:", &endp)) { + return !bt_device_add(endp); + } + + error_report("bad bluetooth parameter '%s'", opt); + return 1; +} diff --git a/include/sysemu/bt.h b/include/sysemu/bt.h index 2fd8c0f14b..5b73709c2d 100644 --- a/include/sysemu/bt.h +++ b/include/sysemu/bt.h @@ -17,4 +17,7 @@ typedef struct HCIInfo { struct HCIInfo *bt_host_hci(const char *id); struct HCIInfo *qemu_next_hci(void); +/* TODO Convert bt-opts.c to opts_init() and remove from here. */ +int bt_parse(const char *opt); + #endif diff --git a/vl.c b/vl.c index c7f4d01c99..3a6dd3ba2b 100644 --- a/vl.c +++ b/vl.c @@ -60,7 +60,6 @@ int main(int argc, char **argv) #include "hw/isa/isa.h" #include "hw/scsi/scsi.h" #include "hw/display/vga.h" -#include "hw/bt.h" #include "sysemu/watchdog.h" #include "hw/firmware/smbios.h" #include "hw/acpi/acpi.h" @@ -913,133 +912,6 @@ static void configure_rtc(QemuOpts *opts) } /***********************************************************/ -/* Bluetooth support */ -static int nb_hcis; -static int cur_hci; -static struct HCIInfo *hci_table[MAX_NICS]; - -struct HCIInfo *qemu_next_hci(void) -{ - if (cur_hci == nb_hcis) { - return &null_hci; - } - - return hci_table[cur_hci++]; -} - -static int bt_hci_parse(const char *str) -{ - struct HCIInfo *hci; - bdaddr_t bdaddr; - - if (nb_hcis >= MAX_NICS) { - error_report("too many bluetooth HCIs (max %i)", MAX_NICS); - return -1; - } - - hci = hci_init(str); - if (!hci) { - return -1; - } - - bdaddr.b[0] = 0x52; - bdaddr.b[1] = 0x54; - bdaddr.b[2] = 0x00; - bdaddr.b[3] = 0x12; - bdaddr.b[4] = 0x34; - bdaddr.b[5] = 0x56 + nb_hcis; - hci->bdaddr_set(hci, bdaddr.b); - - hci_table[nb_hcis++] = hci; - - return 0; -} - -static void bt_vhci_add(int vlan_id) -{ - struct bt_scatternet_s *vlan = qemu_find_bt_vlan(vlan_id); - - if (!vlan->slave) { - warn_report("adding a VHCI to an empty scatternet %i", - vlan_id); - } - - bt_vhci_init(bt_new_hci(vlan)); -} - -static struct bt_device_s *bt_device_add(const char *opt) -{ - struct bt_scatternet_s *vlan; - int vlan_id = 0; - char *endp = strstr(opt, ",vlan="); - int len = (endp ? endp - opt : strlen(opt)) + 1; - char devname[10]; - - pstrcpy(devname, MIN(sizeof(devname), len), opt); - - if (endp) { - if (qemu_strtoi(endp + 6, (const char **)&endp, 0, &vlan_id) < 0) { - error_report("unrecognised bluetooth vlan Id"); - return 0; - } - } - - vlan = qemu_find_bt_vlan(vlan_id); - - if (!vlan->slave) { - warn_report("adding a slave device to an empty scatternet %i", - vlan_id); - } - - if (!strcmp(devname, "keyboard")) { - return bt_keyboard_init(vlan); - } - - error_report("unsupported bluetooth device '%s'", devname); - return 0; -} - -static int bt_parse(const char *opt) -{ - const char *endp, *p; - int vlan; - - if (strstart(opt, "hci", &endp)) { - if (!*endp || *endp == ',') { - if (*endp) { - if (!strstart(endp, ",vlan=", 0)) { - opt = endp + 1; - } - } - - return bt_hci_parse(opt); - } - } else if (strstart(opt, "vhci", &endp)) { - if (!*endp || *endp == ',') { - if (*endp) { - if (strstart(endp, ",vlan=", &p)) { - if (qemu_strtoi(p, &endp, 0, &vlan) < 0) { - error_report("bad scatternet '%s'", p); - return 1; - } - } else { - error_report("bad parameter '%s'", endp + 1); - return 1; - } - } else { - vlan = 0; - } - - bt_vhci_add(vlan); - return 0; - } - } else if (strstart(opt, "device:", &endp)) { - return !bt_device_add(endp); - } - - error_report("bad bluetooth parameter '%s'", opt); - return 1; -} static int parse_name(void *opaque, QemuOpts *opts, Error **errp) { From patchwork Fri Jul 12 13:39:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1131375 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lYxC341gz9s8m for ; Fri, 12 Jul 2019 23:41:35 +1000 (AEST) Received: from localhost ([::1]:49554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvnp-0002Ii-K7 for incoming@patchwork.ozlabs.org; Fri, 12 Jul 2019 09:41:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57953) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvnY-0001Nj-Km for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:41:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvnX-0007c5-NQ for qemu-devel@nongnu.org; Fri, 12 Jul 2019 09:41:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42614) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hlvnV-0007aM-FK; Fri, 12 Jul 2019 09:41:13 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B813B87630; Fri, 12 Jul 2019 13:41:12 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-150.brq.redhat.com [10.40.204.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37BC826FC1; Fri, 12 Jul 2019 13:41:08 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 15:39:28 +0200 Message-Id: <20190712133928.21394-8-philmd@redhat.com> In-Reply-To: <20190712133928.21394-1-philmd@redhat.com> References: <20190712133928.21394-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 12 Jul 2019 13:41:12 +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] [PATCH-for-4.1? 7/7] hw/bt: Allow building with CONFIG_BLUETOOTH disabled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Miroslav Rezanina , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- Makefile.objs | 3 ++- bt-stubs.c | 18 ++++++++++++++++++ hw/bt/Makefile.objs | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 bt-stubs.c diff --git a/Makefile.objs b/Makefile.objs index c2845a0efc..98269e393a 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -65,8 +65,9 @@ common-obj-y += replay/ common-obj-y += ui/ common-obj-m += ui/ -common-obj-y += bt-host.o bt-vhci.o bt-opts.o bt-host.o-cflags := $(BLUEZ_CFLAGS) +common-obj-$(CONFIG_BLUETOOTH) += bt-host.o bt-vhci.o bt-opts.o +common-obj-$(call lnot,$(CONFIG_BLUETOOTH)) += bt-stubs.o common-obj-y += dma-helpers.o common-obj-y += vl.o diff --git a/bt-stubs.c b/bt-stubs.c new file mode 100644 index 0000000000..d3f5158d3b --- /dev/null +++ b/bt-stubs.c @@ -0,0 +1,18 @@ +/* + * Bluetooth stubs. + * + * Copyright (c) 2019 Red Hat, Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "sysemu/bt.h" + +int bt_parse(const char *opt) +{ + error_report("Bluetooth support is disabled"); + + return 1; +} diff --git a/hw/bt/Makefile.objs b/hw/bt/Makefile.objs index 867a7d2e8a..46aec8e38e 100644 --- a/hw/bt/Makefile.objs +++ b/hw/bt/Makefile.objs @@ -1,3 +1,3 @@ -common-obj-y += core.o l2cap.o sdp.o hci.o hid.o -common-obj-y += hci-csr.o +common-obj-$(CONFIG_BLUETOOTH) += core.o l2cap.o sdp.o hci.o hid.o +common-obj-$(CONFIG_BLUETOOTH) += hci-csr.o