 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
peb
Joined: 12 Mar 2007 Posts: 26
|
Posted: Sun Sep 07, 2008 3:17 am Post subject: [resolved] toggle usb/flash0... |
|
|
Hi!
In time, I make test on flash0, just for me, it's test!(Don't think I want release the hundredth HB about flash0^^) and for security I want make prx to toggle USB (flash0). So I have done this prx (I have seen Wildcard src witch I have adapted for 4.xx kernel), but I have probleme, when I run this (via an eboot), my pc detect the device but I can't open it (I see the device, but it put message like I connect my psp in USB/MS without MS^^)
So I have few questions :
1- The probleme can come of attribute of my prx? (0x1006)
2- I must add an assigment? _________________ Sorry for my English, I'm french.
Last edited by peb on Mon Sep 08, 2008 7:30 pm; edited 1 time in total |
|
| Back to top |
|
 |
angelo
Joined: 29 Aug 2007 Posts: 168
|
Posted: Sun Sep 07, 2008 4:14 am Post subject: |
|
|
| Code: | #include <pspkernel.h>
#include <pspdebug.h>
#include <psppower.h>
#include <kubridge.h>
#include <pspusb.h>
#include <pspwlan.h>
#include <pspumd.h>
#include <pspctrl.h>
#include <pspusbstor.h>
#include <pspusbdevice.h>
PSP_MODULE_INFO("PSPRevealed", 0, 1, 1);
#define printf pspDebugScreenPrintf
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
int main() {
pspDebugScreenInit();
SetupCallbacks();
pspDebugScreenSetTextColor(0x0000FF);
SceCtrlData pad;
printf("PSPRevealed by RZX15.\n");
printf("Below is a list of some of your PSP's basic information.\n\n");
printf("Ethernet Address: sceWlanGetEtherAddr(8)\n");
while(1) {
if (sceWlanDevIsPowerOn() == 1) {
printf("Your Wlan Switch is on.\n\n");
}
else {
printf("Your Wlan Switch is turned off.\n\n");
}
break;
}
while(1) {
if (scePowerIsLowBattery() == 1) {
printf("Your Battery is Low.\n");
}
else {
printf("Your Battery is not Low.\n");
}
break;
}
while(1) {
if (scePowerIsBatteryExist() == 1) {
printf("A Battery Exists.\n");
}
break;
}
printf("Your Battery Percentage is scePowerGetBatteryLifePercent().\n");
printf("Battery Temperature: scePowerGetBatteryTemp().\n");
printf("Battery Volt Level: scePowerGetBatteryVolt().\n");
while(1) {
if (scePowerIsBatteryCharging() == 1) {
printf("Your Battery is Charging.\n");
}
else {
printf("Your Battery is Not Charging.\n\n");
}
break;
}
while(1) {
if (kuKernelGetModel() == PSP_MODEL_SLIM_AND_LITE) {
printf("Your PSP is a Slim.\n");
}
break;
}
while(1) {
if (kuKernelGetModel() == PSP_MODEL_STANDARD) {
printf("Your PSP is a Fat.\n");
}
break;
}
kuKernelLoadModule("flash0:/kd/semawm.prx", 0, NULL);
kuKernelLoadModule("flash0:/kd/usbstor.prx", 0, NULL);
kuKernelLoadModule("flash0:/kd/usbstormgr.prx", 0, NULL);
kuKernelLoadModule("flash0:/kd/usbstorms.prx", 0, NULL);
kuKernelLoadModule("flash0:/kd/usbstorboot.prx", 0, NULL);
kuKernelLoadModule("flash0:/kd/usbdevice.prx", 0, NULL);
printf("Press X to Toggle USB.\n");
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbActivate(0x1c8);
}
break;
}
printf("When USB is Toggled, press O to Terminate.\n");
while(1) {
if(pad.Buttons & PSP_CTRL_CIRCLE) {
sceUsbDeactivate(0x1c8);
sceUsbStop(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0);
}
break;
}
printf("Press [] to Toggle USB (FLASH0)\n");
while(1) {
if(pad.Buttons & PSP_CTRL_SQUARE) {
pspUsbDeviceSetDevice(0, 0, NULL);
sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbActivate(0x1c8);
}
break;
}
printf("When USB is Toggled (FLASH0), press Triangle to Terminate.");
while(1) {
if(pad.Buttons & PSP_CTRL_TRIANGLE) {
sceUsbDeactivate(0x1c8);
sceUsbStop(PSP_USBSTOR_DRIVERNAME, 0, 0);
pspUsbDeviceFinishDevice();
sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0);
}
break;
}
sceKernelSleepThread();
return 0;
} |
| Code: | TARGET = psprevealed
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lpspkernel -lpspdebug -lpsppower -lpspkubridge -lpspusb -lpspwlan -lpspumd -lpspctrl -lpspusbstor -lpspusbdevice
LDFLAGS =
PSP_FW_VERSION = 371
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSPRevealed
BUILD_PRX = 1
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak |
ALL the help you need. This was RZX15 work so credits go to him. Simple application but usefull source.
=D
Angelo |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Mon Sep 08, 2008 2:05 am Post subject: |
|
|
pspusbdevice.h :) _________________
Upgrade your PSP |
|
| Back to top |
|
 |
peb
Joined: 12 Mar 2007 Posts: 26
|
Posted: Mon Sep 08, 2008 7:29 pm Post subject: |
|
|
Oh thank you very much!!! I can see my flash0, finally!
And thank RZX15 for your good job ;) _________________ Sorry for my English, I'm french. |
|
| Back to top |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Tue Sep 09, 2008 2:43 am Post subject: |
|
|
| peb wrote: | Oh thank you very much!!! I can see my flash0, finally!
And thank RZX15 for your good job ;) |
i would have said thanks M33 for the SDK... |
|
| Back to top |
|
 |
peb
Joined: 12 Mar 2007 Posts: 26
|
Posted: Tue Sep 09, 2008 3:39 am Post subject: |
|
|
lol, thank everybody who have contributed to do this work and people that help me! (M33, RZX15 and people that I have forgotten) ;) _________________ Sorry for my English, I'm french. |
|
| Back to top |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Tue Sep 09, 2008 4:38 am Post subject: |
|
|
i'm sorry if i'm offtopic, but i wanna say...
lol! |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Tue Sep 09, 2008 7:21 am Post subject: |
|
|
@peb, the usage IS VERY SIMPLE, you must thank m33 team only, the pspusbdevice.h files has enough comments which tell you how to use the functions. RZX15 only made usage of them.
most of the file posted is not needed for USB access _________________
Upgrade your PSP |
|
| Back to top |
|
 |
|
|
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
|