PS3 controller - SHANWAN

I have a ps3 controller but I have the following problem:

  • if I connect by USB it works but the controller never stop to vibrate
  • I cannot manage to connect it via Bluetooth

$ dmesg

[ 3535.328372] input: SHANWAN PS3 GamePad as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:054C:0268.0001/input/input16
[ 3535.329083] sony 0003:054C:0268.0001: input,hiddev0,hidraw0: USB HID v1.10 Joystick [SHANWAN PS3 GamePad] on usb-0000:00:14.0-1/input0
  • How can I properly setup SHANWAN controller on Linux ?
  • Or Where I should I submit a bug report

SHANWAN are not original controller but:

  • they works fine on Windows
  • they are most of not original controller are SHANWAN
2

1 Answer

Just figured out how to fix vibration on Ubuntu for Shanwan controllers attached to USB.

The fix was found here :

File linux.../drivers/hid/hid-sony.c should be modified in kernel sources and kernel should be recompiled.

I've slightly changed it (to adapt for any Sony PS3 gamepad copy with producer "ShanWan" or "SHANWAN" - my version has capital names):

struct sony_sc { __u8 led_count; };
+/*
+ * The ShanWan 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 strstr(hdev->name, "ShanWan") || strstr(hdev->name, "SHANWAN) ;
+}
+ static __u8 *sixaxis_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) {
<..........>
static __u8 *sony_report_fixup(struct hi struct sony_sc *sc = hid_get_drvdata(hdev); /*
+ * The ShanWan gamepades 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. */
<...........>
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 gamepads 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) { 

The kernel download and compile can be found here: after sources download, modify hid-sony.c accordingly and compile.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like