Did any one ever use the memory stick driver from IPL SDK?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
M.Jackson
Posts: 85
Joined: Mon Sep 10, 2007 6:37 pm
Contact:

Did any one ever use the memory stick driver from IPL SDK?

Post by M.Jackson »

I am trying to utlize the memory stick driver from the IPL SDK to create something useful, but i am getting increasingly frustrated on it as the ms driver seems not working as expected. The existing driver provides a simple interface to read out one sector (512 bytes) of data at a time. My problem is, when I try to read out the first sector (sector 0), I didn't get the sector 0's data but instead 512 bytes of junk data preceding with lots of zeros. Normally, sector 0 should be something like this:

Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F

00000000 EB 58 90 20 20 20 20 20 20 20 20 00 02 40 20 00 隭? ..@ .
00000010 02 00 00 00 00 F8 00 00 3E 00 A0 00 DE 00 00 00 .....?.>.??..
00000020 E2 07 78 00 C1 03 00 00 00 00 00 00 02 00 00 00 ?x.?..........
00000030 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 00 01 29 00 00 00 00 20 20 20 20 20 20 20 20 20 ..)....
00000050 20 20 46 41 54 33 32 20 20 20 00 00 00 00 00 00 FAT32 ......
00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA ..............U?


But what i was getting was like:

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 03800000
9F0C0025 00DE18FE 07E20000 00000078 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 AA550000


Only the last few bytes seem making sense. Is there a different sector numbering system in this physical level compared to the logical level?(whereby sector 0 is actually not sector "0"?) Or, is the memory stick driver from the IPL SDK specifically targetting certain type of psp hardware that is not compatible with mine?

Thanks!
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

That looks like an MS-DOS master boot record. The bytes at the end is the partition table. Looks like the partition start is at sector 222.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

You don't even know how drive formatting works and you're trying to read/write the stick directly? Remind me not to use whatever you're working on when it gets released. :)

A memstick is formatted like a harddrive, not a floppy. If you don't know the difference, you shouldn't be attempting to mess with the memstick.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

You wanted to get the first sector of the logical first partition, but obviously you got the first physical sector.

Some of the numbers that are not zero will guide you to the logical partition start ;)
M.Jackson
Posts: 85
Joined: Mon Sep 10, 2007 6:37 pm
Contact:

Post by M.Jackson »

actually I do want to get the first physical sector which, in my mind, should look more like the first table I showed (the one with a text of "FAT32" in between), because that's what i got when i mounted ms0 to my pc through the usb cable and read out sector 0 of that mounted disk via some other tool. But now it seems to me that I could have been having wrong pictures about sector 0 all along. Are you folks suggesting that the first table I showed is just a logical sector while the second one I got is genuinely the first physical sector of the memory stick? I think I should probably do more readings about sectors and file systems...
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

M.Jackson wrote:actually I do want to get the first physical sector which, in my mind, should look more like the first table I showed (the one with a text of "FAT32" in between), because that's what i got when i mounted ms0 to my pc through the usb cable and read out sector 0 of that mounted disk via some other tool. But now it seems to me that I could have been having wrong pictures about sector 0 all along. Are you folks suggesting that the first table I showed is just a logical sector while the second one I got is genuinely the first physical sector of the memory stick? I think I should probably do more readings about sectors and file systems...
Well, maybe that other tool showed the first sector of the logical unit. In windows, this would have a drive letter. The physical device wouldn't have any letter, but a name such as \\.\PhysicalDrive0

You can use the dd command in linux/cygwin like this to get the first sector:

dd if=/dev/sda of=sector.bin bs=512 count=1

where /dev/sda should be replaced with your memory stick device.
adrahil
Posts: 274
Joined: Thu Mar 16, 2006 1:55 am

Post by adrahil »

The MS Driver works really well -.-
And for FAT support, just look at Tiny-FatFs (http://elm-chan.org/fsw/ff/00index_e.html) where the code was taken from.
M.Jackson
Posts: 85
Joined: Mon Sep 10, 2007 6:37 pm
Contact:

Post by M.Jackson »

Haha i got it. the "FAT32" sector is indeed in sector 222. it turns out the "junk data" i got actually tells all the things i needed to know. previously i did roughly know the difference between harddrive and floppy, but it just never came to my mind that the memory stick could have been constructed as complex as a harddrive that can contain multiple partitions. looking back it now makes more sense to me that why ms0 is called ms"0", because theoretically there could be ms1, ms2 and more.

You guys are just amazingly helpful. Great thanks!
M.Jackson
Posts: 85
Joined: Mon Sep 10, 2007 6:37 pm
Contact:

Post by M.Jackson »

Cool! I just successfully mounted a vfat fs on the block device controlling the memory stick so that my linux port can now access the ms just the way I wanted to. The only drawback is that i got so excited that i forgot to unmount the thing before shutting down the psp. luckly i didn't damage the fat fs beyond repair -_-!!! Still, this makes me feeling so good right now. Thanks to you guys again!
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

M.Jackson wrote:Cool! I just successfully mounted a vfat fs on the block device controlling the memory stick so that my linux port can now access the ms just the way I wanted to. The only drawback is that i got so excited that i forgot to unmount the thing before shutting down the psp. luckly i didn't damage the fat fs beyond repair -_-!!! Still, this makes me feeling so good right now. Thanks to you guys again!
Ah, good news indeed. Linux isn't very useful if it doesn't have a decent storage medium to load from.
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

Awesome!!!
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

J.F. wrote:
M.Jackson wrote:Cool! I just successfully mounted a vfat fs on the block device controlling the memory stick so that my linux port can now access the ms just the way I wanted to. The only drawback is that i got so excited that i forgot to unmount the thing before shutting down the psp. luckly i didn't damage the fat fs beyond repair -_-!!! Still, this makes me feeling so good right now. Thanks to you guys again!
Ah, good news indeed. Linux isn't very useful if it doesn't have a decent storage medium to load from.
Anyways, this driver is much slower than firmware one, so there is not a "decent" storage medium yet :)
The memory stick reading in mscm is much more complex that this driver that is based on the pre-ipl. Adrahil, you have to make a V2 with whatever trick mscm use to speed things ;)
IM back!
Posts: 44
Joined: Tue Apr 17, 2007 9:53 pm

Post by IM back! »

moonlight wrote: Ah, good news indeed. Linux isn't very useful if it doesn't have a decent storage medium to load from.
Anyways, this driver is much slower than firmware one, so there is not a "decent" storage medium yet :)
The memory stick reading in mscm is much more complex that this driver that is based on the pre-ipl. Adrahil, you have to make a V2 with whatever trick mscm use to speed things ;)
still its a huge improvement some time ago I was fiddling with the psp Linux ramdisk (porting some small apps like my own address book.) it was hell on wheels trying to fit things in the psps ram 2 times. so any ms access is better than none.
sorry for spelling!
Post Reply