forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

usb exiting

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
dankydoo



Joined: 29 Mar 2005
Posts: 11

PostPosted: Sat Oct 08, 2005 8:12 am    Post subject: usb exiting Reply with quote

Hello all,

I've been porting some of my openGL code with the PSPSDK, and it came to me that compile time/execution turnaround will be much quicker if I enable USB in my programs, then upload the new executable with a script after it is compiled and then maybe hook the booting of the executable to say the 'select' button.

I've integrated the USB example into my proggie, the only problem is that I cannot exit the program cleanly. After I hit the home button and say 'Yes' to exit, it freezes and shuts down the PSP. I've investigated, and the USB demo app has the same problem. I have a feeling it has to do with either kernel thread/ user thread things, or stopping/unloading the USB modules.

Any suggestions, or any direction would be great!

thanks,

dankydoo
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Sat Oct 08, 2005 11:33 am    Post subject: Reply with quote

in pspinside we do it like this:

Code:

void initUSBdrivers(void)
{
int exec_pu;
   
   exec_pu=sceKernelLoadModule("flash0:/kd/semawm.prx",0,NULL);
   sceKernelStartModule(exec_pu, 0, NULL, 0, NULL);

   exec_pu=sceKernelLoadModule("flash0:/kd/usbstor.prx",0,NULL);
   sceKernelStartModule(exec_pu, 0, NULL, 0, NULL);

   exec_pu=sceKernelLoadModule("flash0:/kd/usbstormgr.prx",0,NULL);
   sceKernelStartModule(exec_pu, 0, NULL, 0, NULL);

   exec_pu=sceKernelLoadModule("flash0:/kd/usbstorms.prx",0,NULL);
   sceKernelStartModule(exec_pu, 0, NULL, 0, NULL);

   exec_pu=sceKernelLoadModule("flash0:/kd/usbstorboot.prx",0,NULL);
   sceKernelStartModule(exec_pu, 0, NULL, 0, NULL);

   int ret = 0;

// FIXME: last arg should be NULL (wrong prototype in pspsdk?)
   sceUsbStart("USBBusDriver",0,0);
   ret = sceUsbStart("USBStor_Driver",0,0);
   
   if(ret)
   {
// prototype in pspsdk has only one arg, is that correct?
//      sceUsbstorBootSetCapacity(0x00800000,ret);
      sceUsbstorBootSetCapacity(0x00800000);
   }
}

void exitUSBdrivers(void)
{
   sceUsbDeactivate();

// FIXME: last arg should be NULL (wrong prototype in pspsdk?)
   sceUsbStop("USBStor_Driver",0,0);
   sceUsbStop("USBBusDriver",0,0);
}


that seems to work fine. (atleast pspinside doesnt crash and exits to the vsh cleanly :))
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Sat Oct 08, 2005 8:27 pm    Post subject: Reply with quote

MrMr[iCE] posted a codelet doing this in the VFPU thread on Tue Oct 04, 2005 7:24 pm: http://forums.ps2dev.org/viewtopic.php?t=3567&postdays=0&postorder=asc&start=0
Back to top
View user's profile Send private message
dankydoo



Joined: 29 Mar 2005
Posts: 11

PostPosted: Mon Oct 10, 2005 3:42 am    Post subject: Reply with quote

Thanks guys!


I will look into this...

dankydoo
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group