* Re: [PATCH 3/6] Bluetooth: Set discovery parameters
From: Marcel Holtmann @ 2013-08-21 22:56 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
In-Reply-To: <CACJA=fVmvqJu0YxfAZ9A8a-08z6NUvT-J97O3db9ii0vQVKsFg@mail.gmail.com>
Hi Andre,
>>> This patch adds support for setting discovery parameters through
>>> debugfs filesystem.
>>>
>>> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
>>> ---
>>> net/bluetooth/hci_sysfs.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
>>> 1 file changed, 44 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
>>> index 90cb53b..17ebc4a 100644
>>> --- a/net/bluetooth/hci_sysfs.c
>>> +++ b/net/bluetooth/hci_sysfs.c
>>> @@ -553,9 +553,52 @@ static int discovery_parameters_open(struct inode *inode, struct file *file)
>>> return single_open(file, discovery_parameters_show, inode->i_private);
>>> }
>>>
>>> +static ssize_t discovery_parameters_write(struct file *file,
>>> + const char __user *data,
>>> + size_t count, loff_t *offset)
>>> +{
>>> + struct seq_file *sfile = file->private_data;
>>> + struct hci_dev *hdev = sfile->private;
>>> + struct discovery_param param;
>>> + char *buf;
>>> + int n;
>>> + ssize_t res = 0;
>>> +
>>> + /* We don't allow partial writes */
>>> + if (*offset != 0)
>>> + return 0;
>>> +
>>> + buf = kzalloc(count, GFP_KERNEL);
>>> + if (!buf)
>>> + return 0;
>>> +
>>> + if (copy_from_user(buf, data, count))
>>> + goto out;
>>> +
>>> + memset(¶m, 0, sizeof(param));
>>> +
>>> + n = sscanf(buf, "%hhx %hx %hx %u %u %hhx %hhx",
>>> + ¶m.scan_type, ¶m.scan_interval, ¶m.scan_window,
>>> + ¶m.le_scan_duration, ¶m.interleaved_scan_duration,
>>> + ¶m.interleaved_inquiry_length,
>>> + ¶m.bredr_inquiry_length);
>>
>> I am not a huge fan of this crazy. I need a manual to know exactly what to do here. That is just silly. Unless things are a bit self-explanatory on how you can tweak things, I am not really interested here.
>
> What do you think about having the following hierarchy:
>
> hciX/
> |
> |--> discovery_param/
> | |--> scan_type
> | |--> scan_window
> | |--> scan_interval
> | |--> le_scan_timeout
> | |--> interleaved_scan_timeout
> | |--> interleaved_inquiry_length
> | |--> bredr_inquiry_length
> |
> |--> le_conn_param/
> |--> scan_window
> |--> scan_interval
> |--> min_conn_interval
> |--> max_conn_interval
> |--> min_ce_length
> |--> max_ce_length
> |--> supervision_timeout
> |--> conn_latency
>
> It sounds much self-explanatory to me.
don't go crazy with the nesting here. Toplevel directory entries are just fine. The one tricky part you will run into is that things like the scan_window for connections suppose to be per device and not just global. Since you can learn many of these parameters from AD or GATT. And when connecting to one specific device, you suppose to use these ones and not some global common value.
>> Also intermixing LE with BR/EDR is a bit pointless here. I would prefer if they are separate and not that BR/EDR only controller exports LE knobs and and LE only controller exports BR/EDR knobs.
>
> Sure. I'll fix this in the v2 patchset. We can also extend this to
> others debugfs entries (e.g. inquiry_cache and auto_accept_delay files
> should not be exported if controller is LE-only).
Of course they should be separated.
> In the current code, hdev is exported during device registration
> (hci_register_dev). However, in hci_register_dev(), hdev has not been
> initialized yet so we are not able to know is controller is BR/EDR, LE
> or dual mode. In order to fix this, we need to postpone exporting hdev
> by moving hci_add_sysfs call from hci_register_dev() to
> hci_dev_open().
>
> As a side effect, the hciX/ directory will be added to debugfs once
> the adapter is powered on and it will be removed once the adapter is
> powered off. Do you see any problem with that?
That is not acceptable and also not how the kernel actually works. We are initializing the adapter no matter what. So the information is available before power on.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 5/6] Bluetooth: Add LE connection parameters to debugfs
From: Andre Guedes @ 2013-08-21 20:41 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth, Vinicius Costa Gomes
In-Reply-To: <228F27B6-D28E-4377-8C83-81D59E3EF924@holtmann.org>
Hi Marcel,
On Sat, Aug 10, 2013 at 1:10 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Andre,
>
>> From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
>>
>> Only reading the parameters is supported for now.
>
> don't come me with this short kernel commits. Write a proper explanation on what you are doing here and why.
According to what we discussed in the anterior patch, I'll completely
rework this one and write a proper explanation here.
>>
>> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
>> ---
>> net/bluetooth/hci_sysfs.c | 33 +++++++++++++++++++++++++++++++++
>> 1 file changed, 33 insertions(+)
>>
>> diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
>> index 17ebc4a..5993150 100644
>> --- a/net/bluetooth/hci_sysfs.c
>> +++ b/net/bluetooth/hci_sysfs.c
>> @@ -603,6 +603,35 @@ static const struct file_operations discovery_parameters_fops = {
>> .release = single_release,
>> };
>>
>> +static int le_conn_parameters_show(struct seq_file *f, void *p)
>> +{
>> + struct hci_dev *hdev = f->private;
>> + struct le_conn_params *params = &hdev->le_conn_params;
>> +
>> + hci_dev_lock(hdev);
>> +
>> + seq_printf(f, "0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
>> + params->scan_interval, params->scan_window,
>> + params->conn_interval_min, params->conn_interval_max,
>> + params->supervision_timeout);
>> +
>> + hci_dev_unlock(hdev);
>> +
>> + return 0;
>> +}
>> +
>> +static int le_conn_parameters_open(struct inode *inode, struct file *file)
>> +{
>> + return single_open(file, le_conn_parameters_show, inode->i_private);
>> +}
>> +
>> +static const struct file_operations le_conn_parameters_fops = {
>> + .open = le_conn_parameters_open,
>> + .read = seq_read,
>> + .llseek = seq_lseek,
>> + .release = single_release,
>> +};
>> +
>> void hci_init_sysfs(struct hci_dev *hdev)
>> {
>> struct device *dev = &hdev->dev;
>> @@ -647,6 +676,10 @@ int hci_add_sysfs(struct hci_dev *hdev)
>>
>> debugfs_create_file("discovery_parameters", 0644, hdev->debugfs, hdev,
>> &discovery_parameters_fops);
>> +
>> + debugfs_create_file("le_conn_parameters", 0644, hdev->debugfs, hdev,
>> + &le_conn_parameters_fops);
>> +
>> return 0;
>> }
>
> What is the point exactly of exposing this if you are BR/EDR only controller?
Yeah, there is no point. This will be fixed in v2.
BR,
Andre
^ permalink raw reply
* Re: [PATCH 3/6] Bluetooth: Set discovery parameters
From: Andre Guedes @ 2013-08-21 20:41 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <FE070485-AC61-4229-851F-9537CA50AB99@holtmann.org>
Hi Marcel,
On Sat, Aug 10, 2013 at 1:09 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Andre,
>
>> This patch adds support for setting discovery parameters through
>> debugfs filesystem.
>>
>> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
>> ---
>> net/bluetooth/hci_sysfs.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 44 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
>> index 90cb53b..17ebc4a 100644
>> --- a/net/bluetooth/hci_sysfs.c
>> +++ b/net/bluetooth/hci_sysfs.c
>> @@ -553,9 +553,52 @@ static int discovery_parameters_open(struct inode *inode, struct file *file)
>> return single_open(file, discovery_parameters_show, inode->i_private);
>> }
>>
>> +static ssize_t discovery_parameters_write(struct file *file,
>> + const char __user *data,
>> + size_t count, loff_t *offset)
>> +{
>> + struct seq_file *sfile = file->private_data;
>> + struct hci_dev *hdev = sfile->private;
>> + struct discovery_param param;
>> + char *buf;
>> + int n;
>> + ssize_t res = 0;
>> +
>> + /* We don't allow partial writes */
>> + if (*offset != 0)
>> + return 0;
>> +
>> + buf = kzalloc(count, GFP_KERNEL);
>> + if (!buf)
>> + return 0;
>> +
>> + if (copy_from_user(buf, data, count))
>> + goto out;
>> +
>> + memset(¶m, 0, sizeof(param));
>> +
>> + n = sscanf(buf, "%hhx %hx %hx %u %u %hhx %hhx",
>> + ¶m.scan_type, ¶m.scan_interval, ¶m.scan_window,
>> + ¶m.le_scan_duration, ¶m.interleaved_scan_duration,
>> + ¶m.interleaved_inquiry_length,
>> + ¶m.bredr_inquiry_length);
>
> I am not a huge fan of this crazy. I need a manual to know exactly what to do here. That is just silly. Unless things are a bit self-explanatory on how you can tweak things, I am not really interested here.
What do you think about having the following hierarchy:
hciX/
|
|--> discovery_param/
| |--> scan_type
| |--> scan_window
| |--> scan_interval
| |--> le_scan_timeout
| |--> interleaved_scan_timeout
| |--> interleaved_inquiry_length
| |--> bredr_inquiry_length
|
|--> le_conn_param/
|--> scan_window
|--> scan_interval
|--> min_conn_interval
|--> max_conn_interval
|--> min_ce_length
|--> max_ce_length
|--> supervision_timeout
|--> conn_latency
It sounds much self-explanatory to me.
> Also intermixing LE with BR/EDR is a bit pointless here. I would prefer if they are separate and not that BR/EDR only controller exports LE knobs and and LE only controller exports BR/EDR knobs.
Sure. I'll fix this in the v2 patchset. We can also extend this to
others debugfs entries (e.g. inquiry_cache and auto_accept_delay files
should not be exported if controller is LE-only).
In the current code, hdev is exported during device registration
(hci_register_dev). However, in hci_register_dev(), hdev has not been
initialized yet so we are not able to know is controller is BR/EDR, LE
or dual mode. In order to fix this, we need to postpone exporting hdev
by moving hci_add_sysfs call from hci_register_dev() to
hci_dev_open().
As a side effect, the hciX/ directory will be added to debugfs once
the adapter is powered on and it will be removed once the adapter is
powered off. Do you see any problem with that?
BR,
Andre
^ permalink raw reply
* pull request: bluetooth-next 2013-08-21
From: Gustavo Padovan @ 2013-08-21 16:12 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, linux-bluetooth, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 3411 bytes --]
Hi John,
Patches to 3.12, here we have:
* implementation of a proper tty_port for RFCOMM devices, this fixes some
issues people were seeing lately in the kernel.
* Add voice_setting option for SCO, it is used for SCO Codec selection
* bugfixes, small improvements and clean ups
Please pull, Thanks.
Gustavo
--
The following changes since commit 72bb2f2678878dd4a758e628957f29ce28000d88:
bgmac: make bgmac depend on bcm47xx (2013-07-24 11:05:19 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next master
for you to fetch changes up to 2dea632f9acad076370fe871d4ccc93868621403:
Bluetooth: Add SCO connection fallback (2013-08-21 16:47:13 +0200)
----------------------------------------------------------------
Andy Shevchenko (1):
Bluetooth: use DIV_ROUND_UP in suitable places in btmrvl_sdio
Benjamin Tissoires (2):
Bluetooth: hidp: implement hidinput_input_event callback
Bluetooth: hidp: remove wrong send_report at init
Frédéric Dalleau (10):
Bluetooth: Use hci_connect_sco directly
Bluetooth: Remove unused mask parameter in sco_conn_defer_accept
Bluetooth: Add Bluetooth socket voice option
Bluetooth: Add constants for SCO airmode
Bluetooth: Use voice setting in deferred SCO connection request
Bluetooth: Parameters for outgoing SCO connections
Bluetooth: Add constants and macro declaration for transparent data
Bluetooth: Prevent transparent SCO on older devices
Bluetooth: Handle specific error for SCO connection fallback
Bluetooth: Add SCO connection fallback
Gianluca Anzolin (6):
Bluetooth: Take proper tty_struct references
Bluetooth: Remove the device from the list in the destructor
Bluetooth: Move the tty initialization and cleanup out of open/close
Bluetooth: Implement .activate, .shutdown and .carrier_raised methods
Bluetooth: Fix the reference counting of tty_port
Bluetooth: Purge the dlc->tx_queue to avoid circular dependency
Gustavo Padovan (1):
Bluetooth: Add missing braces to an "else if"
Jingoo Han (1):
Bluetooth: replace strict_strtol() with kstrtol()
Johan Hedberg (1):
Bluetooth: Fix getting SCO socket options in deferred state
Marcel Holtmann (2):
Bluetooth: Fix simple whitespace vs tab style issue
Bluetooth: Set different event mask for LE-only controllers
Mikel Astiz (3):
Bluetooth: Add HCI authentication capabilities macros
Bluetooth: Use defines in in hci_get_auth_req()
Bluetooth: Use defines instead of integer literals
drivers/bluetooth/btmrvl_debugfs.c | 6 +-
drivers/bluetooth/btmrvl_sdio.c | 4 +-
include/net/bluetooth/bluetooth.h | 8 ++
include/net/bluetooth/hci.h | 7 +
include/net/bluetooth/hci_core.h | 10 +-
include/net/bluetooth/sco.h | 1 +
net/bluetooth/hci_conn.c | 62 +++++++--
net/bluetooth/hci_core.c | 14 +-
net/bluetooth/hci_event.c | 29 +++--
net/bluetooth/hidp/core.c | 40 ++++--
net/bluetooth/l2cap_core.c | 3 +-
net/bluetooth/rfcomm/tty.c | 271 ++++++++++++++++++---------------------
net/bluetooth/sco.c | 85 +++++++++---
13 files changed, 334 insertions(+), 206 deletions(-)
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* LE GATT service discovery Over BR/EDR
From: Sathish Narasimman @ 2013-08-21 14:08 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
Hi,
I am reading core spec 4.0.
GATT Features regarding Primary Service Discovery in page: 1911
"GATT service discovery over BR/EDR transport will list services that
only run
over an LE transport and therefore only SDP service discovery shall be used
on BR/EDR."
Though SDP Service Discovery is able to get all the related service
information. What is the use of
GATT Service Discovery which gives only LE Information on BR/EDR Controller.
Thanks,
Sathish N
^ permalink raw reply
* [PATCH BlueZ] core: Fix emitting empty Device1.UUIDs property
From: Luiz Augusto von Dentz @ 2013-08-21 12:17 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In case there is a incoming connection but services has not been
resolved the UUID of the profile being connected is automatically added
using btd_device_add_uuid which does update uuids not eir_uuids which is
used if svc_resolved is false.
To fix this the code will now fallback to uuids field whenever eir_uuids is
empty so uuids added with btd_device_add_uuid previous to services being
resolved should appear in UUIDs property.
---
src/device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/device.c b/src/device.c
index f854ed9..457ab64 100644
--- a/src/device.c
+++ b/src/device.c
@@ -911,7 +911,9 @@ static gboolean dev_property_get_uuids(const GDBusPropertyTable *property,
dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
DBUS_TYPE_STRING_AS_STRING, &entry);
- if (!device->svc_resolved)
+ if (device->svc_resolved)
+ l = device->uuids;
+ else if (device->eir_uuids)
l = device->eir_uuids;
else
l = device->uuids;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v5 6/6] rfcomm: Purge the dlc->tx_queue to avoid circular dependency
From: Gianluca Anzolin @ 2013-08-21 8:41 UTC (permalink / raw)
To: Gustavo Padovan, peter, marcel, linux-bluetooth, gregkh, jslaby
In-Reply-To: <20130820092127.GA1908@joana>
On Tue, Aug 20, 2013 at 11:21:27AM +0200, Gustavo Padovan wrote:
> Hi Gianluca,
>
> 2013-07-29 Gianluca Anzolin <gianluca@sottospazio.it>:
>
> > In rfcomm_tty_cleanup we purge the dlc->tx_queue which may contain
> > socket buffers referencing the tty_port and thus preventing the tty_port
> > destruction.
> >
> > Signed-off-by: Gianluca Anzolin <gianluca@sottospazio.it>
> > ---
> > net/bluetooth/rfcomm/tty.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
>
> all patches have been applied to bluetooth-next. Thanks.
>
> Gustavo
Hello,
Thank you!
Gianluca
^ permalink raw reply
* [PATCH BlueZ 10/10 v2] obexd: Make use of g_dbus_send_message*
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This replaces dbus_connection_send* with g_dbus_send_message* which do
not alter message order.
---
obexd/plugins/bluetooth.c | 2 +-
obexd/plugins/pcsuite.c | 5 ++---
obexd/plugins/syncevolution.c | 6 +++---
obexd/src/manager.c | 3 +--
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index e4d518e..10f5e4f 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -317,7 +317,7 @@ static int register_profile(struct bluetooth_profile *profile)
}
dbus_message_iter_close_container(&iter, &opt);
- if (!dbus_connection_send_with_reply(connection, msg, &call, -1)) {
+ if (!g_dbus_send_message_with_reply(connection, msg, &call, -1)) {
ret = -1;
unregister_profile(profile);
goto failed;
diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
index 4ce2fe4..6460aa9 100644
--- a/obexd/plugins/pcsuite.c
+++ b/obexd/plugins/pcsuite.c
@@ -351,7 +351,7 @@ static gboolean send_backup_dbus_message(const char *oper,
DBUS_TYPE_INVALID);
if (strcmp(oper, "open") == 0) {
- ret = dbus_connection_send_with_reply(conn, msg, &pending_call,
+ ret = g_dbus_send_message_with_reply(conn, msg, &pending_call,
BACKUP_DBUS_TIMEOUT);
dbus_message_unref(msg);
if (ret) {
@@ -363,8 +363,7 @@ static gboolean send_backup_dbus_message(const char *oper,
} else
dbus_connection_unref(conn);
} else {
- ret = dbus_connection_send(conn, msg, NULL);
- dbus_message_unref(msg);
+ g_dbus_send_message(conn, msg);
dbus_connection_unref(conn);
}
diff --git a/obexd/plugins/syncevolution.c b/obexd/plugins/syncevolution.c
index 2d25d28..edc00c8 100644
--- a/obexd/plugins/syncevolution.c
+++ b/obexd/plugins/syncevolution.c
@@ -314,7 +314,7 @@ static int synce_close(void *object)
dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &normal,
DBUS_TYPE_STRING, &error, DBUS_TYPE_INVALID);
- dbus_connection_send_with_reply(context->dbus_conn, msg, &call, -1);
+ g_dbus_send_message_with_reply(context->dbus_conn, msg, &call, -1);
dbus_pending_call_set_notify(call, close_cb, NULL, NULL);
dbus_message_unref(msg);
dbus_pending_call_unref(call);
@@ -380,7 +380,7 @@ static ssize_t synce_read(void *object, void *buf, size_t count)
dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &authenticate,
DBUS_TYPE_STRING, &session, DBUS_TYPE_INVALID);
- if (!dbus_connection_send_with_reply(conn, msg, &call, -1)) {
+ if (!g_dbus_send_message_with_reply(conn, msg, &call, -1)) {
error("D-Bus call to %s failed.", SYNCE_SERVER_INTERFACE);
dbus_message_unref(msg);
return -EPERM;
@@ -424,7 +424,7 @@ static ssize_t synce_write(void *object, const void *buf, size_t count)
dbus_message_append_args(msg, DBUS_TYPE_STRING, &type,
DBUS_TYPE_INVALID);
- if (!dbus_connection_send_with_reply(context->dbus_conn, msg,
+ if (!g_dbus_send_message_with_reply(context->dbus_conn, msg,
&call, -1)) {
error("D-Bus call to %s failed.", SYNCE_CONN_INTERFACE);
dbus_message_unref(msg);
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index dbfbef8..f64b7b9 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -776,8 +776,7 @@ int manager_request_authorization(struct obex_transfer *transfer, int32_t time,
dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &transfer->path,
DBUS_TYPE_INVALID);
- if (!dbus_connection_send_with_reply(connection,
- msg, &call, TIMEOUT)) {
+ if (!g_dbus_send_message_with_reply(connection, msg, &call, TIMEOUT)) {
dbus_message_unref(msg);
return -EPERM;
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 09/10 v2] audio/media: Make use of g_dbus_send_message_with_reply
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This replaces dbus_connection_send_with_reply with
g_dbus_send_message_with_reply which does not alter message order.
---
profiles/audio/media.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 5a06b99..9c72b8d 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -325,7 +325,7 @@ static gboolean media_endpoint_async_call(DBusMessage *msg,
request = g_new0(struct endpoint_request, 1);
/* Timeout should be less than avdtp request timeout (4 seconds) */
- if (dbus_connection_send_with_reply(btd_get_dbus_connection(),
+ if (g_dbus_send_message_with_reply(btd_get_dbus_connection(),
msg, &request->call,
REQUEST_TIMEOUT) == FALSE) {
error("D-Bus send failed");
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 08/10 v2] neard: Make use of g_dbus_send_message_with_reply
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This replaces dbus_connection_send_with_reply with
g_dbus_send_message_with_reply which does not alter message order.
---
plugins/neard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/neard.c b/plugins/neard.c
index e4a4d71..ea91c4d 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -158,7 +158,7 @@ static void register_agent(bool append_carrier)
dbus_message_append_args(message, DBUS_TYPE_STRING, &carrier,
DBUS_TYPE_INVALID);
- if (!dbus_connection_send_with_reply(btd_get_dbus_connection(),
+ if (!g_dbus_send_message_with_reply(btd_get_dbus_connection(),
message, &call, -1)) {
dbus_message_unref(message);
error("D-Bus send failed");
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 07/10 v2] core: Make use of g_dbus_send_message_with_reply
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This replaces dbus_connection_send_with_reply with
g_dbus_send_message_with_reply which does not alter message order.
---
src/agent.c | 12 ++++++------
src/profile.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/agent.c b/src/agent.c
index b9e6e8c..7880ba6 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -370,7 +370,7 @@ static int agent_call_authorize_service(struct agent_request *req,
DBUS_TYPE_STRING, &uuid,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(btd_get_dbus_connection(),
+ if (g_dbus_send_message_with_reply(btd_get_dbus_connection(),
req->msg, &req->call,
REQUEST_TIMEOUT) == FALSE) {
error("D-Bus send failed");
@@ -480,7 +480,7 @@ static int pincode_request_new(struct agent_request *req, const char *device_pat
dbus_message_append_args(req->msg, DBUS_TYPE_OBJECT_PATH, &device_path,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(btd_get_dbus_connection(), req->msg,
+ if (g_dbus_send_message_with_reply(btd_get_dbus_connection(), req->msg,
&req->call, REQUEST_TIMEOUT) == FALSE) {
error("D-Bus send failed");
return -EIO;
@@ -574,7 +574,7 @@ static int passkey_request_new(struct agent_request *req,
dbus_message_append_args(req->msg, DBUS_TYPE_OBJECT_PATH, &device_path,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(btd_get_dbus_connection(), req->msg,
+ if (g_dbus_send_message_with_reply(btd_get_dbus_connection(), req->msg,
&req->call, REQUEST_TIMEOUT) == FALSE) {
error("D-Bus send failed");
return -EIO;
@@ -632,7 +632,7 @@ static int confirmation_request_new(struct agent_request *req,
DBUS_TYPE_UINT32, &passkey,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(btd_get_dbus_connection(), req->msg,
+ if (g_dbus_send_message_with_reply(btd_get_dbus_connection(), req->msg,
&req->call, REQUEST_TIMEOUT) == FALSE) {
error("D-Bus send failed");
return -EIO;
@@ -689,7 +689,7 @@ static int authorization_request_new(struct agent_request *req,
DBUS_TYPE_OBJECT_PATH, &device_path,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(btd_get_dbus_connection(), req->msg,
+ if (g_dbus_send_message_with_reply(btd_get_dbus_connection(), req->msg,
&req->call, REQUEST_TIMEOUT) == FALSE) {
error("D-Bus send failed");
return -EIO;
@@ -823,7 +823,7 @@ static int display_pincode_request_new(struct agent_request *req,
DBUS_TYPE_STRING, &pincode,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(btd_get_dbus_connection(), req->msg,
+ if (g_dbus_send_message_with_reply(btd_get_dbus_connection(), req->msg,
&req->call, REQUEST_TIMEOUT) == FALSE) {
error("D-Bus send failed");
return -EIO;
diff --git a/src/profile.c b/src/profile.c
index 90c3535..57aead7 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -938,7 +938,7 @@ static bool send_new_connection(struct ext_profile *ext, struct ext_io *conn)
dbus_message_iter_close_container(&iter, &dict);
- if (!dbus_connection_send_with_reply(btd_get_dbus_connection(),
+ if (!g_dbus_send_message_with_reply(btd_get_dbus_connection(),
msg, &conn->pending, -1)) {
error("%s: sending NewConnection failed", ext->name);
dbus_message_unref(msg);
@@ -1682,7 +1682,7 @@ static int send_disconn_req(struct ext_profile *ext, struct ext_io *conn)
dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID);
- if (!dbus_connection_send_with_reply(btd_get_dbus_connection(),
+ if (!g_dbus_send_message_with_reply(btd_get_dbus_connection(),
msg, &conn->pending, -1)) {
error("%s: sending RequestDisconnection failed", ext->name);
dbus_message_unref(msg);
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 06/10 v2] gdbus: Fix emitting PropertiesChanged twice
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes double emission of PropertiesChanged introduced by flushing
changes, the flushing can happen during the pending processing so the
pending_prop flag needs to be updated in the beginning and the list of
properties can be freed before g_dbus_send_message as it is not required
anymore.
---
gdbus/object.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index be4dcb1..58dbdfc 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1642,6 +1642,8 @@ static void process_properties_from_interface(struct generic_data *data,
DBusMessageIter iter, dict, array;
GSList *invalidated;
+ data->pending_prop = FALSE;
+
if (iface->pending_prop == NULL)
return;
@@ -1691,12 +1693,12 @@ static void process_properties_from_interface(struct generic_data *data,
g_slist_free(invalidated);
dbus_message_iter_close_container(&iter, &array);
+ g_slist_free(iface->pending_prop);
+ iface->pending_prop = NULL;
+
/* Called by process_data do not flush */
dbus_connection_send(data->conn, signal, NULL);
dbus_message_unref(signal);
-
- g_slist_free(iface->pending_prop);
- iface->pending_prop = NULL;
}
static void process_property_changes(struct generic_data *data)
@@ -1708,8 +1710,6 @@ static void process_property_changes(struct generic_data *data)
process_properties_from_interface(data, iface);
}
-
- data->pending_prop = FALSE;
}
void g_dbus_emit_property_changed(DBusConnection *connection,
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 05/10 v2] gdbus: Avoid calling dbus_connection_send*
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
dbus_connection_send* should not be called directly except by
g_dbus_send_message.
---
gdbus/client.c | 14 ++++-----
gdbus/object.c | 92 ++++++++++++++++++++++------------------------------------
2 files changed, 42 insertions(+), 64 deletions(-)
diff --git a/gdbus/client.c b/gdbus/client.c
index d80e252..8ebfaad 100644
--- a/gdbus/client.c
+++ b/gdbus/client.c
@@ -100,7 +100,7 @@ static gboolean modify_match(DBusConnection *conn, const char *member,
dbus_message_append_args(msg, DBUS_TYPE_STRING, &rule,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(conn, msg, &call, -1) == FALSE) {
+ if (g_dbus_send_message_with_reply(conn, msg, &call, -1) == FALSE) {
dbus_message_unref(msg);
return FALSE;
}
@@ -319,7 +319,7 @@ static void get_all_properties(GDBusProxy *proxy)
dbus_message_append_args(msg, DBUS_TYPE_STRING, &proxy->interface,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(client->dbus_conn, msg,
+ if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, -1) == FALSE) {
dbus_message_unref(msg);
return;
@@ -575,7 +575,7 @@ gboolean g_dbus_proxy_refresh_property(GDBusProxy *proxy, const char *name)
&proxy->interface);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &name);
- if (dbus_connection_send_with_reply(client->dbus_conn, msg,
+ if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, -1) == FALSE) {
dbus_message_unref(msg);
refresh_property_free(data);
@@ -668,7 +668,7 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
dbus_message_iter_append_basic(&variant, type, value);
dbus_message_iter_close_container(&iter, &variant);
- if (dbus_connection_send_with_reply(client->dbus_conn, msg,
+ if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, -1) == FALSE) {
dbus_message_unref(msg);
g_free(data);
@@ -742,7 +742,7 @@ gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
setup(&iter, data->user_data);
}
- if (dbus_connection_send_with_reply(client->dbus_conn, msg,
+ if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, METHOD_CALL_TIMEOUT) == FALSE) {
dbus_message_unref(msg);
g_free(data);
@@ -1038,7 +1038,7 @@ static void get_managed_objects(GDBusClient *client)
dbus_message_append_args(msg, DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(client->dbus_conn, msg,
+ if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&client->get_objects_call, -1) == FALSE) {
dbus_message_unref(msg);
return;
@@ -1102,7 +1102,7 @@ static void get_name_owner(GDBusClient *client, const char *name)
dbus_message_append_args(msg, DBUS_TYPE_STRING, &name,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(client->dbus_conn, msg,
+ if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&client->pending_call, -1) == FALSE) {
dbus_message_unref(msg);
return;
diff --git a/gdbus/object.c b/gdbus/object.c
index 4f82ea9..be4dcb1 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -272,8 +272,7 @@ static DBusHandlerResult process_message(DBusConnection *connection,
if (reply == NULL)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- dbus_connection_send(connection, reply, NULL);
- dbus_message_unref(reply);
+ g_dbus_send_message(connection, reply);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -313,19 +312,14 @@ void g_dbus_pending_error_valist(DBusConnection *connection,
for (list = pending_security; list; list = list->next) {
struct security_data *secdata = list->data;
- DBusMessage *reply;
if (secdata->pending != pending)
continue;
pending_security = g_slist_remove(pending_security, secdata);
- reply = g_dbus_create_error_valist(secdata->message,
+ g_dbus_send_error_valist(connection, secdata->message,
name, format, args);
- if (reply != NULL) {
- dbus_connection_send(connection, reply, NULL);
- dbus_message_unref(reply);
- }
dbus_message_unref(secdata->message);
g_free(secdata);
@@ -470,18 +464,13 @@ void g_dbus_pending_property_error_valist(GDBusPendingReply id,
va_list args)
{
struct property_data *propdata;
- DBusMessage *reply;
propdata = remove_pending_property_data(id);
if (propdata == NULL)
return;
- reply = g_dbus_create_error_valist(propdata->message, name, format,
- args);
- if (reply != NULL) {
- dbus_connection_send(propdata->conn, reply, NULL);
- dbus_message_unref(reply);
- }
+ g_dbus_send_error_valist(propdata->conn, propdata->message, name,
+ format, args);
dbus_message_unref(propdata->message);
g_free(propdata);
@@ -1339,45 +1328,6 @@ static gboolean check_signal(DBusConnection *conn, const char *path,
return FALSE;
}
-static dbus_bool_t emit_signal_valist(DBusConnection *conn,
- const char *path,
- const char *interface,
- const char *name,
- int first,
- va_list var_args)
-{
- DBusMessage *signal;
- dbus_bool_t ret;
- const GDBusArgInfo *args;
-
- if (!check_signal(conn, path, interface, name, &args))
- return FALSE;
-
- signal = dbus_message_new_signal(path, interface, name);
- if (signal == NULL) {
- error("Unable to allocate new %s.%s signal", interface, name);
- return FALSE;
- }
-
- ret = dbus_message_append_args_valist(signal, first, var_args);
- if (!ret)
- goto fail;
-
- if (g_dbus_args_have_signature(args, signal) == FALSE) {
- error("%s.%s: got unexpected signature '%s'", interface, name,
- dbus_message_get_signature(signal));
- ret = FALSE;
- goto fail;
- }
-
- ret = dbus_connection_send(conn, signal, NULL);
-
-fail:
- dbus_message_unref(signal);
-
- return ret;
-}
-
gboolean g_dbus_register_interface(DBusConnection *connection,
const char *path, const char *name,
const GDBusMethodTable *methods,
@@ -1640,7 +1590,7 @@ gboolean g_dbus_emit_signal(DBusConnection *connection,
va_start(args, type);
- result = emit_signal_valist(connection, path, interface,
+ result = g_dbus_emit_signal_valist(connection, path, interface,
name, type, args);
va_end(args);
@@ -1652,8 +1602,36 @@ gboolean g_dbus_emit_signal_valist(DBusConnection *connection,
const char *path, const char *interface,
const char *name, int type, va_list args)
{
- return emit_signal_valist(connection, path, interface,
- name, type, args);
+ DBusMessage *signal;
+ dbus_bool_t ret;
+ const GDBusArgInfo *args_info;
+
+ if (!check_signal(connection, path, interface, name, &args_info))
+ return FALSE;
+
+ signal = dbus_message_new_signal(path, interface, name);
+ if (signal == NULL) {
+ error("Unable to allocate new %s.%s signal", interface, name);
+ return FALSE;
+ }
+
+ ret = dbus_message_append_args_valist(signal, type, args);
+ if (!ret)
+ goto fail;
+
+ if (g_dbus_args_have_signature(args_info, signal) == FALSE) {
+ error("%s.%s: got unexpected signature '%s'", interface, name,
+ dbus_message_get_signature(signal));
+ ret = FALSE;
+ goto fail;
+ }
+
+ return g_dbus_send_message(connection, signal);
+
+fail:
+ dbus_message_unref(signal);
+
+ return ret;
}
static void process_properties_from_interface(struct generic_data *data,
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 04/10 v2] gdbus: Add g_dbus_send_message_with_reply
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
g_dbus_send_message_with_reply flushes pending signals before calling
dbus_connection_send_with_reply so it does not alter the message order
---
gdbus/gdbus.h | 3 +++
gdbus/object.c | 11 +++++++++++
2 files changed, 14 insertions(+)
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 8b13393..9542109 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -250,6 +250,9 @@ DBusMessage *g_dbus_create_reply_valist(DBusMessage *message,
int type, va_list args);
gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message);
+gboolean g_dbus_send_message_with_reply(DBusConnection *connection,
+ DBusMessage *message,
+ DBusPendingCall **call, int timeout);
gboolean g_dbus_send_error(DBusConnection *connection, DBusMessage *message,
const char *name, const char *format, ...)
__attribute__((format(printf, 4, 5)));
diff --git a/gdbus/object.c b/gdbus/object.c
index 5af771f..4f82ea9 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1556,6 +1556,17 @@ out:
return result;
}
+gboolean g_dbus_send_message_with_reply(DBusConnection *connection,
+ DBusMessage *message,
+ DBusPendingCall **call, int timeout)
+{
+ /* Flush pending signal to guarantee message order */
+ g_dbus_flush(connection);
+
+ return dbus_connection_send_with_reply(connection, message, call,
+ timeout);
+}
+
gboolean g_dbus_send_error_valist(DBusConnection *connection,
DBusMessage *message, const char *name,
const char *format, va_list args)
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 03/10 v2] gdbus: Fix sending ObjectManager/Properties signals out of order
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In some cases the order of the messages is altered when a message is
sent without processing the pending signals first, currently this affect
client_check_order unit test:
/gdbus/client_check_order: **
ERROR:unit/test-gdbus-client.c:795:property_check_order: assertion failed: (g_strcmp0(string, "value1") == 0)
As can be observed the value of the property is not yet updated because the
signal it is still pending, once this fix is applied the test pass:
/gdbus/client_check_order: OK
Note that the flushing only works when g_dbus_send_message is used so
places where dbus_connection_send and other variants are called directly
may still change the order.
---
gdbus/object.c | 67 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 52 insertions(+), 15 deletions(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index 2f8ef45..5af771f 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -86,6 +86,7 @@ struct property_data {
static int global_flags = 0;
static struct generic_data *root;
+static GSList *pending = NULL;
static gboolean process_changes(gpointer user_data);
static void process_properties_from_interface(struct generic_data *data,
@@ -599,7 +600,9 @@ static void emit_interfaces_added(struct generic_data *data)
dbus_message_iter_close_container(&iter, &array);
- g_dbus_send_message(data->conn, signal);
+ /* Called by process_data do not flush */
+ dbus_connection_send(data->conn, signal, NULL);
+ dbus_message_unref(signal);
}
static struct interface_data *find_interface(GSList *interfaces,
@@ -640,6 +643,16 @@ static gboolean g_dbus_args_have_signature(const GDBusArgInfo *args,
return TRUE;
}
+static void add_pending(struct generic_data *data)
+{
+ if (data->process_id > 0)
+ return;
+
+ data->process_id = g_idle_add(process_changes, data);
+
+ pending = g_slist_append(pending, data);
+}
+
static gboolean remove_interface(struct generic_data *data, const char *name)
{
struct interface_data *iface;
@@ -677,10 +690,7 @@ static gboolean remove_interface(struct generic_data *data, const char *name)
data->removed = g_slist_prepend(data->removed, iface->name);
g_free(iface);
- if (data->process_id > 0)
- return TRUE;
-
- data->process_id = g_idle_add(process_changes, data);
+ add_pending(data);
return TRUE;
}
@@ -976,14 +986,26 @@ static void emit_interfaces_removed(struct generic_data *data)
dbus_message_iter_close_container(&iter, &array);
- g_dbus_send_message(data->conn, signal);
+ /* Called by process_data do not flush */
+ dbus_connection_send(data->conn, signal, NULL);
+ dbus_message_unref(signal);
+}
+
+static void remove_pending(struct generic_data *data)
+{
+ if (data->process_id > 0) {
+ g_source_remove(data->process_id);
+ data->process_id = 0;
+ }
+
+ pending = g_slist_remove(pending, data);
}
static gboolean process_changes(gpointer user_data)
{
struct generic_data *data = user_data;
- data->process_id = 0;
+ remove_pending(data);
if (data->added != NULL)
emit_interfaces_added(data);
@@ -1211,10 +1233,8 @@ done:
return TRUE;
data->added = g_slist_append(data->added, iface);
- if (data->process_id > 0)
- return TRUE;
- data->process_id = g_idle_add(process_changes, data);
+ add_pending(data);
return TRUE;
}
@@ -1494,6 +1514,21 @@ DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...)
return reply;
}
+static void g_dbus_flush(DBusConnection *connection)
+{
+ GSList *l;
+
+ for (l = pending; l;) {
+ struct generic_data *data = l->data;
+
+ l = l->next;
+ if (data->conn != connection)
+ continue;
+
+ process_changes(data);
+ }
+}
+
gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
{
dbus_bool_t result = FALSE;
@@ -1510,6 +1545,9 @@ gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
goto out;
}
+ /* Flush pending signal to guarantee message order */
+ g_dbus_flush(connection);
+
result = dbus_connection_send(connection, message, NULL);
out:
@@ -1664,7 +1702,9 @@ static void process_properties_from_interface(struct generic_data *data,
g_slist_free(invalidated);
dbus_message_iter_close_container(&iter, &array);
- g_dbus_send_message(data->conn, signal);
+ /* Called by process_data do not flush */
+ dbus_connection_send(data->conn, signal, NULL);
+ dbus_message_unref(signal);
g_slist_free(iface->pending_prop);
iface->pending_prop = NULL;
@@ -1723,10 +1763,7 @@ void g_dbus_emit_property_changed(DBusConnection *connection,
iface->pending_prop = g_slist_prepend(iface->pending_prop,
(void *) property);
- if (!data->process_id) {
- data->process_id = g_idle_add(process_changes, data);
- return;
- }
+ add_pending(data);
}
gboolean g_dbus_get_properties(DBusConnection *connection, const char *path,
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 02/10 v2] unit: Add gdbus/client_check_order
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
unit/test-gdbus-client.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/unit/test-gdbus-client.c b/unit/test-gdbus-client.c
index a594384..488d4ec 100644
--- a/unit/test-gdbus-client.c
+++ b/unit/test-gdbus-client.c
@@ -35,6 +35,7 @@ struct context {
GMainLoop *main_loop;
DBusConnection *dbus_conn;
GDBusClient *dbus_client;
+ GDBusProxy *proxy;
void *data;
guint timeout_source;
};
@@ -779,6 +780,74 @@ static void client_string_changed(void)
destroy_context(context);
}
+static void property_check_order(const DBusError *err, void *user_data)
+{
+ struct context *context = user_data;
+ GDBusProxy *proxy = context->proxy;
+ DBusMessageIter iter;
+ const char *string;
+
+ g_assert(!dbus_error_is_set(err));
+
+ g_assert(g_dbus_proxy_get_property(proxy, "String", &iter));
+
+ dbus_message_iter_get_basic(&iter, &string);
+ g_assert(g_strcmp0(string, "value1") == 0);
+
+ g_dbus_client_unref(context->dbus_client);
+}
+
+static void proxy_check_order(GDBusProxy *proxy, void *user_data)
+{
+ struct context *context = user_data;
+ const char *string;
+
+ if (g_test_verbose())
+ g_print("proxy %s found\n",
+ g_dbus_proxy_get_interface(proxy));
+
+ context->proxy = proxy;
+ string = "value1";
+ g_assert(g_dbus_proxy_set_property_basic(proxy, "String",
+ DBUS_TYPE_STRING, &string,
+ property_check_order, context,
+ NULL));
+}
+
+static void client_check_order(void)
+{
+ struct context *context = create_context();
+ static const GDBusPropertyTable string_properties[] = {
+ { "String", "s", get_string, set_string, string_exists },
+ { },
+ };
+
+ if (context == NULL)
+ return;
+
+ context->data = g_strdup("value");
+ g_dbus_register_interface(context->dbus_conn,
+ SERVICE_PATH, SERVICE_NAME,
+ methods, signals, string_properties,
+ context, NULL);
+
+ context->dbus_client = g_dbus_client_new(context->dbus_conn,
+ SERVICE_NAME, SERVICE_PATH);
+
+ g_dbus_client_set_disconnect_watch(context->dbus_client,
+ disconnect_handler, context);
+ g_dbus_client_set_proxy_handlers(context->dbus_client,
+ proxy_check_order, NULL, NULL,
+ context);
+
+ g_main_loop_run(context->main_loop);
+
+ g_dbus_unregister_interface(context->dbus_conn,
+ SERVICE_PATH, SERVICE_NAME);
+
+ destroy_context(context);
+}
+
int main(int argc, char *argv[])
{
g_test_init(&argc, &argv, NULL);
@@ -809,5 +878,7 @@ int main(int argc, char *argv[])
g_test_add_func("/gdbus/client_string_changed",
client_string_changed);
+ g_test_add_func("/gdbus/client_check_order", client_check_order);
+
return g_test_run();
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 01/10 v2] build: Fix not rebuilding bluetoothd if gdbus changes
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1377004035-16936-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
src_bluetoothd_DEPENDENCIES should list all local libraries including gdbus
otherwise it does not get relinked whenever gdbus changes.
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index b8890ec..bf66c2b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -157,7 +157,7 @@ src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
-Wl,--version-script=$(srcdir)/src/bluetooth.ver
src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
- src/bluetooth.service
+ gdbus/libgdbus-internal.la src/bluetooth.service
src_bluetoothd_CFLAGS = $(AM_CFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
-DPLUGINDIR=\""$(build_plugindir)"\"
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 00/10 v2] Fix message order
From: Luiz Augusto von Dentz @ 2013-08-20 13:07 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This set fixes a couple of issues introduced with the use of ObjectManager due
the processing of signals on idle to group changes, this has been causing
issues with external components such as ofono and pulseaudio that sometimes
receives connections from devices objects that have pending signals thus
cannot be properly processed or have to be assumed paired and with certain
UUIDs which is not ideal.
v2: Fixes some commit messages as suggested by Lucas Demarchi, in addition to
that rework flush mechanism to honor the order of the pending signals and make
it work with any connection.
Luiz Augusto von Dentz (10):
build: Fix not rebuilding bluetoothd if gdbus changes
unit: Add gdbus/client_check_order
gdbus: Fix not sending ObjectManager/Properties signals out of order
gdbus: Add g_dbus_send_message_with_reply
gdbus: Avoid calling dbus_connection_send*
gdbus: Fix emitting PropertiesChanged twice
core: Make use of g_dbus_send_message_with_reply
neard: Make use of g_dbus_send_message_with_reply
audio/media: Make use of g_dbus_send_message_with_reply
obexd: Make use of g_dbus_send_message*
Makefile.am | 2 +-
gdbus/client.c | 14 ++--
gdbus/gdbus.h | 3 +
gdbus/object.c | 176 ++++++++++++++++++++++++------------------
obexd/plugins/bluetooth.c | 2 +-
obexd/plugins/pcsuite.c | 5 +-
obexd/plugins/syncevolution.c | 6 +-
obexd/src/manager.c | 3 +-
plugins/neard.c | 2 +-
profiles/audio/media.c | 2 +-
src/agent.c | 12 +--
src/profile.c | 4 +-
unit/test-gdbus-client.c | 71 +++++++++++++++++
13 files changed, 200 insertions(+), 102 deletions(-)
--
1.8.3.1
^ permalink raw reply
* Re: [PATCH BlueZ] build: Fix not checking readline.h for bluetooth-player
From: Luiz Augusto von Dentz @ 2013-08-20 12:28 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
In-Reply-To: <1376922779-11802-2-git-send-email-luiz.dentz@gmail.com>
Hi,
On Mon, Aug 19, 2013 at 5:32 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> If --disable-client is passed to configure script is possible to build
> BlueZ without readline which would cause the following error:
>
> tools/bluetooth-player.c:36:31: fatal error: readline/readline.h: No such file or directory
> #include <readline/readline.h>
> ^
> ---
> Makefile.tools | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/Makefile.tools b/Makefile.tools
> index 3bb0e82..4bcb18e 100644
> --- a/Makefile.tools
> +++ b/Makefile.tools
> @@ -172,8 +172,7 @@ if EXPERIMENTAL
> noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest tools/scotest \
> tools/hcieventmask tools/hcisecfilter tools/hwdb \
> tools/btmgmt tools/btattach tools/btsnoop \
> - tools/btiotest tools/mpris-player \
> - tools/bluetooth-player
> + tools/btiotest tools/mpris-player
>
> tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
> tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
> @@ -199,17 +198,13 @@ tools_btiotest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> tools_mpris_player_SOURCES = tools/mpris-player.c
> tools_mpris_player_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
>
> -tools_bluetooth_player_SOURCES = tools/bluetooth-player.c \
> - client/display.h client/display.c
> -tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
> - @GLIB_LIBS@ @DBUS_LIBS@ -lreadline
> -
> EXTRA_DIST += tools/bdaddr.1
> endif
>
> if READLINE
> noinst_PROGRAMS += attrib/gatttool \
> - tools/obex-client-tool tools/obex-server-tool
> + tools/obex-client-tool tools/obex-server-tool \
> + tools/bluetooth-player
>
> attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
> attrib/gattrib.c btio/btio.c \
> @@ -226,6 +221,11 @@ tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \
> tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
> tools/obex-server-tool.c
> tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> +
> +tools_bluetooth_player_SOURCES = tools/bluetooth-player.c \
> + client/display.h client/display.c
> +tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
> + @GLIB_LIBS@ @DBUS_LIBS@ -lreadline
> endif
>
> if EXPERIMENTAL
> --
> 1.8.3.1
I went ahead and applied this one.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: Fix security level for peripheral role
From: Andre Guedes @ 2013-08-20 12:14 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1375298729-23513-1-git-send-email-andre.guedes@openbossa.org>
Ping.
On Wed, Jul 31, 2013 at 4:25 PM, Andre Guedes
<andre.guedes@openbossa.org> wrote:
> While playing the peripheral role, the host gets a LE Long Term Key
> Request Event from the controller when a connection is established
> with a bonded device. The host then informs the LTK which should be
> used for the connection. Once the link is encrypted, the host gets
> an Encryption Change Event.
>
> Therefore we should set conn->pending_sec_level instead of conn->
> sec_level in hci_le_ltk_request_evt. This way, conn->sec_level is
> properly updated in hci_encrypt_change_evt.
>
> Moreover, since we have a LTK associated to the device, we have at
> least BT_SECURITY_MEDIUM security level.
>
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
> net/bluetooth/hci_event.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 50e39f4..ea993ab 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -3556,7 +3556,9 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
> cp.handle = cpu_to_le16(conn->handle);
>
> if (ltk->authenticated)
> - conn->sec_level = BT_SECURITY_HIGH;
> + conn->pending_sec_level = BT_SECURITY_HIGH;
> + else
> + conn->pending_sec_level = BT_SECURITY_MEDIUM;
>
> hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp);
>
> --
> 1.8.3.4
>
^ permalink raw reply
* Re: [PATCH v11 10/10] Bluetooth: Add SCO connection fallback
From: Gustavo Padovan @ 2013-08-20 9:41 UTC (permalink / raw)
To: Frédéric Dalleau; +Cc: linux-bluetooth, Johan Hedberg
In-Reply-To: <1376915043-24531-11-git-send-email-frederic.dalleau@linux.intel.com>
Hi Frédéric,
2013-08-19 Frédéric Dalleau <frederic.dalleau@linux.intel.com>:
> When initiating a transparent eSCO connection, make use of T2 settings
> at first try. T2 is the recommended settings from HFP 1.6 WideBand
> Speech. Upon connection failure, try T1 settings.
>
> When CVSD is requested and eSCO is supported, try to establish eSCO
> connection using S3 settings. If it fails, fallback in sequence to S2,
> S1, D1, D0 settings.
>
> To know which setting should be used, conn->attempt is used. It
> indicates the currently ongoing SCO connection attempt and can be used
> as the index for the fallback settings table.
>
> These setting and the fallback order are described in Bluetooth HFP 1.6
> specification p. 101.
>
> Signed-off-by: Frédéric Dalleau <frederic.dalleau@linux.intel.com>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> include/net/bluetooth/hci_core.h | 2 +-
> net/bluetooth/hci_conn.c | 44 +++++++++++++++++++++++++++++++-------
> net/bluetooth/hci_event.c | 6 +++---
> 3 files changed, 40 insertions(+), 12 deletions(-)
All 10 patches have been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: Remove assignment in if
From: Gustavo Padovan @ 2013-08-20 9:25 UTC (permalink / raw)
To: Valentin Ilie; +Cc: marcel, johan.hedberg, Dean_Jenkins, linux-bluetooth
In-Reply-To: <CAHuBVBYQaDt6UZ6oJvY1D4DKQZnOmD+RmsgnFkYKxUPJ80L4Rw@mail.gmail.com>
Hi Valentin,
2013-08-19 Valentin Ilie <valentin.ilie@gmail.com>:
> On 12 August 2013 18:46, Valentin Ilie <valentin.ilie@gmail.com> wrote:
> > Remove assignment in if
>
> Hello,
>
> Can anyone look into this patch? I've corrected it as requested.
I can't see your patch anywhere. Could you please resend it?
Gustavo
^ permalink raw reply
* Re: [PATCH v5 6/6] rfcomm: Purge the dlc->tx_queue to avoid circular dependency
From: Gustavo Padovan @ 2013-08-20 9:21 UTC (permalink / raw)
To: Gianluca Anzolin; +Cc: peter, marcel, linux-bluetooth, gregkh, jslaby
In-Reply-To: <1375110493-5237-7-git-send-email-gianluca@sottospazio.it>
Hi Gianluca,
2013-07-29 Gianluca Anzolin <gianluca@sottospazio.it>:
> In rfcomm_tty_cleanup we purge the dlc->tx_queue which may contain
> socket buffers referencing the tty_port and thus preventing the tty_port
> destruction.
>
> Signed-off-by: Gianluca Anzolin <gianluca@sottospazio.it>
> ---
> net/bluetooth/rfcomm/tty.c | 6 ++++++
> 1 file changed, 6 insertions(+)
all patches have been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* python scripts not working
From: Markus Roppelt @ 2013-08-20 9:21 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 1978 bytes --]
Hi,
I have problems to get the python test scripts running.
My configuration is Ubuntu 13.10 with Kernel 3.8.0-27-generic. For the
installation of Bluez 5.7 I used the following commands:
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc
--localstatedir=/var -disable-systemd
make
make install
Then I changed the init.d script to the new bluetoothd, as pointed out
here: http://permalink.gmane.org/gmane.linux.bluez.kernel/35011
/etc/init.d/bluetooth stop
# do a backup of the original executable
mv /usr/sbin/bluetoothd /usr/sbin/bluetoothd.orig
ln -s /usr/libexec/bluetooth/bluetoothd /usr/sbin/bluetoothd
/etc/init.d/bluetooth start
Everything worked fine and I can connect to the Bluetooth chip (Nordic
nrf51822) using the command:
sudo gatttool -b D1:83:15:3C:26:F0 -t random --interactive
I can read the descriptions, enable notifications as expected.
However, when I start the python heart rate example, I get the following error.
markus@markus-G33M-DS2R:~/ble-server/bluez-5.7/test$ sudo
./test-heartrate -b D1:83:15:3C:26:F0
Traceback (most recent call last):
File "./test-heartrate", line 71, in <module>
heartrateManager.RegisterWatcher(path)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line
651, in call_blocking
message, timeout)
dbus.exceptions.DBusException:
org.freedesktop.DBus.Error.UnknownMethod: Method "RegisterWatcher"
with signature "s" on interface "org.bluez.HeartRateManager1" doesn't
exist
Attached you'll find a dump (btmon -w btmon.dump) during the
./test-heartrate call as mentioned
here:http://article.gmane.org/gmane.linux.bluez.kernel/37419
I suspect that the dump is empty because of the small file size.
How can I get the script running?
Best Regards
Markus
[-- Attachment #2: btmon.dump --]
[-- Type: application/octet-stream, Size: 56 bytes --]
^ permalink raw reply
* Re: [PATCH BlueZ 1/2] build: Fix not rebuilding bluetoothd if gdbus changes
From: Lucas De Marchi @ 2013-08-20 0:01 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: BlueZ development
In-Reply-To: <1376923727-12152-1-git-send-email-luiz.dentz@gmail.com>
On Mon, Aug 19, 2013 at 11:48 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> src_bluetoothd_DEPENDENCIES should list all local libraries including gdbus
> otherwise it does not get recompiled whenever gdbus changes.
relinked, not recompiled
Lucas De Marchi
^ 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