Fix Up/Left joystick direction for THT 2P arcade controller with device ID 0x75e1
-
HW: RaspberryPi3
Retropie: 4.1
USB controller: THT 2P arcade controller with device ID 0x16c0:0x75e1I have compiled a fix for the issue where 2 directions on the joystick are not recognized by the THT 2P arcade controller with device ID 0x75e1.
The issue is previously reported here with a workaround solution:
https://retropie.org.uk/forum/topic/4361/20-pin-xin-mo-wiring-diagram-set-up/9The fix is identical to a fix that was made some time ago and which is included in the raspberry source code:
http://ithink.ch/blog/2013/09/08/patching_the_linux_kernel_to_install_the_xin-mo_dual_arcade_driver_on_a_raspberry_pi.htmlMy patch will simply add the device id of the THT 2P arcade controller to the Xin Mo HID driver source. The device has same vendor ID as XinMo, but a different device ID and name!
Note:
You still need to use the usbhid quirks fix if you want 2 player. Follow this guide
https://retropie.org.uk/forum/topic/1992/tht-tht-arcade-console-2p-usb-player
but use this string:
usbhid.quirks=0x16c0:0x75e1:0x40Procedure:
You have to rebuild the Linux kernel!
Don’t worry it is not that bad. RPI team has made a good and simple guide which works. The easiest method is to build on your rpi locally, but it takes a few hours to compile.
You just have to follow the steps in “Local Building” from https://www.raspberrypi.org/documentation/linux/kernel/building.mdAfter you have downloaded the Linux source you have to apply the changes. Download this file, which has the source changes, to your rpi:
http://pastebin.com/4BMidcJVChange to linux directory and apply the patch with:
git apply <path to patch file>/rpi_tht_2p.patch.txtNow continue with the configuration and build steps from the “Local Building” guide.
Reboot your rpi with:
sudo rebootRetroPi will now recognize all joystick direction and you still have 12 buttons for each player.
This is how my THT 2P arcade controller looks like:
-
Hi
When I apply the patch to the kernel it gives me the following error:
Fatal: patch broken at line 35
Is this normal? Does the patch apply even if the error occurs?
Sorry for my ignorance, I do not know much about linux.
Thank you very much for your work.
Best Regards
-
Please check that your local patch file it is identical to the one from pastebin. Double check line 35, the };
The change is fairly simple so perhaps just edit the changes manually.
-
For anyone else who may be led here searching for a solution to this issue, I just wanted to let people know that there are even more versions of Xin-Mo 2 player boards out there -- ones that even look identical to the photo.
To doublecheck what your id is, type
dmesg
at the shell prompt. You'll get a giant list of stuff. Look for an error in there, something like
usb 1-1.3 device descriptor read/64, error -32
usb 1-1.3 New USB device found, idVendor=16c0, idProduct=XXXXThe XXXX is the device id you need. The patch in this thread adds device id 75e1. Having done this twice now with what looked like the same controller board, I saw one board report 75e1 and work with this patch. The other, however, reported 05e0.
Rather than simply applying the patch, I suggest you instead manually edit these the three files in the patch:
linux/drivers/hid/hid-core.c
linux/drivers/hid/hid-core.c
linux/drivers/hid/hid-xinmo.cAnd add the relevant line and correct device id for your controller.
You will also need to use a usbhid quirks fix that matches the id:
usbhid.quirks=0x16c0:0xXXXX :0x40
-
Hello,
I have another device ID 0x05e0 and my up and left joystick position can still not be detected. My retropie was the latest downloaded few days ago. I followed these guides:
I have changed the cmdline.txt to include "usbhid.quirks=0x16c0:0x05e0:0x040" , and I got the latest kernel and patched and compiled without problem. All I have done was identical to the guides although I replace the original product id of 05e1 to 05e0. Am I doing it correctly? If my up and left still fail, can anyone give any clue to a fix?
I just want to add that my joystick is working correctly as I used it to plug into other machines and the joystick is recognised correctly.
Thanks
Patrick -
@zhaoyun Yes, all you should need to do is apply those three changes with the new id. It worked for me after rebooting the Pi... but I do seem to recall that the first time it came up, it didn't seem to work, and then it did. I wish I had taken better notes as I did it.
I note that I still get usb 1-1.3 device descriptor read/64, error -32 when I check with dmesg. But everything seems to work.
I just noticed that in my summary, I typoed. The three files you need to edit are
linux/drivers/hid/hid-core.c
linux/drivers/hid/hid-core.h
linux/drivers/hid/hid-xinmo.c -
So the OP's patch added his own device id on top of the 0x05e1, while I manually replaced 0x05e1 with my 0x05e0. I do not think it makes any difference as I do not have a 0x05e1 device. The compile process completed without warning and I can see the timestamp of modules installed are updated, so I presume the compile succeeded.
Do you have any idea why the up/left still fail the evtest?
-
Perhaps you'll need to reset the RPI input configuration. Something like:
Manage Packages -> Core Packages -> emulationstation -> Configuration or
Configuration / Tools -> emulationstation
and choose the option to Clear/Reset Emulation Station input configuration
Thn reboot and see if RPI ask for input config at bootup. -
@zhaoyun I just remembered something.
Here is what I did:
- Made the quirks change
- Manually typed in the changes in the three files, rather than patch:
hid_core.c added
{ HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_3H_DUAL_ARCADE) },
hid_core.h added
#define USB_DEVICE_ID_3H_DUAL_ARCADE 0x05e0
hid-xinmo.c added
{ HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_3H_DUAL_ARCADE) },
- Went to follow the guide at https://www.raspberrypi.org/documentation/linux/kernel/building.md but with the following change:
Instead of
make -j4 zImage modules dtbs
Type
make -j4 zImage make -j4 modules make -j4 dtbs
I had found that trying to do all three on one line didn't actually work.
Then proceed with the rest:
sudo make modules_install sudo cp arch/arm/boot/dts/*.dtb /boot/ sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/ sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/ sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
Then reboot.
-
OK I followed the patch kernel guide mentioned in my OP and have only performed a "make" and a "make modules". from what I understand, it should already include zImage and modules, not sure if dtbs is included. Anyway, I'll try to follow exactly the steps you mentioned to compile again. Let you know the result later.
-
If you didn't do below steps you never installed the new kernel. You have only compiled it.
sudo make modules_install
sudo cp arch/arm/boot/dts/.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img -
I have done this already. I have even quit to the command and run both evtest and jstest and both cannot detect up/left motion. So I believe it is more likely a device/kernel matter rather than emulationstation config matter.
-
@stuntstein said in Fix Up/Left joystick direction for THT 2P arcade controller with device ID 0x75e1:
If you didn't do below steps you never installed the new kernel. You have only compiled it.
sudo make modules_install
sudo cp arch/arm/boot/dts/.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.imgYeah I have done "make install" and "make modules_install", but not the subsequent four lines of sudo cp. I assume make install at least do the zImage line, not sure if it also performed the dts lines.
-
Ok, it just sounded like you only did the make.
Can you check the build date of the running kernel to make sure that it is running yours? -
@stuntstein said in Fix Up/Left joystick direction for THT 2P arcade controller with device ID 0x75e1:
Ok, it just sounded like you only did the make.
Can you check the build date of the running kernel to make sure that it is running yours?I have forgotten most linux commands. Should I use "uname -a" to check build date?
-
@zhaoyun said in Fix Up/Left joystick direction for THT 2P arcade controller with device ID 0x75e1:
I have forgotten most linux commands. Should I use "uname -a" to check build date?
Try it.
According to my master, Google, you should use uname -v for "kernel version information" :-)
https://unix.stackexchange.com/questions/264833/find-linux-kernel-build-date-time -
At this point, I'd type in all three make -j4 lines. If they are current, it'll just say so and finish quickly. If not, then you are catching something that didn't compile.
The first time I tried this process, and put the three targets on one line after make, it resulted in a built kernel that was half and half... which I then copied over, and I had to wipe the SD card and start from scratch :)
I wouldn't follow the ithink.ch kernel building guide. I would follow the one at https://www.raspberrypi.org/documentation/linux/kernel/building.md
-
@rkoster said in Fix Up/Left joystick direction for THT 2P arcade controller with device ID 0x75e1:
At this point, I'd type in all three make -j4 lines. If they are current, it'll just say so and finish quickly. If not, then you are catching something that didn't compile.
The first time I tried this process, and put the three targets on one line after make, it resulted in a built kernel that was half and half... which I then copied over, and I had to wipe the SD card and start from scratch :)
I wouldn't follow the ithink.ch kernel building guide. I would follow the one at https://www.raspberrypi.org/documentation/linux/kernel/building.md
It took me several days to discover that the -j4 flag caused instability to my original version of pi which held up the compiling process, and it took me another couple of days to finally finish the compile. And I wish to update you that the pi can now recognise the joystick.
But the compiling really took a lot of time and I guess a lot of unnecessary modules were compiled. I am now trying to compile again using localmodconfig rather than bcmrpi_defconfig as the config set. I believe it takes much less time and still get the result.
Anyway, I think the emulator itself is another challenge, especially the mame. I totally don't know how the roms can be run. But this is another story......thanks everyone anyway.
-
Hi Zhaoyun,
Glad that you finally got it working. If you find a quicker way to build please let us know.
I was considering building on a more powerful linux machine but never found time to set it up. -
@zhaoyun Hi man! I'm having the left up problem with a 05e0 controller and I was going to follow this guide
http://ithink.ch/blog/2013/09/08/patching_the_linux_kernel_to_install_the_xin-mo_dual_arcade_driver_on_a_raspberry_pi.html
then I wanted to search for more info and I saw that the patch in that guide is for 0x05e1. I saw that you could resolve the problem with 05e0 and if you could make me a guide or explain me how did you do that I would really appriciate. I don't know nothing about this things and I don't even know how to edit the patch to change to 05e0.
hope you see this and can help me cause you will really save me the day. thanks a lot.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.