HID compliant USB driver

[QUOTE=Frozen_Fish;38656]I’m trying to write a driver for my Qanba Q4RAF arcade stick. I was able to get the left stick axis working without much trouble, but no matter what I do I can’t get the buttons or d-pad to work (The Q4RAF has a switch that swaps the single physical joystick between controlling the left stick and the d-pad FYI).

Here’s the info from HIDTest:


80 7F 80 7F 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Left Stick Horizontal (Byte 00):
Range = 00 - FF
Left = 00
Centre = 80
Right = FF

Left Stick Vertical (Byte 01):
Range = 00 - FF
Up = 00
Centre = 7F
Down = FF

Right Stick Horizontal (Byte 02):
Physically inaccessible

Right Stick Vertical (Byte 03):
Physically inaccessible

Hat (Byte 04):
Neutral = 0F
Up = 00
UpRight = 01
Right = 02
RightDown = 03
Down = 04
DownLeft = 05
Left = 06
LeftUp = 07

Face Buttons (Byte 05):
None = 00
A = 01
B = 02
X = 04
Y = 08
RB = 10
LB = 20
RT = 40
LT = 80

Other Buttons (Byte 06):
None = 00
Select = 01
Start = 02
Home = 10

Here’s what I have so far:


/*  RetroArch - A frontend for libretro.
 *  Copyright (C) 2013-2014 - Jason Fetters
 *  Copyright (C) 2011-2016 - Daniel De Matteis
 *
 *  RetroArch is free software: you can redistribute it and/or modify it under the terms
 *  of the GNU General Public License as published by the Free Software Found-
 *  ation, either version 3 of the License, or (at your option) any later version.
 *
 *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 *  PURPOSE.  See the GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along with RetroArch.
 *  If not, see <http://www.gnu.org/licenses/>.
 */

#include <stdint.h>
#include <string.h>
#include <stdlib.h>

#include <boolean.h>
#include "joypad_connection.h"

#include "../input_defines.h"

struct hidpad_qanbaq4raf_data
{
   struct pad_connection* connection;
   uint8_t data[64];
   uint32_t slot;
   uint64_t buttons;
};

static void* hidpad_qanbaq4raf_init(void *data, uint32_t slot, send_control_t ptr)
{
   struct pad_connection* connection = (struct pad_connection*)data;
   struct hidpad_qanbaq4raf_data* device    = (struct hidpad_qanbaq4raf_data*)
      calloc(1, sizeof(struct hidpad_qanbaq4raf_data));

   if (!device)
      return NULL;

   if (!connection)
   {
      free(device);
      return NULL;
   }

   device->connection   = connection;
   device->slot         = slot;

   return device;
}

static void hidpad_qanbaq4raf_deinit(void *data)
{
   struct hidpad_qanbaq4raf_data *device = (struct hidpad_qanbaq4raf_data*)data;

   if (device)
      free(device);
}

static uint64_t hidpad_qanbaq4raf_get_buttons(void *data)
{
   struct hidpad_qanbaq4raf_data *device = (struct hidpad_qanbaq4raf_data*)data;
   if (!device)
      return 0;
   return device->buttons;
}

static int16_t hidpad_qanbaq4raf_get_axis(void *data, unsigned axis)
{
   int val;
   struct hidpad_qanbaq4raf_data *device = (struct hidpad_qanbaq4raf_data*)data;

   if (!device || axis >= 2)
      return 0;
  
   val = device->data[1 + axis];
   val = (val << 8) - 0x8000;

   return (abs(val) > 0x1000) ? val : 0;
}

#define Q4_H_GET(a) (a & 0x0F) /*HAT MASK = 0x0F */
#define Q4_H_LEFT(a) (a == 0x05) || (a == 0x06) || (a == 0x07)
#define Q4_H_RIGHT(a) (a == 0x01) || (a == 0x02) || (a == 0x03)
#define Q4_H_UP(a) (a == 0x07) || (a == 0x00) || (a == 0x01)
#define Q4_H_DOWN(a) (a == 0x03) || (a == 0x04) || (a == 0x05)

static void hidpad_qanbaq4raf_packet_handler(void *data, uint8_t *packet, uint16_t size)
{
   uint32_t i, pressed_keys;
   //int16_t hat_value;
   static const uint32_t button_mapping[13] =
   {
      RETRO_DEVICE_ID_JOYPAD_A,
      RETRO_DEVICE_ID_JOYPAD_B,
      RETRO_DEVICE_ID_JOYPAD_X,
      RETRO_DEVICE_ID_JOYPAD_Y,
      RETRO_DEVICE_ID_JOYPAD_R,
      RETRO_DEVICE_ID_JOYPAD_L,
      RETRO_DEVICE_ID_JOYPAD_R2,
      RETRO_DEVICE_ID_JOYPAD_L2,
      RETRO_DEVICE_ID_JOYPAD_SELECT,
      RETRO_DEVICE_ID_JOYPAD_START,
      NO_BTN,
      NO_BTN,
      16,
   };
   struct hidpad_qanbaq4raf_data *device = (struct hidpad_qanbaq4raf_data*)data;
   
   if (!device)
      return;
   
   memcpy(device->data, packet, size);
   
   device->buttons = 0;
   
   pressed_keys = device->data[6] | (device->data[7] << 8);
   
   for (i = 0; i < 13; i ++)
      if (button_mapping[i] != NO_BTN)
         device->buttons |= (pressed_keys & (1 << i)) ? (UINT64_C(1) << button_mapping[i]) : 0;
     
   /* Now process the hat values as if they were pad buttons */
   //hat_value = Q4_H_GET(device->data[5]);
   //device->buttons |= Q4_H_LEFT(hat_value) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
   //device->buttons |= Q4_H_RIGHT(hat_value) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;
   //device->buttons |= Q4_H_UP(hat_value) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP) : 0;
   //device->buttons |= Q4_H_DOWN(hat_value) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
}

static void hidpad_qanbaq4raf_set_rumble(void *data,
      enum retro_rumble_effect effect, uint16_t strength)
{
    (void)data;
    (void)effect;
   (void)strength;
}

const char * hidpad_qanbaq4raf_get_name(void *data)
{
    (void)data;
    /* For now we return a single static name */
    return "QanBa Joystick Plus";
}

pad_connection_interface_t pad_connection_qanbaq4raf = {
   hidpad_qanbaq4raf_init,
   hidpad_qanbaq4raf_deinit,
   hidpad_qanbaq4raf_packet_handler,
   hidpad_qanbaq4raf_set_rumble,
   hidpad_qanbaq4raf_get_buttons,
   hidpad_qanbaq4raf_get_axis,
   hidpad_qanbaq4raf_get_name,
};

I’ve done as netux79 suggested and added 1 to the actual index of each byte I want to read. No button inputs are detected and if I uncomment the hat processing code, I get a constant up press in the Retroarch menu, meaning device->data[5] is 0x00 when I’d expect it to be 0x0F. I’ve also tried every value from 0 - 8 as indexes for the hat switch and none have worked.

Any help is appreciated.[/QUOTE]

hi Frozen_Fish, I will give it a look later and give you some input to see if we can make it work… I see you provided the info from the Nintendont tool to see the values from the buttons so it should not be a problem.

That would be much appreciated :slight_smile:

Also thanks SuperSpongo for your help and suggestions.

Yeah, no problem. I was kinda running out of ideas, aswell.

One last thing I thought of was somehow using the text output for debug purposes. The one that tells you ingame, what controller gets connected via USB. But I don’t know if that is even possible.

[QUOTE=SuperSpongo;38721]Yeah, no problem. I was kinda running out of ideas, aswell.

One last thing I thought of was somehow using the text output for debug purposes. The one that tells you ingame, what controller gets connected via USB. But I don’t know if that is even possible.[/QUOTE]

Yeah, I was looking into making an OSD message or writing to the log file but I couldn’t figure it out. I’ll keep trying. Thanks again.

hi Frozen_Fish,

I had finally the time to check your code and guess what, it seems correct to me… you did the correct changes to make it work and also your autoconfig seems ok! Now, it seems you are receiving data when the switch is in analog mode right? I will suggest that you try that way first… I mean, forget for a moment the HAT stuff and check that the bytes from the buttons actually have values…

I may say that if it actually works and shows something with the nintendont tool it should work with Retroarch as it uses the same process to get the data… Just be sure you use the same info that this tool provides… something weird I noticed in your comments is that RA returns 8 as the size and at the very beginning I see you put the data from the hidtool and see 20 bytes… be sure it is 20 bytes or 8 bytes… regularly it is 8 bytes for standard controllers.

Other thing that could help is that please provide the config file for this controller from nintendont, there is a file for each supported controller, that could help me see if the controller has a special setup but I doubt it it look very standard… also be sure you are using the correct VID / PID values.

Using the info you provided I created the connect file but it seems practically the same as your… try it also and see the results.

Hope it helps

Thanks for the reply netux79. Switching between modes only affects the stick, buttons still do not work in analog mode. The bytes don’t change no matter what you press as far as I can tell.

I’d assumed HIDTest always displayed 20 bytes regardless of device, but I could be wrong. Not sure if this helps at all but here’s some info I got from a program called USBView (http://www.ftdichip.com/Resources/Utilities/usbview.zip):


Device Descriptor:
bcdUSB:             0x0200
bDeviceClass:         0x00
bDeviceSubClass:      0x00
bDeviceProtocol:      0x00
bMaxPacketSize0:      0x08 (8)
idVendor:           0x0F30
idProduct:          0x1012
bcdDevice:          0x0211
iManufacturer:        0x01
0x0409: "HJC"
iProduct:             0x02
0x0409: "QanBa Joystick Plus"
iSerialNumber:        0x00
bNumConfigurations:   0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed:     Full
Device Address:       0x02
Open Pipes:              1

Endpoint Descriptor:
bEndpointAddress:     0x81  IN
Transfer Type:   Interrupt
wMaxPacketSize:     0x0020 (32)
bInterval:            0x0A

Configuration Descriptor:
wTotalLength:       0x0022
bNumInterfaces:       0x01
bConfigurationValue:  0x01
iConfiguration:       0x00
bmAttributes:         0x80 (Bus Powered )
MaxPower:             0x32 (100 Ma)

Interface Descriptor:
bInterfaceNumber:     0x00
bAlternateSetting:    0x00
bNumEndpoints:        0x01
bInterfaceClass:      0x03 (HID)
bInterfaceSubClass:   0x00
bInterfaceProtocol:   0x00
iInterface:           0x00

HID Descriptor:
bcdHID:             0x0110
bCountryCode:         0x00
bNumDescriptors:      0x01
bDescriptorType:      0x22
wDescriptorLength:  0x0072

Endpoint Descriptor:
bEndpointAddress:     0x81  IN
Transfer Type:   Interrupt
wMaxPacketSize:     0x0020 (32)
bInterval:            0x0A

and here’s everything HIDTest displays with nothing pressed:


HIDTest
Built   : Apr 20 2014 00:24:40 
Version : 0.6
Firmware: 55.21.30

Failed to open config
HIDVersion:40001
Getting list of HID compatible devices...
DeviceID:0
VID:0F30 PID:1012
HIDVers:3 IntClass:0 SubIntClass:0
bEndpointAddress:81
wMaxPacketSize  :32

Press some buttons, if the values change the device is compatible
Press power or turn the wiimote off to power down

80 7F 80 7F 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Sure, here you go: 0F30_1012.zip (475 Bytes)

Made no difference sadly, still get a constant up press and none of the buttons do anything.

Using the if(condition){send up press} method I was able to determine that byte 0x4 (The hat byte) is always equal to 0x80 no matter what you press. That’s why after masking it with 0xF it evaluates as 0x0 and sends a constant up press. With nothing pressed I’d expect the packet to look like this:


80 7F 80 7F 0F 00 00...

but instead it looks more like this:


80 7F 80 7F 80 XX XX...

XX = Value varies, not affected by button presses

Hi, I’m in the process of creating several drivers right now and wanted to ask two things before I start compiling:

  1. Is it possible to modify the driver to accept twin inputs from a single adapter? I have got both a Mayflash dual-N64-adapter and a Mayflash dual-SNES-adapter. Unfortunately it’s already a problem to configure the autoconf file for two controllers since either one of them isn’t recognized at all or both of them share the same input-value (using RA Windows, Windows shows 2 controllers in settings). Crediar’s test suite shows a turbo/semi-pressed value if a button on only a single controller is held and only displays a full button press if equal buttons on both controllers are held.

  2. I realized that both the N64- and SNES-adapter share the same HIDs and VIDs. I could definitely create an universal driver for both of them but I’m not sure if it’s possible to create two independent autoconf files for the same VID/PID (input-values aren’t equal).

Thanks!

Furthermore, I’m not getting any of those drivers to work at all. Help appreciated!

joypad_connection.c

 ...
{ "Nintendo RVL-CNT-01",         1406,  816,    &pad_connection_wii },
      { "Nintendo RVL-CNT-01-UC",      1406,  816,    &pad_connection_wiiupro },
      { "Wireless Controller",         1356,  1476,   &pad_connection_ps4 },
      { "PLAYSTATION(R)3 Controller",  1356,  616,    &pad_connection_ps3 },
      { "PLAYSTATION(R)3 Controller",  787,   8406,   &pad_connection_ps3 },
      { "FIGHTING_STICK_V3",  3853,   33,   &pad_connection_ps3 },
      { "Mayflash_SNES_dual", 3727,  12307,  &pad_connection_snesusb },
      { "SEGA_SATURN_SLS_USB", 1204,  266,  &pad_connection_snesusb },
      { "Generic NES USB Controller",  121,   17,     &pad_connection_nesusb },
      { "Wii U GC Controller Adapter", 1406,  823,    &pad_connection_wiiugca },
      { "PS2/PSX Controller Adapter",  2064,  1,      &pad_connection_ps2adapter },
      { 0, 0}
...

Autoconfs:

input_device = "FIGHTING_STICK_V3"
input_driver = "hid"
input_vendor_id = 3853
input_product_id = 33input_b_btn = "1"
input_y_btn = "0"
input_select_btn = "8"
input_start_btn = "9"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"
input_a_btn = "2"
input_x_btn = "3"
input_l_btn = "5"
input_r_btn = "7"
input_l2_btn = "12"
input_r2_btn = "13"
input_l3_btn = "6"
input_r3_btn = "4"
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 = "+2"
input_r_x_minus_axis = "-2"
input_r_y_plus_axis = "+3"
input_r_y_minus_axis = "-3"
input_menu_toggle_btn = "16"

input_b_btn_label = "Cross"
input_y_btn_label = "Square"
input_select_btn_label = "Select"
input_start_btn_label = "Start"
input_up_btn_label = "D-Pad Up"
input_down_btn_label = "D-Pad Down"
input_left_btn_label = "D-Pad Left"
input_right_btn_label = "D-Pad Right"
input_a_btn_label = "Circle"
input_x_btn_label = "Triangle"
input_l_btn_label = "L1"
input_r_btn_label = "R1"
input_l2_btn_label = "L2"
input_r2_btn_label = "R2"
input_l3_btn_label = "L3"
input_r3_btn_label = "R3"
input_l_x_plus_axis_label = "Left Analog X+"
input_l_x_minus_axis_label = "Left Analog X-"
input_l_y_plus_axis_label = "Left Analog Y+"
input_l_y_minus_axis_label = "Left Analog Y-"
input_r_x_plus_axis_label = "Right Analog X+"
input_r_x_minus_axis_label = "Right Analog X-"
input_r_y_plus_axis_label = "Right Analog Y+"
input_r_y_minus_axis_label = "Right Analog Y-"
input_menu_toggle_btn_label = "PS"


input_device = "Mayflash_SNES_dual"
input_driver = "hid"
input_vendor_id = 3727
input_product_id = 12307
input_b_btn = "2"
input_y_btn = "3"
input_select_btn = "8"
input_start_btn = "9"
input_a_btn = "1"
input_x_btn = "0"
input_l_btn = "6"
input_r_btn = "7"
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_b_btn_label = "B"
input_y_btn_label = "Y"
input_select_btn_label = "Select"
input_start_btn_label = "Start"
input_a_btn_label = "A"
input_x_btn_label = "X"
input_l_btn_label = "L"
input_r_btn_label = "R"
input_l_x_plus_axis_label = "D Pad Right"
input_l_x_minus_axis_label = "D Pad Left"
input_l_y_plus_axis_label = "D Pad Down"
input_l_y_minus_axis_label = "D Pad Up"


input_device = "SEGA_SATURN_SLS_USB"
input_driver = "hid"
input_vendor_id = 1204
input_product_id = 266
input_b_btn = "0"
input_y_btn = "3"

input_start_btn = "3"
input_a_btn = "1"
input_x_btn = "4"
input_l_btn = "5"
input_r_btn = "2"
input_l2_btn = "6"input_r2_btn = "7"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_b_btn_label = "A"
input_y_btn_label = "X"
input_start_btn_label = "Start"
input_a_btn_label = "B"
input_x_btn_label = "Y"
input_l_btn_label = "Z"
input_r_btn_label = "C"input_l2_btn_label = "L"
input_r2_btn_label = "R"
input_l_x_plus_axis_label = "D Pad Right"
input_l_x_minus_axis_label = "D Pad Left"
input_l_y_plus_axis_label = "D Pad Down"
input_l_y_minus_axis_label = "D Pad Up"


@frozen_fish: No, the hidtool may be displaying different # of bytes depending its packet size, but as you are showing only showing 20 for your control. Yes, the info you provide is useful, we can see with it that its packet size is in fact 32 “wMaxPacketSize: 0x0020 (32)” howewer only reading 20.

Let do something… maybe there is an issue on the # bytes it is reporting that were read. Could you please confirm the value of the “size” variable that is being used in the “memcpy” function? I remember you mentioned it was 8 but hopefully it is larger. Also, could you please check the values in the packet array instead of device->data? Maybe the data is not being copied completely, remember the index should be +1 I checked the ini file from nintendont and it matches what you reported in Retroarch. hope we can find the issue.

@Consolero: Could you please confirm what are you tring to achieve:

a) make both connectors of your adapter work (Meaning you can use 2 SNES controllers with the same adapter) b) Connect to RA any of the mayflash adapters, N64 or SNES, as both share its VID/PID

What is the Crediar’s test suite? if you mean the hid tool we are been using from nintendont then I know what it’s hapenning. The issue is that the adapters provide the info for both controllers in the same package, so you have to know which is them you want to read, the first controller or the second and discard the one you are not using. I created a driver for a twin adapter for PS2 but only the first controller is functional because of the same issue… I’m discarding the 2nd controller data.

What are the values for each adapter? you mentioned these were not equal.

[QUOTE=netux79;39147] @Consolero: Could you please confirm what are you tring to achieve:

a) make both connectors of your adapter work (Meaning you can use 2 SNES controllers with the same adapter) b) Connect to RA any of the mayflash adapters, N64 or SNES, as both share its VID/PID[/QUOTE] confirmed[QUOTE=netux79;39147] What is the Crediar’s test suite? if you mean the hid tool we are been using from nintendont then I know what it’s hapenning. The issue is that the adapters provide the info for both controllers in the same package, so you have to know which is them you want to read, the first controller or the second and discard the one you are not using. I created a driver for a twin adapter for PS2 but only the first controller is functional because of the same issue… I’m discarding the 2nd controller data.[/QUOTE] Correct. I just wanted to know if it’s a feasible option to use two inputs but if you say it’s just not possible I’m good with using just one.

Sure compare the following (uncompleted) .cfg with the one I posted before. Note that they both use the same HIDs and PIDs. b_btn is actually the A- and y_button the B-button on the original controller, but that’s just a personal choice for now (acracdestick-style mapping).

input_driver = "hid"
input_device = "Mayflash_N64_dual"
input_vendor_id = "3727"
input_product_id = "12307"
input_b_btn = "1"
input_y_btn = "2"
input_select_btn = "8"
input_start_btn = "9"
input_up_btn = "12"
input_down_btn = "14"
input_left_btn = "15"
input_right_btn = "13"
input_a_axis = "+2"
input_x_axis = "+5"
input_l_axis = "-2"
input_r_axis = "-5"
input_l2_btn = "6"
input_r2_btn = "7"
input_l_x_plus_axis = "+0"
input_l_x_minus_axis = "-0"
input_l_y_plus_axis = "+1"
input_l_y_minus_axis = "-1"

As previously mentioned none of my drivers is working at all. Am I missing something? Is there something that needs to be changed in the connect_snesusb.c and connect_ps3.c? Can I be sure that the files are changed for compilation as soon as I change them in the toolchain (have only been compiling the salamander-file, no cores)?

You definitely have to recompile your cores!

[QUOTE=netux79;39147]@frozen_fish: No, the hidtool may be displaying different # of bytes depending its packet size, but as you are showing only showing 20 for your control. Yes, the info you provide is useful, we can see with it that its packet size is in fact 32 “wMaxPacketSize: 0x0020 (32)” howewer only reading 20.

Let do something… maybe there is an issue on the # bytes it is reporting that were read. Could you please confirm the value of the “size” variable that is being used in the “memcpy” function? I remember you mentioned it was 8 but hopefully it is larger. Also, could you please check the values in the packet array instead of device->data? Maybe the data is not being copied completely, remember the index should be +1 I checked the ini file from nintendont and it matches what you reported in Retroarch. hope we can find the issue.[/QUOTE]

I noticed makefile.griffin had options for USBGecko debugging so I dug mine out of the drawer and got that working which makes things a lot easier:


(gdb) print size
$1 = 8

(gdb) print packet
$2 = (uint8_t *) 0x8127d8bf "%\200\177\200\177\200Ñë0"

(gdb) x/32xb 0x8127d8c0
0x8127d8c0:     0x80    0x7f    0x80    0x7f    0x80    0xd1    0xeb    0x30
0x8127d8c8:     0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00
0x8127d8d0:     0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00
0x8127d8d8:     0x00    0x00    0x00    0x00    0x00    0x00    0x01    0x68

size is 8, packet goes wrong after the first 4 bytes.

I was able to see the first two bytes of the packet change to the expected values in gdb when holding an analog direction and continuing a few times. But the hat and button bytes never change when doing the same for them

EDIT:

Seems like depending on when I plug the controller in, bytes 4-7 can differ (they’re still completely unresponsive) The above dump was from starting Retroach with the controller already plugged in.

Here’s what it looks like when I start RA with a Dualshock 3 plugged in and then swap it with my Qanba Q4RAF:


0x812af2a0:     0x80    0x7f    0x80    0x7f    0x00    0x00    0x00    0x00
0x812af2a8:     0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00
0x812af2b0:     0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00
0x812af2b8:     0x00    0x00    0x00    0x00    0x00    0x00    0x1f    0x98

Ok, I updated the cores and now at least one profile (Mayflash_SNES_dual) is being detected. For some weird reason though the SNES-pad isn’t detected by this driver but the SEGA SATURN one is (using the SNES driver ???). Unfortunately the only thing I can do with that is remap a few buttons in the inputs settings. Some buttons are not being detected (including the D-pad) buttons that were detected (like the b_btn “A”) couldn’t control the interface. Any idea?

edit: Could the order of lines in the joypad_connection.c be of any significance?

@Frozen_Fish: Nice you have the usbgecko, I would love one for debugging. Per the data shown I think yes there is an issue with the data, not sure if your controller may need a startup sequence to start sending the button data (like the PS3 controller)… but that would be more difficult to track from my side. I may need the physical controller and obviously that it not possible. However, what I can recommend here is to ensure your controller switch is set to PC/PS3 and see if the nintendont tool have any difference when changing this switch.

@consolero: what I recommend is to go with a controller first and then when you have it working move to the other one. Pick one. The d-pad may be because this kind of controller report the d-pad as a analog input instead of a button so Retroarch need the option “analog to digital” set to left joystick. You may then be able to navigate.

[QUOTE=netux79;39310]@Frozen_Fish: Nice you have the usbgecko, I would love one for debugging. Per the data shown I think yes there is an issue with the data, not sure if your controller may need a startup sequence to start sending the button data (like the PS3 controller)… but that would be more difficult to track from my side. I may need the physical controller and obviously that it not possible. However, what I can recommend here is to ensure your controller switch is set to PC/PS3 and see if the nintendont tool have any difference when changing this switch. [/QUOTE]

I got myself a clone from here if you’re interested: http://www.staffs2.webspace.virginmedia.com/shuriken_usb.htm, real usbgecko’s are pretty rare and expensive these days.

You may be right about it needing a startup sequence, this comment from the PS3 driver does sound a lot like my problem:


/* Without this, the digital buttons won't be reported. */
   hidpad_ps3_send_control(device);

Just transplanting the relevant code into my driver doesn’t help though and I can’t find anything in Nintendont’s source code. Also would my PC know to perform such a sequence?

Changing the switch doesn’t seem to do anything once the stick has “powered up”. It stays in PS3/PC mode until you unplug it.

Either way, thanks for your help.

Hi, could someone tell me how to make the official Gamecube Adapter for Wii U compatible with Retroarch Wii??

I saw that here: https://github.com/libretro/RetroArch/tree/master/input/connect there is a connect_wiiugca.c which I understand to be the correct configuration file for the adapter?? Do I have to recompile the cores myself or is this driver already included in the latest releases and I only need to adjust some configs??

Thanks for your help in advance!

[QUOTE=geheim;43741]Hi, could someone tell me how to make the official Gamecube Adapter for Wii U compatible with Retroarch Wii??

I saw that here: https://github.com/libretro/RetroArch/tree/master/input/connect there is a connect_wiiugca.c which I understand to be the correct configuration file for the adapter?? Do I have to recompile the cores myself or is this driver already included in the latest releases and I only need to adjust some configs??

Thanks for your help in advance![/QUOTE]

Hopefully you don’t need to recompile anything. The GC adapter may be already supported. Try this:

  1. Download the autonconfig files for the controllers from the assets download section (http://buildbot.libretro.com/assets/frontend/autoconfig.zip).
  2. Create an “autoconfig” folder within the retroarch app folder (the one that contains all the cores) and unzip it there.
  3. Start retroarch normally and get into the drivers menu and change joystick driver to “hid”.
  4. Restart retroarch and connect the controller in any usb port.
  5. It should detect it, configure it and allow to use it. Enjoy.

Now, please the current driver got the GC adapter only supports the first controller. You can connect a PS3 controller in the second USB port of the Wii if you like.

PLEASE let us know if it worked for you :slight_smile:

Thanks @netux79!! It works now, what was missing were the autoconfig files. I downloaded them and put them on the SD like you described. After changing the driver to hid my controller works perfectly now. Thanks so much for your fast help :slight_smile:

[QUOTE=geheim;43772]Thanks @netux79!! It works now, what was missing were the autoconfig files. I downloaded them and put them on the SD like you described. After changing the driver to hid my controller works perfectly now. Thanks so much for your fast help :)[/QUOTE]

Nice to hear that, you are welcome! :slight_smile:

Hello,

I can’t get my Mayflash USB adapters to work with the latest RetroArch Nightly. I’m using the Mayflash Sega Saturn to USB adapter and a SNES to USB adapter. I downloaded the autoconfig files and set autoconfig directory to where the files are in retroarch.cfg , and i can see that inside the udev folder there is a cfg file for my SS to USB adapter whose PID and VID match with the one in the cfg file named “mayflash-sega-saturn-to-usb-adapter.cfg”. I tried editing this file (changing driver from udev to hid) then copying it to the hid folder, but to no avail. All of this did work flawlessly in the Windows version of RA using udev as input driver though. My adapters have dual ports, if that helps…

As confirmation that the HID support is working, my Mayflash arcade stick works, but what is odd is that it’s recognized as “PLAYSTATION® 3 Controller” whose VID and PID do not match at all with this arcade stick’s (¿?). So it’s not a misconfiguration.

I don’t have devkitpro right now and I don’t know if I really need to recompile anything at this point so I’d need confirmation about that.

I hope somebody can help me.

[QUOTE=spanishnerd;46371]Hello,

I can’t get my Mayflash USB adapters to work with the latest RetroArch Nightly. I’m using the Mayflash Sega Saturn to USB adapter and a SNES to USB adapter. I downloaded the autoconfig files and set autoconfig directory to where the files are in retroarch.cfg , and i can see that inside the udev folder there is a cfg file for my SS to USB adapter whose PID and VID match with the one in the cfg file named “mayflash-sega-saturn-to-usb-adapter.cfg”. I tried editing this file (changing driver from udev to hid) then copying it to the hid folder, but to no avail. All of this did work flawlessly in the Windows version of RA using udev as input driver though. My adapters have dual ports, if that helps…

As confirmation that the HID support is working, my Mayflash arcade stick works, but what is odd is that it’s recognized as “PLAYSTATION® 3 Controller” whose VID and PID do not match at all with this arcade stick’s (¿?). So it’s not a misconfiguration.

I don’t have devkitpro right now and I don’t know if I really need to recompile anything at this point so I’d need confirmation about that.

I hope somebody can help me.[/QUOTE]

Even when many controllers are supported in other platforms, for the Wii the approach is a bit different, we need add a driver for each of them. So yes, you may be able to get them working but you will need to create the driver and then recompile it all and maybe share your driver so it can be used by someone else with the same controller.

it’s not that hard, the hardest part will be to figure out the mapping of each button and create the corresponding autonconfig file.