Help - Search - Members - Calendar
Full Version: Naming Of Locations In The Files Tab
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > Qt/Qtopia

On Sharp ROMs with the Files tab you seem to be able to mount anything that you like under /mnt and there's something that maps the device name thats mounted to a meaningful name.

Mount anything on /dev/mtdblockx and it gets called 'Internal Flash' on the Files tab.

Mount SD Card or CF card and you get the appropriate Icon and an appropriately named file.

Bind mount /tmp into /mnt somewhere and it comes back as 'Temporary Storage'.

Anyone know how to set up new mappings? It would be nicer to have an Icon and a name appear when USB storage is mounted... I looked at Anton's card manager and I'm pretty sure we can add the prerequisite functionality to mount/unount USB storage like SD Card or CF Card... it would be good to have an Icon and a Name though and this is the only bit that isn't particularly obvious.

- Andy
Maybe have a shot at editing /etc/mtab?
QUOTE(adf @ Mar 25 2005, 10:16 PM)
Maybe have a shot at editing /etc/mtab?

mtab just holds the list of current mounts... it's standard Linux stuff... not related to Qtopia.
I suspect this might be one of those "Built-In-Qtopia" things like application font selection.

Of course I haven't taken the time to dissect the rom, so I could be entirely wrong. I certainly hope so - USB storage showing up in the files tab might be nice.

A downside is that some applications search *everything* in the file tab during some operations - so if you stuck a portable hard drive on there you'd be stuck waiting for 40 minutes trying to open your app as it enumerates every file on the hard drive.
QUOTE(kahm @ Mar 30 2005, 06:40 PM)
I suspect this might be one of those "Built-In-Qtopia" things like application font selection.

It is indeed, trawled through the Qtopia source and found it in src/libraries/qtopia/storage.cpp (which becomes part of

It's implemented as part of the StorageInfo class on the update() member function and looks like this in Qtopia 1.7 (which is the source that I'm reading)...

           if ( isCF(humanname) ) {
               humanname = tr("CF Card");
               removable = TRUE;
           } else if ( humanname == "/dev/hda1" ) {
               humanname = tr("Hard Disk");
           } else if ( humanname.left(9) == "/dev/mmcd" ) {
               humanname = tr("SD Card");
               removable = TRUE;
           } else if ( humanname.left(7) == "/dev/hd" )
               humanname = tr("Hard Disk") + " " + humanname.mid(7);
           else if ( humanname.left(7) == "/dev/sd" )
               humanname = tr("SCSI Hard Disk") + " " + humanname.mid(7);
           else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" )
               humanname = tr("Internal Storage");
           else if ( humanname.left(14) == "/dev/mtdblock/" )
               humanname = tr("Internal Storage") + " " + humanname.mid(14);
           else if ( humanname.left(13) == "/dev/mtdblock" )
               humanname = tr("Internal Storage") + " " + humanname.mid(13);
           else if ( humanname.left(8) == "/dev/ram" )
               humanname = tr("RAM disk") + " " + humanname.mid(8);
           FileSystem *fs = new FileSystem( *it, *fsit, humanname, removable, opts );

I can only assume that in the Sharp Qtopia 1.5 build that the "SCSI Hard Disk" bit is missing which is why /dev/sda1 mounts show up without the name sad.gif

Since the FileSystem class does not expose a function to modify the humanname member it can't be done... in fact the FileSystem class has no entry to these members apart from the constructor for the class....hmm....great thinking (NOT) and exposes only one member - update() - which uses statfs to update the file system stats in the class.

You may ask how Qtopia gets the info out of the class with only one member.. the answer is in storage.h and is pretty rudimentary..

class QTOPIA_EXPORT FileSystem
   const QString &disk() const { return fsdisk; }
   const QString &path() const { return fspath; }
   const QString &name() const { return humanname; }
   const QString &options() const { return opts; }
   long blockSize() const { return blkSize; }
   long totalBlocks() const { return totalBlks; }
   long availBlocks() const { return availBlks; }
   bool isRemovable() const { return removable; }
   bool isWritable() const { return opts.contains("rw"); }

   friend class StorageInfo;
   FileSystem( const QString &disk, const QString &path, const QString &humanname, bool rem, const QString &opts );
   void update();

Ah well, at least I tried.

- Andy
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.