Comments (30)
from bluez.
Here's the squashed commit with all the fixes in it. I'll look into upstreaming it.
mrfixit2001/rockchip-kernel@eab66f5
from bluez.
FYI I've applied sixaxis plugin patch to bluez master
from bluez.
The linux kernel HID driver handles the shanwan driver differently. This line:
https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c#L2987
sets the driver quirk dependent on the device name. If the device name isn't "SHANWAN PS3 GamePad" then this quirk is not set and the driver doesn't do some things, including a fix for the non-stop rumbling, as well as send different output reports.
The question now is... how can bluez correctly identify a shanwan device? I suppose as long as it pairs over USB first you should be able to pull the name from the usb device and override the one you've manually set in your struct. Shouldn't be too difficult but I'm not familiar enough with bluez to figure out how to pull the device name from the usb device.
from bluez.
sixaxis plugin is not enabled by default so you need to add --enable-sixaxis to configure
from bluez.
@jangofett4 what kernel are you using? Just to confirm the HID driver has the proper code. Can you give us output from uname -a
I've tested "udev_device_get_property_value(hid_parent, "HID_NAME")" on my patch sets with my older version of bluez (will be updating shortly) and it's properly passing the name of the controller thru to the kernel now.
Unfortunately - I would also point out for anyone else reading this... that if your controller doesn't register exactly as "SHANWAN PS3 GamePad" then the kernel driver will not apply the shanwan quirks in the driver. I've seen this in some PS3 clones that are actually shanwan. I've had to patch the kernel to check if SHANWAN is anywhere in the name in order for the quirks to get picked up.
from bluez.
https://www.spinics.net/lists/linux-input/msg71953.html
from bluez.
Yep I have the exact same problem and not sure whats the reason.
dmesg:
[ 9975.458006] usb 1-2: new full-speed USB device number 13 using xhci_hcd
[ 9975.614589] usb 1-2: New USB device found, idVendor=054c, idProduct=0268, bcdDevice= 1.00
[ 9975.614595] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 9975.614598] usb 1-2: Product: PS3 GamePad
[ 9975.614600] usb 1-2: Manufacturer: SHANWAN
[ 9975.636635] input: SHANWAN PS3 GamePad Motion Sensors as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-2/1-2:1.0/0003:054C:0268.0010/input/input57
[ 9975.691210] input: SHANWAN PS3 GamePad as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-2/1-2:1.0/0003:054C:0268.0010/input/input56
[ 9975.691518] sony 0003:054C:0268.0010: input,hiddev1,hidraw3: USB HID v81.10 Joystick [SHANWAN PS3 GamePad] on usb-0000:05:00.3-2/input0
BlueZ thinks its a genuine Sony Dualshock 3.
Arch Linux
Kernel: 5.9.12
BlueZ: 5.55-1
from bluez.
Bump? I'm way too inexperienced with Linux drivers to fix this issue, but vibration doesn't seem to be handled in plugins/sixaxis.c
. If someone can tell me where to look for I'm willing to try to fix this.
from bluez.
yeap, thats the plan :-) getting name from udev and pass it instead of default one, just need to find spare evening
from bluez.
Please check #95
Note that this may not be final version as I'm considering to simply always pass name read from USB (regardless of device connected)
from bluez.
I'm trying to test the #95:
$ git clone -b shanwan https://github.com/sjanc/bluez
$ cd bluez
$ ./bootstrap-configure
$ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var
$ make
$ sudo make install
Build & install is successful, however vibration problem still exist. I'm suspicious of driver not actually being installed. How can I be sure if I'm using the Bluez version I just built?
from bluez.
Ok I recompiled and installed again. Currently its running the driver I just built for certain. Gamepad works however all 4 lights keep flashing (every half a second or so, not pairing light). Also vibration is not working in bluetooth mode altogether.
dmesg:
[ 408.651311] usb 1-2: new full-speed USB device number 10 using xhci_hcd
[ 408.810858] usb 1-2: New USB device found, idVendor=054c, idProduct=0268, bcdDevice= 1.00
[ 408.810861] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 408.810863] usb 1-2: Product: PS3 GamePad
[ 408.810864] usb 1-2: Manufacturer: SHANWAN
[ 408.825863] sony 0003:054C:0268.0009: controller with MAC address 07:84:ae:6a:63:25 already connected
[ 408.826023] sony 0003:054C:0268.0009: hiddev97,hidraw4: USB HID v81.10 Joystick [SHANWAN PS3 GamePad] on usb-0000:05:00.3-2/input0
[ 408.826025] sony 0003:054C:0268.0009: failed to claim input
[ 409.612832] usb 1-2: USB disconnect, device number 10
[ 410.007983] usb 1-2: new full-speed USB device number 11 using xhci_hcd
[ 410.164864] usb 1-2: New USB device found, idVendor=054c, idProduct=0268, bcdDevice= 1.00
[ 410.164867] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 410.164869] usb 1-2: Product: PS3 GamePad
[ 410.164870] usb 1-2: Manufacturer: SHANWAN
[ 410.185897] input: SHANWAN PS3 GamePad Motion Sensors as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-2/1-2:1.0/0003:054C:0268.000A/input/input36
[ 410.241367] input: SHANWAN PS3 GamePad as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-2/1-2:1.0/0003:054C:0268.000A/input/input35
[ 410.241553] sony 0003:054C:0268.000A: input,hiddev97,hidraw3: USB HID v81.10 Joystick [SHANWAN PS3 GamePad] on usb-0000:05:00.3-2/input0
[ 416.356591] usb 1-2: USB disconnect, device number 11
[ 423.608865] sony 0005:054C:0268.000B: unknown main item tag 0x0
[ 423.632182] input: SHANWAN PS3 GamePad Motion Sensors as /devices/pci0000:00/0000:00:08.1/0000:05:00.4/usb3/3-2/3-2:1.0/bluetooth/hci0/hci0:3/0005:054C:0268.000B/input/input38
[ 423.632549] input: SHANWAN PS3 GamePad as /devices/pci0000:00/0000:00:08.1/0000:05:00.4/usb3/3-2/3-2:1.0/bluetooth/hci0/hci0:3/0005:054C:0268.000B/input/input37
[ 423.634943] sony 0005:054C:0268.000B: input,hidraw3: BLUETOOTH HID v80.00 Joystick [SHANWAN PS3 GamePad] on 10:63:c8:b0:44:5c
I noticed failed to claim input
and unkonwn main item tag 0x0
lines.
from bluez.
When I connect it through USB, I get 4 lights, but when I unplug it and plug it again, I get only one light, but I do not get the message that tells me if I want to trust this device or not anymore. It might be an issue with KDE. Anyway, the controller works only now through USB.
Bluez always asks me if I want to trust this device everytime I plug it whatever I use Cinnamon, Gnome, or KDE, but that is another issue. I do not know if it is a common issue with this controller or not.
from bluez.
Had a similar issue, solution was simply to install bluez-plugins
and bluez-utils
in Arch Linux and reboot. I removed my bluez packages in order to use the driver I built, trust dialog does open up in KDE for me.
from bluez.
Output of uname -a
➜ ~ uname -a
Linux cezeri 5.10.15-arch1-1 #1 SMP PREEMPT Wed, 10 Feb 2021 18:32:40 +0000 x86_64 GNU/Linux
It's stable linux
package from Arch repository, no custom kernel (yet).
Unfortunately - I would also point out for anyone else reading this... that if your controller doesn't register exactly as "SHANWAN PS3 GamePad" then the kernel driver will not apply the shanwan quirks in the driver. I've seen this in some PS3 clones that are actually shanwan. I've had to patch the kernel to check if SHANWAN is anywhere in the name in order for the quirks to get picked up.
I think mine is identified exactly like that string, at least dmesg reports like that. Also since vibration from USB works fine I would guess that quirk is successfully applied.
from bluez.
Vibration with bluez alone is up to the kernel to handle properly, which now depends on what it's seeing the name of. Shanwan controllers seem to be a bit all over the place. The clone I have identifies itself as ShanWan PLAYSTATION(R)3 Controller
(there are 5 spaces between shanwan and playstation)
So the kernel would handle this like it's a normal DS3 controller and not a shanwan. When I force the kernel driver to identify this as a shanwan device, the LEDs and rumble stop working. When I allow it to function as a normal DS3, both work but the rumble effect continues for a long time until it times out completely. I'm working on a fix for that, but in the meantime I have revived and updated the qtsixa application that you can run right along with bluez that will make everything work properly. As of right now I still need to fix the way the threading works, as every rumble causes emulators to freeze up for half a second. But its "good enough" until I figure out how to make the kernel handle these clones properly. I expect I need to add a quirk to force the kernel to close the socket for the ff effect for these clones only. We will see.
https://github.com/mrfixit2001/qtsixa
from bluez.
Thanks for the information, I tried to use qtsixa before but it wasn't working, I'll check your fork of it. Is there any way to get name from udev?
lsusb
reports:
Bus 001 Device 009: ID 054c:0268 Sony Corp. Batoh Device / PlayStation 3 Controller
dmesg
reports:
[ 152.198284] input: SHANWAN PS3 GamePad Motion Sensors as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-2/1-2:1.0/0003:054C:0268.0004/input/input26
[ 152.254670] input: SHANWAN PS3 GamePad as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-2/1-2:1.0/0003:054C:0268.0004/input/input25
[ 152.254818] sony 0003:054C:0268.0004: input,hiddev97,hidraw3: USB HID v81.10 Joystick [SHANWAN PS3 GamePad] on usb-0000:05:00.3-2/input0
I'm guessing SHANWAN PS3 GamePad
is the correct one, but I might be wrong.
from bluez.
FYI - I have fixed shanwan clones in my linux kernel. My fork is dedicated to rockchip compatibility but my patch can be applied to any kernel. This patch directly applies to the issue being described. I do not have any other shanwan or sixaxis devices to test with, but it fixes the issue on mine. It's possible this patch should be adjusted to apply to all shanwan devices, not just the clones. I wrote the patch so that it doesn't interfere with the current shanwan codepath and uses my new clone quirk.
mrfixit2001/rockchip-kernel@b719b93
I should point out that the bluez patch that passes the udev name thru to the kernel is essential to this functionality. So thank you to the bluez devs on that fix.
from bluez.
OK, so I'm sending it to bluez mailing list for merging
from bluez.
@mrfixit2001 Thank you so much for your efforts, but building each new kernel with the patch, it is not something that I would like to do.
@sjanc Thank you so much for your patch. I hope it will be merged soon.
from bluez.
I am continuing to do testing and tweaks to this, when I’m 100% satisfied with it, I’ll submit it to torvalds to hopefully make it into mainline support.
Amazing! I hope it will make it to mainline soon. Thank you for your support.
from bluez.
FYI I've applied sixaxis plugin patch to bluez master
I am glad that is mainlined.
from bluez.
You said nothing about your patches. Is it mainlined yet?
from bluez.
Somehow everything is messed up now. It's nice to see the SHANWAN PS3 Gamepad name now. But they are not acting as PS3 controllers anymore. Rumble does not work and all LED blink instead of showing 1, 2, 3, or 4 single LED. What happened?
I did a test on current Ubuntu and they show up as SONY PLAYSTATION(R)3 controllers and behave like that.
from bluez.
I replied via email but it didn’t show up. So I’m posting manually, but Sorry if this eventually shows up twice.
That could be a few things. Check your dmesg output to confirm what HID driver is being used by your kernel. Mainline Sony driver will only use Shanwan quirks if the name is EXACTLY this, case sensitive with one space between words: SHANWAN PS3 GamePad
If you have any of the sixad sixaxis plugins installed then they will override the name that bluez is assigning and force something like SONY PLAYSTATION(R)3 controller (depending on the sixad fork)
from bluez.
Thank you for your reply. This is my output. Isn't it normal?
[Di Jul 20 22:12:43 2021] sony 0005:054C:0268.002D: unknown main item tag 0x0
[Di Jul 20 22:12:43 2021] input: SHANWAN PS3 GamePad Motion Sensors as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-8/1-8.1/1-8.1.1/1-8.1.1:1.0/bluetooth/hci0/hci0:40/0005:054C:0268.002D/input/input108
[Di Jul 20 22:12:43 2021] input: SHANWAN PS3 GamePad as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-8/1-8.1/1-8.1.1/1-8.1.1:1.0/bluetooth/hci0/hci0:40/0005:054C:0268.002D/input/input107
[Di Jul 20 22:12:43 2021] sony 0005:054C:0268.002D: input,hidraw6: BLUETOOTH HID v80.00 Joystick [SHANWAN PS3 GamePad] on 00:09:dd:10:6f:75
from bluez.
That looks pretty standard, yes. What kernel are you using? If it’s not mainline, Any clue where the source for it is or if the Sony HID driver has been patched at all?
You may want to try removing the device from bluetoothctl and letting bluez re-trust it over usb with the sixaxis plugin enabled.
from bluez.
It's the current standard gentoo kernel. No modifications.
I basically followed this guide: https://wiki.gentoo.org/wiki/Sony_DualShock
Linux game 5.12.17-gentoo-dist #1 SMP Fri Jul 16 08:02:40 CEST 2021 x86_64 AMD Ryzen 9 5950X 16-Core Processor AuthenticAMD GNU/Linux
Edit: How do i know sixaxis plugin is enabled? I have this file on my drive: /usr/lib64/bluetooth/plugins/sixaxis.so
Edit2: Never mind, with debug enabled i see:
bluetoothd[29279]: src/plugin.c:plugin_init() Loading plugins /usr/lib64/bluetooth/plugins
bluetoothd[29279]: src/plugin.c:add_plugin() Loading sixaxis plugin
fftest there is rumble, but on test nothing is vibrating.
game ~ # evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Power Button
/dev/input/event1: Power Button
/dev/input/event2: SONiX USB DEVICE
/dev/input/event3: SONiX USB DEVICE Keyboard
/dev/input/event4: SONiX USB DEVICE
/dev/input/event5: Gaming Mouse
/dev/input/event6: Gaming Mouse Keyboard
/dev/input/event7: PC Speaker
/dev/input/event8: HD-Audio Generic Front Mic
/dev/input/event9: HD-Audio Generic Rear Mic
/dev/input/event10: HD-Audio Generic Line
/dev/input/event11: HD-Audio Generic Line Out Front
/dev/input/event12: HD-Audio Generic Line Out Surround
/dev/input/event13: HD-Audio Generic Line Out CLFE
/dev/input/event14: HD-Audio Generic Front Headphone
/dev/input/event15: SHANWAN PS3 GamePad Motion Sensors
/dev/input/event16: SHANWAN PS3 GamePad
/dev/input/event22: HDA NVidia HDMI/DP,pcm=3
/dev/input/event23: HDA NVidia HDMI/DP,pcm=7
/dev/input/event24: HDA NVidia HDMI/DP,pcm=8
/dev/input/event25: HDA NVidia HDMI/DP,pcm=9
/dev/input/event26: HDA NVidia HDMI/DP,pcm=10
/dev/input/event27: HDA NVidia HDMI/DP,pcm=11
/dev/input/event28: Logitech Logitech G930 Headset Consumer Control
Select the device event number [0-28]: ^C
game ~ # fftest /dev/input/event16
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES
Device /dev/input/event16 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
from bluez.
These Shanwan clones are all so interesting, different, and unpredictable. It sounds like your Shanwan isn’t a true Shanwan (which is very common), meaning in your case it needs to be treated like a normal DS3 instead of a Shanwan device. The kernel driver says the udev name bluez has assigned matches the Shanwan devices so it’s output reports are handled differently - which can cause LED and rumble to not work properly.
It’s possible that you could override bluez’s name assigned to the Mac, but I haven’t found a good way to make that persist. It used to be as simple as editing the files in /var/Bluetooth but i think it’s become more difficult in the latest versions. If you’re able to get it to change then almost ANY other name than that specific Shanwan name should resolve your issue.
If you can’t get the name changed, you could install the sixad driver, which will intercept the comm between bluez and the kernel and handle everything for you. But you may encounter a slight delay right after vibration due to the way it’s programmed.
from bluez.
Related Issues (20)
- bluetoothd crashes sometimes when reconnecting my Bluetooth keyboard HOT 3
- BAP Unicast issue HOT 2
- bluez-daemon crashed, segment error HOT 2
- Remove of remote LE OOB data HOT 2
- no input from gamepad HOT 1
- >=bluez-5.72 fail to build with musl-1.2.5: tools/hex2hcd.c:305:18: error: call to undeclared function 'basename' HOT 1
- No Bluetooth devices connecting HOT 1
- Cannot access org.bluez.obex.* DBus objects
- [5.72] BlueZ repeatedly rejects Connection Parameter Update HOT 25
- Phantom gamepad devices in /dev after disconnecting HOT 8
- Bluetooth not working HOT 20
- Bluetooth Keyboard connectivity issue HOT 1
- Bluez peripheral using DBus API always ask pairing request on Android HOT 3
- Crackling sound after udpating to 5.73 and newer
- When connecting the mouse: No service update HOT 3
- Services not propagating through dbus properly
- initializer element is not constant HOT 2
- Host initiating remove device command resulting device removed from Pair list and LE link also got disconnected.
- Paired mouse is not connecting after shutdown/restart/suspend
- After bluez 5.66 -> 5.72 upgrade, multipoint prioritization is working incorrectly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluez.