Linux bluetooth development
 help / color / mirror / Atom feed
* Re: [PATCH] lib: Use bigger IMTU when connecting SDP
From: simon @ 2014-01-19 19:45 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, David Herrmann, Frank Praznik
In-Reply-To: <1390153036-10030-1-git-send-email-szymon.janc@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

> Sony Dualshock 4 controller is ignoring L2CAP MTU while sending SDP
> response. This results in data being dropped and no SDP response is
> received (so no input device was created and HID connection was
> refused). Workaround this by using large IMTU for SDP.

I tried with this and your earlier DS4 patch, on top of a Fedora 20 Live
CD, and unfortunately it does not work for me. I still get the situation
where the DS initiates a connection and then turns off immediately.

I get the log messages
--
Jan 19 14:01:14 localhost systemd: Reached target Bluetooth.
Jan 19 14:01:14 localhost bluetoothd[1803]: Refusing input device connect:
No such file or directory (2)
Jan 19 14:01:14 localhost bluetoothd[1803]: Refusing connection from
1C:66:6D:07:C3:E0: unknown device
--

See log files:
pair_ds4_fedora.txt
connect_ds4_fedora.txt

There is also a problem when the pairing is initiated from the PC side,
seems that the resultant link key is not accepted on connection.

See:
pair_fedora_ds4_2.txt
connect_ds4_fedora_2.txt

I note that the cache file for the DS4's mac picks up some details on a
SDP browse, but not a complete record. This is on an older machine, so BT
chipset might be a factor.

Anything I can try?
Simon

[-- Attachment #2: pair_ds4_fedora.txt --]
[-- Type: text/plain, Size: 10725 bytes --]

HCI sniffer - Bluetooth packet analyzer ver 5.13
device: hci0 snap_len: 1500 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
    bdaddr 1C:66:6D:07:C3:E0 class 0x002508 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 1C:66:6D:07:C3:E0 role 0x00
    Role: Master
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr 1C:66:6D:07:C3:E0 role 0x00
    Role: Master
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 41 bdaddr 1C:66:6D:07:C3:E0 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 41
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
    bdaddr 1C:66:6D:07:C3:E0 mode 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 0
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 41 slots 5
> HCI Event: Command Status (0x0f) plen 4
    Unknown (0x00|0x0000) status 0x00 ncmd 1
< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
    handle 41 ptype 0xcc18
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Command Status (0x0f) plen 4
    Change Connection Packet Type (0x01|0x000f) status 0x00 ncmd 1
> HCI Event: Connection Packet Type Changed (0x1d) plen 5
    status 0x00 handle 41 ptype 0xcc18
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 41
    Features: 0xff 0xfe 0x0d 0xfe 0x98 0x7f 0x79 0x87
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 1C:66:6D:07:C3:E0 mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 0
      Connection pending - No futher information available
< ACL data: handle 41 flags 0x02 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x0000
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 672 
< ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> ACL data: handle 41 flags 0x02 dlen 24
    L2CAP(d): cid 0x0040 len 20 [psm 1]
        SDP SSA Req: tid 0x1 len 0xf
          pat uuid-16 0x0100 (L2CAP)
          max 2048
          aid(s) 0x0000 - 0xffff
          cont 00
< ACL data: handle 41 flags 0x02 dlen 192
< ACL data: handle 41 flags 0x01 dlen 192
< ACL data: handle 41 flags 0x01 dlen 93
    L2CAP(d): cid 0x0040 len 473 [psm 1]
        SDP SSA Rsp: tid 0x1 len 0x1d4
          count 465
          record #0
              aid 0x0000 (SrvRecHndl)
                 uint 0x10001
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1800 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x1 uint 0x8 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x000a (DocURL)
                 url "http://www.bluez.org/"
              aid 0x000b (ClientExeURL)
                 url "http://www.bluez.org/"
              aid 0x000c (IconURL)
                 url "http://www.bluez.org/"
              aid 0x0100 (SrvName)
                 str "Generic Access Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #1
              aid 0x0000 (SrvRecHndl)
                 uint 0x10002
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1801 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x10 uint 0x10 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0100 (SrvName)
                 str "Generic Attribute Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #2
              aid 0x0000 (SrvRecHndl)
                 uint 0x10003
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110e (AVRemote) uuid-16 0x110f (AVRemCt) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x105 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP CT"
              aid 0x0311 (SuppFeatures)
                 uint 0x4f
          record #3
              aid 0x0000 (SrvRecHndl)
                 uint 0x10004
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110c (AVRemTarget) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x104 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP TG"
              aid 0x0311 (SuppFeatures)
                 uint 0x5f
          cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 2
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 1C:66:6D:07:C3:E0 name 'Wireless Controller'
> HCI Event: Link Key Request (0x17) plen 6
    bdaddr 1C:66:6D:07:C3:E0
< HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6
    bdaddr 1C:66:6D:07:C3:E0
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Negative Reply (0x01|0x000c) ncmd 1
    status 0x00 bdaddr 1C:66:6D:07:C3:E0
> HCI Event: PIN Code Request (0x16) plen 6
    bdaddr 1C:66:6D:07:C3:E0
< HCI Command: PIN Code Request Reply (0x01|0x000d) plen 23
    bdaddr 1C:66:6D:07:C3:E0 len 4 pin '0000'
> HCI Event: Command Complete (0x0e) plen 10
    PIN Code Request Reply (0x01|0x000d) ncmd 1
    status 0x00 bdaddr 1C:66:6D:07:C3:E0
> HCI Event: Link Key Notification (0x18) plen 23
    bdaddr 1C:66:6D:07:C3:E0 key BC41AFE608E8AD39806F772FCD37F5AD type 0
    Type: Combination Key
> HCI Event: Encrypt Change (0x08) plen 4
    status 0x00 handle 41 encrypt 0x01
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 17 scid 0x0041
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0041 result 0 status 0
      Connection successful
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 672 
< ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
      MTU 672 
> ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
< ACL data: handle 41 flags 0x02 dlen 5
    L2CAP(d): cid 0x0041 len 1 [psm 17]
      HIDP: Control: Virtual cable unplug
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0041 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 19 scid 0x0042
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 1 status 2
      Connection pending - Authorization pending
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 3 status 0
      Connection refused - security block
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 5
    L2CAP(d): cid 0x0040 len 1 [psm 17]
      HIDP: Handshake: Unsupported request
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 41 reason 0x13
    Reason: Remote User Terminated Connection
< HCI Command: Create Connection (0x01|0x0005) plen 13
    bdaddr 1C:66:6D:07:C3:E0 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Command Status (0x0f) plen 4
    Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
    status 0x04 handle 0 bdaddr 1C:66:6D:07:C3:E0 type ACL encrypt 0x00
    Error: Page Timeout

[-- Attachment #3: connect_ds4_fedora.txt --]
[-- Type: text/plain, Size: 9876 bytes --]

HCI sniffer - Bluetooth packet analyzer ver 5.13
device: hci0 snap_len: 1500 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
    bdaddr 1C:66:6D:07:C3:E0 class 0x002508 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 1C:66:6D:07:C3:E0 role 0x00
    Role: Master
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr 1C:66:6D:07:C3:E0 role 0x00
    Role: Master
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 41 bdaddr 1C:66:6D:07:C3:E0 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 41
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
    bdaddr 1C:66:6D:07:C3:E0 mode 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 0
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 41 slots 5
> HCI Event: Command Status (0x0f) plen 4
    Unknown (0x00|0x0000) status 0x00 ncmd 1
< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
    handle 41 ptype 0xcc18
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Command Status (0x0f) plen 4
    Change Connection Packet Type (0x01|0x000f) status 0x00 ncmd 1
> HCI Event: Connection Packet Type Changed (0x1d) plen 5
    status 0x00 handle 41 ptype 0xcc18
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 41
    Features: 0xff 0xfe 0x0d 0xfe 0x98 0x7f 0x79 0x87
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 1C:66:6D:07:C3:E0 mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 0
      Connection pending - No futher information available
< ACL data: handle 41 flags 0x02 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x0000
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 672 
< ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 24
    L2CAP(d): cid 0x0040 len 20 [psm 1]
        SDP SSA Req: tid 0x1 len 0xf
          pat uuid-16 0x0100 (L2CAP)
          max 2048
          aid(s) 0x0000 - 0xffff
          cont 00
< ACL data: handle 41 flags 0x02 dlen 192
< ACL data: handle 41 flags 0x01 dlen 192
< ACL data: handle 41 flags 0x01 dlen 93
    L2CAP(d): cid 0x0040 len 473 [psm 1]
        SDP SSA Rsp: tid 0x1 len 0x1d4
          count 465
          record #0
              aid 0x0000 (SrvRecHndl)
                 uint 0x10001
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1800 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x1 uint 0x8 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x000a (DocURL)
                 url "http://www.bluez.org/"
              aid 0x000b (ClientExeURL)
                 url "http://www.bluez.org/"
              aid 0x000c (IconURL)
                 url "http://www.bluez.org/"
              aid 0x0100 (SrvName)
                 str "Generic Access Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #1
              aid 0x0000 (SrvRecHndl)
                 uint 0x10002
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1801 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x10 uint 0x10 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0100 (SrvName)
                 str "Generic Attribute Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #2
              aid 0x0000 (SrvRecHndl)
                 uint 0x10003
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110e (AVRemote) uuid-16 0x110f (AVRemCt) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x105 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP CT"
              aid 0x0311 (SuppFeatures)
                 uint 0x4f
          record #3
              aid 0x0000 (SrvRecHndl)
                 uint 0x10004
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110c (AVRemTarget) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x104 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP TG"
              aid 0x0311 (SuppFeatures)
                 uint 0x5f
          cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 2
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 1C:66:6D:07:C3:E0 name 'Wireless Controller'
> HCI Event: Link Key Request (0x17) plen 6
    bdaddr 1C:66:6D:07:C3:E0
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
    bdaddr 1C:66:6D:07:C3:E0 key BC41AFE608E8AD39806F772FCD37F5AD
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Reply (0x01|0x000b) ncmd 1
    status 0x00 bdaddr 1C:66:6D:07:C3:E0
> HCI Event: Encrypt Change (0x08) plen 4
    status 0x00 handle 41 encrypt 0x01
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 17 scid 0x0041
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0041 result 0 status 0
      Connection successful
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 672 
< ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
      MTU 672 
> ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
< ACL data: handle 41 flags 0x02 dlen 5
    L2CAP(d): cid 0x0041 len 1 [psm 17]
      HIDP: Control: Virtual cable unplug
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0041 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 19 scid 0x0042
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 1 status 2
      Connection pending - Authorization pending
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 3 status 0
      Connection refused - security block
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 5
    L2CAP(d): cid 0x0040 len 1 [psm 17]
      HIDP: Handshake: Unsupported request
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 41 reason 0x13
    Reason: Remote User Terminated Connection

[-- Attachment #4: connect_ds4_fedora_2.txt --]
[-- Type: text/plain, Size: 7888 bytes --]

HCI sniffer - Bluetooth packet analyzer ver 5.13
device: hci0 snap_len: 1500 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
    bdaddr 1C:66:6D:07:C3:E0 class 0x002508 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 1C:66:6D:07:C3:E0 role 0x00
    Role: Master
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr 1C:66:6D:07:C3:E0 role 0x00
    Role: Master
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 41 bdaddr 1C:66:6D:07:C3:E0 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 41
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
    bdaddr 1C:66:6D:07:C3:E0 mode 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 0
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 41 slots 5
> HCI Event: Command Status (0x0f) plen 4
    Unknown (0x00|0x0000) status 0x00 ncmd 1
< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
    handle 41 ptype 0xcc18
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Command Status (0x0f) plen 4
    Change Connection Packet Type (0x01|0x000f) status 0x00 ncmd 1
> HCI Event: Connection Packet Type Changed (0x1d) plen 5
    status 0x00 handle 41 ptype 0xcc18
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 41
    Features: 0xff 0xfe 0x0d 0xfe 0x98 0x7f 0x79 0x87
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 1C:66:6D:07:C3:E0 mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 0
      Connection pending - No futher information available
< ACL data: handle 41 flags 0x02 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x0000
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 672 
< ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> ACL data: handle 41 flags 0x02 dlen 24
    L2CAP(d): cid 0x0040 len 20 [psm 1]
        SDP SSA Req: tid 0x1 len 0xf
          pat uuid-16 0x0100 (L2CAP)
          max 2048
          aid(s) 0x0000 - 0xffff
          cont 00
< ACL data: handle 41 flags 0x02 dlen 192
< ACL data: handle 41 flags 0x01 dlen 192
< ACL data: handle 41 flags 0x01 dlen 93
    L2CAP(d): cid 0x0040 len 473 [psm 1]
        SDP SSA Rsp: tid 0x1 len 0x1d4
          count 465
          record #0
              aid 0x0000 (SrvRecHndl)
                 uint 0x10001
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1800 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x1 uint 0x8 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x000a (DocURL)
                 url "http://www.bluez.org/"
              aid 0x000b (ClientExeURL)
                 url "http://www.bluez.org/"
              aid 0x000c (IconURL)
                 url "http://www.bluez.org/"
              aid 0x0100 (SrvName)
                 str "Generic Access Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #1
              aid 0x0000 (SrvRecHndl)
                 uint 0x10002
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1801 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x10 uint 0x10 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0100 (SrvName)
                 str "Generic Attribute Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #2
              aid 0x0000 (SrvRecHndl)
                 uint 0x10003
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110e (AVRemote) uuid-16 0x110f (AVRemCt) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x105 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP CT"
              aid 0x0311 (SuppFeatures)
                 uint 0x4f
          record #3
              aid 0x0000 (SrvRecHndl)
                 uint 0x10004
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110c (AVRemTarget) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x104 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP TG"
              aid 0x0311 (SuppFeatures)
                 uint 0x5f
          cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 2
> ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 41 packets 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 1C:66:6D:07:C3:E0 name 'Wireless Controller'
> HCI Event: Link Key Request (0x17) plen 6
    bdaddr 1C:66:6D:07:C3:E0
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
    bdaddr 1C:66:6D:07:C3:E0 key E7A1FCE56F3CDF257687D829E953C33C
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Reply (0x01|0x000b) ncmd 1
    status 0x00 bdaddr 1C:66:6D:07:C3:E0
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 41 reason 0x05
    Reason: Authentication Failure
< HCI Command: Inquiry (0x01|0x0001) plen 5
    lap 0x9e8b33 len 8 num 0
> HCI Event: Command Status (0x0f) plen 4
    Inquiry (0x01|0x0001) status 0x00 ncmd 1

[-- Attachment #5: pair_fedora_ds4_2.txt --]
[-- Type: text/plain, Size: 3874 bytes --]

HCI sniffer - Bluetooth packet analyzer ver 5.13
device: hci0 snap_len: 1500 filter: 0xffffffff
> HCI Event: Inquiry Complete (0x01) plen 1
    status 0x00
< HCI Command: Create Connection (0x01|0x0005) plen 13
    bdaddr 1C:66:6D:07:C3:E0 ptype 0xcc18 rswitch 0x01 clkoffset 0x514b (valid)
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 
> HCI Event: Command Status (0x0f) plen 4
    Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 41 bdaddr 1C:66:6D:07:C3:E0 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 41
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 0
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 41 slots 5
> HCI Event: Command Status (0x0f) plen 4
    Unknown (0x00|0x0000) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 41
    Features: 0xff 0xfe 0x0d 0xfe 0x98 0x7f 0x79 0x87
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 1C:66:6D:07:C3:E0 mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 1C:66:6D:07:C3:E0 name 'Wireless Controller'
< HCI Command: Authentication Requested (0x01|0x0011) plen 2
    handle 41
> HCI Event: Command Status (0x0f) plen 4
    Authentication Requested (0x01|0x0011) status 0x00 ncmd 1
> HCI Event: Link Key Request (0x17) plen 6
    bdaddr 1C:66:6D:07:C3:E0
< HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6
    bdaddr 1C:66:6D:07:C3:E0
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Negative Reply (0x01|0x000c) ncmd 1
    status 0x00 bdaddr 1C:66:6D:07:C3:E0
> HCI Event: PIN Code Request (0x16) plen 6
    bdaddr 1C:66:6D:07:C3:E0
< HCI Command: PIN Code Request Reply (0x01|0x000d) plen 23
    bdaddr 1C:66:6D:07:C3:E0 len 4 pin '0000'
> HCI Event: Command Complete (0x0e) plen 10
    PIN Code Request Reply (0x01|0x000d) ncmd 1
    status 0x00 bdaddr 1C:66:6D:07:C3:E0
> HCI Event: Link Key Notification (0x18) plen 23
    bdaddr 1C:66:6D:07:C3:E0 key E7A1FCE56F3CDF257687D829E953C33C type 0
    Type: Combination Key
> HCI Event: Auth Complete (0x06) plen 3
    status 0x00 handle 41
< HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 41 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 41 reason 0x16
    Reason: Connection Terminated by Local Host
< HCI Command: Inquiry (0x01|0x0001) plen 5
    lap 0x9e8b33 len 8 num 0
> HCI Event: Command Status (0x0f) plen 4
    Inquiry (0x01|0x0001) status 0x00 ncmd 1
> HCI Event: Inquiry Result (0x02) plen 15
    bdaddr 1C:66:6D:07:C3:E0 mode 1 clkoffset 0x514c class 0x002508
> HCI Event: Inquiry Complete (0x01) plen 1
    status 0x00
< HCI Command: Inquiry (0x01|0x0001) plen 5
    lap 0x9e8b33 len 8 num 0
> HCI Event: Command Status (0x0f) plen 4
    Inquiry (0x01|0x0001) status 0x00 ncmd 1
> HCI Event: Inquiry Result (0x02) plen 15
    bdaddr 1C:66:6D:07:C3:E0 mode 1 clkoffset 0x514c class 0x002508
> HCI Event: Inquiry Complete (0x01) plen 1
    status 0x00
< HCI Command: Inquiry (0x01|0x0001) plen 5
    lap 0x9e8b33 len 8 num 0
> HCI Event: Command Status (0x0f) plen 4
    Inquiry (0x01|0x0001) status 0x00 ncmd 1
> HCI Event: Inquiry Result (0x02) plen 15
    bdaddr 1C:66:6D:07:C3:E0 mode 1 clkoffset 0x514c class 0x002508
> HCI Event: Inquiry Complete (0x01) plen 1
    status 0x00
< HCI Command: Inquiry (0x01|0x0001) plen 5
    lap 0x9e8b33 len 8 num 0
> HCI Event: Command Status (0x0f) plen 4
    Inquiry (0x01|0x0001) status 0x00 ncmd 1

[-- Attachment #6: info_ds4_fedora.txt --]
[-- Type: text/plain, Size: 156 bytes --]

[LinkKey]
Key=0x67C8E811F0C7CF297C6900ABA9A73BA7
Type=0
PINLength=4

[General]
Name=
Class=0x002508
SupportedTechnologies=BR/EDR
Trusted=false
Blocked=false

[-- Attachment #7: cache_after_sdp_browse.txt --]
[-- Type: text/plain, Size: 34 bytes --]

[General]
Name=Wireless Controller

^ permalink raw reply

* [PATCH] lib: Use bigger IMTU when connecting SDP
From: Szymon Janc @ 2014-01-19 17:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Wood, Frank Praznik, Szymon Janc

Sony Dualshock 4 controller is ignoring L2CAP MTU while sending SDP
response. This results in data being dropped and no SDP response is
received (so no input device was created and HID connection was
refused). Workaround this by using large IMTU for SDP.

< ACL Data TX: Handle 12 flags 0x00 dlen 12
      L2CAP: Configure Request (0x04) ident 3 len 4
        Destination CID: 64
        Flags: 0x0000
> ACL Data RX: Handle 12 flags 0x02 dlen 18
      L2CAP: Configure Response (0x05) ident 3 len 10
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
        Option: Maximum Transmission Unit (0x01)
          MTU: 672
> ACL Data RX: Handle 12 flags 0x02 dlen 16
      L2CAP: Configure Request (0x04) ident 1 len 8
        Destination CID: 64
        Flags: 0x0000
        Option: Maximum Transmission Unit (0x01)
          MTU: 672
< ACL Data TX: Handle 12 flags 0x00 dlen 18
      L2CAP: Configure Response (0x05) ident 1 len 10
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
        Option: Maximum Transmission Unit (0x01)
          MTU: 672
< ACL Data TX: Handle 12 flags 0x00 dlen 24
      Channel: 64 len 20 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Request (0x06) tid 0 len 15
        Search pattern: [len 5]
          Sequence (6) with 3 bytes [8 extra bits] len 5
            UUID (3) with 2 bytes [0 extra bits] len 3
              L2CAP (0x0100)
        Max record count: 65535
        Attribute list: [len 7]
          Sequence (6) with 5 bytes [8 extra bits] len 7
            Unsigned Integer (1) with 4 bytes [0 extra bits] len 5
              0x0000ffff
        Continuation state: 0
> HCI Event: Remote Name Req Complete (0x07) plen 255
        Status: Success (0x00)
        Address: 1C:66:6D:18:F0:0A (Hon Hai Precision Ind.Co.Ltd)
        Name: Wireless Controller
> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 12
        Count: 2
@ Device Connected: 1C:66:6D:18:F0:0A (0) flags 0x0000
        14 09 57 69 72 65 6c 65 73 73 20 43 6f 6e 74 72  ..Wireless Contr
        6f 6c 6c 65 72                                   oller
> ACL Data RX: Handle 12 flags 0x02 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 83
> ACL Data RX: Handle 12 flags 0x01 dlen 48
      Channel: 64 len 708 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 0 len 703
---
 lib/sdp.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/sdp.c b/lib/sdp.c
index 886e7cf..3b5f8f8 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -4644,6 +4644,22 @@ static int sdp_connect_local(sdp_session_t *session)
 	return connect(session->sock, (struct sockaddr *) &sa, sizeof(sa));
 }
 
+static void set_l2cap_imtu(int sock, uint16_t imtu)
+{
+	struct l2cap_options l2o;
+	socklen_t len;
+
+	memset(&l2o, 0, sizeof(l2o));
+	len = sizeof(l2o);
+
+	if (getsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &len) < 0)
+		return;
+
+	l2o.imtu = imtu;
+
+	setsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, &l2o, sizeof(l2o));
+}
+
 static int sdp_connect_l2cap(const bdaddr_t *src,
 		const bdaddr_t *dst, sdp_session_t *session)
 {
@@ -4678,6 +4694,8 @@ static int sdp_connect_l2cap(const bdaddr_t *src,
 		setsockopt(sk, SOL_SOCKET, SO_LINGER, &l, sizeof(l));
 	}
 
+	set_l2cap_imtu(sk, SDP_RSP_BUFFER_SIZE);
+
 	sa.l2_psm = htobs(SDP_PSM);
 	sa.l2_bdaddr = *dst;
 
-- 
1.8.5.3


^ permalink raw reply related

* Re: [PATCH 8/9] android/hal-audio: Read fd from Output Stream response
From: Lukasz Rymanowski @ 2014-01-19 10:50 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Szymon Janc, Andrzej Kaczmarek, linux-bluetooth@vger.kernel.org
In-Reply-To: <CABBYNZ+e7LL8Ok1pFTqEdtDJGNDZoZChA0hbB1v-qgPnr6pXwQ@mail.gmail.com>

Hi Luiz,

On Fri, Jan 17, 2014 at 8:57 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Szymon,
>
> On Fri, Jan 17, 2014 at 8:13 PM, Szymon Janc <szymon.janc@gmail.com> wrote:
>> Hi Andrzej,
>>
>> On Friday 17 January 2014 16:40:12 Andrzej Kaczmarek wrote:
>>> ---
>>>  android/hal-audio.c | 11 +++++++----
>>>  1 file changed, 7 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/android/hal-audio.c b/android/hal-audio.c
>>> index f2cb12a..d8438f7 100644
>>> --- a/android/hal-audio.c
>>> +++ b/android/hal-audio.c
>>> @@ -575,7 +575,7 @@ static int ipc_close_cmd(uint8_t endpoint_id)
>>>       return result;
>>>  }
>>>
>>> -static int ipc_open_stream_cmd(uint8_t endpoint_id, uint16_t *mtu,
>>> +static int ipc_open_stream_cmd(uint8_t endpoint_id, uint16_t *mtu, int *fd,
>>> struct audio_preset **caps)
>>>  {
>>>       char buf[BLUEZ_AUDIO_MTU];
>>> @@ -593,7 +593,7 @@ static int ipc_open_stream_cmd(uint8_t endpoint_id,
>>> uint16_t *mtu, cmd.id = endpoint_id;
>>>
>>>       result = audio_ipc_cmd(AUDIO_SERVICE_ID, AUDIO_OP_OPEN_STREAM,
>>> -                             sizeof(cmd), &cmd, &rsp_len, rsp, NULL);
>>> +                             sizeof(cmd), &cmd, &rsp_len, rsp, fd);
>>>
>>>       if (result == AUDIO_STATUS_SUCCESS) {
>>>               size_t buf_len = sizeof(struct audio_preset) +
>>> @@ -990,6 +990,7 @@ static int audio_open_output_stream(struct
>>> audio_hw_device *dev, struct audio_preset *preset;
>>>       const struct audio_codec *codec;
>>>       uint16_t mtu;
>>> +     int fd;
>>>
>>>       out = calloc(1, sizeof(struct a2dp_stream_out));
>>>       if (!out)
>>> @@ -1017,13 +1018,15 @@ static int audio_open_output_stream(struct
>>> audio_hw_device *dev, /* TODO: for now we always use endpoint 0 */
>>>       out->ep = &audio_endpoints[0];
>>>
>>> -     if (ipc_open_stream_cmd(out->ep->id, &mtu, &preset) !=
>>> +     if (ipc_open_stream_cmd(out->ep->id, &mtu, &fd, &preset) !=
>>>                       AUDIO_STATUS_SUCCESS)
>>>               goto fail;
>>>
>>> -     if (!preset)
>>> +     if (!preset || fd < 0)
>>>               goto fail;
>>
>> For sanity, code under fail label should be updated to handle that either
>> preset or fd might be valid here.
>>
>>>
>>> +     out->ep->fd = fd;
>>> +
>>
>> I might be missing something but fd is never closed. Should this be done in
>> audio_close_output_stream() ?
>
> Yep, the fd should be closed every time we suspend as we will get
> another fd on open so we will end up with duplicated fds.
>
Why?
Stream can be suspended in two ways.
1) AudioFlinger can do it with out_standby() and to resume it it just
use just out_write().
2) Some other part of Android eg Phone app with out_set_parameters()
and to resume it it will use same function. Open is called if stream
is closed. Probably Szymon idea is good here.

\Lukasz
>
>
> Luiz Augusto von Dentz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state
From: Luiz Augusto von Dentz @ 2014-01-18 22:28 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org
In-Reply-To: <1389965587-20066-1-git-send-email-luiz.dentz@gmail.com>

Hi,

On Fri, Jan 17, 2014 at 3:33 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> ---
>  android/hal-msg.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index ceaa3b2..cfb5460 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -564,6 +564,10 @@ struct hal_ev_a2dp_conn_state {
>         uint8_t bdaddr[6];
>  } __attribute__((packed));
>
> +#define HAL_AUDIO_SUSPEND                      0x00
> +#define HAL_AUDIO_STOPPED                      0x01
> +#define HAL_AUDIO_STARTED                      0x02
> +
>  #define HAL_EV_A2DP_AUDIO_STATE                        0x82
>  struct hal_ev_a2dp_audio_state {
>         uint8_t state;
> --
> 1.8.4.2

Pushed.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH] Bluetooth: Remove useless l2cap_seq_list_remove function
From: Marcel Holtmann @ 2014-01-18 20:13 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1390073579-19074-1-git-send-email-johan.hedberg@gmail.com>

Hi Johan,

> The only user of l2cap_seq_list_remove() was l2cap_seq_list_pop() which
> only removes the head, meaning only the "else if (seq_list->head ==
> seq)" branch was ever being used. This patch moves the code from this
> branch straight into l2cap_seq_list_pop() and removes the (now useless)
> l2cap_seq_list_remove().
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 40 ++++++++--------------------------------
> 1 file changed, 8 insertions(+), 32 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply

* [PATCH] Bluetooth: Remove useless l2cap_seq_list_remove function
From: johan.hedberg @ 2014-01-18 19:32 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

The only user of l2cap_seq_list_remove() was l2cap_seq_list_pop() which
only removes the head, meaning only the "else if (seq_list->head ==
seq)" branch was ever being used. This patch moves the code from this
branch straight into l2cap_seq_list_pop() and removes the (now useless)
l2cap_seq_list_remove().

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/l2cap_core.c | 40 ++++++++--------------------------------
 1 file changed, 8 insertions(+), 32 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index cd534599fbfa..138394ad3e51 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -330,44 +330,20 @@ static inline bool l2cap_seq_list_contains(struct l2cap_seq_list *seq_list,
 	return seq_list->list[seq & seq_list->mask] != L2CAP_SEQ_LIST_CLEAR;
 }
 
-static u16 l2cap_seq_list_remove(struct l2cap_seq_list *seq_list, u16 seq)
+static inline u16 l2cap_seq_list_pop(struct l2cap_seq_list *seq_list)
 {
+	u16 seq = seq_list->head;
 	u16 mask = seq_list->mask;
 
-	if (seq_list->head == L2CAP_SEQ_LIST_CLEAR) {
-		/* In case someone tries to pop the head of an empty list */
-		return L2CAP_SEQ_LIST_CLEAR;
-	} else if (seq_list->head == seq) {
-		/* Head can be removed in constant time */
-		seq_list->head = seq_list->list[seq & mask];
-		seq_list->list[seq & mask] = L2CAP_SEQ_LIST_CLEAR;
-
-		if (seq_list->head == L2CAP_SEQ_LIST_TAIL) {
-			seq_list->head = L2CAP_SEQ_LIST_CLEAR;
-			seq_list->tail = L2CAP_SEQ_LIST_CLEAR;
-		}
-	} else {
-		/* Walk the list to find the sequence number */
-		u16 prev = seq_list->head;
-		while (seq_list->list[prev & mask] != seq) {
-			prev = seq_list->list[prev & mask];
-			if (prev == L2CAP_SEQ_LIST_TAIL)
-				return L2CAP_SEQ_LIST_CLEAR;
-		}
+	seq_list->head = seq_list->list[seq & mask];
+	seq_list->list[seq & mask] = L2CAP_SEQ_LIST_CLEAR;
 
-		/* Unlink the number from the list and clear it */
-		seq_list->list[prev & mask] = seq_list->list[seq & mask];
-		seq_list->list[seq & mask] = L2CAP_SEQ_LIST_CLEAR;
-		if (seq_list->tail == seq)
-			seq_list->tail = prev;
+	if (seq_list->head == L2CAP_SEQ_LIST_TAIL) {
+		seq_list->head = L2CAP_SEQ_LIST_CLEAR;
+		seq_list->tail = L2CAP_SEQ_LIST_CLEAR;
 	}
-	return seq;
-}
 
-static inline u16 l2cap_seq_list_pop(struct l2cap_seq_list *seq_list)
-{
-	/* Remove the head in constant time */
-	return l2cap_seq_list_remove(seq_list, seq_list->head);
+	return seq;
 }
 
 static void l2cap_seq_list_clear(struct l2cap_seq_list *seq_list)
-- 
1.8.4.2


^ permalink raw reply related

* Re: [PATCH 1/3] eir: Add support for parsing  DeviceID info
From: Johan Hedberg @ 2014-01-18 19:09 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1390057034-7983-1-git-send-email-szymon.janc@gmail.com>

Hi Szymon,

On Sat, Jan 18, 2014, Szymon Janc wrote:
> ---
>  src/eir.c | 10 ++++++++++
>  src/eir.h |  4 ++++
>  2 files changed, 14 insertions(+)

All three patches have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH BlueZ] android: Fix const to non-const issue on android-tester
From: Szymon Janc @ 2014-01-18 18:21 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1390056866-21560-1-git-send-email-anderson.lizardo@openbossa.org>

Hi Anderson,

On Saturday 18 January 2014 10:54:26 Anderson Lizardo wrote:
> According to definition from hardware/bluetooth.h, the "val" field does
> not have const modifier.
> 
> Fix clang errors like:
> 
> android/android-tester.c:760:14: error: initializing 'void *' with an
> expression of type 'const char (*)[18]' discards qualifiers
> [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

Applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH 3/3] input: Add DualShock 4 detection
From: Szymon Janc @ 2014-01-18 15:13 UTC (permalink / raw)
  To: David Herrmann; +Cc: linux-bluetooth@vger.kernel.org, Simon Wood, Frank Praznik
In-Reply-To: <CANq1E4Tm2na1zVCdeDK5ihS0fQKCpJ10P0a+pTVUmcURTqCV9A@mail.gmail.com>

Hi,

On Saturday 18 January 2014 16:05:26 David Herrmann wrote:
> Hi
> 
> @Simon and Frank:
> This patch might help fix your DS4 issues.
> 
> Cheers
> David

Just for clarification, this does not add DS4 support, just detection for it 
in input server. There is some problem with getting SDP records from DS4 by 
bluetoothd (works with sdptool) which prevents idev from being created.

I'm working on fixing this, but no ETA yet.

> 
> On Sat, Jan 18, 2014 at 3:57 PM, Szymon Janc <szymon.janc@gmail.com> wrote:
> > DS4 tries to connect right after pairing before SDP search completed
> > and no idev is present yet.
> > ---
> > 
> >  profiles/input/server.c | 16 +++++++++++-----
> >  1 file changed, 11 insertions(+), 5 deletions(-)
> > 
> > diff --git a/profiles/input/server.c b/profiles/input/server.c
> > index 3814eaf..21c589c 100644
> > --- a/profiles/input/server.c
> > +++ b/profiles/input/server.c
> > @@ -118,18 +118,24 @@ static void sixaxis_browse_sdp(const bdaddr_t *src,
> > const bdaddr_t *dst,> 
> >  static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
> >  {
> >  
> >         struct btd_device *device;
> > 
> > +       uint16_t vid, pid;
> > 
> >         device = btd_adapter_find_device(adapter_find(src), dst);
> >         if (!device)
> >         
> >                 return false;
> > 
> > -       if (btd_device_get_vendor(device) != 0x054c)
> > -               return false;
> > +       vid = btd_device_get_vendor(device);
> > +       pid = btd_device_get_product(device);
> > 
> > -       if (btd_device_get_product(device) != 0x0268)
> > -               return false;
> > +       /* DualShock 3 */
> > +       if (vid == 0x054c && pid == 0x0268)
> > +               return true;
> > +
> > +       /* DualShock 4 */
> > +       if (vid == 0x054c && pid == 0x05c4)
> > +               return true;
> > 
> > -       return true;
> > +       return false;
> > 
> >  }
> >  
> >  static void connect_event_cb(GIOChannel *chan, GError *err, gpointer
> >  data)
> > 
> > --
> > 1.8.5.3
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> > in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH 3/3] input: Add DualShock 4 detection
From: David Herrmann @ 2014-01-18 15:05 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org, Simon Wood, Frank Praznik
In-Reply-To: <1390057034-7983-3-git-send-email-szymon.janc@gmail.com>

Hi

@Simon and Frank:
This patch might help fix your DS4 issues.

Cheers
David

On Sat, Jan 18, 2014 at 3:57 PM, Szymon Janc <szymon.janc@gmail.com> wrote:
> DS4 tries to connect right after pairing before SDP search completed
> and no idev is present yet.
> ---
>  profiles/input/server.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/profiles/input/server.c b/profiles/input/server.c
> index 3814eaf..21c589c 100644
> --- a/profiles/input/server.c
> +++ b/profiles/input/server.c
> @@ -118,18 +118,24 @@ static void sixaxis_browse_sdp(const bdaddr_t *src, const bdaddr_t *dst,
>  static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
>  {
>         struct btd_device *device;
> +       uint16_t vid, pid;
>
>         device = btd_adapter_find_device(adapter_find(src), dst);
>         if (!device)
>                 return false;
>
> -       if (btd_device_get_vendor(device) != 0x054c)
> -               return false;
> +       vid = btd_device_get_vendor(device);
> +       pid = btd_device_get_product(device);
>
> -       if (btd_device_get_product(device) != 0x0268)
> -               return false;
> +       /* DualShock 3 */
> +       if (vid == 0x054c && pid == 0x0268)
> +               return true;
> +
> +       /* DualShock 4 */
> +       if (vid == 0x054c && pid == 0x05c4)
> +               return true;
>
> -       return true;
> +       return false;
>  }
>
>  static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
> --
> 1.8.5.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 3/3] input: Add DualShock 4 detection
From: Szymon Janc @ 2014-01-18 14:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1390057034-7983-1-git-send-email-szymon.janc@gmail.com>

DS4 tries to connect right after pairing before SDP search completed
and no idev is present yet.
---
 profiles/input/server.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/profiles/input/server.c b/profiles/input/server.c
index 3814eaf..21c589c 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -118,18 +118,24 @@ static void sixaxis_browse_sdp(const bdaddr_t *src, const bdaddr_t *dst,
 static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
 {
 	struct btd_device *device;
+	uint16_t vid, pid;
 
 	device = btd_adapter_find_device(adapter_find(src), dst);
 	if (!device)
 		return false;
 
-	if (btd_device_get_vendor(device) != 0x054c)
-		return false;
+	vid = btd_device_get_vendor(device);
+	pid = btd_device_get_product(device);
 
-	if (btd_device_get_product(device) != 0x0268)
-		return false;
+	/* DualShock 3 */
+	if (vid == 0x054c && pid == 0x0268)
+		return true;
+
+	/* DualShock 4 */
+	if (vid == 0x054c && pid == 0x05c4)
+		return true;
 
-	return true;
+	return false;
 }
 
 static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 2/3] adapter: Add support for setting DID info from EIR
From: Szymon Janc @ 2014-01-18 14:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1390057034-7983-1-git-send-email-szymon.janc@gmail.com>

---
 src/adapter.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index 230f3ce..c117508 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -4147,6 +4147,13 @@ static void update_found_devices(struct btd_adapter *adapter,
 	if (eir_data.class != 0)
 		device_set_class(dev, eir_data.class);
 
+	if (eir_data.did_source || eir_data.did_vendor ||
+			eir_data.did_product || eir_data.did_version)
+		btd_device_set_pnpid(dev, eir_data.did_source,
+							eir_data.did_vendor,
+							eir_data.did_product,
+							eir_data.did_version);
+
 	device_add_eir_uuids(dev, eir_data.services);
 
 	eir_data_free(&eir_data);
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 1/3] eir: Add support for parsing  DeviceID info
From: Szymon Janc @ 2014-01-18 14:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

---
 src/eir.c | 10 ++++++++++
 src/eir.h |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/src/eir.c b/src/eir.c
index 5f3f059..d85ac7e 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -223,6 +223,16 @@ void eir_parse(struct eir_data *eir, const uint8_t *eir_data, uint8_t eir_len)
 				break;
 			eir->randomizer = g_memdup(data, 16);
 			break;
+
+		case EIR_DEVICE_ID:
+			if (data_len < 8)
+				break;
+
+			eir->did_source = data[0] | (data[1] << 8);
+			eir->did_vendor = data[2] | (data[3] << 8);
+			eir->did_product = data[4] | (data[5] << 8);
+			eir->did_version = data[6] | (data[7] << 8);
+			break;
 		}
 
 		eir_data += field_len + 1;
diff --git a/src/eir.h b/src/eir.h
index 888f382..3fa1cb3 100644
--- a/src/eir.h
+++ b/src/eir.h
@@ -49,6 +49,10 @@ struct eir_data {
 	uint8_t *hash;
 	uint8_t *randomizer;
 	bdaddr_t addr;
+	uint16_t did_vendor;
+	uint16_t did_product;
+	uint16_t did_version;
+	uint16_t did_source;
 };
 
 void eir_data_free(struct eir_data *eir);
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH BlueZ] android: Fix const to non-const issue on android-tester
From: Anderson Lizardo @ 2014-01-18 14:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

According to definition from hardware/bluetooth.h, the "val" field does
not have const modifier.

Fix clang errors like:

android/android-tester.c:760:14: error: initializing 'void *' with an
expression of type 'const char (*)[18]' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
---
 android/android-tester.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 6f0e962..0e44bc8 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -897,7 +897,7 @@ static void remote_device_properties_cb(bt_status_t status,
 }
 
 static bt_bdaddr_t enable_done_bdaddr_val = { {0x00} };
-static const char enable_done_bdname_val[] = "BlueZ for Android";
+static char enable_done_bdname_val[] = "BlueZ for Android";
 static bt_uuid_t enable_done_uuids_val = {
 	.uu = { 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
 					0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb},
@@ -1344,7 +1344,7 @@ static const struct generic_data bluetooth_discovery_device_found_test = {
 	.expected_adapter_status = BT_STATUS_NOT_EXPECTED,
 };
 
-static const char remote_get_properties_bdname_val[] = "00:AA:01:01:00:00";
+static char remote_get_properties_bdname_val[] = "00:AA:01:01:00:00";
 static uint32_t remote_get_properties_cod_val = 0;
 static bt_device_type_t remote_get_properties_tod_val = BT_DEVICE_DEVTYPE_BREDR;
 static int32_t remote_get_properties_rssi_val = -60;
@@ -1400,7 +1400,7 @@ static const struct generic_data bt_dev_getprops_success_test = {
 	.expected_adapter_status = BT_STATUS_NOT_EXPECTED,
 };
 
-static const char remote_getprop_bdname_val[] = "00:AA:01:01:00:00";
+static char remote_getprop_bdname_val[] = "00:AA:01:01:00:00";
 
 static struct priority_property remote_getprop_bdname_props[] = {
 	{
@@ -1675,7 +1675,7 @@ static const struct generic_data bt_dev_getprop_fname_fail_test = {
 	.expected_adapter_status = BT_STATUS_FAIL,
 };
 
-static const char remote_setprop_fname_val[] = "set_fname_test";
+static char remote_setprop_fname_val[] = "set_fname_test";
 
 static struct priority_property remote_setprop_fname_props[] = {
 	{
@@ -1702,7 +1702,7 @@ static const struct generic_data bt_dev_setprop_fname_success_test = {
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 };
 
-static const char remote_setprop_bdname_val[] = "setprop_bdname_fail";
+static char remote_setprop_bdname_val[] = "setprop_bdname_fail";
 
 static struct priority_property remote_setprop_bdname_props[] = {
 	{
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH 1/2] agent: Remove not used enum value
From: Johan Hedberg @ 2014-01-18 13:20 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1390049485-23503-1-git-send-email-szymon.janc@gmail.com>

Hi Szymon,

On Sat, Jan 18, 2014, Szymon Janc wrote:
> Only user of AGENT_REQUEST_CONFIRM_MODE is already removed.
> ---
>  src/agent.c | 1 -
>  1 file changed, 1 deletion(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 1/2] neard: Set device UUIDs from EIR
From: Johan Hedberg @ 2014-01-18 13:20 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1390048980-16670-1-git-send-email-szymon.janc@gmail.com>

Hi Szymon,

On Sat, Jan 18, 2014, Szymon Janc wrote:
> Handle UUIDs received in EIR from neard in same way as UUIDs received
> on device discovery.
> ---
>  plugins/neard.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply

* [PATCH 2/2] device: Remove addr from struct probe_data
From: Szymon Janc @ 2014-01-18 12:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1390049485-23503-1-git-send-email-szymon.janc@gmail.com>

It is not used anywhere.
---
 src/device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/device.c b/src/device.c
index aa663f7..bcc5561 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2504,7 +2504,6 @@ static bool device_match_profile(struct btd_device *device,
 struct probe_data {
 	struct btd_device *dev;
 	GSList *uuids;
-	char addr[18];
 };
 
 static void dev_probe(struct btd_profile *p, void *user_data)
@@ -2579,15 +2578,16 @@ void device_probe_profiles(struct btd_device *device, GSList *uuids)
 {
 	struct probe_data d = { device, uuids };
 	GSList *l;
+	char addr[18];
 
-	ba2str(&device->bdaddr, d.addr);
+	ba2str(&device->bdaddr, addr);
 
 	if (device->blocked) {
-		DBG("Skipping profiles for blocked device %s", d.addr);
+		DBG("Skipping profiles for blocked device %s", addr);
 		goto add_uuids;
 	}
 
-	DBG("Probing profiles for device %s", d.addr);
+	DBG("Probing profiles for device %s", addr);
 
 	btd_profile_foreach(dev_probe, &d);
 
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 1/2] agent: Remove not used enum value
From: Szymon Janc @ 2014-01-18 12:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Only user of AGENT_REQUEST_CONFIRM_MODE is already removed.
---
 src/agent.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/agent.c b/src/agent.c
index 4c63cb9..6887bc1 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -66,7 +66,6 @@ typedef enum {
 	AGENT_REQUEST_AUTHORIZATION,
 	AGENT_REQUEST_PINCODE,
 	AGENT_REQUEST_AUTHORIZE_SERVICE,
-	AGENT_REQUEST_CONFIRM_MODE,
 	AGENT_REQUEST_DISPLAY_PINCODE,
 } agent_request_type_t;
 
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 2/2] neard: Refactor request_oob function
From: Szymon Janc @ 2014-01-18 12:43 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1390048980-16670-1-git-send-email-szymon.janc@gmail.com>

This makes function flow easier to follow.
---
 plugins/neard.c | 43 ++++++++++++++++++++-----------------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/plugins/neard.c b/plugins/neard.c
index da6e37c..b546750 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -768,42 +768,39 @@ static DBusMessage *request_oob(DBusConnection *conn, DBusMessage *msg,
 	if (err < 0)
 		return error_reply(msg, -err);
 
-	if (bacmp(&remote.address, BDADDR_ANY) == 0)
-		goto read_local;
-
-	device = btd_adapter_get_device(adapter, &remote.address,
-								BDADDR_BREDR);
+	if (bacmp(&remote.address, BDADDR_ANY) == 0) {
+		if (btd_adapter_get_powered(adapter))
+			goto read_local;
 
-	err = check_device(device);
-	if (err < 0) {
-		free_oob_params(&remote);
+		goto done;
+	}
 
-		if (err == -EALREADY)
-			return create_request_oob_reply(adapter, NULL, NULL,
-									msg);
+	device = btd_adapter_get_device(adapter, &remote.address, BDADDR_BREDR);
 
-		return error_reply(msg, -err);
-	}
+	err = check_device(device);
+	if (err < 0)
+		goto done;
 
 	if (!btd_adapter_get_pairable(adapter)) {
-		free_oob_params(&remote);
-
-		return error_reply(msg, ENONET);
+		err = -ENONET;
+		goto done;
 	}
 
 	store_params(adapter, device, &remote);
 
-	if (!remote.hash || !btd_adapter_get_powered(adapter)) {
-		free_oob_params(&remote);
-		return create_request_oob_reply(adapter, NULL, NULL, msg);
-	}
+	if (remote.hash && btd_adapter_get_powered(adapter))
+		goto read_local;
+done:
+	free_oob_params(&remote);
+
+	if (err < 0 && err != -EALREADY)
+		return error_reply(msg, -err);
+
+	return create_request_oob_reply(adapter, NULL, NULL, msg);
 
 read_local:
 	free_oob_params(&remote);
 
-	if (!btd_adapter_get_powered(adapter))
-		return create_request_oob_reply(adapter, NULL, NULL, msg);
-
 	err = btd_adapter_read_local_oob_data(adapter);
 	if (err < 0)
 		return error_reply(msg, -err);
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 1/2] neard: Set device UUIDs from EIR
From: Szymon Janc @ 2014-01-18 12:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Handle UUIDs received in EIR from neard in same way as UUIDs received
on device discovery.
---
 plugins/neard.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/neard.c b/plugins/neard.c
index 35fdaeb..da6e37c 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -643,7 +643,8 @@ static void store_params(struct btd_adapter *adapter, struct btd_device *device,
 		btd_device_device_set_name(device, params->name);
 	}
 
-	/* TODO handle UUIDs? */
+	if (params->services)
+		device_add_eir_uuids(device, params->services);
 
 	if (params->hash) {
 		btd_adapter_add_remote_oob_data(adapter, &params->address,
-- 
1.8.5.3


^ permalink raw reply related

* Re: Status of BlueZ GATT APIs
From: Marcel Holtmann @ 2014-01-18  8:42 UTC (permalink / raw)
  To: Arman Uguray; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <CAHrH25SjO5Bgdjnu6YjwKSQEiwvP+p8bfqcjJO9WEMDvG1A3PQ@mail.gmail.com>

Hi Arman,

> I was wondering what the current plans are for the GATT D-Bus API in
> BlueZ. Can anyone give a rough estimate of when these APIs will be
> available in BlueZ upstream and approximately when they could make to
> into a release?

I think the best person to answer this is Claudio. INdT has been working on these patches and we have discussed the APIs during the Plumbers Conf.

Maybe they just need to re-submit a new version and we could include them. I honestly don’t know until I see an updated set of the patches.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH] test: Python import cleanup
From: Marcel Holtmann @ 2014-01-18  8:39 UTC (permalink / raw)
  To: Petri Gynther; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <20140118014507.85FAE10065C@puck.mtv.corp.google.com>

Hi Petri,

> Some test scripts use "from gi.repository import GObject" whereas others
> use "import gobject". gi.repository is not always available on embedded
> systems, so convert all instances to this format:
> 
> try:
>  from gi.repository import GObject
> except ImportError:
>  import gobject as GObject
> 
> Also, sort the imports in this order: system, dbus, gobject, bluezutils

I am not a Python expert, but the changes look all good to. So I went ahead and applied the patch.

Regards

Marcel


^ permalink raw reply

* [PATCH] test: Python import cleanup
From: Petri Gynther @ 2014-01-18  1:45 UTC (permalink / raw)
  To: linux-bluetooth

Some test scripts use "from gi.repository import GObject" whereas others
use "import gobject". gi.repository is not always available on embedded
systems, so convert all instances to this format:

try:
  from gi.repository import GObject
except ImportError:
  import gobject as GObject

Also, sort the imports in this order: system, dbus, gobject, bluezutils
---
 test/ftp-client        | 12 +++++++-----
 test/map-client        | 15 ++++++++-------
 test/monitor-bluetooth |  8 +++++---
 test/opp-client        | 11 +++++++----
 test/pbap-client       | 10 ++++++----
 test/simple-agent      |  8 +++++---
 test/simple-endpoint   |  7 +++++--
 test/simple-obex-agent |  8 +++++---
 test/simple-player     | 10 +++++++---
 test/test-adapter      |  4 ++--
 test/test-alert        | 15 ++++++++++-----
 test/test-cyclingspeed | 10 ++++++----
 test/test-device       | 10 ++++++----
 test/test-discovery    |  8 +++++---
 test/test-health       | 11 +++++++----
 test/test-health-sink  |  9 ++++++---
 test/test-heartrate    | 10 ++++++----
 test/test-hfp          | 12 +++++++-----
 test/test-manager      |  6 ++++--
 test/test-nap          |  2 +-
 test/test-network      |  2 +-
 test/test-profile      |  8 +++++---
 test/test-proximity    | 10 ++++++----
 test/test-thermometer  | 10 ++++++----
 24 files changed, 133 insertions(+), 83 deletions(-)

diff --git a/test/ftp-client b/test/ftp-client
index ae3cbcb..78c32b3 100755
--- a/test/ftp-client
+++ b/test/ftp-client
@@ -2,14 +2,16 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-import gobject
-
+from optparse import OptionParser
+import os.path
 import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-import os.path
-from optparse import OptionParser
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME='org.bluez.obex'
 PATH = '/org/bluez/obex'
@@ -142,7 +144,7 @@ if  __name__ == '__main__':
 		sys.exit(0)
 
 	bus = dbus.SessionBus()
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 
 	client = dbus.Interface(bus.get_object(BUS_NAME, PATH,),
 							CLIENT_INTERFACE)
diff --git a/test/map-client b/test/map-client
index f3c657f..b9695da 100755
--- a/test/map-client
+++ b/test/map-client
@@ -2,15 +2,16 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-import gobject
-
-import sys
+from optparse import OptionParser
 import os
+from pprint import pformat
+import sys
 import dbus
 import dbus.mainloop.glib
-from optparse import OptionParser
-
-from pprint import pformat
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME='org.bluez.obex'
 PATH = '/org/bluez/obex'
@@ -185,7 +186,7 @@ if  __name__ == '__main__':
 		exit(0)
 
 	bus = dbus.SessionBus()
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 
 	client = dbus.Interface(bus.get_object(BUS_NAME, PATH),
 							CLIENT_INTERFACE)
diff --git a/test/monitor-bluetooth b/test/monitor-bluetooth
index bc5ddaf..d9b5472 100755
--- a/test/monitor-bluetooth
+++ b/test/monitor-bluetooth
@@ -2,10 +2,12 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-import gobject
-
 import dbus
 import dbus.mainloop.glib
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 relevant_ifaces = [ "org.bluez.Adapter1", "org.bluez.Device1" ]
 
@@ -48,5 +50,5 @@ if __name__ == '__main__':
 			dbus_interface="org.freedesktop.DBus.ObjectManager",
 			signal_name="InterfacesRemoved")
 
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 	mainloop.run()
diff --git a/test/opp-client b/test/opp-client
index 878c263..62d5b84 100755
--- a/test/opp-client
+++ b/test/opp-client
@@ -2,12 +2,15 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
+from optparse import OptionParser
+import os.path
 import sys
 import dbus
-import gobject
 import dbus.mainloop.glib
-import os.path
-from optparse import OptionParser
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME='org.bluez.obex'
 PATH = '/org/bluez/obex'
@@ -97,7 +100,7 @@ if  __name__ == '__main__':
 		sys.exit(0)
 
 	bus = dbus.SessionBus()
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 
 	client = dbus.Interface(bus.get_object(BUS_NAME, PATH),
 							CLIENT_INTERFACE)
diff --git a/test/pbap-client b/test/pbap-client
index c02833b..51e26eb 100755
--- a/test/pbap-client
+++ b/test/pbap-client
@@ -2,13 +2,15 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-import gobject
-
-import sys
 import os
+import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME='org.bluez.obex'
 PATH = '/org/bluez/obex'
@@ -113,7 +115,7 @@ if  __name__ == '__main__':
 	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
 	bus = dbus.SessionBus()
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 
 	client = dbus.Interface(bus.get_object(BUS_NAME, PATH),
 							CLIENT_INTERFACE)
diff --git a/test/simple-agent b/test/simple-agent
index 854e1af..a69299a 100755
--- a/test/simple-agent
+++ b/test/simple-agent
@@ -2,13 +2,15 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from gi.repository import GObject
-
+from optparse import OptionParser
 import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-from optparse import OptionParser
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 BUS_NAME = 'org.bluez'
diff --git a/test/simple-endpoint b/test/simple-endpoint
index 590f83a..0164cff 100755
--- a/test/simple-endpoint
+++ b/test/simple-endpoint
@@ -6,7 +6,10 @@ import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-import gobject
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 A2DP_SOURCE_UUID = "0000110A-0000-1000-8000-00805F9B34FB"
@@ -94,7 +97,7 @@ if __name__ == '__main__':
 
 	path = "/test/endpoint"
 	endpoint = Endpoint(bus, path)
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 
 	properties = dbus.Dictionary({ "UUID" : A2DP_SOURCE_UUID,
 					"Codec" : SBC_CODEC,
diff --git a/test/simple-obex-agent b/test/simple-obex-agent
index f15e9d1..05ec4ed 100755
--- a/test/simple-obex-agent
+++ b/test/simple-obex-agent
@@ -2,12 +2,14 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-import gobject
-
 import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME = 'org.bluez.obex'
 PATH = '/org/bluez/obex'
@@ -63,7 +65,7 @@ if __name__ == '__main__':
 	path = "/test/agent"
 	agent = Agent(bus, path)
 
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 
 	manager.RegisterAgent(path)
 	print("Agent registered")
diff --git a/test/simple-player b/test/simple-player
index 01bec06..23e78ad 100755
--- a/test/simple-player
+++ b/test/simple-player
@@ -1,12 +1,16 @@
 #!/usr/bin/python
 
 from __future__ import print_function
+
 import os
 import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-import gobject
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 class Player(dbus.service.Object):
@@ -56,7 +60,7 @@ class Player(dbus.service.Object):
 					signature="sv")
 
 			handler = InputHandler(self)
-			gobject.io_add_watch(sys.stdin, gobject.IO_IN,
+			GObject.io_add_watch(sys.stdin, GObject.IO_IN,
 							handler.handle)
 
 	@dbus.service.method("org.freedesktop.DBus.Properties",
@@ -136,7 +140,7 @@ if __name__ == '__main__':
 
 	path = "/test/player"
 	player = Player(bus, path)
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 
 	if len(sys.argv) > 2:
 		player.set_object(sys.argv[2])
diff --git a/test/test-adapter b/test/test-adapter
index 5deeda4..959a437 100755
--- a/test/test-adapter
+++ b/test/test-adapter
@@ -2,10 +2,10 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
+from optparse import OptionParser, make_option
 import sys
-import dbus
 import time
-from optparse import OptionParser, make_option
+import dbus
 import bluezutils
 
 bus = dbus.SystemBus()
diff --git a/test/test-alert b/test/test-alert
index 066e537..43b3cf3 100755
--- a/test/test-alert
+++ b/test/test-alert
@@ -1,12 +1,17 @@
 #!/usr/bin/python
+
 from __future__ import absolute_import, print_function, unicode_literals
+
+import optparse
+import os
+import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-import gobject
-import optparse
-import sys
-import os
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME = 'org.bluez'
 ALERT_INTERFACE = 'org.bluez.Alert1'
@@ -149,7 +154,7 @@ parser.disable_interspersed_args()
 
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 bus = dbus.SystemBus()
-mainloop = gobject.MainLoop()
+mainloop = GObject.MainLoop()
 alert = dbus.Interface(bus.get_object(BUS_NAME, BLUEZ_OBJECT_PATH),
 								ALERT_INTERFACE)
 alert_agent = AlertAgent(bus, TEST_OBJECT_PATH, alert, mainloop)
diff --git a/test/test-cyclingspeed b/test/test-cyclingspeed
index 75bd7d7..d49041f 100755
--- a/test/test-cyclingspeed
+++ b/test/test-cyclingspeed
@@ -6,13 +6,15 @@ from __future__ import absolute_import, print_function, unicode_literals
 Cycling Speed and Cadence test script
 '''
 
-import gobject
-
+from optparse import OptionParser, make_option
 import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-from optparse import OptionParser, make_option
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME = 'org.bluez'
 CYCLINGSPEED_MANAGER_INTERFACE = 'org.bluez.CyclingSpeedManager1'
@@ -190,5 +192,5 @@ if __name__ == "__main__":
 			print("Unknown command")
 			sys.exit(1)
 
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 	mainloop.run()
diff --git a/test/test-device b/test/test-device
index 3d7b852..b490d53 100755
--- a/test/test-device
+++ b/test/test-device
@@ -2,13 +2,15 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from gi.repository import GObject
-
+from optparse import OptionParser, make_option
+import re
 import sys
 import dbus
 import dbus.mainloop.glib
-import re
-from optparse import OptionParser, make_option
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
diff --git a/test/test-discovery b/test/test-discovery
index c13bfac..73b8161 100755
--- a/test/test-discovery
+++ b/test/test-discovery
@@ -2,11 +2,13 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from gi.repository import GObject
-
+from optparse import OptionParser, make_option
 import dbus
 import dbus.mainloop.glib
-from optparse import OptionParser, make_option
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 compact = False
diff --git a/test/test-health b/test/test-health
index 052a602..343f29c 100755
--- a/test/test-health
+++ b/test/test-health
@@ -3,11 +3,14 @@
 from __future__ import absolute_import, print_function, unicode_literals
 # -*- coding: utf-8 -*-
 
+import sys
 import dbus
 import dbus.service
-import gobject
 from dbus.mainloop.glib import DBusGMainLoop
-import sys
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME = 'org.bluez'
 PATH = '/org/bluez'
@@ -16,7 +19,7 @@ HEALTH_MANAGER_INTERFACE = 'org.bluez.HealthManager1'
 HEALTH_DEVICE_INTERFACE = 'org.bluez.HealthDevice1'
 
 DBusGMainLoop(set_as_default=True)
-loop = gobject.MainLoop()
+loop = GObject.MainLoop()
 
 bus = dbus.SystemBus()
 
@@ -48,7 +51,7 @@ def enter_mainloop():
 	try:
 		print("Entering main lopp, push Ctrl+C for finish")
 
-		mainloop = gobject.MainLoop()
+		mainloop = GObject.MainLoop()
 		mainloop.run()
 	except KeyboardInterrupt:
 		pass
diff --git a/test/test-health-sink b/test/test-health-sink
index 32afd71..52be535 100755
--- a/test/test-health-sink
+++ b/test/test-health-sink
@@ -3,11 +3,14 @@
 from __future__ import absolute_import, print_function, unicode_literals
 # -*- coding: utf-8 -*-
 
+import sys
 import dbus
 import dbus.service
-import gobject
 from dbus.mainloop.glib import DBusGMainLoop
-import sys
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 BUS_NAME = 'org.bluez'
 PATH = '/org/bluez'
@@ -16,7 +19,7 @@ HEALTH_MANAGER_INTERFACE = 'org.bluez.HealthManager1'
 HEALTH_DEVICE_INTERFACE = 'org.bluez.HealthDevice1'
 
 DBusGMainLoop(set_as_default=True)
-loop = gobject.MainLoop()
+loop = GObject.MainLoop()
 
 bus = dbus.SystemBus()
 
diff --git a/test/test-heartrate b/test/test-heartrate
index f26b3db..5e4e7e5 100755
--- a/test/test-heartrate
+++ b/test/test-heartrate
@@ -6,13 +6,15 @@ from __future__ import absolute_import, print_function, unicode_literals
 Heart Rate Monitor test script
 '''
 
-import gobject
-
+from optparse import OptionParser, make_option
 import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-from optparse import OptionParser, make_option
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 BUS_NAME = 'org.bluez'
@@ -102,5 +104,5 @@ if __name__ == "__main__":
 			print("unknown command")
 			sys.exit(1)
 
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 	mainloop.run()
diff --git a/test/test-hfp b/test/test-hfp
index 873de0a..a806043 100755
--- a/test/test-hfp
+++ b/test/test-hfp
@@ -2,16 +2,18 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from gi.repository import GObject
-
+from optparse import OptionParser, make_option
 import os
+from socket import SOCK_SEQPACKET, socket
 import sys
 import dbus
-import glib
 import dbus.service
 import dbus.mainloop.glib
-from optparse import OptionParser, make_option
-from socket import SOCK_SEQPACKET, socket
+import glib
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 mainloop = None
 audio_supported = True
diff --git a/test/test-manager b/test/test-manager
index 1e3882f..4f5994f 100755
--- a/test/test-manager
+++ b/test/test-manager
@@ -2,10 +2,12 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from gi.repository import GObject
-
 import dbus
 import dbus.mainloop.glib
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 def interfaces_added(path, interfaces):
diff --git a/test/test-nap b/test/test-nap
index 197e3c2..00a2585 100755
--- a/test/test-nap
+++ b/test/test-nap
@@ -2,10 +2,10 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
+from optparse import OptionParser, make_option
 import sys
 import time
 import dbus
-from optparse import OptionParser, make_option
 import bluezutils
 
 bus = dbus.SystemBus()
diff --git a/test/test-network b/test/test-network
index 3e8713f..6f09486 100755
--- a/test/test-network
+++ b/test/test-network
@@ -2,10 +2,10 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
+from optparse import OptionParser, make_option
 import sys
 import time
 import dbus
-from optparse import OptionParser, make_option
 import bluezutils
 
 bus = dbus.SystemBus()
diff --git a/test/test-profile b/test/test-profile
index b78d00c..2791580 100755
--- a/test/test-profile
+++ b/test/test-profile
@@ -2,15 +2,17 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from gi.repository import GObject
-
+from optparse import OptionParser, make_option
 import os
 import sys
 import uuid
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-from optparse import OptionParser, make_option
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 
 class Profile(dbus.service.Object):
 	fd = -1
diff --git a/test/test-proximity b/test/test-proximity
index 2f47824..66b7bc2 100755
--- a/test/test-proximity
+++ b/test/test-proximity
@@ -6,12 +6,14 @@ from __future__ import absolute_import, print_function, unicode_literals
 Proximity Monitor test script
 '''
 
-import gobject
-
+from optparse import OptionParser, make_option
 import sys
 import dbus
 import dbus.mainloop.glib
-from optparse import OptionParser, make_option
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 BUS_NAME = 'org.bluez'
@@ -64,5 +66,5 @@ if __name__ == "__main__":
 	print("Proximity SetProperty('%s', '%s')" % (args[0], args[1]))
 	device_prop.Set(PROXIMITY_MONITOR_INTERFACE, args[0], args[1])
 
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 	mainloop.run()
diff --git a/test/test-thermometer b/test/test-thermometer
index 6c143be..7e67c23 100755
--- a/test/test-thermometer
+++ b/test/test-thermometer
@@ -6,13 +6,15 @@ from __future__ import absolute_import, print_function, unicode_literals
 Thermometer test script
 '''
 
-import gobject
-
+from optparse import OptionParser, make_option
 import sys
 import dbus
 import dbus.service
 import dbus.mainloop.glib
-from optparse import OptionParser, make_option
+try:
+  from gi.repository import GObject
+except ImportError:
+  import gobject as GObject
 import bluezutils
 
 BUS_NAME = 'org.bluez'
@@ -93,5 +95,5 @@ if __name__ == "__main__":
 			print("unknown command")
 			sys.exit(1)
 
-	mainloop = gobject.MainLoop()
+	mainloop = GObject.MainLoop()
 	mainloop.run()
-- 
1.8.5.3


^ permalink raw reply related

* Status of BlueZ GATT APIs
From: Arman Uguray @ 2014-01-17 21:47 UTC (permalink / raw)
  To: linux-bluetooth

Hi all,

I was wondering what the current plans are for the GATT D-Bus API in
BlueZ. Can anyone give a rough estimate of when these APIs will be
available in BlueZ upstream and approximately when they could make to
into a release?

Thanks!
Arman Uguray

^ permalink raw reply

* Re: Compilation using clang
From: Donald Carr @ 2014-01-17 21:26 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <20140110200624.GA25318@molly.amr.corp.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2753 bytes --]

Hola,

Thanks for the rapid response :)

I am simply attaching a patch, probably in complete defiance of some
standardized announcement/submission pattern.

Yours sincerely,
Donald

On Fri, Jan 10, 2014 at 12:06 PM, Vinicius Costa Gomes
<vcgomes@gmail.com> wrote:
> Hi Donald,
>
> On 09:57 Fri 10 Jan, Donald Carr wrote:
>> Top of the morning,
>>
>> qtconnectivity currently contains a kludge which is required due to
>> the use of the GCC typeof extension in bluetooth.h which is breaking
>> with Clang compilation against the cxx11 spec.
>
> Another kludge that I have seen is putting a
> "#define typeof(x) __tupeof__(x)" before including bluetooth.h.
>
>>
>> The kludge in question involves molesting the standard (eg -std=cxx11)
>> specified to the compiler (explicitly away from cxx11 toward g++0x)
>> and hence I am hoping to be able to murder its intrusive self. I am
>> not entirely clear on the nuances though:
>>
>> This is the offending section:
>>
>> #define bt_get_unaligned(ptr)                   \
>> ({                                              \
>>         struct __attribute__((packed)) {        \
>>                 typeof(*(ptr)) __v;         \
>>         } *__p = (typeof(__p)) (ptr);               \
>>         __p->__v;                               \
>> })
>>
>> #define bt_put_unaligned(val, ptr)              \
>> do {                                            \
>>         struct __attribute__((packed)) {        \
>>                 typeof(*(ptr)) __v;         \
>>         } *__p = (typeof(__p)) (ptr);               \
>>         __p->__v = (val);                       \
>> } while(0)
>>
>> and changing typeof to __typeof__ has been verified to succeed in the
>> stated circumstance. I don't know whether this is the ideal solution,
>> or whether decltype or so other designator would be a closer/better
>> match.
>
> I would vote for changing it to __typeof__.
>
>>
>> Any feedback would be greatly appreciated, I am using this change
>> locally and I think it could be of broader use to people.
>
> Please send a patch and let's see what others think.
>
>>
>> Yours sincerely,
>> Donald Carr
>>
>>
>> --
>> -------------------------------
>>  °v°  Donald Carr
>> /(_)\ Vaguely Professional Penguin lover
>>  ^ ^
>>
>> Cave canem, te necet lingendo
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> Cheers,
> --
> Vinicius



-- 
-------------------------------
 °v°  Donald Carr
/(_)\ Vaguely Professional Penguin lover
 ^ ^

Cave canem, te necet lingendo

[-- Attachment #2: 0001-Bluez-Move-off-gcc-typeof-extension.patch --]
[-- Type: text/x-patch, Size: 1026 bytes --]

From 846b84143ee4240258b2aee6aad3cd95565caefb Mon Sep 17 00:00:00 2001
From: Donald Carr <sirspudd@gmail.com>
Date: Fri, 17 Jan 2014 13:20:39 -0800
Subject: [PATCH] Bluez: Move off gcc typeof extension

Change-Id: I63c70c9b43af6a29aa69ed11a720c45c1085dce9
---
 bluetooth/bluetooth.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bluetooth/bluetooth.h b/bluetooth/bluetooth.h
index 61c1f9a..bc9b35e 100644
--- a/bluetooth/bluetooth.h
+++ b/bluetooth/bluetooth.h
@@ -158,16 +158,16 @@ enum {
 #define bt_get_unaligned(ptr)			\
 ({						\
 	struct __attribute__((packed)) {	\
-		typeof(*(ptr)) __v;		\
-	} *__p = (typeof(__p)) (ptr);		\
+		__typeof__(*(ptr)) __v;		\
+	} *__p = (__typeof__(__p)) (ptr);		\
 	__p->__v;				\
 })
 
 #define bt_put_unaligned(val, ptr)		\
 do {						\
 	struct __attribute__((packed)) {	\
-		typeof(*(ptr)) __v;		\
-	} *__p = (typeof(__p)) (ptr);		\
+		__typeof__(*(ptr)) __v;		\
+	} *__p = (__typeof__(__p)) (ptr);		\
 	__p->__v = (val);			\
 } while(0)
 
-- 
1.8.5.3


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox