SD980 port - page 15 - DryOS Development - CHDK Forum

SD980 port

  • 169 Replies
  • 64272 Views
*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #140 on: 18 / October / 2009, 05:25:28 »
Advertisements
You were right about stat()
It is the right function, but the structure changed.
I didn't get enough time to look for what the values are, but the 3rd int is the file size.
I'll attach a dump of that structure, if you feel like looking through it. I dumped 200 bytes, since I don't know exactly how long it is, but it is probably 24 bytes long.

*

Offline reyalp

  • ******
  • 14125
Re: SD980 port
« Reply #141 on: 19 / October / 2009, 02:37:25 »
You were right about stat()
It is the right function, but the structure changed.
I didn't get enough time to look for what the values are, but the 3rd int is the file size.
I'll attach a dump of that structure, if you feel like looking through it. I dumped 200 bytes, since I don't know exactly how long it is, but it is probably 24 bytes long.
I can't do anything with this without knowing the actual details of the file that was stat()ed.
I'd suggest stating at least one regular file and directory, and listing the size, creation/modification/access times and DOS attributes
If you make a couple of files with all these things set differently, that will make it easier.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #142 on: 19 / October / 2009, 02:58:25 »
Ok, well, I got the most important fields, size and attributes. I think I got some times too, but right now I am debugging the file browser.
Speaking of which, can you please check if:
void gui_draw_fselect(int arg) {
    gui_fselect_init(LANG_STR_FILE_BROWSER, "A/", NULL);
}

works on the other cameras?
On the SD980 and possibly new cameras, the root dir is "A/" not "A". And if it works, can you please put that in the SVN so it will be ready for the SD980 port?

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #143 on: 19 / October / 2009, 04:00:22 »
Hmm, using "A/" instead of "A" will cause some problems later in the gui_fselect_read_dir() function because of: sprintf(buf, "%s/%s", dir, de->d_name); removing the / does help for the root dir, but it doesn't help with other dirs. I'll look more into it.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #144 on: 19 / October / 2009, 04:18:43 »
Ok, I found a better way that gets the file browser working:
In static void gui_fselect_read_dir(const char* dir)
Instead of d = opendir(dir);

Code: [Select]
if(dir[0]=='A' && dir[1]==0)
d = opendir("A/");
else
    d = opendir(dir);

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #145 on: 19 / October / 2009, 05:24:29 »
Regarding stat(), here is the structure:

struct   stat
    {
    unsigned long   st_unknown_1;      //?
    unsigned long   st_attrib;
    unsigned long   st_size;   //?
    unsigned long   st_ctime;   //?
    unsigned long   st_mtime;   //?S
    unsigned long   st_unknown_2;   //?S
};

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #146 on: 19 / October / 2009, 05:30:02 »
LUA uses some other stat fields that I could not find:

loslib.c: In function `os_stat':
loslib.c:298: error: structure has no member named `st_dev'
loslib.c:300: error: structure has no member named `st_mode'
loslib.c:309: error: structure has no member named `st_atime'
loslib.c:331: error: structure has no member named `st_blksize'
loslib.c:332: error: structure has no member named `st_blocks'

Perhaps we need an #ifdef there as well.

Anyway, how do you suggest to call the #ifdef for stdlib.h for the new stat structure?

*

Offline reyalp

  • ******
  • 14125
Re: SD980 port
« Reply #147 on: 19 / October / 2009, 19:51:53 »
You could also make your wrapper for stat shuffle the values around to fit the existing structure (and stuff sane values in any you haven't found ?)
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #148 on: 19 / October / 2009, 19:56:43 »
That's a possibility too, but I've noticed that there are two stat structures, one for DRYOS and one for VX, so to keep it consistent we'd need a 3rd structure, especially if all the new cameras are going to use this one.
And does LUA REALLY need those other fields?

if I do what you suggested, then everyone porting new cameras would need to use my code as a reference, or at least take my wrappers.

Also, did you check the "A" vs "A/" thing?
« Last Edit: 19 / October / 2009, 19:58:22 by RaduP »

*

Offline reyalp

  • ******
  • 14125
Re: SD980 port
« Reply #149 on: 19 / October / 2009, 20:24:30 »
We'll need a new #ifdef for the "new style" cameras anyway. I don't know what to call it, but it doesn't matter too much, that's what global search/replace is for. CAM_DRYOS_2_3_R39 for now, if you can't think of something better.

I don't know that lua "needs" those extra fields, but I'm reluctant to remove something that already exists and works on current cameras.

I haven't tried A/ vs. A.  I wasn't clear from your post above whether this was still needed, or what else it affects. In any case, I only have a vxworks cam at the moment.
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal