-
Notifications
You must be signed in to change notification settings - Fork 810
Possible Output Report Changes #1248
Comments
This sounds interesting. Didn't know DS4 gamepad supports yet additional HID packet types than those "normal" ones (packets used in usb vs bt, pc-friendly vs native ds4). If those new packet types make it into release version then maybe using some profile setting (next to BTPollRate, ControllerOutputType, OutputDataToDS4 options) to choose which one to use. Could be that forcing use of those new packet types might break some non-official DS4 gamepads. I marked another issue ticket today as "enhancement" to let profile setting optionally to disable communication with DS4 audio device. Maybe this option could be somehow part of those upcoming new experiements. |
Since I do not own a PS4, I have no real idea how the console interacts with the DS4 and how the hardware was originally intended to be used. There is a good amount of information online that is out of date and inaccurate. It is nice to have more information about how the DS4 is utilized on the PS4 console. I originally found the article when attempting to find newer information about getting BT audio support working. At least someone else tried to get it working and got pretty close to a working solution. I need to try out the code and see if tweaking the program can help make audio streaming work better. I originally made a small change to the jay branch but reverted it. Third party controller support might be affected so I did not want to add something that might interfere with your changes just yet. More testing will be required. At this rate, I plan on running from the report_tweak branch for a while and keeping it in sync with jay. Definitely can feel a positive difference when playing DmC Devil May Cry; I need to play a proper Devil May Cry game sometime but I actually like DmC for the most part. |
Got the code compiled. The program can send data to the controller but I get no sound from the controller. |
This issue got me to start playing around with the ds4linuxtest again. I finally figured out how to detect controllers through hidraw connected via Bluetooth. I can read input reports and convert the state data to a virtual Xbox 360 controller; have not tested input performance yet. I still have had no luck getting the lightbar color to change when a DS4 is connected via Bluetooth; the USB and Sony Wireless Adapter routines work just fine. |
I think I have found the exact problem with the HIDRAW API. There is no way to manually send an output report via the control interface. The interrupt interface will be used and that does not work as intended when the DS4 is connected via Bluetooth. DS4Windows has to use a different method to write output packets to the DS4 when connected via Bluetooth. Some of the data is accepted by the controller as I can change the BT Poll Rate and output report type and those changes take effect. Changing the lightbar color nor the rumble data is possible at the moment unless I can find some workaround. I am going to try out Kali Linux 2019.4 which is the distro that the author used for his testing. It looks like that distro uses Linux kernel 5.3.9. |
Finally. I have spent the past day trying to figure out how to compile and test a modified version of the hid_sony Linux driver. Got the issues worked out and my initial hypothesis was correct. With the addition of an hid_device quirk to force HIDRAW to write on the control endpoint, lightbar color changing and rumble work as expected. Need to find out if there is a different way I can go about doing this so a custom kernel module is not needed. |
Now I have gotten to the point where audio can stream to the DS4 controller when connected via Bluetooth. The audio output is very choppy but it is interesting that audio is playing at all. Besides the default configuration of playing audio through the internal speaker, it is documented how to set up the output report to send the audio stream to the headphone jack; it is controlled by one byte in the output report. Steaming audio to the headphone jack does work with the program. Granted, it is not usable in its current state but it is an interesting test. |
More progress. Played around with the hid_sony code more and found the secret sauce that allows the ouput report to go through without a workaround. CRC32 data needs to be generated for the output report in order for the DS4 controller to acknowledge it. Removed the hid_device quirk and added CRC32 generation to the output report routines. Lightbar and rumble functionality now work with no kernel module changes. That information might be useful for DS4Windows in the future. |
Nice work. Although I don't use DS4 audio output, but I'm sure others may find it useful. Or if those new output modes help to tackle the issue of weird BT lag in some PC/BT host setups. |
The written command in the article for converting audio files is slightly wrong. The line had to be modified slightly. Got the process mostly sorted out. Here is my own short demonstration. Playing Liquid Richard - Banworld on the DS4 https://www.youtube.com/watch?v=Ru6TYGhNMWE Example gst-launch-1.0 command
|
The report_tweak branch has been merged into jay. |
@Ryochan7 This article claims they fix the stuttering using islive=true to audiotestsrc Great work so far, very exciting. Will this method work for 3.5mm jack audio aswell? I own a ps4 pro and a few ds4s, let me know if theres something I can do. |
In the ds4-bt wiki https://www.psdevwiki.com/ps4/DS4-BT they mention that the ds4 firmware has a pc and ps4 mode. If we can spoof a ps4 connection, maybe it would expose the audio device. This gets activated when instead of going into pair mode, you connect the controller to the ps4 by usb and press the ps button, it does some kind of handshake that registers the bluetooth connection. |
Yes. DS4 gamepad has a so called "PC-friendly mode" and a "native DS4 mode" when connected over BT. USB connection in PC is always in native DS4 mode (=all custom DS4 features work), but over BT connection DS gamepad is at first in PC-friendly mode. Lightbar/touchpad/etc "custom" DS4 features don't work. This DS4Windows app can handle that situation and send the proper handshaking messages to switch over to native DS4 mode (=DS4 gamepad firmware is told to talk like it is done with PS4 console) even in PC. Without that ligthbar and touchpad would not work over BT. The same applies to audio also (althought it still has other issues over BT in pc). |
@mika-n thats really good to hear ds4win has already figured the handshake out. Do you have further information on the other audio issues you mentioned? Is there a build of ds4win that exposes 3.5mm audio over bt? Do you think it would be worth my time to build a USB over Bluetooth soluton? |
I don't want to disturb this lovely dev-ish moment, but I thought that there was already an "audio solution" working in linux, that didn't require to touch the kernel or whatnot? |
@mirh Yes some success in linux, these methods are all based on that russian article I mentioned earlier. It involves sending raw data packets over bt. I'm really looking for a windows audio solution. |
The only new piece of information that I can see in the article is that the script switches the type of output report sent to the controller. It alternates between report type 0x14 and 0x15. I can experiment with that type of approach later but I don't have very high hopes. Also, the ds4drv version is an old proof of concept. It has never been a fully developed solution. From what I have read, it suffers from audio stuttering like other tests. Edit: 0x14 does send audio data but it does not include other data like rumble. |
The current change of the output report generated by DS4Windows is to improve BT performance and input latency. There is still no plan to try to incorporate audio streaming via BT until the audio stuttering problem can be solved. |
I understand, apologies for the tangent in that case. I'll stick to #1268
Thanks for all your work so far. I hope you do return to audio soon! Do you think usb over bt/wifi could work? |
One odd positive thing to come out of this is that it got me to check out the current Linux gaming wasteland. I still have some Linux native games in my backlog that I would like to play on Linux. Updated my small DS4 mapper so the DS4 can function as an Xbox 360 controller. |
Maybe you can contact the developers in Dolphin emulator |
I found an article a little while ago about a person's adventures trying to decipher how BT audio works with the DS4. It is a very informative article about how the PS4 interacts with the DS4 and the structure of the various output reports. I have not yet tried the proof of concept code for playing audio through BT. I need to get a dev environment set up on my Fedora installation to build the code and try it out. It seems to be further along than the other popular example that people have pointed to in the past.
https://sensepost.com/blog/2020/dual-pod-shock-emotional-abuse-of-a-dualshock/
The information listed there has led me to perform some other experiments for the time being. One change that seems to make a difference is moving from using HID Ouput report 0x11 to report 0x15. Also, changing the byte pertaining to connection mode makes a difference in input performance. I need to do more testing but I am liking the changes so far. Any possible changes won't make it to version 2.1.
https://github.com/Ryochan7/DS4Windows/tree/report_tweak
The text was updated successfully, but these errors were encountered: