#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <oslib/oslib.h>
#include <oslib/messagebox.h>
#include <oslib/usb.h>
#include "osl_usb.h"
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("oslibusb", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
int main() {
SceCtrlData pad;
oslInit(0);
oslInitGfx(OSL_PF_8888, 0);
oslPrintf("USB Connection using osLib - bl0x");
oslPrintf("\n\nPress X to connect USB");
oslPrintf("\nPress O to disconnect USB");
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
sceCtrlReadBufferPositive(&pad, 1);
do {
if(pad.Buttons & PSP_CTRL_CROSS)
{
oslConectar();
oslMessageBox("USB Conectado", "Inicio", oslMake3Buttons(OSL_KEY_CROSS, OSL_MB_OK, 0, 0, 0, 0));
}
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
oslDesconectar();
oslMessageBox("USB Desconectado", "Fin", oslMake3Buttons(OSL_KEY_CROSS, OSL_MB_OK, 0, 0, 0, 0));
}
} while(pad.Buttons != 0);
oslWaitKey();
oslMessageBox("The End. Created by bl0x", "See ya", oslMake3Buttons(OSL_KEY_CROSS, OSL_MB_OK, 0, 0, 0, 0));
oslEndGfx();
oslQuit();
return 0;
}