Porting a camera sx530hs - page 2 - DryOS Development - CHDK Forum

Porting a camera sx530hs

  • 288 Replies
  • 77292 Views
Re: Porting a camera sx530hs
« Reply #10 on: 03 / July / 2015, 16:28:51 »
Advertisements
Now most of this done and working.I must also correct the live preview, as this very slow. anyone have any suggestions.
I am posting the trunk.
also could not do set_zom through the LUA scrips.
Nice work!   I converted your dump into a patch file that can be applied to the svn and submitted it here for you so that it gets added to the trunk and stays current going forward.   Once there is a little more testing - maybe by another user - then it can likely get released to the autobuild.

The notes.txt file appears to be a cut&paste from another camera and should be updated.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11849
Re: Porting a camera sx530hs
« Reply #11 on: 04 / July / 2015, 17:24:57 »
Now most of this done and working.I must also correct the live preview, as this very slow. anyone have any suggestions.
I am posting the trunk.
also could not do set_zom through the LUA scrips.
Thanks. This is excellent work for a first port. I've added the patch posted by waterwingz to the trunk.  The only thing I changed was the notes.txt. In the future, please update the notes.txt to reflect what has actually been tested or is known to be broken in this port. For future updates, you can use SVN to generate a patch against the current trunk.

There are quite a few things that need to be resolved before it can be added to the autobuild. In addition to the things I've noted below, please see http://chdk.wikia.com/wiki/Testing

code-gen
The capt_seq.c generated by code-gen does not match the one submitted in the patch, specifically the capt_seq.c has
Code: [Select]
"    BL      sub_FF0F39C0 \n"  // --> Patched. Old value = 0xFF0F39C0. jeronymo
while code-gen generates
Code: [Select]
"    BL      sub_FF0F39C0_my\n" 
If the capt_seq.c reflects the code that should actually be used, please update the code-gen file.

finsig
The stubs_entry.S included in the patch appears to have been generated by an updated version of finsig, which was not included in the patch, the current svn finsig does not generate
Code: [Select]
//   KEYSYS = d4h                // Found @ 0xff0144a4

sx530hs/shooting.c
The mode map is incorrect. To find the mode map values, you can set each mode in the canon UI while watching propcase SHOOTING_MODE. You can use the mode table in the canon firmware to verify that you found all the valid values.

sx530hs/kbd.c
The KEY_VIDEO is missing, when the camera clearly has a video button. There are probably some other keys that can be added. You can find the keys by watching phsw_status in the memory browser while pressing keys. KEY_POWER should probably not be in the keymap, and definitely shouldn't be in the KEYS_MASK2
(edit: other cams have it in the keymap, but it should not be in mask)

Comment refers to sx510 code. Verify the code is valid for sx530 and update comments.

The jogdial code looks incomplete. Are you able to use the jodgial to navigate the CHDK menu?

sx530hs/lib.c
the next_buffer code appears to be unused. It should be deleted or put in an #if 0 block

shutdown refers to _TurnOffE1, which NULLSUB.

Does debug_led work? I see the same value is defined as AF_LED. From the wiki it seems this isn't actually the AF LED, but just to be sure, the debug_led should not use the AF LED, because this would interfere with shooting.

does vid_get_viewport_live_fb return the correct buffer while video is recording?

have the varioius viewport functions been verified? In general, this can be done by making sure everything looks correct in chdkptp live view. Also check that histogram and zebra work correctly.

The palette functions in #ifdef CAM_LOAD_CUSTOM_COLORS are mostly commented out, but the define is defined in platform_camera.h. If custom colors are not working, then the define should not be defined.

The jogdial functions have comments that appear to be copied from other ports. Please verify that script wheel_left() and wheel_right() work correctly, and update or remove the comments.

platform_camera.h
This appears to have been copied from sx510. Please update the comments and indicate clearly which values have been verified.

The CAM_JPEG_* values are are clearly incorrect, since this is a 16MP cam. The values should reflect the size of the largest available jpeg.

The active area should be checked. You can find instructions at the bottom of https://www.assembla.com/spaces/chdkptp/wiki/DNG_Processing or upload a sample DNG somewhere.

The comment on CAM_HAS_MOVIE_DIGEST_MODE says the camera doesn't have a movie digest mode, but the manual suggests it does.

CAM_IS_VID_REC_WORKS should only be defined if is_video_recording actually works. If this hasn't been verified, it should be. Information on this can be found at http://chdk.wikia.com/wiki/Testing_Needed#CAM_IS_VID_REC_WORKS

The  CAM_ALT_BUTTON_ defines include KEY_VIDEO, but this key is not in the keymap. Please update the keymap, or remove it.

Have the CAM_SD_OVER_IN... defines been verified?

sub/boot_hdr.c
The debug LED code should be in #if 0 or removed

sub/capt_seq_hdr
The dark frame control code refers to RAM addresses copied from the SX510 port. This is almost certainly wrong, and is likely to cause crashes if anyone tries to use it. AFAIK the SX510 port itself also doesn't do dark frame control correctly. Additionally, these addresses are likely to be firmware specific, so should not be in the code-gen header at all.

sub/movie_rec_hdr.c
Is not used.

sub/fw/capt_seq.c
Has the "quick press" behavior been tested? Specifically, if you press the shutter quickly without waiting for focus, is raw captured and overrides correctly applied?

sub/fw/stubs_entry_2.s
Some functions defined here are correctly found by the current finsig. They can be removed.

Firmware variables focus_len_table and playrec_mode are defined as NULLSUB. This is completely incorrect and will cause crashes or other bad behavior, because the values of those variables with be the opcod of the nullsub (and whatever follows it for focus_len_table)

time() is defined as nullsub. This will cause problems, because time() has a return value that will be garbage.

loader/entry.s
Is the delay loop actually needed?

loader/main.c
Debug LED code should be #if 0

Comments refer to addresses in a different port. Has the equivalent code been found and verified for this specific camera?
« Last Edit: 04 / July / 2015, 19:36:20 by reyalp »
Don't forget what the H stands for.

Re: Porting a camera sx530hs
« Reply #12 on: 04 / July / 2015, 19:01:31 »
Thanks. This is excellent work for a first port. I've added the patch posted by waterwingz to the trunk.
I agree.  Not many people get this far with a port without needing help. 

Some of the things noted by reyalp might be my errors translating jeronymoGustavo's working copy to an svn patch file.  Hopefully he will sort that out for us now that the base of what he has created is in the svn.

Great work!
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline nafraf

  • *****
  • 1305
Re: Porting a camera sx530hs
« Reply #13 on: 04 / July / 2015, 23:06:04 »
finsig was updated to support d4h keysys (trunk r4182), the code was taken from the code posted by jeronymoGustavo at previous post.

@jeronymoGustavo, to fix focus_len autodetection, CAM_DNG_LENS_INFO should be fixed. Patch in attachment.


Re: Porting a camera sx530hs
« Reply #14 on: 15 / July / 2015, 14:58:54 »
Thank you all for your help. I tried to fix the problems pointed out by you. I leave here a copy of the trunk that I'm using.
I did not have time to fix the part of the svn.
I am now having a problem using the get_shooting() LUA command.
I think the propset (propset6.h) has changed, so I created a new (propset7.h), but do not know how to find the values, I found some using get_prop () command.

*

Offline srsa_4c

  • ******
  • 3878
Re: Porting a camera sx530hs
« Reply #15 on: 15 / July / 2015, 18:42:44 »
I think the propset (propset6.h) has changed, so I created a new (propset7.h), but do not know how to find the values, I found some using get_prop () command.
In case you don't know: there's a built-in debug feature in CHDK that lists propcases on screen (10 at a time): Miscellaneous stuff -> Debug parameters -> Debug data display [Props]. You can use the 'debug shortcut' button in ALT mode to browse through all propcases (set ALT +/- debug action to [Page]).

If you're lucky, some propcases will just have an offset (see the difference between propset 5 and 6 for example). Try identifying the obvious ones from the propset 6 list, starting with AE lock, AF lock, ...

Re: Porting a camera sx530hs
« Reply #16 on: 15 / July / 2015, 20:11:41 »
Thank you all for your help. I tried to fix the problems pointed out by you. I leave here a copy of the trunk that I'm using.
I did not have time to fix the part of the svn.
I can convert your zip file to an svn patch file fairly easily if you will let us know what you changed (other than adding the sx530hs folders to the platform & loader folders)?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Porting a camera sx530hs
« Reply #17 on: 06 / August / 2015, 15:21:21 »
How can i find this function (active_viewport_buffer) inside ida disasembly.

DEF(active_viewport_buffer,         0x00005FB0)


*

Offline srsa_4c

  • ******
  • 3878
Re: Porting a camera sx530hs
« Reply #18 on: 07 / August / 2015, 15:56:24 »
How can i find this function (active_viewport_buffer) inside ida disasembly.

DEF(active_viewport_buffer,         0x00005FB0)
You need to disassemble a reference firmware (such as the ixus160), locate active_viewport_buffer in it, then you need to find the equivalent address in your camera's disassembly. You can look for similar code patterns, function calls, strings.
If you haven't yet imported the address/name pairs from funcs_by_address.csv to your IDA project, you may want to do it (it's way more accurate than any published IDA signature file). Seeing familiar function calls helps a lot when searching for stuff.

I think the address in your case is 0x2174. But I can't be sure.

Re: Porting a camera sx530hs
« Reply #19 on: 13 / August / 2015, 15:15:33 »
I found a similar code cited, but the pointer 0x2174 is not work.
I try 0x5FB0, but I receive frames out of sequence.
Some one can help me, i have not more idea about how to find this.

thanks

 

Related Topics