Code does not find any usb devices June 17, 2009 07:47PM | Registered: 15 years ago Posts: 1 |
#include#include #include #include #include #include #include #include #define DEVLIST_MAXSIZE 8 static u32 *xfb; static GXRModeObj *rmode; void Initialise() { VIDEO_Init(); WPAD_Init(); rmode = VIDEO_GetPreferredMode(NULL); xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); VIDEO_Configure(rmode); VIDEO_SetNextFramebuffer(xfb); VIDEO_SetBlack(FALSE); VIDEO_Flush(); VIDEO_WaitVSync(); if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); } void waitForButtonDown(int button){ u16 buttonsDown; do { WPAD_ScanPads(); buttonsDown = WPAD_ButtonsDown(0); } while(!(buttonsDown & button)); printf("Button pressed\n"); } int main() { Initialise(); s32 test = USB_Initialize(); printf("USB has been initialized: %d\n", test); printf("Press A to continue...\n\n"); waitForButtonDown(WPAD_BUTTON_A); u8 n; u8* buffer; buffer = memalign(32, DEVLIST_MAXSIZE << 3); memset(buffer, 0, DEVLIST_MAXSIZE << 3); printf("DEVLIST_MAXSIZE: %x\n", (DEVLIST_MAXSIZE << 3)); if(buffer != NULL){ test = USB_GetDeviceList("/dev/usb/oh0",buffer,DEVLIST_MAXSIZE, 0, &n); printf("Getting usb device list: %d\n", test); printf("Found %d devices!\n",n); } else printf("Error: buffer is null.\n"); printf("Press A to continue...\n\n"); waitForButtonDown(WPAD_BUTTON_A); test = USB_Deinitialize(); printf("USB has been deinitialized: %d\n", test); printf("Press B to continue...\n"); waitForButtonDown(WPAD_BUTTON_B); printf("Exiting...\n"); return 0; }
Re: Code does not find any usb devices June 18, 2009 05:00AM | Registered: 15 years ago Posts: 441 |