Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp715238iol; Thu, 9 Jun 2022 12:20:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeZh7//l8F8PS/9GRhX5tBa+jgNKfKMuGOMu8VLoihTY0EM/plAnaE+Zq8gSG7dCohpptx X-Received: by 2002:a17:902:e788:b0:163:73fc:5140 with SMTP id cp8-20020a170902e78800b0016373fc5140mr40613456plb.88.1654802429808; Thu, 09 Jun 2022 12:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654802429; cv=none; d=google.com; s=arc-20160816; b=MTz0w4NRNexSu2FMfj+kV6LAU3sfXDN3uL8g4SHXUxn43er+60JFt2y6hTrAbcAP1Z Kvv9SOFehTAp++10GIB8B8V6xHZKW/q2btRg0rBQvL+jBgpBRLrnmBvlLZRWlqDzpret ZkHI2aThDzLFe+kvYHd1JmBzmBF2q2jrqjuFc3k69SgPekIvUROvaZstYKVZfivK+wf9 xDwgmzozUJJ1g+wDE1EYbqbyJ10n3kdda5d+yDgOGA0Vt2JSj06bHemuiY20XH+oWDe/ wBwznefmBv0LORWwJzkGCnnp7F7j/oTyeyEclWrLAtyyImmYsgXrEv2MendGogpw3e88 8qZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jwKn4pzc5GYsE/BJFaLjvKJnAWAMrtHKyy8h5ezGu80=; b=EBSYap7vGpU7zIfBXYJp0Tcow+bAiT25Mw3UKMY0IB9L8UjaN6iij0+XkINRjW65Bd OzDvIPgGr0d1ZVnCiA/mGC9x1THYkWDMKQ0ZYu4sAGNCo0NtFnSraD7hul9boPOI2B2Y pHLrki2nvJy+jcRUjQXXvnRqr03dNBWt7uKCK5XJQMeA40wGD6T7XyA6oJqQcJ+3BGsD zLtMFg4Wm99Pz0bVwu06oQhYHDQvoGL4RmSkW7Pekwc6L/whiSMdwukPVP0z/SaL/xKZ WcfLyv7m0w1yYpeXRgi36sy0NxI5s18CEoBsq/ebDhtNjiahwDQhu/nz6BuxQpaWn5Kh s9IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=i4pupNlK; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p14-20020a056a000b4e00b0051c147c59absi9035142pfo.353.2022.06.09.12.20.00; Thu, 09 Jun 2022 12:20:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=i4pupNlK; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234277AbiFITFD (ORCPT + 99 others); Thu, 9 Jun 2022 15:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237908AbiFITFB (ORCPT ); Thu, 9 Jun 2022 15:05:01 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF53853E32 for ; Thu, 9 Jun 2022 12:05:00 -0700 (PDT) Received: from localhost.localdomain (67.227.121.78.rev.sfr.net [78.121.227.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fdanis) by madras.collabora.co.uk (Postfix) with ESMTPSA id 1B69F6601732 for ; Thu, 9 Jun 2022 20:04:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1654801499; bh=shnm+AmAoGNGoYHI83x2SpIvTEz2YnBS9mV/05zcCRo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i4pupNlKgMAvc2wld60MsWXDc97ED11uwF38zCdWrlwK59+XBgYF2MNkfdwmc0dca BOQrjBB3p9RMKFKgZ4jOl8NQipj26eEI1wYgRb8BLZB1KfPUAo+kWxMp8JCUa5F5wM p+6zSpBzja9Klvf7Gf65o+W9QrPWZ+kGwKb7oH60Nl/GYlaGj0h3W5LdXq2ccRIcBe iGLmz57HM4ZZDnNoqpQTA22XLQGYsiAzZWOi5ofmuf5S6pOWgzCdMI4cGb5KsDTipb DAmZeNQt5y909Z2yI9Vg4x5QBbxfBY9uXQzybBebiiUYKmjvQWwo0Pav4cCnnDsjTx LZdQVZiLMLdig== From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH 2/3] test-runner: Add audio card support Date: Thu, 9 Jun 2022 21:04:41 +0200 Message-Id: <20220609190442.74325-3-frederic.danis@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609190442.74325-1-frederic.danis@collabora.com> References: <20220609190442.74325-1-frederic.danis@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org With this commit audio daemons can detect an audio card with output and input, allowing to test interaction between BlueZ and the audio daemon. --- doc/test-runner.txt | 5 +++++ tools/test-runner.c | 23 ++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/test-runner.txt b/doc/test-runner.txt index 683c622a2..019c23188 100644 --- a/doc/test-runner.txt +++ b/doc/test-runner.txt @@ -54,6 +54,11 @@ For Bluetooth functionality: CONFIG_UHID=y +For Audio functionality: + CONFIG_SYSVIPC=y + CONFIG_SOUND=y + CONFIG_SND=y + CONFIG_SND_INTEL8X0=y These options should be installed as .config in the kernel source directory followed by this command. diff --git a/tools/test-runner.c b/tools/test-runner.c index 8e0e2b42b..77007def4 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -54,6 +54,7 @@ static bool start_monitor = false; static int num_devs = 0; static const char *qemu_binary = NULL; static const char *kernel_image = NULL; +static bool audio_support = false; static const char *qemu_table[] = { "qemu-system-x86_64", @@ -261,6 +262,7 @@ static void start_qemu(void) run_auto, testargs); argv = alloca(sizeof(qemu_argv) + + (audio_support ? 4 : 0) + (sizeof(char *) * (4 + (num_devs * 4)))); memcpy(argv, qemu_argv, sizeof(qemu_argv)); @@ -268,6 +270,20 @@ static void start_qemu(void) argv[0] = (char *) qemu_binary; + if (audio_support) { + char *xdg_runtime_dir, *audiodev; + + xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); + audiodev = alloca(40 + strlen(xdg_runtime_dir)); + sprintf(audiodev, "id=audio,driver=pa,server=%s/pulse/native", + xdg_runtime_dir); + + argv[pos++] = "-audiodev"; + argv[pos++] = audiodev; + argv[pos++] = "-device"; + argv[pos++] = "AC97,audiodev=audio"; + } + argv[pos++] = "-kernel"; argv[pos++] = (char *) kernel_image; argv[pos++] = "-append"; @@ -990,6 +1006,7 @@ static void usage(void) "\t-u, --unix [path] Provide serial device\n" "\t-q, --qemu QEMU binary\n" "\t-k, --kernel Kernel image (bzImage)\n" + "\t-A, --audio Add audio support\n" "\t-h, --help Show help options\n"); } @@ -1004,6 +1021,7 @@ static const struct option main_options[] = { { "monitor", no_argument, NULL, 'm' }, { "qemu", required_argument, NULL, 'q' }, { "kernel", required_argument, NULL, 'k' }, + { "audio", no_argument, NULL, 'A' }, { "version", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { } @@ -1023,7 +1041,7 @@ int main(int argc, char *argv[]) for (;;) { int opt; - opt = getopt_long(argc, argv, "aubdslmq:k:vh", main_options, + opt = getopt_long(argc, argv, "aubdslmq:k:Avh", main_options, NULL); if (opt < 0) break; @@ -1057,6 +1075,9 @@ int main(int argc, char *argv[]) case 'k': kernel_image = optarg; break; + case 'A': + audio_support = true; + break; case 'v': printf("%s\n", VERSION); return EXIT_SUCCESS; -- 2.25.1