2014-03-14 15:51:40

by Christian Bianchini

[permalink] [raw]
Subject: Bluetooth low energy with gatttool and jawbone

I was trying to connect my Jawbone UP 24 with my pc to get some data from
this device.
This is how much I have done:

$ sudo hcitool lescan
LE Scan ...
DC:7A:F8:10:AF:A5 (unknown)
DC:7A:F8:10:AF:A5 UP24
DC:7A:F8:10:AF:A5 (unknown)
DC:7A:F8:10:AF:A5 (unknown)

$ sudo hcitool lecc --random DC:7A:F8:10:AF:A5
Connection handle 70

sudo gatttool -b DC:7A:F8:10:AF:A5 -I
[ ][DC:7A:F8:10:AF:A5][LE]> connect
[CON][DC:7A:F8:10:AF:A5][LE]>


After this I tried to type "primary" but I just get a timeout.
The device should vibrate to accept the pairing, there is in someway to set
a PIN when pairing?

Also I tried with my android, the procedure is the same:
- Scan for devices
- Find Jawbone
- Vibrate the device
- Press a button on the device
- The pairing is done


I suppose there is a special command to send, in the meantime I will try to
make a small app with Android to pair the device.
Anyway I would like to know how to use gatt to pair with my pc and I am
sure I am missing some steps :S

Thanks

--
---------------------------
Web/Mobile Developer
Luiis Group
[email protected]


2014-03-17 17:50:35

by Anderson Lizardo

[permalink] [raw]
Subject: Re: Bluetooth low energy with gatttool and jawbone

Hi Christian,

On Mon, Mar 17, 2014 at 12:30 PM, Christian Bianchini
<[email protected]> wrote:
> Tried to connect with bluez:
> $ sudo bluez-simple-agent hci0 DC:7A:F8:10:AF:A5
> Creating device failed: org.bluez.Error.ConnectionAttemptFailed: Page Timeout

If you are using a 4.x BlueZ, you must run "test-discovery" until the
device appears, and then attempt the simple-agent command above. This
will feed an internal cache that allows BlueZ to know that this
address is from a LE device, not a BR/EDR one. Since BlueZ 5.0, this
is not necessary anymore.

If this does not work, please post the output from hcidump when you
run the "bluez-simple-agent" command.

> Stupid question, how do I read the firmware version? Sorry to ask
> silly questions but this my first attempt to use this kind of "AT
> commands" via GATT

Given that your connection is dropping after a few seconds, it is
difficult to run commands on the gatttool prompt before fixing this
connection timeout issue. Try running test-discovery + simple-agent as
described above, and then try gatttool again and see if it stays
connected.

> Here is the dump:
> [...]

Unfortunately, the log only says your device is disconnecting due to
"Connection Timeout". Are you getting this same error every time? And
for how long the link stays up before disconnecting? (you can pass
"-t" to hcidump to show the timestamp so you can measure easily).

This error usually means there is a poor connection between your
machine and the device, or that the device "disappeared" (i.e. became
out of range). Is the device fully charged?

Best Regards,
--
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil

2014-03-17 16:59:12

by Christian Bianchini

[permalink] [raw]
Subject: Re: Bluetooth low energy with gatttool and jawbone

Ok, digging around in the code from Jawbone I discovered this:

They get the first service attr handle: 0x0009, end grp handle:
0x0012 uuid: f7c9ba7e-6658-4390-b53c-1de5e1453654
and then read the characteristics of it:
handle: 0x000a, char properties: 0x18, char value handle: 0x000b,
uuid: f7c9b162-6658-4390-b53c-1de5e1453654
handle: 0x000d, char properties: 0x10, char value handle: 0x000e,
uuid: f7c9ba82-6658-4390-b53c-1de5e1453654
handle: 0x0010, char properties: 0x10, char value handle: 0x0011,
uuid: f7c9ba91-6658-4390-b53c-1de5e1453654
handle: 0x0014, char properties: 0x02, char value handle: 0x0015,
uuid: 00002a29-0000-1000-8000-00805f9b34fb
handle: 0x0017, char properties: 0x02, char value handle: 0x0018,
uuid: 00002a26-0000-1000-8000-00805f9b34fb
handle: 0x001a, char properties: 0x02, char value handle: 0x001b,
uuid: 00002a24-0000-1000-8000-00805f9b34fb
handle: 0x001d, char properties: 0x02, char value handle: 0x001e,
uuid: 00002a28-0000-1000-8000-00805f9b34fb

then they send a "ENABLE_NOTIFICATION_VALUE ( {0x01,0x00} ) to the
first 3 handles.

One thing that I dont get is that I get disconnected after 5 seconds
that I dont send data, there is a way to get a permanent connection?

I am not sure what this ENABLE_NOTIFICATION_VALUE means, it can be
something standard from BLE but I said I am just new in this world.

Would be nice if someone can give me some info :)



On Mon, Mar 17, 2014 at 4:30 PM, Christian Bianchini
<[email protected]> wrote:
> Tried to connect with bluez:
> $ sudo bluez-simple-agent hci0 DC:7A:F8:10:AF:A5
> Creating device failed: org.bluez.Error.ConnectionAttemptFailed: Page Timeout
>
>
> Stupid question, how do I read the firmware version? Sorry to ask
> silly questions but this my first attempt to use this kind of "AT
> commands" via GATT
>
> Here is the dump:
>
> HCI sniffer - Bluetooth packet analyzer ver 2.5
> device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
> < HCI Command: LE Create Connection (0x08|0x000d) plen 25
> bdaddr DC:7A:F8:10:AF:A5 type 1
> interval 96 window 48 initiator_filter 0
> own_bdaddr_type 0 min_interval 40 max_interval 56
> latency 0 supervision_to 42 min_ce 0 max_ce 0
>> HCI Event: Command Status (0x0f) plen 4
> LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
>> HCI Event: LE Meta Event (0x3e) plen 19
> LE Connection Complete
> status 0x00 handle 70, role master
> bdaddr DC:7A:F8:10:AF:A5 (Random)
> < ACL data: handle 70 flags 0x00 dlen 11
> ATT: Read By Group req (0x10)
> start 0x0001, end 0xffff
> type-uuid 0x2800
>> HCI Event: Number of Completed Packets (0x13) plen 5
> handle 70 packets 1
>> ACL data: handle 70 flags 0x02 dlen 18
> ATT: Read By Group resp (0x11)
> attr handle 0x0001, end group handle 0x0007
> value 0x00 0x18
> attr handle 0x0008, end group handle 0x0008
> value 0x01 0x18
> < ACL data: handle 70 flags 0x00 dlen 11
> ATT: Read By Group req (0x10)
> start 0x0009, end 0xffff
> type-uuid 0x2800
>> HCI Event: Number of Completed Packets (0x13) plen 5
> handle 70 packets 1
>> ACL data: handle 70 flags 0x02 dlen 26
> ATT: Read By Group resp (0x11)
> attr handle 0x0009, end group handle 0x0012
> value 0x54 0x36 0x45 0xe1 0xe5 0x1d 0x3c 0xb5 0x90 0x43 0x58
> 0x66 0x7e 0xba 0xc9 0xf7
> < ACL data: handle 70 flags 0x00 dlen 11
> ATT: Read By Group req (0x10)
> start 0x0013, end 0xffff
> type-uuid 0x2800
>> HCI Event: Number of Completed Packets (0x13) plen 5
> handle 70 packets 1
>> ACL data: handle 70 flags 0x02 dlen 12
> ATT: Read By Group resp (0x11)
> attr handle 0x0013, end group handle 0xffff
> value 0x0a 0x18
>> HCI Event: Disconn Complete (0x05) plen 4
> status 0x00 handle 70 reason 0x08
> Reason: Connection Timeout
>
> On Fri, Mar 14, 2014 at 5:18 PM, Christian Bianchini
> <[email protected]> wrote:
>> I would like to get the motion data, basically this device has an
>> accelerometer inside and maybe a gyro, so I just want to receive these
>> information on my pc :)
>> I will do some more testing later, probably if I dont answer for a
>> while... I will be back on Monday.
>>
>> In the meantime thanks for your helpful answers!
>>
>> On Fri, Mar 14, 2014 at 5:07 PM, Anderson Lizardo
>> <[email protected]> wrote:
>>> Hi Christian,
>>>
>>> On Fri, Mar 14, 2014 at 12:19 PM, Christian Bianchini
>>> <[email protected]> wrote:
>>>> You were right!
>>>> Something happened, but I am not sure how to continue now, even
>>>> because after primary I get some data then the device disconnect
>>>> itself.
>>>>
>>>> $ sudo gatttool -b DC:7A:F8:10:AF:A5 -t random -I
>>>> [ ][DC:7A:F8:10:AF:A5][LE]> connect
>>>> [CON][DC:7A:F8:10:AF:A5][LE]> primary
>>>> [CON][DC:7A:F8:10:AF:A5][LE]>
>>>> attr handle: 0x0001, end grp handle: 0x0007 uuid:
>>>> 00001800-0000-1000-8000-00805f9b34fb
>>>> attr handle: 0x0008, end grp handle: 0x0008 uuid:
>>>> 00001801-0000-1000-8000-00805f9b34fb
>>>> attr handle: 0x0009, end grp handle: 0x0012 uuid:
>>>> f7c9ba7e-6658-4390-b53c-1de5e1453654
>>>> attr handle: 0x0013, end grp handle: 0xffff uuid:
>>>> 0000180a-0000-1000-8000-00805f9b34fb
>>>>
>>>> I dont have bluetoothctl, there is special package for ubuntu?
>>>
>>> To have btmon/bluetoothctl, I think you need a recent BlueZ 5.x, which
>>> is not available on Ubuntu (I think even latest Ubuntu uses 4.101, not
>>> sure about the development version). So you need to build BlueZ from
>>> sources.
>>>
>>> If you see a disconnect after ~30 seconds, it may be because it is
>>> issuing a GATT request which gatttool does not answer (as gatttool
>>> does not implement a GATT server). To confirm this, use "hcidump -i
>>> hci0 -w jawbone.dump" and send it here. This log will show whether the
>>> device is attempting some ATT request (e.g. GATT service discovery).
>>> You can also read this log using "hcidump -r jawbone.dump".
>>>
>>> Another reason for disconnect is a failed pairing attempt.
>>>
>>> If you can't use BlueZ 5 for some reason, you can try pairing using
>>> "sudo bluez-simple-agent hci0 <addr>".
>>>
>>> All that said, which data specifically do you want to get from the
>>> device? On the output above I see a proprietary service at handle
>>> 0x0009 and the Device Information service at handle 0x0013 (which is
>>> most likely firmware version, serial number etc.). Do you have
>>> specifications for the proprietary service?
>>>
>>> Best Regards,
>>> --
>>> Anderson Lizardo
>>> http://www.indt.org/?lang=en
>>> INdT - Manaus - Brazil
>>
>>
>>
>> --
>> ---------------------------
>> Web/Mobile Developer
>> Luiis Group
>> [email protected]
>
>
>
> --
> ---------------------------
> Web/Mobile Developer
> Luiis Group
> [email protected]



--
---------------------------
Web/Mobile Developer
Luiis Group
[email protected]

2014-03-17 16:30:37

by Christian Bianchini

[permalink] [raw]
Subject: Re: Bluetooth low energy with gatttool and jawbone

Tried to connect with bluez:
$ sudo bluez-simple-agent hci0 DC:7A:F8:10:AF:A5
Creating device failed: org.bluez.Error.ConnectionAttemptFailed: Page Timeout


Stupid question, how do I read the firmware version? Sorry to ask
silly questions but this my first attempt to use this kind of "AT
commands" via GATT

Here is the dump:

HCI sniffer - Bluetooth packet analyzer ver 2.5
device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
< HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr DC:7A:F8:10:AF:A5 type 1
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 40 max_interval 56
latency 0 supervision_to 42 min_ce 0 max_ce 0
> HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
> HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 70, role master
bdaddr DC:7A:F8:10:AF:A5 (Random)
< ACL data: handle 70 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 70 packets 1
> ACL data: handle 70 flags 0x02 dlen 18
ATT: Read By Group resp (0x11)
attr handle 0x0001, end group handle 0x0007
value 0x00 0x18
attr handle 0x0008, end group handle 0x0008
value 0x01 0x18
< ACL data: handle 70 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0009, end 0xffff
type-uuid 0x2800
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 70 packets 1
> ACL data: handle 70 flags 0x02 dlen 26
ATT: Read By Group resp (0x11)
attr handle 0x0009, end group handle 0x0012
value 0x54 0x36 0x45 0xe1 0xe5 0x1d 0x3c 0xb5 0x90 0x43 0x58
0x66 0x7e 0xba 0xc9 0xf7
< ACL data: handle 70 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0013, end 0xffff
type-uuid 0x2800
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 70 packets 1
> ACL data: handle 70 flags 0x02 dlen 12
ATT: Read By Group resp (0x11)
attr handle 0x0013, end group handle 0xffff
value 0x0a 0x18
> HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 70 reason 0x08
Reason: Connection Timeout

On Fri, Mar 14, 2014 at 5:18 PM, Christian Bianchini
<[email protected]> wrote:
> I would like to get the motion data, basically this device has an
> accelerometer inside and maybe a gyro, so I just want to receive these
> information on my pc :)
> I will do some more testing later, probably if I dont answer for a
> while... I will be back on Monday.
>
> In the meantime thanks for your helpful answers!
>
> On Fri, Mar 14, 2014 at 5:07 PM, Anderson Lizardo
> <[email protected]> wrote:
>> Hi Christian,
>>
>> On Fri, Mar 14, 2014 at 12:19 PM, Christian Bianchini
>> <[email protected]> wrote:
>>> You were right!
>>> Something happened, but I am not sure how to continue now, even
>>> because after primary I get some data then the device disconnect
>>> itself.
>>>
>>> $ sudo gatttool -b DC:7A:F8:10:AF:A5 -t random -I
>>> [ ][DC:7A:F8:10:AF:A5][LE]> connect
>>> [CON][DC:7A:F8:10:AF:A5][LE]> primary
>>> [CON][DC:7A:F8:10:AF:A5][LE]>
>>> attr handle: 0x0001, end grp handle: 0x0007 uuid:
>>> 00001800-0000-1000-8000-00805f9b34fb
>>> attr handle: 0x0008, end grp handle: 0x0008 uuid:
>>> 00001801-0000-1000-8000-00805f9b34fb
>>> attr handle: 0x0009, end grp handle: 0x0012 uuid:
>>> f7c9ba7e-6658-4390-b53c-1de5e1453654
>>> attr handle: 0x0013, end grp handle: 0xffff uuid:
>>> 0000180a-0000-1000-8000-00805f9b34fb
>>>
>>> I dont have bluetoothctl, there is special package for ubuntu?
>>
>> To have btmon/bluetoothctl, I think you need a recent BlueZ 5.x, which
>> is not available on Ubuntu (I think even latest Ubuntu uses 4.101, not
>> sure about the development version). So you need to build BlueZ from
>> sources.
>>
>> If you see a disconnect after ~30 seconds, it may be because it is
>> issuing a GATT request which gatttool does not answer (as gatttool
>> does not implement a GATT server). To confirm this, use "hcidump -i
>> hci0 -w jawbone.dump" and send it here. This log will show whether the
>> device is attempting some ATT request (e.g. GATT service discovery).
>> You can also read this log using "hcidump -r jawbone.dump".
>>
>> Another reason for disconnect is a failed pairing attempt.
>>
>> If you can't use BlueZ 5 for some reason, you can try pairing using
>> "sudo bluez-simple-agent hci0 <addr>".
>>
>> All that said, which data specifically do you want to get from the
>> device? On the output above I see a proprietary service at handle
>> 0x0009 and the Device Information service at handle 0x0013 (which is
>> most likely firmware version, serial number etc.). Do you have
>> specifications for the proprietary service?
>>
>> Best Regards,
>> --
>> Anderson Lizardo
>> http://www.indt.org/?lang=en
>> INdT - Manaus - Brazil
>
>
>
> --
> ---------------------------
> Web/Mobile Developer
> Luiis Group
> [email protected]



--
---------------------------
Web/Mobile Developer
Luiis Group
[email protected]

2014-03-14 17:18:22

by Christian Bianchini

[permalink] [raw]
Subject: Re: Bluetooth low energy with gatttool and jawbone

I would like to get the motion data, basically this device has an
accelerometer inside and maybe a gyro, so I just want to receive these
information on my pc :)
I will do some more testing later, probably if I dont answer for a
while... I will be back on Monday.

In the meantime thanks for your helpful answers!

On Fri, Mar 14, 2014 at 5:07 PM, Anderson Lizardo
<[email protected]> wrote:
> Hi Christian,
>
> On Fri, Mar 14, 2014 at 12:19 PM, Christian Bianchini
> <[email protected]> wrote:
>> You were right!
>> Something happened, but I am not sure how to continue now, even
>> because after primary I get some data then the device disconnect
>> itself.
>>
>> $ sudo gatttool -b DC:7A:F8:10:AF:A5 -t random -I
>> [ ][DC:7A:F8:10:AF:A5][LE]> connect
>> [CON][DC:7A:F8:10:AF:A5][LE]> primary
>> [CON][DC:7A:F8:10:AF:A5][LE]>
>> attr handle: 0x0001, end grp handle: 0x0007 uuid:
>> 00001800-0000-1000-8000-00805f9b34fb
>> attr handle: 0x0008, end grp handle: 0x0008 uuid:
>> 00001801-0000-1000-8000-00805f9b34fb
>> attr handle: 0x0009, end grp handle: 0x0012 uuid:
>> f7c9ba7e-6658-4390-b53c-1de5e1453654
>> attr handle: 0x0013, end grp handle: 0xffff uuid:
>> 0000180a-0000-1000-8000-00805f9b34fb
>>
>> I dont have bluetoothctl, there is special package for ubuntu?
>
> To have btmon/bluetoothctl, I think you need a recent BlueZ 5.x, which
> is not available on Ubuntu (I think even latest Ubuntu uses 4.101, not
> sure about the development version). So you need to build BlueZ from
> sources.
>
> If you see a disconnect after ~30 seconds, it may be because it is
> issuing a GATT request which gatttool does not answer (as gatttool
> does not implement a GATT server). To confirm this, use "hcidump -i
> hci0 -w jawbone.dump" and send it here. This log will show whether the
> device is attempting some ATT request (e.g. GATT service discovery).
> You can also read this log using "hcidump -r jawbone.dump".
>
> Another reason for disconnect is a failed pairing attempt.
>
> If you can't use BlueZ 5 for some reason, you can try pairing using
> "sudo bluez-simple-agent hci0 <addr>".
>
> All that said, which data specifically do you want to get from the
> device? On the output above I see a proprietary service at handle
> 0x0009 and the Device Information service at handle 0x0013 (which is
> most likely firmware version, serial number etc.). Do you have
> specifications for the proprietary service?
>
> Best Regards,
> --
> Anderson Lizardo
> http://www.indt.org/?lang=en
> INdT - Manaus - Brazil



--
---------------------------
Web/Mobile Developer
Luiis Group
[email protected]

2014-03-14 17:07:12

by Anderson Lizardo

[permalink] [raw]
Subject: Re: Bluetooth low energy with gatttool and jawbone

Hi Christian,

On Fri, Mar 14, 2014 at 12:19 PM, Christian Bianchini
<[email protected]> wrote:
> You were right!
> Something happened, but I am not sure how to continue now, even
> because after primary I get some data then the device disconnect
> itself.
>
> $ sudo gatttool -b DC:7A:F8:10:AF:A5 -t random -I
> [ ][DC:7A:F8:10:AF:A5][LE]> connect
> [CON][DC:7A:F8:10:AF:A5][LE]> primary
> [CON][DC:7A:F8:10:AF:A5][LE]>
> attr handle: 0x0001, end grp handle: 0x0007 uuid:
> 00001800-0000-1000-8000-00805f9b34fb
> attr handle: 0x0008, end grp handle: 0x0008 uuid:
> 00001801-0000-1000-8000-00805f9b34fb
> attr handle: 0x0009, end grp handle: 0x0012 uuid:
> f7c9ba7e-6658-4390-b53c-1de5e1453654
> attr handle: 0x0013, end grp handle: 0xffff uuid:
> 0000180a-0000-1000-8000-00805f9b34fb
>
> I dont have bluetoothctl, there is special package for ubuntu?

To have btmon/bluetoothctl, I think you need a recent BlueZ 5.x, which
is not available on Ubuntu (I think even latest Ubuntu uses 4.101, not
sure about the development version). So you need to build BlueZ from
sources.

If you see a disconnect after ~30 seconds, it may be because it is
issuing a GATT request which gatttool does not answer (as gatttool
does not implement a GATT server). To confirm this, use "hcidump -i
hci0 -w jawbone.dump" and send it here. This log will show whether the
device is attempting some ATT request (e.g. GATT service discovery).
You can also read this log using "hcidump -r jawbone.dump".

Another reason for disconnect is a failed pairing attempt.

If you can't use BlueZ 5 for some reason, you can try pairing using
"sudo bluez-simple-agent hci0 <addr>".

All that said, which data specifically do you want to get from the
device? On the output above I see a proprietary service at handle
0x0009 and the Device Information service at handle 0x0013 (which is
most likely firmware version, serial number etc.). Do you have
specifications for the proprietary service?

Best Regards,
--
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil

2014-03-14 16:19:41

by Christian Bianchini

[permalink] [raw]
Subject: Re: Bluetooth low energy with gatttool and jawbone

You were right!
Something happened, but I am not sure how to continue now, even
because after primary I get some data then the device disconnect
itself.

$ sudo gatttool -b DC:7A:F8:10:AF:A5 -t random -I
[ ][DC:7A:F8:10:AF:A5][LE]> connect
[CON][DC:7A:F8:10:AF:A5][LE]> primary
[CON][DC:7A:F8:10:AF:A5][LE]>
attr handle: 0x0001, end grp handle: 0x0007 uuid:
00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0008, end grp handle: 0x0008 uuid:
00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0009, end grp handle: 0x0012 uuid:
f7c9ba7e-6658-4390-b53c-1de5e1453654
attr handle: 0x0013, end grp handle: 0xffff uuid:
0000180a-0000-1000-8000-00805f9b34fb

I dont have bluetoothctl, there is special package for ubuntu?

thanks

On Fri, Mar 14, 2014 at 4:07 PM, Anderson Lizardo
<[email protected]> wrote:
> Hi Christian,
>
> On Fri, Mar 14, 2014 at 11:51 AM, Christian Bianchini
> <[email protected]> wrote:
>> I was trying to connect my Jawbone UP 24 with my pc to get some data from
>> this device.
>> This is how much I have done:
>>
>> $ sudo hcitool lescan
>> LE Scan ...
>> DC:7A:F8:10:AF:A5 (unknown)
>> DC:7A:F8:10:AF:A5 UP24
>> DC:7A:F8:10:AF:A5 (unknown)
>> DC:7A:F8:10:AF:A5 (unknown)
>>
>> $ sudo hcitool lecc --random DC:7A:F8:10:AF:A5
>> Connection handle 70
>
> "hcitool lecc" is unnecessary and may cause problems, so just skip it.
> "connect" command for gatttool will do the right thing.
>
>>
>> sudo gatttool -b DC:7A:F8:10:AF:A5 -I
>
> also pass "-t random" so you can connect to devices with random
> address (the detault used type is public).
>
>> [ ][DC:7A:F8:10:AF:A5][LE]> connect
>> [CON][DC:7A:F8:10:AF:A5][LE]>
>>
>>
>> After this I tried to type "primary" but I just get a timeout.
>
> First try the changes described above and see if it works.
>
>> The device should vibrate to accept the pairing, there is in someway to set
>> a PIN when pairing?
>
> If your device requires a PIN for pairing (and will not work without
> pairing), you need to do the pairing Using BlueZ and bluetoothctl.
> This will save the necessary LTK on the kernel and then you can try
> using gatttool again.
>
> bluetoothctl is a interactive tool (like gattttool -I), just type
> "help" to see available commands. I think you need at least these
> commands
>
> scan on
> # (wait for device to appear)
> scan off
> default-agent
> agent on
> pair <addr>
> # (here it should ask for PIN confirmation or entry)
> quit
>
> Then try gatttool as usual.
>
>>
>> Also I tried with my android, the procedure is the same:
>> - Scan for devices
>> - Find Jawbone
>> - Vibrate the device
>> - Press a button on the device
>> - The pairing is done
>
> Remember to clear pairing on the device side (this is device specific,
> usually it is a button sequence or menu) after using android app,
> otherwise pairing with BlueZ may fail with "PIN on key missing".
>
> Finally, I suggest running "btmon" on a terminal all the time so you
> can see the connection traffic and spot errors.
>
> Best Regards,
> --
> Anderson Lizardo
> http://www.indt.org/?lang=en
> INdT - Manaus - Brazil



--
---------------------------
Web/Mobile Developer
Luiis Group
[email protected]

2014-03-14 16:07:12

by Anderson Lizardo

[permalink] [raw]
Subject: Re: Bluetooth low energy with gatttool and jawbone

Hi Christian,

On Fri, Mar 14, 2014 at 11:51 AM, Christian Bianchini
<[email protected]> wrote:
> I was trying to connect my Jawbone UP 24 with my pc to get some data from
> this device.
> This is how much I have done:
>
> $ sudo hcitool lescan
> LE Scan ...
> DC:7A:F8:10:AF:A5 (unknown)
> DC:7A:F8:10:AF:A5 UP24
> DC:7A:F8:10:AF:A5 (unknown)
> DC:7A:F8:10:AF:A5 (unknown)
>
> $ sudo hcitool lecc --random DC:7A:F8:10:AF:A5
> Connection handle 70

"hcitool lecc" is unnecessary and may cause problems, so just skip it.
"connect" command for gatttool will do the right thing.

>
> sudo gatttool -b DC:7A:F8:10:AF:A5 -I

also pass "-t random" so you can connect to devices with random
address (the detault used type is public).

> [ ][DC:7A:F8:10:AF:A5][LE]> connect
> [CON][DC:7A:F8:10:AF:A5][LE]>
>
>
> After this I tried to type "primary" but I just get a timeout.

First try the changes described above and see if it works.

> The device should vibrate to accept the pairing, there is in someway to set
> a PIN when pairing?

If your device requires a PIN for pairing (and will not work without
pairing), you need to do the pairing Using BlueZ and bluetoothctl.
This will save the necessary LTK on the kernel and then you can try
using gatttool again.

bluetoothctl is a interactive tool (like gattttool -I), just type
"help" to see available commands. I think you need at least these
commands

scan on
# (wait for device to appear)
scan off
default-agent
agent on
pair <addr>
# (here it should ask for PIN confirmation or entry)
quit

Then try gatttool as usual.

>
> Also I tried with my android, the procedure is the same:
> - Scan for devices
> - Find Jawbone
> - Vibrate the device
> - Press a button on the device
> - The pairing is done

Remember to clear pairing on the device side (this is device specific,
usually it is a button sequence or menu) after using android app,
otherwise pairing with BlueZ may fail with "PIN on key missing".

Finally, I suggest running "btmon" on a terminal all the time so you
can see the connection traffic and spot errors.

Best Regards,
--
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil