All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Press <ryan@presslab.us>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: LE mouse reconnect problem
Date: Sat, 28 Jun 2014 21:51:49 -0700	[thread overview]
Message-ID: <CABx3TkXsRXUNG4RudXnYifyN4Tq4MssVGXZE6uQtPtxU34bw7A@mail.gmail.com> (raw)
In-Reply-To: <CABx3TkU+JvmekRYBS1iYuriJaprMznH=g6vw2MVYi+2Vqc7Y5w@mail.gmail.com>

On Sat, Jun 28, 2014 at 1:07 PM, Ryan Press <ryan@presslab.us> wrote:
> On Sat, Jun 28, 2014 at 12:22 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> On Sat, Jun 28, 2014 at 6:50 PM, Ryan Press <ryan@presslab.us> wrote:
>>> On Fri, Jun 27, 2014 at 1:32 AM, Luiz Augusto von Dentz
>>> <luiz.dentz@gmail.com> wrote:
>>>> Hi Ryan,
>>>>
>>>> On Wed, Jun 25, 2014 at 4:23 PM, Ryan Press <ryan@presslab.us> wrote:
>>>>> Hi Luiz,
>>>>>
>>>>> Yes it will repeat the scan every few seconds.
>>>>>
>>>>> I paired the device in the Gnome applet.  In the bluetoothctl I could
>>>>> see the pair and trust messages like so:
>>>>>
>>>>> [NEW] Device C5:8C:97:E6:9C:81 Arc Touch Mouse SE
>>>>> [CHG] Device C5:8C:97:E6:9C:81 Connected: yes
>>>>> [CHG] Device C5:8C:97:E6:9C:81 UUIDs:
>>>>>     00001800-0000-1000-8000-00805f9b34fb
>>>>>     00001801-0000-1000-8000-00805f9b34fb
>>>>>     0000180a-0000-1000-8000-00805f9b34fb
>>>>>     0000180f-0000-1000-8000-00805f9b34fb
>>>>>     00001812-0000-1000-8000-00805f9b34fb
>>>>> [CHG] Device C5:8C:97:E6:9C:81 Paired: yes
>>>>> [CHG] Device C5:8C:97:E6:9C:81 Trusted: yes
>>>>> [CHG] Device C5:8C:97:E6:9C:81 Modalias: usb:v045Ep07F3d0001
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Ryan
>>>>>
>>>>>
>>>>> On Jun 25, 2014 12:08 AM, "Luiz Augusto von Dentz" <luiz.dentz@gmail.com> wrote:
>>>>>>
>>>>>> Hi Ryan,
>>>>>>
>>>>>> On Wed, Jun 25, 2014 at 5:27 AM, Ryan Press <ryan@presslab.us> wrote:
>>>>>> > I have a Microsoft Arc mouse, Surface edition.  This uses Bluetooth
>>>>>> > Low Energy.  Under dual boot Windows 8.1 I can connect this mouse, and
>>>>>> > it will reconnect just fine if I turn the mouse off/on or Bluetooth
>>>>>> > off/on.
>>>>>> >
>>>>>> > In Fedora rawhide I have Bluez 5.18-2.  I can pair this mouse just
>>>>>> > fine, and it will continue to work until I turn the mouse off/on or
>>>>>> > turn the computer off/on.  Then it won't reconnect automatically.  If
>>>>>> > I go into bluetoothctl I can connect it again and it will then work.
>>>>>> >
>>>>>> > I looked at bluetoothd and it seems to be doing the LE scan with:
>>>>>> > bluetoothd[2356]: src/adapter.c:trigger_passive_scanning()
>>>>>> > bluetoothd[2356]: src/adapter.c:passive_scanning_complete() status 0x00
>>>>>> > bluetoothd[2356]: src/adapter.c:discovering_callback() hci0 type 6 discovering 1
>>>>>> >
>>>>>> > I look also at hcidump and I see:
>>>>>> > < HCI Command: LE Set Random Address (0x08|0x0005) plen 6
>>>>>> >     bdaddr 39:6D:E2:EC:17:37
>>>>>> >> HCI Event: Command Complete (0x0e) plen 4
>>>>>> >     LE Set Random Address (0x08|0x0005) ncmd 1
>>>>>> >     status 0x00
>>>>>> > < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
>>>>>> >     type 0x01 (active)
>>>>>> >     interval 11.250ms window 11.250ms
>>>>>> >     own address: 0x01 (Random) policy: All
>>>>>> >> HCI Event: Command Complete (0x0e) plen 4
>>>>>> >     LE Set Scan Parameters (0x08|0x000b) ncmd 1
>>>>>> >     status 0x00
>>>>>> > < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
>>>>>> >     value 0x01 (scanning enabled)
>>>>>> >     filter duplicates 0x01 (enabled)
>>>>>> >> HCI Event: Command Complete (0x0e) plen 4
>>>>>> >     LE Set Scan Enable (0x08|0x000c) ncmd 2
>>>>>> >     status 0x00
>>>>>> > < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
>>>>>> >     value 0x00 (scanning disabled)
>>>>>> >     filter duplicates 0x00 (disabled)
>>>>>> >
>>>>>> >
>>>>>> > It doesn't seem to be finding anything?  Is there something else I should try?
>>>>>>
>>>>>> Does it continue to scan or it scan a single time and stops, and have
>>>>>> you paired or just connect?
>>>>
>>>> Can you try with current master, we have applied a few patches for reconnection.
>>>>
>>>>
>>>> --
>>>> Luiz Augusto von Dentz
>>> Hi Luiz,
>>>
>>> I have compiled and install the git Bluez.
>>>
>>> It's the same as before, I can pair it and it will work, but it won't
>>> automatically reconnect.  Using bluetoothctl and "connect" command I
>>> can manually reconnect.
>>>
>>
>> No top posting please. Im running out of ideas, are you sure the mouse
>> is advertising using the same address?
>
> I just tested with "hcitool lescan" and it connected okay.  So I
> looked at a "hcidump" for the hcitool scan and for the Bluez scan and
> they are a bit different.
>
> Here is the one from "hcitool lescan":
>
> HCI sniffer - Bluetooth packet analyzer ver 5.20
> device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
> 2014-06-28 12:54:01.421267 < HCI Command: LE Set Scan Parameters
> (0x08|0x000b) plen 7
>     type 0x01 (active)
>     interval 10.000ms window 10.000ms
>     own address: 0x00 (Public) policy: All
> 2014-06-28 12:54:01.422140 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Parameters (0x08|0x000b) ncmd 1
>     status 0x00
> 2014-06-28 12:54:01.422238 < HCI Command: LE Set Scan Enable
> (0x08|0x000c) plen 2
>     value 0x01 (scanning enabled)
>     filter duplicates 0x01 (enabled)
> 2014-06-28 12:54:01.423144 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Enable (0x08|0x000c) ncmd 2
>     status 0x00
> 2014-06-28 12:54:01.425141 > HCI Event: LE Meta Event (0x3e) plen 12
>     LE Advertising Report
>       ADV_DIRECT_IND - Connectable directed advertising (1)
>       bdaddr C5:8C:97:E9:9C:81 (Random)
>       RSSI: -35
> 2014-06-28 12:54:01.425333 < HCI Command: LE Set Scan Enable
> (0x08|0x000c) plen 2
>     value 0x00 (scanning disabled)
>     filter duplicates 0x00 (disabled)
> 2014-06-28 12:54:01.429161 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Enable (0x08|0x000c) ncmd 2
>     status 0x00
> 2014-06-28 12:54:01.429409 < HCI Command: LE Create Connection
> (0x08|0x000d) plen 25
>     bdaddr C5:8C:97:E9:9C:81 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
> 2014-06-28 12:54:01.430157 > HCI Event: Command Status (0x0f) plen 4
>     LE Create Connection (0x08|0x000d) status 0x00 ncmd 2
> 2014-06-28 12:54:01.433220 > HCI Event: LE Meta Event (0x3e) plen 19
>     LE Connection Complete
>       status 0x00 handle 3585, role master
>       bdaddr C5:8C:97:E9:9C:81 (Random)
> 2014-06-28 12:54:01.433476 < HCI Command: LE Set Scan Enable
> (0x08|0x000c) plen 2
>     value 0x00 (scanning disabled)
>     filter duplicates 0x01 (enabled)
> 2014-06-28 12:54:01.434141 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Enable (0x08|0x000c) ncmd 1
>     status 0x0c
>     Error: Command Disallowed
> 2014-06-28 12:54:01.434206 < HCI Command: LE Start Encryption
> (0x08|0x0019) plen 28
> 2014-06-28 12:54:01.435140 > HCI Event: Command Status (0x0f) plen 4
>     LE Start Encryption (0x08|0x0019) status 0x00 ncmd 1
> 2014-06-28 12:54:01.848191 > HCI Event: Encrypt Change (0x08) plen 4
>     status 0x00 handle 3585 encrypt 0x01
> 2014-06-28 12:54:01.848461 < ACL data: handle 3585 flags 0x00 dlen 11
>     ATT: Read By Type req (0x08)
>       start 0x000c, end 0x0010
>       type-uuid 0x2803
> 2014-06-28 12:54:01.918203 > HCI Event: Number of Completed Packets
> (0x13) plen 5
>     handle 3585 packets 1
> 2014-06-28 12:54:01.988079 > ACL data: handle 3585 flags 0x02 dlen 20
>     ATT: Read By Type resp (0x09)
>       length: 7
>         handle 0x000d, value 0x02 0x0e 0x00 0x29 0x2a
>         handle 0x000f, value 0x02 0x10 0x00 0x50 0x2a
> 2014-06-28 12:54:01.988364 < ACL data: handle 3585 flags 0x00 dlen 7
>     ATT: MTU req (0x02)
>       client rx mtu 672
> 2014-06-28 12:54:02.058200 > HCI Event: Number of Completed Packets
> (0x13) plen 5
>     handle 3585 packets 1
> 2014-06-28 12:54:02.127941 > ACL data: handle 3585 flags 0x02 dlen 7
>     ATT: MTU resp (0x03)
>       server rx mtu 23
> 2014-06-28 12:54:02.128174 < ACL data: handle 3585 flags 0x00 dlen 7
>     ATT: Read req (0x0a)
>       handle 0x0010
> 2014-06-28 12:54:02.198204 > HCI Event: Number of Completed Packets
> (0x13) plen 5
>     handle 3585 packets 1
> 2014-06-28 12:54:02.267972 > ACL data: handle 3585 flags 0x02 dlen 12
>     ATT: Read resp (0x0b)
>
> And here is the one from the regular bluetoothd:
>
> HCI sniffer - Bluetooth packet analyzer ver 5.20
> device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
> 2014-06-28 12:55:30.229459 < HCI Command: LE Set Scan Enable
> (0x08|0x000c) plen 2
>     value 0x00 (scanning disabled)
>     filter duplicates 0x00 (disabled)
> 2014-06-28 12:55:30.232444 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Enable (0x08|0x000c) ncmd 2
>     status 0x00
> 2014-06-28 12:55:33.954807 < HCI Command: LE Set Random Address
> (0x08|0x0005) plen 6
>     bdaddr 00:67:25:80:95:CD
> 2014-06-28 12:55:33.955419 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Random Address (0x08|0x0005) ncmd 1
>     status 0x00
> 2014-06-28 12:55:33.955494 < HCI Command: LE Set Scan Parameters
> (0x08|0x000b) plen 7
>     type 0x01 (active)
>     interval 11.250ms window 11.250ms
>     own address: 0x01 (Random) policy: All
> 2014-06-28 12:55:33.956440 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Parameters (0x08|0x000b) ncmd 1
>     status 0x00
> 2014-06-28 12:55:33.956509 < HCI Command: LE Set Scan Enable
> (0x08|0x000c) plen 2
>     value 0x01 (scanning enabled)
>     filter duplicates 0x01 (enabled)
> 2014-06-28 12:55:33.957440 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Enable (0x08|0x000c) ncmd 2
>     status 0x00
> 2014-06-28 12:55:44.213285 < HCI Command: LE Set Scan Enable
> (0x08|0x000c) plen 2
>     value 0x00 (scanning disabled)
>     filter duplicates 0x00 (disabled)
> 2014-06-28 12:55:44.215502 > HCI Event: Command Complete (0x0e) plen 4
>     LE Set Scan Enable (0x08|0x000c) ncmd 2
>     status 0x00
>
>
> It looks like Bluez is using random address and hcitool lescan is
> using public address.  I don't know why to use random or public.
>
> hcitool lescan:
>     own address: 0x00 (Public) policy: All
> bluetoothd:
>     own address: 0x01 (Random) policy: All
>
> And the advertise address from the mouse is the same.
>
> hcitool:
>     bdaddr C5:8C:97:E9:9C:81 (Random)
> bluetoothctl:
> [NEW] Device C5:8C:97:E9:9C:81 Arc Touch Mouse SE
>
>
> Thanks.
> Ryan

Hi Luiz,

I realized that 3.15+ kernel had the LE Privacy support, so I tried
3.14 and my mouse reconnects just fine.  So somehow my mouse does not
work with the new LE Privacy in the kernel.

I couldn't find any way to disable this.  It seems that bluetoothd
just uses the default setting which is LE Privacy enabled.  And I
couldn't find any way in the kernel to disable it via a module option
or sysfs.  Is there some other way I can disable this?

Thanks,
Ryan

  reply	other threads:[~2014-06-29  4:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25  2:27 LE mouse reconnect problem Ryan Press
2014-06-25  7:08 ` Luiz Augusto von Dentz
     [not found]   ` <CABx3TkVgs6J1UR8Z5Rbyd2e90p74RfggpzsvnxzgWGgN9c2Epg@mail.gmail.com>
2014-06-25 13:23     ` Fwd: " Ryan Press
2014-06-27  8:32       ` Luiz Augusto von Dentz
2014-06-28 15:50         ` Ryan Press
2014-06-28 19:22           ` Luiz Augusto von Dentz
2014-06-28 20:07             ` Ryan Press
2014-06-29  4:51               ` Ryan Press [this message]
2014-06-29  5:14                 ` Johan Hedberg
2014-06-29  5:29                   ` Johan Hedberg
2014-06-29  9:43                     ` Marcel Holtmann
2014-06-29 17:02                       ` Ryan Press
2014-06-29 17:52                         ` Marcel Holtmann
2014-06-29 19:01                           ` Ryan Press
2014-07-01  9:49                             ` Marcel Holtmann
2014-07-03  3:01                               ` Ryan Press
2014-07-03  7:29                                 ` Marcel Holtmann
2014-07-03 15:18                           ` d.eriksson
2014-07-03 15:41                             ` Marcel Holtmann
2014-07-03 16:40                               ` d.eriksson
2014-07-03 16:48                                 ` Marcel Holtmann
2014-07-17  5:40                                 ` Scott James Remnant
2014-06-29 19:03                       ` Scott James Remnant
2014-06-29 19:19                         ` Marcel Holtmann
2014-06-29 19:37                           ` Scott James Remnant
2014-06-29 19:56                             ` Marcel Holtmann
2014-06-29 20:02                               ` Scott James Remnant
2014-07-01 16:01                             ` Marcel Holtmann
2014-07-17  5:42                               ` Scott James Remnant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABx3TkXsRXUNG4RudXnYifyN4Tq4MssVGXZE6uQtPtxU34bw7A@mail.gmail.com \
    --to=ryan@presslab.us \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.