* [PATCH 3/8] adapter: Convert storage classes
From: Frédéric Danis @ 2012-11-15 17:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1353000701-16605-1-git-send-email-frederic.danis@linux.intel.com>
---
src/adapter.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index ea2d2ad..5157b46 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2545,6 +2545,11 @@ static void convert_trusts_entry(GKeyFile *key_file, void *value)
g_key_file_set_boolean(key_file, "General", "Trusted", TRUE);
}
+static void convert_classes_entry(GKeyFile *key_file, void *value)
+{
+ g_key_file_set_string(key_file, "General", "Class", value);
+}
+
static void convert_entry(char *key, char *value, void *user_data)
{
struct device_converter *converter = user_data;
@@ -2624,6 +2629,9 @@ static void convert_device_storage(struct btd_adapter *adapter)
/* Convert trusts */
convert_file("trusts", address, convert_trusts_entry);
+
+ /* Convert classes */
+ convert_file("classes", address, convert_classes_entry);
}
static void convert_config(struct btd_adapter *adapter, const char *filename,
--
1.7.9.5
^ permalink raw reply related
* [PATCH 4/8] device: Retrieve class from storage
From: Frédéric Danis @ 2012-11-15 17:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1353000701-16605-1-git-send-email-frederic.danis@linux.intel.com>
When device class is updated, save it and emit property changed signal.
---
src/device.c | 60 ++++++++++++++++++++++++++++++++++++++--------------------
src/device.h | 1 +
2 files changed, 41 insertions(+), 20 deletions(-)
diff --git a/src/device.c b/src/device.c
index 5969f15..d4d649b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -149,6 +149,7 @@ struct btd_device {
GSList *eir_uuids;
char name[MAX_NAME_LENGTH + 1];
char *alias;
+ uint32_t class;
uint16_t vendor_src;
uint16_t vendor;
uint16_t product;
@@ -211,6 +212,7 @@ static gboolean store_device_info_cb(gpointer user_data)
char adapter_addr[18];
char device_addr[18];
char *str;
+ char class[9];
gsize length = 0;
device->store_id = 0;
@@ -223,6 +225,11 @@ static gboolean store_device_info_cb(gpointer user_data)
g_key_file_set_string(key_file, "General", "Alias",
device->alias);
+ if (device->class) {
+ sprintf(class, "0x%6.6x", device->class);
+ g_key_file_set_string(key_file, "General", "Class", class);
+ }
+
g_key_file_set_boolean(key_file, "General", "Trusted",
device->trusted);
@@ -470,35 +477,23 @@ static void dev_property_set_alias(const GDBusPropertyTable *property,
set_alias(id, alias, data);
}
-static gboolean get_class(const GDBusPropertyTable *property, void *data,
- uint32_t *class)
-{
- struct btd_device *device = data;
-
- if (read_remote_class(adapter_get_address(device->adapter),
- &device->bdaddr, class) == 0)
- return TRUE;
-
- return FALSE;
-}
-
static gboolean dev_property_exists_class(const GDBusPropertyTable *property,
void *data)
{
- uint32_t class;
+ struct btd_device *device = data;
- return get_class(property, data, &class);
+ return device->class != 0;
}
static gboolean dev_property_get_class(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
- uint32_t class;
+ struct btd_device *device = data;
- if (!get_class(property, data, &class))
+ if (device->class == 0)
return FALSE;
- dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &class);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &device->class);
return TRUE;
}
@@ -542,12 +537,12 @@ static gboolean dev_property_get_appearance(const GDBusPropertyTable *property,
static const char *get_icon(const GDBusPropertyTable *property, void *data)
{
+ struct btd_device *device = data;
const char *icon = NULL;
- uint32_t class;
uint16_t appearance;
- if (get_class(property, data, &class))
- icon = class_to_icon(class);
+ if (device->class != 0)
+ icon = class_to_icon(device->class);
else if (get_appearance(property, data, &appearance))
icon = gap_appearance_to_icon(appearance);
@@ -1745,6 +1740,16 @@ static void load_info(struct btd_device *device, const gchar *local,
device->alias = g_key_file_get_string(key_file, "General", "Alias",
NULL);
+ /* Load class */
+ str = g_key_file_get_string(key_file, "General", "Class", NULL);
+ if (str) {
+ uint32_t class;
+
+ if (sscanf(str, "%x", &class) == 1)
+ device->class = class;
+ g_free(str);
+ }
+
/* Load trust */
device->trusted = g_key_file_get_boolean(key_file, "General",
"Trusted", NULL);
@@ -1849,6 +1854,21 @@ bool device_name_known(struct btd_device *device)
return device->name[0] != '\0';
}
+void device_set_class(struct btd_device *device, uint32_t class)
+{
+ if (device->class == class)
+ return;
+
+ DBG("%s 0x%06X", device->path, class);
+
+ device->class = class;
+
+ store_device_info(device);
+
+ g_dbus_emit_property_changed(btd_get_dbus_connection(), device->path,
+ DEVICE_INTERFACE, "Class");
+}
+
uint16_t btd_device_get_vendor(struct btd_device *device)
{
return device->vendor;
diff --git a/src/device.h b/src/device.h
index ea646a8..3715698 100644
--- a/src/device.h
+++ b/src/device.h
@@ -32,6 +32,7 @@ struct btd_device *device_create(struct btd_adapter *adapter,
void device_set_name(struct btd_device *device, const char *name);
void device_get_name(struct btd_device *device, char *name, size_t len);
bool device_name_known(struct btd_device *device);
+void device_set_class(struct btd_device *device, uint32_t class);
uint16_t btd_device_get_vendor(struct btd_device *device);
uint16_t btd_device_get_vendor_src(struct btd_device *device);
uint16_t btd_device_get_product(struct btd_device *device);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 5/8] adapter: Set device class in device object
From: Frédéric Danis @ 2012-11-15 17:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1353000701-16605-1-git-send-email-frederic.danis@linux.intel.com>
Move storage of device class after device object creation.
---
src/adapter.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 5157b46..9ecc0fa 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3070,9 +3070,6 @@ void adapter_update_found_devices(struct btd_adapter *adapter,
return;
}
- if (eir_data.class != 0)
- write_remote_class(&adapter->bdaddr, bdaddr, eir_data.class);
-
if (eir_data.appearance != 0)
write_remote_appearance(&adapter->bdaddr, bdaddr, bdaddr_type,
eir_data.appearance);
@@ -3102,6 +3099,9 @@ void adapter_update_found_devices(struct btd_adapter *adapter,
if (eir_data.name)
device_set_name(dev, eir_data.name);
+ if (eir_data.class != 0)
+ device_set_class(dev, eir_data.class);
+
device_add_eir_uuids(dev, eir_data.services);
eir_data_free(&eir_data);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 6/8] event: Set device class in device object
From: Frédéric Danis @ 2012-11-15 17:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1353000701-16605-1-git-send-email-frederic.danis@linux.intel.com>
---
src/event.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/event.c b/src/event.c
index 5f1fc9f..7fc8f02 100644
--- a/src/event.c
+++ b/src/event.c
@@ -419,7 +419,7 @@ void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer, uint8_t bdaddr_typ
update_lastused(local, peer, bdaddr_type);
if (class != 0)
- write_remote_class(local, peer, class);
+ device_set_class(device, class);
device_set_addr_type(device, bdaddr_type);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 7/8] dbusoob: Set device class in device object
From: Frédéric Danis @ 2012-11-15 17:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1353000701-16605-1-git-send-email-frederic.danis@linux.intel.com>
---
plugins/dbusoob.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
index b59ffa8..e58b353 100644
--- a/plugins/dbusoob.c
+++ b/plugins/dbusoob.c
@@ -191,7 +191,9 @@ static gboolean parse_data(DBusMessageIter *data, struct oob_data *remote_data)
return TRUE;
}
-static gboolean store_data(struct btd_adapter *adapter, struct oob_data *data)
+static gboolean store_data(struct btd_adapter *adapter,
+ struct btd_device *device,
+ struct oob_data *data)
{
bdaddr_t bdaddr;
@@ -204,8 +206,7 @@ static gboolean store_data(struct btd_adapter *adapter, struct oob_data *data)
}
if (data->class)
- write_remote_class(adapter_get_address(adapter), &bdaddr,
- data->class);
+ device_set_class(device, data->class);
if (data->name)
btd_event_remote_name(adapter_get_address(adapter), &bdaddr,
@@ -255,7 +256,7 @@ static DBusMessage *add_remote_data(DBusConnection *conn, DBusMessage *msg,
if (!parse_data(&data, &remote_data))
return btd_error_invalid_args(msg);
- if (!store_data(adapter, &remote_data))
+ if (!store_data(adapter, device, &remote_data))
return btd_error_failed(msg, "Request failed");
reply = dbus_message_new_method_return(msg);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 8/8] neard: Set device class in device object
From: Frédéric Danis @ 2012-11-15 17:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1353000701-16605-1-git-send-email-frederic.danis@linux.intel.com>
This will create a new device object and generate
DeviceCreated signal
---
plugins/neard.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/neard.c b/plugins/neard.c
index 8f8381c..069953a 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -287,10 +287,11 @@ static int process_eir(struct btd_adapter *adapter, uint8_t *eir, size_t size,
if (device)
adapter_remove_device(adapter, device, TRUE);
+ device = adapter_get_device(adapter, remote_address);
+
/* store OOB data */
if (eir_data.class != 0)
- write_remote_class(adapter_get_address(adapter),
- &eir_data.addr, eir_data.class);
+ device_set_class(device, eir_data.class);
/* TODO handle incomplete name? */
if (eir_data.name)
--
1.7.9.5
^ permalink raw reply related
* [PATCH] doc: Add HFP design document
From: Frédéric Danis @ 2012-11-15 17:35 UTC (permalink / raw)
To: linux-bluetooth
---
Makefile.am | 2 +-
doc/audio-telephony-design.txt | 320 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 321 insertions(+), 1 deletion(-)
create mode 100644 doc/audio-telephony-design.txt
diff --git a/Makefile.am b/Makefile.am
index e8a247a..a167a24 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -342,7 +342,7 @@ EXTRA_DIST += doc/manager-api.txt \
doc/media-api.txt doc/assigned-numbers.txt \
doc/supported-features.txt doc/alert-api.txt doc/mgmt-api.txt \
doc/oob-api.txt doc/proximity-api.txt doc/heartrate-api.txt \
- doc/thermometer-api.txt
+ doc/thermometer-api.txt doc/audio-telephony-design.txt
AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@
diff --git a/doc/audio-telephony-design.txt b/doc/audio-telephony-design.txt
new file mode 100644
index 0000000..7604f9f
--- /dev/null
+++ b/doc/audio-telephony-design.txt
@@ -0,0 +1,320 @@
+Telephony Interface Design
+**************************
+
+Introduction
+============
+
+The aim of this document is to briefly describe usage of profile interface which
+will allow external application to implement telephony related profiles
+(headset, handsfree).
+
+
+The goal
+========
+
+Previous version of headset code in BlueZ needs the implementation of an AT
+parser for each modem target or external telephony application (Maemo, oFono)
+which is not the aim of Bluez.
+
+The profile interface allows BlueZ to focus on Bluetooth communication part
+(connection, disconnection, authentication, authorization) and let external
+application (i.e. oFono) take charge of the Telephony tasks (AT parsing and
+modem specific code).
+This will allow code to be simpler, easier to maintain and debug in both BlueZ
+and telephony application.
+
+
+Design
+======
+
+External applications, which should implement AT parsing and telephony part
+will have to register an org.bluez.Profile1 agent using RegisterProfile of
+org.bluez.ProfileManager1 interface.
+This will setup a SDP record for the profile and a RFCOMM server listening for
+incoming connection.
+
+When a new device is connected, NewConnection method of Profile1 agent is
+called with informations related to connecting profile (like RFCOMM client file
+descriptor, version, features, media end point path, ...).
+
+The telephony application is in charge to implement a MediaTransport for its
+audio connection with remote device and interact with the MediaTransport of the
+audio component (i.e. PulseAudio).
+
+
+Flow charts
+===========
+
+Here is some flowcharts of interactions between BlueZ, telephony agent (oFono)
+and audio component (PulseAudio):
+
+ .....> Bluetooth communication between headset and phone
+ -----> Dbus messages and signals
+
+Start up
+--------
+
+When PulseAudio starts it registers media endpoints to BlueZ.
+When oFono starts it registers profile agent for HFP.
+
+ PulseAudio BlueZ oFono
+ | | |
+ | register media endpoint | |
+ |------------------------>| |
+ | | register profile agent |
+ | |<-----------------------|
+ | | |
+
+HFP Connection
+--------------
+
+On incoming connection, BlueZ performs (if needed) authentication and
+authorization then passes RFCOMM file descriptor and media end point path to
+oFono.
+oFono should create a media transport and register it to PulseAudio using the
+media end point path.
+
+ PulseAudio oFono BlueZ HF
+ | | | |
+ | | | connection |
+ | | | set-up |
+ | | |<............>|
+ | | NewConnection | |
+ | |<---------------| |
+ | SelectConfiguration | | |
+ |<--------------------| | |
+ | | | |
+ | SetConfiguration | | |
+ |<--------------------| | |
+ | | | |
+
+Outgoing SCO connection - HFP <= 1.5
+------------------------------------
+
+When PulseAudio needs to setup the audio connection it will call media
+transport acquire method. This will perform a SCO connection and return the SCO
+socket file descriptor to PulseAudio.
+
+ PulseAudio oFono HF/AG
+ | | |
+ | transport acquire | |
+ |------------------------>| |
+ | | connect SCO |
+ | |..............>|
+ | return SCO fd | |
+ |<------------------------| |
+ | | |
+
+Incoming SCO connection - HFP <= 1.5
+------------------------------------
+
+On an incoming SCO connection oFono will change to playing state.
+On reception of this state change, PulseAudio will call media transport acquire
+method to retrieve the SCO socket file descriptor.
+
+ PulseAudio oFono HF/AG
+ | | |
+ | | connect SCO |
+ | |<..............|
+ | state changed signal | |
+ |<------------------------| |
+ | | |
+ | transport acquire | |
+ |------------------------>| |
+ | | |
+ | return SCO fd | |
+ |<------------------------| |
+ | | |
+
+Codec negotiation - HFP AG - HFP v1.6
+-------------------------------------------
+
+On reception of HF available codecs command (AT+BAC), the gateway may start a
+codec selection procedure which will setup the correct media transport.
+When a media transport already exists and it uses a different codec, it should
+be closed before correct one is setup.
+
+ PulseAudio oFono HF
+ | | |
+ | | AT+BAC=u1,u2 |
+ | |<.............|
+ | | |
+ | | OK |
+ | |.............>|
+ | | |
+ | | +BCS:id |
+ | |.............>|
+ | | |
+ | | AT+BCS=id |
+ | |<.............|
+ | | |
+ | | OK |
+ | |.............>|
+ | configure Transport | |
+ |<--------------------| |
+ | | |
+
+It may also be possible to force a codec selection from oFono.
+
+ PulseAudio oFono HF
+ | | |
+ | | +BCS:id |
+ | |............>|
+ | | |
+ | | AT+BCS=id |
+ | |<............|
+ | | |
+ | | OK |
+ | |............>|
+ | configure Transport | |
+ |<--------------------| |
+ | | |
+
+Outgoing SCO connection - HFP AG - HFP v1.6
+-------------------------------------------
+
+Idem than for HFP v1.5
+
+Incoming SCO connection - HFP AG - HFP v1.6
+-------------------------------------------
+
+It is pretty the same here as for outgoing SCO connection, except that it is
+started upon reception of AT+BCC from the headset.
+
+ PulseAudio oFono HF
+ | | |
+ | | AT+BCC |
+ | |<............|
+ | | |
+ | | OK |
+ | |............>|
+ | | |
+ | | connect SCO |
+ | |............>|
+ | state changed signal | |
+ |<---------------------| |
+ | | |
+ | transport acquire | |
+ |--------------------->| |
+ | | |
+ | return SCO fd | |
+ |<---------------------| |
+
+
+Codec negotiation - HFP HF - HFP v1.6
+-------------------------------------------
+
+Codec selection procedure started by gateway will end up by codec property
+update and setup of the correct media transport.
+When a media transport already exists and it uses a different codec, it should
+be closed before correct one is setup.
+
+ PulseAudio oFono AG
+ | | |
+ | | +BCS:id |
+ | |<.............|
+ | | |
+ | | AT+BCS=id |
+ | |.............>|
+ | | |
+ | | OK |
+ | |<.............|
+ | configure Transport | |
+ |<--------------------| |
+ | | |
+
+Outgoing SCO connection - HFP HF - HFP v1.6
+-------------------------------------------
+
+On media transport acquire, oFono requests connection from the gateway.
+Then incoming SCO socket file descriptor will be returned to PulseAudio.
+
+ PulseAudio oFono AG
+ | | |
+ | transport acquire | |
+ |----------------------->| |
+ | | AT+BCC |
+ | |............>|
+ | | |
+ | | OK |
+ | |<............|
+ | | |
+ | | connect SCO |
+ | |<............|
+ | return SCO fd | |
+ |<-----------------------| |
+ | | |
+
+Incoming SCO connection - HFP HF - HFP v1.6
+-------------------------------------------
+
+Idem than for HFP v1.5
+
+AT+NREC - HFP AG
+----------------
+
+Reception of AT+NREC will update the NREC property of media transport interface
+(listened by PulseAudio).
+
+ HF oFono PulseAudio
+ | AT+NREC | |
+ |............>| |
+ | | property |
+ | | changed signal |
+ | |--------------->|
+ | OK | |
+ |<............| |
+ | | |
+
++BSIR - HFP AG
+--------------
+
+PulseAudio can change in-band ring tone by calling SetProperty method of media
+transport interface, which will send the proper +BSIR unsolicited event.
+
+ HF oFono PulseAudio app
+ | | | |
+ | | |<------------|
+ | | SetProperty | |
+ | |<---------------| |
+ | +BSIR:x | | |
+ |<............| | |
+ | | property | |
+ | | changed signal | |
+ | |--------------->| |
+ | | | |
+
+AT+VGS,AT+VGM - HFP AG
+----------------------
+
+Reception of volume management command will update the corresponding volume
+property of media transport interface (listened by PulseAudio).
+
+ HF oFono PulseAudio app
+ | | | |
+ | AT+VGS=xx | | |
+ |............>| | |
+ | | property | |
+ | | changed signal | |
+ | |--------------->| |
+ | OK | | |
+ |<............| |------------>|
+ | | | |
+
++VGS,+VGM - HFP AG
+------------------
+
+PulseAudio can change volume by calling SetProperty method of media transport
+interface. This which will send the proper +VGx unsolicited event.
+
+ HF oFono PulseAudio app
+ | | | |
+ | | |<------------|
+ | | SetProperty | |
+ | |<---------------| |
+ | +VGS:xx | | |
+ |<............| property | |
+ | | changed signal | |
+ | |--------------->| |
+ | | |------------>|
+ | | | |
--
1.7.9.5
^ permalink raw reply related
* Re: [RFC] Bluetooth: Add BT_DEFER_SETUP option to sco socket
From: Gustavo Padovan @ 2012-11-15 20:30 UTC (permalink / raw)
To: Frédéric Dalleau; +Cc: linux-bluetooth
In-Reply-To: <1352830825-13987-2-git-send-email-frederic.dalleau@linux.intel.com>
Hi Frédéric,
* Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-13 19:20:25 +0100]:
> In order to authenticate and later configure an incoming SCO connection, the
> BT_DEFER_SETUP option is added.
> When an connection is requested, the listening socket is unblocked but the
> effective connection setup happens only on first recv.
> Any send between accept and recv fails with -ENOTCONN.
> ---
> include/net/bluetooth/hci_core.h | 15 +++++++
> net/bluetooth/hci_event.c | 47 +++++++++++++++++++-
> net/bluetooth/sco.c | 88 ++++++++++++++++++++++++++++++++++++--
> 3 files changed, 145 insertions(+), 5 deletions(-)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index ef5b85d..2ee0ecb 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -377,6 +377,7 @@ extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb,
> u16 flags);
>
> extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
> +extern int sco_defer(struct hci_dev *hdev, bdaddr_t *bdaddr);
> extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
> extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
> extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
> @@ -577,6 +578,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
> int hci_conn_del(struct hci_conn *conn);
> void hci_conn_hash_flush(struct hci_dev *hdev);
> void hci_conn_check_pending(struct hci_dev *hdev);
> +void hci_conn_accept(struct hci_conn *conn, int mask);
>
> struct hci_chan *hci_chan_create(struct hci_conn *conn);
> void hci_chan_del(struct hci_chan *chan);
> @@ -796,6 +798,19 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
> }
> }
>
> +static inline int hci_proto_defered(struct hci_dev *hdev, bdaddr_t *bdaddr,
> + __u8 type)
> +{
> + switch (type) {
> + case SCO_LINK:
> + case ESCO_LINK:
> + return sco_defer(hdev, bdaddr);
> +
> + default:
> + return 0;
> + }
> +}
> +
> static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
> {
> switch (conn->type) {
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 9f5c5f2..167eca0 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -2047,15 +2047,54 @@ unlock:
> hci_conn_check_pending(hdev);
> }
>
> +void hci_conn_accept(struct hci_conn *conn, int mask)
> +{
> + struct hci_dev *hdev = conn->hdev;
> +
> + BT_DBG("conn %p", conn);
> +
> + if (!lmp_esco_capable(hdev)) {
> + struct hci_cp_accept_conn_req cp;
> +
> + conn->state = BT_CONNECT;
> + bacpy(&cp.bdaddr, &conn->dst);
> +
> + if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
> + cp.role = 0x00; /* Become master */
> + else
> + cp.role = 0x01; /* Remain slave */
> +
> + hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp),
> + &cp);
> + } else /* lmp_esco_capable(hdev)) */ {
> + struct hci_cp_accept_sync_conn_req cp;
> +
> + conn->state = BT_CONNECT;
> + bacpy(&cp.bdaddr, &conn->dst);
> + cp.pkt_type = cpu_to_le16(conn->pkt_type);
> +
> + cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40);
> + cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40);
> + cp.max_latency = __constant_cpu_to_le16(0xffff);
> + cp.content_format = cpu_to_le16(hdev->voice_setting);
> + cp.retrans_effort = 0xff;
> +
> + hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
> + sizeof(cp), &cp);
> + }
> +}
> +
> static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
> {
> struct hci_ev_conn_request *ev = (void *) skb->data;
> int mask = hdev->link_mode;
> + int defered;
>
> BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr,
> ev->link_type);
>
> mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type);
> + defered = hci_proto_defered(hdev, &ev->bdaddr, ev->link_type);
I'm not really happy with this hci_proto thing. Weed need to think more on
this.
>
> if ((mask & HCI_LM_ACCEPT) &&
> !hci_blacklist_lookup(hdev, &ev->bdaddr)) {
> @@ -2085,7 +2124,8 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
>
> hci_dev_unlock(hdev);
>
> - if (ev->link_type == ACL_LINK || !lmp_esco_capable(hdev)) {
> + if (ev->link_type == ACL_LINK ||
> + (!defered && !lmp_esco_capable(hdev))) {
> struct hci_cp_accept_conn_req cp;
>
> bacpy(&cp.bdaddr, &ev->bdaddr);
> @@ -2097,7 +2137,7 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
>
> hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp),
> &cp);
> - } else {
> + } else if (!defered) {
> struct hci_cp_accept_sync_conn_req cp;
>
> bacpy(&cp.bdaddr, &ev->bdaddr);
> @@ -2111,6 +2151,9 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
>
> hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
> sizeof(cp), &cp);
> + } else {
> + hci_proto_connect_cfm(conn, 0);
> + hci_conn_put(conn);
> }
> } else {
> /* Connection rejected */
> diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> index 450cdcd..416801a 100644
> --- a/net/bluetooth/sco.c
> +++ b/net/bluetooth/sco.c
> @@ -662,16 +662,57 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
> return err;
> }
>
> +static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
> + struct msghdr *msg, size_t len, int flags)
> +{
> + struct sock *sk = sock->sk;
> + struct sco_pinfo *pi = sco_pi(sk);
> +
> + lock_sock(sk);
> +
> + if (sk->sk_state == BT_CONNECT &&
I think you want to use BT_CONNECT2 here...
> + test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {
> + hci_conn_accept(pi->conn->hcon, 0);
> + sk->sk_state = BT_CONNECT2;
and BT_CONFIG here.
> +
> + release_sock(sk);
> + return 0;
> + }
> +
> + release_sock(sk);
> +
> + return bt_sock_recvmsg(iocb, sock, msg, len, flags);
> +}
> +
> static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
> {
> struct sock *sk = sock->sk;
> int err = 0;
> + u32 opt;
>
> BT_DBG("sk %p", sk);
>
> lock_sock(sk);
>
> switch (optname) {
> +
> + case BT_DEFER_SETUP:
> + if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
> + err = -EINVAL;
> + break;
> + }
> +
> + if (get_user(opt, (u32 __user *) optval)) {
> + err = -EFAULT;
> + break;
> + }
> +
> + if (opt)
> + set_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
> + else
> + clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
> + break;
> +
Please move the set/getsockopt to a separated patch and put it first in your
series.
> default:
> err = -ENOPROTOOPT;
> break;
> @@ -753,6 +794,19 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char
> lock_sock(sk);
>
> switch (optname) {
> +
> + case BT_DEFER_SETUP:
> + if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
> + err = -EINVAL;
> + break;
> + }
> +
> + if (put_user(test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags),
> + (u32 __user *) optval))
> + err = -EFAULT;
> +
> + break;
> +
> default:
> err = -ENOPROTOOPT;
> break;
> @@ -874,7 +928,10 @@ static void sco_conn_ready(struct sco_conn *conn)
> hci_conn_hold(conn->hcon);
> __sco_chan_add(conn, sk, parent);
>
> - sk->sk_state = BT_CONNECTED;
> + if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags))
> + sk->sk_state = BT_CONNECT;
Let's use BT_CONNECT2 here as this a incoming connection.
Gustavo
^ permalink raw reply
* Re: [RFC 1/4] Bluetooth: Use __l2cap_no_conn_pending helper
From: Marcel Holtmann @ 2012-11-15 23:53 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352996096-27374-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Use helper instead of test_bit. This is the only place left using
> test CONF_CONNECT_PEND flag.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFC 3/4] Bluetooth: Remove unneeded local_amp_id initialization
From: Marcel Holtmann @ 2012-11-15 23:53 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352996096-27374-3-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> local_amp_id is already set in l2cap_connect() which is called several
> lines above.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 1 -
> 1 file changed, 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFC 4/4] Bluetooth: Set local_amp_id after getting Phylink Completed evt
From: Marcel Holtmann @ 2012-11-15 23:54 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352996096-27374-4-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> local_amp_id is used in l2cap_physical_cfm and shall be set up
> before calling it.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/amp.c | 1 +
> 1 file changed, 1 insertion(+)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFC 2/4] Bluetooth: Fix sending L2CAP Create Chan Req
From: Marcel Holtmann @ 2012-11-15 23:56 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352996096-27374-2-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> When receiving Physical Link Completed event we need to create L2CAP
> channel with L2CAP Create Chan Request. Current code was sending
> this command only if connection was pending (which is probably
> needed in channel move case). If channel is not moved but created
> Create Chan should be sent for outgoing channel which is checked
> with BT_CONNECT flag.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 29 ++++++++++++++++++-----------
> 1 file changed, 18 insertions(+), 11 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ 2/2] l2test: Add support to test auto select PSM
From: Johan Hedberg @ 2012-11-16 8:05 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: linux-bluetooth
In-Reply-To: <1352449889-5149-2-git-send-email-s.syam@samsung.com>
Hi Syam,
On Fri, Nov 09, 2012, Syam Sidhardhan wrote:
> This patch enable us to test the auto select PSM by passing
> PSM value as 0.
>
> Ex: l2test -d -P 0
> l2test[2585]: Waiting for connection on psm 4099 ...
> ---
> test/l2test.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/test/l2test.c b/test/l2test.c
> index 7645681..72ad4ba 100644
> --- a/test/l2test.c
> +++ b/test/l2test.c
> @@ -87,7 +87,7 @@ static long buffer_size = 2048;
>
> /* Default addr and psm and cid */
> static bdaddr_t bdaddr;
> -static unsigned short psm = 0x1011;
> +static unsigned short psm = 0;
> static unsigned short cid = 0;
>
> /* Default number of frames to send (-1 = infinite) */
> @@ -375,8 +375,6 @@ static int do_connect(char *svr)
> addr.l2_cid = htobs(cid);
> else if (psm)
> addr.l2_psm = htobs(psm);
> - else
> - goto error;
>
> if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0 ) {
> syslog(LOG_ERR, "Can't connect: %s (%d)",
At least the second chunk is for the initiating (client) part, not the
server (which the commit message implies you're dealing with). There's
no "auto select" for the client.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ 2/2] gdbus: Replace leading spaces with tabs
From: Johan Hedberg @ 2012-11-16 8:07 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: linux-bluetooth
In-Reply-To: <1351000626-22632-2-git-send-email-s.syam@samsung.com>
Hi Syam,
On Tue, Oct 23, 2012, Syam Sidhardhan wrote:
> Trivial formatting fix.
> ---
> gdbus/object.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
This patch has been applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 8/8] neard: Set device class in device object
From: Johan Hedberg @ 2012-11-16 8:24 UTC (permalink / raw)
To: Frédéric Danis; +Cc: linux-bluetooth
In-Reply-To: <1353000701-16605-8-git-send-email-frederic.danis@linux.intel.com>
Hi Frédéric,
On Thu, Nov 15, 2012, Frédéric Danis wrote:
> This will create a new device object and generate DeviceCreated signal
> ---
> plugins/neard.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Your commit message doesn't explain why the old object needs to be
removed (imo it shouldn't need to be removed).
The other patches in this set have been applied.
> + device = adapter_get_device(adapter, remote_address);
> +
> /* store OOB data */
Missing check for failed adapter_get_device() return (NULL).
Johan
^ permalink raw reply
* [PATCH v2] neard: Set device class in device object
From: Frédéric Danis @ 2012-11-16 9:35 UTC (permalink / raw)
To: linux-bluetooth
As soon as we have info related to a new device,
device object will be created if it does not exist yet.
So removing adapter_remove_device().
---
plugins/neard.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/plugins/neard.c b/plugins/neard.c
index 8f8381c..ff754c3 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -39,7 +39,6 @@
#include "manager.h"
#include "device.h"
#include "eir.h"
-#include "storage.h"
#include "agent.h"
#include "hcid.h"
#include "event.h"
@@ -267,30 +266,30 @@ static int process_eir(struct btd_adapter *adapter, uint8_t *eir, size_t size,
DBG("hci%u remote:%s", adapter_get_dev_id(adapter), remote_address);
- device = adapter_find_device(adapter, remote_address);
+ device = adapter_get_device(adapter, remote_address);
+ if (!device) {
+ DBG("failed to create device object");
+ eir_data_free(&eir_data);
+ return -ENOMEM;
+ }
/* If already paired do nothing */
- if (device && device_is_paired(device)) {
+ if (device_is_paired(device)) {
DBG("already paired");
eir_data_free(&eir_data);
return 1;
}
/* Pairing in progress... */
- if (device && device_is_bonding(device, NULL)) {
+ if (device_is_bonding(device, NULL)) {
DBG("pairing in progress");
eir_data_free(&eir_data);
return -EINPROGRESS;
}
- /* If we have unpaired device hanging around, purge it */
- if (device)
- adapter_remove_device(adapter, device, TRUE);
-
/* store OOB data */
if (eir_data.class != 0)
- write_remote_class(adapter_get_address(adapter),
- &eir_data.addr, eir_data.class);
+ device_set_class(device, eir_data.class);
/* TODO handle incomplete name? */
if (eir_data.name)
--
1.7.9.5
^ permalink raw reply related
* Re: [RFC] Bluetooth: Add BT_DEFER_SETUP option to sco socket
From: Frédéric Dalleau @ 2012-11-16 12:10 UTC (permalink / raw)
To: Gustavo Padovan, linux-bluetooth
In-Reply-To: <20121115203029.GA2026@joana>
Hi Gustavo,
On 11/15/2012 09:30 PM, Gustavo Padovan wrote:
>> mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type);
>> + defered = hci_proto_defered(hdev, &ev->bdaddr, ev->link_type);
>
> I'm not really happy with this hci_proto thing. Weed need to think more on
> this.
Since hci_proto_connect_ind returns an int, what about using 16 bits for
HCI_LM_* flags, and 16 bits for additional flags (from hci_core.h),
including one to indicate deferred setup.
Frédéric
^ permalink raw reply
* Hard freeze after 'rfkill block bluetooth'
From: Jiri Kosina @ 2012-11-16 12:47 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg
Cc: linux-bluetooth, linux-kernel, linux-usb
Hi,
I got a hard freeze with HEAD at 1b42fc4 (i.e. past -rc4) after running
rfkill block bluetooth.
Screen capture can be found at
http://www.jikos.cz/jikos/junk/IMAG0264.jpg
(sorry for the bad picture quality, but I believe it's readable).
I am not able to reproduce it again.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* [PATCH BlueZ] audio: Bump A2DP version to 1.03
From: Luiz Augusto von Dentz @ 2012-11-16 13:11 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In addition remove support of setting DelayReporting in audio.conf as
it should always be supported in the service record since it doesn't
mean the endpoint must support it because it is actually negotiated
during the stream configuration.
---
profiles/audio/a2dp.c | 19 ++++---------------
profiles/audio/avdtp.c | 20 +++-----------------
profiles/audio/avdtp.h | 2 +-
3 files changed, 8 insertions(+), 33 deletions(-)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 7799420..50c0f43 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -109,7 +109,6 @@ struct a2dp_server {
GSList *sources;
uint32_t source_record_id;
uint32_t sink_record_id;
- uint16_t version;
gboolean sink_enabled;
gboolean source_enabled;
};
@@ -1087,7 +1086,7 @@ static struct avdtp_sep_ind endpoint_ind = {
.delayreport = endpoint_delayreport_ind,
};
-static sdp_record_t *a2dp_record(uint8_t type, uint16_t avdtp_ver)
+static sdp_record_t *a2dp_record(uint8_t type)
{
sdp_list_t *svclass_id, *pfseq, *apseq, *root;
uuid_t root_uuid, l2cap_uuid, avdtp_uuid, a2dp_uuid;
@@ -1096,7 +1095,7 @@ static sdp_record_t *a2dp_record(uint8_t type, uint16_t avdtp_ver)
sdp_record_t *record;
sdp_data_t *psm, *version, *features;
uint16_t lp = AVDTP_UUID;
- uint16_t a2dp_ver = 0x0102, feat = 0x000f;
+ uint16_t a2dp_ver = 0x0103, avdtp_ver = 0x0103, feat = 0x000f;
record = sdp_record_alloc();
if (!record)
@@ -1170,7 +1169,6 @@ static struct a2dp_server *find_server(GSList *list, const bdaddr_t *src)
int a2dp_register(const bdaddr_t *src, GKeyFile *config)
{
gboolean source = TRUE, sink = FALSE;
- gboolean delay_reporting = FALSE;
char *str;
GError *err = NULL;
struct a2dp_server *server;
@@ -1212,7 +1210,7 @@ proceed:
server = g_new0(struct a2dp_server, 1);
- av_err = avdtp_init(src, config, &server->version);
+ av_err = avdtp_init(src, config);
if (av_err < 0) {
g_free(server);
return av_err;
@@ -1222,15 +1220,6 @@ proceed:
servers = g_slist_append(servers, server);
}
- if (config)
- delay_reporting = g_key_file_get_boolean(config, "A2DP",
- "DelayReporting", NULL);
-
- if (delay_reporting)
- server->version = 0x0103;
- else
- server->version = 0x0102;
-
server->source_enabled = source;
server->sink_enabled = sink;
@@ -1341,7 +1330,7 @@ struct a2dp_sep *a2dp_add_sep(const bdaddr_t *src, uint8_t type,
if (*record_id != 0)
goto add;
- record = a2dp_record(type, server->version);
+ record = a2dp_record(type);
if (!record) {
error("Unable to allocate new service record");
avdtp_unregister_sep(sep->lsep);
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 75b81fe..e38c95b 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -331,7 +331,6 @@ struct avdtp_remote_sep {
struct avdtp_server {
bdaddr_t src;
- uint16_t version;
GIOChannel *io;
GSList *seps;
GSList *sessions;
@@ -1392,9 +1391,6 @@ static gboolean avdtp_getcap_cmd(struct avdtp *session, uint8_t transaction,
goto failed;
}
- if (get_all && session->server->version < 0x0103)
- return avdtp_unknown_cmd(session, transaction, cmd);
-
if (!sep->ind->get_capability(session, sep, get_all, &caps,
&err, sep->user_data))
goto failed;
@@ -2785,7 +2781,7 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
int ret = 0;
gboolean getcap_pending = FALSE;
- if (session->version >= 0x0103 && session->server->version >= 0x0103)
+ if (session->version >= 0x0103)
getcap_cmd = AVDTP_GET_ALL_CAPABILITIES;
else
getcap_cmd = AVDTP_GET_CAPABILITIES;
@@ -3717,8 +3713,7 @@ int avdtp_delay_report(struct avdtp *session, struct avdtp_stream *stream,
stream->lsep->state != AVDTP_STATE_STREAMING)
return -EINVAL;
- if (!stream->delay_reporting || session->version < 0x0103 ||
- session->server->version < 0x0103)
+ if (!stream->delay_reporting || session->version < 0x0103)
return -EINVAL;
stream->delay = delay;
@@ -3868,12 +3863,11 @@ void avdtp_get_peers(struct avdtp *session, bdaddr_t *src, bdaddr_t *dst)
bacpy(dst, &session->dst);
}
-int avdtp_init(const bdaddr_t *src, GKeyFile *config, uint16_t *version)
+int avdtp_init(const bdaddr_t *src, GKeyFile *config)
{
GError *err = NULL;
gboolean tmp, master = TRUE;
struct avdtp_server *server;
- uint16_t ver = 0x0102;
if (!config)
goto proceed;
@@ -3893,17 +3887,9 @@ int avdtp_init(const bdaddr_t *src, GKeyFile *config, uint16_t *version)
else
auto_connect = tmp;
- if (g_key_file_get_boolean(config, "A2DP", "DelayReporting", NULL))
- ver = 0x0103;
-
proceed:
server = g_new0(struct avdtp_server, 1);
- server->version = ver;
-
- if (version)
- *version = server->version;
-
server->io = avdtp_server_socket(src, master);
if (!server->io) {
g_free(server);
diff --git a/profiles/audio/avdtp.h b/profiles/audio/avdtp.h
index 7b330b9..cdf39bf 100644
--- a/profiles/audio/avdtp.h
+++ b/profiles/audio/avdtp.h
@@ -309,5 +309,5 @@ void avdtp_get_peers(struct avdtp *session, bdaddr_t *src, bdaddr_t *dst);
gboolean avdtp_stream_setup_active(struct avdtp *session);
void avdtp_set_device_disconnect(struct avdtp *session, gboolean dev_dc);
-int avdtp_init(const bdaddr_t *src, GKeyFile *config, uint16_t *version);
+int avdtp_init(const bdaddr_t *src, GKeyFile *config);
void avdtp_exit(const bdaddr_t *src);
--
1.7.11.7
^ permalink raw reply related
* Re: [RFC v1 03/16] manager: Extend FindAdapter with "default" pattern
From: Luiz Augusto von Dentz @ 2012-11-16 13:29 UTC (permalink / raw)
To: Mikel Astiz; +Cc: linux-bluetooth@vger.kernel.org, Mikel Astiz
In-Reply-To: <1352992159-11559-4-git-send-email-mikel.astiz.oss@gmail.com>
Hi Mikel,
On Thu, Nov 15, 2012 at 5:09 PM, Mikel Astiz <mikel.astiz.oss@gmail.com> wrote:
> From: Mikel Astiz <mikel.astiz@bmw-carit.de>
>
> Extend the supported values in the given pattern in order to return the
> default adapter if "default" is given.
> ---
> doc/manager-api.txt | 1 +
> src/manager.c | 4 +++-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/doc/manager-api.txt b/doc/manager-api.txt
> index 8497141..b0d534d 100644
> --- a/doc/manager-api.txt
> +++ b/doc/manager-api.txt
> @@ -27,6 +27,7 @@ Object path /
> patterns are "hci0" or "00:11:22:33:44:55". Other
> supported values are:
> "any"
> + "default"
>
> Possible errors: org.bluez.Error.InvalidArguments
> org.bluez.Error.NoSuchAdapter
> diff --git a/src/manager.c b/src/manager.c
> index 3088dd9..79d049b 100644
> --- a/src/manager.c
> +++ b/src/manager.c
> @@ -110,7 +110,9 @@ static DBusMessage *find_adapter(DBusConnection *conn,
> } else if (!strncmp(pattern, "hci", 3) && strlen(pattern) >= 4) {
> dev_id = atoi(pattern + 3);
> adapter = manager_find_adapter_by_id(dev_id);
> - } else {
> + } else if (!strcmp(pattern, "default"))
> + adapter = manager_find_adapter_by_id(default_adapter_id);
> + else {
> bdaddr_t bdaddr;
> str2ba(pattern, &bdaddr);
> adapter = manager_find_adapter(&bdaddr);
> --
> 1.7.11.7
Hmm, I though we would have a property e.g. DefaultAdapter because
with ObjectManager you also get the properties so once you do
GetManagedObjects you discover what is the default one. It could also
be a property of the Adapter interface e.g. boolean Default but if it
changes we actually have to emit 2 signals so it would no be an atomic
operation as it should be.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH BlueZ] audio: Bump A2DP version to 1.03
From: Johan Hedberg @ 2012-11-16 14:22 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1353071513-32182-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Fri, Nov 16, 2012, Luiz Augusto von Dentz wrote:
> In addition remove support of setting DelayReporting in audio.conf as
> it should always be supported in the service record since it doesn't
> mean the endpoint must support it because it is actually negotiated
> during the stream configuration.
> ---
> profiles/audio/a2dp.c | 19 ++++---------------
> profiles/audio/avdtp.c | 20 +++-----------------
> profiles/audio/avdtp.h | 2 +-
> 3 files changed, 8 insertions(+), 33 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v4 09/16] sbc: Use simd primitive if doing msbc on neon
From: Siarhei Siamashka @ 2012-11-18 23:46 UTC (permalink / raw)
To: frederic.dalleau; +Cc: linux-bluetooth
In-Reply-To: <50A4C2BF.3050807@linux.intel.com>
On Thu, 15 Nov 2012 11:23:59 +0100
Frédéric Dalleau <frederic.dalleau@linux.intel.com> wrote:
> Hi,
> On 11/14/2012 08:27 PM, Siarhei Siamashka wrote:
> > On Tue, 30 Oct 2012 10:39:28 +0100
> >> + if (state->increment == 1)
> >> + state->sbc_analyze_8s = sbc_analyze_1b_8s_simd;
> >> #endif
> >> }
> >
> > This is not enough. As I commented earlier in
> > http://permalink.gmane.org/gmane.linux.bluez.kernel/31567
> >
> > "neon code also provides optimized "sbc_enc_process_input_*" functions,
> > which are not going to work correctly for mSBC:
> >
> > state->sbc_enc_process_input_8s_le = sbc_enc_process_input_8s_le_neon;
> > state->sbc_enc_process_input_8s_be = sbc_enc_process_input_8s_be_neon;"
>
> Indeed, this is a mistake :
> I wanted to use the neon analysis in conjonction with simd input processing.
>
> Instead, the patch would look like this :
> + if (state->increment == 1) {
> + state->sbc_enc_process_input_8s_be =
> + sbc_enc_process_input_8s_be;
> + state->sbc_enc_process_input_8s_le =
> + sbc_enc_process_input_8s_le;
> + }
> Damned it is 82 chars long!
>
> Unfortunately I can't test this one. I can't even build it. I could but
> that's gonna take a lot of time.
I can test the patches on ARM. But what I'm asking is just to restore
*all* function pointers (not state->sbc_analyze_8s alone) to C
implementations for ARM NEON in the case if "state->increment == 1".
This minor modification should be enough.
Also building and testing is not too difficult when having an arm
crosscompiler (I believe ubuntu even has it packaged) and qemu. The
whole process may look like this:
$ apt-get install qemu-user
$ apt-get install gcc-arm-linux-gnueabihf
$ arm-linux-gnueabihf-gcc -O2 -march=armv7-a -mfpu=neon \
-static -I. -DVERSION=\"\" \
-o sbcenc src/sbcenc.c sbc/*.c
$ qemu-arm -cpu cortex-a8 ./sbcenc test.au > test.sbc
--
Best regards,
Siarhei Siamashka
^ permalink raw reply
* Bluez/Obexd upstream test result_20121102(bluez-4.101.851+ obexd-0.47.69)
From: Li, XiaX @ 2012-11-19 8:36 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]
Hi all,
QA finished upstream testing. The test is for bluez-4.101.851 and obexd-0.47.69. Against last, BlueZ is changed from 4.101.767 to 4.101.851, Obexd is changed from 0.47.67 to 0.47.69.
In this test, totally ran 100 case: 72 Pass, 10 Fail. Other 18 are blocked or unavailable (some cases validation method is still in investigating). The pass rate is 88% (pass / <pass + fail>). Ofono has not caught up with the BlueZ API changing in HFP profile.
New bugs:
===============================================
No
Re-open bugs:
===============================================
No
Verified bugs:
===============================================
No
Testing Environment
==============================================
Hardware: netbook Eeepc 1005HA | Acer AspireOne NAV50
Image: netbook-ia32-pinetrail-tizen_20120424.2
Linux Kernel: v3.4-rc7
bluez-4.101.851.gce084da-1.1.i586
obexd-0.47.69.gb10bcae-1.1.i586
obexd-server-0.47.69.gb10bcae-1.1.i586
connman-1.9.19.gf5d62e4-1.1.i586
ofono-1.11-1.i686
Pulseaudio: 67602d8743e8e529919bb9fbb956aa77724a8e50 (oct, 6th)
For detailed test results, please see attached file.
Thanks
Li Xia
[-- Attachment #2: Bluetooth_upstream_quality_20121119.txt --]
[-- Type: text/plain, Size: 7550 bytes --]
== Detail Result ==
[PASS]: case passed <br>
[FAIL]: case failed <br>
[Block]: case is blocked by one bug <br>
[N/A]: case not available to be tested
=== Audio-A2DP ===
[PASS] A2DP_001: audio sink connect/re-connect
[PASS] A2DP_002: stereo headset playback
[PASS] A2DP_003: stereo headset voice record
[PASS] A2DP_004: Codec support: SBC
[PASS] A2DP_005: Playback music on line
[PASS] A2DP_006: SINK role, as speaker for other device music playing
With some BT headset, we ever met issue [https://bugs.meego.com/show_bug.cgi?id=25480 Bug#25480 A2DP-source: pulseaudio fails to create bluez_sink and bluez_source]
=== Audio-AVRCP ===
[PASS] AVRCP_001: Volume Up/Down
[Block] AVRCP_002: Play/Pause (by unavailable media-player)
[Block] AVRCP_003: Next/Privious (by unavailable media-player)
[PASS] AVRCP_004: Connection Establish/Release
[N/A] AVRCP_005: Audio metadata get.
We still try to find avaliable media-player to support AVRCP-1.4
=== Audio-HFP ===
Ofono needs to update its API, since BlueZ already took the changes. Here is bug [https://bugs.meego.com/show_bug.cgi?id=25748 Bug#25748 HFP: Ofono List-modems shows no modem after paired with phone]
[FAIL] HFP_001: RFCOMM connection on AG
Need install sbc for latest pulseaudio
[FAIL] HFP_002: list (ofono) hfp modem
[FAIL] HFP_003: HFP modem establishment (Ofono)
[FAIL] HFP_004: Audio SNK and SRC establishment
[FAIL] HFP_005: voicecall, audio creates BT SNK/SRC
[FAIL] HFP_006: redirect AG SNK/SRC to local SRC/SNK
BlueZ interface has some regression, bug is reported as [https://bugs.meego.com/show_bug.cgi?id=25473 Bug#25473 HFP: latest bluez cannot support pulseaudio to create bluez_sink and bluez_source]
Pulseaudio has new crash bug: [https://bugs.meego.com/show_bug.cgi?id=25593 Bug#25593 Pulseaudio crashes after connect BT sink to alsa source]
[FAIL] HFP_007: Check AT-commands from HF part
[FAIL] HFP_008: Connect BT Headset to HFP phone
=== Audio-HSP ===
[PASS] HSP_001: Use mono headset to play music
*** DUT is a Netbook, unable to take phone ***
[N/A] HSP_002: Take incoming call by button-press
[N/A] HSP_003: Audio transfer between AG and HS
[PASS] HSP_004: Adjust Volume Up/Down
=== OBEX-FTP ===
[PASS] FTP_001: pull/push files from/to server.
[PASS] FTP_002: browse server files
[PASS] FTP_003: Client "delete file", "rename file"
[PASS] FTP_004: Server enables FTP parameter
[PASS] FTP_005: Server sets sharing root path
[PASS] FTP_006: Server handles all requirements
[PASS] FTP_007: Server has ability to set permission for FTP
[PASS] FTP_008: FTP data-rate about 30k/s~230k/s
[PASS] FTP_009: Big size file transferred stable
=== OBEX-OPP ===
[PASS] OPP_001: pull un-patterned object from server.
[PASS] OPP_002: Server enables OPP parameter
[PASS] OPP_003: During object transferring, the progress is clear
=== OBEX-PBAP ===
[PASS] PBAP_001: Client gets phone book entries from server
[PASS] PBAP_002: Client gets ICH, OCH, MCH and CCH from server
[FAIL] PBAP_003: PSE can provide PBAP daemon by enabling corresponding parameter
Case failed due to [https://bugs.meego.com/show_bug.cgi?id=25598 Bug#25598, PBAP server fails to open /telecom/pb.vcf file]
[PASS] PBAP_004: Both sides support vCard2.1/vCard3.0
=== OBEX-SYNC ===
[PASS] SYNC_001: Server enables SYNC daemon
[PASS] SYNC_002: During sync, Server can show "syncing..."
[PASS] SYNC_003: client can set PIM fetching from INT
[PASS] SYNC_004: Server get/put entire phonebook from/to client.
[PASS] SYNC_005: Client can support vCard2.1, vCard3.0
=== OBEX-MAP MCE ===
[FAIL] MAP_001: MCE can browse message/folder list on MSE
Regression happened on client side, bug is reported as [https://bugs.meego.com/show_bug.cgi?id=25595 Bug#25595 MAP client fail to get message list from Samsung GT-i9100]
[BLOCK] MAP_002: MCE can upload local message to MSE
[BLOCK] MAP_003: MCE can delete the message on MSE side
[BLOCK] MAP_004: MCE can take use of MSE to send message
=== Network-PAN ===
[PASS] PAN_001: PANU can init nap0 device connect to NAP
[PASS] PAN_002: PANU can get ip address or assigned static ip
[PASS] PAN_003: PANU can logon internet website
[N/A] PAN_004: NAP can init bridge bnep
[N/A] PAN_005: NAP can support one or multiple PANU connection
[N/A] PAN_006: NAP can have DHCP responding to each PANU
Current connman does not support DHCP functions.
=== Network-BNEP ===
[PASS] BNEP_001: Check BNEP support on DUT
=== Network-DUN ===
[PASS] DUN_001: GW (DUT) can parse a series of AT commands from the data terminal.
[PASS] DUN_002: DT can build up rfcomm device by bluetooth and DUN modem by Ofono.
[PASS] DUN_003: DT can use Ofono to dial up special service number ("*99#").
[PASS] DUN_004: When network connected, DT can log on website in internet.
=== SIM-SAP ===
The SAP test method is still in investigation.
[N/A] SAP_001: Server can enable a module to register Client
[N/A] SAP_002: Server can power on/off SIM Card or reset it
[N/A] SAP_003: Server can disconnect Client
[N/A] SAP_004: Server can disconnect SIM
[N/A] SAP_005: Client can connect to Server SIM
[N/A] SAP_006: Client can power on Server SIM
[N/A] SAP_007: Client can disconnect Server
=== Generic-GAP ===
[PASS] GAP_001: PSCAN/ISCAN mode setting.
[PASS] GAP_002: Active pairing to another bluetooth device.
[PASS] GAP_003: Passive pairing, accepte pair master requirement
[PASS] GAP_004: SSP supports
[PASS] GAP_005: If lost link-key, it needs re-pair
[PASS] GAP_006: reboot DUT with link-key restored, no need to re-pair
[PASS] GAP_007: Pair can be released
=== Generic-SDP ===
[PASS] SDP_001: browse available service list in local
[PASS] SDP_002: browse available service list from remote
[PASS] SDP_003: browse service by RecHandle for detail info
[PASS] SDP_004: Server can answer SDP searching request
[PASS] SDP_005: Server can add/del/update service records
=== Others-HID ===
[PASS] HID_001: Host can search nearby HID device.
[PASS] HID_002: [BAT] Host can connect to HID device.
[PASS] HID_003: Host can handle multiple human input/output devices.
=== HCI ===
[PASS] HCI_001: Build hci connection between Dev_A and Dev_B.
[PASS] HCI_002: Receive ACL data with HCI.
[PASS] HCI_003: Send ACL data with HCI.
[PASS] HCI_004: Change name of remote Dev by HCI.
[PASS] HCI_005: Change class of remote Dev by HCI.
[PASS] HCI_006: Read local HCI controller information.
[PASS] HCI_007: Read remote HCI controller information.
=== L2CAP ===
[PASS] L2CAP_001: Build l2cap connection between Dev_A and Dev_B.
[PASS] L2CAP_002: Dev_A and Dev_B take l2cap protocol to do pingpong.
=== RFCOMM ===
[PASS] RFCOMM_001: Build rfcomm connection between Dev_A and Dev_B.
[PASS] RFCOMM_002: Dev_A and Dev_B take rfcomm protocol to do pingpong.
=== Settings ===
[PASS] SET_001: [BAT] No error output during bluetoothd startup process.
=== Bluetooth Utils ===
Some basic checking for hciconfig, hcitool, sdptool commands.
[PASS] BTCMD_001: hciconfig -a
[PASS] BTCMD_002: hciconfig <adapter> piscan
[PASS] BTCMD_003: hciconfig <adapter> up/down
[PASS] BTCMD_004: hcitool scan
[PASS] BTCMD_005: sdptool browse local
[PASS] BTCMD_006: sdptool browse <ermote MAC>
[PASS] BTCMD_007: sdptool add/del
^ permalink raw reply
* [PATCH BlueZ 1/4] gdbus: Fix having multiple path exporting ObjectManager
From: Luiz Augusto von Dentz @ 2012-11-19 8:46 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
ObjectManager should only be available on the root path so if the
current is a child of the object being registered the root should be
changed.
---
gdbus/object.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index 3101ca6..43154f3 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -84,6 +84,8 @@ struct property_data {
DBusMessage *message;
};
+static struct generic_data *root = NULL;
+
static gboolean process_changes(gpointer user_data);
static void process_properties_from_interface(struct generic_data *data,
struct interface_data *iface);
@@ -574,11 +576,7 @@ static void emit_interfaces_added(struct generic_data *data)
if (parent == NULL)
return;
- /* Find root data */
- while (parent->parent)
- parent = parent->parent;
-
- signal = dbus_message_new_signal(parent->path,
+ signal = dbus_message_new_signal(root->path,
DBUS_INTERFACE_OBJECT_MANAGER,
"InterfacesAdded");
if (signal == NULL)
@@ -948,11 +946,7 @@ static void emit_interfaces_removed(struct generic_data *data)
if (parent == NULL)
return;
- /* Find root data */
- while (parent->parent)
- parent = parent->parent;
-
- signal = dbus_message_new_signal(parent->path,
+ signal = dbus_message_new_signal(root->path,
DBUS_INTERFACE_OBJECT_MANAGER,
"InterfacesRemoved");
if (signal == NULL)
@@ -1008,6 +1002,9 @@ static void generic_unregister(DBusConnection *connection, void *user_data)
g_slist_foreach(data->objects, reset_parent, data->parent);
g_slist_free(data->objects);
+ if (root == data)
+ root = NULL;
+
dbus_connection_unref(data->conn);
g_free(data->introspect);
g_free(data->path);
@@ -1175,6 +1172,20 @@ static void add_interface(struct generic_data *data,
data->process_id = g_idle_add(process_changes, data);
}
+static void set_root(struct generic_data *data)
+{
+ if (root != NULL) {
+ data->objects = g_slist_prepend(data->objects, root);
+ root->parent = data;
+ remove_interface(root, DBUS_INTERFACE_OBJECT_MANAGER);
+ }
+
+ add_interface(data, DBUS_INTERFACE_OBJECT_MANAGER,
+ manager_methods, manager_signals,
+ NULL, data, NULL);
+ root = data;
+}
+
static struct generic_data *object_path_ref(DBusConnection *connection,
const char *path)
{
@@ -1209,9 +1220,7 @@ static struct generic_data *object_path_ref(DBusConnection *connection,
/* Only root path export ObjectManager interface */
if (data->parent == NULL)
- add_interface(data, DBUS_INTERFACE_OBJECT_MANAGER,
- manager_methods, manager_signals,
- NULL, data, NULL);
+ set_root(data);
add_interface(data, DBUS_INTERFACE_PROPERTIES, properties_methods,
properties_signals, NULL, data, NULL);
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 2/4] gdbus: Automatically register '/' path
From: Luiz Augusto von Dentz @ 2012-11-19 8:46 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1353314786-11427-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes g_dbus_setup_bus to automatically register '/' path so
user application that don't export any interface on '/' will have it
registered for ObjectManager.
Note that it is now required to call g_dbus_close before exit.
---
gdbus/gdbus.h | 1 +
gdbus/mainloop.c | 55 ++++++++++++++++++++++++++++++-------------------------
gdbus/object.c | 2 +-
3 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index ba49621..5056340 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -53,6 +53,7 @@ DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name,
DBusError *error);
+void g_dbus_close(DBusConnection *connection);
gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
DBusError *error);
diff --git a/gdbus/mainloop.c b/gdbus/mainloop.c
index 099b67f..49e6538 100644
--- a/gdbus/mainloop.c
+++ b/gdbus/mainloop.c
@@ -286,27 +286,36 @@ static gboolean setup_bus(DBusConnection *conn, const char *name,
return TRUE;
}
-DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
+static gboolean g_dbus_connect(DBusConnection *conn, const char *name,
DBusError *error)
{
- DBusConnection *conn;
-
- conn = dbus_bus_get(type, error);
-
if (error != NULL) {
if (dbus_error_is_set(error) == TRUE)
- return NULL;
+ return FALSE;
}
- if (conn == NULL)
- return NULL;
+ if (setup_bus(conn, name, error) == FALSE)
+ return FALSE;
- if (setup_bus(conn, name, error) == FALSE) {
- dbus_connection_unref(conn);
- return NULL;
- }
+ if (!g_dbus_register_interface(conn, "/", NULL, NULL, NULL, NULL, NULL,
+ NULL))
+ return FALSE;
- return conn;
+ return TRUE;
+}
+
+DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
+ DBusError *error)
+{
+ DBusConnection *conn;
+
+ conn = dbus_bus_get(type, error);
+
+ if (g_dbus_connect(conn, name, error))
+ return conn;
+
+ dbus_connection_unref(conn);
+ return NULL;
}
DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name,
@@ -316,20 +325,16 @@ DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name,
conn = dbus_bus_get_private(type, error);
- if (error != NULL) {
- if (dbus_error_is_set(error) == TRUE)
- return NULL;
- }
-
- if (conn == NULL)
- return NULL;
+ if (g_dbus_connect(conn, name, error))
+ return conn;
- if (setup_bus(conn, name, error) == FALSE) {
- dbus_connection_unref(conn);
- return NULL;
- }
+ dbus_connection_unref(conn);
+ return NULL;
+}
- return conn;
+void g_dbus_close(DBusConnection *connection)
+{
+ g_dbus_unregister_interface(connection, "/", NULL);
}
gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
diff --git a/gdbus/object.c b/gdbus/object.c
index 43154f3..2a2982d 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -615,7 +615,7 @@ static struct interface_data *find_interface(GSList *interfaces,
for (list = interfaces; list; list = list->next) {
struct interface_data *iface = list->data;
- if (!strcmp(name, iface->name))
+ if (g_strcmp0(name, iface->name) == 0)
return iface;
}
--
1.7.11.7
^ 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