Author Topic: Naming Of Locations In The Files Tab  (Read 4487 times)

iamasmith

  • Hero Member
  • *****
  • Posts: 1248
    • View Profile
Naming Of Locations In The Files Tab
« on: March 23, 2005, 05:57:38 pm »
Hi,

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
OpenBSD 4.2 -current on full 4Gb of SL-C3000
Microdrive replaced with 4Gb SanDisk Extreme III card

adf

  • Hero Member
  • *****
  • Posts: 2807
    • View Profile
    • http://
Naming Of Locations In The Files Tab
« Reply #1 on: March 25, 2005, 05:16:06 pm »
Maybe have a shot at editing /etc/mtab?
« Last Edit: March 25, 2005, 05:22:31 pm by adf »
**3100 Zubuntu Jaunty,(working on Cacko dualboot), 16G A-Data internal CF, 4G SD, Ambicom WL-1100C Cf, linksys usb ethernet,  BelkinF8T020 BT card, Belkin F8U1500-E Ir kbd, mini targus usb mouse, rechargeble AC/DC powered USB hub, psp cables and battery extenders.

**6000l  Tetsuized Sharprom, installed on internal flash only 1G sd, 2G cf

iamasmith

  • Hero Member
  • *****
  • Posts: 1248
    • View Profile
Naming Of Locations In The Files Tab
« Reply #2 on: March 25, 2005, 05:31:46 pm »
Quote
Maybe have a shot at editing /etc/mtab?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=72292\"][{POST_SNAPBACK}][/a][/div]

mtab just holds the list of current mounts... it's standard Linux stuff... not related to Qtopia.
« Last Edit: March 25, 2005, 05:32:00 pm by iamasmith »
OpenBSD 4.2 -current on full 4Gb of SL-C3000
Microdrive replaced with 4Gb SanDisk Extreme III card

kahm

  • Hero Member
  • *****
  • Posts: 657
    • View Profile
Naming Of Locations In The Files Tab
« Reply #3 on: March 30, 2005, 01:40:14 pm »
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.
Fujitsu U8240 "Stormtrooper" -  Zaurus Supplement
Libretto U100 | Sony Librie, Sony Reader
SL-C3100: Sharp 1.11JP (Kanji Dictionary/Translator) - LCD Top swap with C1000.
SL-C3000: pdaXii13 5.4.7, SL-C3000 5.4.9 - microdrive replaced with 8gb Sandisk
SL-C1000: PDAXRom Beta3 | SL-6000L: Sharp 1.12 | SL-5500: Cacko, 64-0 kernel | SL-5000D: OZ-Opie
Linksys WCF12; Sharp CE-AG06, CE-RH2, CE-170TS; iRiver USB OTG Host cable; Socket BT rev.E CF; Hitachi 6gb Microdrive

iamasmith

  • Hero Member
  • *****
  • Posts: 1248
    • View Profile
Naming Of Locations In The Files Tab
« Reply #4 on: April 07, 2005, 07:30:38 am »
Quote
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 libqpe.so)

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)...

Code: [Select]
           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

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..

Code: [Select]
class QTOPIA_EXPORT FileSystem
{
public:
    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"); }

private:
    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
« Last Edit: April 07, 2005, 07:32:42 am by iamasmith »
OpenBSD 4.2 -current on full 4Gb of SL-C3000
Microdrive replaced with 4Gb SanDisk Extreme III card