Return-Path: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) Subject: Re: [RFC v2 3/4] Bluetooth: Enable new LE meta event From: Marcel Holtmann In-Reply-To: <1403743975-31114-3-git-send-email-andre.guedes@openbossa.org> Date: Thu, 26 Jun 2014 08:57:19 +0200 Cc: linux-bluetooth@vger.kernel.org Message-Id: <33E8F9C2-CFF0-4555-94B9-0F1D0166472A@holtmann.org> References: <1403743975-31114-1-git-send-email-andre.guedes@openbossa.org> <1403743975-31114-3-git-send-email-andre.guedes@openbossa.org> To: Andre Guedes Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Andre, > The Bluetooth 4.1 introduces a new LE meta event called "LE Remote > Connection Parameter Request" event. In order to the controller sends > this event to host, we should enable it during controller initialization. > > Therefore, this patch enables that event in case the controller supports > Bluetooth 4.1 or upper version. > > Signed-off-by: Andre Guedes > --- > include/net/bluetooth/bluetooth.h | 1 + > net/bluetooth/hci_core.c | 7 +++++++ > 2 files changed, 8 insertions(+) > > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h > index 373000d..85dbc03 100644 > --- a/include/net/bluetooth/bluetooth.h > +++ b/include/net/bluetooth/bluetooth.h > @@ -38,6 +38,7 @@ > #define BLUETOOTH_VER_1_1 1 > #define BLUETOOTH_VER_1_2 2 > #define BLUETOOTH_VER_2_0 3 > +#define BLUETOOTH_VER_4_1 7 > > /* Reserv for core and drivers use */ > #define BT_SKB_RESERVE 8 > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c > index 9852449..a8b9d70 100644 > --- a/net/bluetooth/hci_core.c > +++ b/net/bluetooth/hci_core.c > @@ -1461,6 +1461,13 @@ static void hci_setup_event_mask(struct hci_request *req) > if (lmp_le_capable(hdev)) { > memset(events, 0, sizeof(events)); > events[0] = 0x1f; > + > + /* If Bluetooth 4.1 or upper version, enable LE Remote > + * Connection Parameter Request Event. > + */ > + if (hdev->hci_ver >= BLUETOOTH_VER_4_1) > + events[0] = events[0] | 0x20; > + we only fall back to Bluetooth version check in case we can not feature masks to determine if something is supported or not. Use the LE features mask to figure out if we support this or not. Regards Marcel