LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Games (https://www.linuxquestions.org/questions/linux-games-33/)
-   -   Playstation2 Controller with USB adapter need help getting additional buttons to work (https://www.linuxquestions.org/questions/linux-games-33/playstation2-controller-with-usb-adapter-need-help-getting-additional-buttons-to-work-4175643583/)

ianm42 12-03-2018 10:12 PM

Playstation2 Controller with USB adapter need help getting additional buttons to work
 
Hi all

i tried and checked about a week now to get a PS2 controller working on my linux machine, hardware works fine, the adapter works with same controller on same machine with windows perfectly fine,
unfortunately the following buttons (Square, Circle,X) do not seem to exist in the driver or kernel driver or wherever that info should be available, all others seem to do something, even if i check with (cat /dev/input/eventX) all buttons give some output but not the mentioned ones the 3 ones seem dead and non existent. i found many guides talking about PS3 controller and it being about Bluetooth, but this is hardwired, with an adapter to USB,

i tried antimicro, says same i.e 13 buttons 3 buttons are missing same is in Jstest.
im running Lubuntu Linux 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linu

please help and let me know what else info is needed.

thank you in advance.

Edit: btw. im not sure if this is the best choice of category to post this thread, maybe if needed move it appropriately.


additional Edit:

i ran across this:
http://domisan.sakura.ne.jp/article/psxpad/psxpad.html

it seems a patch for raspi, altough i have no idea, if it is modifiable to work with amd/intel/64bit cpu, any help appreciated, have no experience in patching a kernel or compiling,
here is what i tried

patch -p1 -d /usr/src/linux-headers-4.15.0-42 < psxpad-spi_rp.patch

which gave me this

|diff -uprN linux_org/arch/arm/boot/dts/bcm2708-rpi-0-w.dts linux_alt/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
|--- linux_org/arch/arm/boot/dts/bcm2708-rpi-0-w.dts 2017-05-08 23:58:26.103387000 +0900
|+++ linux_alt/arch/arm/boot/dts/bcm2708-rpi-0-w.dts 2017-04-25 10:57:51.000000000 +0900

i assume the patch is for ARM cpu, and i am wondering if the file is modifiable to work with x86/64 architecture.

and yes i am possibly doing everything wrong, apologies in that case, any help appreciated.

ianm42 12-05-2018 12:49 AM

i wonder what happened this looks empty, the text disappeared but thread remains?

ianm42 12-05-2018 10:07 AM

the post was something along these lines:

i have a USB to Playstation 2 Dual shock2 game controller adapter that is working perfectly fine under windows, unfortunately in linux im running lubuntu 18.04 Linux 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux, and the following 3 buttons dont seem to work/exist square, X and circle, while checking under "cat /dev/input/eventX" all buttons give some response/output but the 3 mentioned ones (sqaure, X and Circle) dont do anything so it appears like they dont exist at all, i wonder what the issue is and if anyone can help with this. thank you in advance.

ianm42 12-08-2018 10:01 PM

hrmm the biggest problem i seem to have is that there is alot of outdated information and it is for me personally impossible to find out which and what i should be looking for to get it running with Ubuntu 18.04 kernel 4.15.0-42, there is talk of SDL2 then there is talk of xboxdrvr, and i actually found that "/dev/usb/hiddev1" in my case, by doing "cat /dev/usb/hiddev1" does give me some output and does give me some output pushing X,Square and Circle, as well as all other buttons, so i thought id simply try to do "ln - n /dev/usb/hiddev1 /dev/input/js0" ofc that got me nothing at all, game controller was not recognized by SDL2, antimicro, Qjoypad, or jstest im ofc 100% sure im doing something wrong, but i might be on the right path to fix this issue??? any input appreciated
i also found this
https://bugs.launchpad.net/ubuntu/+s...ux/+bug/836335

it apeares also to be a bug apparently, this person has exactly the same problem that i seem to have, but well it seems completely abandoned and never fixed. now im not sure if that is actually a fact or not and if there is a replacement for that or some other way to get this working. or if i should just forget about it and throw just my precious Playstation 2 controller into the landfill and contribute to the destruction of our planet further.

ianm42 12-17-2018 07:20 AM

bump

ianm42 12-23-2018 03:10 AM

bump

jeremy 12-24-2018 11:57 AM

Quote:

Originally Posted by ianm42 (Post 5940567)
bump

Please refrain from doing this in the future. LQ is comprised solely of volunteers; as soon as a member who can answer your questions sees it, they will do so.

--jeremy

ianm42 01-05-2019 01:14 AM

sorry apologies for that, what is usually done to avoid something getting buried in the void? what is the normal procedure?, also, no idea how to PM and if its possible at all, question is actually, is this maybe better off in another section of the forum? and if so where? maybe hardware?

Quote:

Originally Posted by jeremy (Post 5940944)
Please refrain from doing this in the future. LQ is comprised solely of volunteers; as soon as a member who can answer your questions sees it, they will do so.

--jeremy


Sliver-X 11-17-2019 05:42 AM

A Fix
 
I connect my Dualshock 1 to my PC with a no-name PS1/PS2 to PS3 adapter I found on Amazon a few years ago.

It works great under Windows with drivers like SCPToolkit (Which makes it act like an Xbox controller), but I ran into the same problem the original poster describes last year when trying to use it with Ubuntu 18.04.

Recently, I gave antiX 17 a spin on my primary PC and was surprised to see that the adapter showed up as a fully working device under it. I did some research and discovered there were changes to the HID driver sometime at or after Linux 4.10 that broke a bunch of third party adapters, such as ours: antiX 17 was running Linux 4.9.16, which has a copy of the sony-hid driver that predates the breaking changes.

So I downloaded Linux 4.9.196's sources (The most recent at the time, as of now it's 4.9.202: I assume it would also work?) and extracted them. Two files were of interest in here:

linux-source-4.9/drivers/hid/hid-sony.c
linux-source-4.9/drivers/hid/hid-ids.h

I then made a Makefile with the following:

Code:

obj-m += hid-sony.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

I then threw all three into a subfolder named hid-sony (I did all this in /tmp: Wherever you want is fine).

In a root terminal at the folder above hid-sony (Again, for me, /tmp), I ran the following:

Code:

cd ./hid-sony

make

rmmod hid_sony
rm -f /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko

cp ./hid-sony.ko /lib/modules/$(uname -r)/kernel/drivers/hid/
insmod /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko

make clean

This entirely replaces the existing driver module with the 4.9 version. After doing this, my gamepad is now fully functional under Ubuntu 18.04, 19.04 and antiX 17 updated to Linux 5.2.8

A downside is that this must be done after every kernel update, but I can live with that.

Titan91 01-19-2020 12:01 PM

Quote:

Originally Posted by Sliver-X (Post 6058782)
I connect my Dualshock 1 to my PC with a no-name PS1/PS2 to PS3 adapter I found on Amazon a few years ago.

It works great under Windows with drivers like SCPToolkit (Which makes it act like an Xbox controller), but I ran into the same problem the original poster describes last year when trying to use it with Ubuntu 18.04.

Recently, I gave antiX 17 a spin on my primary PC and was surprised to see that the adapter showed up as a fully working device under it. I did some research and discovered there were changes to the HID driver sometime at or after Linux 4.10 that broke a bunch of third party adapters, such as ours: antiX 17 was running Linux 4.9.16, which has a copy of the sony-hid driver that predates the breaking changes.

So I downloaded Linux 4.9.196's sources (The most recent at the time, as of now it's 4.9.202: I assume it would also work?) and extracted them. Two files were of interest in here:

linux-source-4.9/drivers/hid/hid-sony.c
linux-source-4.9/drivers/hid/hid-ids.h

I then made a Makefile with the following:

Code:

obj-m += hid-sony.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

I then threw all three into a subfolder named hid-sony (I did all this in /tmp: Wherever you want is fine).

In a root terminal at the folder above hid-sony (Again, for me, /tmp), I ran the following:

Code:

cd ./hid-sony

make

rmmod hid_sony
rm -f /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko

cp ./hid-sony.ko /lib/modules/$(uname -r)/kernel/drivers/hid/
insmod /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko

make clean

This entirely replaces the existing driver module with the 4.9 version. After doing this, my gamepad is now fully functional under Ubuntu 18.04, 19.04 and antiX 17 updated to Linux 5.2.8

A downside is that this must be done after every kernel update, but I can live with that.

This is an AWESOME post. I've been trying to figure out for over a year how to get this adapter working in Linux, particularly on my Raspbian based RetroPie OS. It had the same issue and is running a kernel version that is a few steps newer than 4.10. I downloaded the c and h files from here and put them on the micro SD card. I then booted it up, SSH'd into it, built the module, and replaced it. I didn't have to remove the module as it wasn't loaded due to the adapter not being plugged in. Man, this WORKS!! jstest showed all 18 buttons were responding and I tested this in various RetroArch and LibRetro based emulators without an issue. The only thing I had to do differently was add tabs at the beginning of lines 4 and 7 in your Makefile as Make expects those.

I'm going to link to your post on some other threads I found at other places, and make a WayBack Machine snapshot of this thread. Can't thank you enough, as while this isn't a solution for the current kernel revision, it actually does work. Since I don't update my kernel, I won't have to compile it again. Now I can finally play PSX games with the authentic controller.

Sliver-X 01-24-2020 07:37 PM

I've been using dkms for this.

I made a folder called hid-sony-4.9, which contains the makefile and two source files from the previous method. In this folder, I made a file named dkms.conf:

Code:

PACKAGE_NAME="hid-sony"
PACKAGE_VERSION="4.9"
BUILT_MODULE_NAME[0]="hid-sony"
DEST_MODULE_LOCATION[0]="/kernel/drivers/hid/"
AUTOINSTALL="yes"

Above hid-sony-4.9, I ran the following:

Code:

rmmod hid_sony
rm -f /lib/modules/$(uname -r)/kernel/drivers/hid/hid-sony.ko

cp -r ./hid-sony-4.9 /usr/src/
dkms install -m hid-sony -v 4.9

Now it will be autocompiled by dkms after any kernel upgrade.

I'm linking to a zip file that contains the needed files and two scripts (One for dkms, the other for a straight manual replacement). I make no warranties as to their functionality.

Sony-HID-Downgrader.zip

liOnux.fr 04-20-2020 10:13 AM

Many thanks
 
Thanks a lot Silver-X for your scripts ! It works fine :)

scshumat 05-13-2020 02:17 PM

I just bought a pair of these adapters from Amazon and ran into this same problem - the X, square, and circle buttons do not work in Linux. I decided to do a little digging with usbhid-dump and discovered that the hardware is reporting a USB descriptor with only 13 buttons instead of the requisite 16. I then created a Linux kernel patch that corrects the invalid descriptor and everything is working perfectly now on my system. I submitted a patch to the Linux kernel mailing list so hopefully it will be accepted and will be fixed in an upcoming kernel release.

Here's a description of the patch: https://lkml.org/lkml/2020/5/13/1323

FYI - The kernel commit that breaks these adapters is e19a267b9987. This commit removed a USB descriptor fix-up that masked this problem.

-Scott

Titan91 05-13-2020 03:11 PM

That's VERY much appreciated. With any luck everyone who had this issue over the last few years may have a permanent fix soon!

liOnux.fr 05-14-2020 03:49 AM

I made a tutorial for embedded Linux like Batocera.linux here :

https://forum.batocera.org/d/3796-tu...ap-usb-adaptor

I also hope that Scott's patch will be accepted.
Thank you all for your contributions ;-)

Lionel


All times are GMT -5. The time now is 04:38 PM.