360 Controller Not Showing Up

Discussion in 'Wii - Emulation and Homebrew' started by gudenau, Aug 18, 2014.

  1. gudenau
    OP

    gudenau Largely ignored

    Member
    3,278
    1,250
    Jul 7, 2010
    United States
    /dev/random
    A am attempting to create a driver for the xBox 360 Gamepad for use on the Wii, however it is not showing up.

    Here is the source:

    Code:
    #include <ogc/system.h>
    #include <ogc/usb.h>
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <malloc.h>
    #include <unistd.h>
     
    #include <wiiuse/wpad.h>
     
    #include <gccore.h>
     
    #include <ogc/usb.h>
    #include <ogc/lwp_queue.h>
    #include <ogc/usbmouse.h>
    #include <ogc/semaphore.h>
     
    #include "util.h"
     
    #define CLASS_VENDOR                0xFF
    #define SUBCLASS_XBOX360_GAMEPAD    0x5D
     
    #define UIPROTO_XBOX360_HEADSET        0x00
    #define UIPROTO_XBOX360_GAMEPAD        0x01
    #define UIPROTO_XBOX360_CHATPAD        0x02
     
    #define    HEAP_SIZE                    4096
    #define DEVLIST_MAXSIZE                8
     
    void reset();
    void power();
     
    int main(int argc, char **argv){
        usb_device_entry *buffer;
        u8 device_count;
       
        s32 hid = -1;
     
        initGraphics();
     
        WPAD_Init();
     
        printf("\x1b[2;0H");
        printf("Hello world!\n");
       
        printf("USB_Initialize\n");
        if(USB_Initialize() != 0){
            printf("ERROR");
            exit(0);
        }
       
        printf("iosCreateHeap\n");
        hid = iosCreateHeap(HEAP_SIZE);
        if(hid < 0){
            printf("ERROR");
            exit(0);
        }
       
        printf("iosAlloc\n");
        buffer = iosAlloc(hid, DEVLIST_MAXSIZE * sizeof(usb_device_entry));
        if(!buffer){
            printf("ERROR");
            exit(0);
        }
     
        memset(buffer, 0, DEVLIST_MAXSIZE * sizeof(usb_device_entry));
       
        printf("USB_GetDeviceList\n");
        if(USB_GetDeviceList(buffer, DEVLIST_MAXSIZE, CLASS_VENDER, &device_count) < 0){
            iosFree(hid, buffer);
            printf("ERROR");
            exit(0);
        }
     
        printf("%u\n", device_count);
     
        return 0;
    }
    And here is the USB info about the controller:
    Code:
    Information for device Controller (VID=0x045E PID=0x028E): 
     
    Connection Information:
    ------------------------------
    Connection status: Device connected
    Device actual bus speed: Full
    Device is hub: No
    Device adress: 0x0001
    Current configuration value: 0x01
    Number of open pipes: 7
     
    Device Descriptor:
    ------------------------------
    0x12bLength
    0x01bDescriptorType
    0x0200bcdUSB
    0xFFbDeviceClass   (Vendor specific)
    0xFFbDeviceSubClass   
    0xFFbDeviceProtocol   
    0x08bMaxPacketSize0   (8 Bytes)
    0x045EidVendor
    0x028EidProduct
    0x0114bcdDevice
    0x01iManufacturer   "©Microsoft Corporation"
    0x02iProduct   "Controller"
    0x03iSerialNumber   "0F23AFB"
    0x01bNumConfigurations
     
    Configuration Descriptor:
    ------------------------------
    0x09bLength
    0x02bDescriptorType
    0x0099wTotalLength
    0x04bNumInterfaces
    0x01bConfigurationValue
    0x00iConfiguration
    0xA0bmAttributes   (Bus-powered Device, Remote-Wakeup)
    0xFAbMaxPower   (500 mA)
     
    Interface Descriptor:
    ------------------------------
    0x09bLength
    0x04bDescriptorType
    0x00bInterfaceNumber
    0x00bAlternateSetting
    0x02bNumEndPoints
    0xFFbInterfaceClass   (Vendor specific)
    0x5DbInterfaceSubClass   
    0x01bInterfaceProtocol   
    0x00iInterface
     
    Unknown Descriptor:
    ------------------------------
    0x11bLength
    0x21bDescriptorType
    Hex dump: 
    0x11 0x21 0x00 0x01 0x01 0x25 0x81 0x14 0x00 0x00 
    0x00 0x00 0x13 0x01 0x08 0x00 0x00 
     
    Endpoint Descriptor:
    ------------------------------
    0x07bLength
    0x05bDescriptorType
    0x81bEndpointAddress   (IN Endpoint)
    0x03bmAttributes(Transfer: Interrupt / Synch: None / Usage: Data)
    0x0020wMaxPacketSize   (32 Bytes) 
    0x04bInterval
     
    Endpoint Descriptor:
    ------------------------------
    0x07bLength
    0x05bDescriptorType
    0x01bEndpointAddress   (OUT Endpoint)
    0x03bmAttributes(Transfer: Interrupt / Synch: None / Usage: Data)
    0x0020wMaxPacketSize   (32 Bytes) 
    0x08bInterval
     
    Interface Descriptor:
    ------------------------------
    0x09bLength
    0x04bDescriptorType
    0x01bInterfaceNumber
    0x00bAlternateSetting
    0x04bNumEndPoints
    0xFFbInterfaceClass   (Vendor specific)
    0x5DbInterfaceSubClass   
    0x03bInterfaceProtocol   
    0x00iInterface
     
    Unknown Descriptor:
    ------------------------------
    0x1BbLength
    0x21bDescriptorType
    Hex dump: 
    0x1B 0x21 0x00 0x01 0x01 0x01 0x82 0x40 0x01 0x02 
    0x20 0x16 0x83 0x00 0x00 0x00 0x00 0x00 0x00 0x16 
    0x03 0x00 0x00 0x00 0x00 0x00 0x00 
     
    Endpoint Descriptor:
    ------------------------------
    0x07bLength
    0x05bDescriptorType
    0x82bEndpointAddress   (IN Endpoint)
    0x03bmAttributes(Transfer: Interrupt / Synch: None / Usage: Data)
    0x0020wMaxPacketSize   (32 Bytes) 
    0x02bInterval
     
    Endpoint Descriptor:
    ------------------------------
    0x07bLength
    0x05bDescriptorType
    0x02bEndpointAddress   (OUT Endpoint)
    0x03bmAttributes(Transfer: Interrupt / Synch: None / Usage: Data)
    0x0020wMaxPacketSize   (32 Bytes) 
    0x04bInterval
     
    Endpoint Descriptor:
    ------------------------------
    0x07bLength
    0x05bDescriptorType
    0x83bEndpointAddress   (IN Endpoint)
    0x03bmAttributes(Transfer: Interrupt / Synch: None / Usage: Data)
    0x0020wMaxPacketSize   (32 Bytes) 
    0x40bInterval
     
    Endpoint Descriptor:
    ------------------------------
    0x07bLength
    0x05bDescriptorType
    0x03bEndpointAddress   (OUT Endpoint)
    0x03bmAttributes(Transfer: Interrupt / Synch: None / Usage: Data)
    0x0020wMaxPacketSize   (32 Bytes) 
    0x10bInterval
     
    Interface Descriptor:
    ------------------------------
    0x09bLength
    0x04bDescriptorType
    0x02bInterfaceNumber
    0x00bAlternateSetting
    0x01bNumEndPoints
    0xFFbInterfaceClass   (Vendor specific)
    0x5DbInterfaceSubClass   
    0x02bInterfaceProtocol   
    0x00iInterface
     
    Unknown Descriptor:
    ------------------------------
    0x09bLength
    0x21bDescriptorType
    Hex dump: 
    0x09 0x21 0x00 0x01 0x01 0x22 0x84 0x07 0x00 
     
    Endpoint Descriptor:
    ------------------------------
    0x07bLength
    0x05bDescriptorType
    0x84bEndpointAddress   (IN Endpoint)
    0x03bmAttributes(Transfer: Interrupt / Synch: None / Usage: Data)
    0x0020wMaxPacketSize   (32 Bytes) 
    0x10bInterval
     
    Interface Descriptor:
    ------------------------------
    0x09bLength
    0x04bDescriptorType
    0x03bInterfaceNumber
    0x00bAlternateSetting
    0x00bNumEndPoints
    0xFFbInterfaceClass   (Vendor specific)
    0xFDbInterfaceSubClass   
    0x13bInterfaceProtocol   
    0x04iInterface   "Xbox Security Method 3, Version 1.00, © 2005 Microsoft Corporation. All rights reserved."
     
    Unknown Descriptor:
    ------------------------------
    0x06bLength
    0x41bDescriptorType
    Hex dump: 
    0x06 0x41 0x00 0x01 0x01 0x03 
     
    String Descriptor Table
    --------------------------------
    Index  LANGID  String
    0x00   0x0000  0x0409 
    0x01   0x0409  "©Microsoft Corporation"
    0x02   0x0409  "Controller"
    0x03   0x0409  "0F23AFB"
    0x04   0x0409  "Xbox Security Method 3, Version 1.00, © 2005 Microsoft Corporation. All rights reserved."
    0xEE   0x0000  "MSFT100"
     
    ------------------------------
     
    Connection path for device: 
    Intel(R) USB 3.0 eXtensible Host Controller
    Root Hub
    Controller (VID=0x045E PID=0x028E)
     
    Brought to you by TDD v1.83.0, Mar  7 2014, 14:22:05
    
    Any help would be appreciated.
     
  2. gudenau
    OP

    gudenau Largely ignored

    Member
    3,278
    1,250
    Jul 7, 2010
    United States
    /dev/random
    Any help?
     
  3. migles

    migles Mei the sexiest bae

    Member
    6,899
    4,633
    Sep 19, 2013
    Saint Kitts and Nevis
    my dad works for nintendo.
    are you trying to connect to nintendont, or making homebrew?
     
  4. gudenau
    OP

    gudenau Largely ignored

    Member
    3,278
    1,250
    Jul 7, 2010
    United States
    /dev/random
    Making homebrew to hopefully add support to Nintendo in the future. But for the moment, just homebrew.
     
  5. gudenau
    OP

    gudenau Largely ignored

    Member
    3,278
    1,250
    Jul 7, 2010
    United States
    /dev/random
    *BUMP*
    Any ideas?
     
  6. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,292
    8,763
    Oct 27, 2002
    France
    Engine room, learning
    Which IOS are you running? I guess IOS58

    All your debug are printing "error", not very easy to know where it stops. put different error name for different places.

    If your program runs up to GetDeviceList, print the return error code.
    It's probably #IPC_ENOENT
    if the device_interface is really 0xFF, then you made a mistake (CLASS_VENDER -> CLASS_VENDOR)


    You already know the PID/VID, you could open it directly from
    fd = IOS_Open("/dev/usb/oh0/45e/28e", 1 /* 2 = write, 1 = read */);



    few things I found
    http://devkitpro.org/viewtopic.php?f=15&t=2619&view=print (might be old/changed since then)
    http://wiibrew.org/wiki//dev/usb/oh0
    http://wiibrew.org/wiki//dev/usb/oh1
    and libogc
     
  7. gudenau
    OP

    gudenau Largely ignored

    Member
    3,278
    1,250
    Jul 7, 2010
    United States
    /dev/random
    I don't get any errors, I get a device count of zero. But I will look into these links.
     
  8. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,292
    8,763
    Oct 27, 2002
    France
    Engine room, learning
    then probably just the typo in the GetDeviceList.
    It's not searching the class 0xFF correctly.

    also, I'm not expert on USB, it's only things I found an hour ago. It's probably not correct.
     
  9. gudenau
    OP

    gudenau Largely ignored

    Member
    3,278
    1,250
    Jul 7, 2010
    United States
    /dev/random
    Probably...

    Edit:
    Nope... Lets check the ios.

    Edit 2:
    Ios 58

    Edit 3:
    IOS_Open returns 4294967295, which I suppose is a pointer or key of sorts.
     
  10. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,292
    8,763
    Oct 27, 2002
    France
    Engine room, learning