* [PATCH 2/2] Bluetooth: Remove unnecessary stop_scan_complete function
From: johan.hedberg @ 2014-02-28 18:26 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393611973-3183-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
The stop_scan_complete function was used as an intermediate step before
doing the actual connection creation. Since we're using hci_request
there's no reason to have this extra function around, i.e. we can simply
put both HCI commands into the same request.
The single task that the intermediate function had, i.e. indicating
discovery as stopped is now taken care of by a new
HCI_LE_SCAN_INTERRUPTED flag which allows us to do the discovery state
update when the stop scan command completes.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
include/net/bluetooth/hci.h | 1 +
net/bluetooth/hci_conn.c | 51 +++++++--------------------------------------
net/bluetooth/hci_event.c | 7 +++++++
3 files changed, 16 insertions(+), 43 deletions(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 0409f0119d2b..be150cf8cd43 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -140,6 +140,7 @@ enum {
HCI_FAST_CONNECTABLE,
HCI_BREDR_ENABLED,
HCI_6LOWPAN_ENABLED,
+ HCI_LE_SCAN_INTERRUPTED,
};
/* A mask for the flags that are supposed to remain when a reset happens
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 5330fcfde93d..7c713c4675ba 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -605,44 +605,6 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
conn->state = BT_CONNECT;
}
-static void stop_scan_complete(struct hci_dev *hdev, u8 status)
-{
- struct hci_request req;
- struct hci_conn *conn;
- int err;
-
- conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT);
- if (!conn)
- return;
-
- if (status) {
- BT_DBG("HCI request failed to stop scanning: status 0x%2.2x",
- status);
-
- hci_dev_lock(hdev);
- hci_le_conn_failed(conn, status);
- hci_dev_unlock(hdev);
- return;
- }
-
- /* Since we may have prematurely stopped discovery procedure, we should
- * update discovery state.
- */
- hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
-
- hci_req_init(&req, hdev);
-
- hci_req_add_le_create_conn(&req, conn);
-
- err = hci_req_run(&req, create_le_conn_complete);
- if (err) {
- hci_dev_lock(hdev);
- hci_le_conn_failed(conn, HCI_ERROR_MEMORY_EXCEEDED);
- hci_dev_unlock(hdev);
- return;
- }
-}
-
struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
u8 dst_type, u8 sec_level, u8 auth_type)
{
@@ -721,16 +683,19 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
hci_req_init(&req, hdev);
/* If controller is scanning, we stop it since some controllers are
- * not able to scan and connect at the same time.
+ * not able to scan and connect at the same time. Also set the
+ * HCI_LE_SCAN_INTERRUPTED flag so that the command complete
+ * handler for scan disabling knows to set the correct discovery
+ * state.
*/
if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) {
hci_req_add_le_scan_disable(&req);
- err = hci_req_run(&req, stop_scan_complete);
- } else {
- hci_req_add_le_create_conn(&req, conn);
- err = hci_req_run(&req, create_le_conn_complete);
+ set_bit(HCI_LE_SCAN_INTERRUPTED, &hdev->dev_flags);
}
+ hci_req_add_le_create_conn(&req, conn);
+
+ err = hci_req_run(&req, create_le_conn_complete);
if (err) {
hci_conn_del(conn);
return ERR_PTR(err);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index e3335b03c992..c3b0a08f5ab4 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1024,6 +1024,13 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
cancel_delayed_work(&hdev->le_scan_disable);
clear_bit(HCI_LE_SCAN, &hdev->dev_flags);
+ /* The HCI_LE_SCAN_INTERRUPTED flag indicates that we
+ * interrupted scanning due to a connect request. Mark
+ * therefore discovery as stopped.
+ */
+ if (test_and_clear_bit(HCI_LE_SCAN_INTERRUPTED,
+ &hdev->dev_flags))
+ hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
break;
default:
--
1.8.5.3
^ permalink raw reply related
* Re: [PATCH 2/2] Bluetooth: Remove unnecessary stop_scan_complete function
From: Marcel Holtmann @ 2014-02-28 18:39 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth
In-Reply-To: <1393611973-3183-2-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
> The stop_scan_complete function was used as an intermediate step before
> doing the actual connection creation. Since we're using hci_request
> there's no reason to have this extra function around, i.e. we can simply
> put both HCI commands into the same request.
>
> The single task that the intermediate function had, i.e. indicating
> discovery as stopped is now taken care of by a new
> HCI_LE_SCAN_INTERRUPTED flag which allows us to do the discovery state
> update when the stop scan command completes.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> include/net/bluetooth/hci.h | 1 +
> net/bluetooth/hci_conn.c | 51 +++++++--------------------------------------
> net/bluetooth/hci_event.c | 7 +++++++
> 3 files changed, 16 insertions(+), 43 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: Fix trying to disable scanning twice
From: Marcel Holtmann @ 2014-02-28 18:39 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth
In-Reply-To: <1393611973-3183-1-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
> The discovery process has a timer for disabling scanning, however
> scanning might be disabled through other means too like the auto-connect
> process. We should therefore ensure that the timer is never active
> after sending a HCI command to disable scanning.
>
> There was some existing code in stop_scan_complete trying to avoid the
> timer when a connect request interrupts a discovery procedure, but the
> other way around was not covered. This patch covers both scenarios by
> canceling the timer as soon as we get a successful command complete for
> the disabling HCI command.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/hci_conn.c | 1 -
> net/bluetooth/hci_event.c | 5 +++++
> 2 files changed, 5 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* [PATCH 0/6] Initial HAL test AVRCP api support
From: Ravi kumar Veeramally @ 2014-02-28 18:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
Patchset contains initial AVRCP api support for HAL test.
Ravi kumar Veeramally (6):
android/client: Add AVRCP get_play_status_rsp support
android/client: Add AVRCP get_element_attr_rsp support
android/client: Add AVRCP set_volume support
android/client: Add AVRCP get_play_status_cb support
android/client: Add AVRCP get_element_attr_cb support
android/client: Add AVRCP volume_change_cb support
android/client/if-rc.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 151 insertions(+)
--
1.8.3.2
^ permalink raw reply
* [PATCH 1/6] android/client: Add AVRCP get_play_status_rsp support
From: Ravi kumar Veeramally @ 2014-02-28 18:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1393613928-22264-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/client/if-rc.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 58fb892..7da26e6 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -15,11 +15,27 @@
*
*/
+#include<stdio.h>
+#include<ctype.h>
+
+#include<hardware/bluetooth.h>
+#include<hardware/bt_hh.h>
+
#include "if-main.h"
+#include "pollhandler.h"
#include "../hal-utils.h"
const btrc_interface_t *if_rc = NULL;
+SINTMAP(btrc_play_status_t, -1, "(unknown)")
+ DELEMENT(BTRC_PLAYSTATE_STOPPED),
+ DELEMENT(BTRC_PLAYSTATE_PLAYING),
+ DELEMENT(BTRC_PLAYSTATE_PAUSED),
+ DELEMENT(BTRC_PLAYSTATE_FWD_SEEK),
+ DELEMENT(BTRC_PLAYSTATE_REV_SEEK),
+ DELEMENT(BTRC_PLAYSTATE_ERROR),
+ENDMAP
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
};
@@ -33,6 +49,46 @@ static void init_p(int argc, const char **argv)
EXEC(if_rc->init, &rc_cbacks);
}
+/* get_play_status_rsp */
+
+static void get_play_status_rsp_c(int argc, const char **argv,
+ enum_func *enum_func, void **user)
+{
+ if (argc == 3) {
+ *user = TYPE_ENUM(btrc_play_status_t);
+ *enum_func = enum_defines;
+ }
+}
+
+static void get_play_status_rsp_p(int argc, const char **argv)
+{
+ btrc_play_status_t play_status;
+ uint32_t song_len, song_pos;
+
+ RETURN_IF_NULL(if_rc);
+
+ if (argc <= 2) {
+ haltest_error("No play status specified");
+ return;
+ }
+
+ if (argc <= 3) {
+ haltest_error("No song length specified");
+ return;
+ }
+
+ if (argc <= 4) {
+ haltest_error("No song position specified");
+ return;
+ }
+
+ play_status = str2btrc_play_status_t(argv[2]);
+ song_len = (uint32_t) atoi(argv[3]);
+ song_pos = (uint32_t) atoi(argv[4]);
+
+ EXEC(if_rc->get_play_status_rsp, play_status, song_len, song_pos);
+}
+
/* cleanup */
static void cleanup_p(int argc, const char **argv)
@@ -45,6 +101,8 @@ static void cleanup_p(int argc, const char **argv)
static struct method methods[] = {
STD_METHOD(init),
+ STD_METHODCH(get_play_status_rsp,
+ "<play_status> <song_len> <song_pos>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2
^ permalink raw reply related
* [PATCH 2/6] android/client: Add AVRCP get_element_attr_rsp support
From: Ravi kumar Veeramally @ 2014-02-28 18:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1393613928-22264-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/client/if-rc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 7da26e6..5625e56 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -36,6 +36,16 @@ SINTMAP(btrc_play_status_t, -1, "(unknown)")
DELEMENT(BTRC_PLAYSTATE_ERROR),
ENDMAP
+SINTMAP(btrc_media_attr_t, -1, "(unknown)")
+ DELEMENT(BTRC_MEDIA_ATTR_TITLE),
+ DELEMENT(BTRC_MEDIA_ATTR_ARTIST),
+ DELEMENT(BTRC_MEDIA_ATTR_ALBUM),
+ DELEMENT(BTRC_MEDIA_ATTR_TRACK_NUM),
+ DELEMENT(BTRC_MEDIA_ATTR_NUM_TRACKS),
+ DELEMENT(BTRC_MEDIA_ATTR_GENRE),
+ DELEMENT(BTRC_MEDIA_ATTR_PLAYING_TIME),
+ENDMAP
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
};
@@ -89,6 +99,41 @@ static void get_play_status_rsp_p(int argc, const char **argv)
EXEC(if_rc->get_play_status_rsp, play_status, song_len, song_pos);
}
+/* get_element_attr_rsp */
+
+static void get_element_attr_rsp_c(int argc, const char **argv,
+ enum_func *enum_func, void **user)
+{
+ if (argc == 4) {
+ *user = TYPE_ENUM(btrc_media_attr_t);
+ *enum_func = enum_defines;
+ }
+}
+
+static void get_element_attr_rsp_p(int argc, const char **argv)
+{
+ uint8_t num_attr;
+ btrc_element_attr_val_t attrs;
+
+ RETURN_IF_NULL(if_rc);
+
+ if (argc <= 2) {
+ haltest_error("No number of attributes specified");
+ return;
+ }
+
+ if (argc <= 4) {
+ haltest_error("No attr id and value specified");
+ return;
+ }
+
+ num_attr = (uint8_t) atoi(argv[2]);
+ attrs.attr_id = str2btrc_media_attr_t(argv[3]);
+ strcpy((char *)attrs.text, argv[4]);
+
+ EXEC(if_rc->get_element_attr_rsp, num_attr, &attrs);
+}
+
/* cleanup */
static void cleanup_p(int argc, const char **argv)
@@ -103,6 +148,7 @@ static struct method methods[] = {
STD_METHOD(init),
STD_METHODCH(get_play_status_rsp,
"<play_status> <song_len> <song_pos>"),
+ STD_METHODCH(get_element_attr_rsp, "<num_attr> <attrs_id> <value>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2
^ permalink raw reply related
* [PATCH 3/6] android/client: Add AVRCP set_volume support
From: Ravi kumar Veeramally @ 2014-02-28 18:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1393613928-22264-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/client/if-rc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 5625e56..5aab8e0 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -134,6 +134,29 @@ static void get_element_attr_rsp_p(int argc, const char **argv)
EXEC(if_rc->get_element_attr_rsp, num_attr, &attrs);
}
+/* set_volume */
+
+static void set_volume_c(int argc, const char **argv,
+ enum_func *enum_func, void **user)
+{
+}
+
+static void set_volume_p(int argc, const char **argv)
+{
+ uint8_t volume;
+
+ RETURN_IF_NULL(if_rc);
+
+ if (argc <= 2) {
+ haltest_error("No volume specified");
+ return;
+ }
+
+ volume = (uint8_t) atoi(argv[2]);
+
+ EXEC(if_rc->set_volume, volume);
+}
+
/* cleanup */
static void cleanup_p(int argc, const char **argv)
@@ -149,6 +172,7 @@ static struct method methods[] = {
STD_METHODCH(get_play_status_rsp,
"<play_status> <song_len> <song_pos>"),
STD_METHODCH(get_element_attr_rsp, "<num_attr> <attrs_id> <value>"),
+ STD_METHODCH(set_volume, "<volume>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2
^ permalink raw reply related
* [PATCH 4/6] android/client: Add AVRCP get_play_status_cb support
From: Ravi kumar Veeramally @ 2014-02-28 18:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1393613928-22264-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/client/if-rc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 5aab8e0..b8174dd 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -46,8 +46,14 @@ SINTMAP(btrc_media_attr_t, -1, "(unknown)")
DELEMENT(BTRC_MEDIA_ATTR_PLAYING_TIME),
ENDMAP
+static void get_play_status_cb(void)
+{
+ haltest_info("%s", __func__);
+}
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
+ .get_play_status_cb = get_play_status_cb,
};
/* init */
--
1.8.3.2
^ permalink raw reply related
* [PATCH 5/6] android/client: Add AVRCP get_element_attr_cb support
From: Ravi kumar Veeramally @ 2014-02-28 18:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1393613928-22264-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/client/if-rc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index b8174dd..57f7082 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -51,9 +51,20 @@ static void get_play_status_cb(void)
haltest_info("%s", __func__);
}
+static void get_element_attr_cb(uint8_t num_attr, btrc_media_attr_t *attrs)
+{
+ uint8_t i;
+
+ haltest_info("%s, num_of_attributes=%d", __func__, num_attr);
+
+ for (i = 0; i < num_attr; i++)
+ haltest_info("attr id=%s", btrc_media_attr_t2str(attrs[i]));
+}
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
.get_play_status_cb = get_play_status_cb,
+ .get_element_attr_cb = get_element_attr_cb,
};
/* init */
--
1.8.3.2
^ permalink raw reply related
* [PATCH 6/6] android/client: Add AVRCP volume_change_cb support
From: Ravi kumar Veeramally @ 2014-02-28 18:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1393613928-22264-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/client/if-rc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 57f7082..02e1de3 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -61,10 +61,16 @@ static void get_element_attr_cb(uint8_t num_attr, btrc_media_attr_t *attrs)
haltest_info("attr id=%s", btrc_media_attr_t2str(attrs[i]));
}
+static void volume_change_cb(uint8_t volume, uint8_t ctype)
+{
+ haltest_info("%s, volume=%d ctype=%d", __func__, volume, ctype);
+}
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
.get_play_status_cb = get_play_status_cb,
.get_element_attr_cb = get_element_attr_cb,
+ .volume_change_cb = volume_change_cb,
};
/* init */
--
1.8.3.2
^ permalink raw reply related
* pull request: bluetooth-next 2014-02-28
From: Gustavo Padovan @ 2014-02-28 19:38 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, linux-bluetooth, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 6291 bytes --]
Hi John,
Another pull request to 3.15. Here we have the second part of the LE private
feature, the LE auto-connect feature and improvements to the power off
procedures. The rest are small improvements, clean up, and fixes.
Please pull or let me know of any problem. Thanks.
Gustavo
---
The following changes since commit 668b7b19820b0801c425d31cc27fd6f499050e5c:
Bluetooth: Fix iterating wrong list in hci_remove_irk() (2014-02-21 11:07:46 -0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git for-upstream
for you to fetch changes up to 81ad6fd9698f659dbabdc6cd3e1667a98eb2be3b:
Bluetooth: Remove unnecessary stop_scan_complete function (2014-02-28 10:28:17 -0800)
----------------------------------------------------------------
Andre Guedes (17):
Bluetooth: Create hci_req_add_le_scan_disable helper
Bluetooth: Declare le_conn_failed in hci_core.h
Bluetooth: Stop scanning on LE connection
Bluetooth: Remove unused function
Bluetooth: Refactor HCI connection code
Bluetooth: Move address type conversion to outside hci_connect_le
Bluetooth: Introduce hdev->pend_le_conn list
Bluetooth: Introduce LE auto connection infrastructure
Bluetooth: Introduce LE auto connect options
Bluetooth: Connection parameters and auto connection
Bluetooth: Temporarily stop background scanning on discovery
Bluetooth: Auto connection and power on
Bluetooth: Connection parameters and resolvable address
Bluetooth: Support resolvable private addresses
Bluetooth: Add le_auto_conn file on debugfs
Bluetooth: Create hci_req_add_le_passive_scan helper
Bluetooth: Update background scan parameters
Andrzej Kaczmarek (1):
Bluetooth: Fix NULL pointer dereference when sending data
Johan Hedberg (47):
Bluetooth: Add helper variables to smp_distribute_keys()
Bluetooth: Add initial code for distributing local IRK
Bluetooth: Move enable/disable_advertising higher up in mgmt.c
Bluetooth: Add mgmt defines for privacy
Bluetooth: Add Privacy flag to mgmt supported/current settings
Bluetooth: Ensure hci_conn always contains the local identity address
Bluetooth: Set the correct values for Identity Address Information
Bluetooth: Add SMP function for generating RPAs
Bluetooth: Add timer for regenerating local RPA
Bluetooth: Add hci_update_random_address() convenience function
Bluetooth: Use hci_update_random_address() when connecting LE
Bluetooth: Use hci_update_random_address() for enabling advertising
Bluetooth: Use hci_update_random_address() for initiating LE scan
Bluetooth: Don't write static address during power on
Bluetooth: Add debugfs entry for RPA regeneration timeout
Bluetooth: Add support for Set Privacy command
Bluetooth: Fix setting correct src_type when connecting LE
Bluetooth: Remove unneeded hdev->own_addr_type
Bluetooth: Enable RPA resolving if mgmt_set_privacy is called
Bluetooth: Fix canceling RPA expiry timer
Bluetooth: Add convenience function for getting total connection count
Bluetooth: Move HCI_ADVERTISING handling into mgmt.c
Bluetooth: Move check for MGMT_CONNECTED flag into mgmt.c
Bluetooth: Don't clear HCI_DISCOVERABLE when powering off
Bluetooth: Don't clear HCI_CONNECTABLE when powering off
Bluetooth: Don't clear HCI_ADVERTISING when powering off
Bluetooth: Clean up HCI state when doing power off
Bluetooth: Fix advertising address type when toggling connectable
Bluetooth: Ignore IRKs with no Identity Address
Bluetooth: Track not yet received keys in SMP
Bluetooth: Simplify logic for checking for SMP completion
Bluetooth: Remove unneeded "force" parameter from smp_distribute_keys()
Bluetooth: Add tracking of advertising address type
Bluetooth: Add hci_copy_identity_address convenience function
Bluetooth: Fix disconnecting connections in non-connected states
Bluetooth: Add timer to force power off
Bluetooth: Fix clearing SMP keys if pairing fails
Bluetooth: Add protections for updating local random address
Bluetooth: Fix updating connection state to BT_CONNECT too early
Bluetooth: Track LE initiator and responder address information
Bluetooth: Use hdev->init/resp_addr values for smp_c1 function
Bluetooth: Add defines for LE initiator filter policy
Bluetooth: Add timeout for LE connection attempts
Bluetooth: Re-encrypt link after receiving an LTK
Bluetooth: Delay LTK encryption to let remote receive all keys
Bluetooth: Fix trying to disable scanning twice
Bluetooth: Remove unnecessary stop_scan_complete function
Lukasz Rymanowski (1):
Bluetooth: Fix response on confirm_name
Marcel Holtmann (12):
Bluetooth: Fix issue with missing management event opcode
Bluetooth: Expose current identity information in debugfs
Bluetooth: Use unresolvable private address for active scanning
Bluetooth: Use privacy mode for non-connectable advertising
Bluetooth: Store current RPA and update it if needed
Bluetooth: Export current local RPA with identity information
Bluetooth: Make hci_blacklist_clear function static
Bluetooth: Add definitions for LE white list HCI commands
Bluetooth: Clear all LE white list entries when powering controller
Bluetooth: Add support for storing LE white list entries
Bluetooth: Track LE white list modification via HCI commands
Bluetooth: Use __le64 type for LE random numbers
include/net/bluetooth/hci.h | 27 +-
include/net/bluetooth/hci_core.h | 78 ++++-
include/net/bluetooth/mgmt.h | 10 +-
net/bluetooth/hci_conn.c | 116 ++++----
net/bluetooth/hci_core.c | 679 ++++++++++++++++++++++++++++++++++++++++---
net/bluetooth/hci_event.c | 274 ++++++++++++++++-
net/bluetooth/l2cap_core.c | 37 ++-
net/bluetooth/mgmt.c | 425 ++++++++++++++++++++++-----
net/bluetooth/smp.c | 180 +++++++++---
net/bluetooth/smp.h | 11 +-
10 files changed, 1585 insertions(+), 252 deletions(-)
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] bluetooth: ath3k: added Atheros AR3012 with ID 0x0b05:0x17d0
From: Bela Hausmann @ 2014-02-28 20:26 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <0F2EE81A-0DB1-44DF-8EFD-F0835B090B7E@holtmann.org>
Hi Marcel,
I would, but I just now noticed that you already added this device ID
a few days ago in commit a735f9e22432899cee188d167966782c29246390 to
linux-next [1]. Thank you!
Best wishes,
Bela
[1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit=
/drivers/bluetooth?id=3Da735f9e22432899cee188d167966782c29246390
2014-02-28 0:19 GMT+01:00 Marcel Holtmann <marcel@holtmann.org>:
> Hi Bela,
>
>> Hi Marcel,
>>
>> sorry for the messed up tabs.
>>
>> Here is /sys/kernel/debug/usb/devices:
>> T: Bus=3D02 Lev=3D02 Prnt=3D02 Port=3D03 Cnt=3D02 Dev#=3D 4 Spd=3D12 =
MxCh=3D 0
>> D: Ver=3D 1.10 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 MxPS=3D64 #Cfgs=3D 1
>> P: Vendor=3D0b05 ProdID=3D17d0 Rev=3D 0.02
>> C:* #Ifs=3D 2 Cfg#=3D 1 Atr=3De0 MxPwr=3D100mA
>> I:* If#=3D 0 Alt=3D 0 #EPs=3D 3 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 Drive=
r=3Dbtusb
>> E: Ad=3D81(I) Atr=3D03(Int.) MxPS=3D 16 Ivl=3D1ms
>> E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 64 Ivl=3D0ms
>> E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 64 Ivl=3D0ms
>> I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 Drive=
r=3Dbtusb
>> E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 0 Ivl=3D1ms
>> E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 0 Ivl=3D1ms
>> I: If#=3D 1 Alt=3D 1 #EPs=3D 2 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 Drive=
r=3Dbtusb
>> E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 9 Ivl=3D1ms
>> E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 9 Ivl=3D1ms
>> I: If#=3D 1 Alt=3D 2 #EPs=3D 2 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 Drive=
r=3Dbtusb
>> E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 17 Ivl=3D1ms
>> E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 17 Ivl=3D1ms
>> I: If#=3D 1 Alt=3D 3 #EPs=3D 2 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 Drive=
r=3Dbtusb
>> E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 25 Ivl=3D1ms
>> E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 25 Ivl=3D1ms
>> I: If#=3D 1 Alt=3D 4 #EPs=3D 2 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 Drive=
r=3Dbtusb
>> E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 33 Ivl=3D1ms
>> E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 33 Ivl=3D1ms
>> I: If#=3D 1 Alt=3D 5 #EPs=3D 2 Cls=3De0(wlcon) Sub=3D01 Prot=3D01 Drive=
r=3Dbtusb
>> E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 49 Ivl=3D1ms
>> E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 49 Ivl=3D1ms
>>
>> An again the patch.
>>
>> Best wishes,
>> Bela
>
> why don=E2=80=99t you use git-format-patch and git-send-email. Just save =
the email you send as raw text and see what happens if you apply it with gi=
t-am and then look at git-log.
>
> Regards
>
> Marcel
>
^ permalink raw reply
* [PATCHv3 1/6] shared/hfp: Add prefix handlers functionality
From: Marcin Kraglak @ 2014-02-28 20:33 UTC (permalink / raw)
To: linux-bluetooth
Add two functions: hfp_gw_register_prefix_handler() and
hfp_gw_unregister_prefix_handler(). It will allow user to register for
specific command. Current implementation just put/remove handler data
from queue.
---
Makefile.tools | 1 +
src/shared/hfp.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/shared/hfp.h | 19 +++++++++++
3 files changed, 120 insertions(+)
diff --git a/Makefile.tools b/Makefile.tools
index 9f7ba9f..31e1093 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -63,6 +63,7 @@ emulator_hfp_SOURCES = emulator/hfp.c \
monitor/mainloop.h monitor/mainloop.c \
src/shared/io.h src/shared/io-mainloop.c \
src/shared/util.h src/shared/util.c \
+ src/shared/queue.h src/shared/queue.c \
src/shared/ringbuf.h src/shared/ringbuf.c \
src/shared/hfp.h src/shared/hfp.c
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 854cf46..aecd246 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -32,6 +32,7 @@
#include "src/shared/util.h"
#include "src/shared/ringbuf.h"
+#include "src/shared/queue.h"
#include "src/shared/io.h"
#include "src/shared/hfp.h"
@@ -42,6 +43,7 @@ struct hfp_gw {
struct io *io;
struct ringbuf *read_buf;
struct ringbuf *write_buf;
+ struct queue *prefix_handlers;
bool writer_active;
bool permissive_syntax;
bool result_pending;
@@ -60,6 +62,37 @@ struct hfp_gw {
bool destroyed;
};
+struct prefix_handler_data {
+ char *prefix;
+ void *user_data;
+ hfp_destroy_func_t destroy;
+ hfp_result_func_t callback;
+};
+
+static void destroy_prefix_handler_data(void *data)
+{
+ struct prefix_handler_data *handler = data;
+
+ if (handler->destroy)
+ handler->destroy(handler->user_data);
+
+ free(handler);
+}
+
+static bool match_handler_prefix(const void *a, const void *b)
+{
+ const struct prefix_handler_data *handler = a;
+ const char *prefix = b;
+
+ if (strlen(handler->prefix) != strlen(prefix))
+ return false;
+
+ if (memcmp(handler->prefix, prefix, strlen(prefix)))
+ return false;
+
+ return true;
+}
+
static void write_watch_destroy(void *user_data)
{
struct hfp_gw *hfp = user_data;
@@ -196,8 +229,19 @@ struct hfp_gw *hfp_gw_new(int fd)
return NULL;
}
+ hfp->prefix_handlers = queue_new();
+ if (!hfp->prefix_handlers) {
+ io_destroy(hfp->io);
+ ringbuf_free(hfp->write_buf);
+ ringbuf_free(hfp->read_buf);
+ free(hfp);
+ return NULL;
+ }
+
if (!io_set_read_handler(hfp->io, can_read_data,
hfp, read_watch_destroy)) {
+ queue_destroy(hfp->prefix_handlers,
+ destroy_prefix_handler_data);
io_destroy(hfp->io);
ringbuf_free(hfp->write_buf);
ringbuf_free(hfp->read_buf);
@@ -250,6 +294,9 @@ void hfp_gw_unref(struct hfp_gw *hfp)
ringbuf_free(hfp->write_buf);
hfp->write_buf = NULL;
+ queue_destroy(hfp->prefix_handlers, destroy_prefix_handler_data);
+ hfp->prefix_handlers = NULL;
+
if (!hfp->in_disconnect) {
free(hfp);
return;
@@ -405,6 +452,59 @@ bool hfp_gw_set_command_handler(struct hfp_gw *hfp,
return true;
}
+bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
+ hfp_result_func_t callback,
+ const char *prefix,
+ void *user_data,
+ hfp_destroy_func_t destroy)
+{
+ struct prefix_handler_data *handler;
+
+ handler = new0(struct prefix_handler_data, 1);
+ if (!handler)
+ return false;
+
+ handler->callback = callback;
+ handler->user_data = user_data;
+
+ handler->prefix = strdup(prefix);
+ if (!handler->prefix) {
+ free(handler);
+ return false;
+ }
+
+ if (queue_find(hfp->prefix_handlers, match_handler_prefix,
+ handler->prefix)) {
+ destroy_prefix_handler_data(handler);
+ return false;
+ }
+
+ handler->destroy = destroy;
+
+ return queue_push_tail(hfp->prefix_handlers, handler);
+}
+
+bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix)
+{
+ struct prefix_handler_data *handler;
+ char *lookup_prefix;
+
+ lookup_prefix = strdup(prefix);
+ if (!lookup_prefix)
+ return false;
+
+ handler = queue_remove_if(hfp->prefix_handlers, match_handler_prefix,
+ lookup_prefix);
+ free(lookup_prefix);
+
+ if (!handler)
+ return false;
+
+ destroy_prefix_handler_data(handler);
+
+ return true;
+}
+
static void disconnect_watch_destroy(void *user_data)
{
struct hfp_gw *hfp = user_data;
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index b0bd934..dee80d9 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -60,6 +60,18 @@ enum hfp_error {
HFP_ERROR_NETWORK_NOT_ALLOWED = 32,
};
+enum hfp_cmd_type {
+ HFP_AT_READ,
+ HFP_AT_SET,
+ HFP_AT_TEST,
+ HFP_AT_COMMAND
+};
+
+struct hfp_gw_result;
+
+typedef void (*hfp_result_func_t)(struct hfp_gw_result *result,
+ enum hfp_cmd_type type, void *user_data);
+
typedef void (*hfp_destroy_func_t)(void *user_data);
typedef void (*hfp_debug_func_t)(const char *str, void *user_data);
@@ -94,3 +106,10 @@ bool hfp_gw_set_disconnect_handler(struct hfp_gw *hfp,
hfp_destroy_func_t destroy);
bool hfp_gw_disconnect(struct hfp_gw *hfp);
+
+bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
+ hfp_result_func_t callback,
+ const char *prefix,
+ void *user_data,
+ hfp_destroy_func_t destroy);
+bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv3 2/6] shared/hfp: Add implementiation of processing commands
From: Marcin Kraglak @ 2014-02-28 20:33 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393619636-23762-1-git-send-email-marcin.kraglak@tieto.com>
It will look for prefix handler for given cammand.
---
src/shared/hfp.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 94 insertions(+), 4 deletions(-)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index aecd246..8feaf16 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
+#include <ctype.h>
#include "src/shared/util.h"
#include "src/shared/ringbuf.h"
@@ -69,6 +70,11 @@ struct prefix_handler_data {
hfp_result_func_t callback;
};
+struct hfp_gw_result {
+ const char *data;
+ int offset;
+};
+
static void destroy_prefix_handler_data(void *data)
{
struct prefix_handler_data *handler = data;
@@ -130,6 +136,88 @@ static void wakeup_writer(struct hfp_gw *hfp)
hfp->writer_active = true;
}
+static void skip_whitespace(struct hfp_gw_result *result)
+{
+ while (result->data[result->offset] == ' ')
+ result->offset++;
+}
+
+static bool call_prefix_handler(struct hfp_gw *hfp, const char *data)
+{
+ struct prefix_handler_data *handler;
+ const char *separators = ";?=\0";
+ struct hfp_gw_result result;
+ enum hfp_cmd_type type;
+ char lookup_prefix[18];
+ uint8_t pref_len = 0;
+ const char *prefix;
+ int i;
+
+ result.offset = 0;
+ result.data = data;
+
+ skip_whitespace(&result);
+
+ if (strlen(data + result.offset) < 3)
+ return false;
+
+ if (strncmp(data + result.offset, "AT", 2))
+ if (strncmp(data + result.offset, "at", 2))
+ return false;
+
+ result.offset += 2;
+ prefix = data + result.offset;
+
+ if (isalpha(prefix[0])) {
+ lookup_prefix[pref_len++] = toupper(prefix[0]);
+ } else {
+ pref_len = strcspn(prefix, separators);
+ if (pref_len > 17 || pref_len < 2)
+ return false;
+
+ for (i = 0; i < pref_len; i++)
+ lookup_prefix[i] = toupper(prefix[i]);
+ }
+
+ lookup_prefix[pref_len] = '\0';
+ result.offset += pref_len;
+
+ if (lookup_prefix[0] == 'D') {
+ type = HFP_AT_SET;
+ goto done;
+ }
+
+ if (data[result.offset] == '=') {
+ result.offset++;
+ if (data[result.offset] == '?') {
+ result.offset++;
+ type = HFP_AT_TEST;
+ } else {
+ type = HFP_AT_SET;
+ }
+ goto done;
+ }
+
+ if (data[result.offset] == '?') {
+ result.offset++;
+ type = HFP_AT_READ;
+ goto done;
+ }
+
+ type = HFP_AT_COMMAND;
+
+done:
+
+ handler = queue_find(hfp->prefix_handlers, match_handler_prefix,
+ lookup_prefix);
+ if (!handler)
+ return false;
+
+ handler->callback(&result, type, handler->user_data);
+
+ return true;
+}
+
static void process_input(struct hfp_gw *hfp)
{
char *str, *ptr;
@@ -162,10 +250,12 @@ static void process_input(struct hfp_gw *hfp)
hfp->result_pending = true;
- if (hfp->command_callback)
- hfp->command_callback(str, hfp->command_data);
- else
- hfp_gw_send_result(hfp, HFP_RESULT_ERROR);
+ if (!call_prefix_handler(hfp, str)) {
+ if (hfp->command_callback)
+ hfp->command_callback(str, hfp->command_data);
+ else
+ hfp_gw_send_result(hfp, HFP_RESULT_ERROR);
+ }
len = ringbuf_drain(hfp->read_buf, count + 1);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv3 3/6] shared/hfp: Add get_number implementation
From: Marcin Kraglak @ 2014-02-28 20:33 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393619636-23762-1-git-send-email-marcin.kraglak@tieto.com>
User can call this function with hfp_gw_result, which will
be passed to prefix handler.
---
src/shared/hfp.c | 33 +++++++++++++++++++++++++++++++++
src/shared/hfp.h | 2 ++
2 files changed, 35 insertions(+)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 8feaf16..d168ac4 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -218,6 +218,39 @@ done:
return true;
}
+static void next_field(struct hfp_gw_result *result)
+{
+ if (result->data[result->offset] == ',')
+ result->offset++;
+}
+
+bool hfp_gw_result_get_number(struct hfp_gw_result *result, int *val)
+{
+ int temp = 0;
+ int i;
+
+ skip_whitespace(result);
+
+ i = result->offset;
+
+ while (result->data[i] >= '0' && result->data[i] <= '9') {
+ temp *= 10;
+ temp += result->data[i++] - '0';
+ }
+
+ if (i == result->offset)
+ return false;
+
+ if (val)
+ *val = temp;
+ result->offset = i;
+
+ skip_whitespace(result);
+ next_field(result);
+
+ return true;
+}
+
static void process_input(struct hfp_gw *hfp)
{
char *str, *ptr;
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index dee80d9..37d5c9b 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -113,3 +113,5 @@ bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
void *user_data,
hfp_destroy_func_t destroy);
bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix);
+
+bool hfp_gw_result_get_number(struct hfp_gw_result *result, int *val);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv3 4/6] shared/hfp: Add open/close container function
From: Marcin Kraglak @ 2014-02-28 20:33 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393619636-23762-1-git-send-email-marcin.kraglak@tieto.com>
It will look for "(" or ")" parenthesis and skip it if found.
---
src/shared/hfp.c | 26 ++++++++++++++++++++++++++
src/shared/hfp.h | 2 ++
2 files changed, 28 insertions(+)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index d168ac4..807ddf2 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -251,6 +251,32 @@ bool hfp_gw_result_get_number(struct hfp_gw_result *result, int *val)
return true;
}
+bool hfp_gw_result_open_container(struct hfp_gw_result *result)
+{
+ skip_whitespace(result);
+
+ /* The list shall be preceded by a left parenthesis "(") */
+ if (result->data[result->offset] != '(')
+ return false;
+
+ result->offset++;
+
+ return true;
+}
+
+bool hfp_gw_result_close_container(struct hfp_gw_result *result)
+{
+ skip_whitespace(result);
+
+ /* The list shall be followed by a right parenthesis (")" V250 5.7.3.1*/
+ if (result->data[result->offset] != ')')
+ return false;
+
+ result->offset++;
+
+ return true;
+}
+
static void process_input(struct hfp_gw *hfp)
{
char *str, *ptr;
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index 37d5c9b..dcde28f 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -115,3 +115,5 @@ bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix);
bool hfp_gw_result_get_number(struct hfp_gw_result *result, int *val);
+bool hfp_gw_result_open_container(struct hfp_gw_result *result);
+bool hfp_gw_result_close_container(struct hfp_gw_result *result);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv3 5/6] shared/hfp: Add function to get string
From: Marcin Kraglak @ 2014-02-28 20:33 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393619636-23762-1-git-send-email-marcin.kraglak@tieto.com>
It will look for quoted sting and write it to given buffer.
---
src/shared/hfp.c | 33 +++++++++++++++++++++++++++++++++
src/shared/hfp.h | 2 ++
2 files changed, 35 insertions(+)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 807ddf2..4d3bdc9 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -277,6 +277,39 @@ bool hfp_gw_result_close_container(struct hfp_gw_result *result)
return true;
}
+bool hfp_gw_result_get_string(struct hfp_gw_result *result, char *buf,
+ uint8_t len)
+{
+ int i = 0;
+ const char *data = result->data;
+
+ skip_whitespace(result);
+
+ if (data[result->offset] != '"')
+ return false;
+
+ result->offset++;
+
+ while (data[result->offset] != '\0' && data[result->offset] != '"') {
+ if (i < len)
+ buf[i++] = data[result->offset];
+ result->offset++;
+ }
+
+ if (i < len)
+ buf[i++] = '\0';
+
+ if (data[result->offset] == '"')
+ result->offset++;
+ else
+ return false;
+
+ skip_whitespace(result);
+ next_field(result);
+
+ return true;
+}
+
static void process_input(struct hfp_gw *hfp)
{
char *str, *ptr;
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index dcde28f..96c6ef9 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -117,3 +117,5 @@ bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix);
bool hfp_gw_result_get_number(struct hfp_gw_result *result, int *val);
bool hfp_gw_result_open_container(struct hfp_gw_result *result);
bool hfp_gw_result_close_container(struct hfp_gw_result *result);
+bool hfp_gw_result_get_string(struct hfp_gw_result *result, char *buf,
+ uint8_t len);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv3 6/6] shared/hfp: Add function to get unquoted string
From: Marcin Kraglak @ 2014-02-28 20:33 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393619636-23762-1-git-send-email-marcin.kraglak@tieto.com>
---
src/shared/hfp.c | 28 ++++++++++++++++++++++++++++
src/shared/hfp.h | 2 ++
2 files changed, 30 insertions(+)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 4d3bdc9..8e318d6 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -310,6 +310,34 @@ bool hfp_gw_result_get_string(struct hfp_gw_result *result, char *buf,
return true;
}
+bool hfp_gw_result_get_unquoted_string(struct hfp_gw_result *result, char *buf,
+ uint8_t len)
+{
+ const char *data = result->data;
+ int i = 0;
+ char c;
+
+ skip_whitespace(result);
+
+ c = data[result->offset];
+ if (c == '"' || c == ')' || c == '(')
+ return false;
+
+ while (data[result->offset] != '\0' && data[result->offset] != ','
+ && data[result->offset] != ')') {
+ if (i < len)
+ buf[i++] = data[result->offset];
+ result->offset++;
+ }
+
+ if (i < len)
+ buf[i++] = '\0';
+
+ next_field(result);
+
+ return true;
+}
+
static void process_input(struct hfp_gw *hfp)
{
char *str, *ptr;
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index 96c6ef9..1001b27 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -119,3 +119,5 @@ bool hfp_gw_result_open_container(struct hfp_gw_result *result);
bool hfp_gw_result_close_container(struct hfp_gw_result *result);
bool hfp_gw_result_get_string(struct hfp_gw_result *result, char *buf,
uint8_t len);
+bool hfp_gw_result_get_unquoted_string(struct hfp_gw_result *result, char *buf,
+ uint8_t len);
--
1.8.3.1
^ permalink raw reply related
* Re: partial success with PS3 sixaxis
From: Andrea @ 2014-02-28 21:20 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <4617658.ClQmBLQ0NT@uw000953>
On 28/02/14 10:47, Szymon Janc wrote:
> Hi Andrea,
>
>
> Failing probe is a problem here. Do you use same dongle on RaspPi as on Fedora?
> I've seen that DS3 is not playing well with some controllers i.e. it doesn't work
> with one on my CSR 2.0 USB dongle.
yes I seem to confirm it.
using kernel 3.10.xxx on Pi, the PS3 does not seem to work on any usb dongle
3.12 Fedora and 3.13 Pi with a CSR 4.0 it works (let's ignore the crashes on Pi which seems to be
related to Pi USB stack). No LEDs.
3.12 Fedora and 3.13 Pi with a CSR 2.0, it pairs, connects but /dev/input/js0 is only readable for a
few seconds then it stops reading events
3.13 Pi with a CSR 4.0 I sometimes get device timeout when I try "hciconfig hcio up"
What is strange here is that sixad was working with more dongles and more kernels.
So, to be concrete, my current issues are
1) no LEDs (you said it is going to be fixed in Linux 3.15)
2) CSR with dongle 2.0 produces a non usable /dev/input/js0
3) CSR 4.0 I cant always bring hci0 up
The 2 dongles I am using now are both reporting the same usb device id
0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
although they are very different 2.0 vs 4.0
Anything I can do to narrow down these last issues?
>
>> I am not too familiar with whom is responsible for /dev/input/js0? kernel? bluez? the sixaxis plugin?
>
> Kernel. sixaxis plugin is used only to associate DS3 with host controller (and to set LEDs).
>
>> Since this controller always works with the alternative sixad daemon, can I log the traffic and
>> compare it? or maybe post it here so some of you guys can help me?
>
> Yeap, btmon logs could give us some more info what is going on.
>
^ permalink raw reply
* [PATCH] android/socket: Use same RFCOMM channels for services as Linux daemon
From: Szymon Janc @ 2014-02-28 21:23 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Use numbers from doc/assigned-numbers.txt.
---
android/socket.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/android/socket.c b/android/socket.c
index ee98b54..9aab345 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -47,9 +47,10 @@
#define RFCOMM_CHANNEL_MAX 30
-#define OPP_DEFAULT_CHANNEL 12
+#define OPP_DEFAULT_CHANNEL 9
#define HFAG_DEFAULT_CHANNEL 13
-#define PBAP_DEFAULT_CHANNEL 19
+#define PBAP_DEFAULT_CHANNEL 15
+#define MAP_MAS_DEFAULT_CHANNEL 16
#define SVC_HINT_OBEX 0x10
@@ -403,7 +404,7 @@ static const struct profile_info {
0x00, 0x00, 0x11, 0x32, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
- .channel = 0,
+ .channel = MAP_MAS_DEFAULT_CHANNEL,
.svc_hint = SVC_HINT_OBEX,
.sec_level = BT_IO_SEC_MEDIUM,
.create_record = create_mas_record
--
1.8.5.3
^ permalink raw reply related
* Re: [PATCHv3 1/6] shared/hfp: Add prefix handlers functionality
From: Marcel Holtmann @ 2014-03-01 3:20 UTC (permalink / raw)
To: Marcin Kraglak; +Cc: linux-bluetooth
In-Reply-To: <1393619636-23762-1-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
> Add two functions: hfp_gw_register_prefix_handler() and
> hfp_gw_unregister_prefix_handler(). It will allow user to register for
> specific command. Current implementation just put/remove handler data
> from queue.
> ---
> Makefile.tools | 1 +
> src/shared/hfp.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> src/shared/hfp.h | 19 +++++++++++
> 3 files changed, 120 insertions(+)
>
> diff --git a/Makefile.tools b/Makefile.tools
> index 9f7ba9f..31e1093 100644
> --- a/Makefile.tools
> +++ b/Makefile.tools
> @@ -63,6 +63,7 @@ emulator_hfp_SOURCES = emulator/hfp.c \
> monitor/mainloop.h monitor/mainloop.c \
> src/shared/io.h src/shared/io-mainloop.c \
> src/shared/util.h src/shared/util.c \
> + src/shared/queue.h src/shared/queue.c \
> src/shared/ringbuf.h src/shared/ringbuf.c \
> src/shared/hfp.h src/shared/hfp.c
>
> diff --git a/src/shared/hfp.c b/src/shared/hfp.c
> index 854cf46..aecd246 100644
> --- a/src/shared/hfp.c
> +++ b/src/shared/hfp.c
> @@ -32,6 +32,7 @@
>
> #include "src/shared/util.h"
> #include "src/shared/ringbuf.h"
> +#include "src/shared/queue.h"
> #include "src/shared/io.h"
> #include "src/shared/hfp.h"
>
> @@ -42,6 +43,7 @@ struct hfp_gw {
> struct io *io;
> struct ringbuf *read_buf;
> struct ringbuf *write_buf;
> + struct queue *prefix_handlers;
call this cmd_handlers.
> bool writer_active;
> bool permissive_syntax;
> bool result_pending;
> @@ -60,6 +62,37 @@ struct hfp_gw {
> bool destroyed;
> };
>
> +struct prefix_handler_data {
Same here. Just cmd_handler should be fine.
> + char *prefix;
> + void *user_data;
> + hfp_destroy_func_t destroy;
> + hfp_result_func_t callback;
> +};
> +
> +static void destroy_prefix_handler_data(void *data)
> +{
Use destroy_cmd_handler here.
> + struct prefix_handler_data *handler = data;
> +
> + if (handler->destroy)
> + handler->destroy(handler->user_data);
> +
> + free(handler);
> +}
> +
> +static bool match_handler_prefix(const void *a, const void *b)
> +{
> + const struct prefix_handler_data *handler = a;
> + const char *prefix = b;
> +
> + if (strlen(handler->prefix) != strlen(prefix))
> + return false;
> +
> + if (memcmp(handler->prefix, prefix, strlen(prefix)))
> + return false;
> +
> + return true;
> +}
> +
> static void write_watch_destroy(void *user_data)
> {
> struct hfp_gw *hfp = user_data;
> @@ -196,8 +229,19 @@ struct hfp_gw *hfp_gw_new(int fd)
> return NULL;
> }
>
> + hfp->prefix_handlers = queue_new();
> + if (!hfp->prefix_handlers) {
> + io_destroy(hfp->io);
> + ringbuf_free(hfp->write_buf);
> + ringbuf_free(hfp->read_buf);
> + free(hfp);
> + return NULL;
> + }
> +
> if (!io_set_read_handler(hfp->io, can_read_data,
> hfp, read_watch_destroy)) {
> + queue_destroy(hfp->prefix_handlers,
> + destroy_prefix_handler_data);
> io_destroy(hfp->io);
> ringbuf_free(hfp->write_buf);
> ringbuf_free(hfp->read_buf);
> @@ -250,6 +294,9 @@ void hfp_gw_unref(struct hfp_gw *hfp)
> ringbuf_free(hfp->write_buf);
> hfp->write_buf = NULL;
>
> + queue_destroy(hfp->prefix_handlers, destroy_prefix_handler_data);
> + hfp->prefix_handlers = NULL;
> +
> if (!hfp->in_disconnect) {
> free(hfp);
> return;
> @@ -405,6 +452,59 @@ bool hfp_gw_set_command_handler(struct hfp_gw *hfp,
> return true;
> }
>
> +bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
> + hfp_result_func_t callback,
> + const char *prefix,
> + void *user_data,
> + hfp_destroy_func_t destroy)
> +{
> + struct prefix_handler_data *handler;
> +
> + handler = new0(struct prefix_handler_data, 1);
> + if (!handler)
> + return false;
> +
> + handler->callback = callback;
> + handler->user_data = user_data;
> +
> + handler->prefix = strdup(prefix);
> + if (!handler->prefix) {
> + free(handler);
> + return false;
> + }
> +
> + if (queue_find(hfp->prefix_handlers, match_handler_prefix,
> + handler->prefix)) {
> + destroy_prefix_handler_data(handler);
> + return false;
> + }
> +
> + handler->destroy = destroy;
> +
> + return queue_push_tail(hfp->prefix_handlers, handler);
> +}
> +
> +bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix)
> +{
> + struct prefix_handler_data *handler;
> + char *lookup_prefix;
> +
> + lookup_prefix = strdup(prefix);
> + if (!lookup_prefix)
> + return false;
> +
> + handler = queue_remove_if(hfp->prefix_handlers, match_handler_prefix,
> + lookup_prefix);
> + free(lookup_prefix);
> +
> + if (!handler)
> + return false;
> +
> + destroy_prefix_handler_data(handler);
> +
> + return true;
> +}
> +
> static void disconnect_watch_destroy(void *user_data)
> {
> struct hfp_gw *hfp = user_data;
> diff --git a/src/shared/hfp.h b/src/shared/hfp.h
> index b0bd934..dee80d9 100644
> --- a/src/shared/hfp.h
> +++ b/src/shared/hfp.h
> @@ -60,6 +60,18 @@ enum hfp_error {
> HFP_ERROR_NETWORK_NOT_ALLOWED = 32,
> };
>
> +enum hfp_cmd_type {
> + HFP_AT_READ,
> + HFP_AT_SET,
> + HFP_AT_TEST,
> + HFP_AT_COMMAND
> +};
> +
> +struct hfp_gw_result;
At this moment, lets use hfp_gw_cmd_type and HFP_GW_CMD_TYPE_READ etc.
> +
> +typedef void (*hfp_result_func_t)(struct hfp_gw_result *result,
> + enum hfp_cmd_type type, void *user_data);
> +
> typedef void (*hfp_destroy_func_t)(void *user_data);
> typedef void (*hfp_debug_func_t)(const char *str, void *user_data);
>
> @@ -94,3 +106,10 @@ bool hfp_gw_set_disconnect_handler(struct hfp_gw *hfp,
> hfp_destroy_func_t destroy);
>
> bool hfp_gw_disconnect(struct hfp_gw *hfp);
> +
> +bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
> + hfp_result_func_t callback,
> + const char *prefix,
> + void *user_data,
> + hfp_destroy_func_t destroy);
> +bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix);
Just hfp_gw_register and hfp_gw_unregister are enough. That is what we do within the other code that provides similar functionality.
Regards
Marcel
^ permalink raw reply
* Re: [PATCHv3 3/6] shared/hfp: Add get_number implementation
From: Marcel Holtmann @ 2014-03-01 3:27 UTC (permalink / raw)
To: Marcin Kraglak; +Cc: linux-bluetooth
In-Reply-To: <1393619636-23762-3-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
> User can call this function with hfp_gw_result, which will
> be passed to prefix handler.
> ---
> src/shared/hfp.c | 33 +++++++++++++++++++++++++++++++++
> src/shared/hfp.h | 2 ++
> 2 files changed, 35 insertions(+)
>
> diff --git a/src/shared/hfp.c b/src/shared/hfp.c
> index 8feaf16..d168ac4 100644
> --- a/src/shared/hfp.c
> +++ b/src/shared/hfp.c
> @@ -218,6 +218,39 @@ done:
> return true;
> }
>
> +static void next_field(struct hfp_gw_result *result)
> +{
> + if (result->data[result->offset] == ',')
> + result->offset++;
> +}
> +
> +bool hfp_gw_result_get_number(struct hfp_gw_result *result, int *val)
> +{
> + int temp = 0;
> + int i;
int i, tmp = 0;
> +
> + skip_whitespace(result);
> +
> + i = result->offset;
> +
> + while (result->data[i] >= '0' && result->data[i] <= '9') {
> + temp *= 10;
> + temp += result->data[i++] - '0’;
tmp = (tmp * 10) + (result->data[i++] - ‘0’;
This should be the cheaper operation since tmp does not need be reevaluated twice.
Are we going to support negative number? I do not even remember if they are valid in AT commands. Has been too long. Might also go straight to unsigned int *val in that case.
Regards
Marcel
^ permalink raw reply
* Re: [PATCHv3 3/6] shared/hfp: Add get_number implementation
From: Marcin Kraglak @ 2014-03-01 5:31 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <FBA29747-DEFB-4420-9010-A01792933120@holtmann.org>
Hi Marcel,
On 1 March 2014 04:27, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Marcin,
>
>> User can call this function with hfp_gw_result, which will
>> be passed to prefix handler.
>> ---
>> src/shared/hfp.c | 33 +++++++++++++++++++++++++++++++++
>> src/shared/hfp.h | 2 ++
>> 2 files changed, 35 insertions(+)
>>
>> diff --git a/src/shared/hfp.c b/src/shared/hfp.c
>> index 8feaf16..d168ac4 100644
>> --- a/src/shared/hfp.c
>> +++ b/src/shared/hfp.c
>> @@ -218,6 +218,39 @@ done:
>> return true;
>> }
>>
>> +static void next_field(struct hfp_gw_result *result)
>> +{
>> + if (result->data[result->offset] == ',')
>> + result->offset++;
>> +}
>> +
>> +bool hfp_gw_result_get_number(struct hfp_gw_result *result, int *val)
>> +{
>> + int temp = 0;
>> + int i;
>
> int i, tmp = 0;
>
>> +
>> + skip_whitespace(result);
>> +
>> + i = result->offset;
>> +
>> + while (result->data[i] >= '0' && result->data[i] <= '9') {
>> + temp *= 10;
>> + temp += result->data[i++] - '0';
>
> tmp = (tmp * 10) + (result->data[i++] - '0';
>
> This should be the cheaper operation since tmp does not need be reevaluated twice.
>
> Are we going to support negative number? I do not even remember if they are valid in AT commands. Has been too long. Might also go straight to unsigned int *val in that case.
>
> Regards
>
> Marcel
>
ok, I'll change it to be cheaper,
In spec V.250 stays:
"Decimal numeric constants shall consist of a sequence of one or more
of the characters "0"
(IA5 3/0) through "9" (IA5 3/9), inclusive."
and
"No spaces, hyphens, periods, commas, parentheses, or other generally-
accepted numeric formatting characters are permitted in numeric constants;"
co i suppose that it shuouldn't be accepted
I'll send next version
BR
Marcin
^ permalink raw reply
* Re: [PATCHv3 1/6] shared/hfp: Add prefix handlers functionality
From: Marcin Kraglak @ 2014-03-01 5:32 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <8B82CC5D-1748-4938-9FC0-8B12E6EF55B6@holtmann.org>
Hi Marcel,
On 1 March 2014 04:20, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Marcin,
>
>> Add two functions: hfp_gw_register_prefix_handler() and
>> hfp_gw_unregister_prefix_handler(). It will allow user to register for
>> specific command. Current implementation just put/remove handler data
>> from queue.
>> ---
>> Makefile.tools | 1 +
>> src/shared/hfp.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> src/shared/hfp.h | 19 +++++++++++
>> 3 files changed, 120 insertions(+)
>>
>> diff --git a/Makefile.tools b/Makefile.tools
>> index 9f7ba9f..31e1093 100644
>> --- a/Makefile.tools
>> +++ b/Makefile.tools
>> @@ -63,6 +63,7 @@ emulator_hfp_SOURCES = emulator/hfp.c \
>> monitor/mainloop.h monitor/mainloop.c \
>> src/shared/io.h src/shared/io-mainloop.c \
>> src/shared/util.h src/shared/util.c \
>> + src/shared/queue.h src/shared/queue.c \
>> src/shared/ringbuf.h src/shared/ringbuf.c \
>> src/shared/hfp.h src/shared/hfp.c
>>
>> diff --git a/src/shared/hfp.c b/src/shared/hfp.c
>> index 854cf46..aecd246 100644
>> --- a/src/shared/hfp.c
>> +++ b/src/shared/hfp.c
>> @@ -32,6 +32,7 @@
>>
>> #include "src/shared/util.h"
>> #include "src/shared/ringbuf.h"
>> +#include "src/shared/queue.h"
>> #include "src/shared/io.h"
>> #include "src/shared/hfp.h"
>>
>> @@ -42,6 +43,7 @@ struct hfp_gw {
>> struct io *io;
>> struct ringbuf *read_buf;
>> struct ringbuf *write_buf;
>> + struct queue *prefix_handlers;
>
> call this cmd_handlers.
>
>> bool writer_active;
>> bool permissive_syntax;
>> bool result_pending;
>> @@ -60,6 +62,37 @@ struct hfp_gw {
>> bool destroyed;
>> };
>>
>> +struct prefix_handler_data {
>
> Same here. Just cmd_handler should be fine.
>
>> + char *prefix;
>> + void *user_data;
>> + hfp_destroy_func_t destroy;
>> + hfp_result_func_t callback;
>> +};
>> +
>> +static void destroy_prefix_handler_data(void *data)
>> +{
>
> Use destroy_cmd_handler here.
>
>> + struct prefix_handler_data *handler = data;
>> +
>> + if (handler->destroy)
>> + handler->destroy(handler->user_data);
>> +
>> + free(handler);
>> +}
>> +
>> +static bool match_handler_prefix(const void *a, const void *b)
>> +{
>> + const struct prefix_handler_data *handler = a;
>> + const char *prefix = b;
>> +
>> + if (strlen(handler->prefix) != strlen(prefix))
>> + return false;
>> +
>> + if (memcmp(handler->prefix, prefix, strlen(prefix)))
>> + return false;
>> +
>> + return true;
>> +}
>> +
>> static void write_watch_destroy(void *user_data)
>> {
>> struct hfp_gw *hfp = user_data;
>> @@ -196,8 +229,19 @@ struct hfp_gw *hfp_gw_new(int fd)
>> return NULL;
>> }
>>
>> + hfp->prefix_handlers = queue_new();
>> + if (!hfp->prefix_handlers) {
>> + io_destroy(hfp->io);
>> + ringbuf_free(hfp->write_buf);
>> + ringbuf_free(hfp->read_buf);
>> + free(hfp);
>> + return NULL;
>> + }
>> +
>> if (!io_set_read_handler(hfp->io, can_read_data,
>> hfp, read_watch_destroy)) {
>> + queue_destroy(hfp->prefix_handlers,
>> + destroy_prefix_handler_data);
>> io_destroy(hfp->io);
>> ringbuf_free(hfp->write_buf);
>> ringbuf_free(hfp->read_buf);
>> @@ -250,6 +294,9 @@ void hfp_gw_unref(struct hfp_gw *hfp)
>> ringbuf_free(hfp->write_buf);
>> hfp->write_buf = NULL;
>>
>> + queue_destroy(hfp->prefix_handlers, destroy_prefix_handler_data);
>> + hfp->prefix_handlers = NULL;
>> +
>> if (!hfp->in_disconnect) {
>> free(hfp);
>> return;
>> @@ -405,6 +452,59 @@ bool hfp_gw_set_command_handler(struct hfp_gw *hfp,
>> return true;
>> }
>>
>> +bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
>> + hfp_result_func_t callback,
>> + const char *prefix,
>> + void *user_data,
>> + hfp_destroy_func_t destroy)
>> +{
>> + struct prefix_handler_data *handler;
>> +
>> + handler = new0(struct prefix_handler_data, 1);
>> + if (!handler)
>> + return false;
>> +
>> + handler->callback = callback;
>> + handler->user_data = user_data;
>> +
>> + handler->prefix = strdup(prefix);
>> + if (!handler->prefix) {
>> + free(handler);
>> + return false;
>> + }
>> +
>> + if (queue_find(hfp->prefix_handlers, match_handler_prefix,
>> + handler->prefix)) {
>> + destroy_prefix_handler_data(handler);
>> + return false;
>> + }
>> +
>> + handler->destroy = destroy;
>> +
>> + return queue_push_tail(hfp->prefix_handlers, handler);
>> +}
>> +
>> +bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix)
>> +{
>> + struct prefix_handler_data *handler;
>> + char *lookup_prefix;
>> +
>> + lookup_prefix = strdup(prefix);
>> + if (!lookup_prefix)
>> + return false;
>> +
>> + handler = queue_remove_if(hfp->prefix_handlers, match_handler_prefix,
>> + lookup_prefix);
>> + free(lookup_prefix);
>> +
>> + if (!handler)
>> + return false;
>> +
>> + destroy_prefix_handler_data(handler);
>> +
>> + return true;
>> +}
>> +
>> static void disconnect_watch_destroy(void *user_data)
>> {
>> struct hfp_gw *hfp = user_data;
>> diff --git a/src/shared/hfp.h b/src/shared/hfp.h
>> index b0bd934..dee80d9 100644
>> --- a/src/shared/hfp.h
>> +++ b/src/shared/hfp.h
>> @@ -60,6 +60,18 @@ enum hfp_error {
>> HFP_ERROR_NETWORK_NOT_ALLOWED = 32,
>> };
>>
>> +enum hfp_cmd_type {
>> + HFP_AT_READ,
>> + HFP_AT_SET,
>> + HFP_AT_TEST,
>> + HFP_AT_COMMAND
>> +};
>> +
>> +struct hfp_gw_result;
>
> At this moment, lets use hfp_gw_cmd_type and HFP_GW_CMD_TYPE_READ etc.
>
>> +
>> +typedef void (*hfp_result_func_t)(struct hfp_gw_result *result,
>> + enum hfp_cmd_type type, void *user_data);
>> +
>> typedef void (*hfp_destroy_func_t)(void *user_data);
>> typedef void (*hfp_debug_func_t)(const char *str, void *user_data);
>>
>> @@ -94,3 +106,10 @@ bool hfp_gw_set_disconnect_handler(struct hfp_gw *hfp,
>> hfp_destroy_func_t destroy);
>>
>> bool hfp_gw_disconnect(struct hfp_gw *hfp);
>> +
>> +bool hfp_gw_register_prefix_handler(struct hfp_gw *hfp,
>> + hfp_result_func_t callback,
>> + const char *prefix,
>> + void *user_data,
>> + hfp_destroy_func_t destroy);
>> +bool hfp_gw_unregister_prefix_handler(struct hfp_gw *hfp, const char *prefix);
>
> Just hfp_gw_register and hfp_gw_unregister are enough. That is what we do within the other code that provides similar functionality.
>
> Regards
>
> Marcel
>
I'll change it in next version
BR
Marcin
^ permalink raw reply
* Re: Passive scanning of iBeacons results in a "Data Buffer Overflow"
From: Adam Warski @ 2014-03-01 9:34 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: BlueZ development
In-Reply-To: <CAJdJm_PMAVyiY-=13puBHAucCzObUWOSOXZ+maOL2z11YwOh-g@mail.gmail.com>
> For me looks like something got confused on the HCI packet parsing:
> either the kernel, hcidump, or something else. The HCI events after
> the LE meta event make no sense (they seem garbage). Did you try with
> btmon instead of hcidump ?
Yes, with btmon the same is happening. Also when just running “hcitool lescan --passive —duplicates” it stops getting advertisements after a while (without hcidump or btmon running in the background).
> Can you save the raw dump using "hcidump -w output.dump" (or using
> btmon -w) and send to the list? It is easier to analyze, as the parser
> may be bogus.
Sure. The problems start at 63.120548.
The dump is here: http://www.warski.org/btmon_ibeacons.dat
Thanks,
Adam
--
Adam Warski
http://twitter.com/#!/adamwarski
http://www.softwaremill.com
http://www.warski.org
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox