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

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
rzxiao
Posts: 13
Joined: Sun Feb 05, 2006 7:55 pm

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

Post by rzxiao »

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: Select all

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: Select all

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.
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Re: LoadStartModule usb-relative prx fail in PSP2000 (3.60 M

Post by sakya »

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: Select all

sceKernelStartModule(loadResult, 0, NULL, &status, NULL);
Ciaooo
Sakya
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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 :)
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

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: Select all

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
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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.
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

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
rzxiao
Posts: 13
Joined: Sun Feb 05, 2006 7:55 pm

Re: LoadStartModule usb-relative prx fail in PSP2000 (3.60 M

Post by rzxiao »

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.
cswindle
Posts: 6
Joined: Sat Apr 08, 2006 4:07 pm

Post by cswindle »

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.
rzxiao
Posts: 13
Joined: Sun Feb 05, 2006 7:55 pm

Post by rzxiao »

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: Select all

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?
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

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: Select all

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
rzxiao
Posts: 13
Joined: Sun Feb 05, 2006 7:55 pm

Post by rzxiao »

It works now!!!!
Thanks Sakya and Thanks cswindle!!!!
Post Reply