I've been trying to get a connection from Android using createL2capChannel or createInsecureL2capChannel (and iOS) to a Raspberry Pi which has created a BTPROTO_L2CAP SOCK_SEQPACKET Bluetooth socket which it is accepting, running Bluez 5.50 but they are failing at the LE Credit Based Flow step.
Running WireShark with a nRF BLE sniffer I see it is failing at the LE Credit Based Connection Response with LE_PSM not supported:
Command: LE Credit Based Connection Response
Command Code: LE Credit Based Connection Response (0x15)
Command Identifier: 0x02
Command Length: 10
Destination CID: Null identifier (0x0000)
MTU: 0
MPS: 0
Initial Credits: 0
LE Result: Connection Refused - LE_PSM Not Supported (0x0002)
I've tried various PSMs: 0x1001, 0xf3, 0x25 without any difference. I have also seen that BlueKitche BTStack works, so I know the iOS / Android code is OK.
Does anyone know how to actually configure Bluez to correctly support LE L2Cap CoC credit based flow on the Pi?
Solved thanks to the Bluez Slack channel. I followed https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/tools/l2test.c#n573 to get the correct settings from do_listen().