Skip to content

honux77/ist-ps3-st-joystick-linux-patch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hid-sony patch for IST SOLUTION PS3 Controller

A kernel module patch that fixes the IST SOLUTION PS3 (ST) joystick not working on Linux.

Problem

The IST SOLUTION PS3 controller uses Sony's VID/PID (054c:0268), so the hid-sony kernel driver claims the device. However, the driver fails because it tries to fetch a Sixaxis MAC address via feature report 0xf2, which this clone controller does not implement.

dmesg before patch:

sony 0003:054C:0268.000D: failed to retrieve feature report 0xf2 with the Sixaxis MAC address
sony 0003:054C:0268.000D: hiddev3,hidraw8: USB HID v81.00 Joystick [IST SOLUTION INC. IST SOLUTION PS3 (ST)] on usb-...
sony 0003:054C:0268.000D: failed to claim input

dmesg after patch:

sony 0003:054C:0268.000E: failed to retrieve feature report 0xf2 with the Sixaxis MAC address; duplicate check skipped
sony 0003:054C:0268.000E: can't set operational mode: step 1; assuming already operational
input: IST SOLUTION INC. IST SOLUTION PS3 (ST) as /devices/...
sony 0003:054C:0268.000E: input,hiddev3,hidraw8: USB HID v81.00 Joystick [IST SOLUTION INC. IST SOLUTION PS3 (ST)] on usb-...

How it works

Two changes are made to hid-sony.c:

  1. sony_check_add() — When feature report 0xf2 (Sixaxis MAC address) cannot be retrieved, skip the duplicate-connection check and continue instead of returning an error.

  2. sixaxis_set_operational_usb() — When step 1 of the operational mode setup fails, assume the device is already operational and continue.

Both failures become non-fatal warnings, allowing the input device to register normally.

Supported devices

Product idVendor idProduct
IST SOLUTION PS3 (ST) 054c 0268

May also help other PS3-compatible clone controllers that share Sony's VID/PID but do not implement feature report 0xf2.

Tested on

Distro Kernel
Arch Linux 6.18.9-arch1-2 (standard)
Arch Linux 6.18.9-arch1-2-15khz (custom 15khz patch)
Ubuntu / Linux Mint standard linux-headers

Installation

Arch Linux

1. Install dependencies

sudo pacman -S base-devel linux-headers wget

LTS 커널 사용 중이면 linux-lts-headers 를 설치하세요.

2. Download sources

mkdir -p ~/ist-ps3-driver/src && cd ~/ist-ps3-driver

KVER=$(uname -r | sed 's/-.*//')
wget "https://raw.githubusercontent.com/torvalds/linux/v${KVER}/drivers/hid/hid-sony.c" -O src/hid-sony.c
wget "https://raw.githubusercontent.com/torvalds/linux/v${KVER}/drivers/hid/hid-ids.h"  -O src/hid-ids.h

If the tag does not exist on GitHub, try master instead of v${KVER}.

3. Apply patch

wget "https://raw.githubusercontent.com/honux77/ist-ps3-driver/main/ist-ps3.patch"
patch -p1 -d src < ist-ps3.patch

4. Build & install

echo 'obj-m := hid-sony.o' > src/Kbuild
make -C /lib/modules/$(uname -r)/build M=$(pwd)/src modules

zstd -19 -f src/hid-sony.ko -o src/hid-sony.ko.zst
sudo cp /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst \
        /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst.bak
sudo cp src/hid-sony.ko.zst /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst
sudo depmod -a
sudo rmmod hid_sony 2>/dev/null; sudo modprobe hid_sony

Note: After a kernel update (pacman -Syu) the module reverts to the original. Re-run step 4, or use the DKMS method below to automate this.


Arch Linux (DKMS — recommended)

DKMS automatically rebuilds the module after every kernel update.

sudo pacman -S dkms linux-headers

# After completing steps 1–4 above:
sudo mkdir -p /usr/src/hid-sony-ist-1.0
sudo cp ~/ist-ps3-driver/src/hid-sony.c  /usr/src/hid-sony-ist-1.0/
sudo cp ~/ist-ps3-driver/src/hid-ids.h   /usr/src/hid-sony-ist-1.0/
sudo cp ~/ist-ps3-driver/src/Kbuild      /usr/src/hid-sony-ist-1.0/

sudo tee /usr/src/hid-sony-ist-1.0/dkms.conf << 'EOF'
PACKAGE_NAME="hid-sony-ist"
PACKAGE_VERSION="1.0"
BUILT_MODULE_NAME[0]="hid-sony"
DEST_MODULE_LOCATION[0]="/kernel/drivers/hid"
STRIP[0]="no"
AUTOINSTALL="yes"
EOF

sudo dkms add hid-sony-ist/1.0
sudo dkms build hid-sony-ist/1.0
sudo dkms install hid-sony-ist/1.0
sudo rmmod hid_sony 2>/dev/null; sudo modprobe hid_sony

Check DKMS status:

dkms status
# hid-sony-ist/1.0, 6.18.9-arch1-2, x86_64: installed

Remove:

sudo dkms remove hid-sony-ist/1.0 --all
sudo rm -rf /usr/src/hid-sony-ist-1.0

Ubuntu / Linux Mint

1. Install dependencies

sudo apt install build-essential linux-headers-$(uname -r) wget zstd

2. Download sources

mkdir -p ~/ist-ps3-driver/src && cd ~/ist-ps3-driver

KVER=$(uname -r | cut -d- -f1)
wget "https://raw.githubusercontent.com/torvalds/linux/v${KVER}/drivers/hid/hid-sony.c" -O src/hid-sony.c
wget "https://raw.githubusercontent.com/torvalds/linux/v${KVER}/drivers/hid/hid-ids.h"  -O src/hid-ids.h

3. Apply patch

wget "https://raw.githubusercontent.com/honux77/ist-ps3-driver/main/ist-ps3.patch"
patch -p1 -d src < ist-ps3.patch

4. Build & install

echo 'obj-m := hid-sony.o' > src/Kbuild
make -C /lib/modules/$(uname -r)/build M=$(pwd)/src modules

zstd -19 -f src/hid-sony.ko -o src/hid-sony.ko.zst
sudo cp /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst \
        /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst.bak
sudo cp src/hid-sony.ko.zst /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst
sudo depmod -a
sudo rmmod hid_sony 2>/dev/null; sudo modprobe hid_sony

Verify

Plug in the controller and check:

dmesg | grep -i sony | tail -5

The output should include input,hiddev (not just hiddev) and have no failed to claim input.

Test inputs:

# Install joystick utils if needed
# Ubuntu: sudo apt install joystick
# Arch:   sudo pacman -S joyutils

jstest /dev/input/js0

Reverting

sudo cp /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst.bak \
        /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko.zst
sudo depmod -a
sudo rmmod hid_sony 2>/dev/null; sudo modprobe hid_sony

Patch file

For reference, the full diff applied to hid-sony.c:

--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1147,7 +1147,8 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev)
 	if (ret < 0) {
-		hid_err(hdev, "can't set operational mode: step 1\n");
-		goto out;
+		hid_warn(hdev, "can't set operational mode: step 1; assuming already operational\n");
+		ret = 0;
+		goto out;
 	}
@@ -1811,8 +1811,8 @@ static int sony_check_add(struct sony_sc *sc)
 		if (ret != SIXAXIS_REPORT_0xF2_SIZE) {
-			hid_err(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address\n");
-			ret = ret < 0 ? ret : -EINVAL;
-			goto out_free;
+			hid_warn(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address; duplicate check skipped\n");
+			ret = 0;
+			goto out_free;
 		}

License

The patch targets hid-sony.c which is licensed under GPL-2.0-or-later. This project is likewise released under GPL-2.0-or-later.

About

Linux Module Patch for IST PS3 ST joystick

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages