* Re: btusb_intr_complete returns -EPIPE
From: Naveen Kumar Parna @ 2014-10-16 15:05 UTC (permalink / raw)
To: Alan Stern
Cc: Oliver Neukum, linux-bluetooth@vger.kernel.org, linux-usb, acho
In-Reply-To: <Pine.LNX.4.44L0.1410161007340.1316-100000@iolanthe.rowland.org>
Ok, I will do this and update you.
But Currently I am on long leave and I can update you on 27th Oct.
Thanks,
Naveen
On Thu, Oct 16, 2014 at 7:39 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Thu, 16 Oct 2014, Naveen Kumar Parna wrote:
>
>> > Indeed. However, it is possible to use an additional in between your
>> > devices and the internal hub.
>> >
>> > Regards
>> > Oliver
>> >
>> >
>>
>>
>> Tested with this configuration(external hubs Dev 3, Dev 4, Dev 17, Dev
>> 10) and got the same result.
>>
>> /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
>>
>> /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
>>
>> |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M
>>
>> |__ Port 5: Dev 3, If 0, Class=hub, Driver=hub/7p, 12M
>>
>> |__ Port 1: Dev 4, If 0, Class=hub, Driver=hub/7p, 12M
>
> This is not what Oliver meant. You have to use a USB-2 hub. And
> having one of them is enough; you don't need two.
>
> Alan Stern
>
^ permalink raw reply
* Query regarding creation of multiple MAS Instance ID:
From: Gowtham Anandha Babu @ 2014-10-16 14:18 UTC (permalink / raw)
To: linux-bluetooth; +Cc: 'Bharat Panda', 'Dmitry Kasatkin', cpgs
Hi All,
I am working on obexd MAP profile. Is it possible to create multiple MAS
Instance in bluez?
Because right now bluez has only one MAS Instance support (only one
MAS_UUID), which is advertised to MCE based on the XML format followed in
src/profile.c.
When I add one more record to MAS_RECORD XML format by changing the value as
0x01, I am not able see two instances getting loaded.
<attribute id=\"0x0315\"> \
<uint8 value=\"0x01\"/> \
</attribute> \
Do we need to create one more UUID like OBEX_MAS1_UUID and OBEX_MAS2_UUID to
support multiple mas instances?
Or what could be the possible solutions?
Regards.
Gowtham Anandha Babu
^ permalink raw reply
* Re: btusb_intr_complete returns -EPIPE
From: Alan Stern @ 2014-10-16 14:16 UTC (permalink / raw)
To: Naveen Kumar Parna
Cc: Oliver Neukum, linux-bluetooth@vger.kernel.org, linux-usb, acho
In-Reply-To: <CAG0bkvJD_j_SUuSm4_+DiMqc-RH63BDU=cAtbkmNZdJ-ps=q6g@mail.gmail.com>
On Thu, 16 Oct 2014, Naveen Kumar Parna wrote:
> > It's entirely possible that the stall packets are created by the hub.
> > When a full-speed device is connected to a USB-2 hub, and the device
> > fails to respond to a packet sent by the host, the hub reports this
> > failure as a stall.
>
> Here I don’t think device fails to respond to a packet sent by the
> host. I verified this by connecting Ellisys USB analyser in between
> host and devices.
>
> For example Look at the attached(Sample_HciEvt.png) HCI event captured
> by Ellisys USB analyser. It is a valid HCI event from device to Host.
> IN transaction 96 1 ACK FS 16 bytes (FF 2F C2 01 00 17 00 DF 00 01 10
> 00 00 A9 EE 0F)
> IN transaction 96 1 ACK FS 16 bytes (00 00 00 5A 06 9D 39 00 00 66 00
> 00 00 00 00 00)
> IN transaction 96 1 ACK FS 16 bytes (00 00 00 00 00 00 00 00 00 00 00
> 8E 05 28 00 01)
> IN transaction 96 1 ACK FS 1 byte (00)
This doesn't prove anything. All it means is that the device responded
properly on these four occasions. What if the device failed to respond
on some other occasion? You have to compare the output of the analyzer
with the output from usbmon. If usbmon shows a STALL and the analyzer
shows a valid reply for the very same packet, then you'll know the
device isn't at fault.
You should also run a similar test when you connect the device through
a USB-2 hub. In fact, you should run two tests. In one test, connect
the analyzer to the cable segment between the computer and the hub; in
the other test, connect the analyzer to the cable segment between the
hub and the device.
Alan Stern
^ permalink raw reply
* Re: btusb_intr_complete returns -EPIPE
From: Alan Stern @ 2014-10-16 14:09 UTC (permalink / raw)
To: Naveen Kumar Parna
Cc: Oliver Neukum, linux-bluetooth@vger.kernel.org, linux-usb, acho
In-Reply-To: <CAG0bkv+bu23Fm_thq7A5AOrCEXaaWmcKNaX-193GqFh=W0S8xA@mail.gmail.com>
On Thu, 16 Oct 2014, Naveen Kumar Parna wrote:
> > Indeed. However, it is possible to use an additional in between your
> > devices and the internal hub.
> >
> > Regards
> > Oliver
> >
> >
>
>
> Tested with this configuration(external hubs Dev 3, Dev 4, Dev 17, Dev
> 10) and got the same result.
>
> /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
>
> /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
>
> |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M
>
> |__ Port 5: Dev 3, If 0, Class=hub, Driver=hub/7p, 12M
>
> |__ Port 1: Dev 4, If 0, Class=hub, Driver=hub/7p, 12M
This is not what Oliver meant. You have to use a USB-2 hub. And
having one of them is enough; you don't need two.
Alan Stern
^ permalink raw reply
* [PATCH 2/2] android/pts: Update PTS test results for GATT
From: Marcin Kraglak @ 2014-10-16 12:41 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413463262-4090-1-git-send-email-marcin.kraglak@tieto.com>
---
android/pts-gatt.txt | 74 +++++++++++++++-------------------------------------
1 file changed, 21 insertions(+), 53 deletions(-)
diff --git a/android/pts-gatt.txt b/android/pts-gatt.txt
index 9d57007..22e3bdb 100644
--- a/android/pts-gatt.txt
+++ b/android/pts-gatt.txt
@@ -1,7 +1,7 @@
PTS test results for GATT
-PTS version: 5.2
-Tested: 22-July-2014
+PTS version: 5.3
+Tested: 16-October-2014
Android version: 4.4.4
Results:
@@ -18,7 +18,8 @@ TC_GAC_CL_BV_01_C PASS haltest:
gattc search_service
gattc get_characteristic
gattc write_characteristic: type 3
-TC_GAC_SR_BV_01_C FAIL PTS issue #12357
+TC_GAC_SR_BV_01_C PASS PTS issue #12357
+ NOTE: tested with ETS attached to errata
haltest:
gatts add_service
gatts add_chaaracteristic:
@@ -47,8 +48,7 @@ TC_GAD_CL_BV_02_C PASS haltest:
gattc disconnect
gattc connect
gattc refresh
-TC_GAD_CL_BV_03_C PASS haltest:
- when requested: gattc get_characteristic
+TC_GAD_CL_BV_03_C FAIL
TC_GAD_CL_BV_04_C PASS haltest:
when requested: gattc get_characteristic
TC_GAD_CL_BV_05_C PASS haltest:
@@ -56,8 +56,8 @@ TC_GAD_CL_BV_05_C PASS haltest:
handle: check from btmon logs
TC_GAD_CL_BV_06_C PASS haltest:
when requested: gattc get_descriptor
-TC_GAD_CL_BV_07_C N/A
-TC_GAD_CL_BV_08_C N/A
+TC_GAD_CL_BV_07_C PASS bluetooth get_remote_services
+TC_GAD_CL_BV_08_C PASS bluetooth get_remote_services
TC_GAD_SR_BV_01_C PASS haltest:
gattc register_client
gattc listen
@@ -173,9 +173,9 @@ TC_GAR_CL_BV_04_C PASS haltest:
TC_GAR_CL_BI_12_C PASS haltest:
gattc read_characteristic
TC_GAR_CL_BI_13_C PASS haltest:
- gattc read_characteristic
+ gattc test_command <u1> 0x0c
TC_GAR_CL_BI_14_C PASS haltest:
- gattc read_characteristic
+ gattc test_command <u1> 0x0a
TC_GAR_CL_BI_15_C PASS haltest:
gattc read_characteristic
TC_GAR_CL_BI_16_C PASS haltest:
@@ -203,8 +203,6 @@ TC_GAR_CL_BI_25_C PASS haltest:
gattc read_descriptor
TC_GAR_CL_BI_26_C PASS haltest:
gattc read_descriptor
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAR_CL_BI_27_C PASS haltest:
gattc connect
gattc search_service
@@ -214,22 +212,19 @@ TC_GAR_CL_BI_27_C PASS haltest:
handle from logs
gattc read_descriptor
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAR_CL_BV_07_C PASS haltest:
gattc read_descriptor
TC_GAR_CL_BI_28_C PASS haltest:
gattc read_descriptor
TC_GAR_CL_BI_29_C PASS haltest:
- gattc read_descriptor
+ gattc test_command <u1> 0x0c
+ <u2> handle <u3>offset
TC_GAR_CL_BI_30_C PASS haltest:
gattc read_descriptor
TC_GAR_CL_BI_31_C PASS haltest:
gattc read_descriptor
TC_GAR_CL_BI_32_C PASS haltest:
gattc read_descriptor
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAR_CL_BI_33_C PASS haltest:
gattc connect
gattc search_service
@@ -239,8 +234,6 @@ TC_GAR_CL_BI_33_C PASS haltest:
handle from logs
gattc read_descriptor
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAR_CL_BI_34_C PASS haltest:
gattc connect
gattc test_command 224 <addr> 0 0x0a <handle>
@@ -269,8 +262,7 @@ TC_GAR_SR_BI_05_C PASS haltest:
gatts start_service
gatts send_response: <status> 12
TC_GAR_SR_BV_03_C PASS
-TC_GAR_SR_BI_06_C PASS PTS issue #12346 tested with ETS
- haltest:
+TC_GAR_SR_BI_06_C PASS haltest:
gatts add_service
gatts add_chaaracteristic:
<properties> 2 <permissions> 16
@@ -510,17 +502,12 @@ TC_GAW_CL_BI_05_C PASS haltest:
handle from logs
gattc write_characteristic 2 <long_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BI_06_C PASS haltest:
gattc connect
gattc search_service
gattc get_characteristic: srvc_id based on
handle from logs
gattc write_characteristic 2 <long_value>
- gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BV_05_C PASS haltest:
gattc connect
gattc search_service
@@ -542,9 +529,9 @@ TC_GAW_CL_BI_08_C PASS haltest:
TC_GAW_CL_BI_09_C PASS haltest:
gattc connect
gattc search_service
- gattc get_characteristic: srvc_id based on
- handle from logs
- gattc write_characteristic 2 <long_value>
+ gattc test_command <u1> 0x16 <u2> handle
+ <u3> offset <u4> data
+ gattc test_command <u1> 0x18 <u2> 1
gattc disconnect
TC_GAW_CL_BI_11_C PASS haltest:
gattc connect
@@ -560,8 +547,6 @@ TC_GAW_CL_BI_12_C PASS haltest:
handle from logs
gattc write_characteristic 2 <long_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BI_13_C PASS haltest:
gattc connect
gattc search_service
@@ -569,14 +554,13 @@ TC_GAW_CL_BI_13_C PASS haltest:
handle from logs
gattc write_characteristic 2 <long_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BV_06_C PASS haltest:
gattc connect
gattc search_service
gattc get_characteristic: srvc_id based on
handle from logs
- gattc write_characteristic 2 <long_value>
+ gattc write_characteristic 3
+ gattc execute_write 1
gattc disconnect
TC_GAW_CL_BI_14_C PASS haltest:
gattc connect
@@ -603,8 +587,6 @@ TC_GAW_CL_BI_18_C PASS haltest:
handle from logs
gattc write_characteristic 2 <long_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BI_19_C PASS haltest:
gattc connect
gattc search_service
@@ -612,8 +594,6 @@ TC_GAW_CL_BI_19_C PASS haltest:
handle from logs
gattc write_characteristic 2 <long_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BV_08_C PASS haltest:
gattc connect
gattc search_service
@@ -650,8 +630,6 @@ TC_GAW_CL_BI_23_C PASS haltest:
gattc get_descriptor
gattc write_descriptor 2 <short_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BI_24_C PASS haltest:
gattc connect
gattc search_service
@@ -660,8 +638,6 @@ TC_GAW_CL_BI_24_C PASS haltest:
gattc get_descriptor
gattc write_descriptor 2 <short_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BV_09_C PASS haltest:
gattc connect
gattc search_service
@@ -702,8 +678,6 @@ TC_GAW_CL_BI_30_C PASS haltest:
handle from logs
gattc write_characteristic 2 <long_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BI_31_C PASS haltest:
gattc connect
gattc search_service
@@ -711,8 +685,6 @@ TC_GAW_CL_BI_31_C PASS haltest:
handle from logs
gattc write_characteristic 2 <long_value>
gattc disconnect
- NOTE: TSPX_delete_ltk must be set to true
- PTS issue #12371
TC_GAW_CL_BI_32_C PASS haltest:
gattc connect
gattc search_service
@@ -759,7 +731,7 @@ TC_GAW_SR_BV_01_C PASS haltest:
TC_GAW_SR_BV_02_C PASS haltest:
gatts add service
gatts add_characteristics:
- <properties> 66 <permisions> 147
+ <properties> 66 <permisions> 145
gatts start_service
gattc listen
gatts send_response: (twice)
@@ -962,8 +934,7 @@ TC_GAW_SR_BV_09_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
- gatts add_characteristic:
- <properties> 10 <permissions> 17
+ gatts add_descriptor: <permissions> 17
gatts start_service
gatts send_response:
<data> value greater than MTU
@@ -1110,7 +1081,7 @@ TC_GAT_CL_BV_02_C PASS haltest:
gattc disconnect
TC_GAT_SR_BV_01_C PASS haltest:
gatts add_service
- gatts add_chaaracteristic:
+ gatts add_characteristic:
<properties> 42 <permissions> 17
gatts add_descriptor: <permissions> 17
gatts start_service
@@ -1196,14 +1167,12 @@ TC_GPA_SR_BV_05_C PASS haltest:
<properties> 138 <permissions> 17
gatts add_descriptor <UUID> 2900
gatts start_service
- gatts send_response
TC_GPA_SR_BV_06_C PASS haltest:
gatts add_service
gatts add_chaaracteristic:
<properties> 138 <permissions> 17
gatts add_descriptor <UUID> 2901
gatts start_service
- gatts send_response
TC_GPA_SR_BV_07_C PASS
TC_GPA_SR_BV_08_C PASS haltest:
gatts add_service
@@ -1220,8 +1189,7 @@ TC_GPA_SR_BV_11_C PASS haltest:
gatts start_service
gatts send_response: repeat with correct offset
and data
-TC_GPA_SR_BV_12_C PASS PTS issue #12262
- haltest:
+TC_GPA_SR_BV_12_C PASS haltest:
gatts add_service
gatts add_chaaracteristic:
<properties> 10 <permissions> 17
--
1.9.3
^ permalink raw reply related
* [PATCH 1/2] android/pts: Update PICS and PIXIT for GATT
From: Marcin Kraglak @ 2014-10-16 12:41 UTC (permalink / raw)
To: linux-bluetooth
---
android/pics-gatt.txt | 2 +-
android/pixit-gatt.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/android/pics-gatt.txt b/android/pics-gatt.txt
index 0cd67b6..6ff9c55 100644
--- a/android/pics-gatt.txt
+++ b/android/pics-gatt.txt
@@ -1,6 +1,6 @@
GATT PICS for the PTS tool.
-PTS version: 5.2
+PTS version: 5.3
* - different than PTS defaults
diff --git a/android/pixit-gatt.txt b/android/pixit-gatt.txt
index 08a80a3..191e2c9 100644
--- a/android/pixit-gatt.txt
+++ b/android/pixit-gatt.txt
@@ -1,6 +1,6 @@
GATT PIXIT for the PTS tool.
-PTS version: 5.2
+PTS version: 5.3
* - different than PTS defaults
& - should be set to IUT Bluetooth address
--
1.9.3
^ permalink raw reply related
* Re: btusb_intr_complete returns -EPIPE
From: Naveen Kumar Parna @ 2014-10-16 10:54 UTC (permalink / raw)
To: Oliver Neukum
Cc: Alan Stern, linux-bluetooth@vger.kernel.org, linux-usb, acho
In-Reply-To: <1413450936.29366.1.camel@linux-0dmf.site>
On Thu, Oct 16, 2014 at 2:45 PM, Oliver Neukum <oneukum@suse.de> wrote:
>
> On Wed, 2014-10-15 at 12:11 -0400, Alan Stern wrote:
> > > If the hub is the problem… what will be the better solution? Is it
> > > possible to change internal hub?
> >
> > No, it is not possible.
>
> Indeed. However, it is possible to use an additional in between your
> devices and the internal hub.
>
> Regards
> Oliver
>
>
Tested with this configuration(external hubs Dev 3, Dev 4, Dev 17, Dev
10) and got the same result.
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M
|__ Port 5: Dev 3, If 0, Class=hub, Driver=hub/7p, 12M
|__ Port 1: Dev 4, If 0, Class=hub, Driver=hub/7p, 12M
|__ Port 1: Dev 11, If 0, Class=vend., Driver=, 12M
|__ Port 2: Dev 12, If 0, Class=vend., Driver=, 12M
|__ Port 3: Dev 13, If 0, Class=vend., Driver=, 12M
|__ Port 4: Dev 14, If 0, Class=vend., Driver=, 12M
|__ Port 5: Dev 15, If 0, Class=vend., Driver=, 12M
|__ Port 6: Dev 16, If 0, Class=vend., Driver=, 12M
|__ Port 7: Dev 17, If 0, Class=hub, Driver=hub/2p, 12M
|__ Port 1: Dev 21, If 0, Class=vend., Driver=, 12M
|__ Port 2: Dev 22, If 0, Class=vend., Driver=, 12M
|__ Port 2: Dev 5, If 0, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 2: Dev 5, If 1, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 2: Dev 5, If 2, Class=app., Driver=, 12M
|__ Port 3: Dev 6, If 0, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 3: Dev 6, If 1, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 3: Dev 6, If 2, Class=app., Driver=, 12M
|__ Port 4: Dev 7, If 0, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 4: Dev 7, If 1, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 4: Dev 7, If 2, Class=app., Driver=, 12M
|__ Port 5: Dev 8, If 0, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 5: Dev 8, If 1, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 5: Dev 8, If 2, Class=app., Driver=, 12M
|__ Port 6: Dev 9, If 0, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 6: Dev 9, If 1, Class='bInterfaceClass 0xe0 not
yet handled', Driver=btusb, 12M
|__ Port 6: Dev 9, If 2, Class=app., Driver=, 12M
|__ Port 7: Dev 10, If 0, Class=hub, Driver=hub/3p, 12M
|__ Port 1: Dev 18, If 0, Class='bInterfaceClass 0xe0
not yet handled', Driver=btusb, 12M
|__ Port 1: Dev 18, If 1, Class='bInterfaceClass 0xe0
not yet handled', Driver=btusb, 12M
|__ Port 1: Dev 18, If 2, Class=app., Driver=, 12M
|__ Port 2: Dev 19, If 0, Class='bInterfaceClass 0xe0
not yet handled', Driver=btusb, 12M
|__ Port 2: Dev 19, If 1, Class='bInterfaceClass 0xe0
not yet handled', Driver=btusb, 12M
|__ Port 2: Dev 19, If 2, Class=app., Driver=, 12M
|__ Port 3: Dev 20, If 0, Class='bInterfaceClass 0xe0
not yet handled', Driver=btusb, 12M
|__ Port 3: Dev 20, If 1, Class='bInterfaceClass 0xe0
not yet handled', Driver=btusb, 12M
|__ Port 3: Dev 20, If 2, Class=app., Driver=, 12M
^ permalink raw reply
* [PATCHv5 14/14] shared/gatt: Add function bt_gatt_result_included_count()
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
It will return number of included services in result.
---
src/shared/gatt-helpers.c | 21 +++++++++++++++++++++
src/shared/gatt-helpers.h | 1 +
2 files changed, 22 insertions(+)
diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index 48e7379..92d0696 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -140,6 +140,27 @@ unsigned int bt_gatt_result_descriptor_count(struct bt_gatt_result *result)
return result_element_count(result);
}
+unsigned int bt_gatt_result_included_count(struct bt_gatt_result *result)
+{
+ struct bt_gatt_result *cur;
+ unsigned int count = 0;
+
+ if (!result)
+ return 0;
+
+ if (result->opcode != BT_ATT_OP_READ_BY_TYPE_RSP)
+ return 0;
+
+ if (result->data_len != 6 && result->data_len != 8)
+ return 0;
+
+ for (cur = result; cur; cur = cur->next)
+ if (cur->opcode == BT_ATT_OP_READ_BY_TYPE_RSP)
+ count += cur->pdu_len / cur->data_len;
+
+ return count;
+}
+
bool bt_gatt_iter_init(struct bt_gatt_iter *iter, struct bt_gatt_result *result)
{
if (!iter || !result)
diff --git a/src/shared/gatt-helpers.h b/src/shared/gatt-helpers.h
index f2c7ec5..07c145d 100644
--- a/src/shared/gatt-helpers.h
+++ b/src/shared/gatt-helpers.h
@@ -38,6 +38,7 @@ struct bt_gatt_iter {
unsigned int bt_gatt_result_service_count(struct bt_gatt_result *result);
unsigned int bt_gatt_result_characteristic_count(struct bt_gatt_result *result);
unsigned int bt_gatt_result_descriptor_count(struct bt_gatt_result *result);
+unsigned int bt_gatt_result_included_count(struct bt_gatt_result *result);
bool bt_gatt_iter_init(struct bt_gatt_iter *iter, struct bt_gatt_result *result);
bool bt_gatt_iter_next_service(struct bt_gatt_iter *iter,
--
1.9.3
^ permalink raw reply related
* [PATCHv5 13/14] shared/gatt: Fix searching descriptors
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
Descriptor discovery range started from characteristic value handle + 1
and end with characteristic end handle. If characteristic value handle
is 0xffff, then discovery range was set to 0x0000-0xffff.
Found during PTS test case TC_GAD_CL_BV_03_C.
---
src/shared/gatt-client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 28865da..8089302 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -714,8 +714,8 @@ static void discover_chrcs_cb(bool success, uint8_t att_ecode,
for (i = 0; i < chrc_count; i++) {
op->cur_chrc_index = i;
op->cur_chrc = chrcs + i;
- desc_start = chrcs[i].chrc_external.value_handle + 1;
- if (desc_start > chrcs[i].chrc_external.end_handle)
+ desc_start = chrcs[i].chrc_external.value_handle;
+ if (desc_start++ == chrcs[i].chrc_external.end_handle)
continue;
if (bt_gatt_discover_descriptors(client->att, desc_start,
--
1.9.3
^ permalink raw reply related
* [PATCHv5 12/14] tools/btgatt-client: Print found include services
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
---
tools/btgatt-client.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 5c692ff..5465d53 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -174,7 +174,9 @@ static void print_uuid(const uint8_t uuid[16])
static void print_service(const bt_gatt_service_t *service)
{
struct bt_gatt_characteristic_iter iter;
+ struct bt_gatt_incl_service_iter include_iter;
const bt_gatt_characteristic_t *chrc;
+ const bt_gatt_included_service_t *incl;
size_t i;
if (!bt_gatt_characteristic_iter_init(&iter, service)) {
@@ -182,12 +184,24 @@ static void print_service(const bt_gatt_service_t *service)
return;
}
+ if (!bt_gatt_include_service_iter_init(&include_iter, service)) {
+ PRLOG("Failed to initialize include service iterator\n");
+ return;
+ }
printf(COLOR_RED "service %s" COLOR_OFF " - start: 0x%04x, "
"end: 0x%04x, uuid: ",
service->primary ? "primary" : "second.",
service->start_handle, service->end_handle);
print_uuid(service->uuid);
+ while (bt_gatt_include_service_iter_next(&include_iter, &incl)) {
+ printf("\t " COLOR_GREEN "include" COLOR_OFF " - handle: "
+ "0x%04x, - start: 0x%04x, end: 0x%04x,"
+ "uuid: ", incl->handle,
+ incl->start_handle, incl->end_handle);
+ print_uuid(incl->uuid);
+ }
+
while (bt_gatt_characteristic_iter_next(&iter, &chrc)) {
printf("\t " COLOR_YELLOW "charac" COLOR_OFF
" - start: 0x%04x, end: 0x%04x, "
--
1.9.3
^ permalink raw reply related
* [PATCHv5 11/14] shared/gatt: Add gatt-client include service iterator
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
It will allow user to take value, handle, start and end handle
of included service.
---
src/shared/gatt-client.c | 30 ++++++++++++++++++++++++++++++
src/shared/gatt-client.h | 10 ++++++++++
2 files changed, 40 insertions(+)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 971788c..28865da 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1674,6 +1674,36 @@ bool bt_gatt_characteristic_iter_next(struct bt_gatt_characteristic_iter *iter,
return true;
}
+bool bt_gatt_include_service_iter_init(struct bt_gatt_incl_service_iter *iter,
+ const bt_gatt_service_t *service)
+{
+ if (!iter || !service)
+ return false;
+
+ memset(iter, 0, sizeof(*iter));
+ iter->service = (struct service_list *) service;
+
+ return true;
+}
+
+bool bt_gatt_include_service_iter_next(struct bt_gatt_incl_service_iter *iter,
+ const bt_gatt_included_service_t **incl)
+{
+ struct service_list *service;
+
+ if (!iter || !incl)
+ return false;
+
+ service = iter->service;
+
+ if (iter->pos >= service->num_includes)
+ return false;
+
+ *incl = &service->includes[iter->pos++];
+
+ return true;
+}
+
struct read_op {
bt_gatt_client_read_callback_t callback;
void *user_data;
diff --git a/src/shared/gatt-client.h b/src/shared/gatt-client.h
index 05b4838..bf4e7bb 100644
--- a/src/shared/gatt-client.h
+++ b/src/shared/gatt-client.h
@@ -113,6 +113,11 @@ struct bt_gatt_characteristic_iter {
size_t pos;
};
+struct bt_gatt_incl_service_iter {
+ void *service;
+ size_t pos;
+};
+
bool bt_gatt_service_iter_init(struct bt_gatt_service_iter *iter,
struct bt_gatt_client *client);
bool bt_gatt_service_iter_next(struct bt_gatt_service_iter *iter,
@@ -129,6 +134,11 @@ bool bt_gatt_characteristic_iter_init(struct bt_gatt_characteristic_iter *iter,
bool bt_gatt_characteristic_iter_next(struct bt_gatt_characteristic_iter *iter,
const bt_gatt_characteristic_t **chrc);
+bool bt_gatt_include_service_iter_init(struct bt_gatt_incl_service_iter *iter,
+ const bt_gatt_service_t *service);
+bool bt_gatt_include_service_iter_next(struct bt_gatt_incl_service_iter *iter,
+ const bt_gatt_included_service_t **inc);
+
typedef void (*bt_gatt_client_read_callback_t)(bool success, uint8_t att_ecode,
const uint8_t *value, uint16_t length,
void *user_data);
--
1.9.3
^ permalink raw reply related
* [PATCHv5 10/14] shared/gatt: Discover included services
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
---
src/shared/gatt-client.c | 114 +++++++++++++++++++++++++++++++++++++++++++++--
src/shared/gatt-client.h | 7 +++
2 files changed, 117 insertions(+), 4 deletions(-)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index e04724c..971788c 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -69,6 +69,8 @@ struct service_list {
bt_gatt_service_t service;
struct chrc_data *chrcs;
size_t num_chrcs;
+ bt_gatt_included_service_t *includes;
+ size_t num_includes;
struct service_list *next;
};
@@ -253,6 +255,14 @@ static void service_destroy_characteristics(struct service_list *service)
free(service->chrcs);
}
+static void service_destroy_includes(struct service_list *service)
+{
+ free(service->includes);
+
+ service->includes = NULL;
+ service->num_includes = 0;
+}
+
static void service_list_clear(struct service_list **head,
struct service_list **tail)
{
@@ -265,6 +275,7 @@ static void service_list_clear(struct service_list **head,
while (l) {
service_destroy_characteristics(l);
+ service_destroy_includes(l);
tmp = l;
l = tmp->next;
free(tmp);
@@ -293,6 +304,7 @@ static void service_list_clear_range(struct service_list **head,
}
service_destroy_characteristics(cur);
+ service_destroy_includes(cur);
if (!prev)
*head = cur->next;
@@ -428,6 +440,99 @@ static int uuid_cmp(const uint8_t uuid128[16], uint16_t uuid16)
return memcmp(uuid128, rhs_uuid, sizeof(rhs_uuid));
}
+static void discover_incl_cb(bool success, uint8_t att_ecode,
+ struct bt_gatt_result *result,
+ void *user_data)
+{
+ struct discovery_op *op = user_data;
+ struct bt_gatt_client *client = op->client;
+ struct bt_gatt_iter iter;
+ char uuid_str[MAX_LEN_UUID_STR];
+ bt_gatt_included_service_t *includes;
+ unsigned int includes_count, i;
+
+ if (!success) {
+ if (att_ecode == BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND) {
+ success = true;
+ goto next;
+ }
+
+ goto done;
+ }
+
+ if (!result || !bt_gatt_iter_init(&iter, result)) {
+ success = false;
+ goto done;
+ }
+
+ includes_count = bt_gatt_result_included_count(result);
+ if (includes_count == 0) {
+ success = false;
+ goto done;
+ }
+
+ includes = new0(bt_gatt_included_service_t, includes_count);
+ if (!includes) {
+ success = false;
+ goto done;
+ }
+
+ util_debug(client->debug_callback, client->debug_data,
+ "Included services found: %u",
+ includes_count);
+
+ i = 0;
+ while (bt_gatt_iter_next_included_service(&iter, &includes[i].handle,
+ &includes[i].start_handle,
+ &includes[i].end_handle,
+ includes[i].uuid)) {
+ uuid_to_string(includes[i].uuid, uuid_str);
+ util_debug(client->debug_callback, client->debug_data,
+ "handle: 0x%04x, start: 0x%04x, end: 0x%04x,"
+ "uuid: %s", includes[i].handle,
+ includes[i].start_handle,
+ includes[i].end_handle, uuid_str);
+ i++;
+ }
+
+ op->cur_service->includes = includes;
+ op->cur_service->num_includes = includes_count;
+
+next:
+ if (!op->cur_service->next) {
+ op->cur_service = op->result_head;
+ if (bt_gatt_discover_characteristics(client->att,
+ op->cur_service->service.start_handle,
+ op->cur_service->service.end_handle,
+ discover_chrcs_cb,
+ discovery_op_ref(op),
+ discovery_op_unref))
+ return;
+
+ util_debug(client->debug_callback, client->debug_data,
+ "Failed to start characteristic discovery");
+ discovery_op_unref(op);
+ success = false;
+ goto done;
+ }
+
+ op->cur_service = op->cur_service->next;
+ if (bt_gatt_discover_included_services(client->att,
+ op->cur_service->service.start_handle,
+ op->cur_service->service.end_handle,
+ discover_incl_cb,
+ discovery_op_ref(op),
+ discovery_op_unref))
+ return;
+ util_debug(client->debug_callback, client->debug_data,
+ "Failed to start included discovery");
+ discovery_op_unref(op);
+ success = false;
+
+done:
+ op->complete_func(op, success, att_ecode);
+}
+
static void discover_descs_cb(bool success, uint8_t att_ecode,
struct bt_gatt_result *result,
void *user_data)
@@ -532,6 +637,7 @@ done:
op->complete_func(op, success, att_ecode);
}
+
static void discover_chrcs_cb(bool success, uint8_t att_ecode,
struct bt_gatt_result *result,
void *user_data)
@@ -703,18 +809,18 @@ static void discover_secondary_cb(bool success, uint8_t att_ecode,
}
next:
- /* Sequentially discover the characteristics of all services */
+ /* Sequentially discover included services */
op->cur_service = op->result_head;
- if (bt_gatt_discover_characteristics(client->att,
+ if (bt_gatt_discover_included_services(client->att,
op->cur_service->service.start_handle,
op->cur_service->service.end_handle,
- discover_chrcs_cb,
+ discover_incl_cb,
discovery_op_ref(op),
discovery_op_unref))
return;
util_debug(client->debug_callback, client->debug_data,
- "Failed to start characteristic discovery");
+ "Failed to start included services discovery");
discovery_op_unref(op);
success = false;
diff --git a/src/shared/gatt-client.h b/src/shared/gatt-client.h
index 22d4dc0..05b4838 100644
--- a/src/shared/gatt-client.h
+++ b/src/shared/gatt-client.h
@@ -96,6 +96,13 @@ typedef struct {
size_t num_descs;
} bt_gatt_characteristic_t;
+typedef struct {
+ uint16_t handle;
+ uint16_t start_handle;
+ uint16_t end_handle;
+ uint8_t uuid[BT_GATT_UUID_SIZE];
+} bt_gatt_included_service_t;
+
struct bt_gatt_service_iter {
struct bt_gatt_client *client;
void *ptr;
--
1.9.3
^ permalink raw reply related
* [PATCHv5 09/14] shared/gatt: Discover secondary services
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
Add searching of secondary services in gatt-client.
---
src/shared/gatt-client.c | 117 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 104 insertions(+), 13 deletions(-)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 724fde2..e04724c 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -200,23 +200,36 @@ static void mark_notify_data_invalid_if_in_range(void *data, void *user_data)
notify_data->invalid = true;
}
-static bool service_list_add_service(struct service_list **head,
- struct service_list **tail,
- bool primary, uint16_t start,
- uint16_t end,
+static struct service_list *new_service_list(uint16_t start, uint16_t end,
+ bool primary,
uint8_t uuid[BT_GATT_UUID_SIZE])
{
struct service_list *list;
list = new0(struct service_list, 1);
if (!list)
- return false;
+ return NULL;
list->service.primary = primary;
list->service.start_handle = start;
list->service.end_handle = end;
memcpy(list->service.uuid, uuid, UUID_BYTES);
+ return list;
+}
+
+static bool service_list_add_service(struct service_list **head,
+ struct service_list **tail,
+ bool primary, uint16_t start,
+ uint16_t end,
+ uint8_t uuid[BT_GATT_UUID_SIZE])
+{
+ struct service_list *list;
+
+ list = new_service_list(start, end, primary, uuid);
+ if (!list)
+ return false;
+
if (!(*head))
*head = *tail = list;
else {
@@ -364,6 +377,8 @@ struct discovery_op {
struct bt_gatt_client *client;
struct service_list *result_head, *result_tail, *cur_service;
struct chrc_data *cur_chrc;
+ uint16_t start;
+ uint16_t end;
int cur_chrc_index;
int ref_count;
void (*complete_func)(struct discovery_op *op, bool success,
@@ -634,6 +649,79 @@ done:
op->complete_func(op, success, att_ecode);
}
+static void discover_secondary_cb(bool success, uint8_t att_ecode,
+ struct bt_gatt_result *result,
+ void *user_data)
+{
+ struct discovery_op *op = user_data;
+ struct bt_gatt_client *client = op->client;
+ struct bt_gatt_iter iter;
+ uint16_t start, end;
+ uint8_t uuid[BT_GATT_UUID_SIZE];
+ char uuid_str[MAX_LEN_UUID_STR];
+ struct service_list *service;
+
+ if (!success) {
+ util_debug(client->debug_callback, client->debug_data,
+ "Secondary service discovery failed."
+ " ATT ECODE: 0x%02x", att_ecode);
+ switch (att_ecode) {
+ case BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND:
+ case BT_ATT_ERROR_UNSUPPORTED_GROUP_TYPE:
+ goto next;
+ default:
+ goto done;
+ }
+ }
+
+ if (!result || !bt_gatt_iter_init(&iter, result)) {
+ success = false;
+ goto done;
+ }
+
+ util_debug(client->debug_callback, client->debug_data,
+ "Secondary services found: %u",
+ bt_gatt_result_service_count(result));
+
+ while (bt_gatt_iter_next_service(&iter, &start, &end, uuid)) {
+ uuid_to_string(uuid, uuid_str);
+ util_debug(client->debug_callback, client->debug_data,
+ "start: 0x%04x, end: 0x%04x, uuid: %s",
+ start, end, uuid_str);
+
+ /* Store the service */
+ service = new_service_list(start, end, false, uuid);
+ if (!service) {
+ util_debug(client->debug_callback, client->debug_data,
+ "Failed to create service");
+ success = false;
+ goto done;
+ }
+
+ service_list_insert_services(&op->result_head, &op->result_tail,
+ service, service);
+ }
+
+next:
+ /* Sequentially discover the characteristics of all services */
+ op->cur_service = op->result_head;
+ if (bt_gatt_discover_characteristics(client->att,
+ op->cur_service->service.start_handle,
+ op->cur_service->service.end_handle,
+ discover_chrcs_cb,
+ discovery_op_ref(op),
+ discovery_op_unref))
+ return;
+
+ util_debug(client->debug_callback, client->debug_data,
+ "Failed to start characteristic discovery");
+ discovery_op_unref(op);
+ success = false;
+
+done:
+ op->complete_func(op, success, att_ecode);
+}
+
static void discover_primary_cb(bool success, uint8_t att_ecode,
struct bt_gatt_result *result,
void *user_data)
@@ -686,18 +774,17 @@ static void discover_primary_cb(bool success, uint8_t att_ecode,
if (!op->result_head)
goto done;
- /* Sequentially discover the characteristics of all services */
+ /* Discover secondary services */
op->cur_service = op->result_head;
- if (bt_gatt_discover_characteristics(client->att,
- op->cur_service->service.start_handle,
- op->cur_service->service.end_handle,
- discover_chrcs_cb,
- discovery_op_ref(op),
- discovery_op_unref))
+ if (bt_gatt_discover_secondary_services(client->att, NULL,
+ op->start, op->end,
+ discover_secondary_cb,
+ discovery_op_ref(op),
+ discovery_op_unref))
return;
util_debug(client->debug_callback, client->debug_data,
- "Failed to start characteristic discovery");
+ "Failed to start secondary service discovery");
discovery_op_unref(op);
success = false;
@@ -870,6 +957,8 @@ static void process_service_changed(struct bt_gatt_client *client,
op->client = client;
op->complete_func = service_changed_complete;
+ op->start = start_handle;
+ op->end = end_handle;
if (!bt_gatt_discover_primary_services(client->att, NULL,
start_handle, end_handle,
@@ -1002,6 +1091,8 @@ static bool gatt_client_init(struct bt_gatt_client *client, uint16_t mtu)
op->client = client;
op->complete_func = init_complete;
+ op->start = 0x0001;
+ op->end = 0xffff;
/* Configure the MTU */
if (!bt_gatt_exchange_mtu(client->att, MAX(BT_ATT_DEFAULT_LE_MTU, mtu),
--
1.9.3
^ permalink raw reply related
* [PATCHv5 08/14] tools/btgatt-client: Print type of service
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
---
tools/btgatt-client.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index d900e08..5c692ff 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -182,8 +182,9 @@ static void print_service(const bt_gatt_service_t *service)
return;
}
- printf(COLOR_RED "service" COLOR_OFF " - start: 0x%04x, "
+ printf(COLOR_RED "service %s" COLOR_OFF " - start: 0x%04x, "
"end: 0x%04x, uuid: ",
+ service->primary ? "primary" : "second.",
service->start_handle, service->end_handle);
print_uuid(service->uuid);
--
1.9.3
^ permalink raw reply related
* [PATCHv5 07/14] shared/gatt: Distinguish Primary from Secondary services
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
Add flag primary to distinguish service as primary or secondary.
---
src/shared/gatt-client.c | 7 +++++--
src/shared/gatt-client.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 03d722f..724fde2 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -202,7 +202,8 @@ static void mark_notify_data_invalid_if_in_range(void *data, void *user_data)
static bool service_list_add_service(struct service_list **head,
struct service_list **tail,
- uint16_t start, uint16_t end,
+ bool primary, uint16_t start,
+ uint16_t end,
uint8_t uuid[BT_GATT_UUID_SIZE])
{
struct service_list *list;
@@ -211,6 +212,7 @@ static bool service_list_add_service(struct service_list **head,
if (!list)
return false;
+ list->service.primary = primary;
list->service.start_handle = start;
list->service.end_handle = end;
memcpy(list->service.uuid, uuid, UUID_BYTES);
@@ -668,7 +670,8 @@ static void discover_primary_cb(bool success, uint8_t att_ecode,
/* Store the service */
if (!service_list_add_service(&op->result_head,
- &op->result_tail, start, end, uuid)) {
+ &op->result_tail, true, start, end,
+ uuid)) {
util_debug(client->debug_callback, client->debug_data,
"Failed to store service");
success = false;
diff --git a/src/shared/gatt-client.h b/src/shared/gatt-client.h
index 6807f6b..22d4dc0 100644
--- a/src/shared/gatt-client.h
+++ b/src/shared/gatt-client.h
@@ -75,6 +75,7 @@ bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
bt_gatt_client_destroy_func_t destroy);
typedef struct {
+ bool primary;
uint16_t start_handle;
uint16_t end_handle;
uint8_t uuid[BT_GATT_UUID_SIZE];
--
1.9.3
^ permalink raw reply related
* [PATCHv5 06/14] shared/gatt: Remove not needed function parameter
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
According to SPEC 4.1 4.5.1 "Find Included Services" there is no need
to pass UUID to discover_included_services() function.
---
src/shared/gatt-helpers.c | 1 -
src/shared/gatt-helpers.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index fd8d06c..48e7379 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -1002,7 +1002,6 @@ done:
bool bt_gatt_discover_included_services(struct bt_att *att,
uint16_t start, uint16_t end,
- bt_uuid_t *uuid,
bt_gatt_discovery_callback_t callback,
void *user_data,
bt_gatt_destroy_func_t destroy)
diff --git a/src/shared/gatt-helpers.h b/src/shared/gatt-helpers.h
index 8c434c1..f2c7ec5 100644
--- a/src/shared/gatt-helpers.h
+++ b/src/shared/gatt-helpers.h
@@ -82,7 +82,6 @@ bool bt_gatt_discover_secondary_services(struct bt_att *att, bt_uuid_t *uuid,
bt_gatt_destroy_func_t destroy);
bool bt_gatt_discover_included_services(struct bt_att *att,
uint16_t start, uint16_t end,
- bt_uuid_t *uuid,
bt_gatt_discovery_callback_t callback,
void *user_data,
bt_gatt_destroy_func_t destroy);
--
1.9.3
^ permalink raw reply related
* [PATCHv5 05/14] shared/gatt: Add included service iterator
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
It will fetch included services from result.
---
src/shared/gatt-helpers.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++
src/shared/gatt-helpers.h | 3 +++
2 files changed, 61 insertions(+)
diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index 58104d9..fd8d06c 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -186,6 +186,64 @@ struct discovery_op {
bt_gatt_destroy_func_t destroy;
};
+bool bt_gatt_iter_next_included_service(struct bt_gatt_iter *iter,
+ uint16_t *handle, uint16_t *start_handle,
+ uint16_t *end_handle, uint8_t uuid[16])
+{
+ struct bt_gatt_result *read_result;
+ const void *pdu_ptr;
+ int i = 0;
+
+ if (!iter || !iter->result || !handle || !start_handle || !end_handle
+ || !uuid)
+ return false;
+
+ if (iter->result->opcode != BT_ATT_OP_READ_BY_TYPE_RSP)
+ return false;
+
+ if (iter->result->data_len != 8 && iter->result->data_len != 6)
+ return false;
+
+ pdu_ptr = iter->result->pdu + iter->pos;
+
+ if (iter->result->data_len == 8) {
+ *handle = get_le16(pdu_ptr);
+ *start_handle = get_le16(pdu_ptr + 2);
+ *end_handle = get_le16(pdu_ptr + 4);
+ convert_uuid_le(pdu_ptr + 6, 2, uuid);
+
+ iter->pos += iter->result->data_len;
+
+ if (iter->pos == iter->result->pdu_len) {
+ iter->result = iter->result->next;
+ iter->pos = 0;
+ }
+
+ return true;
+ }
+
+ *handle = get_le16(pdu_ptr);
+ *start_handle = get_le16(pdu_ptr + 2);
+ *end_handle = get_le16(pdu_ptr + 4);
+ read_result = iter->result;
+
+ do {
+ read_result = read_result->next;
+ } while (read_result && i++ < (iter->pos / iter->result->data_len));
+
+ if (!read_result)
+ return false;
+
+ convert_uuid_le(read_result->pdu, read_result->data_len, uuid);
+ iter->pos += iter->result->data_len;
+ if (iter->pos == iter->result->pdu_len) {
+ iter->result = read_result->next;
+ iter->pos = 0;
+ }
+
+ return true;
+}
+
bool bt_gatt_iter_next_service(struct bt_gatt_iter *iter,
uint16_t *start_handle, uint16_t *end_handle,
uint8_t uuid[16])
diff --git a/src/shared/gatt-helpers.h b/src/shared/gatt-helpers.h
index 8a25dea..8c434c1 100644
--- a/src/shared/gatt-helpers.h
+++ b/src/shared/gatt-helpers.h
@@ -49,6 +49,9 @@ bool bt_gatt_iter_next_characteristic(struct bt_gatt_iter *iter,
uint8_t uuid[16]);
bool bt_gatt_iter_next_descriptor(struct bt_gatt_iter *iter, uint16_t *handle,
uint8_t uuid[16]);
+bool bt_gatt_iter_next_included_service(struct bt_gatt_iter *iter,
+ uint16_t *handle, uint16_t *start_handle,
+ uint16_t *end_handle, uint8_t uuid[16]);
typedef void (*bt_gatt_destroy_func_t)(void *user_data);
--
1.9.3
^ permalink raw reply related
* [PATCHv5 04/14] shared/gatt: Add extra check in characteristic iterator
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
Avoid incorrect reading of included service discovery results.
---
src/shared/gatt-helpers.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index c18f738..58104d9 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -123,6 +123,9 @@ unsigned int bt_gatt_result_characteristic_count(struct bt_gatt_result *result)
if (result->opcode != BT_ATT_OP_READ_BY_TYPE_RSP)
return 0;
+ if (result->data_len != 21 && result->data_len != 7)
+ return 0;
+
return result_element_count(result);
}
@@ -239,6 +242,9 @@ bool bt_gatt_iter_next_characteristic(struct bt_gatt_iter *iter,
if (iter->result->opcode != BT_ATT_OP_READ_BY_TYPE_RSP)
return false;
+ if (iter->result->data_len != 21 && iter->result->data_len != 7)
+ return false;
+
op = iter->result->op;
pdu_ptr = iter->result->pdu + iter->pos;
--
1.9.3
^ permalink raw reply related
* [PATCHv5 03/14] shared/gatt: Discover included services 128 bit UUIDS
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
If included services has 128 bit UUID, it won't be returned in
READ_BY_TYPE_RSP. To get UUID READ_REQUEST is used.
This procedure is described in CORE SPEC 4.5.1 "Find Included Services".
---
src/shared/gatt-helpers.c | 170 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 169 insertions(+), 1 deletion(-)
diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index dcb2a2f..c18f738 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -692,6 +692,160 @@ bool bt_gatt_discover_secondary_services(struct bt_att *att, bt_uuid_t *uuid,
destroy, false);
}
+struct read_incl_data {
+ struct discovery_op *op;
+ struct bt_gatt_result *result;
+ int pos;
+ int ref_count;
+};
+
+static struct read_incl_data *new_read_included(struct bt_gatt_result *res)
+{
+ struct read_incl_data *data;
+
+ data = new0(struct read_incl_data, 1);
+ if (!data)
+ return NULL;
+
+ data->op = discovery_op_ref(res->op);
+ data->result = res;
+
+ return data;
+};
+
+static struct read_incl_data *read_included_ref(struct read_incl_data *data)
+{
+ __sync_fetch_and_add(&data->ref_count, 1);
+
+ return data;
+}
+
+static void read_included_unref(void *data)
+{
+ struct read_incl_data *read_data = data;
+
+ if (__sync_sub_and_fetch(&read_data->ref_count, 1))
+ return;
+
+ discovery_op_unref(read_data->op);
+
+ free(read_data);
+}
+
+static void discover_included_cb(uint8_t opcode, const void *pdu,
+ uint16_t length, void *user_data);
+
+static void read_included_cb(uint8_t opcode, const void *pdu,
+ uint16_t length, void *user_data)
+{
+ struct read_incl_data *data = user_data;
+ struct bt_gatt_result *final_result = NULL;
+ struct discovery_op *op = data->op;
+ struct bt_gatt_result *cur_result;
+ uint8_t att_ecode = 0;
+ uint16_t handle;
+ uint8_t read_pdu[2];
+ bool success;
+
+ if (opcode == BT_ATT_OP_ERROR_RSP) {
+ success = false;
+ att_ecode = process_error(pdu, length);
+ goto done;
+ }
+
+ if (opcode != BT_ATT_OP_READ_RSP || (!pdu && length)) {
+ success = false;
+ goto done;
+ }
+
+ if (length != 16) {
+ success = false;
+ goto done;
+ }
+ cur_result = result_create(opcode, pdu, length, length, op);
+ if (!cur_result) {
+ success = false;
+ goto done;
+ }
+
+ if (!op->result_head)
+ op->result_head = op->result_tail = cur_result;
+ else {
+ op->result_tail->next = cur_result;
+ op->result_tail = cur_result;
+ }
+
+ if (data->pos == data->result->pdu_len) {
+ uint16_t last_handle, data_len;
+ uint8_t pdu[6];
+
+ data_len = data->result->data_len;
+ last_handle = get_le16(data->result->pdu + data->pos -
+ data_len);
+ if (last_handle == op->end_handle) {
+ final_result = op->result_head;
+ success = true;
+ goto done;
+ }
+
+ put_le16(last_handle + 1, pdu);
+ put_le16(op->end_handle, pdu + 2);
+ put_le16(GATT_INCLUDE_UUID, pdu + 4);
+
+ if (bt_att_send(op->att, BT_ATT_OP_READ_BY_TYPE_REQ,
+ pdu, sizeof(pdu),
+ discover_included_cb,
+ discovery_op_ref(op),
+ discovery_op_unref))
+ return;
+
+ discovery_op_unref(op);
+ success = false;
+ goto done;
+ }
+
+ handle = get_le16(data->result->pdu + data->pos + 2);
+ put_le16(handle, read_pdu);
+
+ data->pos += data->result->data_len;
+
+ if (bt_att_send(op->att, BT_ATT_OP_READ_REQ, read_pdu, sizeof(read_pdu),
+ read_included_cb,
+ read_included_ref(data),
+ read_included_unref))
+ return;
+
+ read_included_unref(data);
+ success = false;
+
+done:
+ if (op->callback)
+ op->callback(success, att_ecode, final_result, op->user_data);
+}
+
+static void read_included(struct read_incl_data *data)
+{
+ struct discovery_op *op = data->op;
+ uint16_t handle;
+ uint8_t pdu[2];
+
+ handle = get_le16(data->result->pdu + 2);
+ put_le16(handle, pdu);
+
+ data->pos += data->result->data_len;
+
+ if (bt_att_send(op->att, BT_ATT_OP_READ_REQ, pdu, sizeof(pdu),
+ read_included_cb,
+ read_included_ref(data),
+ read_included_unref))
+ return;
+
+ read_included_unref(data);
+
+ if (op->callback)
+ op->callback(false, 0, NULL, data->op->user_data);
+}
+
static void discover_included_cb(uint8_t opcode, const void *pdu,
uint16_t length, void *user_data)
{
@@ -721,7 +875,8 @@ static void discover_included_cb(uint8_t opcode, const void *pdu,
data_length = ((uint8_t *) pdu)[0];
- if ((length - 1) % data_length || data_length != 8) {
+ if (((length - 1) % data_length) ||
+ (data_length != 8 && data_length != 6)) {
success = false;
goto done;
}
@@ -740,6 +895,19 @@ static void discover_included_cb(uint8_t opcode, const void *pdu,
op->result_tail = cur_result;
}
+ if (data_length == 6) {
+ struct read_incl_data *data;
+
+ data = new_read_included(cur_result);
+ if (!data) {
+ success = false;
+ goto done;
+ }
+
+ read_included(data);
+ return;
+ }
+
last_handle = get_le16(pdu + length - data_length);
if (last_handle != op->end_handle) {
uint8_t pdu[6];
--
1.9.3
^ permalink raw reply related
* [PATCHv5 02/14] shared/gatt: Add initial implementation of discover_included_services
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
Current implementation allow to discover included services with
16 bit UUID only.
---
src/shared/gatt-helpers.c | 108 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 106 insertions(+), 2 deletions(-)
diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index 4dc787f..dcb2a2f 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -692,6 +692,82 @@ bool bt_gatt_discover_secondary_services(struct bt_att *att, bt_uuid_t *uuid,
destroy, false);
}
+static void discover_included_cb(uint8_t opcode, const void *pdu,
+ uint16_t length, void *user_data)
+{
+ struct bt_gatt_result *final_result = NULL;
+ struct discovery_op *op = user_data;
+ struct bt_gatt_result *cur_result;
+ uint8_t att_ecode = 0;
+ uint16_t last_handle;
+ size_t data_length;
+ bool success;
+
+ if (opcode == BT_ATT_OP_ERROR_RSP) {
+ success = false;
+ att_ecode = process_error(pdu, length);
+
+ if (att_ecode == BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND &&
+ op->result_head)
+ goto success;
+
+ goto done;
+ }
+
+ if (opcode != BT_ATT_OP_READ_BY_TYPE_RSP || !pdu || length < 6) {
+ success = false;
+ goto done;
+ }
+
+ data_length = ((uint8_t *) pdu)[0];
+
+ if ((length - 1) % data_length || data_length != 8) {
+ success = false;
+ goto done;
+ }
+
+ cur_result = result_create(opcode, pdu + 1, length - 1,
+ data_length, op);
+ if (!cur_result) {
+ success = false;
+ goto done;
+ }
+
+ if (!op->result_head)
+ op->result_head = op->result_tail = cur_result;
+ else {
+ op->result_tail->next = cur_result;
+ op->result_tail = cur_result;
+ }
+
+ last_handle = get_le16(pdu + length - data_length);
+ if (last_handle != op->end_handle) {
+ uint8_t pdu[6];
+
+ put_le16(last_handle + 1, pdu);
+ put_le16(op->end_handle, pdu + 2);
+ put_le16(GATT_INCLUDE_UUID, pdu + 4);
+
+ if (bt_att_send(op->att, BT_ATT_OP_READ_BY_TYPE_REQ,
+ pdu, sizeof(pdu),
+ discover_included_cb,
+ discovery_op_ref(op),
+ discovery_op_unref))
+ return;
+
+ discovery_op_unref(op);
+ success = false;
+ }
+
+success:
+ success = true;
+ final_result = op->result_head;
+
+done:
+ if (op->callback)
+ op->callback(success, att_ecode, final_result, op->user_data);
+}
+
bool bt_gatt_discover_included_services(struct bt_att *att,
uint16_t start, uint16_t end,
bt_uuid_t *uuid,
@@ -699,8 +775,36 @@ bool bt_gatt_discover_included_services(struct bt_att *att,
void *user_data,
bt_gatt_destroy_func_t destroy)
{
- /* TODO */
- return false;
+ struct discovery_op *op;
+ uint8_t pdu[6];
+
+ if (!att)
+ return false;
+
+ op = new0(struct discovery_op, 1);
+ if (!op)
+ return false;
+
+ op->att = att;
+ op->callback = callback;
+ op->user_data = user_data;
+ op->destroy = destroy;
+ op->end_handle = end;
+
+ put_le16(start, pdu);
+ put_le16(end, pdu + 2);
+ put_le16(GATT_INCLUDE_UUID, pdu + 4);
+
+ if (!bt_att_send(att, BT_ATT_OP_READ_BY_TYPE_REQ,
+ pdu, sizeof(pdu),
+ discover_included_cb,
+ discovery_op_ref(op),
+ discovery_op_unref)) {
+ free(op);
+ return false;
+ }
+
+ return true;
}
static void discover_chrcs_cb(uint8_t opcode, const void *pdu,
--
1.9.3
^ permalink raw reply related
* [PATCHv5 01/14] shared/gatt: Add discover_secondary_services()
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1413454646-23076-1-git-send-email-marcin.kraglak@tieto.com>
This pach implements searching Secondary Services in given range.
---
src/shared/gatt-helpers.c | 56 +++++++++++++++++++++++++++++++++--------------
src/shared/gatt-helpers.h | 5 +++++
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index 55e6992..4dc787f 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -175,6 +175,7 @@ struct discovery_op {
uint16_t end_handle;
int ref_count;
bt_uuid_t uuid;
+ uint16_t service_type;
struct bt_gatt_result *result_head;
struct bt_gatt_result *result_tail;
bt_gatt_discovery_callback_t callback;
@@ -487,7 +488,7 @@ static void read_by_grp_type_cb(uint8_t opcode, const void *pdu,
put_le16(last_end + 1, pdu);
put_le16(op->end_handle, pdu + 2);
- put_le16(GATT_PRIM_SVC_UUID, pdu + 4);
+ put_le16(op->service_type, pdu + 4);
if (bt_att_send(op->att, BT_ATT_OP_READ_BY_GRP_TYPE_REQ,
pdu, sizeof(pdu),
@@ -569,7 +570,7 @@ static void find_by_type_val_cb(uint8_t opcode, const void *pdu,
put_le16(last_end + 1, pdu);
put_le16(op->end_handle, pdu + 2);
- put_le16(GATT_PRIM_SVC_UUID, pdu + 4);
+ put_le16(op->service_type, pdu + 4);
put_uuid_le(&op->uuid, pdu + 6);
if (bt_att_send(op->att, BT_ATT_OP_FIND_BY_TYPE_VAL_REQ,
@@ -594,21 +595,12 @@ done:
op->callback(success, att_ecode, final_result, op->user_data);
}
-bool bt_gatt_discover_all_primary_services(struct bt_att *att, bt_uuid_t *uuid,
- bt_gatt_discovery_callback_t callback,
- void *user_data,
- bt_gatt_destroy_func_t destroy)
-{
- return bt_gatt_discover_primary_services(att, uuid, 0x0001, 0xffff,
- callback, user_data,
- destroy);
-}
-
-bool bt_gatt_discover_primary_services(struct bt_att *att, bt_uuid_t *uuid,
+static bool discover_services(struct bt_att *att, bt_uuid_t *uuid,
uint16_t start, uint16_t end,
bt_gatt_discovery_callback_t callback,
void *user_data,
- bt_gatt_destroy_func_t destroy)
+ bt_gatt_destroy_func_t destroy,
+ bool primary)
{
struct discovery_op *op;
bool result;
@@ -625,6 +617,8 @@ bool bt_gatt_discover_primary_services(struct bt_att *att, bt_uuid_t *uuid,
op->callback = callback;
op->user_data = user_data;
op->destroy = destroy;
+ /* set service uuid to primary or secondary */
+ op->service_type = primary ? GATT_PRIM_SVC_UUID : GATT_SND_SVC_UUID;
/* If UUID is NULL, then discover all primary services */
if (!uuid) {
@@ -632,7 +626,7 @@ bool bt_gatt_discover_primary_services(struct bt_att *att, bt_uuid_t *uuid,
put_le16(start, pdu);
put_le16(end, pdu + 2);
- put_le16(GATT_PRIM_SVC_UUID, pdu + 4);
+ put_le16(op->service_type, pdu + 4);
result = bt_att_send(att, BT_ATT_OP_READ_BY_GRP_TYPE_REQ,
pdu, sizeof(pdu),
@@ -652,7 +646,7 @@ bool bt_gatt_discover_primary_services(struct bt_att *att, bt_uuid_t *uuid,
put_le16(start, pdu);
put_le16(end, pdu + 2);
- put_le16(GATT_PRIM_SVC_UUID, pdu + 4);
+ put_le16(op->service_type, pdu + 4);
put_uuid_le(&op->uuid, pdu + 6);
result = bt_att_send(att, BT_ATT_OP_FIND_BY_TYPE_VAL_REQ,
@@ -668,6 +662,36 @@ bool bt_gatt_discover_primary_services(struct bt_att *att, bt_uuid_t *uuid,
return result;
}
+bool bt_gatt_discover_all_primary_services(struct bt_att *att, bt_uuid_t *uuid,
+ bt_gatt_discovery_callback_t callback,
+ void *user_data,
+ bt_gatt_destroy_func_t destroy)
+{
+ return bt_gatt_discover_primary_services(att, uuid, 0x0001, 0xffff,
+ callback, user_data,
+ destroy);
+}
+
+bool bt_gatt_discover_primary_services(struct bt_att *att, bt_uuid_t *uuid,
+ uint16_t start, uint16_t end,
+ bt_gatt_discovery_callback_t callback,
+ void *user_data,
+ bt_gatt_destroy_func_t destroy)
+{
+ return discover_services(att, uuid, start, end, callback, user_data,
+ destroy, true);
+}
+
+bool bt_gatt_discover_secondary_services(struct bt_att *att, bt_uuid_t *uuid,
+ uint16_t start, uint16_t end,
+ bt_gatt_discovery_callback_t callback,
+ void *user_data,
+ bt_gatt_destroy_func_t destroy)
+{
+ return discover_services(att, uuid, start, end, callback, user_data,
+ destroy, false);
+}
+
bool bt_gatt_discover_included_services(struct bt_att *att,
uint16_t start, uint16_t end,
bt_uuid_t *uuid,
diff --git a/src/shared/gatt-helpers.h b/src/shared/gatt-helpers.h
index f6f4b62..8a25dea 100644
--- a/src/shared/gatt-helpers.h
+++ b/src/shared/gatt-helpers.h
@@ -72,6 +72,11 @@ bool bt_gatt_discover_primary_services(struct bt_att *att, bt_uuid_t *uuid,
bt_gatt_discovery_callback_t callback,
void *user_data,
bt_gatt_destroy_func_t destroy);
+bool bt_gatt_discover_secondary_services(struct bt_att *att, bt_uuid_t *uuid,
+ uint16_t start, uint16_t end,
+ bt_gatt_discovery_callback_t callback,
+ void *user_data,
+ bt_gatt_destroy_func_t destroy);
bool bt_gatt_discover_included_services(struct bt_att *att,
uint16_t start, uint16_t end,
bt_uuid_t *uuid,
--
1.9.3
^ permalink raw reply related
* [PATCHv5 00/14] Included service discovery
From: Marcin Kraglak @ 2014-10-16 10:17 UTC (permalink / raw)
To: linux-bluetooth
v3:
In this version after primary service discovery,
secondary services are discovered. Next included
services are resolved. With this approach we
don't have recursively search for included service,
like it was TODO in previous proposal.
There is also small coding style fix suggested by Arman.
v4:
If no secondary services found, continue include services search (fixed
in gatt-client.c).
Fixed wrong debug logs (primary->secondary).
Fixed searching descriptors
v5:
Ignore Unsupported Group Type Error in response to secondary service
discovery and continue included services discovery.
Marcin Kraglak (14):
shared/gatt: Add discover_secondary_services()
shared/gatt: Add initial implementation of discover_included_services
shared/gatt: Discover included services 128 bit UUIDS
shared/gatt: Add extra check in characteristic iterator
shared/gatt: Add included service iterator
shared/gatt: Remove not needed function parameter
shared/gatt: Distinguish Primary from Secondary services
tools/btgatt-client: Print type of service
shared/gatt: Discover secondary services
shared/gatt: Discover included services
shared/gatt: Add gatt-client include service iterator
tools/btgatt-client: Print found include services
shared/gatt: Fix searching descriptors
shared/gatt: Add function bt_gatt_result_included_count()
src/shared/gatt-client.c | 263 +++++++++++++++++++++++++++--
src/shared/gatt-client.h | 18 ++
src/shared/gatt-helpers.c | 418 +++++++++++++++++++++++++++++++++++++++++++---
src/shared/gatt-helpers.h | 10 +-
tools/btgatt-client.c | 17 +-
5 files changed, 690 insertions(+), 36 deletions(-)
--
1.9.3
^ permalink raw reply
* [PATCH] src/profile: Add feature bits to MAS SDP record
From: Gowtham Anandha Babu @ 2014-10-16 10:01 UTC (permalink / raw)
To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu
Add MAP supported features bits to MAS SDP record.
Fix the PTS 5.3 test-cases:
TC_MSE_MFB_BV_02_I
TC_MSE_MFB_BV_05_I
---
src/profile.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/profile.c b/src/profile.c
index 7aca3be..bccb145 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -439,6 +439,9 @@
<attribute id=\"0x0316\"> \
<uint8 value=\"0x0F\"/> \
</attribute> \
+ <attribute id=\"0x0317\"> \
+ <uint32 value=\"0x0000007f\"/> \
+ </attribute> \
</record>"
#define MNS_RECORD \
--
1.9.1
^ permalink raw reply related
* Re: btusb_intr_complete returns -EPIPE
From: Oliver Neukum @ 2014-10-16 9:15 UTC (permalink / raw)
To: Alan Stern
Cc: Naveen Kumar Parna, linux-bluetooth@vger.kernel.org, linux-usb,
acho
In-Reply-To: <Pine.LNX.4.44L0.1410151207020.1210-100000@iolanthe.rowland.org>
On Wed, 2014-10-15 at 12:11 -0400, Alan Stern wrote:
> > If the hub is the problem… what will be the better solution? Is it
> > possible to change internal hub?
>
> No, it is not possible.
Indeed. However, it is possible to use an additional in between your
devices and the internal hub.
Regards
Oliver
^ permalink raw reply
* RE: [PATCH 1/4] tools/csr_usb : Fix Resource leak: file
From: Gowtham Anandha Babu @ 2014-10-16 8:57 UTC (permalink / raw)
To: 'Luiz Augusto von Dentz'
Cc: linux-bluetooth, 'Dmitry Kasatkin',
'Bharat Panda', cpgs
In-Reply-To: <CABBYNZKe1=awjhj2XttF+7gyHaw8f5zWftL=p1wrf+HWMUefMQ@mail.gmail.com>
Hi Luiz,
> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: Thursday, October 16, 2014 1:48 PM
> To: Gowtham Anandha Babu
> Cc: linux-bluetooth@vger.kernel.org; Dmitry Kasatkin; Bharat Panda;
> cpgs@samsung.com
> Subject: Re: [PATCH 1/4] tools/csr_usb : Fix Resource leak: file
>
> Hi,
>
> On Wed, Oct 15, 2014 at 5:08 PM, Gowtham Anandha Babu
> <gowtham.ab@samsung.com> wrote:
> > Handles resource leak.
> > ---
> > tools/csr_usb.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/csr_usb.c b/tools/csr_usb.c index 5fb6bdc..a1d7324
> > 100644
> > --- a/tools/csr_usb.c
> > +++ b/tools/csr_usb.c
> > @@ -80,9 +80,12 @@ static int read_value(const char *name, const char
> *attr, const char *format)
> > return -1;
> >
> > n = fscanf(file, format, &value);
> > - if (n != 1)
> > + if (n != 1) {
> > + fclose(file);
> > return -1;
> > + }
> >
> > + fclose(file);
> > return value;
> > }
> >
> > --
> > 1.9.1
>
> Applied 1-3, but note that I did some changes in the commit message, please
> be consistent and don't include things like space before ':'
> etc, it is always a good practice got look how previous commit have been
> formatted and follow the HACKING document.
>
>
> --
> Luiz Augusto von Dentz
Sorry for the formatting errors and 50/72 format. I will follow the HACKING documents here after.
Thanks !
Regards,
Gowtham Anandha Babu
^ 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