All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Bluez with Raspberry Pi for BLE
@ 2015-09-13 11:23 Mike
  2015-09-14 12:39 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Mike @ 2015-09-13 11:23 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

I am trying to get my RPi to work with BLE. I downloaded and compiled
bluez-5.34.tar.xz.

uname -a says: Linux raspberry 4.1.6-v7+ #810 SMP PREEMPT Tue Aug 18
15:32:12 BST 2015 armv7l GNU/Linux

My BLE-stick is recognized and hci0 is up and running. I can scan for
advertising peripherals with "sudo hcitool lescan". This works. But if I
try to connect to a peripheral I always get Connection refused (111). So
I looked at the output of hcidump and found that after the connection is
completed, I get disconnected by remote.

< HCI Command: LE Create Connection (0x08|0x000d) plen 25
    bdaddr 34:B1:F7:D4:FE:F3 type 0
    interval 4 window 4 initiator_filter 0
    own_bdaddr_type 0 min_interval 15 max_interval 15
    latency 0 supervision_to 3200 min_ce 1 max_ce 1
> 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 72, role master
      bdaddr 34:B1:F7:D4:FE:F3 (Public)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
  0000: 48 00                                             H.
> HCI Event: Command Status (0x0f) plen 4
    LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
> HCI Event: LE Meta Event (0x3e) plen 12
    LE Read Remote Used Features Complete
      status 0x00 handle 72
      Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 72 reason 0x13
    Reason: Remote User Terminated Connection
> HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x00 ncmd 1
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 72 reason 0x16
    Reason: Connection Terminated by Local Host

I tried three different peripherals and I always get "Connection refused
(111)". Any ideas would be appreciated.

Best regards,
Mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bluez with Raspberry Pi for BLE
  2015-09-13 11:23 Bluez with Raspberry Pi for BLE Mike
@ 2015-09-14 12:39 ` Luiz Augusto von Dentz
  2015-09-19  7:59   ` Mike
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2015-09-14 12:39 UTC (permalink / raw)
  To: Mike; +Cc: linux-bluetooth@vger.kernel.org

Hi Mike,

On Sun, Sep 13, 2015 at 2:23 PM, Mike <mailinglists@in-box.at> wrote:
> Hi,
>
> I am trying to get my RPi to work with BLE. I downloaded and compiled
> bluez-5.34.tar.xz.
>
> uname -a says: Linux raspberry 4.1.6-v7+ #810 SMP PREEMPT Tue Aug 18
> 15:32:12 BST 2015 armv7l GNU/Linux
>
> My BLE-stick is recognized and hci0 is up and running. I can scan for
> advertising peripherals with "sudo hcitool lescan". This works. But if I
> try to connect to a peripheral I always get Connection refused (111). So
> I looked at the output of hcidump and found that after the connection is
> completed, I get disconnected by remote.


If you are running bluetoothd using hcitool is _not_ recommended,
please use bluetoothctl instead.

Note: Requiring root access should already warn you about that.

> < HCI Command: LE Create Connection (0x08|0x000d) plen 25
>     bdaddr 34:B1:F7:D4:FE:F3 type 0
>     interval 4 window 4 initiator_filter 0
>     own_bdaddr_type 0 min_interval 15 max_interval 15
>     latency 0 supervision_to 3200 min_ce 1 max_ce 1
>> 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 72, role master
>       bdaddr 34:B1:F7:D4:FE:F3 (Public)
> < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
>   0000: 48 00                                             H.
>> HCI Event: Command Status (0x0f) plen 4
>     LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
>> HCI Event: LE Meta Event (0x3e) plen 12
>     LE Read Remote Used Features Complete
>       status 0x00 handle 72
>       Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> < HCI Command: Disconnect (0x01|0x0006) plen 3
>     handle 72 reason 0x13
>     Reason: Remote User Terminated Connection
>> HCI Event: Command Status (0x0f) plen 4
>     Disconnect (0x01|0x0006) status 0x00 ncmd 1
>> HCI Event: Disconn Complete (0x05) plen 4
>     status 0x00 handle 72 reason 0x16
>     Reason: Connection Terminated by Local Host
>
> I tried three different peripherals and I always get "Connection refused
> (111)". Any ideas would be appreciated.

Perhaps are not running bluetoothd or any other tool to keep the
connection alive, try starting bluetoothd and use bluetoothctl, in
addition you can use org.bluez.GattManager1.RegisterProfile to mark
the device to auto connect (passive scanning):

https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt

or using the python test script:

https://git.kernel.org/cgit/bluetooth/bluez.git/tree/test/test-gatt-profile


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bluez with Raspberry Pi for BLE
  2015-09-14 12:39 ` Luiz Augusto von Dentz
@ 2015-09-19  7:59   ` Mike
  0 siblings, 0 replies; 3+ messages in thread
From: Mike @ 2015-09-19  7:59 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org

Hi Luiz,

it works now. Thank you!

BR
Mike

Am 14.09.2015 um 14:39 schrieb Luiz Augusto von Dentz:
> Hi Mike,
> 
> On Sun, Sep 13, 2015 at 2:23 PM, Mike <mailinglists@in-box.at> wrote:
>> Hi,
>>
>> I am trying to get my RPi to work with BLE. I downloaded and compiled
>> bluez-5.34.tar.xz.
>>
>> uname -a says: Linux raspberry 4.1.6-v7+ #810 SMP PREEMPT Tue Aug 18
>> 15:32:12 BST 2015 armv7l GNU/Linux
>>
>> My BLE-stick is recognized and hci0 is up and running. I can scan for
>> advertising peripherals with "sudo hcitool lescan". This works. But if I
>> try to connect to a peripheral I always get Connection refused (111). So
>> I looked at the output of hcidump and found that after the connection is
>> completed, I get disconnected by remote.
> 
> 
> If you are running bluetoothd using hcitool is _not_ recommended,
> please use bluetoothctl instead.
> 
> Note: Requiring root access should already warn you about that.
> 
>> < HCI Command: LE Create Connection (0x08|0x000d) plen 25
>>     bdaddr 34:B1:F7:D4:FE:F3 type 0
>>     interval 4 window 4 initiator_filter 0
>>     own_bdaddr_type 0 min_interval 15 max_interval 15
>>     latency 0 supervision_to 3200 min_ce 1 max_ce 1
>>> 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 72, role master
>>       bdaddr 34:B1:F7:D4:FE:F3 (Public)
>> < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
>>   0000: 48 00                                             H.
>>> HCI Event: Command Status (0x0f) plen 4
>>     LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
>>> HCI Event: LE Meta Event (0x3e) plen 12
>>     LE Read Remote Used Features Complete
>>       status 0x00 handle 72
>>       Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
>> < HCI Command: Disconnect (0x01|0x0006) plen 3
>>     handle 72 reason 0x13
>>     Reason: Remote User Terminated Connection
>>> HCI Event: Command Status (0x0f) plen 4
>>     Disconnect (0x01|0x0006) status 0x00 ncmd 1
>>> HCI Event: Disconn Complete (0x05) plen 4
>>     status 0x00 handle 72 reason 0x16
>>     Reason: Connection Terminated by Local Host
>>
>> I tried three different peripherals and I always get "Connection refused
>> (111)". Any ideas would be appreciated.
> 
> Perhaps are not running bluetoothd or any other tool to keep the
> connection alive, try starting bluetoothd and use bluetoothctl, in
> addition you can use org.bluez.GattManager1.RegisterProfile to mark
> the device to auto connect (passive scanning):
> 
> https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt
> 
> or using the python test script:
> 
> https://git.kernel.org/cgit/bluetooth/bluez.git/tree/test/test-gatt-profile
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-19  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-13 11:23 Bluez with Raspberry Pi for BLE Mike
2015-09-14 12:39 ` Luiz Augusto von Dentz
2015-09-19  7:59   ` Mike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.