Welcome! Log In Create A New Profile

Advanced

Opening USB device 2nd parition

Posted by bobribbon 
Opening USB device 2nd parition
February 20, 2010 01:57PM
Hi everybody,

So far I have no problem accessing files on the first partition. However I would like to access files on the 2nd partition on an USB device. Any thoughts on how to achieve this?

Sincerely yours,
bobribbon
Re: Opening USB device 2nd parition
February 24, 2010 10:15AM
I think this isn't coded in libfat.

Try using libelm, perhaps it works with it (i'm interested about your results).
Re: Opening USB device 2nd parition
February 25, 2010 01:25AM
Sure it is. You just have to pass the starting sector of the partition to fatMount.
Re: Opening USB device 2nd parition
February 25, 2010 10:23AM
Lol, yes you're right. But how do you find the start sector?
Re: Opening USB device 2nd parition
February 25, 2010 08:43PM
Exactly... How do I find the startsector of a partition?
Re: Opening USB device 2nd parition
February 25, 2010 11:00PM
You have to hope the disk has a readable partition table, and parse it. Look in the libfat source code, partition.c contains a function called FindFirstValidPartition that parses the table looking for FAT partitions.
Re: Opening USB device 2nd parition
February 26, 2010 11:10AM
Thank you tueidj. I will try to implement some new feature in a personal mod of libfat (starting by correcting a memory leak i've found in libfat)
Re: Opening USB device 2nd parition
February 26, 2010 01:38PM
Mind sharing? I've run memory leak tests on my programs (mounting and unmounting different volumes) and haven't detected any.
Re: Opening USB device 2nd parition
February 26, 2010 03:15PM
You can have an exemple of memory leak detection here?

[forums.devkitpro.org]

But, the pb is that i can't find the memory leak just by reading the code of libfat. I hope the leak isn't in libogc or worst, in iosupport.h/iosupport.c


And yes, i can share the project. But before i need to explore libelm.
Re: Opening USB device 2nd parition
February 26, 2010 05:46PM
There's a bug in your code, that's what's causing the memory leak.

fatUnmount("sd"); is incorrect - that should be fatUnmount("sd:");
Re: Opening USB device 2nd parition
March 01, 2010 04:30PM
Thank you.
Sorry, only registered users may post in this forum.

Click here to login