Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] DualShock3 on USB is really shocking!!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
whOOsch
n00b
n00b


Joined: 12 Feb 2016
Posts: 5

PostPosted: Fri Feb 12, 2016 1:01 pm    Post subject: [Solved] DualShock3 on USB is really shocking!! Reply with quote

Hi all!

I came across a regression when I updated from 4.0 to 4.1 (gentoo-sources). My PS3 controller would not stop rumbling!

I (recently) filled a bug report on bugzilla.kernel.org and even proposed a trivial solution but I can't help thinking how strange it is that I am the only one with a problem. Most distros should be affected by now and DualShock3 is pretty common so I am a little surprised that nobody complained. The current mainline 4.5-rc3 kernel exhibits the same problem, too.

Am I really the only one who uses DualShock3 on USB? If you guys have such controller, would you be so kind as to test it out? That would be helpful :D

The test is easy: just plug the controller and wait for 10-15 seconds. If it starts rumbling on its own, then you have the same problem as I have.



PS: my bug report is here https://bugzilla.kernel.org/show_bug.cgi?id=111811

PS2: I would welcome tests with compatible controllers, as well


Last edited by whOOsch on Sat Feb 20, 2016 1:21 am; edited 1 time in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Fri Feb 12, 2016 2:14 pm    Post subject: Reply with quote

I am not sure on how many guys use such expensive gaming station devices on their computers.

those wiht ps3 are usually ordinary people not linux geeks.

you could make a diff and see where the changes are, you narrowed it slightly down already.
there was a guide on how to bug wrangle a kernel, between two kernels. when you want ot find out whats wrong.



In the past i stuck to some kernel versions because of some issues. nothing unusual when a kernel branch is unuseable

---

it is like with mice, there are a thousands models out there and i am quite sure i used on my personal computer, only at home already around 30-50 different models, because they stop functioning every 6 months average or less.
Back to top
View user's profile Send private message
Myu
Apprentice
Apprentice


Joined: 22 Oct 2014
Posts: 164
Location: Belgium

PostPosted: Fri Feb 12, 2016 7:16 pm    Post subject: Reply with quote

Hello,

I did the test with a Dualshock 3 and after a reboot ( lsusb was hanging ) , I can say that I don't have the bug.

I've the driver compiled as kernel in-build :


.config, kernel 4.1.15-r1


Code:

<*> Sony PS2/3/4 accessories


lsusb :


Code:
Bus 002 Device 003: ID 054c:0268 Sony Corp. Batoh Device / PlayStation 3 Controller

_________________
Gentoo stable with bits of ~amd64 // Xfce 4.13 + Compiz Reloaded.
Back to top
View user's profile Send private message
whOOsch
n00b
n00b


Joined: 12 Feb 2016
Posts: 5

PostPosted: Sun Feb 14, 2016 8:33 am    Post subject: Reply with quote

Thank you both for your inputs.

Now that explains why this bug hasn't been reported: there is probably something particular about my config that triggers it.

For me the bug happens whether I compile the driver as module or built-in. Enabling or disabling force feedback doesn't change anything either.

@Myu: does dmesg shows some init problem? For me it reports this:

Code:

[  340.301159] usb 1-4.3: new full-speed USB device number 5 using ehci-pci
[  340.381783] usb 1-4.3: New USB device found, idVendor=054c, idProduct=0268
[  340.381787] usb 1-4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  340.381790] usb 1-4.3: Product: PS(R) Ga`epad
[  340.381791] usb 1-4.3: Manufacturer: ShanWan
[  350.401168] sony 0003:054C:0268.0004: usb_submit_urb(ctrl) failed: -1
[  350.401194] sony 0003:054C:0268.0004: timeout initializing reports
[  350.401302] input: ShanWan PS(R) Ga`epad as /devices/pci0000:00/0000:00:12.2/usb1/1-4/1-4.3/1-4.3:1.0/0003:054C:0268.0004/input/input8
[  350.401489] sony 0003:054C:0268.0004: input,hiddev0,hidraw3: USB HID v1.10 Joystick [ShanWan PS(R) Ga`epad] on usb-0000:00:12.2-4.3/input0


It has been like that before 4.1, though, so I don't think this is the problem.
As you can seen, there's a 10 seconds timeout delay, that may explain why lsusb hanged.

As I followed the gentoo wiki https://wiki.gentoo.org/wiki/Sony_DualShock, I suppose we have the same hid config, so perhaps my problem lies with the usb config.



@tw04l124: I think I have it down, since there's one line in hid-sony.c that has changed and messes things up for me:

Code:

[1167] ret = hid_hw_output_report(hdev, buf, 1);


However since Myu doesn't have the bug, I guess I should dig in a little further and see what this command does.
Back to top
View user's profile Send private message
Myu
Apprentice
Apprentice


Joined: 22 Oct 2014
Posts: 164
Location: Belgium

PostPosted: Sun Feb 14, 2016 2:17 pm    Post subject: Reply with quote

Nope, nothing :

Code:
dmesg | grep sony
[    2.162503] sony 0003:054C:0268.0002: input,hiddev0,hidraw1: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:1d.0-1.5/input0


More complete log :
Code:
[    2.118949] usb 2-1.5: New USB device found, idVendor=054c, idProduct=0268
[    2.118952] usb 2-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.118953] usb 2-1.5: Product: PLAYSTATION(R)3 Controller
[    2.118954] usb 2-1.5: Manufacturer: Sony
[    2.156579] input: Sony PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/0003:054C:0268.0002/input/input3
[    2.162241] hid-generic 0003:046D:C31C.0001: input,hidraw0: USB HID v1.10 Keyboard [Logitech USB Keyboard] on usb-0000:00:1a.0-1.3/input0
[    2.162503] sony 0003:054C:0268.0002: input,hiddev0,hidraw1: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:1d.0-1.5/input0
[    2.169313] input: Logitech USB Keyboard as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.1/0003:046D:C31C.0003/input/input4
[    2.220200] hid-generic 0003:046D:C31C.0003: input,hidraw2: USB HID v1.10 Device [Logitech USB Keyboard] on usb-0000:00:1a.0-1.3/input1
[    2.293062] usb 1-1.4: new full-speed USB device number 4 using ehci-pci
[    2.343991] usb 2-1.6: new full-speed USB device number 4 using ehci-pci


Strange issue indeed. This controller/driver is sometimes acting up since on my rig if I unplug it after boot, it's not recognized anymore by lsusb ( makes it hangs )
_________________
Gentoo stable with bits of ~amd64 // Xfce 4.13 + Compiz Reloaded.
Back to top
View user's profile Send private message
whOOsch
n00b
n00b


Joined: 12 Feb 2016
Posts: 5

PostPosted: Tue Feb 16, 2016 1:37 pm    Post subject: Reply with quote

I get it.

I didn't pay much attention since I bought for a supposedly trusty vendor (www.fnac.com :evil: ) but mine is a fake. The manufacturer is ShanWan, as indicated by dmesg, but yours is Sony. I thought it was OK since the idVendor=054c is Sony's.
A google search on the serial number 711719805225 (my controller's) has convinced me.

So I got owned. And I paid the price of an official one. I'm quite pissed actually :evil: :evil: :evil: :evil: :evil: :evil: . Yes, quite.


As for your lsusb hanging problem, I don't know. If you plug it after boot, then unplug, does it act up?
Back to top
View user's profile Send private message
Myu
Apprentice
Apprentice


Joined: 22 Oct 2014
Posts: 164
Location: Belgium

PostPosted: Tue Feb 16, 2016 5:08 pm    Post subject: Reply with quote

That's a shame. How come is it a different device if on an official SONY packaging ?

I hope you'll be able to fix it, you seems to know your way around *nix and source code and you've proposed a fix so at least you're not totally without hope.
_________________
Gentoo stable with bits of ~amd64 // Xfce 4.13 + Compiz Reloaded.
Back to top
View user's profile Send private message
whOOsch
n00b
n00b


Joined: 12 Feb 2016
Posts: 5

PostPosted: Sat Feb 20, 2016 1:20 am    Post subject: Reply with quote

Well, the packaging looks like it could very well be an official one.

I'm preparing a patch right now, I'll post it when I'm finished.
Back to top
View user's profile Send private message
whOOsch
n00b
n00b


Joined: 12 Feb 2016
Posts: 5

PostPosted: Sat Feb 20, 2016 10:01 pm    Post subject: Reply with quote

Here we go!

I have diff -up against current gentoo-sources and current mainline. As you can see, things are pretty much the same, so patching any kernel between those two should be easy.

I fixed two bugs: one is the incessant rumbling which this thread is about, the other one is a 10 seconds delay when plugging in the controller.


4.1.15-r1 (gentoo-sources)
Code:
--- /usr/src/linux-4.1.15-gentoo-r1/drivers/hid/hid-sony.c.orig   2016-02-20 22:31:59.725272473 +0100
+++ /usr/src/linux-4.1.15-gentoo-r1/drivers/hid/hid-sony.c   2016-02-20 22:48:52.670259740 +0100
@@ -837,6 +837,16 @@ struct sony_sc {
    __u8 led_count;
 };
 
+/*
+ * The ShanWan PS(R) Ga`epad reports the same id as the Sony SixAxis, therefore
+ * it can't be added to sony_devices[], but we still need to know which one
+ * we're dealing with.
+ */
+static int is_shanwan_gamepad(struct hid_device *hdev)
+{
+   return !strcmp(hdev->name, "ShanWan PS(R) Ga`epad");
+}
+
 static __u8 *sixaxis_fixup(struct hid_device *hdev, __u8 *rdesc,
               unsigned int *rsize)
 {
@@ -891,6 +901,13 @@ static __u8 *sony_report_fixup(struct hi
    struct sony_sc *sc = hid_get_drvdata(hdev);
 
    /*
+    * The ShanWan PS(R) Ga`epad, when used over USB, times out when
+    * initialising reports, but it works just fine without init.
+    */
+   if((sc->quirks & SIXAXIS_CONTROLLER_USB) && is_shanwan_gamepad(hdev))
+      hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
+
+   /*
     * Some Sony RF receivers wrongly declare the mouse pointer as a
     * a constant non-data variable.
     */
@@ -1151,7 +1168,11 @@ static int sixaxis_set_operational_usb(s
    /*
     * Some compatible controllers like the Speedlink Strike FX and
     * Gasia need another query plus an USB interrupt to get operational.
+    * The ShanWan PS(R) Ga`epad doesn't like these additional steps.
     */
+   if(is_shanwan_gamepad(hdev))
+      goto out;
+
    ret = hid_hw_raw_request(hdev, 0xf5, buf, SIXAXIS_REPORT_0xF5_SIZE,
              HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
    if (ret < 0) {


4.5-rc4 (mainline)
Code:
--- /home/tom/Downloads/linux-4.5-rc4/drivers/hid/hid-sony.c.orig   2016-02-14 22:05:20.000000000 +0100
+++ /home/tom/Downloads/linux-4.5-rc4/drivers/hid/hid-sony.c   2016-02-20 22:49:43.681259099 +0100
@@ -1051,6 +1051,16 @@ struct sony_sc {
    __u8 led_count;
 };
 
+/*
+ * The ShanWan PS(R) Ga`epad reports the same id as the Sony SixAxis, therefore
+ * it can't be added to sony_devices[], but we still need to know which one
+ * we're dealing with.
+ */
+static int is_shanwan_gamepad(struct hid_device *hdev)
+{
+   return !strcmp(hdev->name, "ShanWan PS(R) Ga`epad");
+}
+
 static __u8 *sixaxis_fixup(struct hid_device *hdev, __u8 *rdesc,
               unsigned int *rsize)
 {
@@ -1119,6 +1129,13 @@ static __u8 *sony_report_fixup(struct hi
    struct sony_sc *sc = hid_get_drvdata(hdev);
 
    /*
+    * The ShanWan PS(R) Ga`epad, when used over USB, times out when
+    * initialising reports, but it works just fine without init.
+    */
+   if((sc->quirks & SIXAXIS_CONTROLLER_USB) && is_shanwan_gamepad(hdev))
+      hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
+
+   /*
     * Some Sony RF receivers wrongly declare the mouse pointer as a
     * a constant non-data variable.
     */
@@ -1411,7 +1428,11 @@ static int sixaxis_set_operational_usb(s
    /*
     * Some compatible controllers like the Speedlink Strike FX and
     * Gasia need another query plus an USB interrupt to get operational.
+    * The ShanWan PS(R) Ga`epad doesn't like these additional steps.
     */
+   if(is_shanwan_gamepad(hdev))
+      goto out;
+
    ret = hid_hw_raw_request(hdev, 0xf5, buf, SIXAXIS_REPORT_0xF5_SIZE,
              HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
    if (ret < 0) {


:!: Please note that I have NOT tested with mainline. I'm not worried though, this is simple code.

Tests (with any controller) and/or comments are appreciated :wink:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum