As you know, Psp'camera use the two sheet metals beside the usb interface to supply power,and now i want to use them to supply power for
my own deivce,but i don't know if there is a function to control the power on or off, and what function i can call.
Sorry for my english.
			
			
									
									
						how to get power from psp?
It's a bit old but I got someone to make a PRX Plugin to enable the power using L+R in the XMB way back.
Not sure if it works with current firmwares...
https://lan.st/showpost.php?p=5815&postcount=18
			
			
									
									
						Not sure if it works with current firmwares...
https://lan.st/showpost.php?p=5815&postcount=18
- 
				Dariusc123456
- Posts: 388
- Joined: Tue Aug 12, 2008 12:46 am
Dariusc123456 wrote:He asking for a command to activate his device power.
No really..? *rolls eyes* l beleive it's one click from the link I posted. The full source for the PRX. So don't be so quick to flame the help you idiot..
Code: Select all
#include <pspsdk.h>
#include <pspdisplay.h>
#include <pspuser.h>
#include <pspctrl.h>
#include <string.h>
#include <pspusb.h>
#include <stdio.h>
#include <sys/unistd.h>
#define PSP_USBGPS_PID 0x283
#define printf pspDebugScreenPrintf
#define PSP_USBGPS_DRIVERNAME "USBGps_Driver"
#define PSP_CTRL_COMBO PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER
PSP_MODULE_INFO("SoftSwitch", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
u32 usbState = 0;
SceCtrlData newInput;
int err, kill_threads = 0;
/* Helper function for input_thread. */
int checkInput(int PSP_CTRL_BUTTON) {
	return ((newInput.Buttons & (PSP_CTRL_COMBO | PSP_CTRL_BUTTON)) == (PSP_CTRL_COMBO | PSP_CTRL_BUTTON));
}
void input_thread(SceSize args, void *argp) {
	u32 oldInput = 0;
	while (!kill_threads) {
		sceCtrlPeekBufferPositive(&newInput, 1);
		if (newInput.Buttons != oldInput) {
			if (checkInput(PSP_CTRL_TRIANGLE)) kill_threads = 1;
			if (checkInput(PSP_CTRL_SQUARE)) {
				if (usbState & PSP_USB_ACTIVATED) sceUsbDeactivate(PSP_USBGPS_PID); else sceUsbActivate(PSP_USBGPS_PID);
				usbState = sceUsbGetState();
			}
		}
		oldInput = newInput.Buttons;
		sceKernelDelayThread(1000);
	}
	sceKernelExitDeleteThread(0);
}
u32 moduleLoadStart (const char *path) {
	SceUID loadResult, startResult;
	int status;
	loadResult = sceKernelLoadModule(path, 0, NULL);
	if (loadResult & 0x80000000) return 1;
	startResult = sceKernelStartModule(loadResult, 0, NULL, &status, NULL);
	if (loadResult != startResult) return 2;
	return 0;
}
void initialize() {
	err = moduleLoadStart("ms0:/prx/usbacc.prx");
	if (err) printf("Error loading USB Accessory Module (0x%08X)/n", err);
	err = moduleLoadStart("ms0:/prx/usbgps.prx");
	if (err) printf("Error loading GPS Accessory Module (0x%08X)/n", err);
	err = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
	if (err) printf("Error starting USB BUS Driver (0x%08X)/n", err);
	err = sceUsbStart("USBAccBaseDriver", 0, 0);
	if (err) printf("Error starting USB Accessory Driver (0x%08X)/n", err);
	err = sceUsbStart(PSP_USBGPS_DRIVERNAME,0,0);
	if (err) printf("Error starting USB GPS Driver (0x%08X)/n", err);
	err = sceUsbActivate(PSP_USBGPS_PID);
	if (err) printf("Error activating USB GPS (0x%08X)/n", err);
	usbState = sceUsbGetState();
	printf("USB: %s/n", (usbState & PSP_USB_ACTIVATED) ? "On" : "Off");
}
void exit_thread(SceSize args, void *argp) {
	while (!kill_threads) { sceKernelDelayThread(10000); }
	while (kill_threads) {
		sceUsbDeactivate(PSP_USBGPS_PID);
		err = sceUsbStop(PSP_USBGPS_DRIVERNAME,0,0);
		if (err) printf("Error stopping USB Gps driver (0x%08X)/n", err);
		err = sceUsbStop("USBAccBaseDriver",0,0);
		if (err) printf("Error stopping USB Acc driver (0x%08X)/n", err);
		err = sceUsbStop(PSP_USBBUS_DRIVERNAME,0,0);
		if (err) printf("Error stopping USB BUS driver (0x%08X)/n", err);
	}
	sceKernelExitDeleteThread(0);
}
int main_thread (SceSize args, void *argp) {
	SceUID input_thid, exit_thid;
	initialize();
	// Start input_thread to detect input conditions.
	input_thid = sceKernelCreateThread("input_thread", (SceKernelThreadEntry)input_thread, 0x20, 0x10000, 0, NULL);
	if (input_thid >= 0) sceKernelStartThread(input_thid, 0, NULL);
	sceKernelDelayThread(1000);
	// Start exit_thread to manage exit.
	exit_thid = sceKernelCreateThread("exit_thread", (SceKernelThreadEntry)exit_thread, 0x21, 0x10000, 0, NULL);
	if (exit_thid >= 0) sceKernelStartThread(exit_thid, 0, NULL);
	sceKernelDelayThread(1000);
	return 0;
}
int module_start (SceSize args, void *argp) {
	SceUID main_thid;
	main_thid = sceKernelCreateThread("main_thread", main_thread, 0x20, 0x10000, 0, NULL);
	if (main_thid >= 0) sceKernelStartThread(main_thid, args, argp);
	return 0;
}