Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2233874rdb; Fri, 8 Dec 2023 02:08:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHq4jYuv4P8yCTVj3FjotLH4v4IjSODUVl6RF3mgqpKYClUQv7MTfIMfp/1ippbw2rqVvKe X-Received: by 2002:a05:622a:452:b0:425:a508:a2c2 with SMTP id o18-20020a05622a045200b00425a508a2c2mr248161qtx.84.1702030099434; Fri, 08 Dec 2023 02:08:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702030099; cv=none; d=google.com; s=arc-20160816; b=JdZqMla4ysTkly1hLV24tmrbxsNmxqGR7wMMZHj8t6bDzc3dV/XOgr+h5LwstD9Frq sj9eCSp8+6Spd7wTyGchmPYUxUs5RigMlsh4iQYQHHjhGufzNLouwgc+oTQV5ORLpd7E zOGlILHwSExVkneQalgKNaMxl8m2Vy9RGmBDFToM75S2iNwx94imwd8ggO1q1XGeGmM6 tLGh+1Mh61fAeUl6Vm6NZMYa7j44sKmDpoOKvUVzdkRPOFcqjuLN6Tgm+Z64Pye2Vf+N 7LcFXL8n43yeMDsOYrPv+WobR/JE5Q5brwxZNJ5Pz5aLrKuCjCrXqMv3oZPjEHCmeDCw 8rbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:cc:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=BvXGOHMq5q1Sy/o28/prevPN5rrFhsv/mRMetWRhsvE=; fh=kwBhqjoon1/36NC9LGCU34VRm5bGXsSAR65zqfbzhvg=; b=vXJtSACdBDnttTfukN7kaVDTMVxx860Ecrb/tZcuDgPA5q4I3WOFNw76cR5hP+iIAj Lad5W8lbt9gMNt0c5NUIVLiasji+7eBHN7MgxcLv2Id0SjAz4/JhprcIHitQGs3SreFy ILQaabLy9vU0/Td4OZ8dsBuDQBnTDd7AuMDxTmChgMB1Ffo3iY3CagUNfp6yGIxR24Fv h5sgUY1z8tucNuS7OZz6ZBSbdRIKKjW+ELeyDbIx8cr2rVVaql3zpHRd9/rrf680BgDL qWT/alEAP7PEzSqD3v1cV1IrUYAA4b7lIcODhoDrzC3aYDthPmAz4bE8hNFe+u1OK25o bg9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-460-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-460-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e26-20020ac8671a000000b0042584036938si1707069qtp.354.2023.12.08.02.08.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 02:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-460-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-460-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-460-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 351781C20D1B for ; Fri, 8 Dec 2023 10:08:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10D67134BD; Fri, 8 Dec 2023 10:08:14 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA11D10EF for ; Fri, 8 Dec 2023 02:08:05 -0800 (PST) Received: from [192.168.0.2] (ip5f5af1f0.dynamic.kabel-deutschland.de [95.90.241.240]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 4B3CD61E5FE01; Fri, 8 Dec 2023 11:07:59 +0100 (CET) Message-ID: Date: Fri, 8 Dec 2023 11:07:58 +0100 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH BlueZ v2] tools: avtest: Add reject-code option Content-Language: en-US To: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Danis?= References: <20231208090013.620051-1-frederic.danis@collabora.com> Cc: linux-bluetooth@vger.kernel.org From: Paul Menzel In-Reply-To: <20231208090013.620051-1-frederic.danis@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Dear Frédéric, Thank you for your patch. Am 08.12.23 um 10:00 schrieb Frédéric Danis: > Some PTS tests like A2DP/SNK/AVP/BI-03-C, A2DP/SNK/AVP/BI-08-C , … > request some specific rejection code to pass. > This commit add an option to specify the rejection code during add*s* > AVDTP_SET_CONFIGURATION rejection. It’d be great if you gave one example using that new option. > --- > tools/avtest.c | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > > diff --git a/tools/avtest.c b/tools/avtest.c > index ca37b3b46..5ac3418aa 100644 > --- a/tools/avtest.c > +++ b/tools/avtest.c > @@ -188,7 +188,8 @@ static void dump_buffer(const unsigned char *buf, int len) > } > > static void process_avdtp(int srv_sk, int sk, unsigned char reject, > - int fragment) > + int fragment, > + int reject_code) > { > unsigned char buf[672]; > ssize_t len; > @@ -284,7 +285,8 @@ static void process_avdtp(int srv_sk, int sk, unsigned char reject, > if (reject == AVDTP_SET_CONFIGURATION) { > hdr->message_type = AVDTP_MSG_TYPE_REJECT; > buf[2] = buf[4]; > - buf[3] = 0x13; /* SEP In Use */ > + buf[3] = reject_code ? reject_code : > + 0x13; /* SEP In Use */ > printf("Rejecting set configuration command\n"); > len = write(sk, buf, 4); > } else { > @@ -443,7 +445,8 @@ static int set_minimum_mtu(int sk) > return 0; > } > > -static void do_listen(const bdaddr_t *src, unsigned char reject, int fragment) > +static void do_listen(const bdaddr_t *src, unsigned char reject, int fragment, > + int reject_code) > { > struct sockaddr_l2 addr; > socklen_t optlen; > @@ -483,7 +486,7 @@ static void do_listen(const bdaddr_t *src, unsigned char reject, int fragment) > continue; > } > > - process_avdtp(sk, nsk, reject, fragment); > + process_avdtp(sk, nsk, reject, fragment, reject_code); > > if (media_sock >= 0) { > close(media_sock); > @@ -709,6 +712,7 @@ static void usage(void) > printf("Options:\n" > "\t--device HCI device\n" > "\t--reject Reject command\n" > + "\t--reject-code Reject code to use\n" > "\t--send Send command\n" > "\t--preconf Configure stream before actual command\n" > "\t--wait Wait N seconds before exiting\n" > @@ -720,6 +724,7 @@ static struct option main_options[] = { > { "help", 0, 0, 'h' }, > { "device", 1, 0, 'i' }, > { "reject", 1, 0, 'r' }, > + { "reject-code", 1, 0, 'R' }, > { "send", 1, 0, 's' }, > { "invalid", 1, 0, 'f' }, > { "preconf", 0, 0, 'c' }, > @@ -764,12 +769,12 @@ int main(int argc, char *argv[]) > unsigned char cmd = 0x00; > bdaddr_t src, dst; > int opt, mode = MODE_NONE, sk, invalid = 0, preconf = 0, fragment = 0; > - int avctp = 0, wait_before_exit = 0; > + int avctp = 0, wait_before_exit = 0, reject_code = 0; > > bacpy(&src, BDADDR_ANY); > bacpy(&dst, BDADDR_ANY); > > - while ((opt = getopt_long(argc, argv, "+i:r:s:f:hcFCw:", > + while ((opt = getopt_long(argc, argv, "+i:r:s:f:hcFCw:R:", > main_options, NULL)) != EOF) { > switch (opt) { > case 'i': > @@ -809,6 +814,10 @@ int main(int argc, char *argv[]) > wait_before_exit = atoi(optarg); > break; > > + case 'R': > + reject_code = atoi(optarg); > + break; > + > case 'h': > default: > usage(); > @@ -826,7 +835,7 @@ int main(int argc, char *argv[]) > > switch (mode) { > case MODE_REJECT: > - do_listen(&src, cmd, fragment); > + do_listen(&src, cmd, fragment, reject_code); > break; > case MODE_SEND: > sk = do_connect(&src, &dst, avctp, fragment); Reviewed-by: Paul Menzel Kind regards, Paul