HuiJia USB GamePad

Hello,

i have a mayflash adapter with 2 ports for saturn controller, i want to use autoconf feature with it but there is an issue : both controller are recognized as one device node with 32 buttons (0->15 for controller 1, 16->31 for controller 2). I tried adding 2 files like this in my autoconf dir :

file 1:

input_device = “HuiJia USB GamePad” input_driver = “udev” input_b_btn = “0” input_y_btn = “3” input_select_btn = “5” input_start_btn = “7” input_up_btn = “12” input_down_btn = “14” input_left_btn = “15” input_right_btn = “13” input_a_btn = “1” input_x_btn = “4” input_l_btn = “6” input_r_btn = “2” input_exit_emulator_btn = “9”

file 2:

input_device = “HuiJia USB GamePad” input_driver = “udev” input_b_btn = “16” input_y_btn = “19” input_select_btn = “21” input_start_btn = “23” input_up_btn = “28” input_down_btn = “30” input_left_btn = “31” input_right_btn = “29” input_a_btn = “17” input_x_btn = “20” input_l_btn = “22” input_r_btn = “18” input_exit_emulator_btn = “25”

but no success. Is there a way to configure both controller on this adapter with autoconf ?

Thanks in advance.

No answer ? Impossible ? I change adapters/controllers a lot and i really want a more console-like experience.

Should i go with disabling autoconf and running something similar to this : retroarch-joyconfig -i file1.cfg -p 1 -j 0 retroarch-joyconfig -i file2.cfg -p 2 -j 0 through udev rules ?

I’m not sure what can be done about it if it sees it as a single controller. You can try manually mapping the buttons in the main retroarch.cfg. No clue if that will help or not, though.

Btw, i mentioned saturn adapter but the same applies for my PS/PS2 2 ports adapter to usb (which is not from mayflash but is also recognized as “HuiJia USB Gamepad”) and probably many other 2 ports adapter to usb recognized as HuiJia USB Gamepad.

Since you have no solution at the moment, i’ll develop script(s) i’ll call through udev rules to manipulate main retroarch.cfg, hoping there’ll be a clean method through autoconf someday.

Thanks anyway !

I found out a solution by modifying kernel source and recompiling it, basically i added :

#define USB_DEVICE_ID_GREENASIA_DUAL_SS_JOYPAD 0x3010 #define USB_DEVICE_ID_GREENASIA_DUAL_PS_JOYPAD 0x1006

to drivers/hid/hid-ids.h And

{ USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_SS_JOYPAD, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_PS_JOYPAD, HID_QUIRK_MULTI_INPUT },

to drivers/hid/usbhid/hid-quirks.c

Now each adapters are recognized as 2 joystick

Now i have another issue with autoconf, both my adapters (PS and SS) will name my joypads “HuiJia USB GamePad”, i need to differentiate them since i can’t have the same mapping for PS pads and SS pads. udevadm info return this :

looking at device ‘/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2/3-1.2:1.0/0003:0E8F:1006.000B/input/input30/js0’: KERNEL==“js0” SUBSYSTEM==“input” DRIVER==""

looking at parent device ‘/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2/3-1.2:1.0/0003:0E8F:1006.000B/input/input30’: KERNELS==“input30” SUBSYSTEMS==“input” DRIVERS=="" ATTRS{name}==“HuiJia USB GamePad” ATTRS{phys}==“usb-0000:00:1a.0-1.2/input0” ATTRS{uniq}=="" ATTRS{properties}==“0”

looking at parent device ‘/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2/3-1.2:1.0/0003:0E8F:1006.000B’: KERNELS==“0003:0E8F:1006.000B” SUBSYSTEMS==“hid” DRIVERS==“hid-generic”

looking at parent device ‘/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2/3-1.2:1.0’: KERNELS==“3-1.2:1.0” SUBSYSTEMS==“usb” DRIVERS==“usbhid” ATTRS{bInterfaceClass}==“03” ATTRS{bInterfaceSubClass}==“00” ATTRS{bInterfaceProtocol}==“00” ATTRS{bNumEndpoints}==“01” ATTRS{supports_autosuspend}==“1” ATTRS{bAlternateSetting}==" 0" ATTRS{bInterfaceNumber}==“00”

looking at parent device ‘/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2’: KERNELS==“3-1.2” SUBSYSTEMS==“usb” DRIVERS==“usb” ATTRS{bDeviceSubClass}==“00” ATTRS{bDeviceProtocol}==“00” ATTRS{devpath}==“1.2” ATTRS{idVendor}==“0e8f” ATTRS{speed}==“1.5” ATTRS{bNumInterfaces}==" 1" ATTRS{bConfigurationValue}==“1” ATTRS{bMaxPacketSize0}==“8” ATTRS{busnum}==“3” ATTRS{devnum}==“7” ATTRS{configuration}=="" ATTRS{bMaxPower}==“300mA” ATTRS{authorized}==“1” ATTRS{bmAttributes}==“80” ATTRS{bNumConfigurations}==“1” ATTRS{maxchild}==“0” ATTRS{bcdDevice}==“0110” ATTRS{avoid_reset_quirk}==“0” ATTRS{quirks}==“0x0” ATTRS{version}==" 1.10" ATTRS{urbnum}==“13” ATTRS{ltm_capable}==“no” ATTRS{manufacturer}=="HuiJia " ATTRS{removable}==“removable” ATTRS{idProduct}==“1006” (or “3010” for the SS one) ATTRS{bDeviceClass}==“00” ATTRS{product}==“USB GamePad” …

I thought writing an udev rule like this would work :

SUBSYSTEMS==“usb”, ATTRS{idVendor}==“0e8f”, ATTRS{idProduct}==“3010”, ATTRS{product}=“USB GamePad SS” SUBSYSTEMS==“usb”, ATTRS{idVendor}==“0e8f”, ATTRS{idProduct}==“1006”, ATTRS{product}=“USB GamePad PS”

but no success. I know this is not exactly the right place to discuss about udev rules, but if someone was kind enough to point my mistake, i would be really happy.

Ok, it seems i won’t be able to change attr{name} on js*, and i suppose autoconf is based on it. Is there any “hidden parameter” in autoconf files i could use to differentiate between distinct devices with same attr{name} ?

I don’t think so. AFAIK, it’s designed to recognize a device family and map them all the same.

udevadm info -p $(udevadm info -q path -n /dev/input/js0) P: /devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.1/3-1.1:1.0/0003:0E8F:3010.000B /input/input30/js0 N: input/js0 S: input/by-id/usb-HuiJia_USB_GamePad-joystick S: input/by-path/pci-0000:00:1a.0-usb-0:1.1:1.0-joystick E: DEVLINKS=/dev/input/by-id/usb-HuiJia_USB_GamePad-joystick /dev/input/by-path/ pci-0000:00:1a.0-usb-0:1.1:1.0-joystick E: DEVNAME=/dev/input/js0 E: DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.1/3-1.1:1.0/0003:0E8F:3 010.000B/input/input30/js0 E: ID_BUS=usb E: ID_FOR_SEAT=input-pci-0000_00_1a_0-usb-0_1_1_1_0 E: ID_INPUT=1 E: ID_INPUT_JOYSTICK=1 E: ID_MODEL=USB_GamePad E: ID_MODEL_ENC=USB\x20GamePad E: ID_MODEL_ID=3010 E: ID_PATH=pci-0000:00:1a.0-usb-0:1.1:1.0 E: ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_1_1_0 E: ID_REVISION=0111 E: ID_SERIAL=HuiJia_USB_GamePad E: ID_TYPE=hid E: ID_USB_DRIVER=usbhid E: ID_USB_INTERFACES=:030000: E: ID_USB_INTERFACE_NUM=00 E: ID_VENDOR=HuiJia E: ID_VENDOR_ENC=HuiJia\x20 E: ID_VENDOR_ID=0e8f E: MAJOR=13 E: MINOR=0 E: NAME=HuiJia USB GamePad SS E: SUBSYSTEM=input E: TAGS=:seat:uaccess: E: USEC_INITIALIZED=38629448705

I finally managed to change something useful (NAME) in udev, but it seems you don’t use it for autoconf, while you actually use ID_INPUT_JOYSTICK for player number :confused:

I saw there was 2 new parameters in autoconf joypad cfg files : input_vendor_id input_product_id But i think those parameters are only used on android at the moment. Do you plan on adding this to udev later ? It would resolve my problem.

After checking retroarch udev input sources, i tried again today, thinking it would work, but it didn’t, here are my cfg files : HuiJia_USB_Gamepad_GC.cfg

input_device = “HuiJia USB GamePad” input_driver = “udev” input_vendor_id = 6708 input_product_id = 63237 input_b_btn = “2” input_y_btn = “3” input_select_btn = “7” input_start_btn = “9” input_up_btn = “12” input_down_btn = “14” input_left_btn = “15” input_right_btn = “13” input_a_btn = “1” input_x_btn = “0” input_l_btn = “4” input_r_btn = “5” input_l_x_plus_axis = “+0” input_l_x_minus_axis = “-0” input_l_y_plus_axis = “+1” input_l_y_minus_axis = “-1” input_r_x_plus_axis = “+5” input_r_x_minus_axis = “-5” input_r_y_plus_axis = “+2” input_r_y_minus_axis = “-2”

HuiJia_USB_Gamepad_SS.cfg

input_device = “HuiJia USB GamePad” input_vendor_id = 3727 input_product_id = 12304 input_driver = “udev” input_b_btn = “0” input_y_btn = “3” input_select_btn = “5” input_start_btn = “7” input_up_btn = “12” input_down_btn = “14” input_left_btn = “15” input_right_btn = “13” input_a_btn = “1” input_x_btn = “4” input_l_btn = “6” input_r_btn = “2” input_enable_hotkey_btn = “9” input_menu_toggle_btn = “7” input_exit_emulator_btn = “5” input_toggle_fast_forward_btn = “6”

Whatever the adapter, he load the same joypad mapping, what am i doing wrong ?

This happens because RetroArch detection code’s current behavior is that it will stop to loop over the config files when one with either name or vid:pid is found. RetroArch detection code have to be modified to give more weight if both the name and the vid:pid matches.

I have experienced this same issue, I created a autoconf file for “Mayflash GC to USB Adapter” that has input_device = “HuiJia USB GamePad”, input_vendor_id = 6708, and input_product_id = 63237 (the same as your HuiJia_USB_Gamepad_GC.cfg), it failed in RetroArch auto detection because of another autoconf file with the same input_device = “HuiJia USB GamePad”, but they had different pid:vid.

I submitted this autoconf file to the retroarch-joypad-autoconfig github repository, https://github.com/libretro/retroarch-joypad-autoconfig/pull/51, I also explaining the problem I experienced and the project owners have seen this and confirmed this issue. Hopefully it will be fixed soon :smiley:

I see Mayflash has several (older and newer) USB adapters that identify them with the same input_device name (HuiJia USB GamePad), but they do have different vid:pid.