USB Mass Storage mounting wrong partition


pmprog

DNF (Did Not Finish)
Joined
Apr 25, 2011
Messages
4,150
I've got a 64GB card which has two partitions, one called Gaming, and another called Transfers (stored in that order).

If I use the Mass Storage Mode on /media/Transfers, it says on the Pandora that's what it's done, but on my PC it shows up as my Gaming partition.

Does anyone know why it might be doing this, and how to get it to actually mount the partition I want?
 
Oh now I get it, the SD card stays in the Pandora, which acts as a USB mass storage device. No ideas.
 
Windows PC? Linux PC?
Windows, though I would have thought it was the Pandora side that did the mapping of partition to the USB host
While this is certainly true, afaik Windows (at least up to Version 7) is not able or willing to handle two partitions on a removable mass storage device. What does the device manager say about the partitions on the SD-Card connected via the Pandora ?
 
Last edited by a moderator:
Windows PC? Linux PC?
Windows, though I would have thought it was the Pandora side that did the mapping of partition to the USB host
While this is certainly true, afaik Windows (at least up to Version 7) is not able or willing to handle two partitions on a removable mass storage device. What does the device manager say about the partitions on the SD-Card connected via the Pandora ?
So does it mount the SD card device rather than the partition? If that's the case, then I guess that would explain it, but wouldn't it make sense to have the mass storage menus to list devices instead of partitions?
 
Windows PC? Linux PC?
Windows, though I would have thought it was the Pandora side that did the mapping of partition to the USB host
While this is certainly true, afaik Windows (at least up to Version 7) is not able or willing to handle two partitions on a removable mass storage device. What does the device manager say about the partitions on the SD-Card connected via the Pandora ?
So does it mount the SD card device rather than the partition? If that's the case, then I guess that would explain it, but wouldn't it make sense to have the mass storage menus to list devices instead of partitions?
I don't have the slightest clue, I tried to have a look in the op_storage.sh, but I don't understand a lot of it, but I guess the important part is

selection2=$(echo "$selection" | sed 's/ /\\\\040/g')

...

device2=$(grep "${selection2}" /proc/mounts | awk '{print $1}')

...

modprobe g_file_storage file=$device stall=0 removable=1
Doing guesswork according to variable names, I would say yes, to your question, but then again they already look like as the script has gone through some changes in the past.

If the module parameter "removable" does what I think it does ("marking the device as non removeable > hdd"), you may be able to easily test it by setting in to 0 and see if windows now detects two new drives.
 
Doing guesswork according to variable names, I would say yes, to your question, but then again they already look like as the script has gone through some changes in the past.

If the module parameter "removable" does what I think it does ("marking the device as non removeable > hdd"), you may be able to easily test it by setting in to 0 and see if windows now detects two new drives.
Interestingly enough, I think I was one of the last to edit it (to support mounting direct from the command line).
If you change this line

Code:
modprobe g_file_storage file=$device stall=0 removable=1
to
Code:
modprobe g_file_storage file=$device2 stall=0 removable=1
If mounts the correct partition, not the whole SD card.
 
Doing guesswork according to variable names, I would say yes, to your question, but then again they already look like as the script has gone through some changes in the past.

If the module parameter "removable" does what I think it does ("marking the device as non removeable > hdd"), you may be able to easily test it by setting in to 0 and see if windows now detects two new drives.
Interestingly enough, I think I was one of the last to edit it (to support mounting direct from the command line).
If you change this line

modprobe g_file_storage file=$device stall=0 removable=1
to
Code:
modprobe g_file_storage file=$device2 stall=0 removable=1
If mounts the correct partition, not the whole SD card.
I thought that the 'substr' was the key here, but I had no clue what grep would return in that particular case.
Interestingly enough, I think I was one of the last to edit it (to support mounting direct from the command line).
I know, you even said to have a look at a feature request of mine regarding that functionality some years ago, but I figured If I'm not able to rememeber what code files I worked on three months ago, you may too.
 
I know, you even said to have a look at a feature request of mine regarding that functionality some years ago, but I figured If I'm not able to rememeber what code files I worked on three months ago, you may too
Can you remember what you wanted me to look at? Whilst I can navigate around, linux is still a bit of a mystery to me, so I won't guarantee anything.

It looks like ED has put $device intentionally there:

http://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=commitdiff;h=9ca48b18f6b71e451d1bd0cc3ff9afc30f3a9f44

I can guess he had some reason for that..
I'm surprised it's not been a problem before, because the script only unmounts $device2, but modprobes $device. In my case, it would unmount /media/Transfers, but make /media/Gaming (and media/Transfers?) the USB drive. So if I had a game running, and put Transfers into Mass Storage, I could potentially corrupt the /media/Gaming partition (according to here)

I've tried $device2 on my Pandora, and works okay.

I guess it depends on why ED used $device then

Cheers
 
And what if I have a card with three or more partitions...
 
Somebody needs to test a card without any partitions with this change.
Well, if a card has no partitions, it won't show any items in the list, so you won't be able to mount it anyway.
Maybe the script should be adjusted so you could either mount an SD card device, or a single partition?
 
I modified my script so I can also put mounted USB devices (e.g. an external hard disk) in mass storage mode. I needed that because the combination of cables (and their lengths) made that the most convenient way to attach a hard disk to a wall-mounted TV. I imagine it could also be useful to attach a hard disk (which needs quite some power) to a device that cannot provide enough power on its own.
 
I'm adding pmprog's change to main firmware, we'll see if anyone complains.

_wb_: if you want your change integrated I can take it too, I'd prefer a git patch against openpandora.oe.git .
 
I'm adding pmprog's change to main firmware, we'll see if anyone complains.

_wb_: if you want your change integrated I can take it too, I'd prefer a git patch against openpandora.oe.git .
Please add _wb_s additions too
 
Back
Top