Bluetooth Filter Driver for DS3-compatibility - research notes

@nefarius I suppose that's something hand in hand with invoving other people. You could have the software work only until a certain date, say a month from the beginning of beta, which would prevent people from using the beta binaries indefinitely.

@enricorov hm, a time bomb you mean? 🤔 Well, I'll figure something out, another issue that's more important to me and would need assistance with would be how to properly organize such a circle of testers, having feedback arriving in a nice ordered fashion etc.

Auto-disconnect on I/O idle implemented

Alright, this challenge was easier to resolve than I initially thought (and without a single crash I might add!) thanks to the frameworks idle power-down capabilities:

--------------------------- Nav connecting ---------------------------
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	BthPS3_IndicationCallback Entry
2019/05/19-17:48:09.682	TRACE_LEVEL_INFORMATION	New connection for PSM 0x5053 from 00070401E341 arrived
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnect Entry
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	ClientConnections_RetrieveByBthAddr Entry
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	ClientConnections_RetrieveByBthAddr Exit (STATUS_NOT_FOUND (0xC0000225))
2019/05/19-17:48:09.682	TRACE_LEVEL_ERROR	BTHPS3_GET_DEVICE_NAME failed with status STATUS_INVALID_PARAMETER (0xC000000D), dropping connection
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	L2CAP_PS3_DenyRemoteConnect Entry
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	L2CAP_PS3_DenyRemoteConnectCompleted Entry (STATUS_SUCCESS (0x00000000))
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	L2CAP_PS3_DenyRemoteConnectCompleted Exit
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	L2CAP_PS3_DenyRemoteConnect Exit
2019/05/19-17:48:09.682	TRACE_LEVEL_VERBOSE	BthPS3_IndicationCallback Exit
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	BthPS3_IndicationCallback Entry
2019/05/19-17:48:10.488	TRACE_LEVEL_INFORMATION	New connection for PSM 0x5053 from 00070401E341 arrived
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	IRQL DPC (0x02) too high, preparing async call
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	BthPS3_IndicationCallback Exit
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnectAsync Entry
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnect Entry
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	ClientConnections_RetrieveByBthAddr Entry
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	ClientConnections_RetrieveByBthAddr Exit (STATUS_NOT_FOUND (0xC0000225))
2019/05/19-17:48:10.488	TRACE_LEVEL_INFORMATION	++ Device 00070401E341 name: Navigation Controller
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x0, Context: 0xFFFF858FE830A0D0)
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnect Exit (STATUS_SUCCESS (0x00000000))
2019/05/19-17:48:10.488	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnectAsync Exit
2019/05/19-17:48:10.703	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ControlConnectResponseCompleted Entry
2019/05/19-17:48:10.703	TRACE_LEVEL_INFORMATION	Connection completion, status: STATUS_SUCCESS (0x00000000)
2019/05/19-17:48:10.703	TRACE_LEVEL_INFORMATION	HID Control Channel connection established
2019/05/19-17:48:10.703	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ControlConnectResponseCompleted Exit
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	BthPS3_IndicationCallback Entry
2019/05/19-17:48:10.897	TRACE_LEVEL_INFORMATION	New connection for PSM 0x5055 from 00070401E341 arrived
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	IRQL DPC (0x02) too high, preparing async call
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	BthPS3_IndicationCallback Exit
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnectAsync Entry
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnect Entry
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	ClientConnections_RetrieveByBthAddr Entry
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	++ Found desired connection item in connection list
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	ClientConnections_RetrieveByBthAddr Exit (STATUS_SUCCESS (0x00000000))
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x0, Context: 0xFFFF858FE830A0D0)
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnect Exit (STATUS_SUCCESS (0x00000000))
2019/05/19-17:48:10.897	TRACE_LEVEL_VERBOSE	L2CAP_PS3_HandleRemoteConnectAsync Exit
2019/05/19-17:48:10.969	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x4, Context: 0xFFFF858FE830A0D0)
2019/05/19-17:48:10.969	TRACE_LEVEL_INFORMATION	L2CAP_PS3_ConnectionIndicationCallback ++ IndicationRemoteConfigRequest
2019/05/19-17:48:10.969	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:48:11.092	TRACE_LEVEL_VERBOSE	L2CAP_PS3_InterruptConnectResponseCompleted Entry
2019/05/19-17:48:11.092	TRACE_LEVEL_INFORMATION	Connection completion, status: STATUS_SUCCESS (0x00000000)
2019/05/19-17:48:11.092	TRACE_LEVEL_INFORMATION	HID Interrupt Channel connection established
2019/05/19-17:48:11.092	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionStateConnected Entry
2019/05/19-17:48:11.092	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionStateConnected Exit
2019/05/19-17:48:11.092	TRACE_LEVEL_VERBOSE	L2CAP_PS3_InterruptConnectResponseCompleted Exit
2019/05/19-17:48:11.092	TRACE_LEVEL_VERBOSE	BthPS3_EvtWdfChildListCreateDevice Entry
2019/05/19-17:48:11.093	TRACE_LEVEL_VERBOSE	BthPS3_EvtWdfChildListCreateDevice Exit
--------------------------- Device connected, but no I/O, 10 seconds idle timeout ---------------------------
2019/05/19-17:48:21.094	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfDeviceD0Exit Entry
2019/05/19-17:48:21.094	TRACE_LEVEL_INFORMATION	Requesting device disconnect
2019/05/19-17:48:21.094	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfDeviceD0Exit Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x3, Context: 0xFFFF858FE830A0D0)
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	++ IndicationRemoteDisconnect [0xFFFF858FEFFB1B20]
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	++ HID Control Channel 0xFFFF858FEFFB1B20 disconnected
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Entry (STATUS_SUCCESS (0x00000000))
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x1, Context: 0xFFFF858FE830A0D0)
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x3, Context: 0xFFFF858FE830A0D0)
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	++ IndicationRemoteDisconnect [0xFFFF858FEEE2CB20]
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	++ HID Interrupt Channel 0xFFFF858FEEE2CB20 disconnected
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Entry (STATUS_SUCCESS (0x00000000))
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	++ Both channels are gone, awaiting clean-up
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	ClientConnections_RemoveAndDestroy Entry (ClientConnection: 0xFFFF858FE830A0D0)
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	++ Found desired connection item in connection list
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	ClientConnections_RemoveAndDestroy Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x1, Context: 0xFFFF858FE830A0D0)
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:48:21.237	TRACE_LEVEL_INFORMATION	EvtClientConnectionsDestroyConnection Entry (DISPOSING CONNECTION MEMORY)
2019/05/19-17:48:21.237	TRACE_LEVEL_VERBOSE	EvtClientConnectionsDestroyConnection Exit
2019/05/19-17:48:21.238	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtDeviceContextCleanup Entry
2019/05/19-17:48:21.238	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtDeviceContextCleanup Exit
--------------------------- Device connection dropped by profile driver ---------------------------

Now when something happens to the I/O dispatching (like a process crash or a bug in the function driver), the idle timeout will kick in preventing the buffers from filling up uncontrolled and dropping the connection:

--------------------------- Shibari active, dispatching I/O ---------------------------
2019/05/19-17:54:15.514	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfIoQueueIoDeviceControl Entry
2019/05/19-17:54:15.514	TRACE_LEVEL_VERBOSE	>> IOCTL_BTHPS3_HID_INTERRUPT_READ
2019/05/19-17:54:15.514	TRACE_LEVEL_VERBOSE	bufferLength: 50
2019/05/19-17:54:15.514	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfIoQueueIoDeviceControl Exit (status: STATUS_PENDING (0x00000103))
2019/05/19-17:54:15.544	TRACE_LEVEL_VERBOSE	Interrupt read transfer request completed with status STATUS_SUCCESS (0x00000000) (remaining: 0)
2019/05/19-17:54:15.544	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfIoQueueIoDeviceControl Entry
2019/05/19-17:54:15.544	TRACE_LEVEL_VERBOSE	>> IOCTL_BTHPS3_HID_INTERRUPT_READ
2019/05/19-17:54:15.544	TRACE_LEVEL_VERBOSE	bufferLength: 50
2019/05/19-17:54:15.544	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfIoQueueIoDeviceControl Exit (status: STATUS_PENDING (0x00000103))
2019/05/19-17:54:15.546	TRACE_LEVEL_VERBOSE	Interrupt read transfer request completed with status STATUS_SUCCESS (0x00000000) (remaining: 0)
2019/05/19-17:54:15.547	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfIoQueueIoDeviceControl Entry
2019/05/19-17:54:15.547	TRACE_LEVEL_VERBOSE	>> IOCTL_BTHPS3_HID_INTERRUPT_READ
2019/05/19-17:54:15.547	TRACE_LEVEL_VERBOSE	bufferLength: 50
2019/05/19-17:54:15.547	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfIoQueueIoDeviceControl Exit (status: STATUS_PENDING (0x00000103))
--------------------------- Shibari killed by Task Manager so device is orphaned now ---------------------------
2019/05/19-17:54:15.558	TRACE_LEVEL_VERBOSE	Control read transfer request completed with status STATUS_CANCELLED (0xC0000120)
2019/05/19-17:54:15.558	TRACE_LEVEL_VERBOSE	Control read transfer request completed with status STATUS_CANCELLED (0xC0000120)
2019/05/19-17:54:15.558	TRACE_LEVEL_VERBOSE	Interrupt read transfer request completed with status STATUS_CANCELLED (0xC0000120) (remaining: 0)
2019/05/19-17:54:15.558	TRACE_LEVEL_VERBOSE	Interrupt read transfer request completed with status STATUS_CANCELLED (0xC0000120) (remaining: 0)
--------------------------- Idle timeout kicked in, dropping device ---------------------------
2019/05/19-17:54:25.558	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfDeviceD0Exit Entry
2019/05/19-17:54:25.558	TRACE_LEVEL_INFORMATION	Requesting device disconnect
2019/05/19-17:54:25.559	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtWdfDeviceD0Exit Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x3, Context: 0xFFFF858FE8E610D0)
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	++ IndicationRemoteDisconnect [0xFFFF858FEEA47B20]
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	++ HID Control Channel 0xFFFF858FEEA47B20 disconnected
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Entry (STATUS_SUCCESS (0x00000000))
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x1, Context: 0xFFFF858FE8E610D0)
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x3, Context: 0xFFFF858FE8E610D0)
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	++ IndicationRemoteDisconnect [0xFFFF858FF3EDCB20]
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	++ HID Interrupt Channel 0xFFFF858FF3EDCB20 disconnected
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Entry (STATUS_SUCCESS (0x00000000))
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ChannelDisconnectCompleted Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	++ Both channels are gone, awaiting clean-up
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	ClientConnections_RemoveAndDestroy Entry (ClientConnection: 0xFFFF858FE8E610D0)
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	++ Found desired connection item in connection list
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	ClientConnections_RemoveAndDestroy Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_INFORMATION	EvtClientConnectionsDestroyConnection Entry (DISPOSING CONNECTION MEMORY)
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	EvtClientConnectionsDestroyConnection Exit
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtDeviceContextCleanup Entry
2019/05/19-17:54:25.648	TRACE_LEVEL_VERBOSE	BthPS3_PDO_EvtDeviceContextCleanup Exit
2019/05/19-17:54:25.649	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Entry (Indication: 0x1, Context: 0xFFFF858FE8E610D0)
2019/05/19-17:54:25.649	TRACE_LEVEL_VERBOSE	L2CAP_PS3_ConnectionIndicationCallback Exit
--------------------------- Device connection dropped, all memory freed ---------------------------

Nice, the list is getting shorter 😄

@nefarius I am really glad to see progress and maybe soon a future where I will not have to use SCPToolkit in Windows 10 with my PS3 controller. I still prefer PS3 controller over the PS4 controller.

I have VMWare setup also with Windows 7 and 10 as well and if you need a beta tester I am more then willing. I use to do some software development for Database applications like Invoicing, Inventory, and Time software in Borland Delphi so I do know a bit about what to look for in bugs and how to report them.

Wow, that's an intense weekend @nefarius! I guess you'll have to swear the beta testers to secrecy with some blood oath and haunt them through the night if they do not report in! 😉 Great work, and it's really fun and interesting to follow the progress you post. Keep it up! 🙂

!ERAU QSSI DLRO WEHT

@molitar @Locksmith have a glimpse on the main page, should be a new category visible 😉

@nefarius Ok great I am doing an image backup of my system right now and will be removing SCP and testing within the hour 😉

Note to self: add WdfDeviceInitSetExclusive to PDO to prevent multiple handles.

Ok, finally had do register just to say I too have been following this story for months, and I don't know why (I'm not a programmer, unless you count some rudimentary VBA for Excel...), but coming to check in every few days is better than anything I find on Netflix; what an adventure! I do want to try this out once it is ready (I can only see source code on the main page, I still cant test it yet, right?), and will say goodbye to SCP then!

@RDP be my guest, I've updated your permissions.

finally,the long awaited progress is here
i hale thy for doing what everybody couldn't
but seriously i am a follower since day one
i think no one can deny the progress made in this month
i hope i am not asking for much but if it's possible i wish i too can be a part of making a legendary milestone 🙂

@seiif you've been added to the flock. Enjoy the ride.

pali, reporting for duty with only a hint of snark 😛

Good luck with the testing! I've been following this for a while and can't wait to finally have a true replacement for SCP. I'm very excited with the progress you've posted. Thank you so much for your work on this.

The testing so far has been overwhelmingly good apart from some legacy SCP shenanigans ruining our fun with Shibari but that's a different topic and solvable.

Hi nefarius,

I too have been reading your posts on a regular basis and have been getting much enjoyment out of them (even if some of it is so technical it may as well be Chinese to me 😊 ).
While I'm not a hardcore coder, I love tinkering and would love to help out with testing. My machine is win 10 x64, soon to be 1903, with a Intel 9260 Bluetooth card, which hast had SCP installed on it. Currently have a Xbox 1 and ds4 controller paired to it and have two real ds3's to test with. Oh, and I also have a couple of no name bt adapters that I used to use with SCP that I could also use.

I wouldn't mind testing either if you're still looking for more people to help. I have access to two different Bluetooth adapters (this and this), an original DS4 controller, 2x original DS3 controllers, and 2x Xbox One controllers, as well as multiple computers I could use for testing (all Windows 10 1809 currently).

I do desktop and server support for a living, so I'm comfortable modifying the registry and adding/removing drivers and all that. Not sure what all might be needed in this scenario, but I'll do whatever you may need. Just let me know.

@teeedubb @chaoticyeshua welcome to the flock then, I've adapted your permissions, have fun 😄

I'd like to test as well, here's my setup: original Sixaxis and DS3 with a Chinese clone. Bluetooth V4.0+EDR adapter (CSR8510). Had no success with AirBender. photo

If you are looking for any more beta testers please include me. I have 2 chinese DS3 controllers. and 2 bluetooth usb dongles (both bluetooth 4.0) and one bluetooth card built in to the laptop (bluetooth 4.2). I would love to help in anyway I can.