Homebrew 360 Controller Not Showing Up

gudenau

Largely ignored
OP
Member
Joined
Jul 7, 2010
Messages
3,882
Trophies
2
Location
/dev/random
Website
www.gudenau.net
XP
5,417
Country
United States
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.
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
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
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
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.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • K3Nv2 @ K3Nv2:
    I'll reformat and have a 3tb raid0 m. 2 at least
    +1
  • K3Nv2 @ K3Nv2:
    Lmao that sold out fast
    +1
  • Veho @ Veho:
    Yeet the cat.
    +1
  • K3Nv2 @ K3Nv2:
    Good idea
    +1
  • The Real Jdbye @ The Real Jdbye:
    i thought everybody knew cocktails are like 75% ice
  • Veho @ Veho:
    Yeah but not like this.
  • Veho @ Veho:
    It's not like they're complaining that their Slurpee is 99% ice or something, but if the cocktail calls for "shot of vodka, shot of vermouth, shot of gin, shot of Campari, three shots of juice, squirt of lemon" and ends up being a thimbleful of booze, that's a problem.
  • The Real Jdbye @ The Real Jdbye:
    the funny thing is cocktails in norway are only allowed to have 1 20ml shot of booze
  • The Real Jdbye @ The Real Jdbye:
    so..... yeah
  • The Real Jdbye @ The Real Jdbye:
    we're used to only having a thimbleful of booze
  • Veho @ Veho:
    Booo.
  • The Real Jdbye @ The Real Jdbye:
    same thing if you want whisky on the rocks or something, you can't get a double
  • The Real Jdbye @ The Real Jdbye:
    but you could buy as many shots of whisky (or anything else) as you want and ask for a glass of ice and pour them in
  • The Real Jdbye @ The Real Jdbye:
    it's dumb
  • Veho @ Veho:
    Maybe.
  • Veho @ Veho:
    There was a comparison of the number of Ibuprofen poisonings before and after they limited the maximum dosage per box or per pill (i'll look that up). No limit on the number of boxes you can still buy as many as you want, so people argued it was pointless.
  • Veho @ Veho:
    But the number of (accidental) poisonings dropped because drinking an entire package of ibuprofen pills went from "I need a new liver" to "I need a new box of Ibuprofen".
  • Veho @ Veho:
    Here we have ketoprofen that used to be prescription-only because of the risk of toxic dosages, but then they halved the dose per pill and sell them in bottles of six pills apiece instead of twenty and it doesn't need a prescription any more. Yes you can buy more than one bottle but people simply don't.
  • Psionic Roshambo @ Psionic Roshambo:
    Usually accidentally overdose of ibuprofen here is from people taking like cold medicine then ibuprofen for a headache and the combination is over what they need
    Veho @ Veho: https://imgur.com/gallery/QQkYnQu