..:: PCSX2 Forums ::..

Full Version: DS4Windows -- yet another DualShock 4 driver! (No longer under active development)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ScpVBus hasn't changed since 1.0.0.103, only the installer was updated.

The issue is caused by an immediate Plugin after an Unplug.

When Unplug is called, ScpVBus informs Driver Manager that a PDO is no longer present and returns. Driver Manager then asynchronously goes through the device driver stack informing each driver in the stack that the PDO is no longer present and tears down each driver in turn.

It is then a race condition between the call to Plugin the device again being called and Driver Manager completing it's tear down of the device. If Driver Manager hasn't completed it can leave the device in an error state [should see one of the drivers in the stack with a yellow triangle in Device Manager].

Note: this does not occur in the SCP Drivers since they have a different usage pattern. Also the Win 8/8.1 Driver Manager seems to have a more robust implementation.

Seems to be caused by the Hide DS4 option performing a Stop/Start of BusDevice. Put a Thread.Sleep(100) after a successful DeviceIoControl() call in Unplug.
Thank you so much for stopping by to help. Here's a patch for the Beta 6 build that adds a 1/4 second sleep after any time an Xinput device is torn down, replacing the 1/5 second sleep that is supposed to occur after disconnection before a device can get detected again. Maybe it will help? It also duplicates the debug messages you normally see in the window into the console log so it will increase the amount of error reporting detail.

If this is the only underlying issue then I can work on making it actually wait for the Xinput device to disappear instead of trying to guess at how long it will take. Seems that I can also conditionalize that behavior on the host system being Windows XP or 7 instead of 8, then, too. Thanks again, Scarlet.Crush.
Wonderful news. Beta 6 with those patched files you attached there electrobrains, works amazingly. I did like 7 connect, disconnect cycles using the PS+Options combo, and even tried hotplugging (leaving the server running and turning on Bluetooth, something that always caused the bug for me) and while hotplugging didn't work, I blame that on Windows 7 Bluetooth stack, at least I could turn off the controller and stop the server, and start it all back up again and get a XInput device to show up and function. I never again got the weird disconnect,reconnect,disconnect bug. It is perfect.

So, I'd say with those tweaks in place, I can finally move past v1.2.2 of DS4 Tool Smile

Thanks so much guys. Very very happy to see this bug get squashed.
(04-16-2014, 07:04 PM)DaRkL3AD3R Wrote: [ -> ]Wonderful news. Beta 6 with those patched files you attached there electrobrains, works amazingly. I did like 7 connect, disconnect cycles using the PS+Options combo, and even tried hotplugging (leaving the server running and turning on Bluetooth, something that always caused the bug for me) and while hotplugging didn't work, I blame that on Windows 7 Bluetooth stack, at least I could turn off the controller and stop the server, and start it all back up again and get a XInput device to show up and function. I never again got the weird disconnect,reconnect,disconnect bug. It is perfect.

So, I'd say with those tweaks in place, I can finally move past v1.2.2 of DS4 Tool Smile

Thanks so much guys. Very very happy to see this bug get squashed.

Great! That's wonderful news. Do you think you could test Beta 6 + the DS4Control patch but NOT the other DS4Library patch I posted earlier? I want to know that the simultaneous read/write to the HID device is a red herring, not an actual issue with Windows 7. If it still works then I'll roll it up into another Beta release. Do you get no weird behavior at all anymore?
Edit: Or wait, is that what you did? Start with Beta 6 and only apply the DS4Control patch?
(04-16-2014, 07:58 PM)electrobrains Wrote: [ -> ]Great! That's wonderful news. Do you think you could test Beta 6 + the DS4Control patch but NOT the other DS4Library patch I posted earlier? I want to know that the simultaneous read/write to the HID device is a red herring, not an actual issue with Windows 7. If it still works then I'll roll it up into another Beta release. Do you get no weird behavior at all anymore?
Edit: Or wait, is that what you did? Start with Beta 6 and only apply the DS4Control patch?

This is precisely what I did. Went to the first page, downloaded the basic Beta 6 version attached there, then copied over the DS4Control patch on this page.

No weird behavior at all. Proper disconnects, and the Xbox 360 controller shows up and functions every time.

Hotplugging still is a no go but I blame this on Windows 7 more than a "bug" in DS4Windows. By hotplugging I mean leaving the server running and turning on my DS4 controller. It lights up white on the LED, then the LED turns off completely and DS4Windows sees the controller, makes an XInput device, but it doesn't react to my controller input. Again though, this absolutely never worked for me going all the way back to like DS4 Tool initial release, so I don't call it a bug per-say.


As long as the patched DS4Control files do not interfere with anything in a negative way, I think it would be okay to merge it with your regular branch Smile
(04-16-2014, 08:18 PM)DaRkL3AD3R Wrote: [ -> ]This is precisely what I did. Went to the first page, downloaded the basic Beta 6 version attached there, then copied over the DS4Control patch on this page.

No weird behavior at all. Proper disconnects, and the Xbox 360 controller shows up and functions every time.

Hotplugging still is a no go but I blame this on Windows 7 more than a "bug" in DS4Windows. By hotplugging I mean leaving the server running and turning on my DS4 controller. It lights up white on the LED, then the LED turns off completely and DS4Windows sees the controller, makes an XInput device, but it doesn't react to my controller input. Again though, this absolutely never worked for me going all the way back to like DS4 Tool initial release, so I don't call it a bug per-say.


As long as the patched DS4Control files do not interfere with anything in a negative way, I think it would be okay to merge it with your regular branch Smile

I posted a Beta 7 with that change that appeared to fix some of your issues, and added a configuration box for the initial touchpad mode. At some point could you get me the console log for the controller failing to establish connection? I wonder if that's a Bluetooth driver level problem or one with our DS4 driver software.
Alright Beta 7 installed fresh, here's what I got logged. Just so you have a picture of what's going on, the controller was turned off when I started DS4 Windows so I stopped the server, turned on my controller, and then started it again. The first disconnect worked perfectly, as they all do, until I try to hotplug it without stopping the server that's when the first errors popup and it breaks Xbox 360 controller from hooking.

Code:
2014-04-16T19:33:58.3535682Z> Starting...
2014-04-16T19:33:58.3535682Z> Searching for controllers....
2014-04-16T19:33:58.3635683Z> Using Shared Mode
2014-04-16T19:34:03.5235755Z> Stopping X360 Controllers
2014-04-16T19:34:03.5235755Z> Stopping DS4 Controllers
2014-04-16T19:34:03.5235755Z> Stopped DS4 Tool
2014-04-16T19:34:07.7235814Z> Starting...
2014-04-16T19:34:07.7235814Z> Searching for controllers....
2014-04-16T19:34:07.7235814Z> Using Shared Mode
A4:15:66:7D:F6:1C 2014-04-16T19:34:07.7435814Z> start
2014-04-16T19:34:07.7535814Z> Found Controller: A4:15:66:7D:F6:1C (BT)
A4:15:66:7D:F6:1C 2014-04-16T19:34:07.7635814Z> power subsystem octet: 0x09
2014-04-16T19:34:07.7735814Z> Controller: A4:15:66:7D:F6:1C is ready to use
Trying to disonnect BT device
Disconnect successful: True
Close fs
Close sh
2014-04-16T19:34:15.3315930Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
A4:15:66:7D:F6:1C 2014-04-16T19:34:15.3415930Z> start
A4:15:66:7D:F6:1C 2014-04-16T19:34:15.3415930Z> disconnect due to write failure: 21
A4:15:66:7D:F6:1C 2014-04-16T19:34:15.6915941Z> disconnect due to read failure: 1167
Close fs
Close sh
A4:15:66:7D:F6:1C 2014-04-16T19:34:21.1416017Z> start
A4:15:66:7D:F6:1C 2014-04-16T19:34:21.1416017Z> disconnect due to write failure: 995
2014-04-16T19:34:21.1416017Z> Found Controller: A4:15:66:7D:F6:1C (BT)
2014-04-16T19:34:21.1516017Z> Controller: A4:15:66:7D:F6:1C is ready to use
A4:15:66:7D:F6:1C 2014-04-16T19:34:21.1916018Z> disconnect due to read failure: 1167
Close fs
Close sh
2014-04-16T19:34:21.1916018Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
A4:15:66:7D:F6:1C 2014-04-16T19:34:22.3516034Z> start
2014-04-16T19:34:22.3616034Z> Found Controller: A4:15:66:7D:F6:1C (BT)
2014-04-16T19:34:22.3616034Z> Controller: A4:15:66:7D:F6:1C is ready to use
A4:15:66:7D:F6:1C 2014-04-16T19:34:23.1416045Z> power subsystem octet: 0x09
Trying to disonnect BT device
Disconnect successful: True
Close fs
Close sh
2014-04-16T19:34:34.0416198Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
2014-04-16T19:34:35.8316223Z> Stopping X360 Controllers
2014-04-16T19:34:35.8316223Z> Stopping DS4 Controllers
2014-04-16T19:34:35.8316223Z> Stopped DS4 Tool
2014-04-16T19:34:39.9616281Z> Starting...
2014-04-16T19:34:39.9616281Z> Searching for controllers....
2014-04-16T19:34:39.9616281Z> Using Shared Mode
A4:15:66:7D:F6:1C 2014-04-16T19:34:39.9716281Z> start
2014-04-16T19:34:39.9816281Z> Found Controller: A4:15:66:7D:F6:1C (BT)
2014-04-16T19:34:39.9816281Z> Controller: A4:15:66:7D:F6:1C is ready to use
A4:15:66:7D:F6:1C 2014-04-16T19:34:39.9916281Z> power subsystem octet: 0x09
Trying to disonnect BT device
Disconnect successful: True
Close fs
Close sh
2014-04-16T19:34:50.3716426Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
2014-04-16T19:34:53.3316468Z> Stopping X360 Controllers
2014-04-16T19:34:53.3316468Z> Stopping DS4 Controllers
2014-04-16T19:34:53.3316468Z> Stopped DS4 Tool
(04-16-2014, 09:38 PM)DaRkL3AD3R Wrote: [ -> ]Alright Beta 7 installed fresh, here's what I got logged. Just so you have a picture of what's going on, the controller was turned off when I started DS4 Windows so I stopped the server, turned on my controller, and then started it again. The first disconnect worked perfectly, as they all do, until I try to hotplug it without stopping the server that's when the first errors popup and it breaks Xbox 360 controller from hooking.

Code:
2014-04-16T19:33:58.3535682Z> Starting...
2014-04-16T19:33:58.3535682Z> Searching for controllers....
2014-04-16T19:33:58.3635683Z> Using Shared Mode
2014-04-16T19:34:03.5235755Z> Stopping X360 Controllers
2014-04-16T19:34:03.5235755Z> Stopping DS4 Controllers
2014-04-16T19:34:03.5235755Z> Stopped DS4 Tool
2014-04-16T19:34:07.7235814Z> Starting...
2014-04-16T19:34:07.7235814Z> Searching for controllers....
2014-04-16T19:34:07.7235814Z> Using Shared Mode
A4:15:66:7D:F6:1C 2014-04-16T19:34:07.7435814Z> start
2014-04-16T19:34:07.7535814Z> Found Controller: A4:15:66:7D:F6:1C (BT)
A4:15:66:7D:F6:1C 2014-04-16T19:34:07.7635814Z> power subsystem octet: 0x09
2014-04-16T19:34:07.7735814Z> Controller: A4:15:66:7D:F6:1C is ready to use
Trying to disonnect BT device
Disconnect successful: True
Close fs
Close sh
2014-04-16T19:34:15.3315930Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
A4:15:66:7D:F6:1C 2014-04-16T19:34:15.3415930Z> start
A4:15:66:7D:F6:1C 2014-04-16T19:34:15.3415930Z> disconnect due to write failure: 21
A4:15:66:7D:F6:1C 2014-04-16T19:34:15.6915941Z> disconnect due to read failure: 1167
Close fs
Close sh
A4:15:66:7D:F6:1C 2014-04-16T19:34:21.1416017Z> start
A4:15:66:7D:F6:1C 2014-04-16T19:34:21.1416017Z> disconnect due to write failure: 995
2014-04-16T19:34:21.1416017Z> Found Controller: A4:15:66:7D:F6:1C (BT)
2014-04-16T19:34:21.1516017Z> Controller: A4:15:66:7D:F6:1C is ready to use
A4:15:66:7D:F6:1C 2014-04-16T19:34:21.1916018Z> disconnect due to read failure: 1167
Close fs
Close sh
2014-04-16T19:34:21.1916018Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
A4:15:66:7D:F6:1C 2014-04-16T19:34:22.3516034Z> start
2014-04-16T19:34:22.3616034Z> Found Controller: A4:15:66:7D:F6:1C (BT)
2014-04-16T19:34:22.3616034Z> Controller: A4:15:66:7D:F6:1C is ready to use
A4:15:66:7D:F6:1C 2014-04-16T19:34:23.1416045Z> power subsystem octet: 0x09
Trying to disonnect BT device
Disconnect successful: True
Close fs
Close sh
2014-04-16T19:34:34.0416198Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
2014-04-16T19:34:35.8316223Z> Stopping X360 Controllers
2014-04-16T19:34:35.8316223Z> Stopping DS4 Controllers
2014-04-16T19:34:35.8316223Z> Stopped DS4 Tool
2014-04-16T19:34:39.9616281Z> Starting...
2014-04-16T19:34:39.9616281Z> Searching for controllers....
2014-04-16T19:34:39.9616281Z> Using Shared Mode
A4:15:66:7D:F6:1C 2014-04-16T19:34:39.9716281Z> start
2014-04-16T19:34:39.9816281Z> Found Controller: A4:15:66:7D:F6:1C (BT)
2014-04-16T19:34:39.9816281Z> Controller: A4:15:66:7D:F6:1C is ready to use
A4:15:66:7D:F6:1C 2014-04-16T19:34:39.9916281Z> power subsystem octet: 0x09
Trying to disonnect BT device
Disconnect successful: True
Close fs
Close sh
2014-04-16T19:34:50.3716426Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
2014-04-16T19:34:53.3316468Z> Stopping X360 Controllers
2014-04-16T19:34:53.3316468Z> Stopping DS4 Controllers
2014-04-16T19:34:53.3316468Z> Stopped DS4 Tool

So wait, am I seeing this correctly that you're getting it immediately trying to reconnect upon forced disconnect?
A4:15:66:7D:F6:1C 2014-04-16T19:34:07.7435814Z> start
2014-04-16T19:34:07.7535814Z> Found Controller: A4:15:66:7D:F6:1C (BT)
A4:15:66:7D:F6:1C 2014-04-16T19:34:07.7635814Z> power subsystem octet: 0x09
2014-04-16T19:34:07.7735814Z> Controller: A4:15:66:7D:F6:1C is ready to use
Trying to disonnect BT device
Disconnect successful: True
Close fs
Close sh
2014-04-16T19:34:15.3315930Z> Controller A4:15:66:7D:F6:1C was removed or lost connection
A4:15:66:7D:F6:1C 2014-04-16T19:34:15.3415930Z> start

I feel like I'm shooting in the dark... maybe this change would help, moving the 1/4 second wait after the Xinput device shutdown but before the teardown of the lower half of the DS4 device.
After the "Close sh" part, the controller is off and nothing is happening. The server is still running, and I turn the controller back on. That's when it bugs out and cycles twice, disconnecting then connecting, causing the broken hook that requires a reboot.

But the fact that I can disconnect, stop the server, and reconnect without error, is a huge improvement.

I'm not sure what those read/write errors are from, either Windows 7, my bluetooth adapter or DS4Windows, but I can deal with it by not leaving the server running when I turn on my DS4.

Hope this helps.
hmm... button mode doesn't seem to work for me. When I turn on button mode (it shows that this is the mode that it's in in the console), I can move the mouse cursor around using the touchpad.

edit: I'm using beta7 btw... also seems a bit strange that when I use the hotkey (pad+option) to change to the different modes, it skips over button mode. It'll flash on button mode quickly and then change to cursor mode.