* [PATCH] input: Implement idle timeout for fakehid.
From: Jeff Hansen @ 2012-08-27 14:19 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jeff Hansen
The batteries on my BD remote would die in a few days without this patch.
Now they've been going for weeks (hopefully months).
---
profiles/input/device.c | 6 ++++++
profiles/input/device.h | 4 ++++
profiles/input/fakehid.c | 18 ++++++++++++++++++
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 48d397a..31c970d 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -638,6 +638,7 @@ static int hidp_add_connection(const struct input_device *idev,
fake->disconnect = fake_hid_disconnect;
fake->priv = fake_hid;
fake->idev = idev;
+ fake->timeout = iconn->timeout * 1000;
fake = fake_hid_connadd(fake, iconn->intr_io, fake_hid);
if (fake == NULL)
err = -ENOMEM;
@@ -1307,3 +1308,8 @@ int input_device_close_channels(const bdaddr_t *src, const bdaddr_t *dst)
return 0;
}
+
+void input_device_request_disconnect(const struct input_device *idev)
+{
+ device_request_disconnect(idev->device, NULL);
+}
diff --git a/profiles/input/device.h b/profiles/input/device.h
index 509a353..1b490b4 100644
--- a/profiles/input/device.h
+++ b/profiles/input/device.h
@@ -37,6 +37,8 @@ struct fake_input {
int (*disconnect) (struct input_conn *iconn);
void *priv;
const struct input_device *idev;
+ guint idle_timeout;
+ uint32_t timeout;
};
int fake_input_register(DBusConnection *conn, struct btd_device *device,
@@ -49,3 +51,5 @@ int input_device_unregister(const char *path, const char *uuid);
int input_device_set_channel(const bdaddr_t *src, const bdaddr_t *dst, int psm,
GIOChannel *io);
int input_device_close_channels(const bdaddr_t *src, const bdaddr_t *dst);
+
+void input_device_request_disconnect(const struct input_device *idev);
diff --git a/profiles/input/fakehid.c b/profiles/input/fakehid.c
index 3be1489..a92622f 100644
--- a/profiles/input/fakehid.c
+++ b/profiles/input/fakehid.c
@@ -199,6 +199,13 @@ error:
return -1;
}
+static gboolean ps3remote_idle(gpointer data)
+{
+ struct fake_input *fake = data;
+ input_device_request_disconnect(fake->idev);
+ return FALSE;
+}
+
static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond,
gpointer data)
{
@@ -209,6 +216,13 @@ static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond,
char buff[50];
int fd;
+ if (fake->idle_timeout) {
+ g_source_remove(fake->idle_timeout);
+ fake->idle_timeout = 0;
+ }
+ if (fake->timeout)
+ fake->idle_timeout = g_timeout_add(fake->timeout, ps3remote_idle, fake);
+
if (cond & G_IO_NVAL)
return FALSE;
@@ -328,6 +342,10 @@ static gboolean fake_hid_common_connect(struct fake_input *fake, GError **err)
static int fake_hid_common_disconnect(struct fake_input *fake)
{
+ if (fake->idle_timeout) {
+ g_source_remove(fake->idle_timeout);
+ fake->idle_timeout = 0;
+ }
return 0;
}
--
1.7.8.6
^ permalink raw reply related
* [PATCH 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off
From: Andrzej Kaczmarek @ 2012-08-27 14:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
Set SSP called when hdev is up but still has HCI_AUTO_OFF flag set will
only change dev_flags and enable feature in host but won't enable feature
in controller. As a result some devices will reject IO Capa Request due to
missing SSP Host Support flag in extended features and thus won't allow
SSP or fallback to legacy pairing.
This patch ensures HCI Write Simple Pairing Mode is sent when Set Powered is
called to clear HCI_AUTO_OFF flag.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 05d4b83..ccc6716 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2891,6 +2891,12 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
if (scan)
hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
+ if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
+ u8 ssp = 1;
+
+ hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
+ }
+
update_class(hdev);
update_name(hdev, hdev->dev_name);
update_eir(hdev);
--
1.7.11.3
^ permalink raw reply related
* [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
From: Andrzej Kaczmarek @ 2012-08-27 14:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
In-Reply-To: <1346078850-32704-1-git-send-email-andrzej.kaczmarek@tieto.com>
Set LE called when hdev is up but still has HCI_AUTO_OFF flag set will
only change dev_flags and enable feature in host but won't enable feature
in controller. As a resulit it's not possible to e.g. start LE only or
interleaved discovery due to missing LE Supported flag in local features.
This patch ensures HCI Write LE Host Supported is sent when Set Powered is
called to clear HCI_AUTO_OFF flag.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
---
net/bluetooth/mgmt.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ccc6716..f73441f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2897,6 +2897,17 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
}
+ if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
+ struct hci_cp_write_le_host_supported cp;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.le = 1;
+ cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR);
+
+ hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED,
+ sizeof(cp), &cp);
+ }
+
update_class(hdev);
update_name(hdev, hdev->dev_name);
update_eir(hdev);
--
1.7.11.3
^ permalink raw reply related
* [RFC] Bluetooth: Fix deadlock when closing socket
From: Andrei Emeltchenko @ 2012-08-27 14:52 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
If we have unacked frames when closing bluetooth socket we deadlock
since conn->chan_lock and chan->lock are taken.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/l2cap_core.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index bd13fb7..52baf1b 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1692,10 +1692,14 @@ int __l2cap_wait_ack(struct sock *sk)
DECLARE_WAITQUEUE(wait, current);
int err = 0;
int timeo = HZ/5;
+ int tries = 5;
+
+ BT_DBG("chan %p conn %p unacked %d", chan, chan->conn,
+ chan->unacked_frames);
add_wait_queue(sk_sleep(sk), &wait);
set_current_state(TASK_INTERRUPTIBLE);
- while (chan->unacked_frames > 0 && chan->conn) {
+ while (chan->unacked_frames > 0 && chan->conn && tries--) {
if (!timeo)
timeo = HZ/5;
@@ -1712,6 +1716,8 @@ int __l2cap_wait_ack(struct sock *sk)
err = sock_error(sk);
if (err)
break;
+
+ BT_DBG("chan %p timeo %d tries %d", chan, timeo, tries);
}
set_current_state(TASK_RUNNING);
remove_wait_queue(sk_sleep(sk), &wait);
--
1.7.9.5
^ permalink raw reply related
* Re: kernel crashes coming from btusb
From: Sonny Rao @ 2012-08-27 15:02 UTC (permalink / raw)
To: Oliver Neukum; +Cc: linux-bluetooth, marcel, vpalatin, keybuk
In-Reply-To: <2583063.yEXEROAGYt@linux-lqwf.site>
On Mon, Aug 27, 2012 at 6:06 AM, Oliver Neukum <oliver@neukum.org> wrote:
> On Monday 27 August 2012 03:30:55 Sonny Rao wrote:
>> Hi, I've been investigating an issue where we were seeing random
>> kernel crashes soon after resume and after using the great debugging
>> facilities in SLUB I started getting output which pointed to "use
>> after free" from the btusb driver.
>
> Which kernel version?
>
> Regards
> Oliver
>
Oops sorry, kernel 3.4
^ permalink raw reply
* Re: [PATCH 2/2] Bluetooth: Fix sending a HCI Authorization Request over LE links
From: Gustavo Padovan @ 2012-08-27 15:12 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1345768364-9546-2-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
* Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2012-08-23 21:32:44 -0300]:
> In the case that the link is already in the connected state and a
> Pairing request arrives from the mgmt interface, hci_conn_security()
> would be called but it was not considering LE links.
>
> Reported-by: João Paulo Rechi Vita <jprvita@openbossa.org>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
> net/bluetooth/hci_conn.c | 4 ++++
> 1 file changed, 4 insertions(+)
Both patches have been applied to the bluetooth.git tree. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH RESEND] Bluetooth: Add support for Apple MacBook Pro 9,2
From: Gustavo Padovan @ 2012-08-27 15:16 UTC (permalink / raw)
To: Shea Levy; +Cc: linux-bluetooth, linux-kernel, Johan Hedberg, Marcel Holtmann
In-Reply-To: <1344374463-21231-1-git-send-email-shea@shealevy.com>
Hi Shea,
* Shea Levy <shea@shealevy.com> [2012-08-07 17:21:03 -0400]:
> $ usb-devices
> <snip>
> T: Bus=04 Lev=04 Prnt=04 Port=02 Cnt=01 Dev#= 9 Spd=12 MxCh= 0
> D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=05ac ProdID=821d Rev=00.86
> S: Manufacturer=Apple Inc.
> S: Product=Bluetooth USB Host Controller
> C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
> I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
> I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
> <snip>
>
> Signed-off-by: Shea Levy <shea@shealevy.com>
> ---
> drivers/bluetooth/btusb.c | 3 +++
> 1 file changed, 3 insertions(+)
So this is outdated by the USB_VENDOR_AND_INTERFACE_INFO() patch that I just
applied.
Gustavo
^ permalink raw reply
* Re: [PATCH] Bluetooth: Use module_platform_driver() in btwilink.c file
From: Gustavo Padovan @ 2012-08-27 15:24 UTC (permalink / raw)
To: Sachin Kamat; +Cc: linux-bluetooth, marcel, johan.hedberg, raja_mani, patches
In-Reply-To: <1344316065-2032-1-git-send-email-sachin.kamat@linaro.org>
Hi Sachin,
* Sachin Kamat <sachin.kamat@linaro.org> [2012-08-07 10:37:45 +0530]:
> module_platform_driver() makes the code simpler by eliminating module_init
> and module_exit calls.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> This patch is based on bluetooth-next tree and is compile tested.
> ---
> drivers/bluetooth/btwilink.c | 16 +---------------
> 1 files changed, 1 insertions(+), 15 deletions(-)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Unable to run bluez "test-health-sink" sample
From: 吉田純 @ 2012-08-27 16:08 UTC (permalink / raw)
To: linux-bluetooth
Dear bluez list,
I want to develop an application which receives health data with the
latest blueZ libraries (4.101 version) available for download. First
thing was try to understand the logical process and routines involved
in the API through the test scripts shared with the blueZ project
(under "test" folder).
The problem is that my system is not able to run script related with
the health profile. "test-health-sink" script output is below.
===============
./test-health-sink
ERROR:dbus.connection:Unable to set arguments ({'DataType':
dbus.UInt16(4103), 'Role': 'sink'},) according to signature None:
<type 'exceptions.TypeError'>: an integer is required
Traceback (most recent call last):
File "./test-health-sink", line 18, in <module>
"Role": "sink"})
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 68, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 143, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 620,
in call_blocking
message.append(signature=signature, *args)
TypeError: an integer is required
I'm working with Angstrom OS (32 bits), dbus-python 1.1.1.
Best regards.
----
Jun
^ permalink raw reply
* pull request: bluetooth 2012-08-27
From: Gustavo Padovan @ 2012-08-27 16:18 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, linux-bluetooth, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]
Hi John,
A few updates for the 3.6 kernel. There are two btusb patches to add more
supported devices through the new USB_VENDOR_AND_INTEFACE_INFO() macro and
another one that add a new device id for a Sony Vaio laptop, one fix for a
user-after-free and, finally, two patches from Vinicius to fix a issue in SMP
pairing.
Gustavo
---
The following changes since commit 7dd6753f6d2e7e0ccbf2263cef3a9fff6bc89988:
ath5k: fix spin_lock_irqsave/spin_lock_bh nesting in mesh (2012-08-13 15:17:25 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth master
for you to fetch changes up to d8343f125710fb596f7a88cd756679f14f4e77b9:
Bluetooth: Fix sending a HCI Authorization Request over LE links (2012-08-27 08:11:51 -0700)
----------------------------------------------------------------
Andre Guedes (1):
Bluetooth: Fix use-after-free bug in SMP
Gustavo Padovan (1):
Bluetooth: Use USB_VENDOR_AND_INTERFACE() for Broadcom devices
Henrik Rydberg (1):
Bluetooth: Add support for Apple vendor-specific devices
Vinicius Costa Gomes (2):
Bluetooth: Change signature of smp_conn_security()
Bluetooth: Fix sending a HCI Authorization Request over LE links
Yevgeniy Melnichuk (1):
Bluetooth: Add support for Sony Vaio T-Series
drivers/bluetooth/ath3k.c | 2 ++
drivers/bluetooth/btusb.c | 12 +++++++-----
include/net/bluetooth/smp.h | 2 +-
net/bluetooth/hci_conn.c | 4 ++++
net/bluetooth/l2cap_core.c | 11 ++++++-----
net/bluetooth/l2cap_sock.c | 2 +-
net/bluetooth/smp.c | 10 +++++-----
7 files changed, 26 insertions(+), 17 deletions(-)
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [RFC BlueZ 00/33] Broadcaster/Observer implementation
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
This series contains the implementation for Broadcaster/Observer roles. It has
changes for adapter API, userspace implementation for MGMT API and new commands
in btmgmt tool.
The kernel patches for new MGMT commands were sent few weeks ago by Jefferson
Delfes: http://thread.gmane.org/gmane.linux.bluez.kernel/28228.
For now, only Service Data and Manufacturer Specific Data can be
broadcasted/observed. All other data types defined by BT SIG are not
appropriate for general application use, and should be managed by BlueZ itself.
For Observer role, we have:
* Two methods to register watchers: RegisterServiceObserver() and
RegisterManufacturerObserver().
* Respective methods to unregister watchers: UnregisterServiceObserver() and
UnregisterManufacturerObserver()
* The data received are sent to application through ServiceReceived() and/or
ManufacturerReceived().
An application can register only a observer watcher for each type: one for
Service Data and one for Manufacturer Specific Data. Both types can be enabled
for the same watcher.
For Broadcaster role, we have:
* Two methods to set data in controller: SetServiceData() and
SetManufacturerData().
* One method for releasing any previously set Advertising data:
ClearBroadcastData().
The same application can set a new Service Data and a new Manufacturer Specific
Data. To update any data set previously, the application should use
SetServiceData() or SetManufacturerData() using same Service UUID or Company
Identifier Code, respectively. Using ClearBroadcastData() will clean all data
set by application.
For MGMT API, new functions were implemented for Set Observer, Set Broadcaster,
Set Controller Data and Unset Controller Data (see doc/mgmt-api.txt for
details).
Anderson Lizardo (1):
mgmt-api: Broadcaster/Observer management API
Bruna Moreira (18):
lib: Add set broadcaster operation
btmgmt: Add set observer command
btmgmt: Add set controller data support
btmgmt: Add unset controller data support
doc: Add Observer D-Bus API documentation
observer: Add UnregisterServiceObserver() D-Bus method
observer: Add RegisterManufacturerObserver() D-Bus method
observer: Add UnregisterManufacturerObserver() D-Bus method
observer: Add watchers and filters for observers
observer: Add ServiceReceived() and ManufacturerReceived() D-Bus
method
observer: Add python test script
doc: Add Broadcaster D-Bus API documentation
lib: Maximum value to advertising and scan response
broadcaster: Add SetManufacturerData() D-Bus method
broadcaster: Build and send ADV/EIR data blob to kernel
broadcaster: Add ClearBroadcastData() D-Bus method
broadcaster: Update some data of already broadcast value
broadcaster: Add python test script
Jefferson Delfes (14):
lib: Add set controller data operation
lib: Add unset controller data operation
lib: Add set observer operation
btmgmt: Add set broadcaster support
mgmt: Add set observer command
mgmt: Add set broadcaster command
mgmt: Add set controller data command
mgmt: Add unset controller data command
adapter: Add D-Bus API for Observer GAP Role
observer: Add RegisterServiceObserver() D-Bus method
eir: Add manufacturer and service data fields
adapter: Add D-Bus API for Broadcaster GAP Role
broadcaster: Add SetServiceData() D-Bus method
broadcaster: Add list of broadcasters session
doc/adapter-api.txt | 120 ++++++++
doc/mgmt-api.txt | 64 ++++
lib/hci.h | 6 +-
lib/mgmt.h | 26 ++
src/adapter.c | 775 +++++++++++++++++++++++++++++++++++++++++++++++++
src/bluetooth.conf | 1 +
src/eir.c | 43 +++
src/eir.h | 19 ++
src/mgmt.c | 64 ++++
src/mgmt.h | 6 +
test/test-broadcaster | 76 +++++
test/test-observer | 87 ++++++
tools/btmgmt.c | 136 +++++++++
13 files changed, 1421 insertions(+), 2 deletions(-)
create mode 100755 test/test-broadcaster
create mode 100755 test/test-observer
--
1.7.9.5
^ permalink raw reply
* [RFC BlueZ 01/33] lib: Add set controller data operation
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Add structure for new command: Set Controller Data. Add new defines for
flags that will be used in Set Controller Data operation.
---
lib/mgmt.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/mgmt.h b/lib/mgmt.h
index a2648bc..99243b1 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -318,6 +318,17 @@ struct mgmt_cp_set_device_id {
uint16_t version;
} __packed;
+#define MGMT_DATA_NORMAL_PRIORITY 0x00
+#define MGMT_DATA_HIGH_PRIORITY 0x01
+
+#define MGMT_OP_SET_CONTROLLER_DATA 0x0029
+struct mgmt_cp_set_controller_data {
+ uint8_t flags;
+ uint8_t data_type;
+ uint8_t data_length;
+ uint8_t data[0];
+} __packed;
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
uint16_t opcode;
@@ -489,6 +500,7 @@ static const char *mgmt_op[] = {
"Block Device",
"Unblock Device",
"Set Device ID",
+ "Set Controller Data",
};
static const char *mgmt_ev[] = {
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 02/33] lib: Add unset controller data operation
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Add structure for new command: Unset Controller Data.
---
lib/mgmt.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/mgmt.h b/lib/mgmt.h
index 99243b1..e65b7fb 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -329,6 +329,11 @@ struct mgmt_cp_set_controller_data {
uint8_t data[0];
} __packed;
+#define MGMT_OP_UNSET_CONTROLLER_DATA 0x002A
+struct mgmt_cp_unset_controller_data {
+ uint8_t data_type;
+} __packed;
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
uint16_t opcode;
@@ -501,6 +506,7 @@ static const char *mgmt_op[] = {
"Unblock Device",
"Set Device ID",
"Set Controller Data",
+ "Unset Controller Data",
};
static const char *mgmt_ev[] = {
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 03/33] lib: Add set broadcaster operation
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
Add opcodes for new Set Broadcaster command.
---
lib/mgmt.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/mgmt.h b/lib/mgmt.h
index e65b7fb..6ecad43 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -92,6 +92,7 @@ struct mgmt_rp_read_index_list {
#define MGMT_SETTING_BREDR 0x00000080
#define MGMT_SETTING_HS 0x00000100
#define MGMT_SETTING_LE 0x00000200
+#define MGMT_SETTING_BROADCASTER 0x00000400
#define MGMT_OP_READ_INFO 0x0004
struct mgmt_rp_read_info {
@@ -334,6 +335,8 @@ struct mgmt_cp_unset_controller_data {
uint8_t data_type;
} __packed;
+#define MGMT_OP_SET_BROADCASTER 0x002B
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
uint16_t opcode;
@@ -507,6 +510,7 @@ static const char *mgmt_op[] = {
"Set Device ID",
"Set Controller Data",
"Unset Controller Data",
+ "Set Broadcaster",
};
static const char *mgmt_ev[] = {
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 04/33] lib: Add set observer operation
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Add opcodes for Set Observer command.
---
lib/mgmt.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/mgmt.h b/lib/mgmt.h
index 6ecad43..1e6bb32 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -93,6 +93,7 @@ struct mgmt_rp_read_index_list {
#define MGMT_SETTING_HS 0x00000100
#define MGMT_SETTING_LE 0x00000200
#define MGMT_SETTING_BROADCASTER 0x00000400
+#define MGMT_SETTING_OBSERVER 0x00000800
#define MGMT_OP_READ_INFO 0x0004
struct mgmt_rp_read_info {
@@ -337,6 +338,8 @@ struct mgmt_cp_unset_controller_data {
#define MGMT_OP_SET_BROADCASTER 0x002B
+#define MGMT_OP_SET_OBSERVER 0x002C
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
uint16_t opcode;
@@ -511,6 +514,7 @@ static const char *mgmt_op[] = {
"Set Controller Data",
"Unset Controller Data",
"Set Broadcaster",
+ "Set Observer",
};
static const char *mgmt_ev[] = {
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 05/33] btmgmt: Add set broadcaster support
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Add new broadcaster command for running the Set Broadcaster operation
from MGMT API.
---
tools/btmgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index f06f0bf..adfab83 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1099,6 +1099,11 @@ static void cmd_le(int mgmt_sk, uint16_t index, int argc, char **argv)
cmd_setting(mgmt_sk, index, MGMT_OP_SET_LE, argc, argv);
}
+static void cmd_broadcaster(int mgmt_sk, uint16_t index, int argc, char **argv)
+{
+ cmd_setting(mgmt_sk, index, MGMT_OP_SET_BROADCASTER, argc, argv);
+}
+
static void class_rsp(int mgmt_sk, uint16_t op, uint16_t id, uint8_t status,
void *rsp, uint16_t len, void *user_data)
{
@@ -1834,6 +1839,7 @@ static struct {
{ "rm-uuid", cmd_add_uuid, "Remove UUID" },
{ "clr-uuids", cmd_clr_uuids, "Clear UUIDs", },
{ "did", cmd_did, "Set Device ID", },
+ { "broadcaster",cmd_broadcaster,"Toggle Broadcaster Mode", },
{ NULL, NULL, 0 }
};
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 06/33] btmgmt: Add set observer command
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
Add new observer command for running the Set Observer operation from
MGMT API.
---
tools/btmgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index adfab83..5cc3198 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1104,6 +1104,11 @@ static void cmd_broadcaster(int mgmt_sk, uint16_t index, int argc, char **argv)
cmd_setting(mgmt_sk, index, MGMT_OP_SET_BROADCASTER, argc, argv);
}
+static void cmd_observer(int mgmt_sk, uint16_t index, int argc, char **argv)
+{
+ cmd_setting(mgmt_sk, index, MGMT_OP_SET_OBSERVER, argc, argv);
+}
+
static void class_rsp(int mgmt_sk, uint16_t op, uint16_t id, uint8_t status,
void *rsp, uint16_t len, void *user_data)
{
@@ -1840,6 +1845,7 @@ static struct {
{ "clr-uuids", cmd_clr_uuids, "Clear UUIDs", },
{ "did", cmd_did, "Set Device ID", },
{ "broadcaster",cmd_broadcaster,"Toggle Broadcaster Mode", },
+ { "observer", cmd_observer, "Toggle Observer Mode", },
{ NULL, NULL, 0 }
};
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 07/33] btmgmt: Add set controller data support
From: Bruna Moreira @ 2012-08-27 17:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
Add new command set-data for running the Set Controller Data operation
from MGMT API.
---
tools/btmgmt.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 5cc3198..628d21b 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1813,6 +1813,89 @@ done:
}
}
+static void set_data_rsp(int mgmt_sk, uint16_t op, uint16_t id, uint8_t status,
+ void *rsp, uint16_t len, void *user_data)
+{
+ if (status != 0) {
+ fprintf(stderr, "Unable to set controller data. status 0x%02x"
+ " (%s)\n", status, mgmt_errstr(status));
+ exit(EXIT_FAILURE);
+ }
+
+ exit(EXIT_SUCCESS);
+}
+
+static void set_data_usage(void)
+{
+ printf("Usage: btmgmt set_data [-p] <data type> <byte array>\n");
+ printf("\nexample: btmgmt set_data -p 0xff 11 11 aa bb cc\n");
+ printf("\nparameters:\n");
+ printf("\t<data type>: 0x16 (service data) or 0xff (manufacturer\n"
+ "\t specific data). Values different from that will return\n"
+ "\t error from kernel.\n");
+ printf("\t<byte array>: two bytes (service uuid or company identifier\n"
+ "\t code) following by hex encoded bytes (data).\n");
+}
+
+static struct option set_data_options[] = {
+ { "help", 0, 0, 'h' },
+ { "priority", 1, 0, 'p' },
+ { 0, 0, 0, 0 }
+};
+
+static void cmd_set_data(int mgmt_sk, uint16_t index, int argc, char **argv)
+{
+ struct mgmt_cp_set_controller_data *cp;
+ uint8_t data_len, flags = 0;
+ unsigned int i;
+ int opt;
+
+ while ((opt = getopt_long(argc, argv, "+ph", set_data_options,
+ NULL)) != -1) {
+ switch (opt) {
+ case 'p':
+ flags = MGMT_DATA_HIGH_PRIORITY;
+ break;
+ case 'h':
+ default:
+ set_data_usage();
+ exit(EXIT_SUCCESS);
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ optind = 0;
+
+ if (argc < 1) {
+ set_data_usage();
+ exit(EXIT_FAILURE);
+ }
+
+ data_len = argc - 1;
+ cp = malloc(sizeof(*cp) + data_len);
+ cp->flags = flags;
+ sscanf(argv[0], "%hhx", &cp->data_type);
+
+ for (i = 0; i < data_len; i++)
+ sscanf(argv[i + 1], "%hhx", &cp->data[i]);
+
+ cp->data_length = data_len;
+
+ if (index == MGMT_INDEX_NONE)
+ index = 0;
+
+ if (mgmt_send_cmd(mgmt_sk, MGMT_OP_SET_CONTROLLER_DATA, index,
+ cp, sizeof(*cp) + data_len,
+ set_data_rsp, NULL) < 0) {
+ free(cp);
+ fprintf(stderr, "Unable to send set controller data cmd\n");
+ exit(EXIT_FAILURE);
+ }
+
+ free(cp);
+}
+
static struct {
char *cmd;
void (*func)(int mgmt_sk, uint16_t index, int argc, char **argv);
@@ -1846,6 +1929,7 @@ static struct {
{ "did", cmd_did, "Set Device ID", },
{ "broadcaster",cmd_broadcaster,"Toggle Broadcaster Mode", },
{ "observer", cmd_observer, "Toggle Observer Mode", },
+ { "set-data", cmd_set_data, "Set Controller Data", },
{ NULL, NULL, 0 }
};
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 08/33] btmgmt: Add unset controller data support
From: Bruna Moreira @ 2012-08-27 17:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
Add new command unset-data for running the Unset Controller Data
operation from MGMT API.
---
tools/btmgmt.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 628d21b..44c4db8 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1896,6 +1896,45 @@ static void cmd_set_data(int mgmt_sk, uint16_t index, int argc, char **argv)
free(cp);
}
+static void unset_data_rsp(int mgmt_sk, uint16_t op, uint16_t id,
+ uint8_t status, void *rsp, uint16_t len, void *user_data)
+{
+ if (status != 0) {
+ fprintf(stderr, "Unable to unset controller data. status 0x%02x"
+ " (%s)\n", status, mgmt_errstr(status));
+ exit(EXIT_FAILURE);
+ }
+
+ exit(EXIT_SUCCESS);
+}
+
+static void cmd_unset_data(int mgmt_sk, uint16_t index, int argc, char **argv)
+{
+ struct mgmt_cp_unset_controller_data cp;
+
+ if (argc < 2) {
+ printf("Usage: btmgmt %s <data type>\n", argv[0]);
+ printf("\nexample: btmgmt %s 0xff\n", argv[0]);
+ printf("\nparameters:\n");
+ printf("\t<data type>: 0x16 (service data) or 0xff\n"
+ "\t(manufacturer specific data).\n");
+
+ exit(EXIT_FAILURE);
+ }
+
+ memset(&cp, 0, sizeof(cp));
+ sscanf(argv[1], "%hhx", &cp.data_type);
+
+ if (index == MGMT_INDEX_NONE)
+ index = 0;
+
+ if (mgmt_send_cmd(mgmt_sk, MGMT_OP_UNSET_CONTROLLER_DATA, index,
+ &cp, sizeof(cp), unset_data_rsp, NULL) < 0) {
+ fprintf(stderr, "Unable to send unset controller data cmd\n");
+ exit(EXIT_FAILURE);
+ }
+}
+
static struct {
char *cmd;
void (*func)(int mgmt_sk, uint16_t index, int argc, char **argv);
@@ -1930,6 +1969,7 @@ static struct {
{ "broadcaster",cmd_broadcaster,"Toggle Broadcaster Mode", },
{ "observer", cmd_observer, "Toggle Observer Mode", },
{ "set-data", cmd_set_data, "Set Controller Data", },
+ { "unset-data", cmd_unset_data, "Unset Controller Data", },
{ NULL, NULL, 0 }
};
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 09/33] mgmt-api: Broadcaster/Observer management API
From: Bruna Moreira @ 2012-08-27 17:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Anderson Lizardo <anderson.lizardo@openbossa.org>
Add new management commands for enabling or disabling broadcasting and
observation modes, as defined by the Observer and Broadcaster GAP roles
on the Core specification 4.0.
The commands can also be used for adding information to EIR on BR/EDR
controllers. For a list of all available AD/EIR types, see the Core
Specification Supplement (CSS) document.
Note that some AD/EIR types are managed internally by the kernel and are
not available through these new commands.
---
doc/mgmt-api.txt | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index c25f377..48d6355 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -139,6 +139,8 @@ Read Controller Information Command
8 Basic Rate/Enhanced Data Rate
9 High Speed
10 Low Energy
+ 11 Broadcaster
+ 12 Observer
This command generates a Command Complete event on success or
a Command Status event on failure.
@@ -845,6 +847,68 @@ Set Device ID Command
a Command Status event on failure.
+Set Controller Data Command
+===========================
+
+ Command Code: 0x0029
+ Controller Index: <controller id>
+ Command Parameters: Flags (1 Octet)
+ Data_Type (1 Octet)
+ Data_Length (1 Octet)
+ Data (0-255 Octets)
+ Return Parameters:
+
+ This command can be used to set AD for LE capable controllers or EIR
+ for BR/EDR controllers. Multiple AD/EIR types can be configured by
+ calling this command multiple times. If the controller is BR/EDR/LE
+ capable (also known as "dual mode"), only the LE advertising is set.
+
+ The Flags parameter is currently unused, but it will contain bitwise
+ flags to fine tune how and when the data will set on the controller.
+
+ This command generates a Command Complete event on success or
+ a Command Status event on failure.
+
+
+Unset Controller Data Command
+=============================
+
+ Command Code: 0x002A
+ Controller Index: <controller id>
+ Command Parameters: Data_Type (1 Octet)
+ Return Parameters:
+
+ Remove the AD/EIR information identified by Data_Type, so it will not
+ be broadcasted anymore.
+
+ This command generates a Command Complete event on success or
+ a Command Status event on failure.
+
+
+Set Broadcaster Command
+=======================
+
+ Command Code: 0x002B
+ Controller Index: <controller id>
+ Command Parameters: Broadcaster (1 Octet)
+ Return Parameters: Current_Settings (4 Octets)
+
+ This command generates a Command Complete event on success or
+ a Command Status event on failure.
+
+
+Set Observer Command
+====================
+
+ Command Code: 0x002C
+ Controller Index: <controller id>
+ Command Parameters: Observer (1 Octet)
+ Return Parameters: Current_Settings (4 Octets)
+
+ This command generates a Command Complete event on success or
+ a Command Status event on failure.
+
+
Command Complete Event
======================
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 10/33] mgmt: Add set observer command
From: Bruna Moreira @ 2012-08-27 17:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Implement Set Observer support in MGMT API. Setting TRUE will make the
adapter start LE discovery, otherwise, setting FALSE will make the
adater stop LE discovery.
---
src/mgmt.c | 5 +++++
src/mgmt.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/mgmt.c b/src/mgmt.c
index 58aab2d..0ff1d71 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -2045,6 +2045,11 @@ int mgmt_set_fast_connectable(int index, gboolean enable)
return 0;
}
+int mgmt_set_observer(int index, gboolean enable)
+{
+ return mgmt_set_mode(index, MGMT_OP_SET_OBSERVER, enable);
+}
+
int mgmt_read_clock(int index, bdaddr_t *bdaddr, int which, int timeout,
uint32_t *clock, uint16_t *accuracy)
{
diff --git a/src/mgmt.h b/src/mgmt.h
index 95245d2..7a21f37 100644
--- a/src/mgmt.h
+++ b/src/mgmt.h
@@ -31,6 +31,7 @@ int mgmt_set_pairable(int index, gboolean pairable);
int mgmt_set_name(int index, const char *name);
int mgmt_set_dev_class(int index, uint8_t major, uint8_t minor);
int mgmt_set_fast_connectable(int index, gboolean enable);
+int mgmt_set_observer(int index, gboolean enable);
int mgmt_start_discovery(int index);
int mgmt_stop_discovery(int index);
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 11/33] mgmt: Add set broadcaster command
From: Bruna Moreira @ 2012-08-27 17:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Implement Set Broadcaster support in MGMT API. Setting TRUE will make
the new data sent by Set Controller Data command to be set in adapter
and the advertising will start. Stop the advertising setting FALSE.
---
src/mgmt.c | 5 +++++
src/mgmt.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/mgmt.c b/src/mgmt.c
index 0ff1d71..3d3a8f7 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -2045,6 +2045,11 @@ int mgmt_set_fast_connectable(int index, gboolean enable)
return 0;
}
+int mgmt_set_broadcaster(int index, gboolean enable)
+{
+ return mgmt_set_mode(index, MGMT_OP_SET_BROADCASTER, enable);
+}
+
int mgmt_set_observer(int index, gboolean enable)
{
return mgmt_set_mode(index, MGMT_OP_SET_OBSERVER, enable);
diff --git a/src/mgmt.h b/src/mgmt.h
index 7a21f37..e77a804 100644
--- a/src/mgmt.h
+++ b/src/mgmt.h
@@ -31,6 +31,7 @@ int mgmt_set_pairable(int index, gboolean pairable);
int mgmt_set_name(int index, const char *name);
int mgmt_set_dev_class(int index, uint8_t major, uint8_t minor);
int mgmt_set_fast_connectable(int index, gboolean enable);
+int mgmt_set_broadcaster(int index, gboolean enable);
int mgmt_set_observer(int index, gboolean enable);
int mgmt_start_discovery(int index);
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 12/33] mgmt: Add set controller data command
From: Bruna Moreira @ 2012-08-27 17:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Implement new Set Controller Data command in MGMT API. The maximum size
accept for new data is HCI_MAX_EIR_LENGTH (240 bytes). The data sent
using this command will be stored in internal list and they will be set
in adapter after receiving a Set Broadcaster with TRUE.
---
src/mgmt.c | 32 ++++++++++++++++++++++++++++++++
src/mgmt.h | 3 +++
2 files changed, 35 insertions(+)
diff --git a/src/mgmt.c b/src/mgmt.c
index 3d3a8f7..a011b3d 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -2497,3 +2497,35 @@ int mgmt_ssp_enabled(int index)
return mgmt_ssp(info->current_settings);
}
+
+int mgmt_set_controller_data(int index, uint8_t flags, uint8_t data_type,
+ uint8_t *data, uint8_t data_length)
+{
+ char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_set_controller_data) +
+ HCI_MAX_EIR_LENGTH];
+ struct mgmt_hdr *hdr = (void *) buf;
+ struct mgmt_cp_set_controller_data *cp = (void *) &buf[sizeof(*hdr)];
+ uint16_t cp_size;
+ int err = 0;
+
+ DBG("hci%d flags %d data_type 0x%hhx data_length %d", index, flags,
+ data_type, data_length);
+
+ memset(buf, 0, sizeof(buf));
+
+ cp_size = sizeof(*cp) + data_length;
+
+ hdr->opcode = htobs(MGMT_OP_SET_CONTROLLER_DATA);
+ hdr->index = htobs(index);
+ hdr->len = htobs(cp_size);
+
+ cp->flags = flags;
+ cp->data_type = data_type;
+ cp->data_length = data_length;
+ memcpy(cp->data, data, data_length);
+
+ if (write(mgmt_sock, buf, sizeof(*hdr) + cp_size) < 0)
+ err = -errno;
+
+ return err;
+}
diff --git a/src/mgmt.h b/src/mgmt.h
index e77a804..18f3544 100644
--- a/src/mgmt.h
+++ b/src/mgmt.h
@@ -82,3 +82,6 @@ int mgmt_confirm_name(int index, bdaddr_t *bdaddr, uint8_t bdaddr_type,
gboolean name_known);
int mgmt_ssp_enabled(int index);
+
+int mgmt_set_controller_data(int index, uint8_t flags, uint8_t data_type,
+ uint8_t *data, uint8_t data_length);
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 13/33] mgmt: Add unset controller data command
From: Bruna Moreira @ 2012-08-27 17:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
From: Jefferson Delfes <jefferson.delfes@openbossa.org>
Implement Unset Controller Data command in MGMT API. This operation
will remove all data from specific type that was set previously with Set
Controller Data operation.
---
src/mgmt.c | 22 ++++++++++++++++++++++
src/mgmt.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/src/mgmt.c b/src/mgmt.c
index a011b3d..0f7b8ed 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -2529,3 +2529,25 @@ int mgmt_set_controller_data(int index, uint8_t flags, uint8_t data_type,
return err;
}
+
+int mgmt_unset_controller_data(int index, uint8_t data_type)
+{
+ char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_unset_controller_data)];
+ struct mgmt_hdr *hdr = (void *) buf;
+ struct mgmt_cp_unset_controller_data *cp = (void *) &buf[sizeof(*hdr)];
+
+ DBG("hci%d data_type 0x%hhx", index, data_type);
+
+ memset(buf, 0, sizeof(buf));
+
+ hdr->opcode = htobs(MGMT_OP_UNSET_CONTROLLER_DATA);
+ hdr->index = htobs(index);
+ hdr->len = htobs(sizeof(*cp));
+
+ cp->data_type = data_type;
+
+ if (write(mgmt_sock, buf, sizeof(buf)) < 0)
+ return -errno;
+
+ return 0;
+}
diff --git a/src/mgmt.h b/src/mgmt.h
index 18f3544..c442231 100644
--- a/src/mgmt.h
+++ b/src/mgmt.h
@@ -85,3 +85,4 @@ int mgmt_ssp_enabled(int index);
int mgmt_set_controller_data(int index, uint8_t flags, uint8_t data_type,
uint8_t *data, uint8_t data_length);
+int mgmt_unset_controller_data(int index, uint8_t data_type);
--
1.7.9.5
^ permalink raw reply related
* [RFC BlueZ 14/33] doc: Add Observer D-Bus API documentation
From: Bruna Moreira @ 2012-08-27 17:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
This is a "high level" API for Observer GAP role.
---
doc/adapter-api.txt | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
index 23f0a2f..9e2e652 100644
--- a/doc/adapter-api.txt
+++ b/doc/adapter-api.txt
@@ -173,6 +173,57 @@ Methods dict GetProperties()
Possible errors: org.bluez.Error.DoesNotExist
+ void RegisterServiceObserver(object observer,
+ uint16 match_value)
+
+ Registers an observer agent to monitor Service Data
+ broadcasts. This agent will be notified whenever a
+ broadcast is received that matches that filter. It is
+ possible use same object path for two observers:
+ Service Data and Manufacturer Specific Data.
+
+ The match_value parameter must be the 16-bit UUID for
+ the service whose data is to be monitored.
+
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.AlreadyExists
+
+ void RegisterManufacturerObserver(object observer,
+ uint16 match_value)
+
+ Registers an observer agent to monitor Manufacturer
+ Specific Data broadcasts. This agent will be notified
+ whenever a broadcast is received that matches that
+ filter. It is possible use same object path for two
+ observers: Service Data and Manufacturer Specific Data.
+
+ The match_value parameter must be the 16-bit Company
+ Identifier Code for the manufacturer whose data is to
+ be monitored.
+
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.AlreadyExists
+
+ void UnregisterServiceObserver(object observer)
+
+ Unregisters a Service Data observer. Broadcasts will
+ not be notified to this agent anymore. The observer
+ will be destroyed only if no Manufacturer Specific Data
+ was registered with the same object path.
+
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.DoesNotExist
+
+ void UnregisterManufacturerObserver(object observer)
+
+ Unregisters a Manufacturer Specific Data observer.
+ Broadcasts will not be notified to this agent anymore.
+ The observer will be destroyed only if no Service Data
+ was registered with the same object path.
+
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.DoesNotExist
+
Signals PropertyChanged(string name, variant value)
This signal indicates a changed value of the given
@@ -275,3 +326,27 @@ Properties string Address [readonly]
List of 128-bit UUIDs that represents the available
local services.
+
+Observer hierarchy
+==================
+
+Service unique name
+Interface org.bluez.Observer
+Object path freely definable
+
+Methods void ServiceReceived(string address, uint16 uuid, variant data)
+
+ This callback gets called when a broadcast data has
+ arrived that matches filter used in
+ RegisterServiceObserver.
+
+ Note: data is a bytearray.
+
+ void ManufacturerReceived(string address, uint16 cid,
+ variant data)
+
+ This callback gets called when a broadcast data has
+ arrived that matches filter used in
+ RegisterManufacturerObserver.
+
+ Note: data is a bytearray.
--
1.7.9.5
^ permalink raw reply related
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