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 

What's the matter? [usb connection problem inside]

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



Joined: 26 Oct 2008
Posts: 37

PostPosted: Fri Oct 31, 2008 4:46 am    Post subject: What's the matter? [usb connection problem inside] Reply with quote

Code:
#include "pspkern.h"
#include <pspkernel.h>
#include <pspiofilemgr.h>
#include <pspctrl.h>
#include "dump.h"
#include <psppower.h>
#include <pspumd.h>
#include <pspdisplay.h>
#include <pspusbstor.h>
#include "usbmy.h"
#include <pspusb.h>



PSP_MODULE_INFO("DumperXflash", 0, 1, 0);

#define printf pspDebugScreenPrintf
#define PSP_USBBUS_DRIVERNAME "USBBusDriver"


int sceIoRead(SceUID fd, void *data, SceSize size);
int sceDisplayWaitVblankStart();
int sceIoRemove(const char *file);
int sceIoRmdir(const char *path);
int main(void)
{

    int sceDisplayWaitVblankStart();
        int sceUsbStart();
    int sceUsbActivate();
    int scePowerSetClockFrequency();
    scePowerSetClockFrequency(100, 100, 50);
    sceIoUnassign("flash0:");
    sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
    SceCtrlLatch latch;
    pspDebugScreenInit();
    pspDebugScreenClear();
    SetupCallbacks();
    sceIoUnassign("flash1:");
    sceIoAssign("flash1:", "lflash1:0,1", "flashfat1:", IOASSIGN_RDWR, NULL, 0);
    printf("DumperXflash v. 1,1 by blu_eye4\n");
    printf("Ringrazio Dark_alex per il cf, ps2dev.org per il supporto cosė come psp-ita.com\n");
    printf("Grazie a tyrannid per is suoi esempi del SDK\n");
    printf("premere X per cancellare file config.se dalla flash1");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");
    printf("premere R per stabilire la connessione USB\n");

    for(;;){
            sceCtrlReadLatch(&latch);
    if(latch.uiMake & PSP_CTRL_CIRCLE)
    {
            dump_filesystem("flash1:/", "ms0:/flash1");
         pspDebugScreenClear();
            printf("\n\nFatto\n\n");
    printf("premere X per cancellare file config.se dalla flash1");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");
    }
    if(latch.uiMake & PSP_CTRL_SQUARE)
    {
        dump_filesystem("flash0:/", "ms0:/flash0");
        pspDebugScreenClear();
        printf("\n\nFatto\n\n");
    printf("premere X per cancellare file config.se dalla flash1");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");;

    }
    if(latch.uiMake & PSP_CTRL_TRIANGLE)
    {
        int coso;
        printf("eliminazione file...\n");
        sceIoRemove("flash0:/dic/apotp.dic");
        sceIoRemove("flash0:/dic/atokp.dic");
        sceIoRemove("flash0:/dic/aux0.dic");
        sceIoRemove("flash0:/dic/aux1.dic");
        sceIoRemove("flash0:/dic/aux2.dic");
        sceIoRemove("flash0:/dic/aux3.dic");


        coso = sceIoRemove("flash0:/dic/apotp.dic");
        if(coso < 0){
            printf("errore!!!\n");
            printf("\n errore : %x\n", sceIoRemove("flash0:/dic"));
        }
        if(coso >= 0){
        printf("\nFatto\n");
    printf("premere X per cancellare file config.se dalla flash1\n");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");
    }
    if(latch.uiMake & PSP_CTRL_CROSS){
        sceIoRemove("flash1:/config.se");
        if(coso < 0){
            printf("errore!!!\n");
            printf("errore numero : %x\n", sceIoRemove("flash1:/config.se"));
    }
    else {
        printf("\nFatto\n");
        printf("premere O per dump flash 1\n");
        printf("premere [] per dump flash 0\n");
        printf("premere HOME per uscire \n");
        printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    }
    while(1) {
      if(latch.uiMake & PSP_CTRL_RTRIGGER) {
         sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
         sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
       sceUsbActivate(0x1c8);
      }
      break;
   }
        int prova = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
        if(prova != 0){
            printf("\n errore %x\n", sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0));
        }
        else
        {
            printf("Connessione stabilita\n");
    }
    }
    }
    }

    sceDisplayWaitVblankStart();
    return 0;
}



Where do I wrong? I don't understand error... Cygwin compile it without error or warning but when i play it on my psp there is a black display and i can't do nothing... please help me :)
Back to top
View user's profile Send private message
Wally



Joined: 26 Sep 2005
Posts: 672

PostPosted: Fri Oct 31, 2008 6:45 am    Post subject: Reply with quote

add

PSP_HEAP_SIZE_KB(-1024);

Wally
Back to top
View user's profile Send private message AIM Address
blu_eye4



Joined: 26 Oct 2008
Posts: 37

PostPosted: Fri Oct 31, 2008 7:14 am    Post subject: Reply with quote

Wally4000 wrote:
add

PSP_HEAP_SIZE_KB(-1024);

Wally

I'm sorry, it doesn't work... thanks for your time
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Oct 31, 2008 7:31 am    Post subject: Reply with quote

Init the debugging FIRST, and do some prints around all the USB setup so you can see where it's hanging.
Back to top
View user's profile Send private message AIM Address
blu_eye4



Joined: 26 Oct 2008
Posts: 37

PostPosted: Fri Oct 31, 2008 8:09 pm    Post subject: Reply with quote

J.F. wrote:
Init the debugging FIRST, and do some prints around all the USB setup so you can see where it's hanging.



Code:
#include "pspkern.h"
#include <pspkernel.h>
#include <pspiofilemgr.h>
#include <pspctrl.h>
#include "dump.h"
#include <psppower.h>
#include <pspumd.h>
#include <pspdisplay.h>
#include <pspusbstor.h>
#include "usbmy.h"
#include <pspusb.h>



PSP_MODULE_INFO("DumperXflash", 0, 1, 0);

#define printf pspDebugScreenPrintf
#define PSP_USBBUS_DRIVERNAME "USBBusDriver"
#define PSP_USB_ACTIVATED 0x200


int sceIoRead(SceUID fd, void *data, SceSize size);
int sceDisplayWaitVblankStart();
int sceIoRemove(const char *file);
int sceIoRmdir(const char *path);
int main(void)
{
    pspDebugScreenInit();
    pspDebugScreenClear();
    SetupCallbacks();
    int sceDisplayWaitVblankStart();
    int scePowerSetClockFrequency();
    scePowerSetClockFrequency(100, 100, 50);
    sceIoUnassign("flash0:");
    sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
    SceCtrlLatch latch;
    sceIoUnassign("flash1:");
    sceIoAssign("flash1:", "lflash1:0,1", "flashfat1:", IOASSIGN_RDWR, NULL, 0);
    printf("DumperXflash v. 1,1 by blu_eye4\n");
    printf("Ringrazio Dark_alex per il cf, ps2dev.org per il supporto cosė come psp-ita.com\n");
    printf("Grazie a tyrannid per is suoi esempi del SDK\n");
    printf("premere X per cancellare file config.se dalla flash1");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");
    printf("premere R per stabilire la connessione USB\n");

    for(;;){
            sceCtrlReadLatch(&latch);
    if(latch.uiMake & PSP_CTRL_CIRCLE)
    {
            dump_filesystem("flash1:/", "ms0:/flash1");
         pspDebugScreenClear();
            printf("\n\nFatto\n\n");
    printf("premere X per cancellare file config.se dalla flash1");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");
    }
    if(latch.uiMake & PSP_CTRL_SQUARE)
    {
        dump_filesystem("flash0:/", "ms0:/flash0");
        pspDebugScreenClear();
        printf("\n\nFatto\n\n");
    printf("premere X per cancellare file config.se dalla flash1");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");;

    }
    if(latch.uiMake & PSP_CTRL_TRIANGLE)
    {
        int coso;
        printf("eliminazione file...\n");
        sceIoRemove("flash0:/dic/apotp.dic");
        sceIoRemove("flash0:/dic/atokp.dic");
        sceIoRemove("flash0:/dic/aux0.dic");
        sceIoRemove("flash0:/dic/aux1.dic");
        sceIoRemove("flash0:/dic/aux2.dic");
        sceIoRemove("flash0:/dic/aux3.dic");


        coso = sceIoRemove("flash0:/dic/apotp.dic");
        if(coso < 0){
            printf("errore!!!\n");
            printf("\n errore : %x\n", sceIoRemove("flash0:/dic"));
        }
        if(coso >= 0){
        printf("\nFatto\n");
    printf("premere X per cancellare file config.se dalla flash1\n");
    printf("premere O per dump flash 1\n");
    printf("premere [] per dump flash 0\n");
    printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    printf("premere HOME per uscire senza effettuare alcuna operazione\n");
    }
    if(latch.uiMake & PSP_CTRL_CROSS){
        sceIoRemove("flash1:/config.se");
        if(coso < 0){
            printf("errore!!!\n");
            printf("errore numero : %x\n", sceIoRemove("flash1:/config.se"));
    }
    else {
        printf("\nFatto\n");
        printf("premere O per dump flash 1\n");
        printf("premere [] per dump flash 0\n");
        printf("premere HOME per uscire \n");
        printf("premere triangolo per eliminare il file config.se dalla flash1\n");
    }
                    if(latch.uiMake & PSP_CTRL_RTRIGGER)
                            {
                                int sceUsbStart();
                                int sceUsbActivate();
                                sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
                                sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
                                sceUsbActivate(0x1c8);
      }

        int prova = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
        if(prova != 0){
            printf("\n errore %x\n", sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0));
        }
        else
        {
            printf("Connessione stabilita\n");
    }
    }
    }
    }

    sceDisplayWaitVblankStart();
    return 0;
}


I've changed some things but homebrew doesn't work... I don'y know what I have to do... please help me and excuse me but I'm a noob in c language :)
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Nov 01, 2008 6:24 am    Post subject: Reply with quote

Try something simple first then. Why does everyone try to do an XBox 360 emulator (or equivalent) as their FIRST program? Whatever happened to "Hello World"? :D

Until you figure out from the samples and existing apps how the PSP apps work, I wouldn't bother trying to write anything specific.
Back to top
View user's profile Send private message AIM Address
PosX100



Joined: 15 Aug 2007
Posts: 98

PostPosted: Mon Nov 03, 2008 2:00 am    Post subject: Reply with quote

So this is the brand-new universal-multi-bricker? cool...

The first thing i've noticed , is that you're declaring functions inside main,
and i was about to "hit" "backspace" , but i decided to give it one last chance.

HINT : You're updating the screen surface outside main loop , and to be exact , just before
the program quits.
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