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 

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

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



Joined: 10 Sep 2007
Posts: 85

PostPosted: Mon Nov 19, 2007 6:31 pm    Post subject: Did any one ever use the memory stick driver from IPL SDK? Reply with quote

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!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Tue Nov 20, 2007 12:14 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Tue Nov 20, 2007 2:42 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Tue Nov 20, 2007 2:56 am    Post subject: Reply with quote

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 ;)
Back to top
View user's profile Send private message
M.Jackson



Joined: 10 Sep 2007
Posts: 85

PostPosted: Tue Nov 20, 2007 3:42 am    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message Send e-mail Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Tue Nov 20, 2007 5:14 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Tue Nov 20, 2007 8:09 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
M.Jackson



Joined: 10 Sep 2007
Posts: 85

PostPosted: Tue Nov 20, 2007 5:47 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
M.Jackson



Joined: 10 Sep 2007
Posts: 85

PostPosted: Wed Nov 21, 2007 11:50 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Nov 22, 2007 4:35 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Thu Nov 22, 2007 5:42 am    Post subject: Reply with quote

Awesome!!!
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Nov 22, 2007 6:24 am    Post subject: Reply with quote

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 ;)
Back to top
View user's profile Send private message
IM back!



Joined: 17 Apr 2007
Posts: 44

PostPosted: Thu Nov 22, 2007 7:10 am    Post subject: Reply with quote

Quote:
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!
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