Cannot modify chkd "core": (motion_detector.c & script.c) - General Discussion and Assistance - CHDK Forum  

Cannot modify chkd "core": (motion_detector.c & script.c)

  • 16 Replies
  • 4709 Views
Cannot modify chkd "core": (motion_detector.c & script.c)
« on: 04 / June / 2011, 04:25:26 »
Advertisements
HEllo,
I am looking at some optimisation in the md_detect_motion(void). TTo do so I would like to create a log file to get times and durations. So I got inspiration from another part of the code but the log file MD_DEBUG.CFG  is never created even with a simple code like following:
Code: [Select]
 fd = open("A/CHDK/MD_DEBUG.CFG", O_WRONLY|O_CREAT|O_TRUNC, 0777);
if( fd>=0) {
lseek(fd,0,SEEK_END);
 big_ln=sprintf(big,"TEST\n");
 write(fd,big,big_ln);
 close(fd);    
  }  

IS there a Flag to enable file writing? or am I mimssing something bigger?
Thank you.
« Last Edit: 04 / June / 2011, 14:07:49 by Syl20.mm »
S95 100h

*

Offline msl

  • *****
  • 1274
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Motion Detection: Cannot create log file
« Reply #1 on: 04 / June / 2011, 05:27:53 »
IS there a Flag to enable file writing? or am I mimssing something bigger?

Yes, this is an optional function, by default is not activated - see in buildconf.inc.

For MD debugging you must compile your own version. With whim's CHDK-shell you can set this options easily.

msl

CHDK-DE:  CHDK-DE links

Re: Motion Detection: Cannot create log file
« Reply #2 on: 04 / June / 2011, 06:04:32 »
I assume you are talking about "OPT_MD_DEBUG"
I set it already, but since my code is included in the function "md_detect_motion", but outside #ifdef OPT_MD_DEBUG it should not matter.

 * I am using a powershot S95 100h firmware. is there another reason I could not print a file ?
 * I put return 0; at the bigining of the functions md_init_motion_detector and md_detect_motion in the file ..\trunk1196\core\motion_detector.c.
 * I compiled using CHDK-SHELL V.3.26
 * I put this on the SD card using CrdTrick

And the the motion detection still works. So my modification have not been taken into account. The DISKBOOT.BIN file is generated. What did I miss?
I also noticed the ps.FI2 is not generated during compilation (no flag OPT_FI2) But I assume this is not important.
« Last Edit: 04 / June / 2011, 06:57:55 by Syl20.mm »
S95 100h

*

Offline msl

  • *****
  • 1274
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Motion Detection: Cannot create log file
« Reply #3 on: 04 / June / 2011, 06:59:01 »
Ok, I see you have compiled the correct version.

Did you activate the debug mode in your md script? Parameter n  in md_detect_motion should be 2 for a debug file.

msl
CHDK-DE:  CHDK-DE links


Re: Motion Detection: Cannot create log file
« Reply #4 on: 04 / June / 2011, 07:15:47 »
Yes I tried but :
1. This should not matter in text file writing
2. It does not create any dump file off live view.any where

Maybe on the powershot S95 some feature are still missing?

OK I Made a test modifying the ubasic_script_default in all script.c files I have on my computer, I just modify the text to check that the "core" was compilated correctly.
And I could not see the modification on My camera.

This means that the core modifications are not taken into account. Is there a particular flag to compile the core with the plateform?
« Last Edit: 04 / June / 2011, 11:56:29 by Syl20.mm »
S95 100h

*

Online philmoz

  • *****
  • 3226
    • Photos
Re: Cannot modify chkd "core": (motion_detector.c & script.c)
« Reply #5 on: 04 / June / 2011, 19:05:40 »
Yes I tried but :
1. This should not matter in text file writing
2. It does not create any dump file off live view.any where

Maybe on the powershot S95 some feature are still missing?

OK I Made a test modifying the ubasic_script_default in all script.c files I have on my computer, I just modify the text to check that the "core" was compilated correctly.
And I could not see the modification on My camera.

This means that the core modifications are not taken into account. Is there a particular flag to compile the core with the plateform?

Sound like your build environment is not set up correctly.

Edit version.inc and add something recognisable to the version (e.g. your name).
Build and copy the diskboot.bin to your SD card.
Boot the camera and check 'Show build info' under the Miscellaneous stuff' menu.

Does it show your modified build number and the date/time of the build?

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)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline reyalp

  • ******
  • 12940
Re: Cannot modify chkd "core": (motion_detector.c & script.c)
« Reply #6 on: 04 / June / 2011, 23:46:45 »
May be obvious, but if you are using a multi-partition card, you need to make sure the diskboot.bin ends up on the fat16 partition

If you are loading manually with "firm update", you need to build a PS.FI2, which is not built by default.
« Last Edit: 05 / June / 2011, 04:09:48 by reyalp »
Don't forget what the H stands for.

Re: Cannot modify chkd "core": (motion_detector.c & script.c)
« Reply #7 on: 05 / June / 2011, 03:59:13 »
Sound like your build environment is not set up correctly.

Edit version.inc and add something recognisable to the version (e.g. your name).
Build and copy the diskboot.bin to your SD card.
Boot the camera and check 'Show build info' under the Miscellaneous stuff' menu.

Does it show your modified build number and the date/time of the build?

You are wright, the build version is not the one I modified.

Bu regarding what "reyalp" said, I am loading CHDK lmanually with firmupdate, but the PS.FI2 is not generated during compilation. When I checl the option OPT_FI2, I have the following message in the console:
-> signatures_dryos.h
CAUTION! 'signatures_dryos.h' is not updated due to 'sig_ref_dryos_1.bin` is empty!
....
WARNING OPT_FI2 set but FI2KEY is not! please read platform/fi2.inc.txt


And in the end the FI2 file is not generated ether. I will look into it.
What is exacly th FI2 file? I thought the diskboot.bin WAS the firmware loaded in the camera memory, but it looks is is not the only one.

Is there a threads or a quick explanation about how to generate the FI2 get the FI2Key for my camera?

Thanks
S95 100h


*

Offline reyalp

  • ******
  • 12940
Re: Cannot modify chkd "core": (motion_detector.c & script.c)
« Reply #8 on: 05 / June / 2011, 04:16:37 »
CAUTION! 'signatures_dryos.h' is not updated due to 'sig_ref_dryos_1.bin` is empty!
This does not matter, unless you are trying to add sigs to the sig finder.
Quote
....
WARNING OPT_FI2 set but FI2KEY is not! please read platform/fi2.inc.txt
So read fi2.inc.txt ;)
Quote
What is exacly th FI2 file? I thought the diskboot.bin WAS the firmware loaded in the camera memory, but it looks is is not the only one.
See
http://chdk.setepontos.com/index.php?topic=6397.msg68060#msg68060

Quote
Is there a threads or a quick explanation about how to generate the FI2 get the FI2Key for my camera?
See this thread http://chdk.setepontos.com/index.php?topic=2995.0 and this wiki page http://chdk.wikia.com/wiki/For_Developers/fi2offsets
Don't forget what the H stands for.

Re: Cannot modify chkd "core": (motion_detector.c & script.c)
« Reply #9 on: 05 / June / 2011, 05:02:58 »

See this thread http://chdk.setepontos.com/index.php?topic=2995.0 and this wiki page http://chdk.wikia.com/wiki/For_Developers/fi2offsets

OK, I did not get that.
SO ubntil I got the S95 keys I can still use autoboot to make my tests.
Thancks a lot.
S95 100h

 

Related Topics