It worked! My new hid-sjoy.ko module is definitely picking up my adapter now and gives me two inputs which I can map to player1 / player2 in the UI :-)
But! I may have messed my axis quirks as both the cross buttons and analog sticks seem to be mapped to the same axis.
EDIT: OK, the second pad is definitely stuck in the wrong mode at boot-up. From the docs: 3 different modes for D-Pad: POV mode,Button Mode, and X/Y Analog Axis mode, accessible by pressing and holding “Home” and “L” or “R”. Cycling through the modes on the second pad gets to one where the Main menu can be navigated with both the D-Pad and the Left joystick. Not sure if there’s anything I can do about that, but if I do, I’ll report back.
For now in my hid-quirks.c:
static const struct hid_device_id hid_quirks[] = {
...
{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_WII_CLASSIC), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
HID_QUIRK_MULTI_INPUT is 0×00000040 and HID_QUIRK_NOGET is 0×00000008 … No idea what HID_QUIRK_NOGET does but other multi-input adapters by USB_VENDOR_ID_WISEGROUP have it set.
For reference, here are the steps I took so far (so I don’t forget them):
git clone https://github.com/batocera-linux/batocera.linux
cd batocera.linux
git checkout 5.25_fixes
make clean
make batocera-x86_64_defconfig
make -j4 linux
then add the new device id in hid-ids.h:
#define USB_VENDOR_ID_WISEGROUP 0x0925
#define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005
#define USB_DEVICE_ID_SUPER_JOY_BOX_3 0x8888
#define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800
#define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866
//add this:
#define USB_DEVICE_ID_DUAL_WII_CLASSIC 0x03E8
and find where to put the following in hid-sjoy.c:
{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_WII_CLASSIC),
.driver_data = HID_QUIRK_MULTI_INPUT |
HID_QUIRK_SKIP_OUTPUT_REPORTS },
, then
make -j4 linux-rebuild
I ensured the module_layout matched the existing modules in my working batocera:
modprobe --dump-modversions output/target/lib/modules/5.4.16/kernel/drivers/hid/hid-sjoy.ko | grep module_layout
0xa2d12933 module_layout
I then copied over my new hid-sjoy.ko in output/target/lib/modules/5.4.16/kernel/drivers/hid to my working batocera, in /lib/modules/5.4.16/kernel/drivers/hid … and checked that things work by doing:
# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 012: ID 03f0:354a HP, Inc
Bus 001 Device 018: ID 0925:03e8 Lakeview Research Wii Classic Controller Adapter
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# insmod /lib/modules/5.4.16/kernel/drivers/hid/hid-sjoy.ko
# lsmod | grep hid
hid_sjoy 20480 0
ff_memless 20480 1 hid_sjoy
hid_generic 16384 0
usbhid 65536 0
hid 143360 3 hid_sjoy,hid_generic,usbhid
mac_hid 16384 0
# tail /var/log/messages
Mar 29 20:05:00 batocera user.info kernel: [260471.688701] usb 1-3.1: USB disconnect, device number 19
Mar 29 20:05:02 batocera user.info kernel: [260473.977045] usb 1-3.1: new low-speed USB device number 20 using xhci_hcd
Mar 29 20:05:02 batocera user.info kernel: [260474.085041] usb 1-3.1: New USB device found, idVendor=0925, idProduct=03e8, bcdDevice= 1.00
Mar 29 20:05:02 batocera user.info kernel: [260474.085048] usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Mar 29 20:05:02 batocera user.info kernel: [260474.085052] usb 1-3.1: Product: Mayflash Wii Classic Controller
Mar 29 20:05:02 batocera user.info kernel: [260474.085056] usb 1-3.1: Manufacturer: Mayflash.,Ltd
Mar 29 20:05:02 batocera user.info kernel: [260474.097731] input: Mayflash.,Ltd Mayflash Wii Classic Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/0003:0925:03E8.0012/input/input30
Mar 29 20:05:02 batocera user.info kernel: [260474.157178] input: Mayflash.,Ltd Mayflash Wii Classic Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/0003:0925:03E8.0012/input/input31
Mar 29 20:05:02 batocera user.info kernel: [260474.157480] smartjoyplus 0003:0925:03E8.0012: input,hidraw0: USB HID v1.01 Joystick [Mayflash.,Ltd Mayflash Wii Classic Controller] on usb-0000:00:14.0-3.1/input0
Mar 29 20:05:02 batocera user.info kernel: [260474.157505] smartjoyplus 0003:0925:03E8.0012: Force feedback for SmartJoy PLUS PS2/USB adapter
# ls /dev/input/js*
/dev/input/js0 /dev/input/js1
TODO: I see batocera already patches hid-quirks.c for quite a few joysticks, I’ll see if I can add my own changes to your patch.
EDIT: Batocera uses overlayfs. Let’s see if I got this right (all typed from my batocera box):
# mount -o remount,rw /
# scp 3615ulla@devel-box:/home/3615ulla/projects/batocera.linux/output/target/lib/modules/5.4.16/kernel/drivers/hid/hid-sjoy.ko /lib/modules/5.4.16/kernel/drivers/hid/
# /usr/bin/batocera-save-overlay
Making /boot writable...
Mounting the overlay file...
Saving the real overlay to disk...
sending incremental file list
./
etc/hosts
lib/
lib/modules/
lib/modules/5.4.16/
lib/modules/5.4.16/kernel/
lib/modules/5.4.16/kernel/drivers/
lib/modules/5.4.16/kernel/drivers/hid/
lib/modules/5.4.16/kernel/drivers/hid/hid-sjoy.ko
usr/share/X11/xkb/compiled/
usr/share/batocera/
usr/share/batocera/datainit/
usr/share/batocera/datainit/cheats/
usr/share/batocera/datainit/cheats/cht/
usr/share/batocera/datainit/cheats/cht/FinalBurn Neo/
usr/share/fonts/X11/100dpi/
usr/share/fonts/X11/75dpi/
usr/share/fonts/X11/cyrillic/
usr/share/fonts/X11/encodings/large/
var/run/utmp
sent 9,142 bytes received 161 bytes 18,606.00 bytes/sec
total size is 8,900 speedup is 0.96
Umounting the overlay file...
Making /boot read only...
Synchronizing...
Success.
For some reason, I also had to add the following line to /etc/modules.conf (and save the overlay), otherwise the adapter was just picked-up by hid-generic on reboot:
hid-sjoy
It’s all working now! If you see anything I could’ve done better, do let me know :-)