BT L2Cap DualsenseX
Posted: Tue Jan 17, 2023 6:18 pm
Hello everyone
I'm trying to send HID command on DualsenseX (Playstation5 controller), but DSX ignores any data, i've implemented same (hid report throught l2cap) on WindowsOS, and it works normally with all features, next i decided to inspect whole BT frame by Wireshark, so there is only one difference is a packet boundary flag, after that, i dig into ESP-IDF and found method L2CA_WriteDataEx, which accepts neccessary flags, but it seems that this flags have no effect.
The question is how to modify PB flag in ACL packet with ESP-IDF?
Or how to send acceptable HID command on DualsenseX with ESP32?
My windows library sends this to set led color (100% works):
0000 02 30 00 53 00 4f 00 42 00 a2 31 02 ff f7 00 00
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 fd 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 78 c8 3b e4
Connection Handle: 0x030 ..00 .... .... .... = PB Flag: First Non-automatically Flushable Packet (0)
ESP32 Wrover send this (doesn't work):
0000 02 30 20 53 00 4f 00 42 00 a2 31 02 ff f7 00 00
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 fd 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 78 c8 3b e4
Connection Handle: 0x030 ..10 .... .... .... = PB Flag: First Automatically Flushable Packet (2)
Maybe you know the reason commands are ignored, please help
Bluetooth tech.ref. claims that there are diffrent types of ACL packets, i guess non-auto-flushable means reliable, and that this is the main problem. Thanks for help!
I'm trying to send HID command on DualsenseX (Playstation5 controller), but DSX ignores any data, i've implemented same (hid report throught l2cap) on WindowsOS, and it works normally with all features, next i decided to inspect whole BT frame by Wireshark, so there is only one difference is a packet boundary flag, after that, i dig into ESP-IDF and found method L2CA_WriteDataEx, which accepts neccessary flags, but it seems that this flags have no effect.
The question is how to modify PB flag in ACL packet with ESP-IDF?
Or how to send acceptable HID command on DualsenseX with ESP32?
My windows library sends this to set led color (100% works):
0000 02 30 00 53 00 4f 00 42 00 a2 31 02 ff f7 00 00
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 fd 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 78 c8 3b e4
Connection Handle: 0x030 ..00 .... .... .... = PB Flag: First Non-automatically Flushable Packet (0)
ESP32 Wrover send this (doesn't work):
0000 02 30 20 53 00 4f 00 42 00 a2 31 02 ff f7 00 00
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 fd 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 78 c8 3b e4
Connection Handle: 0x030 ..10 .... .... .... = PB Flag: First Automatically Flushable Packet (2)
Maybe you know the reason commands are ignored, please help
Bluetooth tech.ref. claims that there are diffrent types of ACL packets, i guess non-auto-flushable means reliable, and that this is the main problem. Thanks for help!
Code: Select all
//CRC Computed outside
void L2CapSend(uint16_t cid, uint8_t* dat, uint32_t len) {
BT_HDR *btHdr = (BT_HDR *)malloc(L2CAP_CMD_BUF_SIZE);
memset(btHdr, 0, L2CAP_CMD_BUF_SIZE);
btHdr->len = len;
btHdr->offset = L2CAP_MIN_OFFSET;
memcpy((uint8_t *)(btHdr + 1) + btHdr->offset, dat, btHdr->len);
L2CA_DataWriteEx(cid, btHdr, L2CAP_NON_FLUSHABLE_PKT);
}