Page 1 of 1

usb_mass read dir issue

Posted: Sun Jun 08, 2008 4:42 am
by kouky
Hello, I'm trying to find a way to read directories on a usb stick.

I'm using the usb_mass example, the moduels are said to be correctly loaded, but...
the function:

listDirectory("/");

Code: Select all

void listDirectory(char* path) {
	int ret;
	fat_dir_record record;
	int counter = 0;
	
	TWIN_PRINTF("DIRECTORY LIST path=%s \n", path);
	TWIN_PRINTF("------------------------------------ \n");
        /* list the root directory */

	ret = usb_mass_getFirstDirentry(path, &record);
	while (ret > 0 ) {
		counter++;
		listDirRecord(&record);
		ret = usb_mass_getNextDirentry(&record);
	}
	if (counter == 0) {
                TWIN_PRINTF("no files in root directory ? \n");
	}
}
always return the "no files in root directory ?" error...
I've tried with "/", "mass:/", "mass0:/", "mass://" but always the same error...

any help ?

Hint: I'm using the pink slim PS2, I'm booting with Swap magic, and I'm running the mass_example.elf from the same usb stick I'm triying to read thre directories from.

Posted: Fri Jun 13, 2008 6:11 pm
by Lukasz
I'm getting the same results for my usb pendrive, there are files on the pendrive, however the usb mass example does not list them.

Posted: Fri Jun 13, 2008 8:56 pm
by cosmito
Hmm interesting. It worked on particular conditions... Could it be an init issue?

My load procedure : Boot from Datel Memory Plus 64 using lukasz loader http://lukasz.dk/2008/04/22/datel-memory-plus-64-mb which loads uLE as mc0:/BESLES-00000 MP/EXECUTE1.ELF, launch PS2Link1.51, launch mass_example.elf : And I get the same results as you.

But, if I do the same boot procedure as above but boot the PS2 with the USB pen inserted (although uLE is still loaded from the memory card, not from USB), the example works fine.

@kouky,
Also look at oggplayerbeta01 from CarelessWhisper. It reads dir and loads (ogg) files from USB just fine :
http://www.ps2-scene.org/forums/ps2-hom ... hlight=Ogg

Posted: Sun Jun 15, 2008 4:09 am
by kouky
Just tried the oggplayerbeta01 and it works :)

I'll try to investigate its source now.

Thanks for your help!