Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp5064331pjb; Mon, 27 Jul 2020 12:00:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh9Sn6R5avLIapoN5MOH2OSJG/7X1eDAW/g5T/b63Wha7sc9n+7pCAihA5x6TKtNTzIRnw X-Received: by 2002:a50:da05:: with SMTP id z5mr5324404edj.207.1595876454093; Mon, 27 Jul 2020 12:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595876454; cv=none; d=google.com; s=arc-20160816; b=OTX2q+SLFulAZVfvqvnJln16sRXD3L50hpUA5VcsPB1Oh3UhvDTmOZpf1Jglxb5Ie6 c1vQu5NtjptTGOS/sFIWoAo/wO/UDYlQl8J0lZ2jJFjnjQcLuyIHcaBtW+oLE30snkD+ bZ3uCnA4OPu0b7124F8IJBjv0/ca1lzzt83qwGR7w4sE/qC9ZfMVtqPSZtzaMJe7XQ54 v5TVBL/FsQglkOl11j/h1b92YsOEAsr9oroVRVk1XlIErBK3Df9b5vLUhhynYoXQeefk RINvAylqha8+lNXnYM/Y7WMxt+VWgN9nyx9O0d6vmMHW9sJr/YgxpcZzPf75Q/Wb9R6A Nb7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KqTJWlghm8hbSrvYH/wSR/fzYgdbbuaChV5qjhwMteM=; b=M7SOaIBr/fxFtak7+E3ihXFN4qwhQxYBe5z56yS1VgI4V2Yn3HRb7RUi7rbh1tI7CW A9b7PB1nBRy73BLZgAMfH5ZoFff64bJgPZKruV2bA3k4kH4olJdT7r14QvDcEmxljDSK JWo0g6gBE8XbkJZVTVtYRqHskXpbH+eUbGlirRxQRRzqTeTUtigSWTip5cOXDoQ1Nvqn yhcBk+7xpe7H0T/DILM7PVndbPcDE6LP+yYzyn1fqUtKV5Hx6oxFq+l42EMUtmRmAuxz pBa2bvPEum9I5TM4fr4vaKHacW6R3hTaG5/TD1K3X2kTO3QzdngU3AX1pol+4Nzomg6Z IecQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b0rAu1U0; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si6008418ejp.629.2020.07.27.12.00.21; Mon, 27 Jul 2020 12:00:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b0rAu1U0; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731382AbgG0Rh2 (ORCPT + 99 others); Mon, 27 Jul 2020 13:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726897AbgG0Rh0 (ORCPT ); Mon, 27 Jul 2020 13:37:26 -0400 Received: from mail-ua1-x944.google.com (mail-ua1-x944.google.com [IPv6:2607:f8b0:4864:20::944]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A69AC061794 for ; Mon, 27 Jul 2020 10:37:26 -0700 (PDT) Received: by mail-ua1-x944.google.com with SMTP id p27so1415683uaa.12 for ; Mon, 27 Jul 2020 10:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KqTJWlghm8hbSrvYH/wSR/fzYgdbbuaChV5qjhwMteM=; b=b0rAu1U014sI2AO2VeWvQFnUBn6TnTZR3eBNUHZyWLUcznS+S+K7K+3jS0vxB0zM0m +5DstfFBT1WJWQ3Fae6TqfmQZyfjyEA4Tx3Rw+LDAgAoqXr6Cn8DAca7WLPxn3TCETDD f+jaEmN0isWObVLBp0l4GfrGM43cZMqDYAQEM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KqTJWlghm8hbSrvYH/wSR/fzYgdbbuaChV5qjhwMteM=; b=tu+0PcRD9qTpD/FvszByx55bX4UYZW71QiGpMLC1nePW/ocRHnH3tQ2PvXvCtwAjQR TGjfYz3bWzDMXII3jedpjC1mXhyGwbJO9wKetBVJYwyYc/11nXjeu3y0LoUWrUv76hKH Z+eY1K7tnKNVjHMdirjp95WR7l1Mnu3smMzpE0S58zbjE0mrmDDWVT9ntGI742c8Xkgk 6RsUbWU0L2t0bLtSVAf4T8jUz+STMzD9s0+tWBkUrN0GskXb3AWcEr6alFuo0LiwxLju iCmEGR84sk0yfK9DrZ0HUDR+HhLNuAMGfBXJKLyr63xTL7uS3rSsf6tc7A7sq5VqVmKP qL7Q== X-Gm-Message-State: AOAM532zHvl9sL9PNGw62FcRFE7cnDoz3DgN692VB4XKfWUGMAJa/IKc RcVy9OCbEZPMwJBGdIe3GYgCV/cgmt4= X-Received: by 2002:ab0:1846:: with SMTP id j6mr7090989uag.130.1595871444718; Mon, 27 Jul 2020 10:37:24 -0700 (PDT) Received: from alain.c.googlers.com.com (252.177.243.35.bc.googleusercontent.com. [35.243.177.252]) by smtp.gmail.com with ESMTPSA id s25sm2870871vsj.13.2020.07.27.10.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 10:37:23 -0700 (PDT) From: Alain Michaud To: linux-bluetooth@vger.kernel.org Cc: Alain Michaud , Sonny Sasaka Subject: [Bluez PATCH] main: adding configurable eir_max_name_len Date: Mon, 27 Jul 2020 17:37:20 +0000 Message-Id: <20200727173720.2700327-1-alainm@chromium.org> X-Mailer: git-send-email 2.28.0.rc0.142.g3c755180ce-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change adds support for a configurable eir_max_name_len for platforms which requires a larger than 48 bytes complete name in EIR. From bluetoothctl: [bluetooth]# system-alias 012345678901234567890123456789012345678901234567890123456789 Changing 012345678901234567890123456789012345678901234567890123456789 succeeded [CHG] Controller DC:71:96:69:02:89 Alias: 012345678901234567890123456789012345678901234567890123456789 From btmon: < HCI Command: Write Local Name (0x03|0x0013) plen 248             #109 [hci0] 88.567990         Name: 012345678901234567890123456789012345678901234567890123456789 > HCI Event: Command Complete (0x0e) plen 4                                 #110 [hci0] 88.663854       Write Local Name (0x03|0x0013) ncmd 1         Status: Success (0x00) @ MGMT Event: Local Name Changed (0x0008) plen 260                {0x0004} [hci0] 88.663948         Name: 012345678901234567890123456789012345678901234567890123456789         Short name: < HCI Command: Write Extended Inquiry Response (0x03|0x0052) plen 241          FEC: Not required (0x00)         Name (complete): 012345678901234567890123456789012345678901234567890123456789         TX power: 12 dBm         Device ID: Bluetooth SIG assigned (0x0001)           Vendor: Google (224)           Product: 0xc405           Version: 0.5.6 (0x0056)         16-bit Service UUIDs (complete): 7 entries           Generic Access Profile (0x1800)           Generic Attribute Profile (0x1801)           Device Information (0x180a)           A/V Remote Control (0x110e)           A/V Remote Control Target (0x110c)           Handsfree Audio Gateway (0x111f)           Audio Source (0x110a) > HCI Event: Command Complete (0x0e) plen 4                                  Write Extended Inquiry Response (0x03|0x0052) ncmd 1         Status: Success (0x00) Reviewed-by: Sonny Sasaka Signed-off-by: Alain Michaud --- doc/mgmt-api.txt | 1 + src/adapter.c | 10 +++++++++- src/hcid.h | 1 + src/main.c | 5 +++++ src/main.conf | 5 +++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt index ca0d38469..1bc0f0c12 100644 --- a/doc/mgmt-api.txt +++ b/doc/mgmt-api.txt @@ -3279,6 +3279,7 @@ Read Default System Configuration Command 0x0019 LE Connection Latency 0x001a LE Connection Supervision Timeout 0x001b LE Autoconnect Timeout + 0x001c Max EIR Name Length This command can be used at any time and will return a list of supported default parameters as well as their current value. diff --git a/src/adapter.c b/src/adapter.c index 5e896a9f0..3adc67b63 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2375,7 +2375,7 @@ static bool parse_pathloss(DBusMessageIter *value, return true; } -static bool parse_transport(DBusMessageIter *value, +static bool parse_transport(DBusMessageIter *value, struct discovery_filter *filter) { char *transport_str; @@ -4435,6 +4435,14 @@ static void load_default_system_params(struct btd_adapter *adapter) len += sizeof(params[i].u16); } + if (main_opts.default_params.eir_max_name_len) { + params[i].entry.type = 0x001c; + params[i].entry.length = sizeof(params[i].u16); + params[i].u16 = main_opts.default_params.eir_max_name_len; + ++i; + len += sizeof(params[i].u16); + } + err = mgmt_send(adapter->mgmt, MGMT_OP_SET_DEF_SYSTEM_CONFIG, adapter->dev_id, len, params, NULL, NULL, NULL); if (!err) diff --git a/src/hcid.h b/src/hcid.h index 5f249ebf9..c9b59a374 100644 --- a/src/hcid.h +++ b/src/hcid.h @@ -93,6 +93,7 @@ struct main_opts { uint16_t le_conn_latency; uint16_t le_conn_lsto; uint16_t le_autoconnect_timeout; + uint16_t eir_max_name_len; } default_params; diff --git a/src/main.c b/src/main.c index ec7a9fbd7..74876e01d 100644 --- a/src/main.c +++ b/src/main.c @@ -123,6 +123,7 @@ static const char *controller_options[] = { "LEConnectionLatency", "LEConnectionSupervisionTimeout", "LEAutoconnecttimeout", + "EirMaxNameLength", NULL }; @@ -433,6 +434,10 @@ static void parse_controller_config(GKeyFile *config) &main_opts.default_params.le_autoconnect_timeout, 0x0001, 0x4000}, + { "EirMaxNameLength", + &main_opts.default_params.eir_max_name_len, + 0x0001, + 0x00EE}, }; uint16_t i; diff --git a/src/main.conf b/src/main.conf index f41203b96..7ecac5930 100644 --- a/src/main.conf +++ b/src/main.conf @@ -148,6 +148,11 @@ #LEConnectionSupervisionTimeout= #LEAutoconnecttimeout= +# EIR Max Name. This is the maximum length for the COMPLETE_NAME EIR section. +# If the name length exceeds this size, a SHORT_NAME section is used. +# Default: 48 +#EirMaxNameLength = 48 + [GATT] # GATT attribute cache. # Possible values: -- 2.28.0.rc0.142.g3c755180ce-goog