All of lore.kernel.org
 help / color / mirror / Atom feed
* Write should return error if device is disconnected while expecting a response
@ 2016-03-02  7:31 François Beaufort
  2016-03-02 13:31 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 9+ messages in thread
From: François Beaufort @ 2016-03-02  7:31 UTC (permalink / raw)
  To: BlueZ development

When writing to a characteristic and that a disconnection happens
before getting a write (error) response, BlueZ should inform that
write operation failed.
See my real example logs below:

[DFU_Test:/service000c/char000d]# write 01 04
Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d



< ACL Data TX: Handle 32 flags 0x00 dlen 9
                                                   [hci0] 5.066808
      ATT: Write Request (0x12) len 4
        Handle: 0x000e
          Data: 0104
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                    [hci0] 5.106370
        Num handles: 1
        Handle: 32
        Count: 1
> HCI Event: Vendor (0xff) plen 7                                                                                         [hci0] 5.579396
        82 12 95 40 10 36 59                             ...@.6Y
> HCI Event: Disconnect Complete (0x05) plen 4                                                                            [hci0] 5.580376
        Status: Success (0x00)
        Handle: 32
        Reason: Connection Timeout (0x08)
@ Device Disconnected: F1:6F:DE:EC:F1:D6 (2) reason 1

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-02  7:31 Write should return error if device is disconnected while expecting a response François Beaufort
@ 2016-03-02 13:31 ` Luiz Augusto von Dentz
  2016-03-02 15:19   ` François Beaufort
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2016-03-02 13:31 UTC (permalink / raw)
  To: François Beaufort; +Cc: BlueZ development

Hi François,

On Wed, Mar 2, 2016 at 9:31 AM, François Beaufort
<beaufort.francois@gmail.com> wrote:
> When writing to a characteristic and that a disconnection happens
> before getting a write (error) response, BlueZ should inform that
> write operation failed.
> See my real example logs below:
>
> [DFU_Test:/service000c/char000d]# write 01 04
> Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
>
>
>
> < ACL Data TX: Handle 32 flags 0x00 dlen 9
>                                                    [hci0] 5.066808
>       ATT: Write Request (0x12) len 4
>         Handle: 0x000e
>           Data: 0104
>> HCI Event: Number of Completed Packets (0x13) plen 5                                                                    [hci0] 5.106370
>         Num handles: 1
>         Handle: 32
>         Count: 1
>> HCI Event: Vendor (0xff) plen 7                                                                                         [hci0] 5.579396
>         82 12 95 40 10 36 59                             ...@.6Y
>> HCI Event: Disconnect Complete (0x05) plen 4                                                                            [hci0] 5.580376
>         Status: Success (0x00)
>         Handle: 32
>         Reason: Connection Timeout (0x08)
> @ Device Disconnected: F1:6F:DE:EC:F1:D6 (2) reason 1

Interesting, does bluetoothctl print anything after this?

-- 
Luiz Augusto von Dentz

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-02 13:31 ` Luiz Augusto von Dentz
@ 2016-03-02 15:19   ` François Beaufort
  2016-03-03  9:46     ` François Beaufort
  0 siblings, 1 reply; 9+ messages in thread
From: François Beaufort @ 2016-03-02 15:19 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

It does:

[DFU_Test:/service000c/char000d]# write 01 04
Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
[CHG] Device F1:6F:DE:EC:F1:D6 Connected: no
[CHG] Device F1:6F:DE:EC:F1:D6 Connected: yes
[CHG] Device F1:6F:DE:EC:F1:D6 Name: DfuTarg
[CHG] Device F1:6F:DE:EC:F1:D6 Alias: DfuTarg

On Wed, Mar 2, 2016 at 2:31 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi François,
>
> On Wed, Mar 2, 2016 at 9:31 AM, François Beaufort
> <beaufort.francois@gmail.com> wrote:
>> When writing to a characteristic and that a disconnection happens
>> before getting a write (error) response, BlueZ should inform that
>> write operation failed.
>> See my real example logs below:
>>
>> [DFU_Test:/service000c/char000d]# write 01 04
>> Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
>>
>>
>>
>> < ACL Data TX: Handle 32 flags 0x00 dlen 9
>>                                                    [hci0] 5.066808
>>       ATT: Write Request (0x12) len 4
>>         Handle: 0x000e
>>           Data: 0104
>>> HCI Event: Number of Completed Packets (0x13) plen 5                                                                    [hci0] 5.106370
>>         Num handles: 1
>>         Handle: 32
>>         Count: 1
>>> HCI Event: Vendor (0xff) plen 7                                                                                         [hci0] 5.579396
>>         82 12 95 40 10 36 59                             ...@.6Y
>>> HCI Event: Disconnect Complete (0x05) plen 4                                                                            [hci0] 5.580376
>>         Status: Success (0x00)
>>         Handle: 32
>>         Reason: Connection Timeout (0x08)
>> @ Device Disconnected: F1:6F:DE:EC:F1:D6 (2) reason 1
>
> Interesting, does bluetoothctl print anything after this?
>
> --
> Luiz Augusto von Dentz

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-02 15:19   ` François Beaufort
@ 2016-03-03  9:46     ` François Beaufort
  2016-03-07 15:36       ` François Beaufort
  0 siblings, 1 reply; 9+ messages in thread
From: François Beaufort @ 2016-03-03  9:46 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

Since I'm expecting a response and device gets disconnected, I should
get a write error don't you think?

On Wed, Mar 2, 2016 at 4:19 PM, François Beaufort
<beaufort.francois@gmail.com> wrote:
> It does:
>
> [DFU_Test:/service000c/char000d]# write 01 04
> Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
> [CHG] Device F1:6F:DE:EC:F1:D6 Connected: no
> [CHG] Device F1:6F:DE:EC:F1:D6 Connected: yes
> [CHG] Device F1:6F:DE:EC:F1:D6 Name: DfuTarg
> [CHG] Device F1:6F:DE:EC:F1:D6 Alias: DfuTarg
>
> On Wed, Mar 2, 2016 at 2:31 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi François,
>>
>> On Wed, Mar 2, 2016 at 9:31 AM, François Beaufort
>> <beaufort.francois@gmail.com> wrote:
>>> When writing to a characteristic and that a disconnection happens
>>> before getting a write (error) response, BlueZ should inform that
>>> write operation failed.
>>> See my real example logs below:
>>>
>>> [DFU_Test:/service000c/char000d]# write 01 04
>>> Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
>>>
>>>
>>>
>>> < ACL Data TX: Handle 32 flags 0x00 dlen 9
>>>                                                    [hci0] 5.066808
>>>       ATT: Write Request (0x12) len 4
>>>         Handle: 0x000e
>>>           Data: 0104
>>>> HCI Event: Number of Completed Packets (0x13) plen 5                                                                    [hci0] 5.106370
>>>         Num handles: 1
>>>         Handle: 32
>>>         Count: 1
>>>> HCI Event: Vendor (0xff) plen 7                                                                                         [hci0] 5.579396
>>>         82 12 95 40 10 36 59                             ...@.6Y
>>>> HCI Event: Disconnect Complete (0x05) plen 4                                                                            [hci0] 5.580376
>>>         Status: Success (0x00)
>>>         Handle: 32
>>>         Reason: Connection Timeout (0x08)
>>> @ Device Disconnected: F1:6F:DE:EC:F1:D6 (2) reason 1
>>
>> Interesting, does bluetoothctl print anything after this?
>>
>> --
>> Luiz Augusto von Dentz

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-03  9:46     ` François Beaufort
@ 2016-03-07 15:36       ` François Beaufort
  2016-03-07 15:54         ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 9+ messages in thread
From: François Beaufort @ 2016-03-07 15:36 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

(gentle ping)

On Thu, Mar 3, 2016 at 10:46 AM, François Beaufort
<beaufort.francois@gmail.com> wrote:
> Since I'm expecting a response and device gets disconnected, I should
> get a write error don't you think?
>
> On Wed, Mar 2, 2016 at 4:19 PM, François Beaufort
> <beaufort.francois@gmail.com> wrote:
>> It does:
>>
>> [DFU_Test:/service000c/char000d]# write 01 04
>> Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
>> [CHG] Device F1:6F:DE:EC:F1:D6 Connected: no
>> [CHG] Device F1:6F:DE:EC:F1:D6 Connected: yes
>> [CHG] Device F1:6F:DE:EC:F1:D6 Name: DfuTarg
>> [CHG] Device F1:6F:DE:EC:F1:D6 Alias: DfuTarg
>>
>> On Wed, Mar 2, 2016 at 2:31 PM, Luiz Augusto von Dentz
>> <luiz.dentz@gmail.com> wrote:
>>> Hi François,
>>>
>>> On Wed, Mar 2, 2016 at 9:31 AM, François Beaufort
>>> <beaufort.francois@gmail.com> wrote:
>>>> When writing to a characteristic and that a disconnection happens
>>>> before getting a write (error) response, BlueZ should inform that
>>>> write operation failed.
>>>> See my real example logs below:
>>>>
>>>> [DFU_Test:/service000c/char000d]# write 01 04
>>>> Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
>>>>
>>>>
>>>>
>>>> < ACL Data TX: Handle 32 flags 0x00 dlen 9
>>>>                                                    [hci0] 5.066808
>>>>       ATT: Write Request (0x12) len 4
>>>>         Handle: 0x000e
>>>>           Data: 0104
>>>>> HCI Event: Number of Completed Packets (0x13) plen 5                                                                    [hci0] 5.106370
>>>>         Num handles: 1
>>>>         Handle: 32
>>>>         Count: 1
>>>>> HCI Event: Vendor (0xff) plen 7                                                                                         [hci0] 5.579396
>>>>         82 12 95 40 10 36 59                             ...@.6Y
>>>>> HCI Event: Disconnect Complete (0x05) plen 4                                                                            [hci0] 5.580376
>>>>         Status: Success (0x00)
>>>>         Handle: 32
>>>>         Reason: Connection Timeout (0x08)
>>>> @ Device Disconnected: F1:6F:DE:EC:F1:D6 (2) reason 1
>>>
>>> Interesting, does bluetoothctl print anything after this?
>>>
>>> --
>>> Luiz Augusto von Dentz

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-07 15:36       ` François Beaufort
@ 2016-03-07 15:54         ` Luiz Augusto von Dentz
  2016-03-09 10:53           ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2016-03-07 15:54 UTC (permalink / raw)
  To: François Beaufort; +Cc: BlueZ development

Hi François,

On Mon, Mar 7, 2016 at 5:36 PM, François Beaufort
<beaufort.francois@gmail.com> wrote:
> (gentle ping)
>
> On Thu, Mar 3, 2016 at 10:46 AM, François Beaufort
> <beaufort.francois@gmail.com> wrote:
>> Since I'm expecting a response and device gets disconnected, I should
>> get a write error don't you think?

Yes, it should probably return and error so the client is not left
hanging. I will investigate how this can be fixed.

-- 
Luiz Augusto von Dentz

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-07 15:54         ` Luiz Augusto von Dentz
@ 2016-03-09 10:53           ` Luiz Augusto von Dentz
  2016-03-09 12:17             ` François Beaufort
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2016-03-09 10:53 UTC (permalink / raw)
  To: François Beaufort; +Cc: BlueZ development

Hi François,

On Mon, Mar 7, 2016 at 5:54 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi François,
>
> On Mon, Mar 7, 2016 at 5:36 PM, François Beaufort
> <beaufort.francois@gmail.com> wrote:
>> (gentle ping)
>>
>> On Thu, Mar 3, 2016 at 10:46 AM, François Beaufort
>> <beaufort.francois@gmail.com> wrote:
>>> Since I'm expecting a response and device gets disconnected, I should
>>> get a write error don't you think?
>
> Yes, it should probably return and error so the client is not left
> hanging. I will investigate how this can be fixed.

This should be fixed upstream, it will be part of 5.38 which should be
coming out soon.

-- 
Luiz Augusto von Dentz

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-09 10:53           ` Luiz Augusto von Dentz
@ 2016-03-09 12:17             ` François Beaufort
  2016-03-10  9:27               ` François Beaufort
  0 siblings, 1 reply; 9+ messages in thread
From: François Beaufort @ 2016-03-09 12:17 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

Thank you so much Luiz,
I'm going to test this tomorrow.

In the mean time, which patches should be applied now if we want to
fix this in Chrome OS BlueZ?

On Wed, Mar 9, 2016 at 11:53 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi François,
>
> On Mon, Mar 7, 2016 at 5:54 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi François,
>>
>> On Mon, Mar 7, 2016 at 5:36 PM, François Beaufort
>> <beaufort.francois@gmail.com> wrote:
>>> (gentle ping)
>>>
>>> On Thu, Mar 3, 2016 at 10:46 AM, François Beaufort
>>> <beaufort.francois@gmail.com> wrote:
>>>> Since I'm expecting a response and device gets disconnected, I should
>>>> get a write error don't you think?
>>
>> Yes, it should probably return and error so the client is not left
>> hanging. I will investigate how this can be fixed.
>
> This should be fixed upstream, it will be part of 5.38 which should be
> coming out soon.
>
> --
> Luiz Augusto von Dentz

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

* Re: Write should return error if device is disconnected while expecting a response
  2016-03-09 12:17             ` François Beaufort
@ 2016-03-10  9:27               ` François Beaufort
  0 siblings, 0 replies; 9+ messages in thread
From: François Beaufort @ 2016-03-10  9:27 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

And I've just tried with latest trunk and it works perfectly!
Thank you Luiz!


[DFU_Test:/service000c/char000d]# write 01 04
Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d
[CHG] Device F1:6F:DE:EC:F1:D6 Connected: no
Failed to write: org.bluez.Error.Failed

On Wed, Mar 9, 2016 at 1:17 PM, François Beaufort
<beaufort.francois@gmail.com> wrote:
> Thank you so much Luiz,
> I'm going to test this tomorrow.
>
> In the mean time, which patches should be applied now if we want to
> fix this in Chrome OS BlueZ?
>
> On Wed, Mar 9, 2016 at 11:53 AM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi François,
>>
>> On Mon, Mar 7, 2016 at 5:54 PM, Luiz Augusto von Dentz
>> <luiz.dentz@gmail.com> wrote:
>>> Hi François,
>>>
>>> On Mon, Mar 7, 2016 at 5:36 PM, François Beaufort
>>> <beaufort.francois@gmail.com> wrote:
>>>> (gentle ping)
>>>>
>>>> On Thu, Mar 3, 2016 at 10:46 AM, François Beaufort
>>>> <beaufort.francois@gmail.com> wrote:
>>>>> Since I'm expecting a response and device gets disconnected, I should
>>>>> get a write error don't you think?
>>>
>>> Yes, it should probably return and error so the client is not left
>>> hanging. I will investigate how this can be fixed.
>>
>> This should be fixed upstream, it will be part of 5.38 which should be
>> coming out soon.
>>
>> --
>> Luiz Augusto von Dentz

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

end of thread, other threads:[~2016-03-10  9:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-02  7:31 Write should return error if device is disconnected while expecting a response François Beaufort
2016-03-02 13:31 ` Luiz Augusto von Dentz
2016-03-02 15:19   ` François Beaufort
2016-03-03  9:46     ` François Beaufort
2016-03-07 15:36       ` François Beaufort
2016-03-07 15:54         ` Luiz Augusto von Dentz
2016-03-09 10:53           ` Luiz Augusto von Dentz
2016-03-09 12:17             ` François Beaufort
2016-03-10  9:27               ` François Beaufort

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.