Long filenames - a file browser modification for Select Script File menu

  • 101 Replies
  • 12743 Views
*

Offline srsa_4c

  • ******
  • 3710
Re: Long filenames - a file browser modification for Select Script File menu
« Reply #10 on: 09 / December / 2014, 16:39:43 »
Advertisements
Here's a reworked version for all DryOS models.
opendir() tries to open the directory with the built-in LFN-aware parser. If that succeeds, the built-in routines will be used. If it fails (or the filesystem is not FAT12/16/32), it proceeds calling the firmware functions instead. This IMHO should give 100% LFN coverage.
I'm using a new fw function to determine the filesystem (see the earlier asm excerpt, "returns filesystem type"). Earlier models don't have this function, they will use a dummy replacement (they don't support exFAT).
Core size increase is somewhat less than 800 bytes.

ps.
The server rejected my posts with the attached diff when the diff was either cleartext or gzipped...

*

Offline msl

  • *****
  • 1239
  • A720 IS, SX220 HS 1.01a
    • CHDK inside
Re: Long filenames - a file browser modification for Select Script File menu
« Reply #11 on: 10 / December / 2014, 09:28:18 »
Thanks for that, brilliant job! This solves a long existing issue. The patch works fine on my cameras (A720 FAT16, SX220 FAT32).

The file browser should be reworked for longer file names. I think, two chars more are possible without changing of the other informations.

msl
German CHDK pages:  CHDK forum | CHDK inside | CHDK Twitter News by msl | Download CHDK-DE (Autobuild)
Note: SDM violates the GPL rules!

Re: Long filenames - a file browser modification for Select Script File menu
« Reply #12 on: 10 / December / 2014, 18:29:47 »
Thanks for that, brilliant job! This solves a long existing issue. The patch works fine on my cameras (A720 FAT16, SX220 FAT32).
The file browser should be reworked for longer file names. I think, two chars more are possible without changing of the other informations.
Agreed.  Just tried it out on my A1200 and it was a real pleasure browsing through longer file names!

So I almost hate to ask,  but is this a 1.4 change or does it sneak into 1.3 ?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3070
    • Photos
Re: Long filenames - a file browser modification for Select Script File menu
« Reply #13 on: 10 / December / 2014, 18:53:11 »
Can I suggest that the 'get_fstype' change to finsig_dryos (and the updated stubs files), be added to SVN first.

The patch is hard to digest with all the changes from this, and since this change on its own does not affect CHDK functionality it's safe to add.

I'm happy to push this bit to SVN if there are no objections?

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)


*

Offline srsa_4c

  • ******
  • 3710
Re: Long filenames - a file browser modification for Select Script File menu
« Reply #14 on: 10 / December / 2014, 19:28:13 »
I'm happy to push this bit to SVN if there are no objections?
Okay.

The rest is meant to be "experimental", so it's not for 1.3.

Some notes about this patch:
- only a restricted subset of 7bit ASCII is accepted in the long names, short names will be returned otherwise
- it seems to work fine on cards I tried it on, but someone may use it on a card that has a half-screwed filesystem (and I don't know how directories look on such a card)
- the camera only adds LFN names to files that actually have long names. The linux VFAT driver always seems to add LFN, regardless of name length (this could be due to the lower case names I usually use). I don't know how other operating systems work with VFAT
- short names are (AFAIK) always capitalized, long names are however not - some parts of CHDK may rely on upper case letters (for example the file browser treats lower and upper case differently when sorting)

Would it make sense to add a CHDK menu entry that lets disable the built-in parser?

Re: Long filenames - a file browser modification for Select Script File menu
« Reply #15 on: 10 / December / 2014, 19:43:01 »
Would it make sense to add a CHDK menu entry that lets disable the built-in parser?
Seems like 1.4.0 is not even wet behind the ears  yet. Let's just put this there "as is" for now and worry about a "disable" option if things don't work out and can't be fixed?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 3710
Re: Long filenames - a file browser modification for Select Script File menu
« Reply #16 on: 10 / December / 2014, 19:54:29 »
Would it make sense to add a CHDK menu entry that lets disable the built-in parser?
Seems like 1.4.0 is not even wet behind the ears  yet. Let's just put this there "as is" for now and worry about a "disable" option if things don't work out and can't be fixed?
That option would restore the previous behaviour, it would be useful in cases where the new routine fails for some (yet unknown) reason.

Re: Long filenames - a file browser modification for Select Script File menu
« Reply #17 on: 10 / December / 2014, 20:03:08 »
That option would restore the previous behaviour, it would be useful in cases where the new routine fails for some (yet unknown) reason.
I'm okay with that I guess.

But I was just thinking a bit about reyalp's observation a few weeks ago that we tend to push people to our "dev" or "unstable" branch somewhat freely.   Because the cool new features are there of course.   And we somewhat "bend over backwards" to make sure those features are perfect and not too big a change from what went before (just my observation).

And then we get grief when we want to changes something in what should be a dev branch.  No doubt in part due to the length of time the unstable branches have taken to mature to stable (no criticism intended here .. it's just how it is).

So maybe we should start putting things into the unstable version without a "fallback".  Let new stuff in easily but delete "stuff" that doesn't make the cut quickly.   Fail early and fail often.   And bump the rev level everytime we have something major that is good to add.  The 1.3.0 change list is almost embarrassing in how many good things are in one update.

Just saying.




Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline philmoz

  • *****
  • 3070
    • Photos
Re: Long filenames - a file browser modification for Select Script File menu
« Reply #18 on: 10 / December / 2014, 21:12:48 »
I've added the finsig_dryos changes to SVN.

Attached is an updated version of srsa_4c's patch with just the LFN changes.

Looks ok after a quick scan, haven't had a chance to test it though.
A few thoughts:
- the updated wrapper code in generic/wrappers.c could use some line breaks between functions
- does the buffer for reading the directory in chdk-dir.c need to be 16K (seems a bit big)?
- rename fw_OpenFastDir to fw_opendir and fw_ReadFastDir to fw_readdir for DryOS

Edit: Updated patch attached. I've made the cosmetic changes I suggested above.
Main change is an update to the file browser to use the whole screen and adjust the column widths.
Filename width increased from 15 to 20 characters. Size column reduced from 7 to 6 chars.
Number of rows shown increased from 10 to 12.
(N and N Facebook column widths have not been updated.)

Phil.
« Last Edit: 11 / December / 2014, 02:44:25 by philmoz »
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

*

Offline msl

  • *****
  • 1239
  • A720 IS, SX220 HS 1.01a
    • CHDK inside
Re: Long filenames - a file browser modification for Select Script File menu
« Reply #19 on: 11 / December / 2014, 06:45:02 »
Version 3 works fine.

I have tested a non conform filename with German special chars. The file name is displayed in the 8.3 format as described. In this case on the SX220 no file size is displayed => ? ? ?.

A small cosmetic thing in gui_fselect.c: "<UpDir>" has 7 chars. Maybe "<Up>" is better for the new width of 6 chars.

msl
« Last Edit: 11 / December / 2014, 06:52:49 by msl »
German CHDK pages:  CHDK forum | CHDK inside | CHDK Twitter News by msl | Download CHDK-DE (Autobuild)
Note: SDM violates the GPL rules!

 

Related Topics