I was wondering is it possible to make a USB connection without going into kernelmode? Because I've only seen people activating USB by reading flash0 using kernelmode...
If possible could you also quickly say what library/function?
Ty,
Code: Select all
#include <pspusb.h>
#include <pspusbstor.h>
#include <pspusbdevice.h>
#include <pspmodulemgr.h>
#include "gui_stuff.h"
char usbStatus = 0;
char usbModuleStatus = 0;
int disableUsb(void)
{
if(usbStatus)
{
sceUsbDeactivate(0);
pspUsbDeviceFinishDevice();
sceUsbStop(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0);
usbStatus = 0;
sceKernelDelayThread(300000);
msg_box("USB Connection", "USB connection disabled.");
}
return 0;
}
int enableUsb()
{
if (usbStatus == 1)
{
disableUsb();
return 0;
}
if(!usbModuleStatus)
{
pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbdevice.prx", PSP_MEMORY_PARTITION_KERNEL);
usbModuleStatus = 1;
}
if (!usbStatus)
{
sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbstorBootSetCapacity(0x800000);
sceUsbActivate(0x1c8);
usbStatus = 1;
sceKernelDelayThread(300000);
msg_box("USB Connection", "USB connection enabled.");
}
return 1;
}
int enableUsbEx(u32 device)
{
if (usbStatus == 1)
{
disableUsb();
return 0;
}
if(!usbModuleStatus)
{
pspSdkLoadStartModule("flash0:/kd/usbdevice.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbdevice.prx", PSP_MEMORY_PARTITION_KERNEL);
usbModuleStatus = 1;
}
if (!usbStatus)
{
pspUsbDeviceSetDevice(device, 0, 0);
sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbActivate(0x1c8);
usbStatus = 1;
sceKernelDelayThread(300000);
msg_box("USB Connection", "USB connection enabled.");
}
return 1;
}
What do you mean attributes?C4TurD4Y wrote: Ready to use. Can I ask you what are attributes of your RM?
Is that user module, kernel module or something else? Anyway, recovery menu should be VSH module (attribute 0x800).legendmythe wrote:What do you mean attributes?
No.legendmythe wrote:BTW are you the same guy from QJ with the Ultimate RM?
O yea it's VSHC4TurD4Y wrote: Is that user module, kernel module or something else? Anyway, recovery menu should be VSH module (attribute 0x800).
Code: Select all
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspusb.h>
#include <pspusbstor.h>
#include <pspusb.h>
#include <pspmodulemgr.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("usb", 0x800, 1, 0);
char usbStatus = 0;
char usbModuleStatus = 0;
int enableUsb()
{
if(!usbModuleStatus)
{
pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbdevice.prx", PSP_MEMORY_PARTITION_KERNEL);
usbModuleStatus = 1;
}
if (!usbStatus)
{
sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbstorBootSetCapacity(0x800000);
sceUsbActivate(0x1c8);
usbStatus = 1;
sceKernelDelayThread(300000);
printf("USB Connection");
}
return 1;
}
int main (void) {
pspDebugScreenInit();
enableUsb();
return 0;
}
pspusbdevice.h is a part of M33 SDK (it's released with 4.01 m33 update).legendmythe wrote:But I'm getting a compiling error: pspusbdevice.h is missing... I've got PSPMinGW
It usually means Unknown executable format. Do you have USE_KERNEL_LIBS enabled or disabled?legendmythe wrote:I tried changing some stuff, now I get "error 80020148" (unsupported/missing prx file right?);
Disabled, should it be enabled then?C4TurD4Y wrote:pspusbdevice.h is a part of M33 SDK (it's released with 4.01 m33 update).legendmythe wrote:But I'm getting a compiling error: pspusbdevice.h is missing... I've got PSPMinGW
It usually means Unknown executable format. Do you have USE_KERNEL_LIBS enabled or disabled?legendmythe wrote:I tried changing some stuff, now I get "error 80020148" (unsupported/missing prx file right?);
haven't got any export files...C4TurD4Y wrote:No, it means I don't know what is wrong Can I see your exports file?
Code: Select all
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspusb.h>
#include <pspusbstor.h>
#include <pspusbdevice.h>
#include <pspmodulemgr.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("USB", 0x800, 1, 1);
char usbStatus = 0;
char usbModuleStatus = 0;
int disableUsb(void)
{
if(usbStatus)
{
sceUsbDeactivate(0);
pspUsbDeviceFinishDevice();
sceUsbStop(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0);
usbStatus = 0;
sceKernelDelayThread(300000);
printf("USB Connection");
}
return 0;
}
int enableUsb()
{
if (usbStatus == 1)
{
disableUsb();
return 0;
}
if(!usbModuleStatus)
{
pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbdevice.prx", PSP_MEMORY_PARTITION_KERNEL);
usbModuleStatus = 1;
}
if (!usbStatus)
{
sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbstorBootSetCapacity(0x800000);
sceUsbActivate(0x1c8);
usbStatus = 1;
sceKernelDelayThread(300000);
printf("USB Connection");
}
return 1;
}
int main (void) {
pspDebugScreenInit();
enableUsb();
return 0;
}
Code: Select all
TARGET = usb
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBS=-lpspusb -lpspusbstor -lpspusbdevice
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = USB Test
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
TARGET = usb
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBS= -lpspusb -lpspusbstor -lpspusbdevice
BUILD_PRX = 1
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = USB Test
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak