SD980 port

  • 162 Replies
  • 19754 Views
*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #40 on: 25 / September / 2009, 01:28:54 »
Advertisements
Thanks.
Well, I have no idea what else I can try, I can't get too far without any file i/o...

*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #41 on: 25 / September / 2009, 01:55:30 »
Wow, I got the mofo to work (partially).
Here is the new function, which works:
Code: [Select]
void test_dbg()
{
int fd;
static char fn[32];
sprintf(fn, "A/dump.bin");

blink_led(1);
fd = Fopen_Fut(fn, "w");
blink_led(2);
if (fd)
{
blink_led(3);
    Fwrite_Fut((void*)0, 0x1900,1,fd);
    blink_led(4);
    Fwrite_Fut((void*)0x1900, 32*1024*1024-0x1900,1,fd);
    Fclose_Fut(fd);

}
}

Any idea why?

*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #42 on: 25 / September / 2009, 02:00:38 »
Ok, actually the difference was memdump.bin vs A/dump.bin
That's a strange way to react to an invalid file name :D I would have just expected a graceful error :D

*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #43 on: 26 / September / 2009, 18:26:20 »
Ok, so I think I found out why Open crashed :/
In the function int rbf_load(char *file)
The first open is: fd = open(file, O_RDONLY, 0777);
This was driving me crazy.
So I made a function:

Code: [Select]
void log_debug(char *buffer)
{
int fd;
fd = Fopen_Fut("A/debug.txt", "w");
Fwrite_Fut(buffer, 100,1,fd);
Fclose_Fut(fd);
}

And I called it right before that open.
For some reason, it has a 00,00,00,00 (hex) before the beginning of the file name...

The parameter of that function is initialized in conf.c, as such:  CONF_INFO(183, conf.menu_symbol_rbf_file,   CONF_DEF_PTR,   ptr:"A/CHDK/SYMBOLS/icon_10.rbf", conf_change_menu_symbol_rbf_file)

Any idea why there is a 0 in front of the file name?


*

Offline reyalp

  • ******
  • 10055
Re: SD980 port
« Reply #44 on: 26 / September / 2009, 18:43:45 »
Any idea why there is a 0 in front of the file name?
Do you have umalloc correctly identified ?

Do the 0s overwrite the first characters of the file name, or are they inserted in front ?

Where exactly are your calling your debug function ?

FWIW that you can use fopen, fwrite etc, they are aliases to the Fut functions.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #45 on: 26 / September / 2009, 18:52:56 »
AllocateUncacheableMemory (ummaloc) is correctly auto identified, perfect match.
The 4 0s do not overwrite the file name, they are before it.
I am calling my debug function such as:
Code: [Select]
log_debug(file);
    fd = open(file, O_RDONLY, 0777);
blink_led(3);

And I guess I can use open now, I was thinking that it is wrong, but I see that the crash happened because of the problem with the 0's.

*

Offline reyalp

  • ******
  • 10055
Re: SD980 port
« Reply #46 on: 26 / September / 2009, 19:00:34 »
Have you reset your CCHDK.CFG ? It's possible you ended up with a corrupted file earlier.

edit:
you may be able to tell by hexing the file.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #47 on: 26 / September / 2009, 19:03:29 »
The conf file is deleted, so that it just loads the defaults.


*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #48 on: 26 / September / 2009, 19:18:40 »
Ok, I found the answer..
That file was actually loaded here: CONF_INFO( 66, conf.menu_rbf_file,          CONF_DEF_PTR,   ptr:"", conf_change_menu_rbf_file),

I got confused because the name of the thing in the buffer was A/CHDK/SYMBOLS/icon_10.rbf, no idea how it got in there...

Anyway, it seems that in this version, a file name that doesn't start with A/ will crash the camera. I replaced the null string in CONF_INFO( 66, conf.menu_rbf_file,          CONF_DEF_PTR,   ptr:"", conf_change_menu_rbf_file),
with CONF_INFO( 66, conf.menu_rbf_file,          CONF_DEF_PTR,   ptr:"A/blah", conf_change_menu_rbf_file),
and it didn't crash...

*

Offline RaduP

  • *****
  • 856
Re: SD980 port
« Reply #49 on: 26 / September / 2009, 19:22:22 »
I guess I need to modify the wrapper of open() to check for this situation.

 

Related Topics