Loop around examples/wii/fs/directory - Test your SD Cards

Post Reply
n2kra
Posts: 4
Joined: Thu Mar 05, 2009 6:32 pm

Loop around examples/wii/fs/directory - Test your SD Cards

Post by n2kra » Mon Apr 20, 2009 6:41 pm

might be more helpfull for testing all your SD cards

I have one (4G PNY micro SDHC class 4)
that works in the Wii (SD Menu, Photo, etc.)
But not Homebrew (also tried the sdcard.org formatter)

in main() after - // the console understands VT
printf( ...

Code: Select all


        while(1) {

                if (!fatInitDefault()) {
                        printf("fatInitDefault failure: terminating\n");
                        goto error;
                }

                DIR *pdir;
                struct dirent *pent;
                struct stat statbuf;

                pdir=opendir("/");

                if (!pdir){
                    printf ("opendir() failure; terminating\n");
                        goto error;
                }

                while ((pent=readdir(pdir))!=NULL) {
                    stat(pent->d_name,&statbuf);
                    if(strcmp(".", pent->d_name) == 0 || strcmp("..", pent->d_name) == 0)
                        continue;
                    if(S_ISDIR(statbuf.st_mode))
                        printf("%s <dir>\n", pent->d_name);
                    if(!(S_ISDIR(statbuf.st_mode)))
                        printf("%s %lld\n", pent->d_name, statbuf.st_size);
                }
                closedir(pdir);
                // Should look into
                // void fatUnmount (const char* name);

error:
                printf ("\n");
//              from TheLemonM on #wiihelp
//              extern bool sdio_Deinitialize();
                if(sdio_Deinitialize()){
                printf ("Ready to change SD cards\n");
                printf ("B - for Next Card\n"); }
                printf ("HOME - to quit\n");

                while(1) {

                        // Call WPAD_ScanPads each loop, this reads the latest controller states
                        WPAD_ScanPads();

                        // WPAD_ButtonsDown tells us which buttons were pressed in this loop
                        // this is a "one shot" state which will not fire again until the button has been released
                        u32 pressed = WPAD_ButtonsDown(0);

                        // We return to the launcher application via exit
                        if ( pressed & WPAD_BUTTON_HOME ) exit(0);

                        if ( pressed & WPAD_BUTTON_B ) break;

                        // Wait for the next frame
                        VIDEO_WaitVSync();
                }
//              from TheLemonM on #wiihelp
//              extern bool sdio_Startup();
                sdio_Startup();
        }

        return 0;
}


dontwantanick
Posts: 19
Joined: Tue Dec 30, 2008 5:44 pm

Re: Loop around examples/wii/fs/directory - Test your SD Cards

Post by dontwantanick » Tue Apr 21, 2009 5:56 pm

I switched to use fatMountSimple instead of fatInitDefault, because fatInitDefault initialises usb too. Basically this wouldn't be a porblem, but it is, because it's not working 100%. If you have any usb devices connected and you do more than just 1 fatinit, you will eventually get problems. And i prefer fatMountSimple over fatInitDefault, because you have a proper matching deinit command with it.

#include <sdcard/wiisd_io.h>

Init:
__io_wiisd.startup();
int ret;
ret = fatMountSimple("sd", &__io_wiisd);

Deinit:
fatUnmount("sd");
__io_wiisd.shutdown();



I know most homebrew uses fatInitDefault, but could you test your sd card with fatMountSimple too and post your results? I doubt it changes the compatibility, but testing doesn't harm, doesn't it?

n2kra
Posts: 4
Joined: Thu Mar 05, 2009 6:32 pm

Re: Loop around examples/wii/fs/directory - Test your SD Cards

Post by n2kra » Wed Apr 22, 2009 12:12 am

Thank You, I like that better -
And then file access actually has to be sd:/

pdir=opendir("sd:/"); // instead of "/"

-

NO - there was no change in the unusable
(from HB, but works in Wii) card.

I did download libogc-src, but I guess IOS'es HC
init will need to be disasmebled and analyzed.

Or can IOS' just be run? instead of libogc's HC init ?

dontwantanick
Posts: 19
Joined: Tue Dec 30, 2008 5:44 pm

Re: Loop around examples/wii/fs/directory - Test your SD Cards

Post by dontwantanick » Wed Apr 22, 2009 12:27 am

Could you repeat that in english without abbreviations? I can't understand you.

n2kra
Posts: 4
Joined: Thu Mar 05, 2009 6:32 pm

Re: Loop around examples/wii/fs/directory - Test your SD Cards

Post by n2kra » Wed Apr 22, 2009 10:16 am

dontwantanick wrote:without abbreviations?
- fs = filesystem, Re: Loop around examples/wii/fs/directory

HB = HomeBrew
n2kra wrote:NO - there was no change in the unusable
(from HB, but works in Wii) card.
HC = High Capacity - Re: I have one (4G PNY micro SDHC class 4)
http://www.sdcard.org/
IOS = http://wiibrew.org/wiki/Nintendo_software
n2kra wrote:I did download libogc-src, but I guess IOS'es HC init...

Or can IOS' just be run? instead of libogc's HC init ?
while you are at wiibrew.org, you might want to go
"Main Page", and scroll down to the bottom Navigation.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests