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 

LoadStartModule usb-relative prx fail in PSP2000 (3.60 M33)

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



Joined: 05 Feb 2006
Posts: 13

PostPosted: Thu Oct 18, 2007 12:29 am    Post subject: LoadStartModule usb-relative prx fail in PSP2000 (3.60 M33) Reply with quote

Hi ,I fail to load usb relative prx in PSP 2000 (3.60 M33), but it works well in PSP1000 3.52 M33-4 ,the error is SCE_KERNEL_ERROR_UNSUPPORTED_PRX_TYPE ( 0x80020148)
here's my code :
Code:
LoadStartModule("flash0:/kd/semawm.prx");
    LoadStartModule("flash0:/kd/usbstor.prx");
    LoadStartModule("flash0:/kd/usbstormgr.prx");
    LoadStartModule("flash0:/kd/usbstorms.prx");
    LoadStartModule("flash0:/kd/usbstorboot.prx");
and LoadStartModule function defined below:
Code:
int LoadStartModule(char *path)
   {
       u32 loadResult;
    u32 startResult;
       int status;

       loadResult = sceKernelLoadModule(path, 0, NULL);
       if (loadResult & 0x80000000)
      return -1;
       else
      startResult =
          sceKernelStartModule(loadResult, 0, NULL, &status, NULL);

       if (loadResult != startResult)
      return -2;
       return 0;
   }

I copy it from the ../sdk/samples/usb/storage.

I look forward to your help, thanks in advance.
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Thu Oct 18, 2007 12:43 am    Post subject: Re: LoadStartModule usb-relative prx fail in PSP2000 (3.60 M Reply with quote

Hi! :)

Sorry, I've not an answer to your question....just a question for you. :)

Are you sure this code works fine in kernel 3.52 (not 1.50)?
On my psp (3.52 M33) this code fails to load usbstorms.px and usbsotrboot.prx and the USB connection doesen't work.

I tried to use kubridge, but the prx loads fine but fails to start with
Code:
sceKernelStartModule(loadResult, 0, NULL, &status, NULL);


Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Oct 18, 2007 6:47 am    Post subject: Reply with quote

Maybe is due to some of the protection added by Sony in 3.40 or 3.30, that
prevented some uid's created by kernel mode to be accesed by user mode. But anyways the kuKernelLoadModule is working for me, soforget what i just said :)
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Thu Oct 18, 2007 6:59 am    Post subject: Reply with quote

Hi! :)
moonlight wrote:
But anyways the kuKernelLoadModule is working for me, soforget what i just said :)

With this code kuKernelLoadModule works for me (the module loads fine), but it fails to start (it happens only with usbstorms.prx and usbstorboot.prx).
I get a SCE_KERNEL_ERROR_LIBRARY_NOTFOUND error.
If I just copy this two prx from my flash0 to the ms, then pspSdkLoadStartModule works fine.
I'm on 3.52 M33-4, have you any idea?

Code:
int LoadStartModule(char *path)
{
    u32 loadResult;
    u32 startResult;
    int status;

    pspDebugScreenPrintf("Loading %s\n", path);
    loadResult = kuKernelLoadModule(path, 0, NULL);
    if (loadResult & 0x80000000){
       pspDebugScreenPrintf("kuKernelLoadModule: %x\n", loadResult);
       return -1;
    }else{
       pspDebugScreenPrintf("  Load OK\n");
       startResult = sceKernelStartModule(loadResult, 0, NULL, &status, NULL);
    }

    if (loadResult != startResult){
       pspDebugScreenPrintf("  Error starting module: %x\n", startResult);
       return -2;
    }
    pspDebugScreenPrintf("  Start OK\n");
    return 0;
}

//Init USB:
int USBinit(){
   u32 retVal;
    //start necessary drivers
    LoadStartModule("flash0:/kd/semawm.prx");
    LoadStartModule("flash0:/kd/usbstor.prx");
    LoadStartModule("flash0:/kd/usbstormgr.prx");
    LoadStartModule("flash0:/kd/usbstorms.prx");
    LoadStartModule("flash0:/kd/usbstorboot.prx");

    //setup USB drivers
    retVal = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
    if (retVal != 0) {
        pspDebugScreenPrintf("sceUsbStart BUS error: %x\n", retVal);
        return -6;
    }
    retVal = sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
    if (retVal != 0) {
        pspDebugScreenPrintf("sceUsbStart STOR error: %x\n", retVal);
        return -7;
   }
    retVal = sceUsbstorBootSetCapacity(0x800000);
    if (retVal != 0) {
        pspDebugScreenPrintf("sceUsbstorBootSetCapacity error: %x\n", retVal);
      return -8;
   }
   return 0;
}


Many thanks. :)

Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Oct 18, 2007 7:31 am    Post subject: Reply with quote

Try to load flash0:/kd/npdrm.prx before the other modules.
If npdrm loading fails too, load flash0:/kd/mgr.prx before.

One of the usb modules depend of npdrm. It is for the (useless) drm shit between the ps3 and the psp it needs that prx.

Yeah I know whenever you are gonna load a module from flash, always use kuKernelLoadModule.
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Fri Oct 19, 2007 5:40 am    Post subject: Reply with quote

Hi! :)
moonlight wrote:
Try to load flash0:/kd/npdrm.prx before the other modules.
If npdrm loading fails too, load flash0:/kd/mgr.prx before.

Many thanks, half the problem is gone. :)

I loaded and started npdrm.prx as the first module.
Now usbstorboot.prx loads and starts fine, but.... usbstorms.prx starts but fails to load (always with SCE_KERNEL_ERROR_LIBRARY_NOTFOUND).
I also tried to load mgr.prx (also if npdrm.prx loads fine without it), but I get the same error.

Are there other dependencies to satisfy?
Is there a way I can know a module dependencies?

Many thanks for help :)
Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
rzxiao



Joined: 05 Feb 2006
Posts: 13

PostPosted: Fri Oct 19, 2007 2:31 pm    Post subject: Re: LoadStartModule usb-relative prx fail in PSP2000 (3.60 M Reply with quote

sakya wrote:
Hi! :)

Sorry, I've not an answer to your question....just a question for you. :)

Are you sure this code works fine in kernel 3.52 (not 1.50)?
...deleted...

sorry for late,yes,I'm sure, I can open usb in 3.52 M33-4,very well, so I think the code work fine.
Back to top
View user's profile Send private message
cswindle



Joined: 08 Apr 2006
Posts: 6

PostPosted: Fri Oct 19, 2007 2:38 pm    Post subject: Reply with quote

sakya wrote:
Hi! :)
Now usbstorboot.prx loads and starts fine, but.... usbstorms.prx starts but fails to load (always with SCE_KERNEL_ERROR_LIBRARY_NOTFOUND).
I also tried to load mgr.prx (also if npdrm.prx loads fine without it), but I get the same error.

Are there other dependencies to satisfy?
usbstorms has a dependancy on chkreg.prx, so you will need to load that first.

sakya wrote:
Is there a way I can know a module dependencies?
Taking a look at the module imports in prxtool and seeing which modules are required is the normal way and then compare that to what are currently loaded.
Back to top
View user's profile Send private message
rzxiao



Joined: 05 Feb 2006
Posts: 13

PostPosted: Fri Oct 19, 2007 2:39 pm    Post subject: Reply with quote

When I use kuKernelLoadModule in 3.60 M33,I got same error described below
sakya wrote:
Hi! :)
moonlight wrote:
But anyways the kuKernelLoadModule is working for me, soforget what i just said :)

With this code kuKernelLoadModule works for me (the module loads fine), but it fails to start (it happens only with usbstorms.prx and usbstorboot.prx).
I get a SCE_KERNEL_ERROR_LIBRARY_NOTFOUND error.


but unfortunately,when I do like this:
sakya wrote:

Hi! :)
moonlight wrote:
Try to load flash0:/kd/npdrm.prx before the other modules.
If npdrm loading fails too, load flash0:/kd/mgr.prx before.

Many thanks, half the problem is gone. :)


the problem doesn't gone, it's still there.
Code:
LoadStartModule("flash0:/kd/npdrm.prx");
  LoadStartModule("flash0:/kd/semawm.prx");
  LoadStartModule("flash0:/kd/usbstor.prx");
  LoadStartModule("flash0:/kd/usbstormgr.prx");
  LoadStartModule("flash0:/kd/usbstorms.prx");
  LoadStartModule("flash0:/kd/usbstorboot.prx");


any suggestion?
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Fri Oct 19, 2007 5:53 pm    Post subject: Reply with quote

Hi! :)
rzxiao wrote:
any suggestion?

As cswindle said (many thanks!!!), usbstorms.prx depends from chkreg.prx

The following code works fine on 3.52 M33-4.
Code:
int LoadStartModule(char *path)
{
    u32 loadResult;
    u32 startResult;
    int status;

    loadResult = kuKernelLoadModule(path, 0, NULL);
    if (loadResult & 0x80000000){
       return -1;
    }else{
       startResult = sceKernelStartModule(loadResult, 0, NULL, &status, NULL);
    }

    if (loadResult != startResult){
       return -2;
    }
    return 0;
}

int USBinit(){
   u32 retVal;

    //start necessary drivers
    LoadStartModule("flash0:/kd/chkreg.prx");   
    LoadStartModule("flash0:/kd/npdrm.prx");
    LoadStartModule("flash0:/kd/semawm.prx");
    LoadStartModule("flash0:/kd/usbstor.prx");
    LoadStartModule("flash0:/kd/usbstormgr.prx");
    LoadStartModule("flash0:/kd/usbstorms.prx");
    LoadStartModule("flash0:/kd/usbstorboot.prx");

    //setup USB drivers
    retVal = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
    if (retVal != 0) {
      return -6;
    }
    retVal = sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
    if (retVal != 0) {
      return -7;
   }

    retVal = sceUsbstorBootSetCapacity(0x800000);
    if (retVal != 0) {
      return -8;
   }
    return 0;
}

int USBActivate(){
    sceUsbActivate(0x1c8);
    return 0;
}

int USBDeactivate(){
    sceUsbDeactivate(0x1c8);
    sceIoDevctl("fatms0:", 0x0240D81E, NULL, 0, NULL, 0 ); //Avoid corrupted files
    return 0;
}


Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
rzxiao



Joined: 05 Feb 2006
Posts: 13

PostPosted: Fri Oct 19, 2007 6:57 pm    Post subject: Reply with quote

It works now!!!!
Thanks Sakya and Thanks cswindle!!!!
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