RPCS3 / rpcs3

PlayStation 3 emulator and debugger
https://rpcs3.net/
GNU General Public License v2.0
15.37k stars 1.91k forks source link

Bluetooth DualShock 3 issues for Linux #9079

Closed lgallard closed 2 years ago

lgallard commented 4 years ago

Bluetooth compatibility is not working well in Linux. I followed the instruction at the wiki page for the USB and Bluetooth configuration.

When I connect the USB cable the DS3 works perfectly, but If I use the Bluetooth connection and try to configure the controller, it takes a while to be recognized by RPCS3. After that, the DS3 keeps blinking forever but it works until the vibration mode is enabled by the game (for example, when receiving a hit). Then the DS3 stops working at all.

Bluetooth connection takes a while to be recognized by RPCS3:.

DeepinScreenshot_select-area_20201016010145

DeepinScreenshot_select-area_20201016012153

This is the log file: RPCS3.log

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 142 Model name: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz Stepping: 12 CPU MHz: 1868.552 CPU max MHz: 4800,0000 CPU min MHz: 400,0000


* GPU: 

$ glxinfo | head -n 50

name of display: :0 display: :0 screen: 0 direct rendering: Yes server glx vendor string: SGI server glx version string: 1.4 server glx extensions: GLX_ARB_create_context, GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample, GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_no_config_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer, GLX_OML_swap_method, GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_SGI_make_current_read, GLX_SGI_swap_control client glx vendor string: Mesa Project and SGI client glx version string: 1.4 client glx extensions: GLX_ARB_context_flush_control, GLX_ARB_create_context, GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer, GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync GLX version: 1.4 GLX extensions: GLX_ARB_create_context, GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer, GLX_MESA_query_renderer, GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync Extended renderer info (GLX_MESA_query_renderer): Vendor: Intel (0x8086)


Thanks in advance!
bevanweiss commented 4 years ago

What bluetooth controller do you have in your PC? Do you have any other bluetooth devices connected to this same PC at the time? Can you test the bluetooth connection to other devices on this PC (i.e. bluetooth headphones, mouse etc) to see if there is any latency/comms issue there?

RipleyTom commented 4 years ago

I can confirm the issue which also happens with DS4 BT it seems, investigating.

lgallard commented 4 years ago

@bevanweiss I use other Bluetooth devices: keyboard, earbuds, and mouse...all work well. In fact, the DS3 the controller is recognised by the OS:

DeepinScreenshot_select-area_20201019123948 DeepinScreenshot_select-area_20201019124019

The modules I'm using is btusb. I don't configure anything special, it's configured by default.

# modinfo btusb 
filename:       /lib/modules/5.8.0-2-amd64/kernel/drivers/bluetooth/btusb.ko
license:        GPL
version:        0.8
description:    Generic Bluetooth USB driver ver 0.8
author:         Marcel Holtmann <marcel@holtmann.org>
firmware:       mediatek/mt7668pr2h.bin
firmware:       mediatek/mt7663pr2h.bin
srcversion:     2FB32E08EC690C68BB9D8B0
depends:        usbcore,btrtl,btintel,btbcm,bluetooth
retpoline:      Y
intree:         Y
name:           btusb
vermagic:       5.8.0-2-amd64 SMP mod_unload modversions 

As I mentioned, the DS3 controller via Bluetooth takes a while to be recognized by RPCS3, then keeps blinking forever but it works until the vibration mode is enabled by the game (for example, when receiving a hit). Then the DS3 stops working at all.

Let me know if I can provide you more information or how to help you!

RipleyTom commented 4 years ago

Alright false alert for me. Turns out setting my BT controller as my motherboard AX200(wifi/bt intel thingie) without having setup the antenna for it wasn't a good idea.

Once properly setup the ds3/ds4 bt worked flawlessly here. Interestingly I experienced something very similar to what you're describing with a weak BT controller signal, it took quite a while to connect, could sporadically read input(I could see the dots moving in the pad window), but as soon as I tried to send a report to ds3 in rpcs3, like clicking the motor icons in the pad window, it timeouted and disconnected the pad.

One easy way to test this theory is to get your pad right next to your BT controller and see if you still experience the same issue.

lgallard commented 4 years ago

@RipleyTom in my case I use a driver the Intel driver for bluetooth and Broadcom for the wifi:

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0a5c:5843 Broadcom Corp. 58200
Bus 001 Device 002: ID 0bda:565a Realtek Semiconductor Corp. Integrated_Webcam_HD
Bus 001 Device 004: ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@curiosity:~# 

I also tried the DS3 controller with PPSSPP emulator and works perfectly (of course there's no vibration which can be the issue in this case).

lgallard commented 4 years ago

I bring more information. I used fftest and the DS3 controller vibrated well and it didn't lose the bluetooth connection:

# fftest /dev/input/event25
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES

Device /dev/input/event25 opened
Features:
  * Absolute axes: X, Y, Z, RX, RY, RZ, 
    [3F 00 00 00 00 00 00 00 ]
  * Relative axes: 
    [00 00 ]
  * Force feedback effects types: Periodic, Rumble, Gain, 
    Force feedback periodic effects: Square, Triangle, Sine, 
    [00 00 00 00 00 00 00 00 00 00 03 07 01 00 00 00 ]
  * Number of simultaneous effects: 16

Setting master gain to 75% ... OK
Uploading effect #0 (Periodic sinusoidal) ... OK (id 0)
Uploading effect #1 (Constant) ... Error: Invalid argument
Uploading effect #2 (Spring) ... Error: Invalid argument
Uploading effect #3 (Damper) ... Error: Invalid argument
Uploading effect #4 (Strong rumble, with heavy motor) ... OK (id 1)
Uploading effect #5 (Weak rumble, with light motor) ... OK (id 2)
Enter effect number, -1 to exit
4
Now Playing: Strong Rumble
Enter effect number, -1 to exit
5
Now Playing: Weak Rumble
Enter effect number, -1 to exit
-1
Stopping effects

Both strong and weak rumble worked perfectly!

RipleyTom commented 4 years ago

Did you try what I suggested, getting close to your MB with your pad and testing if it works there?

All I can tell you is that it worked when I used ubuntu 2 years ago, and it works now with latest kernel on gentoo, so the issue clearly isn't with rpcs3. As for evtest it's an abstraction layer above what we use for the ds3 pad handler, you can use evdev as handler and see if that works(ofc this doesn't support sixaxis).

lgallard commented 4 years ago

@RipleyTom yes, I'm using a laptop and I tried getting the pad closer with the same result.

I use Debian with the latest kernel as well. I also tried other emulators like PPSSP and the pad worked.

I'll check evtest and evdev, and other distros like Ubuntu and report back.

ghost commented 3 years ago

I confirm this is happening on Arch Linux, system is up-to-date as of today. When a rumble command is received the connection is temporarily lost - when receiving a hit in a game or when pressing L3+R3 in Gamepad Test. Connection sometimes reestablishes on its own after a few seconds. I am using a Shawan DS3 clone.

Also, rumble does not work at all when connected to USB using DualShock 3 pad handler, but it does work when using XInput pad handler - which in turn prevents using pressure-sensitivity, confirmed on Gamepad Test.

Megamouse commented 3 years ago

Please test this again. I recently fixed some random bug that caused us to spam the output report of the DS3 in certain scenarios.

lgallard commented 3 years ago

@Megamouse it has a weird behavior (see video attached), and buttons don't respond, and the emulator hangs after a while (see error message in the image attached).

I hope this helps to debug the driver.

https://user-images.githubusercontent.com/6194359/113486963-abe1d080-948b-11eb-8c6b-89e58a3b7eb5.mp4

RCPS3-2021-04-03_11-54

Megamouse commented 3 years ago

An analysis of your log says that your CPU is not fast enough to run RPCS3 propely. This might cause the present issues.

lgallard commented 3 years ago

@Megamouse I don't know if it's the case, because I had 16 CPUs and 16 GB of RAM

$ lscpu 
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   48 bits physical, 48 bits virtual
CPU(s):                          16
On-line CPU(s) list:             0-15
Thread(s) per core:              2
Core(s) per socket:              8
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       AuthenticAMD
CPU family:                      23
Model:                           96
Model name:                      AMD Ryzen 7 PRO 4750U with Radeon Graphics
Stepping:                        1
Frequency boost:                 enabled
CPU MHz:                         399.251
CPU max MHz:                     1700,0000
CPU min MHz:                     1400,0000
BogoMIPS:                        3393.83
Virtualization:                  AMD-V
L1d cache:                       256 KiB
L1i cache:                       256 KiB
L2 cache:                        4 MiB
L3 cache:                        8 MiB
NUMA node0 CPU(s):               0-15
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full AMD retpoline, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_ts
                                 c rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cm
                                 p_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_
                                 l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xs
                                 aves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbya
                                 sid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip rdpid overflow_recov succor smca
free -m
               total        used        free      shared  buff/cache   available
Mem:           15295        3940        8371         429        2983       10605
Swap:              0           0           0

Latest tests were done with the above computer specifications. I can test it on my other computer (the one I originally reported the issue, but it has less compute power).

By the way, on both computer I've been able to play using the DualShock 3 with the wire plugged in.

Megamouse commented 3 years ago

well then, since others pointed out it was working for them, this sounds like a driver issue or maybe your bluetooth hardware? I'm just pointing out possible points of failure here

Krejsy commented 3 years ago

Can confirm this issue on both PS3 and PS4 controllers both wired and wireless, PS4 works wired though, every controller is usable in evdev mode otherwise, analog axes are out of whack on PS3 controllers. Using Pop OS 20.10 at the moment, what information do you need?

qurious-pixel commented 3 years ago

In evdev mode you may have to adjust the axis.yml. I did this for the DualSense controller before the pad handler was added. evdev_positive_axis.yml

https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration#Analog_sticks_not_centered_with_evdev_pad_handler

nitroos-ai commented 2 years ago

Is this still a problem? Because it works flawlessly on Lubuntu with kernel 5.11.0-27.

Megamouse commented 2 years ago

Closing. Multiple users have confirmed that it's working and there hasn't been any other feedback in a while.