Bluetooth Filter Driver for DS3-compatibility - research notes



  • @nefarius said in Bluetooth Filter Driver for DS3-compatibility - research notes:

    Hope I got everything, cheers!

    Wow, I'm really impressed... I'm pretty sure that I'm going to use this driver when it get released intro production.
    I only regret having bought a Mayflash Wireless Adapter like 3-4 months ago to use my SIXAXIS/DS3 wireless without having to sacrifice the bluetooth receiver on a PC that I use to play retro games. πŸ˜… I needed to use a wireless headphones to play at night, so that's why I needed the bluetooth device on the host working with standard drivers (not dedicated to just the controller), to be able to connect the headphones... you know, I didn't want the wife to be mad at me for being playing games at night.... πŸ˜’

    I forgot to ask... how is going to be the process to pair the controller with the host receiver? I don't remember exactly, but in the old days of ScpToolkit and Motioninjoy there was a small utility to set the host's bluetooth mac to which the controller should connect when the user pressed the PS button... please correct me if I'm wrong... how is going to be now?



  • @pnkiller78 said in Bluetooth Filter Driver for DS3-compatibility - research notes:

    I forgot to ask... how is going to be the process to pair the controller with the host receiver? I don't remember exactly, but in the old days of ScpToolkit and Motioninjoy there was a small utility to set the host's bluetooth mac to which the controller should connect when the user pressed the PS button... please correct me if I'm wrong... how is going to be now?

    That's still the same; you send a single request to the device via USB updating the host MAC address it shall connect to. This can be done via SCP, FireShock or even WinUSB and a bit of custom code. No biggie.

    I'll provide a tool for that.



  • Ugh, I'm on a hunt. A bug hunt. And it's always issues I've introduced myself πŸ˜†

    2: kd> !analyze -v
    *******************************************************************************
    *                                                                             *
    *                        Bugcheck Analysis                                    *
    *                                                                             *
    *******************************************************************************
    
    DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
    An attempt was made to access a pageable (or completely invalid) address at an
    interrupt request level (IRQL) that is too high.  This is usually
    caused by drivers using improper addresses.
    If kernel debugger is available get stack backtrace.
    Arguments:
    Arg1: ffffe000c63b0dd4, memory referenced
    Arg2: 0000000000000002, IRQL
    Arg3: 0000000000000000, value 0 = read operation, 1 = write operation
    Arg4: fffff800ccac6434, address which referenced memory
    

    DRIVER_IRQL_NOT_LESS_OR_EQUAL is the most misleading bugcheck there is because the IRQL has little to do with this particular case, it's just me accessing freed memory:

    ca8ee713-3e75-4251-8632-5c2c9e29e881-image.png

    A classic 😁



  • Hello @nefarius,
    What wonderful work you have been doing!

    If you could put the code on github, (possibly just your β€œsrc” ans β€œinclude” directories {and licence of course}, so that noobs won’t compile and break their system.). It would allow some of us to have a more in-depth read-through of your code.

    Otherwise, keep up the amazing work; I look forward to seeing the code in person.

    Cam.



  • @da2ce7 Greetings. The plan is indeed to move to GitHub once the project is mature and stable enough. Right now it will stay private 😁



  • Pop the champagne, another milestone reached 🍾

    SIXAXIS/DualShock 3 and Navigation controller playable through Shibari

    Youtube Video

    After all this time of tinkering and watching byte streams I wanted to experience some results so I've modded Shibari to support the exposed children of the BthPS3 bus and look at them go πŸ˜„

    Now I can enter some serious testing and do benchmarks without having to write the function driver. In this example the bus children are in Raw PDO mode meaning that the PNP-Manager will bring them up without a function driver required and exposes them to user-land applications which then can talk to them via classic Win32-API CreateFile and DeviceIoControl.

    This is of course only an "intermediate stage", I'll still provide HID-minifilter drivers so no additional software will be required to expose the controllers via HID/DI and (probably) XInput.

    Stay tuned!



  • Castlevania Chronicles Pro-Gameplay by Gordon Freeman

    Youtube Video

    Pardon the shit quality, recorded this on my HTPC for authenticity and the i3 wasn't really happy πŸ˜…



  • @nefarius Looking good there! Almost like it's ready for beta testers? πŸ˜„ It's been over a week without updates on my favorite tech blog! πŸ˜‰



  • @Locksmith said in Bluetooth Filter Driver for DS3-compatibility - research notes:

    @nefarius Looking good there! Almost like it's ready for beta testers? πŸ˜„ It's been over a week without updates on my favorite tech blog! πŸ˜‰

    Hey,

    no worries, I'm still here, had to take a bit of a break, need to wipe my development PC and reinstall all the fun. Plus I've quit my day job and had to organize a few things and regain a proper sleep schedule πŸ˜…

    There'll be more updates soon.

    Cheers



  • Hi Nefarious, i'm actually using your scp toolkit driver for windows, even if incomplete it works well, i have both a ds3 and a ds4, and i really hope that when this project will be finished, both pads will be supported! Congratulations for all the latest progress you made! ^^



  • @Luke76bg I hope for the same, mate πŸ˜† glad it brings you joy, we're getting very close, just stay with me πŸ˜…



  • @nefarius I'm not going anywhere! I can't wait! ^___^



  • Thank you very much for the effort you're putting into this project. I can't wait for the beta to be released and being able to use both bluetooth audio and my trusty Vault 13 canteen DS3 controller. Should you need testers, please count me in.



  • @nefarius any news? πŸ™‚



  • Dear me, it's been a month! Time to see if the sources still compile 😬



  • Alright, until the next demo is ready I shall at least write down a little To-Do kind of list of open topics 😬

    Profile driver

    Auto-disconnect on buffer overrun threshold

    I've seen that the Bluetooth sub-system keeps all input reports buffered if they're not "consumed" by the profile or function driver which could lead to non-pageable memory exhaustion in case of a bug where the function driver stops consuming and inherently emptying the buffer. I plan on realizing that with a buffer size threshold value of a few kilobytes which, when exceeded, will drop the connection of the controller as there is no "stop sending input reports" command to my knowledge. This protection mechanism should be part of the profile/bus driver as it is the last bastion to system stability πŸ˜‰

    Same for the control endpoint if the "OK bytes" are forgotten to be consumed. Running out of precious non-pageable memory has to be avoided at all costs πŸ‘€

    Harden (dis-)connect state machine

    The state machine is almost a 100% finished, I didn't cover a few edge-cases I can't test because I would need to introduce radio connection errors which I can't without the proper equipment, although should implement fallback paths so the driver won't end up in an unknown state and cause hangs or orphaned objects. Again, no open paths allowed in kernel land. They will bite back one day ☠

    Filter driver

    This little fella basically works well but needs attention.

    Add sideband channel

    A filter can't be directly accessed to e.g. send it configuration changes. Therefore a sideband channel or control device object has to be introduced. This is a very good template to base it upon. The control object will be protected by ACLs only allowing administrative users access to protect against abuse. SDDL_DEVOBJ_SYS_ALL_ADM_ALL sounds right for this purpose (context).

    Add support for multiple radios

    The current assumption is that there's only one radio to work with. In a real world scenario this may be false since multiple "filter-able" Bluetooth host radio devices may be present. Therefore the filter should - in conjunction with the sideband mechanism - keep a reference to every device it's attached to and provide some sort of identification (bus serial, name, etc.). This will also impact the way the filter can be configured.

    User-land configuration

    It should be convenient for the end-user to enable or disable the drivers patching capabilities during runtime without the need of unloading the filter or having to re-plug or re-enable any devices. Some simple IOCTLs should be introduced for the sideband channel which can then be sent by a simple GUI tool. The driver should then store the state change in the according registry sections it can access (Hardware key sounds like the right place).

    User-land tool for control

    I plan on providing a simple C#-based tool which displays the available filtered radios with some basic information and some toggle switches to enable or disable PSM patching on the fly and other possible useful information which might come up (host radio MAC address for easy pairing access for example or entirely integrate PS3 pairing).

    Setup tools

    The recent discoveries of the ViGEm.Setup toolset may certainly benefit this project as well. Maybe portions of BthPS3Util should/could be ported to WiX custom action πŸ€”

    Shibari/Function driver

    Not entirely sure if I should continue/publish my Shibari hack which already makes this stack usable. Proper function drivers should be the end goal but those will once again eat quite a bit of time as well. We'll see about that.

    So far so good, will ramp up the pace again soon.

    Cheers



  • About to test the latest filter modifications (added sideband code), here we go again πŸ˜…

    7056b9f7-0e38-41ca-a873-b4ada6ca4028-image.png

    Bless you, VMware πŸ˜ƒ

    9a354b73-cd02-4bd7-a572-b2836b41e2ab-image.png

    That's quite quick, RAM-cached hard disk provides quite the I/O πŸ˜†

    2ac88313-e079-4eed-9595-a22d537b1c6c-image.png



  • And we have a Desktop, that install only took 5 minutes 😲

    fac015a6-abcf-4ff2-b8f0-ef8b22573701-image.png



  • Oh, this if funny, I thought I've checked this already but apparently not; it's not possible to have two (or more) USB Bluetooth host dongles active at the same time πŸ€”

    Windows 8.1

    e382d185-2c19-4f0e-9fda-8e3d2787c3f8-image.png

    Windows 10

    0f571c51-dfd0-4dfb-b13c-fb727bba3898-image.png

    Well, that's good to know but hasn't interfered with anything I've implemented today because I wanted to have the capability of storing device-specific settings through a control device anyway. So I guess this is true πŸ˜…



  • Phew, everything still works after my mayhem πŸ˜… And on a completely fresh machine as well!

    4b0bf8ce-7834-44e5-a7f7-d36bf04da985-image.png

    Time for a game and/or slumber πŸ’€


Log in to reply