Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1414641ybf; Thu, 27 Feb 2020 10:30:43 -0800 (PST) X-Google-Smtp-Source: APXvYqzId0/sCbSFx5DWOLzFS0h5+Uos6XB3+8aLlrEu1bIfWWV5uBTEUH34bND8hmWypUO/D+bP X-Received: by 2002:a9d:6212:: with SMTP id g18mr186352otj.187.1582828243355; Thu, 27 Feb 2020 10:30:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582828243; cv=none; d=google.com; s=arc-20160816; b=nyZVF6rjfuOj1DxZa58WG3y30EeKh3d4TAnbop3XT07sjyzvIKclH8/uor6ZELZ7W5 99sCiK1Jw4mlz5+o+MkX9RXwfPLzZf7mTV2CSNgy/ck0lj3XtDvT2uelkIadLa/HZDWZ r3zQezuLfGfBZR60psMJ0n+iEB1LyXOYbWo6Ctv2NMfk7hQOt8m4nqnQXOph+4Cxcckk WzSveaFzgdOXCC9ATVTyKUUtFok3hLCS/9AkHSe1iF6WJSyGxn1B3Fg8QXlF+PQygtSW Fu8f4a0tlH7yd/xiHd0P4E0q9dO05428i/C7z76ie0cGtvpyGrs8jBRU4jrQcC9oVkcE s0mA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r62C7Q3pTZHe4INsya0MPDYTIKoY5w4JAKY+dBDHNY4=; b=AxSlUHc+ELKYpRo497rK+y5KiEipKUqX1cLc2zmHPGhaSKiltO/rzu0LOm/71TkusH lZi0SX+z7bWrV0rscSo2PlR6/KeuVUsCwBXvh4EaKTgjouS8DSQJHoICaMCqvHQ0giMQ 0N7eePMFLUVLUNO9npHhp8B6IIE9qcVq5c49QTFgVCfTFy6bCOul29KQKLiZrYjpq+xX UXffbWlKh/xGxr3q1KpQJoHjGEoY+mWCTDSgByHZu4fAYuvLdOSvThTAmMUKrC/D0PKK sQ6abVLRZpAm9qHJ9qYbbe9hB5vzMNHAjQNtRR6vqQ6zeom7QHIehBDN7Us6jxYmknnW o+Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SfbMAknz; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id e19si17466otl.145.2020.02.27.10.30.31; Thu, 27 Feb 2020 10:30:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SfbMAknz; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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 S1729986AbgB0Sa0 (ORCPT + 99 others); Thu, 27 Feb 2020 13:30:26 -0500 Received: from mail-vs1-f67.google.com ([209.85.217.67]:33733 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729258AbgB0Sa0 (ORCPT ); Thu, 27 Feb 2020 13:30:26 -0500 Received: by mail-vs1-f67.google.com with SMTP id n27so306619vsa.0 for ; Thu, 27 Feb 2020 10:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r62C7Q3pTZHe4INsya0MPDYTIKoY5w4JAKY+dBDHNY4=; b=SfbMAknz+1zu66KUb3C8bV0eJzoUBSkNnymelKjcPd0nNmPos4CG/K39SPz2Ns7ZTe HgvOJDQ14Q7N5Qa/cwYaOBV+FGqGXIqsvo+gZ2MgtgP0gIsqxn7QfSvaSXqEucb6JYeV UR6ON7NFtldsXXnAcB7+4dF8SXMxSWT1d7VSE= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=r62C7Q3pTZHe4INsya0MPDYTIKoY5w4JAKY+dBDHNY4=; b=ccNRM6dfeHwfZAX2MkFuF0MZ4LQSUEg1m0yQlS4hLPzGp+uYnOhciOw0FT+ggr1lSK MmkcbNV30/CIi06FHh33RwfDn2bHNHxSBzw5OVK6Ew7smllEby7nq2dyK8zPsehUBpUl l0UukxhT9NKSgJ1W2hV8S2KNpIaB3IxpppNEFVGD1LXz8XJbil8AUfrynz8EaqHTd7bx sOSFaM7qmYMyYpCP7X6ZogAXB7t+rH2dB1nmIrLiy0dIu6Wiw1mSS9Qq2utDEMno7Uyu ZJvHkhI4nwKUciZo7uCS8BkZS0gWgXydaIn7TiAUHYUEuPJXjCRrjZibdgkCwkp9x0DP 6IMA== X-Gm-Message-State: ANhLgQ3Ubkm1szSa+rIDORC3szdklpSjjA2I6zTz0BUqAkJrfus6385a x46uQ0leAOWFXS6MpPyuD+qWUQQ+GRSEpw== X-Received: by 2002:a05:6102:308b:: with SMTP id l11mr416843vsb.68.1582828224905; Thu, 27 Feb 2020 10:30:24 -0800 (PST) Received: from alain.c.googlers.com.com (39.119.74.34.bc.googleusercontent.com. [34.74.119.39]) by smtp.gmail.com with ESMTPSA id v21sm2274464vkd.54.2020.02.27.10.30.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 10:30:24 -0800 (PST) From: Alain Michaud To: linux-bluetooth@vger.kernel.org Cc: Alain Michaud Subject: [PATCH v1 3/3] bluetooth: Enable erroneous data reporting if wbs is supported Date: Thu, 27 Feb 2020 18:29:41 +0000 Message-Id: <20200227182938.110670-4-alainm@chromium.org> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog In-Reply-To: <20200227182938.110670-1-alainm@chromium.org> References: <20200227182938.110670-1-alainm@chromium.org> MIME-Version: 1.0 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 will enable erroneous data reporting if wide band speech is supported by the controller as indicated by the HCI_QUIRK_WIDE_BAND_SPEECH_SUPPORTED quirk. Signed-off-by: Alain Michaud --- include/net/bluetooth/hci.h | 7 +++++++ net/bluetooth/hci_core.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index b214c4358d1c..807fd40bb358 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -1095,6 +1095,13 @@ struct hci_rp_read_inq_rsp_tx_power { __s8 tx_power; } __packed; +#define HCI_OP_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING 0x0c5b + #define ERRONEOUS_DATA_REPORTING_DISABLED 0x00 + #define ERRONEOUS_DATA_REPORTING_ENABLED 0x01 +struct hci_cp_write_default_erroneous_data_reporting { + __u8 erroneous_data_reporting; +} __packed; + #define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63 #define HCI_OP_READ_LOCATION_DATA 0x0c64 diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 1ca7508b6ca7..19afb85ad399 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1382,6 +1382,29 @@ static void hci_dev_get_bd_addr_from_property(struct hci_dev *hdev) bacpy(&hdev->public_addr, &ba); } +static int hci_write_default_erroneous_data_req(struct hci_request *req, + unsigned long opt) +{ + struct hci_cp_write_default_erroneous_data_reporting cp = {}; + + cp.erroneous_data_reporting = (__u8)opt; + hci_req_add(req, HCI_OP_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING, + sizeof(cp), &cp); + return 0; +} + +static void hci_write_default_erroneous_data(struct hci_dev *hdev, + __u8 erroneous_data_reporting) +{ + int err = __hci_req_sync(hdev, + hci_write_default_erroneous_data_req, + erroneous_data_reporting, HCI_CMD_TIMEOUT, + NULL); + if (err) { + BT_ERR("HCI_OP_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING failed"); + } +} + static int hci_dev_do_open(struct hci_dev *hdev) { int ret = 0; @@ -1547,6 +1570,16 @@ static int hci_dev_do_open(struct hci_dev *hdev) set_bit(HCI_UP, &hdev->flags); hci_sock_dev_event(hdev, HCI_DEV_UP); hci_leds_update_powered(hdev, true); + + /* If the controller supports wide_band_speech, enable erroneous + * data reporting. + */ + if (test_bit(HCI_QUIRK_WIDE_BAND_SPEECH_SUPPORTED, + &hdev->quirks)) { + hci_write_default_erroneous_data(hdev, + ERRONEOUS_DATA_REPORTING_ENABLED); + } + if (!hci_dev_test_flag(hdev, HCI_SETUP) && !hci_dev_test_flag(hdev, HCI_CONFIG) && !hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && -- 2.25.1.481.gfbce0eb801-goog