Skip to contentSkip to conversation

Continuing the Xbox One Bluetooth controller debugging

DISCUSSION Cameron Gutman 3 participants 4 messages Nov 30, 2016 – Dec 1, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I'm interesting in continuing the debugging of the Xbox One S controller's issues with the BlueZ stack (original report [0]). I confirmed the issue still affects v4.9-rc7. I've also tried Vinicius's patch from [1] applied on v4.9-rc7 without success.

The controller is updated with the latest firmware and connects reliably to (at least) macOS Sierra, Windows 10 14393, Android 6.0.1, 7.0, and 7.1.1 (including devices using 3.10 and 3.18 based kernels).

I'm happy to collect logs, test other patches, etc.

Regards,
Cameron

[0]: https://marc.info/?l=linux-bluetooth&m=147151539332595&w=2
[1]: https://marc.info/?l=linux-bluetooth&m=147204738628234&w=2

#1 lore raw

Le mardi 29 novembre 2016 à 20:51 -0800, Cameron Gutman a écrit :

Quoted 7 lines

Hi,

I'm interesting in continuing the debugging of the Xbox One S controller's issues with the BlueZ stack (original report [0]). I confirmed the issue still affects v4.9-rc7. I've also tried Vinicius's patch from [1] applied on v4.9-rc7 without success.

Quoted 6 lines

The controller is updated with the latest firmware and connects reliably to (at least) macOS Sierra, Windows 10 14393, Android 6.0.1, 7.0, and 7.1.1 (including devices using 3.10 and 3.18 based kernels).

I'm happy to collect logs, test other patches, etc.

Steam has made a patch referencing the xbox one S controller :
https://github.com/ValveSoftware/steamlink-sdk/commit/d6afa93787217033a0f0f5db5f557b252c36260e#diff-
45ba5a41f43606276c9bf9018eed43c2

You should check this.

#2 lore raw

Hi,

Quoted 13 lines · Anthony Bourguignon
Quoted 12 lines · Cameron Gutman

Hi,

I'm interesting in continuing the debugging of the Xbox One S controller's issues with the BlueZ stack (original report [0]). I confirmed the issue still affects v4.9-rc7. I've also tried Vinicius's patch from [1] applied on v4.9-rc7 without success.

The controller is updated with the latest firmware and connects reliably to (at least) macOS Sierra, Windows 10 14393, Android 6.0.1, 7.0, and 7.1.1 (including devices using 3.10 and 3.18 based kernels).

Quoted 7 lines
Quoted 1 line

I'm happy to collect logs, test other patches, etc.

Steam has made a patch referencing the xbox one S controller :
https://github.com/ValveSoftware/steamlink-sdk/commit/d6afa93787217033a0f0f5db5f557b252c36260e#diff-
45ba5a41f43606276c9bf9018eed43c2

You should check this.

That is a big hammer, instead I was thinking in just ignoring the Unknown option since basic mode is default, so please check with the following patch.

Signature · 1 line
Luiz Augusto von Dentz

From c7e471a082d6fc3cbff42f6e194f64d791a9b1c5 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <[email protected]>
Date: Wed, 30 Nov 2016 16:45:13 +0200
Subject: [PATCH] Bluetooth: L2CAP: Ignore Unknown option error for basic mode

Some devices send Unknown option in case it only support basic mode which will cause the channel the be disconnect, so instead the code now just check if the Unknown option is RFC and the channel mode is basic and ignore the error.

---
 net/bluetooth/l2cap_core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
net/bluetooth/l2cap_core.c +11 -0
index 74abc53..c0ddace 100644
@@ -4206,6 +4206,17 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,
 			if (result != L2CAP_CONF_SUCCESS)
 				goto done;
 			break;
+	}
+
+	case L2CAP_CONF_UNKNOWN:
+		/* Ignore unkwown option for RFC in case of basic mode as it
+		 * is considered the default mode:
+		 * BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part A] page 96:
+		 * The Basic L2CAP mode is the default.
+		 */
+		if (rsp->data == L2CAP_CONF_RFC &&
+		    chan->mode == L2CAP_MODE_BASIC) {
+			break;
 		}
 
 	default:
Signature · 1 line
2.9.3
#3 lore raw
Quoted 24 lines · Luiz Augusto von Dentz

Hi,

Quoted 20 lines · Anthony Bourguignon
Quoted 7 lines · Cameron Gutman

Hi,

I'm interesting in continuing the debugging of the Xbox One S controller's issues with the BlueZ stack (original report [0]). I confirmed the issue still affects v4.9-rc7. I've also tried Vinicius's patch from [1] applied on v4.9-rc7 without success.

Quoted 6 lines

The controller is updated with the latest firmware and connects reliably to (at least) macOS Sierra, Windows 10 14393, Android 6.0.1, 7.0, and 7.1.1 (including devices using 3.10 and 3.18 based kernels).

I'm happy to collect logs, test other patches, etc.

Steam has made a patch referencing the xbox one S controller :
https://github.com/ValveSoftware/steamlink-sdk/commit/d6afa93787217
033a0f0f5db5f557b252c36260e#diff- 45ba5a41f43606276c9bf9018eed43c2

Quoted 6 lines
Quoted 1 line

You should check this.

That is a big hammer, instead I was thinking in just ignoring the Unknown option since basic mode is default, so please check with the following patch.

No dice. I think ignoring it won't work because it's the controller itself initiating the disconnect. Attached an hcidump log with the patch applied and another with disable_ertm set to 1.

HCI sniffer - Bluetooth packet analyzer ver 5.43
device: hci0 snap_len: 1500 filter: 0xffffffffffffffff

Quoted 3 lines

HCI Event: Vendor (0xff) plen 2
HCI Event: Vendor (0xff) plen 2
HCI Event: Connect Request (0x04) plen 10

    bdaddr C8:3F:26:0D:A4:57 class 0x000508 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr C8:3F:26:0D:A4:57 role 0x00
    Role: Master
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Role Change (0x12) plen 8

    status 0x00 bdaddr C8:3F:26:0D:A4:57 role 0x00
    Role: Master
Quoted 2 lines

HCI Event: Vendor (0xff) plen 4
HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 256 bdaddr C8:3F:26:0D:A4:57 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 256
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Max Slots Change (0x1b) plen 3

handle 256 slots 5

Quoted 1 line

HCI Event: Read Remote Supported Features (0x0b) plen 11

    status 0x00 handle 256
    Features: 0xbf 0x3e 0x8d 0xfe 0xdb 0xfd 0x7b 0x87

< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
handle 256 page 1

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Link Key Request (0x17) plen 6

    bdaddr C8:3F:26:0D:A4:57
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
    bdaddr C8:3F:26:0D:A4:57 key 4723E829AE0274800390B1AE4AA4504D
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 10

    Link Key Request Reply (0x01|0x000b) ncmd 1
    status 0x00 bdaddr C8:3F:26:0D:A4:57
Quoted 1 line

HCI Event: Read Remote Extended Features (0x23) plen 13

    status 0x00 handle 256 page 1 max 3
    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr C8:3F:26:0D:A4:57 mode 2 clkoffset 0x0000

< ACL data: handle 256 flags 0x00 dlen 10
L2CAP(s): Info req: type 2

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Encrypt Change (0x08) plen 4

    status 0x00 handle 256 encrypt 0x01

< HCI Command: Read Encryption Key Size (0x05|0x0008) plen 2

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 7

    Read Encryption Key Size (0x05|0x0008) ncmd 1
Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 17 scid 0x0040

< ACL data: handle 256 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 0
Connection pending - No futher information available
< ACL data: handle 256 flags 0x00 dlen 10
L2CAP(s): Info req: type 2

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 16

L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x0010
Streaming mode

Quoted 1 line

HCI Event: Remote Name Req Complete (0x07) plen 255

    status 0x00 bdaddr C8:3F:26:0D:A4:57 name 'Xbox Wireless Controller'
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 16

L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x0010
Streaming mode
< ACL data: handle 256 flags 0x00 dlen 16

    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 256 flags 0x00 dlen 23
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 11
      RFC 0x00 (Basic) 
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 16

    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 1480 
< ACL data: handle 256 flags 0x00 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 1480 
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 15

L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 3 clen 1
Failure - unknown options
RFC
< ACL data: handle 256 flags 0x00 dlen 12

    L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 12

    L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040

< HCI Command: Disconnect (0x01|0x0006) plen 3
handle 256 reason 0x13
Reason: Remote User Terminated Connection

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Disconnect (0x01|0x0006) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Disconn Complete (0x05) plen 4

status 0x00 handle 256 reason 0x16
Reason: Connection Terminated by Local Host

HCI sniffer - Bluetooth packet analyzer ver 5.43
device: hci0 snap_len: 1500 filter: 0xffffffffffffffff

Quoted 1 line

HCI Event: Disconn Complete (0x05) plen 4

status 0x00 handle 256 reason 0x08
Reason: Connection Timeout
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1
enable 2

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

    Write Scan Enable (0x03|0x001a) ncmd 2
    status 0x00
Quoted 3 lines

HCI Event: Vendor (0xff) plen 2
HCI Event: Vendor (0xff) plen 2
HCI Event: Connect Request (0x04) plen 10

    bdaddr C8:3F:26:0D:A4:57 class 0x000508 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr C8:3F:26:0D:A4:57 role 0x00
    Role: Master
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Role Change (0x12) plen 8

    status 0x00 bdaddr C8:3F:26:0D:A4:57 role 0x00
    Role: Master
Quoted 2 lines

HCI Event: Vendor (0xff) plen 4
HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 256 bdaddr C8:3F:26:0D:A4:57 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 256
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1

< HCI Command: Write Scan Enable (0x03|0x001a) plen 1
enable 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

    Write Scan Enable (0x03|0x001a) ncmd 2
    status 0x00
Quoted 1 line

HCI Event: Max Slots Change (0x1b) plen 3

handle 256 slots 5

Quoted 1 line

HCI Event: Read Remote Supported Features (0x0b) plen 11

    status 0x00 handle 256
    Features: 0xbf 0x3e 0x8d 0xfe 0xdb 0xfd 0x7b 0x87

< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
handle 256 page 1

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Link Key Request (0x17) plen 6

    bdaddr C8:3F:26:0D:A4:57
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
    bdaddr C8:3F:26:0D:A4:57 key 8EFE498AD09511DDD149C146B3E43C0C
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 10

    Link Key Request Reply (0x01|0x000b) ncmd 1
    status 0x00 bdaddr C8:3F:26:0D:A4:57
Quoted 1 line

HCI Event: Read Remote Extended Features (0x23) plen 13

    status 0x00 handle 256 page 1 max 3
    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr C8:3F:26:0D:A4:57 mode 2 clkoffset 0x0000

< ACL data: handle 256 flags 0x00 dlen 10
L2CAP(s): Info req: type 2

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Encrypt Change (0x08) plen 4

    status 0x00 handle 256 encrypt 0x01

< HCI Command: Read Encryption Key Size (0x05|0x0008) plen 2

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 7

    Read Encryption Key Size (0x05|0x0008) ncmd 1
Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 17 scid 0x0040

< ACL data: handle 256 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 0
Connection pending - No futher information available
< ACL data: handle 256 flags 0x00 dlen 10
L2CAP(s): Info req: type 2

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 16

L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x0010
Streaming mode

Quoted 1 line

HCI Event: Remote Name Req Complete (0x07) plen 255

    status 0x00 bdaddr C8:3F:26:0D:A4:57 name 'Xbox Wireless Controller'
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 16

L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x0010
Streaming mode
< ACL data: handle 256 flags 0x00 dlen 16

    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 256 flags 0x00 dlen 12
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 0
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 16

    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 1480 
< ACL data: handle 256 flags 0x00 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 1480 
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 14

    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
      Success
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 19 scid 0x0041

< ACL data: handle 256 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 1 status 2
Connection pending - Authorization pending
< ACL data: handle 256 flags 0x00 dlen 16

    L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
      Connection successful
< ACL data: handle 256 flags 0x00 dlen 12
    L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 16

    L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 4
      MTU 1480 
< ACL data: handle 256 flags 0x00 dlen 18
    L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
      MTU 1480 
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 14

    L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 0
      Success
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Max Slots Change (0x1b) plen 3

handle 256 slots 1
< ACL data: handle 256 flags 0x00 dlen 6
L2CAP(d): cid 0x0040 len 2 [psm 17]
HIDP: Get report: Input report

Quoted 1 line

HCI Event: Mode Change (0x14) plen 6

    status 0x00 handle 256 mode 0x02 interval 12
    Mode: Sniff
Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 22

L2CAP(d): cid 0x0041 len 18 [psm 19]
HIDP: Data: Input report

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 22

L2CAP(d): cid 0x0041 len 18 [psm 19]
HIDP: Data: Input report

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 5

L2CAP(d): cid 0x0040 len 1 [psm 17]
HIDP: Handshake: Invalid report ID
< ACL data: handle 256 flags 0x00 dlen 6
L2CAP(d): cid 0x0040 len 2 [psm 17]
HIDP: Get report: Input report
< HCI Command: Exit Sniff Mode (0x02|0x0004) plen 2

    handle 256
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Exit Sniff Mode (0x02|0x0004) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

HCI Event: Mode Change (0x14) plen 6

    status 0x00 handle 256 mode 0x00 interval 0
    Mode: Active
Quoted 1 line

HCI Event: Max Slots Change (0x1b) plen 3

handle 256 slots 5

Quoted 1 line

HCI Event: Max Slots Change (0x1b) plen 3

handle 256 slots 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 5

L2CAP(d): cid 0x0040 len 1 [psm 17]
HIDP: Handshake: Invalid report ID
< ACL data: handle 256 flags 0x00 dlen 6
L2CAP(d): cid 0x0040 len 2 [psm 17]
HIDP: Get report: Input report

Quoted 1 line

HCI Event: Mode Change (0x14) plen 6

    status 0x00 handle 256 mode 0x02 interval 12
    Mode: Sniff
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 256 packets 1

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 5

L2CAP(d): cid 0x0040 len 1 [psm 17]
HIDP: Handshake: Invalid report ID

Quoted 1 line

ACL data: handle 256 flags 0x02 dlen 7

L2CAP(d): cid 0x0041 len 3 [psm 19]
HIDP: Data: Input report