CHDK Forum

CHDK Development => General Discussion and Assistance => DryOS Development => Topic started by: waterwingz on 21 / November / 2010, 22:21:15

Title: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 21 / November / 2010, 22:21:15
=====Latest Update Information Maintained Here =======

Latest version of CHDK for the SD940 (IXUS120) firmware revs 100e, 101a, 102c, 103b & 103c are available at :

CHDK autobuild server (http://mighty-hoernsche.de/) and CHDK-DE (http://forum.chdk-treff.de/download.php)

If you don't see your firmware version listed here,  this would be good place to post a request for help.

Most recent update specific to the SD940 (IXUS120) made on 2012 Aug 03 to change the default <ALT> key to be the Playback key ( the green triangle ) rather than the DISP key.  You can change it to DISP using the CHSK menus if you prefer it to work that way.

========================================

Original Post Below --->

Hi there !  I've been working on getting CHDK working on my SD940 in most of my "spare" time for the last couple of months.   I now have a version that loads and runs ! It displays the CHDK logo after several seconds and runs the CHDK menus when you press the DISP button and then the MENU button.   It beat me at Reversi today so at least one of the games work.

Still tons of stuff to do.  It took me much longer to get to this point than I would have ever imagined and I'm trying not to think of what lays ahead.  Next step is to get the init_file_modules_task running so that, amongst other things, I can get rid of the startup delay.

If you are interesting in this camera. please click on my user name on the left beside this post, scroll down to the bottom and send me a personal message (rather than post in this forum).  Once I have the basics running, tell me which function you would most like to see working next ?

I'll post update links here as I progress and maybe some random notes of things I've learned along the way.

WW  :D


Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 25 / November / 2010, 12:17:04
Posted version 2 of my Alpha release - this has the hack for RefreshPhysicalScreen() that I posted at http://chdk.setepontos.com/index.php?topic=5857.msg57329#msg57329 (http://chdk.setepontos.com/index.php?topic=5857.msg57329#msg57329) so the menus draw and erase properly.  It also has a second task running -  init_file_modules_task() - so in theory it now supports FAT32.  Check it out at :

SD940-103c-ALPHA2-25Nov2010.zip - 0.52MB (http://www.zshare.net/download/83125264c00301c8/)

Progress!
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 26 / November / 2010, 21:29:51
Spent way too long today trying to understand why the CHDK menus seemed to behave strangely >:(.  That's part of the problem when you don't know how things are supposed to work and don't have a working camera with CHDK to play with.  If I value my time at $1.00 / hour then I could have bought one of the cheaper Canon cameras that work with CHDK and been ahead of the game so far.

Finally figured out that the menus were being clipped at the right hand side of the screen because I did not have the screen width set correctly.  This version now works better :

http://www.zshare.net/download/831848957c0184fa/ (http://www.zshare.net/download/831848957c0184fa/)

And I actually got the clock to display in OSD mode by commenting out the various conditionals that were keeping it from displaying when enabled.  Need to figure that out - the rest of the OSD stuff probably has the same issue.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: reyalp on 26 / November / 2010, 21:59:10
Spent way too long today trying to understand why the CHDK menus seemed to behave strangely >:(.  That's part of the problem when you don't know how things are supposed to work and don't have a working camera with CHDK to play with.  If I value my time at $1.00 / hour then I could have bought one of the cheaper Canon cameras that work with CHDK and been ahead of the game so far.
By the time you are done, you will probably be up to a nice DSLR setup at McJob wages ;)

It's a good idea to reset your CCHDK.CFG after fixing this, some things remember their positions.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 26 / November / 2010, 23:13:57
By the time you are done, you will probably be up to a nice DSLR setup at McJob wages ;)
I'd go the DSLR route but I don't like Canon DSLR's.  Once you're used to a Nikon, well ....
It's a good idea to reset your CCHDK.CFG after fixing this, some things remember their positions.
Thanks - I actually did catch on to the CCHDK.CFG file in the CHDK folder on the SD card.  The reset options in the menu seem to work well but every so often I just delete the file itself to see how things initialize with a cold system.

I also spent several hours adding code to boot.c to try and track down where in the code it detects the battery door as being open.  Once things are running,  you can pull the same trick used with to ignore the SD card write protect. But something is checking the door switch during startup - but after CHDK boots!  After porting tons of code from firmware to boot.c so I have control of what actually runs,  and inserting "break points" that are basically loops to forever blink the green LED,  I worked myself into a circle of failure.  Maybe it will look different tomorrow.  Or maybe I'll just have to live with it when I wear out the battery door.

Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: reyalp on 26 / November / 2010, 23:35:21
After porting tons of code from firmware to boot.c so I have control of what actually runs,  and inserting "break points" that are basically loops to forever blink the green LED,  I worked myself into a circle of failure.  Maybe it will look different tomorrow.  Or maybe I'll just have to live with it when I wear out the battery door.
See this thread http://chdk.setepontos.com/index.php?topic=5744.0 (http://chdk.setepontos.com/index.php?topic=5744.0)

I was able to get it to boot with the door open, but I don't understand exactly why...

If you implement PTP, you can upload without the taking the card out (unless you upload a bad diskboot...)
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 27 / November / 2010, 13:35:03
See this thread http://chdk.setepontos.com/index.php?topic=5744.0 (http://chdk.setepontos.com/index.php?topic=5744.0)
Yup - that worked.  Thanks.

If you implement PTP, you can upload without the taking the card out (unless you upload a bad diskboot...)
Now that looks interesting.  More things to do - never enough time though.  Can you download a complete CHDK diskboot.bin file while CHKD is running ? And is that faster than writing the SD card and moving it back and forth from the camera to computer ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: reyalp on 27 / November / 2010, 16:30:11
Now that looks interesting.  More things to do - never enough time though.  Can you download a complete CHDK diskboot.bin file while CHKD is running ? And is that faster than writing the SD card and moving it back and forth from the camera to computer ?
Yes, the diskboot is only loaded at startup, you can overwrite it with the camera running. Uploading is very fast, I'd guess less than on second.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 27 / November / 2010, 18:24:19
Any plans to support firmware 101C?   I may be able to help finding addresses in the code - I started that about a year ago on 101C but never finished it.

Edit: Sorry, I meant 1.02C
Title: Re: SD940 rev 103c porting thread - support for other versions of the firmware ?
Post by: waterwingz on 27 / November / 2010, 22:53:35
Any plans to support firmware 101C?   
I kind of wondered when this question would come up.  There are at least 3 different firmware versions out there according to the wikia.  As I only have a camera with version 1.03c, trying to build for another version "blind" without a test camera would be pretty hard. Not to mention finding the time to do that when my port is barely even in "alpha" status at this point.

I may be able to help finding addresses in the code - I started that about a year ago on 101C but never finished it.
How far did you get ?  It sure would be nice to have someone else to work on this with me.  Its amazingly time consuming, especially doing a new camera.  If you were working on a different firmware version, I suspect much would be almost the same (hardware especially) or just slightly shifted in memory.  We could get a lot more done together.

Maybe some of the other more experience members on this forum can chime in with advice on supporting multiple revisions of firmware for the same base camera ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 27 / November / 2010, 23:01:37
I ported the S95 to a firmware version that I did not own.  From others' comments, it appears to work about the same as the original, but having the camera in hand obviously makes debugging easier.

I found most of the addresses and the patched the code in boot.c, but the camera kept crashing in record mode and I moved on to other things.  If you can post your source code, I could pretty quickly drop my stuff into your code and see how that goes. 
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: reyalp on 27 / November / 2010, 23:03:49
A new sub isn't too hard to do blind. See http://chdk.wikia.com/wiki/Adding_support_of_a_new_firmware_version (http://chdk.wikia.com/wiki/Adding_support_of_a_new_firmware_version)
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 27 / November / 2010, 23:08:53
BTW, the firmware dump for SD940 1.02C from last year is corrupt.  Here is a link to a proper version:

http://www.zshare.net/download/8322887271f67fd4/ (http://www.zshare.net/download/8322887271f67fd4/)
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 27 / November / 2010, 23:29:46
I found most of the addresses and the patched the code in boot.c, but the camera kept crashing in record mode and I moved on to other things.  If you can post your source code, I could pretty quickly drop my stuff into your code and see how that goes.  
I'm sure it will be no surprise with a newbie doing a first port if I confess that my source code at this point is a mess. Starting from scratch, I've had to tinker to understand how this all comes together.  I think that I now understand the build structure basics.  The ground rules are to not change stuff in the trunkNNN core, include and lib directories.   I'm not so sure about how to treat the platform/generic directory - some of the files have duplicate names with the ones under platform/ixus120_SD940.  But the build process seems to sort that out - some don't get compiled and some do despite the name conflict.  Not sure how that magic happens yet.  In any case, at some point I'll take a day and clean up so that the changes I made in the common files all migrate over to the version specific files.

Any chance you could send me your lib.c, stubs_entry_2.S and stubs_min.S ?  I parsed the stub_entry.s version from the SD980 in a spreadsheet and the labels show up in the same order in memory for the SD940 and SD980.  Initially they used the same addresses but gradually spread apart.  I calculated the average spread at the point where the SD980 stubs_entry_2.S were found and used that as a starting point for finding the SD940 equivalents. Brute force.

Also, I have not started on the capt_seq.c or movie_rec.c so getting a look at yours would help.  

You are welcome to any of my files or maybe you'd rather wait until I get a little farther along and I'll just zip up the whole build ?

Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: reyalp on 27 / November / 2010, 23:35:59
The stuff in generic is *included*, for reasons that escape me. Not all ports include all of the generic items.

Some functions also have __attribute__((weak)) versions in the generic code, which may be overridden in camera code. In this case, the weak and non-weak versions must not appear in the same file via includes.

All of this stuff is begging for cleanup :-[
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 27 / November / 2010, 23:56:13
Some functions also have __attribute__((weak)) versions in the generic code, which may be overridden in camera code. In this case, the weak and non-weak versions must not appear in the same file via includes.
So the linker is smart enough to resolve which function to use when two functions have the same name, as long as one of them is tagged __attribute__((weak)).   That is slick - I've learned another new thing today.  (I assume you can't duplicate names in the same file - the compiler would choke as you've suggested.)

All of this stuff is begging for cleanup :-[
I know what you mean.  I went through the makefiles trying to figure out how to convince it not to recompile everything from scratch every time.  I have a slow computer.   But I soon gave that up - although I caught your tip about hiding PRIMARY.BIN.  Still, maybe we could capture some of the stuff I've tried to describe in this forum in the wikia sections on building for a new camera ?  I could draft it but will need help getting it accurate.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: reyalp on 28 / November / 2010, 00:12:05
Some functions also have __attribute__((weak)) versions in the generic code, which may be overridden in camera code. In this case, the weak and non-weak versions must not appear in the same file via includes.
So the linker is smart enough to resolve which function to use when two functions have the same name, as long as one of them is tagged __attribute__((weak)).   That is slick - I've learned another new thing today.  (I assume you can't duplicate names in the same file - the compiler would choke as you've suggested.)
Right. This is a GCC extension. stubs_entry.S and stubs_entry_2.s also depend on this: the NSTUB macro (used in stubs_entry.S) makes a weak symbol, and the NHSTUB macro makes a normal one.
Quote
I know what you mean.  I went through the makefiles trying to figure out how to convince it not to recompile everything from scratch every time.
If you are using make directly (not CHDK shell) you can just do "make fir" and it will do an incremental build. You have to be aware that it won't necessarily rebuild everything when it should. Generally, changing C files should be OK, but changing headers or compile time options is not. You always want to do a make clean if you change which camera you are building.

Quote
Still, maybe we could capture some of the stuff I've tried to describe in this forum in the wikia sections on building for a new camera ?  I could draft it but will need help getting it accurate.
Sure. If you think what you have is too inaccurate/incomplete to have on the main page, you can always throw it somewhere under your user page on the wiki (like I did with http://chdk.wikia.com/wiki/User:ReyalP/EventProcNotes (http://chdk.wikia.com/wiki/User:ReyalP/EventProcNotes) ), and then move the content when it's cleaned up.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 28 / November / 2010, 00:33:57
If you are using make directly (not CHDK shell) you can just do "make fir" and it will do an incremental build.
I've gotten lazy and have been using CHDK_Shell on my WinXP laptops (work & home) rather than my main Linux box. As result,  there are no path / environment variables setup to allow me to just run "make fir".  One more thing to work on I guess.
-
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: whim on 28 / November / 2010, 05:25:07
Quote
I've gotten lazy and have been using CHDK_Shell on my WinXP laptops (work & home) rather than my main Linux box. As result,  there are no path / environment variables setup to allow me to just run "make fir".  One more thing to work on I guess.

In CHDK-Shell, click the 'cmdline icon', and type "gmake fir"
In cmdline mode the shell will adjust the PATH for you.
You have to edit makefile.inc to set your cam/firm as the default first, though, by uncommenting
the PLATFORM and PLATFORMSUB macro's for your cam/firmware (and assuring all the others are #ed)

While checking this, I also noticed it only works if you've already compiled at least once (which
assures a /bin directory is created) Will correct in next version.

HTH,

wim

edit: BTW: trunk991 makefile.inc is set to compile ixus95_sd1200-100c by default, a version that's
                not 'officially' supported (as in: no entries in root Makefile)    :D
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 28 / November / 2010, 09:36:49
In CHDK-Shell, click the 'cmdline icon', and type "gmake fir"
Wow - that works great. :D I guess that I thought the little command line icon was part of the window wallpaper. I didn't realize it actually did something.

So I clicked on the SD card icon and it does something too !  Then I held my breath and clicked on the CHDK icon - nothing happened.  Oh well,   two out of three is pretty good.

Funny how you only start to learn the good tricks after hours of doing things the hard way.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: whim on 28 / November / 2010, 10:30:20
@waterwingz

Most stuff that appears cryptic to me has tooltips - but suggestions are aways welcome here (http://chdk.setepontos.com/index.php?topic=845.0)

cheers,

wim
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: tommasoferrarese on 08 / December / 2010, 10:39:09
hi you all..

i just purchased an ixus 120 is and my fw version is103b..

is there a chance to upgrade to 103c? how? it's 2 days i'm searching online, with no result..

can anybody help?

thanks,

tommaso
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 08 / December / 2010, 15:06:44
is there a chance to upgrade to 103c? how? it's 2 days i'm searching online, with no result..

General consensus on this forum is that changing firmware versions is almost impossible and certainly not something that Canon supports.   Your best option is to either port CHDK from the same camera with at different firmware version or hope that somebody else does so.

I'm still struggling through getting a 103c version running.  Someday, when that's done,  I hope to be able to help people with other firmware versions of the SD940.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 08 / December / 2010, 15:19:34
I'm still struggling through getting a 103c version running.  Someday, when that's done,  I hope to be able to help people with other firmware versions of the SD940.

I know you do not feel comfortable letting other people look at your code, but keep in mind that my offer to port your code to different firmware versions still stands but I would need to see what you have done.  Also keep in mind that I sent you the stubs_entry stuff for 1.02C as you requested with the understanding that it would be a trade for what you have and so far I've seen nothing from you.  After all, it was you that posted this:

It sure would be nice to have someone else to work on this with me.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 08 / December / 2010, 16:01:57
I know you do not feel comfortable letting other people look at your code, but keep in mind that my offer to port your code to different firmware versions still stands but I would need to see what you have done.

Waldo :   Sorry, sorry, sorry - I'll send you what I have ASAP. Finding time to do this is hard so I'm slow.  Just didn't want to waste your time with something that doesn't really run and every day I make a little bit of progress.

Having said that - I've been working with your files and I think - maybe - I found yesterday why you could not keep yours running in picture taking mode.  Still haven't figured out how to fix it - was going to work on that tonight.   

But you (or anyone else) are more than welcome to have my meagre efforts so far.  Maybe I'll just post on my zShare site with a suitable warning?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: tommasoferrarese on 09 / December / 2010, 06:16:22
ok, i'll patiently wait, then..

anyway if you have any need for beta or alfa testing as soon as you begin the porting, i'm here!!!

i wish i was a programmer, but this stuff is beyond my knowledge ..
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 11 / December / 2010, 21:50:52
I spent some time trying out the SD940 on my 1.02C camera

I started with the port that waterwingz had done.  I didn't understand the CHDK version used (version "2000", no "<ALT>" indicator) so I changed to base it from release 1001.  Initially I got similar results as before (crashing on Record mode).  

I determined that playrec_mode variable was correct.  I also found that the camera was crashing when trying to run histogram_process() when in record mode.  The problem was in vid_get_viewport_live_fb.  Changing this function to return a null pointer allowed it to run without crashing.  I'm not sure how to find the correct addresses for this but returning 0 works for now.

I'm seeing some random vertical shifts of about 20 lines so that the OSD overlay is sometimes too low / sometimes OK.  Not sure what's going on there.

Using the Display key to toggle Alt mode is a little strange.  Some features, like the memory browser don't work due to not being able to press Display in Alt mode.  I'm not sure how the configurable alt button feature is supposed to work.  On the SD940 there is no print button so you can't press the default Alt button (Print) to get to the Alt menu to change the Alt button !

I also got the .fir version to work.  Just remove the comment from the OPT_FI2=1 line and add the correct fir.inc file and it builds it correctly.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 11 / December / 2010, 22:12:22
Excellent !!  I spend the day checking all addresses against the SD90 port. I'll still need to look and see if anything changed from the Alpha 2 release.

I didn't understand the CHDK version used (version "2000", no "<ALT>" indicator) so I changed to base it from release 1001.
I did mention the code was a little rough - using version 2000 allowed me to ignore updates to the trunk revisions and work on a stable release back when I didn't understand how things worked.

I determined that playrec_mode variable was correct.  I also found that the camera was crashing when trying to run histogram_process() when in record mode.  The problem was in vid_get_viewport_live_fb.  Changing this function to return a null pointer allowed it to run without crashing.  I'm not sure how to find the correct addresses for this but returning 0 works for now.
I found the same thing today.  In fact, I noticed that in the S90 port,  vid_get_viewport_live_fb() simply returns 0. Now we know why.

I'm seeing some random vertical shifts of about 20 lines so that the OSD overlay is sometimes too low / sometimes OK.  Not sure what's going on there.
So far I've commented out things to get the OSD clock to display - I haven't been able to get anything else in OSD to work but that was going to be my next task.

Using the Display key to toggle Alt mode is a little strange.  Some features, like the memory browser don't work due to not being able to press Display in Alt mode.  I'm not sure how the configurable alt button feature is supposed to work.  On the SD940 there is no print button so you can't press the default Alt button (Print) to get to the Alt menu to change the Alt button !
I picked the Display key as the ALT key because as you mentioned the SD940 does not have a Print button.  I didn't realize it would cause problems in ALT mode, never having actually used CHDK on a camera.  Any idea how other cameras handle this ?

I also got the .fir version to work.  Just remove the comment from the OPT_FI2=1 line and add the correct fir.inc file and it builds it correctly.
What do you use the .fir version for ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 11 / December / 2010, 22:28:58
Further to the above,  vid_get_viewport_live_fb() is only used by gui_osd.c hostogram.c and motion_detector.c.

If vid_get_viewport_live_fb() returns NULL or 0, the code seems to substitute vid_get_viewport_fb() and use that instead.

I wonder what breaks because of that?  More mysteries to explore.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: reyalp on 11 / December / 2010, 22:38:25
Further to the above,  vid_get_viewport_live_fb() is only used by gui_osd.c hostogram.c and motion_detector.c.

If vid_get_viewport_live_fb() returns NULL or 0, the code seems to substitute vid_get_viewport_fb() and use that instead.

I wonder what breaks because of that?  More mysteries to explore.
Nothing breaks, but motion detection and histogram might use older data.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 00:41:35
Quote
So far I've commented out things to get the OSD clock to display - I haven't been able to get anything else in OSD to work but that was going to be my next task.
I'm not sure what base version you used, but there is some code missing for displaying some of the OSD (such as the ALT indicator).

Quote
I picked the Display key as the ALT key because as you mentioned the SD940 does not have a Print button.  I didn't realize it would cause problems in ALT mode, never having actually used CHDK on a camera.  Any idea how other cameras handle this ?
The SD780 uses a short press of Display for Alt and a long press for Display.  That might work better.

Quote
What do you use the .fir version for ?
It's for booting CHDK via the "Firm Update" menu.  Not really all that useful to me, but I think it is more useful when using multiple partitions.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 08:23:39
I'm not sure what base version you used, but there is some code missing for displaying some of the OSD (such as the ALT indicator).
I've never seen the ALT indicator on screen.  Might be something I messed up early on - I'll update to the 1001 version and see what happens.

The SD780 uses a short press of Display for Alt and a long press for Display.  That might work better.
This actually works I think.  In normal mode, if I press the Display key briefly then CHDK goes into ALT mode.  If I hold the Display button down then the display mode changes.   In Alt mode, I'm not sure it does anything other than toggle back to normal mode.
Title: Re: SD940 rev 103c porting thread (IXUS120) -> Alpha release 4
Post by: waterwingz on 12 / December / 2010, 14:03:30
Updated Alpha release now posted.   Uses build version 1001.  OSD now seems to work correctly - grids and icons display although I have not checked that they give the correct information yet.

http://www.zshare.net/download/83841153b78cb67c/ (http://www.zshare.net/download/83841153b78cb67c/)

[Edit : allows optical zoom in video mode]
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 15:29:25
waterwingz, have you gotten the new style taskHook dispatching working?  When I try to run something like:
Code: [Select]
if(!_strcmp(tcb->name, "MovieRecord"))
   tcb->entry = (void*)movie_record_task;
, the camera crashes when I call strcmp.  I have confirmed the strcmp address.  The problem is with taking the value tcb->name.  I also confirmed that gcc is using 1 byte struct alignment for task_t as defined in dryos31.h.  I can go back to the older style hard-coded address compare, but this is supposed to work.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 15:37:06
waterwingz, have you gotten the new style taskHook dispatching working?
Short answer = no. 

But I have not even tried - I didn't even know there was such a thing.  I'm guessing that its a way of intercepting tasks without knowing the actual address in  taskCreateHook() ?  That would be sweet.  I added code to capture every address sent to taskCreateHook in a buffer and used the hacked code I have in main.c to display them on the LCD display. (actually spans multiple screens - I recompiled with an offset and ran it twice).   If I had logging to a file working, that would have been better.

No  much help - sorry.  But now that I know that its exists, I'll have to take a look.  Right after I get capt_seq_task(), exp_drv_task and movie_record_task going.  I know their addresses.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 15:59:23
OK, that may also be helpful.  What 19xx addresses for the taskHook worked?  And did the addresses you dumped include references to all the tasks we need to patch (capt_seq_task, movie_record_task, init_file_modules_task and exp_drv_task) ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 16:21:01
What 19xx addresses for the taskHook worked? 
in boot.c, this worked
   *(int*)0x1938=(int)taskCreateHook;
   *(int*)0x1940=(int)taskCreateHook2; 

And did the addresses you dumped include references to all the tasks we need to patch (capt_seq_task, movie_record_task, init_file_modules_task and exp_drv_task) ?
Yes.  There are 58 task hooks that show up at 0x1938 at startup and 3 tasks at 0x1940.  Another 17 task hooks show up when you enter shooting mode.   I wrote them all down by hand and then compared to SD980 tasks to figure out the four we need for the SD940.  The addresses in the code I sent you work for 103C - I would not expect your release to be off by much ?  I'll take a look at the two firmware dumps and see if I can give you the four addresses for 102c ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 16:25:23
No need - I have the addresses for 102C.  I also noticed that address 193C also makes taskHook get called.  Anybody know if we need to use that one too?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 16:38:10
Does this look right then ?

Code: [Select]

        if(p[0]==0xFF8331C4) p[0]=(int)mykbd_task;                      // SD940 103c
if(p[0]==0xFF88E57C) p[0]=(int)init_file_modules_task;
if(p[0]==0xFF872FE0) p[0]=(int)capt_seq_task; 
if(p[0]==0xFF8B2FD0) p[0]=(int)exp_drv_task;
if(p[0]==0xFF93D810) p[0]=(int)movie_record_task;

if(p[0]==0xFF8331C4) p[0]=(int)mykbd_task;    // SD940 102c
if(p[0]==0xFF88E570) p[0]=(int)init_file_modules_task;
if(p[0]==0xFF872F84) p[0]=(int)capt_seq_task;
if(p[0]==0xFF8B2F74) p[0]=(int)exp_drv_task;
if(p[0]==0xFF93D648) p[0]=(int)movie_record_task;
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 16:54:14
Does this look right then ?

Code: [Select]

        if(p[0]==0xFF8331C4) p[0]=(int)mykbd_task;                      // SD940 103c
if(p[0]==0xFF88E57C) p[0]=(int)init_file_modules_task;
if(p[0]==0xFF872FE0) p[0]=(int)capt_seq_task; 
if(p[0]==0xFF8B2FD0) p[0]=(int)exp_drv_task;
if(p[0]==0xFF93D810) p[0]=(int)movie_record_task;

if(p[0]==0xFF8331C4) p[0]=(int)mykbd_task;    // SD940 102c
if(p[0]==0xFF88E570) p[0]=(int)init_file_modules_task;
if(p[0]==0xFF872F84) p[0]=(int)capt_seq_task;
if(p[0]==0xFF8B2F74) p[0]=(int)exp_drv_task;
if(p[0]==0xFF93D648) p[0]=(int)movie_record_task;

Almost.  I believe init_file_modules should be 0xFF88E520, not 0xFF88E570 for 102C (the task, not the createTask).  I embedded the kbd task into the boot code where the PhySwTask is commented out, but yours should work, too.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 17:01:55
I believe init_file_modules should be 0xFF88E520, not 0xFF88E570 for 102C (the task, not the createTask).

I looked again and you are correct. Sort of confirms my concern about blindly porting to alternate firmware versions without a way to test.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 18:01:14
It appears that the SD940 uses propset3, not propset2 in camera.h.  Changing this should help.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 18:39:02
Here's where I am at on the 102C

Battery voltage = 0

Display button not working properly

Screen updates not 100%

Task patches:
   exp drv:
      overrides working ok
   capt seq:
      overrides working ok
      not all patches working yet
   kbd task
      working ok
   file modules:
      core_spytask_can_start ok
      FAT32 not working yet ("memory card error")
   movie record:
      optical zoom works
   
Edit: USB remote doesn't work either, but that's because it's commented out for now.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 18:41:47
It appears that the SD940 uses propset3, not propset2 in camera.h.  Changing this should help.
Is there a short explanation of what the propset #defines control ? Some sort of offsets into the camera's data structures ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 18:43:51
Here's where I am at on the 102C
Are you going to post your "alpha" build somewhere.  Seems like there are more than a few SD940 owners who are interested - my useless 103c version has had over 25 downloads.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 18:55:12
Here's where I am at on the 102C
Are you going to post your "alpha" build somewhere.  Seems like there are more than a few SD940 owners who are interested - my useless 103c version has had over 25 downloads.
I noticed the propset problem when all the pictures used the same shutter speed.  I traced it to the prop case for Tv being always 0.  I checked several other prop cases and it looks like propset 3 is a good match. Using the prop case debug screen helps to figure out which settings go with which prop case number.

My port has only started to be slightly useful in the last few minutes, but I'll post a version in a few hours.  I'll also post the source in case you want to merge it with your version.  I made almost no changes outside the platform folder (and no changes to the 103c files) so it shouldn't be too hard.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 19:20:25
Wow - you are flying through this !   I think maybe I need a new computer.  Its taking 10 minutes to recompile on the command line - longer if I use the full GUI under Windows.  Averaging three iterations per hour,  this is taking a long time.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 19:29:53
I don't use the Windows shell - I just execute a batch file and that seems a little faster.  I also usually don't do a clean after the compile, so it does an incremental build.  Incremental builds don't always work properly, but if you just change .c files it seems to do the right thing.  Also, gcc 3 is faster than gcc 4 from what I've heard.  I think you could probably also remove the tools and lib directories from the compile part of the build if you know that those did not change, but I haven't tried that yet.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 19:37:29
Did you find a better workaround for vid_bitmap_refresh() than what I did ?

I posted at http://chdk.setepontos.com/index.php?topic=5857.0 (http://chdk.setepontos.com/index.php?topic=5857.0) and a few other place but never came up with anything that actually worked properly.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: whim on 12 / December / 2010, 20:02:38
Quote
Also, gcc 3 is faster than gcc 4 from what I've heard
About twice as fast
Quote
you could probably also remove the tools and lib directories from the compile part of the build if you know that those did not change, but I haven't tried that yet.
probably not much to be gained there; on the other hand, once your stubs & sigs are properly generated,
switching off OPT_GEN_STUBS and OPT_GEN_SIGS can save ~ 20 -30 sec.
Bern R managed to get his compile time down to 5.5 sec using gmake fir on GCC 3.4.6:
http://chdk.setepontos.com/index.php?topic=845.msg57717#msg57717 (http://chdk.setepontos.com/index.php?topic=845.msg57717#msg57717)

hope that helps, and sorry for off topic,

wim

Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 20:19:22
   movie record:
      optical zoom works   

Whoo Hoo !!   Optical zoom in movie mode works on my version too !!   After two month picking away at this,  its the first actual photography thing that CHDK now does on my SD940.  (I get battery voltage displaying too - although the icon is not animating).

Wow - this feels good.   :haha
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 20:26:43
Did you find a better workaround for vid_bitmap_refresh() than what I did ?

I posted at http://chdk.setepontos.com/index.php?topic=5857.0 (http://chdk.setepontos.com/index.php?topic=5857.0) and a few other place but never came up with anything that actually worked properly.

On the S95 I came up with a workaround like yours:
http://chdk.setepontos.com/index.php?topic=5641.msg55757#msg55757 (http://chdk.setepontos.com/index.php?topic=5641.msg55757#msg55757)
I eventually figured out a better location for the screen lock/unlock routines on the S95.  I'll look into this on the '940.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 20:42:17
On the S95 I came up with a workaround like yours:
I eventually figured out a better location for the screen lock/unlock routines on the S95.  I'll look into this on the '940.

Funny how it works out that we ended up with the same hack.  Here's a further post that might help a bit ?


Code: [Select]
extern void _LockAndRefresh(); // wrapper function for screen lock
extern void _UnlockAndRefresh(); // wrapper function for screen unlock


Okay - maybe I just don't understand the terminology here so I'll ask a dumb question.  What do you mean by wrapper function ?  I can find ScreenLock() and ScreenUnlock() by matching the S90 port.  The code even seems to make some sense - incrementing and decrementing some sort of lock counter each time the respective routine is called. When you get a minute,  would you mind doing a cut&paste of code for the wrapper function so I can see what you mean?  ScreenLock & Screenunlock seem to get called from a lot of place ( over 450 each ).
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 12 / December / 2010, 20:52:56
Here's what I have on  my SD940 1.02C port:

Binaries (1.02C):
http://www.zshare.net/download/8383614653354d3f/ (http://www.zshare.net/download/8383614653354d3f/)

Version 1.03C here:
http://chdk.setepontos.com/index.php?topic=5855.msg58000#msg58000 (http://chdk.setepontos.com/index.php?topic=5855.msg58000#msg58000)

Source:
http://www.zshare.net/download/83836185dbd6d38e/ (http://www.zshare.net/download/83836185dbd6d38e/)

Keep in mind that this is an early version with very little testing.  Please see
http://chdk.setepontos.com/index.php?topic=5855.msg58019#msg58019 (http://chdk.setepontos.com/index.php?topic=5855.msg58019#msg58019)
for what is known to be working / not working, but I'd still be interested in hearing about what other people discover works or doesn't.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 12 / December / 2010, 23:12:45
Bern R managed to get his compile time down to 5.5 sec using gmake fir on GCC 3.4.6:

whim :

I kind of want to cry.  Having sat through countless sessions of 10 minutes builds over the last 2 months,  I rolled in everything you've posted and this is what I found after rebuilding following one change to file cap_seq.c , from the end of the log file :

run took 22.33 seconds

22 seconds !!!!   I'll never get those other hours back.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 13 / December / 2010, 19:52:30
Source:
http://www.zshare.net/download/83836185dbd6d38e/ (http://www.zshare.net/download/83836185dbd6d38e/)
I'm really liking your source.  Makes me realize I should have started looking at the S90 port from the start rather than the beta S980. 

One question about boot.c ?   Does this actually work ?
Code: [Select]
// @FF8586DC
if ((*(int*) 0xC0220128) & 1) // look at play switch
*(int*)(0x22FC) = 0x400000; // start in play mode
else
*(int*)(0x22FC) = 0x200000; // start in rec mode

 I tried cut&paste into my boot.c code at the same place as in your code and my camera still starts up in "play mode" regardless of which power switch I press.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 13 / December / 2010, 20:01:08
One question about boot.c ?   Does this actually work ?
Code: [Select]
// @FF8586DC
if ((*(int*) 0xC0220128) & 1) // look at play switch
*(int*)(0x22FC) = 0x400000; // start in play mode
else
*(int*)(0x22FC) = 0x200000; // start in rec mode

Yes, it does if you press and hold the Power button until the lens extends.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 13 / December / 2010, 20:11:40
I'm implementing the short/long Display button pressing to select either ALT or Display.  The problem is that Canon has already placed a special meaning on a long press on Display.  A long press on Display changes the LCD brightness instead of doing the Display function.

We could reverse the logic so that ALT=long press.  This seems less intuitive and would not allow the LCD brightness to be changed.

Or, a short press on Menu for ALT might work OK.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 13 / December / 2010, 20:45:51
Yes, it does if you press and hold the Power button until the lens extends.

Hmmm .. all I changed on the 103c code was adding those 5 lines.  Now if I hold the shoot on/off button down ( the one on the top of the camera ) instead of a short press, the camera starts ( my added AF LED blink happens ) but never gets to turning on the display or anything beyond that.  Some other change I missed maybe ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 13 / December / 2010, 22:13:00
Hmmm .. all I changed on the 103c code was adding those 5 lines.  Now if I hold the shoot on/off button down ( the one on the top of the camera ) instead of a short press, the camera starts ( my added AF LED blink happens ) but never gets to turning on the display or anything beyond that.  Some other change I missed maybe ?

In your version of boot.c there is a line with the comment "removed for correct power-on on 'on/off' button."  You should comment out the code on this line.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 13 / December / 2010, 22:25:07
In your version of boot.c there is a line with the comment "removed for correct power-on on 'on/off' button."  You should comment out the code on this line.

Works now.  Wow - have you also got any tips for me on the stock market?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 13 / December / 2010, 22:47:19
In your version of boot.c there is a line with the comment "removed for correct power-on on 'on/off' button."  You should comment out the code on this line.

Works now.  Wow - have you also got any tips for me on the stock market?

I can't take credit for that.  I asked the same question on the S95 port and reyalp helped.
http://chdk.setepontos.com/index.php?topic=5641.msg55193#msg55193 (http://chdk.setepontos.com/index.php?topic=5641.msg55193#msg55193)
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 13 / December / 2010, 22:51:20
I spent some time on the SD940 port.  Here's what's different today:

Not yet working:
   
Here are the 1.02c binaries:
http://www.zshare.net/download/83886141db0cc4a0/ (http://www.zshare.net/download/83886141db0cc4a0/)

...And the source:
http://www.zshare.net/download/83886172ad3c8fee/ (http://www.zshare.net/download/83886172ad3c8fee/)

I'm hoping that more than the two of us are using this.  I'm counting on others to test this, since I only rigorously test what I use, which is about 10% of the features.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 13 / December / 2010, 23:06:10
I spent some time on the SD940 port.  Here's what's different today:

Wow - you get more done in one day than I do in a week.  I bow to you.

battery readout is always 0V [strange problem !

I get a voltage reading of 3.638 in text mode but the icon does not fill.  I assume its supposed to do that but maybe needs some sort of scaling factor ?

I'm hoping that more than the two of us are using this.  I'm counting on others to test this, since I only rigorously test what I use, which is about 10% of the features.

I have not seen an SD940 in any of the weekend flyers for over a year - its pretty much an obsolete camera despite being a 2010 Consumers Report "Best But".  Most of its owners have probably given up on CHDK after visiting the wiki and learning it is not supported.  I suspect we will get converts as we go forward - especially if we can offer ports to other firmware versions.  The differences between yours & mine are not big - as long as someone says please I will do what I can to help them out.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 13 / December / 2010, 23:27:36
I get a voltage reading of 3.638 in text mode but the icon does not fill.  I assume its supposed to do that but maybe needs some sort of scaling factor ?
The battery voltage code has a low pass filter on the value from the firmware function, otherwise it is a thin wrapper around the firmware.  I bypassed the filter with no difference, The stub address for 102c is the same as for 103c so I'm a little mystified by the difference.  I suppose I'll find a misplaced semicolon eventually.  Until then, I can convince myself that I don't need a battery readout.

The SD940 was always a bit of a niche camera.  It's basically a SD780 with a larger LCD, no optical viewfinder, a bigger lens and a higher price.  I don't think they sold very many.  I like it because it was one of their first cameras Canon made after they rediscovered the importance of making things small.  The SD780 is ranked 15th most popular Canon camera on Flickr.  The SD940 is ranked #60.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 13 / December / 2010, 23:39:39
The SD940 was always a bit of a niche camera.  It's basically a SD780 with a larger LCD, no optical viewfinder, a bigger lens and a higher price. 

Well,  I spent weeks thinking about the 780 vs 940. I was sold on those camera's size.  A CHDK beta for the 780 almost sent me that way but from what I read,  the optical viewfinder was pretty much useless and the lens on the 940 had a much better zoom.  So I ignored the roughly $50 different price and foolishly figured I could puzzle out the CHDK port on my own. 

All of which leads me to my conclusion that the small cadre of  SD940 owners will be pretty excited once CHDK is available for their favorite camera.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 16 / December / 2010, 13:51:35
I'm hoping that more than the two of us are using this.  I'm counting on others to test this, since I only rigorously test what I use, which is about 10% of the features.

I've been thinking about this and how supporting multiple firmware version might be one component of getting enough testing help.   Looking at the SD940 dumps I've seen so far, the code for the routines in stubs_entry_2.S is pretty much the same from version to version - just relocated a little in memory.  However, the signatures_dryos.h file is sufficiently generic to many cameras that it does not 100% find these routines for the SD940.

Would is be worth doing a version of signatures_dryos.h tuned for the SD940 ?  If we could get 100% converage then converting for different firmware versions becomes almost trivial.

Has anyone tried this approach ?
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: brakar on 17 / December / 2010, 05:12:25
Hi,

Hope it is ok to break in on this thread to ask a quick question.

I am currently thinking of buying an Ixus 940IS, but only if it would be possible to use certain chdk functions on it. I am mainly interested in the ability to run scrips (for remote control of the camera). Is this possible in the current alfa version of chdk, or is anybody working on this functionality?
 
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 17 / December / 2010, 08:32:37
Scripts run in the alpha version.  However, none of the scripting functions have been tested so likely some will work and some will not.  This will get better as we get more experience with the port and move into Beta stage. 

One possible challenge will be the firmware version of the SD940 you purchase.  If its not one we are currently working on then you will either need to modify the port yourself or wait until somebody has the time and inclination to do so (i.e. not guaranteed to happen soon)
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 17 / December / 2010, 21:56:53
Scripts run in the alpha version.  However, none of the scripting functions have been tested so likely some will work and some will not.

FWIW, I'm working on a fairly complex time lapse script involving exposure overrides, math, timers, and shooting and it all works perfectly on the SD940.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 17 / December / 2010, 22:02:22
FWIW, I'm working on a fairly complex time lapse script involving exposure overrides, math, timers, and shooting and it all works perfectly on the SD940.

waldo :  Great news!  Now that I have a spare moment this week,  I'm folding my code into yours so the 1.02c and 1.03c versions work the same.  Do you think we can be brave enough to claim we have reached Beta status ?

Merge version of the trunk makefile and makefile.inc attached ....
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 17 / December / 2010, 22:11:32
Now that I have a spare moment this week,  I'm folding my code into yours so the 1.02c and 1.03c versions work the same.  Do you think we can be brave enough to claim we have reached Beta status ?

I've never really understood the alpha/beta thing with regard to CHDK.  Compared to any commercial software, I would say that the most well-refined version of CHDK is still "alpha".  I would say that 1 week after the last unresolved bug report, you should release it to the trunk for auto-builds.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waterwingz on 17 / December / 2010, 22:23:51
I've never really understood the alpha/beta thing with regard to CHDK.  Compared to any commercial software, I would say that the most well-refined version of CHDK is still "alpha".  I would say that 1 week after the last unresolved bug report, you should release it to the trunk for auto-builds.

From the wiki page called "For Developers",  I kind of assumed that anything that would boot and show the CHDK logo could be considered Alpha.  Getting that far is an accomplishment when you start from scratch and it shows that at least you have some grasp on what to do?  Not much actually works but for owners of your camera model - its a ray of hope that somebody is actually working on the project for their camera.

Just my opinion,  but being in Beta means you have completed all the porting steps,coded all the required functions, found all the stub addresses and have a release that boots and runs as far as you know.  At that point,  it all becomes testing and understanding why, despite all your brilliance, some things still don't work.

I hear you about CHDK versus commercial software though.  But I would counter that for what people pay to get CHDK,  they get way more than the pay for.
Title: Re: SD940 rev 103c porting thread (IXUS120)
Post by: waldo on 18 / December / 2010, 10:38:27
I noticed that the edge overlay does not draw properly on 102C.  Possibly a problem with the viewport size functions.
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 18 / December / 2010, 18:36:35
Having a problem with capt_set.c.   At first I thought it was not saving images to the SD card.  But when I look at the SD card, images are being stored in the right subdirectories under DCIM.  However, the file names are not prefixed by "IMG_" - they are just stored as (for example)  1234.jpg rather than IMG_1234.jpg .   This means the camera does not see them in playback mode.

Right now,  I think I have the code stripped so that its an exact copy of the ROM code - no links to CHDK functionality - and I'm still not getting the right file names.  Any ideas ?
Title: Re: SD940 (IXUS120) porting thread
Post by: waldo on 18 / December / 2010, 18:56:24
Having a problem with capt_set.c.   At first I thought it was not saving images to the SD card.  But when I look at the SD card, images are being stored in the right subdirectories under DCIM.  However, the file names are not prefixed by "IMG_" - they are just stored as (for example)  1234.jpg rather than IMG_1234.jpg .   This means the camera does not see them in playback mode.

Right now,  I think I have the code stripped so that its an exact copy of the ROM code - no links to CHDK functionality - and I'm still not getting the right file names.  Any ideas ?

I'm not seeing that on my camera.  I have started noticing random hang-ups after taking a picture, tho.
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 18 / December / 2010, 20:50:23
Did a line by line comparison between yours & mine - looks identical except for address offsets. Sigh.
Making a new dissassembly source in case I introduced a subtle typo somewhere.

Update :  If I start the camera with the play button and then go into shooting mode using a 1/2 push on the shutter button, the camera saves pictures using IMG_nnnn.jpg filenames.   If I start the camera in picture taking mode by holding down the "shoot" button for 2 seconds, the camera saves pictures using nnnn.jpg file names.  This is like chasing ghosts - sometimes the pictures have IMG_ at the start of the filename and some times they don't.  I'm going to put this away for a while now - clearly not thinking straight.
Title: Re: SD940 (IXUS120) porting thread
Post by: waldo on 19 / December / 2010, 11:17:36
I found that my problem related to sometimes hanging up when shooting were related to how fast I pressed the shutter button.  It would hang if I pressed the shutter button too fast.

If you look at my source for capt_seq.c, there are two lines commented out with the comment: "fixes overrides behavior at short shutter press".  If you put these two lines back in, the hang-up problem goes away.
Title: Re: SD940 (IXUS120) porting thread
Post by: brakar on 19 / December / 2010, 11:57:12
Thanks a lot to you guys for working on this port!

I will run to the shop and buy a camera. Is it firmversion 1.02c and 1.03c I should be looking for?

Title: Re: SD940 (IXUS120) porting thread
Post by: waldo on 19 / December / 2010, 12:08:34
I will run to the shop and buy a camera. Is it firmversion 1.02c and 1.03c I should be looking for?

Yes, those are the two versions that have a more-or-less working CHDK port.  There is also apparently a 1.03B firmware but I'm not sure if that has even been dumped so it may be a while before that is supported.

I don't think they are being made anymore, but you might still find a new one in a shop.
Title: Re: SD940 (IXUS120) porting thread
Post by: brakar on 19 / December / 2010, 12:47:56
I saw one in a shop today and have also seen a few on different online-shops. Any idea why these go for the price of eg. Ixus130IS + 50-100% ?
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 19 / December / 2010, 13:31:36
I saw one in a shop today and have also seen a few on different online-shops. Any idea why these go for the price of eg. Ixus130IS + 50-100% ?
I think that newer models tend to have better prices while they are in mass market sales mode.  A quick look at the specs of  SD4000 (IXUS130) says its a bit of an upgrade from the SD940.  Might be a better buy ?
Title: Re: SD940 (IXUS120) porting thread
Post by: brakar on 19 / December / 2010, 13:52:37
In a review: http://www.cnet.com.au/canon-ixus-130-is-339300900.htm (http://www.cnet.com.au/canon-ixus-130-is-339300900.htm) they had the following conclusion:

Casual shooters will find nothing wrong with the images from the IXUS 130 IS, but more astute photographers will find some troublesome noise and photo quality issues. Our advice? Pick up the much better 120 IS, even if it is a few millimetres thicker.

Besides, I don't think there is a chdk port ready for the 130IS yet.
Title: Re: SD940 (IXUS120) porting thread - stuck and need ideas
Post by: waterwingz on 19 / December / 2010, 14:47:48
Still having problems with pictures being saved without the IMG_ prefix (just as nnn.jpg not IMG_nnn.jpg).

I've traced it down to the call to conf_restore() in main.c.   If I take a quick shot before the core_spytask() runs or if I comment out the call to conf_restore() then files are saved with the correct name structure.   As soon as conf_restore() gets to  conf_load_defaults() the filename corruption starts.

I can't find anything in conf_info[] that should cause this.  I'm assuming somewhere something is pointing at the wrong location or somewhere I haven't found all the configuration parameters ?

Anyone have any ideas ?


Solved : http://chdk.setepontos.com/index.php?topic=5855.msg58346#msg58346 (http://chdk.setepontos.com/index.php?topic=5855.msg58346#msg58346)
Title: Re: SD940 (IXUS120) porting thread
Post by: reyalp on 19 / December / 2010, 15:08:24
Still having problems with pictures being saved without the IMG_ prefix (just as nnn.jpg not IMG_nnn.jpg).
Camera jpegs are saved without prefix ? CHDK doesn't (intentionally) change this at all...
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 19 / December / 2010, 15:47:10
Camera jpegs are saved without prefix ? CHDK doesn't (intentionally) change this at all...
That's what I thought too - trying to do it on purpose would be difficult.  I'll keep digging.
Title: Re: SD940 (IXUS120) porting thread
Post by: waldo on 19 / December / 2010, 17:24:23
I would try deleting the CCHDK.CFG.  Let it get rebuilt and see if that helps.  Also, problems with conf_restore can be the result of bad addresses for file I/O functions, although I can't think of a reason that would cause your particular file name symptoms.
Title: Re: SD940 (IXUS120) porting thread
Post by: RoninTech on 19 / December / 2010, 19:28:20
Hi all, trying to dump my 940's 1.03B FW image.  If I boot newdryos version of diskboot.bin I get black screen but if I wait 1 min. empty.dum is just nulls.  Trying dryos version of diskimage.bin gives me disk locked after multiple attempts.  I'm using cardtricks 1.44 to make the SD card dumper.

Any ideas as to what I might be missing?
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 19 / December / 2010, 19:45:39
Hi all, trying to dump my 940's 1.03B FW image.  If I boot newdryos version of diskboot.bin I get black screen but if I wait 1 min. empty.dum is just nulls.  Trying dryos version of diskimage.bin gives me disk locked after multiple attempts.  I'm using cardtricks 1.44 to make the SD card dumper.

Any ideas as to what I might be missing?

RoninTech :  Sounds like you are trying to run a CHDK image for a different camera ?  You seem to be confusing what is needed to dump a FW image.  The easiest way is to run a Canon BASIC program such as the one I posted at http://chdk.setepontos.com/index.php?topic=4310.msg57252#msg57252 (http://chdk.setepontos.com/index.php?topic=4310.msg57252#msg57252).  Details about running Canon Basic can be found at http://chdk.wikia.com/wiki/Canon_Basic (http://chdk.wikia.com/wiki/Canon_Basic)

FWIW,  I have a dump of the 1.03B FW image if you need it.  Are you able to work on a port or were you going to post your dump and see if someone else can port it for you ?

http://www.zshare.net/download/8401129401127798 (http://www.zshare.net/download/8401129401127798)
Title: Re: SD940 (IXUS120) porting thread - problem of the weekend solved
Post by: waterwingz on 19 / December / 2010, 19:57:01
I would try deleting the CCHDK.CFG.  Let it get rebuilt and see if that helps.  Also, problems with conf_restore can be the result of bad addresses for file I/O functions, although I can't think of a reason that would cause your particular file name symptoms.
Thanks waldo.  That wasn't it but the problem is solved - sort of.  Did a binary search of each entry in conf_info[]  and eventually tied the strange filename behaviour to whether or not the splash screen was enabled. Ouch. More trial and error led me eventually to my old friend vid_bitmap_refresh().   The other day I had been trying to implement the various combinations of _ScreenLock() and _ScreenUnLock() that I have seen on this forum.  (I had originally hacked this rountine to simply do draw_filled_rect(0, 0, screen_width, screen_height, 0x00)).    I had left some of the Lock/Unlocks laying around there.  No idea why it caused the weird filename behaviour - once I commented it out everything started working properly.

Hence my comment about "sort of" above.  Still need to figure out how vid_bitmap_refresh() should work.
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 19 / December / 2010, 20:04:50
Pick up the much better 120 IS, even if it is a few millimetres thicker.
That's what I think too - but I might be a little biased.   8)

Besides, I don't think there is a chdk port ready for the 130IS yet.

I've been following their progress on the forum - seems to be a lot more people working on a port that we have and they are somewhat ahead of us in getting things tested.  Nice to see a camera currently showing up in the weekend sale flyers for great prices being ported.


Title: Re: SD940 (IXUS120) porting thread
Post by: RoninTech on 19 / December / 2010, 20:32:41
Thanks waterwingz, your script worked.  After reading this (http://chdk.wikia.com/wiki/Cardtricks?cb=5029) I was under the impression that cardworks was universal as long as you selected the correct OS.  With the Christmas holidays coming up I figured I needed something to keep me occupied so thought I'd play around with CHDK on my camera.  I'm way behind you fellas but I'll gladly help getting 1.03B up to snuff if I can.   :xmas

Can you confirm that this is the same checksum you get for your 1.03B PRIMARY.BIN image file?:

Quote
# made with checksum..  point-and-click hashing for windows.
# from corz.org.. http://corz.org/windows/software/checksum/ (http://corz.org/windows/software/checksum/)
#
2f4ce34f6ed0d8a507ccad97aa8fafb6 *PRIMARY.BIN
Title: Re: SD940 (IXUS120) porting thread
Post by: reyalp on 19 / December / 2010, 20:36:38
You will not get identical checksums, Canon stores settings, crashlogs etc in "ROM"
Title: Re: SD940 (IXUS120) porting thread
Post by: RoninTech on 19 / December / 2010, 20:43:44
Title: Re: SD940 (IXUS120) porting thread: 1.03B here!
Post by: IOOI on 19 / December / 2010, 21:06:35
All of which leads me to my conclusion that the small cadre of  SD940 owners will be pretty excited once CHDK is available for their favorite camera.

Very true! I've got a 1.03B version here and kept coming to the CHDK wiki from time to time to see if there were some news regarding CHDK on the IXUS 120. It's really great that you finally did start a port.

I am hoping for a 1.03B version and I am willing to help testing for that version.
Title: Re: SD940 (IXUS120) porting thread
Post by: RoninTech on 19 / December / 2010, 21:32:46
Quickly setup the CHDK-shell build environment on a win7 laptop I have here.  Dropped in sd940-source-v4.zip as a platform and tried to build 103C.  It errored out because I don't have fi2.inc with the correct keys.  Are you fellas using an environment that doesn't require fi2.inc?
Title: Re: SD940 (IXUS120) porting thread
Post by: reyalp on 19 / December / 2010, 22:09:40
Quickly setup the CHDK-shell build environment on a win7 laptop I have here.  Dropped in sd940-source-v4.zip as a platform and tried to build 103C.  It errored out because I don't have fi2.inc with the correct keys.  Are you fellas using an environment that doesn't require fi2.inc?
if you turn off OPT_FI2 you do not need it. Otherwise, you need to read platform/fi2.inc.txt and find the appropriate keys.
Title: Re: SD940 (IXUS120) porting thread
Post by: RoninTech on 19 / December / 2010, 22:29:14
Thanks reyalp, turned off OPT_F12 and the build ran until this error:

Quote
========== E:\CHDK\TRUNK\TRUNK1005\BIN\LOGS\ERR-IXUS120_SD940-103C.TXT ==========

../platform/ixus120_sd940/libplatform.a(lib.o): In function `vid_bitmap_refresh':
lib.c:(.text+0x24): undefined reference to `_ScreenLock'
../platform/ixus120_sd940/libplatform.a(lib.o): In function `vid_turn_off_updates':
lib.c:(.text+0x10c): undefined reference to `_ScreenLock'
collect2: ld returned 1 exit status
E:\CHDK\gcc451\bin\gmake.exe[1]: *** [main.elf] Error 1
gmake: *** [all-recursive] Error 1


I'll slow down and go back and do some more reading.  All I did was drop one of these alpha builds onto trunk and then use CHDK-shell so I'm obviously missing some important step(s).
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 19 / December / 2010, 22:35:30
Can you confirm that this is the same checksum you get for your 1.03B PRIMARY.BIN image file?:

Post your file on zShare.net and I'll take a look if you like ?
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 19 / December / 2010, 22:41:12
Quickly setup the CHDK-shell build environment on a win7 laptop I have here.  Dropped in sd940-source-v4.zip as a platform and tried to build 103C.

The code you downloaded was posted by waldo, who is working on the 102c version.  I'm pretty sure the 103c version does not build with that code - at least not yet.
Title: Re: SD940 (IXUS120) porting thread
Post by: RoninTech on 19 / December / 2010, 23:26:34
The code you downloaded was posted by waldo, who is working on the 102c version.  I'm pretty sure the 103c version does not build with that code - at least not yet.

Gotcha waterwingz.  Is there an equivalent archive for the 103C source that I could d/l, drop onto trunk and try to build with CHDK-shell?

I did some disassembling with the FW image I dumped and IDA and it does look to be good.
Title: Re: SD940 (IXUS120) porting thread
Post by: dave1978 on 20 / December / 2010, 05:23:31
Great work you're doing. I own a SD940 (fw 103c) for a while now and I am really looking forward to a chdk-version of this nice litt' cam. I'm "volunteering" as a "tester" of the firmware. It seems the alphabuild placed on zshare is missing the ps.fi2, or am I missing something here?
Title: Re: SD940 (IXUS120) porting thread
Post by: brakar on 20 / December / 2010, 06:06:58
Got my camera today (firmware version 1.02c) and will start testing soon.

Btw, with regard to the different firmware-versions; would it not be easier to change the firmware on the camera -instead of creating separate ports of chdk for every firmware-version?
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 20 / December / 2010, 09:04:39
Btw, with regard to the different firmware-versions; would it not be easier to change the firmware on the camera -instead of creating separate ports of chdk for every firmware-version?
I would probably be easier but Canon does not support changing firmware on their cameras. There is no know firmware upgrade method.
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 20 / December / 2010, 09:08:12
It seems the alphabuild placed on zshare is missing the ps.fi2, or am I missing something here?
I have not tried to build a ps.fi2 file as I just copy the Diskboot.bin file to my SD card and boot using the "write protect" switch.  Is there a need for a ps.fi2 file for the SD940? I thought that was only used on cameras that for some reason don't boot with the "write protect" method.
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 20 / December / 2010, 09:13:52
Is there an equivalent archive for the 103C source that I could d/l, drop onto trunk and try to build with CHDK-shell?
I'll post my version as soon as I finish cleaning up from the mess I made tracking down the bug mentioned yesterday in this forum.  Probably in the next couple of days - I modified the makefile and makefile.inc files so that building either version is supported. I guess I'll also add the 1.03B version as well.  Other than that I'm working off Waldo's files for the core, include and platform stuff.
Title: Re: SD940 (IXUS120) porting thread
Post by: dave1978 on 20 / December / 2010, 10:10:01
It seems the alphabuild placed on zshare is missing the ps.fi2, or am I missing something here?
I have not tried to build a ps.fi2 file as I just copy the Diskboot.bin file to my SD card and boot using the "write protect" switch.  Is there a need for a ps.fi2 file for the SD940? I thought that was only used on cameras that for some reason don't boot with the "write protect" method.

Well, without the ps.fi2 I don't get the firmware update option in the menu, with the file I do, though a zero-byte file with the name ps.fi2 doesn't seem to load the chdk properly (camera hangs with a black screen, have to remove the battery to get it goin' again)...
Title: Re: SD940 (IXUS120) porting thread
Post by: waterwingz on 20 / December / 2010, 10:27:40
Well, without the ps.fi2 I don't get the firmware update option in the menu, with the file I do, though a zero-byte file with the name ps.fi2 doesn't seem to load the chdk properly (camera hangs with a black screen, have to remove the battery to get it goin' again)...
I just looked at the forum thread for making the fi2.inc file needed to produce a ps.fi2 file.  
http://chdk.setepontos.com/index.php/topic,2995.0.html (http://chdk.setepontos.com/index.php/topic,2995.0.html)
Looks like more work than I have time for right now.  Did you try using the other (SD card write protect) method of booting - it does not need the ps.fi2 file.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 20 / December / 2010, 12:00:50
Posted my latest release at http://www.zshare.net/download/8414264325f9f3c0/ (http://www.zshare.net/download/8414264325f9f3c0/)  Made the arbitrary decision to call this Beta1 as all required tasks are ported and enabled,  all addresses are found to the best on my ability and most things seems to run.

Having said that,  my first attempt at RAW crashed the camera after creating a new directory on the SD card with an empty RAW image there.

It's a Beta release - what else can I say ?    I'll post source code shortly.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: fe50 on 20 / December / 2010, 13:20:20
Having said that,  my first attempt at RAW crashed the camera after creating a new directory on the SD card with an empty RAW image there.
This most probably isn't the reason for crashing, but: since Canon changed the folder layout / folder creation mechanism for the newer Powershots, it's recommended to disable the "RAW File in Dir with JPEG" setting from the CHDK RAW menu.

This set, RAW images should always be stored to one common folder ("100CANON" or similar) - otherwise you may get a new, empty image folder whenever the camera is restarted.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 20 / December / 2010, 13:27:18
it's recommended to disable the "RAW File in Dir with JPEG" setting from the CHDK RAW menu.

Good point.  The default is disable - but I did noticed the multiple folder issue when I enabled it to see what it would do.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 20 / December / 2010, 13:35:01
It sounds like there may be some differences between the 102c and 103c code, but I'll compare the 103c files to what I have when I see them.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: Microfunguy on 20 / December / 2010, 14:55:12
DELETED

Moved to S95 thread.

Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 20 / December / 2010, 15:16:22
@Waldo

I am having great difficulty porting this to SDM.

The camera crashes on booting when restoring CFG values.
That function also executes if there is no existing CFG file.
For conf values that have an associated conf_change_script_file() function, script_load() is called.
That calls script_scan(..) and crashes.
That code is common to all cameras.

Have you had similar problems ?

Did you notice this edit in conf.c ?

Code: [Select]
//    CONF_INFO( 63, conf.alt_mode_button,        CONF_DEF_VALUE, i:KEY_PRINT, conf_change_alt_mode_button),
// change default to Print for sd940
    CONF_INFO( 63, conf.alt_mode_button,        CONF_DEF_VALUE, i:KEY_DISPLAY, conf_change_alt_mode_button),

I guess looking at it now, the comment should say "Change default to Display"....
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: dave1978 on 21 / December / 2010, 05:04:32
Well, without the ps.fi2 I don't get the firmware update option in the menu, with the file I do, though a zero-byte file with the name ps.fi2 doesn't seem to load the chdk properly (camera hangs with a black screen, have to remove the battery to get it goin' again)...
I just looked at the forum thread for making the fi2.inc file needed to produce a ps.fi2 file. 
http://chdk.setepontos.com/index.php/topic,2995.0.html (http://chdk.setepontos.com/index.php/topic,2995.0.html)
Looks like more work than I have time for right now.  Did you try using the other (SD card write protect) method of booting - it does not need the ps.fi2 file.

Thanx for the hint, I got it working now with a different SD card with the writeprotect enabled, gonna do some testing
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 21 / December / 2010, 09:00:13
Thanx for the hint, I got it working now with a different SD card with the writeprotect enabled, gonna do some testing

Latest Beta release at the start of this thread has what you were looking for. I haven't tested it so if you get a chance you might see if it works ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 21 / December / 2010, 13:08:38
I spent some time on the SD940 port.
.....
I'm hoping that more than the two of us are using this.  I'm counting on others to test this, since I only rigorously test what I use, which is about 10% of the features.

waldo :  Did you try shooting RAW ?  I see people over in the S95 thread are having the same problem as me.  
http://chdk.setepontos.com/index.php?topic=5641.msg58456#msg58456 (http://chdk.setepontos.com/index.php?topic=5641.msg58456#msg58456)
The camera locks up while trying to write a RAW file to the SD card.  Also, there is a file created but it seems to be all black when I use FastStone Image Viewer ( reported to read CHDK RAW files correctly).

UPDATE :  As per the S95 thread, I reduced hook_raw_size() to 0x4000.  Camera still hangs when creating the file - but the file is 16K instead of 8M so it used the smaller value.  Also,  the filename sequential number seems to work fine for the RAW files so the camera parameter used for that appears be okay.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: dave1978 on 21 / December / 2010, 15:04:48
Thanx for the hint, I got it working now with a different SD card with the writeprotect enabled, gonna do some testing

Latest Beta release at the start of this thread has what you were looking for. I haven't tested it so if you get a chance you might see if it works ?

It works.
Title: "bricked" camera ?? - solved
Post by: waterwingz on 22 / December / 2010, 11:56:27
I think I maybe just "bricked" my SD940 working with CHDK.   I now get an error message on startup (with or without CHDK loaded) that says "Lens error, restart camera".   The green LED flashes for a while and then the camera shuts down.  Ouch.

Anybody dealt with this before ?

I've been working on getting RAW to function and chased the problems down to the call to utime() in raw_savefile() in raw.c.  If I comment out that call,  image files are written to the SD card without crashing the camera.  I noticed that utime() in wrapper.c builds differently depending on whether CAM_DRYOS_2_3_R39 is defined in camera.h or not. So I undefined it to see what would happen, rebuilt and loaded.  The camera failed to boot CHDK with that change.  So I rebuilt with CAM_DRYOS_2_3_R39 defined and discovered the lens error on restart.  CHDK will boot but once it returns control to the camera I get the error message again.

UPDATE :  solved - lens was stuck. I guess it doesn't take much to do that.  See two posts down for details.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: c10ud on 22 / December / 2010, 12:15:12
i sometimes had that message while messing up with zooming and some random camera, but it automagically fixed itself rebooting the camera without injecting code. maybe you have some code that's calling bad firmware addresses?
Title: bricked camera - solved
Post by: waterwingz on 22 / December / 2010, 12:18:32
i sometimes had that message while messing up with zooming and some random camera, but it automagically fixed itself rebooting the camera without injecting code. maybe you have some code that's calling bad firmware addresses?
That message should normally comes up only when the lens is jammed (dirt, misshandling etc).  In this case, all I did was swap in and out the SD card. Lens is fine. Whatever got toasted, it generates the error with a normal SD card - no CHDK.

As it boots CHDK, I wonder if its possible to hook the SD940 "reset to factory default" code (on the assumption that its a system paramet that's locked up somewhere maybe and not the firmware itself toasted ?)

Update :  after reading this http://camerarepair.blogspot.com/2007/12/fixing-lens-error-on-digital-camera.html (http://camerarepair.blogspot.com/2007/12/fixing-lens-error-on-digital-camera.html) I worked my way down to "Fix 6".  Worked !  Strange though - must have slightly jammed something reseting CHDK with the lens extended.
Title: Re: SD940 (IXUS120) porting thread - crashing on RAW fixed
Post by: waterwingz on 22 / December / 2010, 14:30:14
Problem with camera shutting down when writing RAW now fixed.  The stubs_entry_2.S value for SetFileTimeStamp was incorrect.  Should be FF835640 for both the 102c and 103c firmware releases.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: brakar on 22 / December / 2010, 19:16:07
Hi, I had no luck so far in starting chdk v 1.02C with the card write protection option. (The camera gives a "memory card is write-protected" error). I fear it is me who have failed to follow some basic instructions, since I have not found any description of how to install and run chdk this way so far. (I just copied the two files in the zip. onto the memory-card). A link to the proper instructions would be nice.

brakar
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 22 / December / 2010, 19:33:18
A link to the proper instructions would be nice.
http://chdk.wikia.com/wiki/CHDK_for_Dummies (http://chdk.wikia.com/wiki/CHDK_for_Dummies)  Look 1/3 of the way down for the section called "Load CHDK onto the card"

Or  http://chdk.wikia.com/wiki/CHDK_For_Newbies_-_How_To_Install (http://chdk.wikia.com/wiki/CHDK_For_Newbies_-_How_To_Install)

Basically,  it sounds like you skipped the steps where you make your card bootable.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: brakar on 22 / December / 2010, 19:48:56
Thanks, The "for dummies"-paper seemes to be exactly what I have been looking for. Will try it out tomorrow. 

brakar
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 22 / December / 2010, 20:09:07
Thanks, The "for dummies"-paper seemes to be exactly what I have been looking for. Will try it out tomorrow. 

No offense intended - at least not from me.  I won't ever tell how long it took me to get things running the first time (or how much time this has taken since).
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 22 / December / 2010, 20:28:58
Source for Beta 1 supporting fw 1.02c, 1.03b and 1.03c posted at
http://www.zshare.net/download/84239780bab48ed0/   (http://www.zshare.net/download/84239780bab48ed0/)

1.03b firmware not ported yet but I put in a placeholder hoping that RoninTech succeeds with his port.

UPDATE :  posted 1.03c http://www.zshare.net/download/84241756930bb65b/ (http://www.zshare.net/download/84241756930bb65b/) build based on latest source - the stuff where RAW now longer crashes the camera
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: tomsturge on 23 / December / 2010, 08:56:23
Really interested in putting this on my camera, how far along is the hack? Is it safe to use without much loss of CHDK functionality?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 23 / December / 2010, 09:16:30
Really interested in putting this on my camera, how far along is the hack?
For the two firmware version ported so far,  all the coding and porting work is complete.  In theory, everything should work but with only a little testing so far we do not have a good understanding of what does and what does not function as required.  Your volunteer work helping to test would be most appreciated.

Is it safe to use without much loss of CHDK functionality?
From the wiki : http://chdk.wikia.com/wiki/FAQ#Q._Can_CHDK_damage_your_camera.C2.A0.3F (http://chdk.wikia.com/wiki/FAQ#Q._Can_CHDK_damage_your_camera.C2.A0.3F)

Q. Can CHDK damage your camera ?

Short answer: Yes. It is unlikely, but theoretically possible. As stated above CHDK comes with no warranty for any use; you use it at your own risk. CHDK is created by reverse engineering an undocumented system that directly controls hardware. Because of this, it is impossible to be certain that it is completely safe. There have been no confirmed cases of CHDK damaging a camera, but in some cases it would be very difficult to distinguish between coincidental failures and failures caused in part by CHDK.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: brakar on 23 / December / 2010, 14:40:22
I have now installed the new version (Beta 1) on a fresh formatted 2GB SD card, using CardTricks, but CHDK will still not run on the camera (firmware 1.02c). The camera gives a "write proctected card" warning when write prot. is on, and nothing happens when writeprot. is off and I try to start chdk the manual way.

Any ideas for what I could try?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 23 / December / 2010, 14:57:07
Any ideas for what I could try?

Did you go through the "make bootable" part of the process ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: brakar on 23 / December / 2010, 15:18:37
Yes, I will try with another SD-card to see if the problem persists.

Same result with the new card ...


Update: I copied the files in the 1.02c binaries (link on page 5 in this thread) onto the card. Made chdk work!
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 23 / December / 2010, 21:58:42
I think some of the current SD940 issues may be getting lost due to the length of this thread.

Here's my list of what is not working:

Edge overlay not working
http://chdk.setepontos.com/index.php?topic=5855.msg58277#msg58277 (http://chdk.setepontos.com/index.php?topic=5855.msg58277#msg58277)

Difficult or impossible to use long press of DISP to get to Canon DISP functions
http://chdk.setepontos.com/index.php?topic=5855.msg58074#msg58074 (http://chdk.setepontos.com/index.php?topic=5855.msg58074#msg58074)

Battery readout not working in 102c
http://chdk.setepontos.com/index.php?topic=5855.msg58084#msg58084 (http://chdk.setepontos.com/index.php?topic=5855.msg58084#msg58084)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 23 / December / 2010, 22:17:46
Here's my proposal for the DISP key issue:

Code: [Select]
void my_kbd_read_keys()
{
static int altDownTimer=0;
const int DISP_DOWN_TIME = 20;

kbd_prev_state[0] = kbd_new_state[0];
kbd_prev_state[1] = kbd_new_state[1];
kbd_prev_state[2] = kbd_new_state[2];

_platformsub_kbd_fetch_data(kbd_new_state);

kbd_new_state[2] |=0x00008000;  /// disable the battery door switch

// support for short/long press of Display
if (kbd_is_key_pressed(KEY_DISPLAY)) { // Display held down
altDownTimer++; // timer for DISP
}
else {
altDownTimer = 0;
}

if (kbd_process() == 0) {
// leave it alone...
physw_status[0] = kbd_new_state[0];
physw_status[1] = kbd_new_state[1];
physw_status[2] = kbd_new_state[2];

physw_status[0] |= alt_mode_key_mask;  /// disable the ALT mode button

physw_status[SD_READONLY_REG] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG;
}
else {
// override keys

physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |(kbd_mod_state[0] & KEYS_MASK0);
physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) | (kbd_mod_state[1] & KEYS_MASK1);
physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |(kbd_mod_state[2] & KEYS_MASK2);

if (altDownTimer > DISP_DOWN_TIME) {
physw_status[0] &= ~alt_mode_key_mask;  // press the Display button
}
}

_kbd_read_keys_r2(physw_status);

physw_status[2] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG;

remote_key = (physw_status[2] & USB_MASK)==USB_MASK;
if (remote_key) {
remote_count += 1;
}
else if (remote_count) {
usb_power = remote_count;
remote_count = 0;
}

if (conf.remote_enable) {
physw_status[2] = physw_status[SD_READONLY_REG] & ~(SD_READONLY_FLAG | USB_MASK);
} else {
physw_status[2] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG;
}
}

Changes are the lines dealing with altDownTimer. 
A quick press and release = ALT toggle.
A press of about 1/4 second to 1 second = Canon DISP
A press longer than 1 sec = Change LCD brightness

It seems fairly intuitive once you get the hang of the key press timing.  It's not ideal and will cause confusion for new users, but it's the best I came up with so far.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 23 / December / 2010, 22:43:28
I think some of the current SD940 issues may be getting lost due to the length of this thread.
I was wondering about that too so I've proposed a bit of an experiment.  There is probably a better way to do this but at least this is a start :

http://chdk.wikia.com/wiki/SD940_Beta_Testing_Status_Page (http://chdk.wikia.com/wiki/SD940_Beta_Testing_Status_Page)

I linked it into the developer section of the wiki.  If that turns out to be a bad idea we can always remove it.

Here's my list of what is not working:

Edge overlay not working
http://chdk.setepontos.com/index.php?topic=5855.msg58277#msg58277 (http://chdk.setepontos.com/index.php?topic=5855.msg58277#msg58277)

Difficult or impossible to use long press of DISP to get to Canon DISP functions
http://chdk.setepontos.com/index.php?topic=5855.msg58074#msg58074 (http://chdk.setepontos.com/index.php?topic=5855.msg58074#msg58074)

Battery readout not working in 102c

Interesting about the battery stuff - works fine on the 103c right out of the box - although I have to adjust the max and min voltage levels down to get the icon and/or percentage indicators to work.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: RoninTech on 26 / December / 2010, 13:31:24
Hi guys,

Just touching base to make sure I'm not going way off track.  I'm using this (http://chdk.wikia.com/wiki/Adding_support_of_a_new_firmware_version) as a guide to port 103B and using 103C as the reference.

I dropped the PRIMARY.BIN I extracted from my 103B camera into ixus120_sd940/sub/103b and then used CHDK shell to build 103b.

I then compared the new 103B stubs_entry.S with the one from 103C.  Found that there were 45 changed NSTUBS above address 0xff8687d4.

Before I continue, am I on the right track with this?  The PRIMARY.BIN files in the sub folders were all 0 length but the stubs_entry.S was present and populated.  Is that just to save space when distributing?  The stubs_entry.S I generated was the same as that in waterwingz trunk1001-SD940-BETA1.zip archive so I think I might be doing it right... :blink:
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 26 / December / 2010, 14:06:52
Before I continue, am I on the right track with this? 
So far, so good.  To go any farther,  you are going to need a dissassembly of the PRIMARY.BIN file so that you can figure out the correct entries for stubs_entry_2.s,  lib.c, stubs.asm.h and the code for boot.c, capt_seq.c and movie_rec.c.

Does that make sense to you ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: RoninTech on 26 / December / 2010, 14:23:17
Yep, thanks waterwingz.  I've got my PRIMARY.BIN loaded up and processed in IDA.  I'll keep going and report back when (not if :) ) I get stuck.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: fe50 on 26 / December / 2010, 15:38:11
I dropped the PRIMARY.BIN I extracted from my 103B camera into ixus120_sd940/sub/103b and then used CHDK shell to build 103b.
There are two relevant settings for this in the "Compile Options" menu: OPT_GEN_STUBS and OPT_GEN_SIGS
You can also set "PRIMARY_ROOT" to your own folder structure containing the firmware dumps - otherwise the CHDK-Shell will look in the current builds sub directory...

Quote
The PRIMARY.BIN files in the sub folders were all 0 length but the stubs_entry.S was present and populated.  Is that just to save space when distributing?
No; the firmware dumps (PRIMARY.BIN files) are not in the SVN tree; without a corresponding firmware dump file the build process creates an empty spare file and skips searching for signatures...

This wikia article may also be helpfull for you: http://chdk.wikia.com/wiki/Signature_finder
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: RoninTech on 26 / December / 2010, 15:58:44
What is the 103B directory in the trunk1001-SD940-BETA1.zip archive based on?  I just noticed that boot.c is quite different between it and the one for 103C.  Should I be using the files for 103C as a 103B baseline?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 26 / December / 2010, 16:47:34
What is the 103B directory in the trunk1001-SD940-BETA1.zip archive based on?  I just noticed that boot.c is quite different between it and the one for 103C.  Should I be using the files for 103C as a 103B baseline?
Sorry for the confusion.  I had put your Primary.BIN file in the the 103B folder when I was setting up the directories and I ran a trial build of the 103B.  So the stubs_entry.S is based on your firmware dump.  I deleted the firmware dumps when making the zip file. You can put it back in and follow fe50's suggestions from above to rebuild.  The boot.c file in there is an older version of the 103C build - probably better to just discard it and work from the current 103C or 102C files.  They are now pretty close to being the same.  The S90 port also makes a good reference.

Two things that to think about.  Having a dissassembly for either the 103C or 102C and using that to help figure out correct address is advised.   I wasted too many night before I figured that out - the S90 code is pretty close and I if I had know I would have used that for comparison.

Also,  notepad+ is a nice little programming editor that understands and hightlights syntax.  More important,  it has a nice plugin for comparing two files side by side.  Very handy when porting code.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 27 / December / 2010, 10:03:32
@waterwingz, You may want to test while enabling raw, dng, edge overlay and zebra.  My camera shows virtually no free memory and will crash when enabling combinations of those features.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 27 / December / 2010, 10:21:37
@waterwingz, You may want to test while enabling raw, dng, edge overlay and zebra.
Raw seems to be okay on its own although the image is useless.  I suspect buffer address needs work. Dng won't work because LUA will not create a badpixel file.  In fact most of LUA functions seem to crash - could not run the LLIBTST.LUA script for example. Have not been able to get anything but snow from my first looks at edge overlay and zebra.  Not sure if that's RAM or bad addresses yet.

My camera shows virtually no free memory and will crash when enabling combinations of those features.
Stupid question time - how do you tell how much free memory you have ?  Also, does this mean doing a more custom port and cutting out things like games and/or maybe one of the two scripting engines ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 27 / December / 2010, 10:29:12
Stupid question time - how do you tell how much free memory you have ?  Also, does this mean doing a more custom port and cutting out things like games and/or maybe one of the two scripting engines ?

CHDK menu/Miscellaneous/Show memory info
It changes as features are turned on and off, but I have seen as little as 512 bytes free.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 27 / December / 2010, 11:05:48
It changes as features are turned on and off, but I have seen as little as 512 bytes free.

Oh good - something else probably not working yet.  Free Memory shows about 130K using the Show Memory Info menu item.  It varies a few K depending on what's enable.  I assume this probably means its calculating free memory based on some parameter not set correctly in one of the many files that need to be edited.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 27 / December / 2010, 11:45:15
Free Memory shows about 130K using the Show Memory Info menu item.  It varies a few K depending on what's enable.  I assume this probably means its calculating free memory based on some parameter not set correctly in one of the many files that need to be edited.

No, it malloc's larger and larger blocks until it fails.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: RoninTech on 27 / December / 2010, 19:57:52
Status update, sick as a dog with a bad cold so I've had nothing but time to play with this stuff.  :(

I whipped up a perl script that analyses the stubs_entry.s files for an existing FW (103C) and a new FW(103B).  It calculates any offset ranges and then iterates through the various files and updates any addresses it finds accordingly.  Here's the output from an example run:

Quote from: Offsetinator Script output
Analyzing 103c/stubs_entry.S and 103b/stubs_entry.S to determine offset ranges.

For addresses less than 0xFF87E5C8 no offset required
For addresses between 0xFF87E5C8 and 0xFF925848 add the offset:    -80(0x50)
For addresses between 0xFF9358EC and 0xFFB0A224 add the offset:    -444(0x1BC)
For addresses greater than 0xFFB0A224 use offset:       -444 (0x1BC)

36 addresses updated in 103b/stubs_entry_2_with_offsets.S
24 addresses updated with offsets in 103b/boot.c_with_offsets
277 addresses updated with offsets in 103b/capt_seq.c_with_offsets
391 addresses updated with offsets in 103b/movie_rec.c_with_offsets

Compare these files to the originals in 103b/ and save as such if they look good

Looking at the modified addresses (including sub_ and loc_ tags) in my PRIMARY.BIN's dissassembly it seems to be working.  If I'm on the right track I need to go through the offset files and find/fix any discrepancies.

You can see the script here (http://dl.dropbox.com/u/1261659/offsetinator.pl) and the modified files (slightly renamed for easy diffing) here (http://dl.dropbox.com/u/1261659/103b/103b.zip).  I also included my 103B PRIMARY.BIN with the modified files.  waterwingz, you must have gotten that 103B file from somewhere else as I didn't upload mine until now.  If someone could take a quick peek for a sanity check I'd be much obliged.

Hope everyone had/is having a great holiday!
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 27 / December / 2010, 21:30:17
Looking at the modified addresses (including sub_ and loc_ tags) in my PRIMARY.BIN's dissassembly it seems to be working.  If I'm on the right track I need to go through the offset files and find/fix any discrepancies.
Ha ha - I did something very similiar while I was working through it - although I used an Excel spreadsheet to calculate variances between the SD940 and SD980 releases I was trying to understand.  Turned out to be a pretty much useless exercise as, in the end, I put the two dissassembly dumps side by side and matched address from the first stubs_entry_2.S to the source code for that camera and then found the same source code for the other camera and saved the resulting address in its stubs_entry_2.S.

waterwingz, you must have gotten that 103B file from somewhere else as I didn't upload mine until now. 
Yes - lost track of where things came from - somebody named http://chdk.wikia.com/wiki/User:Spike940 (http://chdk.wikia.com/wiki/User:Spike940) did the dump for the 103B and was hoping somebody else was going to be able to do the port.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 28 / December / 2010, 12:17:04
@waldo :  Does LUA work for you ? I cannot call functions in my version - makes me suspicious about stack allocation.

This works :
Code: [Select]
--[[
@title LUA Test 1
--]]

repeat
press("shoot_full")
release("shoot_full")
sleep(5000)
until false

this does not ( camera shutsdown with nothing saved )
Code: [Select]
--[[
@title LUA Test 2
--]]

 function TakePicture()
  press("shoot_full")
release("shoot_full")
 end
 
repeat
TakePicture()
sleep(5000)
until false

Would you mind trying this on your port ?

Thnk
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 28 / December / 2010, 19:25:08
@waldo :  Does LUA work for you ? I cannot call functions in my version - makes me suspicious about stack allocation.

This works :
Code: [Select]
--[[
@title LUA Test 1
--]]

repeat
press("shoot_full")
release("shoot_full")
sleep(5000)
until false

this does not ( camera shutsdown with nothing saved )
Code: [Select]
--[[
@title LUA Test 2
--]]

 function TakePicture()
  press("shoot_full")
release("shoot_full")
 end
 
repeat
TakePicture()
sleep(5000)
until false

Would you mind trying this on your port ?

Thnk

Both scripts work for me.  The difference between the two is just Lua plumbing so I would not expect that a particular port could make one work and the other fail.  Maybe it's a memory problem - I've had my SD940 crash just taking pictures without running scripts.  I'm pretty sure that was due to running out of memory.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: sikahr on 29 / December / 2010, 03:26:55
Hi,

   sorry for offtopic,

   please someone who owns sd940 test how much memory is free after chdk loading on SD940 in play mode with empty memory card ( black screen - no pictures),


   I see results of your free memory from previous posts(cca 130k) but I dont know conditions of test (play/capture mode start, empty/ not empty memory card).

   Please, start in play mode with empty memory card to test free memory.

   Thanks in advance, this is needed for SX130 chdk development.


PS
To find free memory:
Press ALT and then press MENU, navigate to the 'Miscellaneous stuff' menu and select 'Show memory info".
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 29 / December / 2010, 10:42:52
please someone who owns sd940 test how much memory is free after chdk loading on SD940 in play mode with empty memory card ( black screen - no pictures),

   I see results of your free memory from previous posts(cca 130k) but I dont know conditions of test (play/capture mode start, empty/ not empty memory card).

   Please, start in play mode with empty memory card to test free memory.

Okay - SD940 103C  BETA release - empty card, play mode start -

***Memory Info ***
Free Memory: 188288 bytes  
CHDK size: 297884 bytes
loaded at 0x153E64

Update : Free memory drops to 127K in shoot mode after I take the first picture (image show on startup).  Taking more pictures does not seem to change that much.  Turning on Edge Overlay drops the memory to 65K.  Zebra does not seem to work yet with this port - maybe not enough memory to even start ?

Free memory with a shoot mode start was 185382 bytes with no pictures on the card.

As discussed in this thread,  I don't think I believe it but waldo's desciption of it malloc'ing space until it runs out sounds pretty robust assuming it tests the malloc'd buffer and does not just depend on the return code from the OS. Having said that,  we are still having trouble with random crashing in LUA and other places so naturally we are suspicious about memory limits

Additional Update :   Looks like the SD940 has more free memory than the IXUS100 SD780 (its physical twin)
 http://chdk.setepontos.com/index.php?topic=3995.msg55455#msg55455 (http://chdk.setepontos.com/index.php?topic=3995.msg55455#msg55455).  They seem to get pretty good functionality out of what they have.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: Bernd R on 29 / December / 2010, 12:12:52
To get zebra working, you need add in camera.h this i think

#define CAM_ZEBRA_ASPECT_ADJUST 1
   #define CAM_ZEBRA_NOBUF 1

your memory is lower.IX 1000 have 251xxx bytes
maybe you try out to disable in chdk shell compiler options opt_game xxxxx opt_textreader if things go better.if not, then its no mem problem

with that you can get 21 kb more ram.ix 1000 have then 272xxx bytes.
check if enough ram is here is a good idea, but for the check task switching of the Camera need disable(i dont know if thats possible), so no other task can jumo in and allocate memory, because if a task alloc mem, during mem eaten process, mem fragmentation or crash can happen, because the other task get no memory.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 29 / December / 2010, 12:39:01
To get zebra working, you need add in camera.h this i think

#define CAM_ZEBRA_ASPECT_ADJUST 1
   #define CAM_ZEBRA_NOBUF 1

That worked - thanks !!  I still have an offset between actual image and either the zebra pattern or the edge overlay pattern so it doesn't look like much. But the pattern is definitely there.  One of my buffer size values in lib.c is wrong I suspect.

your memory is lower.IX 1000 have 251xxx bytes
maybe you try out to disable in chdk shell compiler options opt_game xxxxx opt_textreader if things go better.if not, then its no mem problem

I haven't started eliminating functions yet.  With memory 200K - 300K less than other cameras,  somehow saving 5K to 10K does not seem like much help.  Still,  its worth a shot.   I read in another thread that using gcc4 saves space too - but its was awefully slow the last time I tried it.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 29 / December / 2010, 12:53:10
Here's my proposal for the DISP key issue:
<snip>
It seems fairly intuitive once you get the hang of the key press timing.  It's not ideal and will cause confusion for new users, but it's the best I came up with so far.

Had the chance to try CHDK on my daughter's SD1200.  They solve the issue of not having a PRINT button by using a second short press of the Play power button to activate ALT mode.  Works petty well.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: fe50 on 29 / December / 2010, 14:33:24
With memory 200K - 300K less than other cameras,  somehow saving 5K to 10K does not seem like much help.  Still,  its worth a shot.   I read in another thread that using gcc4 saves space too - but its was awefully slow the last time I tried it.
There are some more cameras with < 300kb free RAM successfully running the "standard" CHDK build...

This wikia article may be helpful for you:
*http://chdk.wikia.com/wiki/CHDK/Camera_RAM_memory_usage (http://chdk.wikia.com/wiki/CHDK/Camera_RAM_memory_usage) :D
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waterwingz on 29 / December / 2010, 16:46:16
There are some more cameras with < 300kb free RAM successfully running the "standard" CHDK build...

True - but not a lot with less than the 180K we are working with.  I did notice that the SD780 tread shows that camera apparently working well with only 125K of free memory.

This wikia article may be helpful for you:

I had seen that - its what got me worried that not having enough memory might be a problem for us.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta release]
Post by: waldo on 29 / December / 2010, 17:20:45
My SD940/1,02c shows 64K free best case. After taking pictures the free memory can be less than 1K (if it doesn't crash before I can check the memory info).  Not sure what the difference is. 

...unless that is why they made firmware version 1.03c
Title: Re: SD940 (IXUS120) porting thread [Zebra & Edge Overlay working !!]
Post by: waterwingz on 29 / December / 2010, 20:20:31
Some progress today - I now have edge overlay and zebra modes working!

Changes from the released 103c beta code :

1) in lib.c vid_get_viewport_width() should return 360
2) in lib.c vid_get_bitmap_screen_width() should return 360
3) in camera.h add the following : (thanks to Bernd R)
             #define CAM_ZEBRA_ASPECT_ADJUST 1
             #define CAM_ZEBRA_NOBUF 1

I'll update the beta source code to reflect this.


Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 31 / December / 2010, 11:45:14
Posted Beta 2 release for firmware 103c
http://www.zshare.net/download/84588902eef95021/ (http://www.zshare.net/download/84588902eef95021/)

.... and source code for SD940 based on 1001 trunk. 
http://www.zshare.net/download/845888249f3ebff5/ (http://www.zshare.net/download/845888249f3ebff5/)

Includes working zebra and edge overlay modes and waldo's new code for handling the DISP key - see
http://chdk.setepontos.com/index.php?topic=5855.msg58646#msg58646 (http://chdk.setepontos.com/index.php?topic=5855.msg58646#msg58646)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: Bernd R on 31 / December / 2010, 12:21:56
@waldo
>It seems fairly intuitive once you get the hang of the key press timing.  It's not ideal and will cause >confusion for new users, but it's the best I came up with so far.

I use such a long press code on IX1000 to enter alt mode.because this camera have only set/func and menu key and cursor key

But what i miss, is a short sound from camera speaker when time is reach.Do you know how can add such a sound ?
So the user get a notify when the key is press long enough to do a long press action.then he can release the key or wait for another beep, if he want a third option on this key

@waterwingz
>Includes working zebra and edge overlay modes and waldo's new code for handling the DISP key - see
>http://chdk.setepontos.com/index.php?topic=5855.msg58646#msg58646 (http://chdk.setepontos.com/index.php?topic=5855.msg58646#msg58646)

have you fix the offset Problem in Zebra ?
if this is not do, then zebra and edge overlay work only in W (16:9) shooting Mode correct.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 31 / December / 2010, 13:32:23
@waldo
>It seems fairly intuitive once you get the hang of the key press timing.  It's not ideal and will cause >confusion for new users, but it's the best I came up with so far.

I use such a long press code on IX1000 to enter alt mode.because this camera have only set/func and menu key and cursor key

But what i miss, is a short sound from camera speaker when time is reach.Do you know how can add such a sound ?
So the user get a notify when the key is press long enough to do a long press action.then he can release the key or wait for another beep, if he want a third option on this key

That seems like a good idea.  To create a short "key press" sound, use:
_PT_PlaySound(0x2003, 0);
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 31 / December / 2010, 14:15:44
have you fix the offset Problem in Zebra ?
if this is not do, then zebra and edge overlay work only in W (16:9) shooting Mode correct.

Not sure what you mean here by W shooting mode ?  I have not seen different shooting modes - just the normal one the camera always does.

Or are you talking about video shooting ?  Does overlay or zebra make any sense for that ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: Bernd R on 01 / January / 2011, 05:10:29
@waterwingz
>Not sure what you mean here by W shooting mode ?  I have not seen different shooting modes - just the >normal one the camera always does.

The Ixus 120 have when i see in pictures a  16:9 TFT display.

Is it not possible in that cam to choose diffrent shooting resolutions ?
Ixus 1000 have this modes.

L 3648 2736
M1
M2
S
W 3648 2048

Have your Cam no W mode with 16:9 aspect ?

The mode W with 3648*2048 fit complete on the 16:9 display on IX1000, because its 16:9

Only with that 16:9 Mode, Zebra position, and edge overlay is correct.

@waldo

thanks for info, i have test it now, sound work great.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: whim on 01 / January / 2011, 08:52:06
Quote
Have your Cam no W mode with 16:9 aspect ?
SD940 manual says it does (p. 148)
BTW Good manuals site here (http://www.starbatteries.com/cadicausguan.html)

hth,

wim
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 01 / January / 2011, 09:38:37
The SD940 has a 4000x2248 mode (16:9).  But it does not have a 1920x1080 mode like newer cameras, which is unfortunate because otherwise it's a good camera for time lapse.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 01 / January / 2011, 10:32:16
have you fix the offset Problem in Zebra ?
if this is not do, then zebra and edge overlay work only in W (16:9) shooting Mode correct.

Okay - I found the W shooting mode (thanks to whim & waldo) - with memory cards so cheap I never use anything but the highest resolution so I never noticed it.   In answer to your original question, Zebra works fine in that mode as well as the other resoultions.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 01 / January / 2011, 18:32:55
Posted Beta 2 release for firmware 103c

Can you post a build for 102c as well?  Thanks.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 01 / January / 2011, 19:45:27
Can you post a build for 102c as well?  Thanks.
http://www.zshare.net/download/84642295f5a0c8ce/ (http://www.zshare.net/download/84642295f5a0c8ce/)

Obviously,  not tested - let me know how it works ?  (I'll update the root post once I know this boots)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 01 / January / 2011, 21:48:51
Can you post a build for 102c as well?  Thanks.
http://www.zshare.net/download/84642295f5a0c8ce/ (http://www.zshare.net/download/84642295f5a0c8ce/)

Obviously,  not tested - let me know how it works ?  (I'll update the root post once I know this boots)

Your version boots just fine and seems to work like the version I compiled (unfortunately).  I was hoping that my memory problems would have gone away, but I still have insufficient memory to make it run reliably.  It's ironic that once I made my camera more useful with CHDK that I can't use it anymore without disabling CHDK features.  Maybe I'll do a stripped-down version for my own use.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 01 / January / 2011, 22:31:53
Your version boots just fine and seems to work like the version I compiled

Something has been bugging me for a while - since we've been wrestling with this whole memory issue.  It just came to me a few minutes ago what it was - something I noticed months ago but ignored while chasing bigger problems.

In my version of  trunk/platform/ixus120_sd940/sub/103c/makefile.inc, the value of MEMISOSTART=0x153E84.  I can't remember why or where that came from. 

In trunk/platform/ixus120_sd940/sub/102c/makefile.inc, the same constant is MEMISOSTART=0x13CA18

Could that be a clue ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 01 / January / 2011, 22:48:37
Your version boots just fine and seems to work like the version I compiled

Something has been bugging me for a while - since we've been wrestling with this whole memory issue.  It just came to me a few minutes ago what it was - something I noticed months ago but ignored while chasing bigger problems.

In my version of  trunk/platform/ixus120_sd940/sub/103c/makefile.inc, the value of MEMISOSTART=0x153E84.  I can't remember why or where that came from. 

In trunk/platform/ixus120_sd940/sub/102c/makefile.inc, the same constant is MEMISOSTART=0x13CA18

Could that be a clue ?

Yes, that would make a difference.  I believe the 0x13CA18 value is correct for both versions.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 02 / January / 2011, 00:38:22
Yes, that would make a difference.  I believe the 0x13CA18 value is correct for both versions.

Wow ... picked up almost 100K of free memory with that change.  Up tp 284K with no images on the SD card and nothing enabled.   Time for some regression testing.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: Bernd R on 02 / January / 2011, 04:55:03
>In answer to your original question, Zebra works fine in that mode as well as the other resoultions.

Do you mean that you have not the offset Problem in the 4:3 modes (which center the image in X) ?

In older post you write about offset Problem
 
""""
That worked - thanks !!  I still have an offset between actual image and either the zebra pattern or the edge overlay pattern so it doesn't look like much. But the pattern is definitely there.  One of my buffer size values in lib.c is wrong I suspect.
""""

have you change something ?
currently all 16:9 display camera have the problem that zebra only work without offset in W mode
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 02 / January / 2011, 09:52:21
Maybe I'll do a stripped-down version for my own use.

This is starting to look really interesting if it solves your memory shortage ->
   
experimental alternate memory allocation  http://chdk.setepontos.com/index.php?topic=5980.0 (http://chdk.setepontos.com/index.php?topic=5980.0)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 02 / January / 2011, 11:02:06
have you change something ?
currently all 16:9 display camera have the problem that zebra only work without offset in W mode
Only changes were this : http://chdk.setepontos.com/index.php?topic=5855.msg58941#msg58941 (http://chdk.setepontos.com/index.php?topic=5855.msg58941#msg58941)

Now that I go back an look at the camera,  zebra seems to display correctly - alligned with the actual bright areas in the image in both the X and Y direction.

However,  edge overlay and grids are not right.   Grids are compressed about 10% in the horizontal and aligned to the left hand edge.   Edge overlay is also 10% compressed overall but the offset is bigger on the right hand side of the screen than on the left hand side of the screen. (i.e. very close to the left hand edge there is essentially no offset).

@Bernd R   Is that what you desribe as an offset ?

UPDATE :  Fixed :  ASPECT_GRID_XCORRECTION(x) in SD940 Beta code of camera.h is wrong causing both edge overlay and grids to draw incorrectly. Should be
Code: [Select]
    #define ASPECT_GRID_XCORRECTION(x)  ( (x) )  //grids are designed on a 360x240 basis
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 02 / January / 2011, 14:52:49
DOH !

I was using the wrong address for free() - should be 0xFF814138.  Much better now...
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 02 / January / 2011, 15:31:53
DOH !

I was using the wrong address for free() - should be 0xFF814138.  Much better now...

I'm going to update the Beta code later today with the updates from yesterday & today.  I'll make your free() change and rebuild the 102c as well.  The values from camera.h and lib.c used for RAW are almost certainly wrong so I wanted a few quiet minutes to look at that before I do the update.

Update : Curiously,  you had 0xFF814138 commented out  for free() in your stubs_entry_2.S for the 102c
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 02 / January / 2011, 17:37:10
While you're at it, you can make it refocus in video mode:

in cameras.h, add:
#define CAM_AF_SCAN_DURING_VIDEO_RECORD 1

for 102c, add:
NHSTUB(ExpCtrlTool_StartContiAE, 0xFF844034)
NHSTUB(MakeAFScan, 0xFF940504)

for 103c, add:
NHSTUB(ExpCtrlTool_StartContiAE, 0xFF844034)
NHSTUB(MakeAFScan, 0xFF9406CC)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waldo on 02 / January / 2011, 19:05:43
Oh, and one more thing...

Can you turn off the flashing orange LED?  I think most people would find it confusing.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 2 release]
Post by: waterwingz on 02 / January / 2011, 19:17:53
While you're at it, you can make it refocus in video mode:

Got it.  Had to also add to stubs_min.S for the 103C :
    DEF(some_flag_for_af_scan, 0x673C)          // @FF940EDC

You don't like the flashing orange LED ? But that's my favorite part of the whole hack.  When I'm testing, it gives me some indication that the spytask is still running.   However,  I concede that others will find it confusing and, as its hacked into trunk/core/main.c I guess it really does have to go. 
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waterwingz on 02 / January / 2011, 22:51:22
Posted BETA 3 release tonight.

Source :  http://www.zshare.net/download/84686420220f9dab/ (http://www.zshare.net/download/84686420220f9dab/)
102c : http://www.zshare.net/download/8468650332642eb9/ (http://www.zshare.net/download/8468650332642eb9/)
103c : http://www.zshare.net/download/846864602fe7d2b7/ (http://www.zshare.net/download/846864602fe7d2b7/)

Major Changes :

1) Grids and edge overlay scaled correctly for SD940 screen ( were slightly compressed to the left )
2) Memory leak in 1.02c fixed - no longer runs out of memory and crashes.
3) Memory fence posts in 1.03c fixed - resulting in more free memory.
4) Will now refocus in video mode
5) Debug blinking orange LED removed.


Still Badly Broken :

1) Invalid RAW images stored
2) LUA still crashes in 1.03c (calling subroutines and possibly other issues).
 
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waldo on 03 / January / 2011, 13:53:52

Still Badly Broken :

1) Invalid RAW images stored
 

Try this:

Code: [Select]
char *hook_raw_image_addr()
{
return 0x4219D120; // @FF874840 for 102C / FF87489C for 103C
}
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waterwingz on 03 / January / 2011, 17:31:27
Try this:
Code: [Select]
return 0x4219D120;

That's what I already have - at least in the current Beta releases.  Might have been different in what I originally sent to you.

I'm thinking the problem might be in camera.h - CAM_RAW_ROWPIX, CAM_RAW_ROWS maybe ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waldo on 03 / January / 2011, 17:42:44
Try this:
Code: [Select]
return 0x4219D120;

That's what I already have - at least in the current Beta releases.  Might have been different in what I originally sent to you.

I'm thinking the problem might be in camera.h - CAM_RAW_ROWPIX, CAM_RAW_ROWS maybe ?

The 102c code still had something else in that function.  The 102c works now with only that change, so you may want to compare the 102c code to the 103c code for other differences.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waterwingz on 03 / January / 2011, 21:06:48
The 102c code still had something else in that function.  The 102c works now with only that change, so you may want to compare the 102c code to the 103c code for other differences.
Working on that.  Are you using the camera.h I put in the beta release or your own ?  Can you send my your own if its different ?  TIA.


@waldo :  Can you run any of the LUA test scripts in the default script folder ( badpixel.lua, llibtst.lua, tstcallf.lua ) ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waldo on 03 / January / 2011, 21:32:54
Working on that.  Are you using the camera.h I put in the beta release or your own ?  Can you send my your own if its different ?  TIA.

Code: [Select]
#elif defined (CAMERA_ixus120_sd940)
#define CAM_DRYOS_2_3_R39 1//stat is different, as well as some other functions
#define SYNCHABLE_REMOTE_NOT_ENABLED 1
    #define CAM_PROPSET                 3
    #define CAM_DRYOS                   1

    #define CAM_RAW_ROWPIX              4080 // from calcs see 100C lib.c
    #define CAM_RAW_ROWS                3048 //  "     "    "    "    "

    #undef CAM_SWIVEL_SCREEN
    #define CAM_ADJUSTABLE_ALT_BUTTON   0
    #define CAM_CAN_SD_OVER_NOT_IN_MF 1
    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
    #define CAM_HAS_VIDEO_BUTTON       1
    #define CAM_VIDEO_QUALITY_ONLY          1
    #define CAM_BRACKETING              1
    #undef  CAM_VIDEO_CONTROL
    #undef  CAM_HAS_IRIS_DIAPHRAGM
    #define CAM_MULTIPART               1
    #undef CAM_HAS_JOGDIAL
    #undef  CAM_USE_ZOOM_FOR_MF
    #undef  CAM_UNCACHED_BIT  // shut up compiler
    #define CAM_UNCACHED_BIT    0x40000000
    #define CAM_HAS_ND_FILTER           1
    #define CAM_CAN_SD_OVERRIDE         1

    #define DNG_SUPPORT                 1
    // pattern
    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
    // color

    #undef CAM_BITMAP_PALETTE
    #define CAM_BITMAP_PALETTE    3

    #define CAM_COLORMATRIX1                               \
      827547, 1000000, -290458, 1000000, -126086, 1000000, \
     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
      5181,   1000000, 48183,   1000000, 245014,  1000000

    #define cam_CalibrationIlluminant1 1 // Daylight
    // cropping
    #define CAM_JPEG_WIDTH  4000
    #define CAM_JPEG_HEIGHT 3000
    #define CAM_ACTIVE_AREA_X1 20
    #define CAM_ACTIVE_AREA_Y1 12
    #define CAM_ACTIVE_AREA_X2 4056
    #define CAM_ACTIVE_AREA_Y2 3038
    // camera name
    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
    #undef  CAM_SENSOR_BITS_PER_PIXEL
    #undef  CAM_WHITE_LEVEL
    #undef  CAM_BLACK_LEVEL
    #define CAM_SENSOR_BITS_PER_PIXEL   12
    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
    #define CAM_BLACK_LEVEL             127

    #define CAM_EXT_TV_RANGE            1

    #define  CAM_SHOW_OSD_IN_SHOOT_MENU  1

    //nandoide sept-2009
    #undef CAM_USES_ASPECT_CORRECTION
    #undef CAM_USES_ASPECT_YCORRECTION
    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate


    #undef ASPECT_XCORRECTION
    #define ASPECT_XCORRECTION(x)  (((x)<<1))   //correction x*screen_buffer_width/screen_width = x*960/480 = x*2/1

    #undef ASPECT_GRID_XCORRECTION
    #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
    #undef ASPECT_GRID_YCORRECTION
    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.


    #undef ASPECT_VIEWPORT_XCORRECTION
    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
    #undef ASPECT_VIEWPORT_YCORRECTION
    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
    #undef EDGE_HMARGIN
    #define EDGE_HMARGIN 20

    //games mappings
// renamed GAMES_SCREEN_WIDTH / GAMES_SCREEN_HEIGHT
   #undef GAMES_SCREEN_WIDTH
   #undef GAMES_SCREEN_HEIGHT
   #define GAMES_SCREEN_WIDTH 360
   #define GAMES_SCREEN_HEIGHT 240
   #undef ASPECT_GAMES_XCORRECTION
   // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
   // used by gui.c that configures the draw environment (trhough new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
   // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
   #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
   #undef ASPECT_GAMES_YCORRECTION
   #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none

   //zebra letterbox for saving memory
   #undef ZEBRA_HMARGIN0
   #define ZEBRA_HMARGIN0  30 //this 30 rows are not used by the display buffer is 720x240 effective, no 960x270, i.e. (270-240) reduction in widht possible but not done (more difficult to manage it and slower).

    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1

Quote
@waldo :  Can you run any of the LUA test scripts in the default script folder ( badpixel.lua, llibtst.lua, tstcallf.lua ) ?

I've tried badpixel and libtst and they both work.  libtst does not properly remove one directory, but that happens on some other cameras, too.  badpixel will not run properly until the raw buffer address is correct.
Title: RAW not working on SD940 1.03c
Post by: waterwingz on 03 / January / 2011, 23:11:34
So when you dig into raw.c,  it all comes down to this one line :

            write(fd, get_raw_image_addr(), hook_raw_size());

What confuses me is that (as explained in the wiki and forum) this simply dumps the raw pixel buffer from the camera to file. I recently tested an SD1200 camera with CHDK and its raw dump and both FSviewer and Picassa viewer could display the file.   Yet when I try to look at the raw image from my SD940 its blank.  I would have understood seeing colored snow if I had the buffer address wrong.  And when I do a hex dump of the file, its got lots of random data in every byte.  So why do the image viewers think its a blank file ?

UPDATE :  Found this in another thread, posted by reyalp :

The CHDK "raw" is a byte for byte copy of the sensor frame buffer. There is no appropriate place to put other data. The tools that do understand non-format use file size as a hint for what camera it came from.

So maybe I've got tools that understand the SD1200 dump and not the SD940 ?

@waldo :  what are you using to look at raw dumps ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waldo on 03 / January / 2011, 23:42:33
I use DNG.  To use, create a file called badpixel.bin in \CHDK.  Maybe an empty file will work, otherwise try 8 or 16 bytes of 0x00.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: reyalp on 03 / January / 2011, 23:45:10
So maybe I've got tools that understand the SD1200 dump and not the SD940 ?
Most programs that understand CHDK CRW use code from dcraw. dcraw is updated occasionally to support new cameras.

I'd suggest using rawconvert (in the tools directory) to turn it into an 8bpp greyscale. That should be enough to tell if you have the correct dimensions and image buffer.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waterwingz on 04 / January / 2011, 00:51:28
I use DNG.  To use, create a file called badpixel.bin in \CHDK.  Maybe an empty file will work, otherwise try 8 or 16 bytes of 0x00.
Needs to be at least 16 0x00's.  I get a CRW file that I can open and see an image.  If I ask FSViewer to show it full size it is a whole lot bigger than my computer screen so I'm hoping its not just scaling up the jpg thumbnail that I think is embedded in each DNG version of a CRW file ?  If not then what this means is that it has been working all along - doh!

I'd suggest using rawconvert (in the tools directory) to turn it into an 8bpp greyscale. That should be enough to tell if you have the correct dimensions and image buffer.

Okay - worked out how to get the makefile in the tools directory to build an executable version of rawconvert.  What should I use as command line parameters to get an 8bpp greyscale - that was not obvious and trial & error has not helped.  Also - any suggestiong on what image viewer should understand the resulting output ?

Thank again!
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: reyalp on 04 / January / 2011, 01:59:49
Needs to be at least 16 0x00's.  I get a CRW file that I can open and see an image.
Don't confuse the *extension* with the *format* of the file. If you have DNG turned on you get a DNG. Some programs are smart enough to figure out a file with a format that doesn't match the extension.

If you get a working DNG (the image isn't scrambled), your raw parameters are correct, and you can ignore everything below

Quote
Okay - worked out how to get the makefile in the tools directory to build an executable version of rawconvert.  What should I use as command line parameters to get an 8bpp greyscale - that was not obvious and trial & error has not helped.  Also - any suggestiong on what image viewer should understand the resulting output ?

Thank again!
http://chdk.wikia.com/wiki/CHDK_Tools (http://chdk.wikia.com/wiki/CHDK_Tools)
rawconvert -12to8 -w=<width> -h=<height> [-pgm] <infile> <outfile>

-12to8 says to convert a 12 bit per pixel to an 8 bit per pixel.

The non-pgm output of rawconvert is understood by many programs (gimp, irfanview http://www.irfanview.com/ (http://www.irfanview.com/) photoshop) that have an "open as raw" command where you can enter the bit depth and dimensions.

Most of those programs probably also understand pgm.

The width and height don't have to be correct, they just have to match (width*height*bpp)/8 == filesize. Use whatever values you have in camera.h. If you get them wrong it will be obvious in the image, and you can try different values in camera.h.

In irfanview, you would do
"open as raw", and enter 8bpp (greyscale, 1 byte per pixel), and the same width and height you used in camera.h

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: Bernd R on 04 / January / 2011, 07:10:01
to show crw files its also possible to use dng4ps and create a camera profile

here you can mark a range and this program can create a color profile for you.there is a jpg of same image need for this.

I can on IX1000 click calc color profile, and i get white too.but i think something work on IX1000 raw wrong, colors are tint not direct exchange.

I shoot for conversion this image from my monitor

http://dng4ps2.googlecode.com/files/pallete.PNG (http://dng4ps2.googlecode.com/files/pallete.PNG)

but not so near, that the monitor dots not see.

then i mark the range of the testimage and dng4ps2 try to calc a color matrix so the raw image look same as jpg image of same file

maybe you have more luck with that
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waterwingz on 04 / January / 2011, 09:49:40
With a faked out badpixel.bin file I get working DNG files.  And using rawconvert per reyalp's instructions give me an 8bpp greyscale that looks good with irfanview.  So I think I'm going to declare this one solved and move onto my last problem - getting LUA working.

Once that's done,  dare I say we might have a release candidate for the main trunk ?
Title: debugging with the ROM log
Post by: waterwingz on 05 / January / 2011, 22:02:19
I need a little debugging advice here.

I'm chasing whatever it is that make LUA crash in my port.  I've read through the wiki on debugging http://chdk.wikia.com/wiki/Debugging#Reading_the_romlog (http://chdk.wikia.com/wiki/Debugging#Reading_the_romlog). 

The good news is that I get what looks like a valid camera dump after each crash.   First line is almost alway "Exception!! Vector 0x10" - an attempt to access an invalid memory address.  I think I also once saw a "Exception!! Vector 0x04" - undefined instruction.  Either way, the camera appears to head off into the void while running LUA scripts.

Other information :  its always "Task name: SpyTask" in the dump logs.  Why ?  I though LUA and BASIC run from the mykbd_task() ?

Looking at addresses in the register and stack dumps do not reveal anything like a "return address" - those in ROM areas are usually halfway through some ramdom subroutine.  Not immediately after a BL instruction.

Not sure what to do with the camera log part.  The last line is usually '00002120: UI:ScreenLock" but not always.


So, any advice on what to look at?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: reyalp on 05 / January / 2011, 22:49:02
I need a little debugging advice here.

I'm chasing whatever it is that make LUA crash in my port.  I've read through the wiki on debugging http://chdk.wikia.com/wiki/Debugging#Reading_the_romlog (http://chdk.wikia.com/wiki/Debugging#Reading_the_romlog). 

The good news is that I get what looks like a valid camera dump after each crash.   First line is almost alway "Exception!! Vector 0x10" - an attempt to access an invalid memory address.  I think I also once saw a "Exception!! Vector 0x04" - undefined instruction.  Either way, the camera appears to head off into the void while running LUA scripts.

Other information :  its always "Task name: SpyTask" in the dump logs.  Why ?  I though LUA and BASIC run from the mykbd_task() ?
Maybe stomping on something that ends up killing spytask.

Since you are getting an exception, you should look at PC (R15) in the register dump. That should be the address of the offending instruction. More likely to be useful with data access exception. If you want to post the register dump and the first bit of the stack dump here, I may be able to provide some help.

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waterwingz on 05 / January / 2011, 23:05:23
Since you are getting an exception, you should look at PC (R15) in the register dump. That should be the address of the offending instruction. More likely to be useful with data access exception. If you want to post the register dump and the first bit of the stack dump here, I may be able to provide some help.
I cut and pasted four ROMLOG files below.  R15 seems only seems to point into ROM once in the four logs.

Code: [Select]

==========================================================================
Exception!! Vector 0x10
Occured Time  2011:01:02 09:43:32
Task ID: 12910616
Task name: SpyTask
Exc Registers:
0x00307534
0x00197E50
0x00000001
0xD1B560C4
0x0019ACD4
0x00000000
0x00000000
0x00000000
0x19980218
0x001611BB
0x19980218
0x00307524
0xFFB0D484
0x00307518
0x0016B3E4
0xFF87E580
0x00000013
StackDump:
0x00307554
0x00307528
0x0015F083
0x0016B3E0
0x0000B471
0x00000201
0x00000000
0x4D2048C4
0x0019ACD4
0x00000100
0x0019ACD4
0x00000201
0x00159B95
0x00000000
0x00000140
0x00000000
0x0016B51D
0x0019ACD4
0x0015A23D
0x0019554C
0x00000000
0x00154055
0x002F2D44
0x19980218
0x19980218
0xFF816A20
0x19980218
0x19980218
0x00000808

==========================================================================
Exception!! Vector 0x10
Occured Time  2011:01:05 18:34:06
Task ID: 12910616
Task name: SpyTask
Exc Registers:
0x00000000
0x00000000
0x00000000
0x00000000
0x60000013
0x00000000
0x00163587
0x002C2000
0x00307554
0x001635CD
0x003078F4
0x003078F4
0x0030761C
0x00307538
0x00165FC9
0x0030762C
0x00000010
StackDump:
0x003078F4
0x002C1DD0
0x003078F4
0x002C5600
0x0030761C
0x003078F4
0x00166073
0x002C5600
0x00000004
0x0016159B
0x0030761C
0x00307BA8
0x0030761C
0x00162245
0x0030761C
0x00307BA8
0x0030761C
0x00162387
0x003078F4
0x00000024
0x0000000D

==========================================================================
Exception!! Vector 0x10
Occured Time  2011:01:05 18:52:24
Task ID: 12910616
Task name: SpyTask
Exc Registers:
0x00005555
0x00307558
0xE12FF001
0x7A3A834C
0xE59F110C
0x1777CD2C
0xE5911000
0x003075F1
0x80000013
0xFF812C3C
0x002C4CB8
0xFF814114
0x00000000
0x00307538
0x002C4CC0
0x00000362
0x800000B8
StackDump:
0x00154180
0x00307D58
0x0030754C
0x00165C3B
0x00154180
0x00005555
0x00000000
0x003075F1
0x00160D89
0x00000000
0x00000005
0x00000004
0x00000004
0x002C1908
0x00160DFF
0x002C1B08
0x00000000
0x002C1AD8
0x003078F4
0x00000024
0x0000000D

==========================================================================
Exception!! Vector 0x10
Occured Time  2011:01:05 18:52:24
Task ID: 12910616
Task name: SpyTask
Exc Registers:
0x00005555
0x00307558
0xE12FF001
0x7A3A834C
0xE59F110C
0x1777CD2C
0xE5911000
0x003075F1
0x80000013
0xFF812C3C
0x002C4CB8
0xFF814114
0x00000000
0x00307538
0x002C4CC0
0x00000362
0x800000B8
StackDump:
0x00154180
0x00307D58
0x0030754C
0x00165C3B
0x00154180
0x00005555
0x00000000
0x003075F1
0x00160D89
0x00000000
0x00000005
0x00000004
0x00000004
0x002C1908
0x00160DFF
0x002C1B08
0x00000000
0x002C1AD8
0x003078F4
0x00000024
0x0000000D

==========================================================================
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: reyalp on 05 / January / 2011, 23:31:30
Do you have a link for a 103c dump ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 3 release]
Post by: waterwingz on 06 / January / 2011, 00:08:56
Do you have a link for a 103c dump ?

http://www.zshare.net/download/848201282cdf43aa/ (http://www.zshare.net/download/848201282cdf43aa/)

Thanks !
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 07 / January / 2011, 01:11:51
Crashing problem in LUA fixed - mykbd_task() was running out of stack space.  Changed 1.03c version to use same startup code as 1.02c as that code created the task with a 4X larger stack.

source ->[http://www.zshare.net/download/848676257e9092d1/  (http://[http://www.zshare.net/download/848676257e9092d1/)
1.02c ->  http://www.zshare.net/download/84867664e4bf0334/ (http://www.zshare.net/download/84867664e4bf0334/)
1.03c ->  http://www.zshare.net/download/848676892eb6629e/ (http://www.zshare.net/download/848676892eb6629e/)

At this point,  as far as I know - EVERYTHING WORKS !!!

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waldo on 07 / January / 2011, 09:08:18
For 102C, the edge overlay and zebra still do not work.  I thought it might be a screen dimension problem in lib.c, but the 102C and 103C code seems to be the same.

Also, the dark frame subtraction does not work.  I spent quite a bit of time on this already but I've got a few more things to try.

Also, the camera usually crashes when I take pictures in raw.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 07 / January / 2011, 11:44:10
For 102C, the edge overlay and zebra still do not work. 
When you sent my your camera.h section for the SD940 the other day,  it did not contain the two additional defines that Bernd  R had give me. 
http://chdk.setepontos.com/index.php?topic=5855.msg58941#msg58941 (http://chdk.setepontos.com/index.php?topic=5855.msg58941#msg58941)

Are you still using your camera.h or did you switch to the one from the Beta source code release ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: tidu on 07 / January / 2011, 12:31:53
Thanks for the port guys!

Using 103C and it seems to work fine; I get usable dng files, ev bracketing and scripting both work etc.  

Only issues I noticed was that the battery meter is not working (fixed at 0%), and autoISO seemed to use 640 for every shot (might be a user error, haven't used the custom autoISO settings before).
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waldo on 07 / January / 2011, 12:33:06

When you sent my your camera.h section for the SD940 the other day,  it did not contain the two additional defines that Bernd  R had give me. 
Are you still using your camera.h or did you switch to the one from the Beta source code release ?

I tested it with your latest build for 102C.  I'll try the changes in camera.h on my build.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 07 / January / 2011, 14:19:40
Only issues I noticed was that the battery meter is not working (fixed at 0%)

Battery meter works properly on my camera if I set the max and min voltage values in the OSD setup menu - try 4.25 and 3.5.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waldo on 07 / January / 2011, 15:11:49
Only issues I noticed was that the battery meter is not working (fixed at 0%)

Battery meter works properly on my camera if I set the max and min voltage values in the OSD setup menu - try 4.25 and 3.5.

Yes, that seems to be the problem with the battery display.  For some reason, the values in get_vbatt_min() and get_vbatt_max() are wrong.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waldo on 07 / January / 2011, 19:23:35
I'm running out of ideas for the issue with the dark frame subtract setting not affecting anything.

What I know is that the location of the call to capt_seq_hook_set_nr was wrong.  It was in a location in capt_seq that did not normally get executed.  When I fixed that, the camera would consistently crash when capt_seq_hook_set_nr was called.  I traced this to the call to _time.  The address for this function looks OK.  When I commented that out, it doesn't crash, but changing nrflag has no effect.  I tried a few possible candidates for the nrflag address, one of which seems to be the same variable used in other ports. 

Then again, in a camera with such a small image sensor, most people would probably want the default Canon behavior for lower noise (i.e. the "Auto" setting).
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 07 / January / 2011, 19:59:09
Then again, in a camera with such a small image sensor, most people would probably want the default Canon behavior for lower noise (i.e. the "Auto" setting).
I hear you.  Looking at the barrel distortion in my DNG images,  I also wonder why RAW seems attractive on a small camera to people ?  Sure, on a $1500 DSLR with  a good 50mm lens there is something to be said for not having jpeg compression.  But I must be missing something - what does it get me with something like the SD940?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: pixeldoc2000 on 07 / January / 2011, 20:01:40
Crashing problem in LUA fixed - mykbd_task() was running out of stack space.  Changed 1.03c version to use same startup code as 1.02c as that code created the task with a 4X larger stack.
Thanks for the hint! Had the same problem on SD4000 (hooked mykbd_task() without increased stack size).

Bad idea:
Code: [Select]
void taskHook(context_t **context) {
...
if(!_strcmp(tcb->name, "PhySw"))           tcb->entry = (void*)mykbd_task;    // cause crash with large scripts because we hook task without increased stack size
...
}
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 07 / January / 2011, 20:07:04
Thanks for the hint! Had the same problem on SD4000 (hooked mykbd_task() without increased stack size).
This community development thing seems to work.   I know my productivity went way up once I had enough of a port to start this thread and starting getting help from the more senior members of the forum.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waldo on 07 / January / 2011, 20:07:58
Then again, in a camera with such a small image sensor, most people would probably want the default Canon behavior for lower noise (i.e. the "Auto" setting).
I hear you.  Looking at the barrel distortion in my DNG images,  I also wonder why RAW seems attractive on a small camera to people ?  Sure, on a $1500 DSLR with  a good 50mm lens there is something to be said for not having jpeg compression.  But I must be missing something - what does it get me with something like the SD940?

Raw has a little more detail, but every passing year, it gets harder to use because cameras do more processing internally before they save the jpeg.  It creates a bigger burden to replicate all that processing on your PC.  One thing I do like about Raw is its extended dynamic range, 10 or 12 bits vs. 8 with jpeg.  But the intelligent contrast feature works pretty well to do tone mapping of the raw image prior to saving as a jpeg and this reduces the need for Raw somewhat IMO.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: pixeldoc2000 on 07 / January / 2011, 20:15:25
Yes, that seems to be the problem with the battery display.  For some reason, the values in get_vbatt_min() and get_vbatt_max() are wrong.
AFAIK SD940 has a 3,6V or 3,7V battery. If battery is fully charged it will be around 4,1V.

Current Source:
Code: [Select]
long get_vbatt_min()
{
return 4550;     // 4550 = 4.5V
}

long get_vbatt_max()
{
return 5150;     // 5150= 5.1V
}
obviously does not fit if battery max voltage is 4,1V ;)

Try:
Code: [Select]
// Battery min. Voltage
long get_vbatt_min() {
    return 3200;    // ToDo: use real value, this is just a guess
}

// Battery max. Voltage
long get_vbatt_max() {
    return 4100;    // ToDo: use real value, this is just a guess
}
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: reyalp on 07 / January / 2011, 22:35:25
Also keep in mind you can override this in your settings, and if you do this, you won't see any subsequent changes from the code.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: pixeldoc2000 on 07 / January / 2011, 22:46:47
Also keep in mind you can override this in your settings, and if you do this, you won't see any subsequent changes from the code.
Yes, if code is changed one need to reset chdk settings or delete chdk config to see changes in chdk.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: Microfunguy on 08 / January / 2011, 05:16:43
But I must be missing something - what does it get me with something like the SD940?

In my opinion, you are not missing anything.
The early developers of CHDK became angry if you suggested such a thing and even tried banning discussion of the topic.

The one small advantage is that you can change white balance.
Title: Re: SD940 (IXUS120) porting thread - releasing to the trunk ?
Post by: waterwingz on 08 / January / 2011, 10:11:22
I know we are not quite there yet but I scrolled through "Adding new cameras, applying patches into trunk (with source code prepared)" http://chdk.setepontos.com/index.php?topic=650 (http://chdk.setepontos.com/index.php?topic=650).  Unless I missed it, there was not much there to explain the ground rules of the process - is there a wiki link or better thread to follow ?

I have a list of files that I change when I move my port to a newer trunk release (currently  ./include/camera.h, ./core/conf.c, ./core/kbd.c, ./makefile, ./makefile.inc )   I guess I need to generate a patch file that inserts #ifdef CAMERA_ixus120_SD940 into the appropriate place in each file ?

I'd also like to change the default setup so that CCHDK.CFG is tuned to the camera (OSD colors,  screen position etc).  What's the best way to do that ?
Title: Re: SD940 (IXUS120) porting thread - releasing to the trunk ?
Post by: Microfunguy on 08 / January / 2011, 10:41:36
I'd also like to change the default setup so that CCHDK.CFG is tuned to the camera (OSD colors,  screen position etc).  What's the best way to do that ?

In conf.c, function conf_init_defaults() can load specific values for each camera.

e.g.

#if defined (CAMERA_g11) || defined (CAMERA_sx200is)|| defined(CAMERA_s90)|| defined(CAMERA_s95)
    def_mode_state_pos.x=294;
    def_batt_icon_pos.x = 10;
#endif

David
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 08 / January / 2011, 11:25:48
In conf.c, function conf_init_defaults() can load specific values for each camera.

Just to be sure,  you are talking about the conf.c in the trunk1031/core directory ?  The stock trunk1031 file I have does not currently have any customizations in conf_init_defaults() although I obviously see how your example will work.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: dave1978 on 09 / January / 2011, 03:56:24
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: Microfunguy on 09 / January / 2011, 05:08:26
Just to be sure,  you are talking about the conf.c in the trunk1031/core directory ? 

Yes, but it seems the CHDK version does not have any customisation.

The example I quoted is from the SDM version.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 09 / January / 2011, 19:20:06
@waldo  -  Working on why PTP crashes,  I think I found that the stub_entry.s for set_control_event in both our versions is wrong.  Comparing to the S90,  its looks like your STUB(set_control_event, 0xff88a500) should be NHSTUB(set_control_event, 0xFF88A550)  Likewise,  the 103c needs NHSTUB(set_control_event, 0xff88a5ac) rather than 0xff88a55c.

Unfortunately,  that did not solve my problem with PTP hanging.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: Dzre on 10 / January / 2011, 10:00:19
Lua should be working in Beta 4, right? I tried with the script from this thread (http://chdk.setepontos.com/index.php?topic=2518.0) (first page), it shut down the camera (crash?). Is it too old script to work? I'm using the 103c version (camera firmware 103c, checked). Tried the romlog.lua too and it gave me this:
Code: [Select]
SystemEventInit failed
GetLogToFile return -1
A/ROMLOG.LOG not written
I'm REALLY new to this, so excuse me. Did I just mess up something or is it not working yet?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: reyalp on 10 / January / 2011, 12:10:42
Use the current version of the script, foun
Tried the romlog.lua too and it gave me this:
Code: [Select]
SystemEventInit failed
GetLogToFile return -1
A/ROMLOG.LOG not written
I'm REALLY new to this, so excuse me. Did I just mess up something or is it not working yet?
Use the latest version of the script, from a "full build" on the autobuild or http://tools.assembla.com/chdk/browser/trunk/CHDK/SCRIPTS/TEST/romlog.lua (http://tools.assembla.com/chdk/browser/trunk/CHDK/SCRIPTS/TEST/romlog.lua)

You also need a CHDK with native calls enabled, but you should have got a different error if you didn't have that.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: Dzre on 10 / January / 2011, 13:33:50
Use the latest version of the script, from a "full build" on the autobuild or http://tools.assembla.com/chdk/browser/trunk/CHDK/SCRIPTS/TEST/romlog.lua (http://tools.assembla.com/chdk/browser/trunk/CHDK/SCRIPTS/TEST/romlog.lua)
Alright, that worked, thanks.
I wonder why the zoom lua script crashes though. Should it work or is it incompatible with the current CHDK?
EDIT: I think the line that causes it is set_zoom(max_zoom), now I'm getting the feeling I'm asking this in the wrong place.
Same with set_zoom(0) but then it zooms out a tiny bit before crashing.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 10 / January / 2011, 14:11:56
Same with set_zoom(0) but then it zooms out a tiny bit before crashing.
The SD940 port has not had a lot of testing.  However,  see http://chdk.setepontos.com/index.php?topic=5855.msg59663#msg59663 (http://chdk.setepontos.com/index.php?topic=5855.msg59663#msg59663) up above - might be related.  I'll  upload a build with that change made tonight - let's see what happens ?

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: Dzre on 10 / January / 2011, 14:57:11
Yeah, I figured it probably isn't that stable yet, I just wasn't sure if my problem was with CHDK in general or this particular port.
Thanks for making this port happen! :)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 10 / January / 2011, 23:16:45
Yeah, I figured it probably isn't that stable yet, I just wasn't sure if my problem was with CHDK in general or this particular port.
Here's my latest build with the fix for set_control_event() mentioned earlier.
http://www.zshare.net/download/85042418e5f996a6/ (http://www.zshare.net/download/85042418e5f996a6/)
Does it help ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: Dzre on 11 / January / 2011, 07:57:16
The set_zoom(0) part of the script seems to be working but it still crashed when it tries set_zoom(max_zoom) so I did some tests.
Code: [Select]
max_zoom = get_zoom_steps() - 1get_zoom_steps() returns 11 so max_zoom is 10, but apparently the range that works is only 0-8 and anything above that will result in a crash. Set_zoom_speed() will crash too, though I'm not sure if that's even available in this camera(?).

So, yeah, I think that fixed it, unless you can make set_zoom_speed() somehow available.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 11 / January / 2011, 09:23:20
So, yeah, I think that fixed it, unless you can make set_zoom_speed() somehow available.

@ Drze : To clarify,  did things start working with the new version I sent you that did not work with the Beta4 release ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: Dzre on 11 / January / 2011, 09:57:10
To clarify,  did things start working with the new version I sent you that did not work with the Beta4 release ?

Yes, the set_zoom did not work at all and now works as long as you don't go out of range.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: waterwingz on 11 / January / 2011, 10:37:17
Yes, the set_zoom did not work at all and now works as long as you don't go out of range.

Checking stubs_entry_2.S,  there is a routine called SetZoomActuatorSpeedPercent() that right now points to a NULLSUB. Doesn't seems like that should make anything crash but I would understand if the zoom did not move as a result.

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 4 release]
Post by: FoggeR on 12 / January / 2011, 11:38:19
Anything new about 103b? =)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 13 / January / 2011, 00:04:02
Posted Beta 5 - primarily a correction to the NHSUB for set_control_event() - change enables zoom control to work and possibly other features.

source ->  http://www.zshare.net/download/85149111cd3e1d48/ (http://www.zshare.net/download/85149111cd3e1d48/)
1.02c -> http://www.zshare.net/download/851492023e5a84e1/ (http://www.zshare.net/download/851492023e5a84e1/)
1.03c -> http://www.zshare.net/download/8514924750cee9eb/ (http://www.zshare.net/download/8514924750cee9eb/)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 13 / January / 2011, 00:07:07
Anything new about 103b? =)
RoninTech was working on the 1.03B version but we have not heard anything in weeks here. 

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: RoninTech on 13 / January / 2011, 09:43:12
Weeks?  Wow, time flies...  :D  Yeah, here's my last post (http://chdk.setepontos.com/index.php?topic=5855.msg58809#msg58809).  From the reply I got the impression I was on the wrong track.  Unfortunately my window of lots of free time has closed now that the holidays are over and it's back to the grind.

Great progress on the other versions by the way!  Hopefully someone that knows how this should be done can get 103B taken care of.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 13 / January / 2011, 19:21:13
From the reply I got the impression I was on the wrong track.

Sorry - didn't mean to leave you with the impression you were on the wrong track.  I was trying to point out that perhaps the easiest way to port is to have the disassembly of your new camera open beside the disassembly of a "reference" camera port and use the reference port to figure out what code you are looking for in the new camera.

In your case,  using the 103c would be really close and relatively fast.  I could probably do it in a day - although it might be a long day.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 14 / January / 2011, 23:23:39
Hi.

OK. It's been a long time. I created a dump of 1.02c long, long ago for CHDK, with the intention to port - and fell off the face of the planet after that. Back now.

Had a play with the current (beta 5) port a few mins ago - and have found hang on load scenario under the 1.02c version. Had a good look to see if they were resource fork related issues on the SD card (from a Mac OS X host), but it wasn't the case. Tried applying with card-tricks, and same scenario. Crashes shortly after CHDK loading screen.

Do you have any debug flags or "got this far then core dumped" style utilities I could run, then send you outputs of?

Cheers.

z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waldo on 14 / January / 2011, 23:35:13
Hi.

OK. It's been a long time. I created a dump of 1.02c long, long ago for CHDK, with the intention to port - and fell off the face of the planet after that. Back now.

Had a play with the current (beta 5) port a few mins ago - and have found hang on load scenario under the 1.02c version. Had a good look to see if they were resource fork related issues on the SD card (from a Mac OS X host), but it wasn't the case. Tried applying with card-tricks, and same scenario. Crashes shortly after CHDK loading screen.

Do you have any debug flags or "got this far then core dumped" style utilities I could run, then send you outputs of?

Cheers.

z

I just tried the latest 102c version and it seems to boot fine for me.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 14 / January / 2011, 23:38:05
Wonder what I am doing wrong. There is no region dependency or model type dependency, is there?

I.e - I'm running PAL-E region GM1.02C fw, with an IXUS 120IS branded variant - not the _940.

?


z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: reyalp on 15 / January / 2011, 00:30:40
Wonder what I am doing wrong. There is no region dependency or model type dependency, is there?

I.e - I'm running PAL-E region GM1.02C fw, with an IXUS 120IS branded variant - not the _940.
This has not been observed in any of the other models CHDK has supported. I would say it is extremely unlikely.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 15 / January / 2011, 00:49:57
OK. Next step is to try an entirely different SD card. Currently attempting to use a fairly pricey SD-HC card. Will swap to a low density SD and see if it makes a difference...

z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 15 / January / 2011, 19:20:36
OK. Next step is to try an entirely different SD card. Currently attempting to use a fairly pricey SD-HC card. Will swap to a low density SD and see if it makes a difference...
I have to confess to only having ever used a spare el-cheapo 2G card I had laying around.  Have not tested to see if there are any partition issues with cards larger than 4G that I see in some of the other threads. Hopefully not.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: reyalp on 15 / January / 2011, 19:27:24
OK. Next step is to try an entirely different SD card. Currently attempting to use a fairly pricey SD-HC card. Will swap to a low density SD and see if it makes a difference...
I have to confess to only having ever used a spare el-cheapo 2G card I had laying around.  Have not tested to see if there are any partition issues with cards larger than 4G that I see in some of the other threads. Hopefully not.
If multipartition works, it shouldn't depend on card size.

Multipartition can be sensitive to the exact tools and partition settings used.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 15 / January / 2011, 19:57:07
If multipartition works, it shouldn't depend on card size.
That makes sense - I guess I could test multiparitions on a 2G or 4G cae okay. Still,  not short of other things to test so I'm thinking that as long as I didn't mess up the FAT32 stuff in boot.c it should be okay unless i hear otherwise.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 16 / January / 2011, 02:20:46
Hi guys.

So far, after a little help from waterwingz, I've managed to get 1.02C based code (beta5) booting. Some odd behaviour is apparent however.

With a (finally working) SD card (non HC), I turned RAW acquisition on through the ALT menu.

Took a couple of snaps. Things noticed:

1. It took a good 6 or 7 seconds with orange LED polling/processing to write out the image.

2. After the write out has complete, seemingly, camera is locked/hung and needs power cycle to be responsive again.

3. Every RAW acquired appears to be corrupt, so far.

Has anyone else bumped into this yet, or is this another "just me" thing?

Had a poke around:

Code: [Select]
int raw_savefile() {
    int ret = 0;  
    int fd, m=(mode_get()&MODE_SHOOTING_MASK);
    static struct utimbuf t;
    static int br_counter;

...

Seemed pretty spartan and lean, and started to wonder if it was related to the little processor in the IXUS 120 IS never really being geared to push ~18MB of captured CCD Data around that quickly, and this is more a function of the camera's hardware limitations than that of unoptimised code? That said - I don't know if the behaviour/core clock et al of the Digic IV processor in this unit is any different that of it's bigger DSLR brothers...

Cheers.

z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: reyalp on 16 / January / 2011, 02:51:39
1. It took a good 6 or 7 seconds with orange LED polling/processing to write out the image.
This seems a bit long for non-DNG. Are you using a decent, recently formatted SD card ?
Quote
2. After the write out has complete, seemingly, camera is locked/hung and needs power cycle to be responsive again.

3. Every RAW acquired appears to be corrupt, so far.
How have you determined that the raw is corrupt ? Most programs will NOT be able to open a CHDK raw from a new camera without modification. They are just a sensor dump, not the CRW format suggested by the extension. The correct way to determine if the raw is corrupt is to examine the data and see whether it contains the image you attempted to capture.

You can use rawconvert (in the tools directory) to convert it to something you can open in photoshop, gimp or irfanview.

See earlier posts in this thread: http://chdk.setepontos.com/index.php?topic=5855.msg59258#msg59258 (http://chdk.setepontos.com/index.php?topic=5855.msg59258#msg59258)

Quote
Seemed pretty spartan and lean, and started to wonder if it was related to the little processor in the IXUS 120 IS never really being geared to push ~18MB of captured CCD Data around that quickly, and this is more a function of the camera's hardware limitations than that of unoptimised code?
Unlikely. Users of other firmwares have reported obtaining valid images without crashing. This is not something that is likely to change between firmware versions.

There may be some time limit on how long CHDK can hold things up saving the raw though, which could be triggered by a slow SD card.

You should try to get a romlog: http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29 (http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 16 / January / 2011, 03:20:43
Hi.

Tried dcraw and Picasa 3 to open, as allegedly, Picasa 3 supports CHDK RAW now. Invalid image messages and things like this from dcraw:

Code: [Select]
bash-3.2# /Users/z/Downloads/usr/bin/dcraw -i -v CRW_1795.CRW
Cannot decode file CRW_1795.CRW

Suggested to me something wasn't right.

I'm eer'ing on the side of it's me, and not the firmware, nor the camera - and it's something obvious I'm missing. Trying raw-develop function from the camera too. Also going to hit up DNG mode...

I'll see if I can find yet another SD card, and go for a ROM log some time tonight!

Thanks guys!

z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: reyalp on 16 / January / 2011, 04:37:42
Tried dcraw and Picasa 3 to open, as allegedly, Picasa 3 supports CHDK RAW now. Invalid image messages and things like this from dcraw:
There is no such thing as supporting "CHDK raw", because "CHDK raw" is not a format, it's just a dump of the sensor data. Some programs (like dcraw and picasa) support raw files from some CHDK cameras. If the sensor layout is different, then any program will need new code or configuration to support it.

That said, if your camera is crashing in raw save, it wouldn't be surprising if the data were corrupt or incomplete.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waldo on 16 / January / 2011, 15:07:50
Also keep in mind that you should be able to generate a .DNG file and open that in something like IrfanView to check the image rather than using the Raw format.  That works for me in 102C.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 16 / January / 2011, 16:00:56
That works for me in 102C.
Do you still have a crashing problem with RAW - presumably after it saves a valid DNG image ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waldo on 16 / January / 2011, 17:25:57
That works for me in 102C.
Do you still have a crashing problem with RAW - presumably after it saves a valid DNG image ?

I just retested this with the latest version.  It turns out it DOES crash when doing Raw.  It used to work, so I assumed it still did.  Sorry for the confusion about that.

The older version from my own build still works OK with Raw.  Looking at it briefly, I see that the 103c code that fixed the overrides behavior for short shutter presses was not carried over to 102c.  I'll try changing that to see if it has an effect.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 17 / January / 2011, 00:08:41
...wonderful :). I wasn't simply going mad then.

Tried to gen a DNG, and found the badpixels LUA script didn't seem to execute correctly, and again, would lock the camera up...

z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 17 / January / 2011, 00:28:29
Tried to gen a DNG, and found the badpixels LUA script didn't seem to execute correctly, and again, would lock the camera up...

Check out http://chdk.setepontos.com/index.php?topic=5855.msg59258#msg59258 (http://chdk.setepontos.com/index.php?topic=5855.msg59258#msg59258) for how I got around the badpixels situation.  

I think I also saw some recent posts from reyalp that the LUA version is going away,  replaced by a  Basic script ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: reyalp on 17 / January / 2011, 01:17:49
I think I also saw some recent posts from reyalp that the LUA version is going away,  replaced by a  Basic script ?
No, it's built into the raw menu now. However, if the script failed, this is likely to fail as well.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: dvip on 17 / January / 2011, 10:43:21
@zebra,
Try deleting badpixel.bin manually, then create it from raw menu with "Create badpixel.bin".
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 17 / January / 2011, 18:05:30
OK.

Good news - I finally managed to capture a sensor data dump (I'm not calling it RAW anymore, thanks to you guys, as I now know the .extension "raw" isn't really all there is to this story!), and then subsequently open it in XnView.

I achieved this by formatting a 2GB card with lower cluster/sector size. Originally, had 4GB SD HC with 64k cluster size.

HOWEVER - this doesn't solve/fix the fact that the camera still hangs after every image is acquired in RAW.

Trying to get some logging going soon...

@ dvip: in the raw menu, I see no "Create badpixel.bin". Am I looking in the wrong place. Rough menu navigation went like this:

[alt] --> press MENU --> "Raw parameters". Selected "Save as RAW". There does appear to be plenty of DNG options in here, but nothing about "Create badpixel.bin". The only reference I could find to this was in LUA scripts.


z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: reyalp on 17 / January / 2011, 22:05:27
@ dvip: in the raw menu, I see no "Create badpixel.bin". Am I looking in the wrong place. Rough menu navigation went like this:
This is a very recent addition to the CHDK trunk. It's likely the build you are using is from sources without this.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 17 / January / 2011, 22:48:04
This is a very recent addition to the CHDK trunk. It's likely the build you are using is from sources without this.
Sounds like its time for a Beta6 release. 

@waldo - any progress on why RAW crashes in the 1.02c Beta5 release ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waldo on 19 / January / 2011, 15:31:43
@waterwingz,
With regard to the raw crashing on 102C, the address of SetFileTimeStamp should be 0xff835640.

Also, you should uncomment the "fixes overrides behavior at short shutter press" lines.  Overrides did not consistently work for me unless I did that.

You should also check if capt_seq_hook_set_nr is ever called.  I don't think it is.  I moved the call to another location where it gets called, but it still does not seem to work.  If we can't get that working, we should probably remove it from the code for now to avoid corrupting memory if nrflag is written to.

Also, did you get the zebra and edge overlay to work on 103c?  It has never drawn properly on 102c.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 19 / January / 2011, 20:05:59
With regard to the raw crashing on 102C, the address of SetFileTimeStamp should be 0xff835640.
Made the change for 1.02C.  It was already set to that address in the 1.03C.

Also, you should uncomment the "fixes overrides behavior at short shutter press" lines.  Overrides did not consistently work for me unless I did that.
Made the change for 1.02C.  It was already set to that way in the 1.03C.

You should also check if capt_seq_hook_set_nr is ever called.  I don't think it is.  I moved the call to another location where it gets called, but it still does not seem to work.  If we can't get that working, we should probably remove it from the code for now to avoid corrupting memory if nrflag is written to.
I guess I need to study what this is supposed to do.  Does the call to wait_until_remote_button_is_released() immediately before the call to capt_seq_hook_set_nr() suggest its only called when you are using a USB remote to trigger the shutter ?

Also, did you get the zebra and edge overlay to work on 103c?  It has never drawn properly on 102c.
Zebra and edge overlay work perfectly in the 1.03C.  I posted a couple of changes a while back :
http://chdk.setepontos.com/index.php?topic=5855.msg58941#msg58941 (http://chdk.setepontos.com/index.php?topic=5855.msg58941#msg58941)
and
http://chdk.setepontos.com/index.php?topic=5855.msg59146#msg59146 (http://chdk.setepontos.com/index.php?topic=5855.msg59146#msg59146)
but I think you already saw those ?

I'll update my trunk to the version 1050 and do a Beta6 release shortly.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 20 / January / 2011, 04:38:46
Concerning the 1.03C fw. I can't actually find a dump of said fw anyware - locally, or on the Canon IXUS sub page.

Does anyone actually have the 1.03C fw dumped, and can I flash my 1.02C unit to 1.03C reliably? Sort of surprised I cannot find an official Canon flasher.

I'm assuming units shipped with 1.02C have no hardware differentiators to the units shipped with 1.03C. This is a safe assumption?

Cheers.

z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: waterwingz on 20 / January / 2011, 07:25:30
Does anyone actually have the 1.03C fw dumped, and can I flash my 1.02C unit to 1.03C reliably?
I think it would be a safe guess that I have the 1.03C fw dumped :)

However,  as far as I can tell,  there is no way to flash the firmware on a Canon camera.  That seems to be the consensus on this forum as well.

Waldo's port of the 1.02C is pretty close to working as well as the 1.03C.  I'll update to a Beta6 release today, which should get RAW working on the 1.02C.


Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 20 / January / 2011, 07:59:03
Beta 6 now ready.  Updated to source tree version 1050 with version 1.02C patched for correct RAW operation.

http://www.zshare.net/download/85479062ffe6454f/ (http://www.zshare.net/download/85479062ffe6454f/)   SD940 1.02c Beta6

http://www.zshare.net/download/85479097d4f68177/ (http://www.zshare.net/download/85479097d4f68177/)  SD940 1.03c Beta6

http://www.zshare.net/download/8547912719543f2f/ (http://www.zshare.net/download/8547912719543f2f/)   SD940 trunk1050 Source Code Beta6

http://www.zshare.net/download/85479728d805f58d/ (http://www.zshare.net/download/85479728d805f58d/) firmware dump of version 1.03C

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: reyalp on 20 / January / 2011, 12:06:44
Does anyone actually have the 1.03C fw dumped, and can I flash my 1.02C unit to 1.03C reliably? Sort of surprised I cannot find an official Canon flasher.
Canon does not generally issue firmware updates, except for major, customer visible problems.

While it is theoretically possible, I'm not aware of anyone changing the canon firmware without a Canon update. Adding support for a new firmware version will take far less time, effort, and programming knowledge than successfully writing your own firmware flasher that can flash from a dump. Also a lot cheaper, given the high probability of bricking a few cameras along the way ;)
Quote
I'm assuming units shipped with 1.02C have no hardware differentiators to the units shipped with 1.03C. This is a safe assumption?
It's not a safe assumption. I'd say it's very likely the hardware is the same (or similar enough not to matter), but hardware changes in a production run aren't out of the question.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 5 release]
Post by: zebra on 20 / January / 2011, 15:30:52
Beta 6 now ready.  Updated to source tree version 1050 with version 1.02C patched for correct RAW operation.

http://www.zshare.net/download/85479062ffe6454f/ (http://www.zshare.net/download/85479062ffe6454f/)   SD940 1.02c Beta6

http://www.zshare.net/download/85479097d4f68177/ (http://www.zshare.net/download/85479097d4f68177/)  SD940 1.03c Beta6

http://www.zshare.net/download/8547912719543f2f/ (http://www.zshare.net/download/8547912719543f2f/)   SD940 trunk1050 Source Code Beta6

http://www.zshare.net/download/85479728d805f58d/ (http://www.zshare.net/download/85479728d805f58d/) firmware dump of version 1.03C



Coming together nicely :). 1 to 2 second pauses for sensor data acquisition, and no crash/hang afterwards! Additionally, as explained, the badpixels script now features in the RAW menu and works flawlessly.

Wonderful work there.

What needs to be dealt with next?

z
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 21 / January / 2011, 04:10:21
What needs to be dealt with next?

Things I'd like to see tested :

1) USB remote - I need to build something to test this so I don't know if it works yet.
2) ND filter (neutral density filter) apparently moves in and out of light path to control exposure range as SD940 has no iris control.  Does this work yet ?
3) PTP - crashed with the Beta 5 version of the 1.03C when trying to browse folders on the camera from a computer via USB cable.  Is it working now ?  I rather fancy getting this working as I move off CHDK porting work and into LUA / BASIC scripts.
4) Calibration - I stole values in camera.h  from other ports and have not checked any of them - shutter speeds, color balance, whatever else you need to setup for an individual camera.

That's a start I think ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: Dzre on 21 / January / 2011, 09:05:52
2) ND filter (neutral density filter) apparently moves in and out of light path to control exposure range as SD940 has no iris control.  Does this work yet ?

I've used the ND filter in 1.03C Beta 3 through Beta 5. At least it worked in those.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 21 / January / 2011, 10:14:27
I've used the ND filter in 1.03C Beta 3 through Beta 5. At least it worked in those.

Excellent!! This project goes so much faster when we have multiple people working on it.  ND should still be good to go then as nothing has changed that would affect it.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: reyalp on 24 / January / 2011, 23:58:28
1) USB remote - I need to build something to test this so I don't know if it works yet.
You can do minimal testing by plugging and unplugging into a PC with remote enabled ;)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 25 / January / 2011, 06:11:25
You can do minimal testing by plugging and unplugging into a PC with remote enabled ;)
Interesting.  I tried that with Remote Enabled.  When I connect the USB cable it does the equivalent of a "half press".  Is that normal and if so is there an easy way to make it complete the process ?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: fe50 on 25 / January / 2011, 06:23:12
When I connect the USB cable it does the equivalent of a "half press".  Is that normal and if so is there an easy way to make it complete the process ?
--> http://chdk.wikia.com/wiki/CHDK_User_Manual#Remote_Parameters (http://chdk.wikia.com/wiki/CHDK_User_Manual#Remote_Parameters)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 25 / January / 2011, 07:05:31
--> http://chdk.wikia.com/wiki/CHDK_User_Manual#Remote_Parameters (http://chdk.wikia.com/wiki/CHDK_User_Manual#Remote_Parameters)
Thanks - that explains how to use the remote in "non-scripted mode".  I was trying to work with this :

http://chdk.wikia.com/wiki/USB_Remote_Cable (http://chdk.wikia.com/wiki/USB_Remote_Cable)   <-- also a good writeup.

So by plugging the USB cable in and out twice I can get the shutter to fire in non-scripted mode if I get the timing right.  Good enough for me - I'm going to declare the remote feature working on this port.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: Babel on 30 / January / 2011, 18:02:21
hi guys,

at first i really want to thank you for all the effort! i only bought the ixus120 because i read in this forum that there is a port for this camera - even if it is in beta-status, i like hacking something until it works ;)

i works fine with my ixus120 and firmware 103c. its really a nice thing. i just had a problem starting it via "firmware update" but now it works with the autostart readonly card modus, which is fine.

i would like to use my cam for timelapse movies so i need delay-shooting. i tried the "7upLight.bas" script and it works well until the script wants to power down the display. i think the script crashed at this action.

maybe its "set_backlight 0" ?

so thats one issue i "found" and the battery-display always says "0%"... but i think that was mentioned earlier.

so thanks a lot!
greets from germany,

kim
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 30 / January / 2011, 21:31:38
I just had a problem starting it via "firmware update" but now it works with the autostart readonly card modus, which is fine.

You need a ps.fi2 file built for your specific release to use the firmware update method.  These are typically not included - search this forum for more details.

i would like to use my cam for timelapse movies so i need delay-shooting. i tried the "7upLight.bas" script and it works well until the script wants to power down the display. i think the script crashed at this action.

Can't find that script on the forum or wiki.  I find that its a major problem trying to find scripts here - lots out there but hard to search. Please post a link or cut&paste it into a code box here ?

so thats one issue i "found" and the battery-display always says "0%"... but i think that was mentioned earlier.

Works for me but for some reason you might have to reset the limits in the OSD -> Battery menu.   Set the Max voltage to 4500 and the MIN voltage to 3000 and see what that does ?

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: Babel on 31 / January / 2011, 04:21:49
Hi,
Quote
You need a ps.fi2 file built for your specific release to use the firmware update method.  These are typically not included - search this forum for more details.
Ok thanks but i think its more comfortable with the autostart-mode!

Quote
Can't find that script on the forum or wiki.  I find that its a major problem trying to find scripts here - lots out there but hard to search. Please post a link or cut&paste it into a code box here ?
i found the script in a german beta-release of the ixus100. i also attached the script to this post. or do you have a "timelapse"-script which works with power down the display?
http://downloads.chdk-treff.de/autobuild/ixus100_sd780-100c-1.1.0-full_BETA_rev_564.zip (http://downloads.chdk-treff.de/autobuild/ixus100_sd780-100c-1.1.0-full_BETA_rev_564.zip)

Quote
Works for me but for some reason you might have to reset the limits in the OSD -> Battery menu.   Set the Max voltage to 4500 and the MIN voltage to 3000 and see what that does ?
Ok thanks, will try it out when i'm home!

kim
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: Babel on 01 / February / 2011, 17:56:08
me again.

the "7upLight" script works fine and also powering off the lcd display works now. the "7upLight" script uses the optical finder from the camera by default, the ixus120 doesn't have one so i had to deactivate this feature. that caused the error and was the problem, sorry for the confusion.

so i have to power on the lcd display every time I take a picture. i think i can live with that!

your tip, resetting the limits in the OSD -> Battery menu, works fine for me! thx for that too ;)

:)

kim
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: bugmenot on 04 / February / 2011, 10:34:16
Is there any hope for 102c catching up with the progress of 103c any time soon?
(Or maybe a tutorial on how to help porting it to 102c? CS student here.)
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 04 / February / 2011, 11:14:49
Is there any hope for 102c catching up with the progress of 103c any time soon?
(Or maybe a tutorial on how to help porting it to 102c? CS student here.)
As far as I know,  the 102c is current with the 103c.  Download available here http://chdk.setepontos.com/index.php?topic=5855 (http://chdk.setepontos.com/index.php?topic=5855)

There might still be a small offset problem with some of the display modes - I have not seen anything from waldo about that in a while.

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: bugmenot on 04 / February / 2011, 11:40:47
As far as I know,  the 102c is current with the 103c.  Download available here http://chdk.setepontos.com/index.php?topic=5855 (http://chdk.setepontos.com/index.php?topic=5855)
There might still be a small offset problem with some of the display modes - I have not seen anything from waldo about that in a while.



Are you sure about this? The Beta Testing Status Page as referenced in the first thread post does not reflect a match up. Quite the opposite. The column for 102c is pretty much empty (=>"no") while 103c is almost entirely filled with "yes". Or am I mistaken?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 04 / February / 2011, 14:26:18
Are you sure about this? The Beta Testing Status Page as referenced in the first thread post does not reflect a match up. Quite the opposite. The column for 102c is pretty much empty (=>"no") while 103c is almost entirely filled with "yes". Or am I mistaken?
I see the confusion now.  

Some time ago I added the Beta Testing Status page to track what works and doesn't work. What mostly doesn't work is the Beta Testing Status page itself - nobody seems really interested in keeping it up to date (unfortunately including me).  I guess I should probably delete it.

Meanwhile,  in answer to your question,  yes, I'm sure the 102c and 103c version are pretty much in the same state.

EDIT :  @bugemenot - if you have a 102c - how about loading up Beta 6, testing and updating the Beta Testing Status page for that firmware ?

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: bugmenot on 04 / February / 2011, 15:08:49
I see the confusion now. 

Some time ago I added the Beta Testing Status page to track what works and doesn't work. What mostly doesn't work is the Beta Testing Status page itself - nobody seems really interested in keeping it up to date (unfortunately including me).  I guess I should probably delete it.

Meanwhile,  in answer to your question,  yes, I'm sure the 102c and 103c version are pretty much in the same state.

EDIT :  @bugemenot - if you have a 102c - how about loading up Beta 6, testing and updating the Beta Testing Status page for that firmware ?
That clears up things. Thanks :P

Oh and yes I will try installing and testing for 102c. *fingers crossed*
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: Microfunguy on 04 / February / 2011, 16:50:08
Could you upload both firmwares again, the zshare links have expired ?

Thanks.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 6 release]
Post by: waterwingz on 04 / February / 2011, 19:51:48
Could you upload both firmwares again, the zshare links have expired ?

ixus120sd940roms.zip - 7.16MB (http://www.zshare.net/download/86137167a28f6cf6/)

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: waterwingz on 06 / February / 2011, 15:18:24
Beta 7  now ready based on latest source tree 1054.  Code cleaned up for eventual inclusion in main trunk. PTP now working for sending and receiving files.  Stub for set_control_event() changed in both fw version to match SX30 address - looks like a better match but switch_mode_usb() still not working.

Source :  trunk1054-SD940Beta7-06Feb2011.zip - 2.39MB (http://www.zshare.net/download/862163165ffab378/)
1.02c : sd940-102c-Beta7-06Feb2011.zip - 0.54MB (http://www.zshare.net/download/862163552ce66f0c/)
1.03c : sd940-103c-Beta7-06Feb2011.zip - 0.54MB (http://www.zshare.net/download/8621639143c979e1/)
SVN Patch File for Trunk 1054 : ixus120_sd940_for_trunk_1054.patch - 0.20MB (http://www.zshare.net/download/86216428157cb239/)


Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: evosonic on 09 / February / 2011, 15:31:57
I have bought a IXUS 120 this week because of your great work on porting chdk to this camera. Of course I was praying for a 1.03c firmware.
Turned out to be a 1.03b... which seems like a worst case scenario to me.
Since I haven't a clue how to port or even analyse firmware, I'm wondering if I should sell the camera.

Will it be difficult to make chdk available for 1.03b? I've read that RoninTech tried to do it, but unfortunately he's to busy now to continue.

Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: waterwingz on 09 / February / 2011, 18:37:54
Turned out to be a 1.03b... which seems like a worst case scenario to me.

I don't think I'd call it a worst case scenario - there is quite a bit of interest in a 1.03b port.  I haven't heard of anybody with a 1.03a or 1.02a - that would be a worst case scenerio if you bought one of those.  There is also a 1.01a version dumped but I have not seen anything on that recently.

Since I haven't a clue how to port or even analyse firmware, I'm wondering if I should sell the camera.

Will it be difficult to make chdk available for 1.03b? I've read that RoninTech tried to do it, but unfortunately he's to busy now to continue.

Well, the good news is that I'm working with another rookie developer who has started on the 1.03b for his camera.  Should be a lot faster for him than it was for me as he's working from an existing port and getting coaching and encouragement from me.   If he gets stuck and I get the time I'll probably do some of the port too.

So no guarantees but I would not sell that camera just yet ?



Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: elnigno on 10 / February / 2011, 13:35:40
Hi there, I own a SD940 with 1.03b firmware and would like to contribute to the port. I need some guiding/mentoring though, can anyone help?
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: evosonic on 10 / February / 2011, 15:03:14

Well, the good news is that I'm working with another rookie developer who has started on the 1.03b for his camera.  Should be a lot faster for him than it was for me as he's working from an existing port and getting coaching and encouragement from me.   If he gets stuck and I get the time I'll probably do some of the port too.

So no guarantees but I would not sell that camera just yet ?


Thank you for that reply and all your effort you put into porting chdk.
I would also like to contribute, if I can. So if there is any need for testing or anything else, I'm happy to help.
Yesterday I've even tried the file for 1.03c and 1.02c because I was so curious.  :)
At least the AF light turned on.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: waterwingz on 10 / February / 2011, 15:54:10
Hi there, I own a SD940 with 1.03b firmware and would like to contribute to the port. I need some guiding/mentoring though, can anyone help?
Take a look at these pages :
http://chdk.wikia.com/wiki/For_Developers (http://chdk.wikia.com/wiki/For_Developers)
http://chdk.wikia.com/wiki/Adding_support_for_a_new_camera (http://chdk.wikia.com/wiki/Adding_support_for_a_new_camera)
http://chdk.wikia.com/wiki/Adding_support_of_a_new_firmware_version (http://chdk.wikia.com/wiki/Adding_support_of_a_new_firmware_version)
Do you feel you can take something like that on or would a testing roll for someone else's port be more suitable ?


Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: waterwingz on 10 / February / 2011, 16:01:47
Yesterday I've even tried the file for 1.03c and 1.02c because I was so curious.  :)
At least the AF light turned on.

With the Beta versions of CHDK for the SD940,  the AF light gets turned on in the boot loader, which is the first thing that runs when CHDK starts.  I stuck that in there early in the porting process just so I could tell that I had loaded the image correctly each time that I made a code change.  The bootloader code is common to all ports of the same camera model.   The flash of the AF lamp is not a standard feature in other CHDK ports although its common to all the CHDK versions for the SD940. 

This is good new - it means you have successfully loaded CHDK code to your SD card and have made it boot.  That's a big step for most people.
Title: Re: SD940 (IXUS120) porting thread [now available in Beta 7 release]
Post by: msl on 11 / February / 2011, 11:03:34
@waterwingz

We have your ixus120 versions integrated into CHDK-DE based on this patch file (http://chdk.setepontos.com/index.php?topic=650.msg60921#msg60921). Thanks for your great job.

http://my-trac.assembla.com/chdkde/changeset/565/trunk (http://my-trac.assembla.com/chdkde/changeset/565/trunk)

Binaries are available here (http://forum.chdk-treff.de/download.php). In this version the default menu language is German. Simply delete the language file german.lng in CHDK/LANG and the menu is in English.
Title: Re: SD940 (IXUS120) porting thread [Beta 7 release and in the CHDK-DE main trunk]
Post by: waterwingz on 11 / February / 2011, 22:28:21
We have your ixus120 versions integrated into CHDK-DE based on this patch file (http://chdk.setepontos.com/index.php?topic=650.msg60921#msg60921). Thanks for your great job.
Thanks - feels really good to see this.  It has been a long learning curve and way more work than I ever expected over last 5 months.  But its been a lot of fun too.  Still more to do but I'm happy that it will bring most of CHDK to IXUS120 SD940 owners as is.
Title: Re: SD940 (IXUS120) porting thread [Beta 7 release and in the CHDK-DE main trunk]
Post by: reyalp on 13 / February / 2011, 19:07:26
Added in the trunk, great job waterwings. Sorry for the delay getting to this, 12+ hour days in the day job don't leave much time for CHDK...

A few comments:
CAM_HAS_VIDEO_BUTTON is defined in camera.h. Does this camera actually have a distinct video button to start recording video, separate from the shutter button ? On some cameras the DP button can be programmed for this, but these generally don't get CAM_HAS_VIDEO_BUTTON, and it looks like sd940 doesn't have a DP button anyway.

CAM_HAS_JOGDIAL is undefined (which looks correct from the pictures), but some jogdial functions are present in plaform/.../lib.c
I've removed them.

draw_filled_rect in lib.c is probably a bad thing.

vid_get_viewport_live_fb not being implemented means MD will be slow.

In the modemap:
   { MODE_VIDEO_STD,          2603   }, // video standby
   { MODE_VIDEO_STD,          3622   }, // video in progress

Usually MODE_VIDEO_STD is when the mode is selected, not recording in progress. How recording in progress is handled isn't well defined and actually needs some reworking in CHDK in general :[

I added a few things to notes.txt, please check if they are correct.
Title: Re: SD940 (IXUS120) porting thread [Beta 7 release and in the CHDK-DE main trunk]
Post by: waterwingz on 13 / February / 2011, 20:16:30
Added in the trunk, great job waterwings. Sorry for the delay getting to this, 12+ hour days in the day job don't leave much time for CHDK...
Thanks reyalp.  I wasn't in any hurry - the SD940 doesn't exactly have a huge user base and I would expect that most of those have probably found the porting thread on the forum. Still, nice to see it move into a "release" state.  Like everything else in CHDK, getting a release accepetd has been a lot of reading forums, trying things and seeing what works.

CAM_HAS_VIDEO_BUTTON is defined in camera.h. Does this camera actually have a distinct video button to start recording video, separate from the shutter button ? On some cameras the DP button can be programmed for this, but these generally don't get CAM_HAS_VIDEO_BUTTON, and it looks like sd940 doesn't have a DP button anyway.

CAM_HAS_JOGDIAL is undefined (which looks correct from the pictures), but some jogdial functions are present in plaform/.../lib.c I've removed them.
As you noticed, no video button or jog dial - this is a really small camera.  The code is hang-overs from my early attempts at a port where I started with the SD980 Beta source.  Thanks for the clean-up.

draw_filled_rect in lib.c is probably a bad thing.
I agree but its the best I've been able to do and it seems to work pretty well.  Posted about it at http://chdk.setepontos.com/index.php?topic=5857.msg57276#msg57276 (http://chdk.setepontos.com/index.php?topic=5857.msg57276#msg57276).  Since then I've tried to improve it by looking at many other camera dumps - most recently for the SD4000 and S90 - and while I can match the stubs, I can't get their version of draw_filled rect() to work.  Curiously, Waldo ended up with a very similiar hack for his original port of the SD940 1.02c too.  I'm open to suggestions here.

vid_get_viewport_live_fb not being implemented means MD will be slow.
I'll add that to my "to do" list - really looking forward to lightening pictures this summer.

In the modemap:
   { MODE_VIDEO_STD,          2603   }, // video standby
   { MODE_VIDEO_STD,          3622   }, // video in progress

Usually MODE_VIDEO_STD is when the mode is selected, not recording in progress. How recording in progress is handled isn't well defined and actually needs some reworking in CHDK in general :[
Completely untested I confess - another c&p from the SD980.  I've not been too interested in video in general.

I added a few things to notes.txt, please check if they are correct.
Notes.txt looks correct - thanks again.  Did not understand the comment about fast MD not being implemented but your note about vid_get_viewport_live_fb explains that now.


Note to patient SD940 owners with 1.03B firmware : I've started work on the 1.03b version of the firmware.  Working with another new forum member - he's looking at the stub_entry_2.S stuff and I've started converting the C files in the sub directory.



Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / February / 2011, 21:13:41
Well, the first patch for the autobuild release did not take long - its the fixes for PTP that we worked out today :
http://chdk.setepontos.com/index.php?topic=4338.msg61420#msg61420 (http://chdk.setepontos.com/index.php?topic=4338.msg61420#msg61420).
Changes to stub_entry_2.S for set_control_event().

ixus120sd940-patch1058.patch - 0.00MB (http://www.zshare.net/download/86524530a45ec4c9/)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 13 / February / 2011, 23:06:32
Added, thanks.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Daveid on 14 / February / 2011, 04:54:30
Hi,

New to CHDK development, just picked up one of these off eBay pretty cheap. Only problem is, seems like I lucked out too, Firmware 1.03B.

I would gladly like to assist in development in anyway that I can, but I wondered..

How impossible would it be to flash my 1.03B to 1.03C. I couldn't find if this was asked before, but I'm genuinely curious. I mean, I'm sure it's possible, but not as straight forward as putting CHDK on an SD card.

In any case, I'd be totally down to flash my camera to 1.03C, if that is at all possible.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / February / 2011, 07:40:33
How impossible would it be to flash my 1.03B to 1.03C. I couldn't find if this was asked before, but I'm genuinely curious. I mean, I'm sure it's possible, but not as straight forward as putting CHDK on an SD card.
The general consensus on this forum is that its not possible to update firmware on Canon cameras.  Or, at least, Canon does not make firmware updates available, you can't just move a firmware dump from one camera to another and nobody has been willing to risk "bricking" their camera experimenting with a CHDK version that does it.

I would gladly like to assist in development in anyway that I can, but I wondered..
Even done any assembler programming?  I have some fairly straight forward code conversion projects that need doing - take the 1.03C code, find the equivalent code in a 1.03b dump and create the 1.03b version of the file.  I'll get to it eventually but additional experienced hands would be better.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Daveid on 14 / February / 2011, 08:18:42
The general consensus on this forum is that its not possible to update firmware on Canon cameras.

That's interesting, as with Canon's DSLR line you can update firmware just fine. Simply copying the .fir file to the SD card gets the job done. I wonder if it's possible to add this functionality within CHDK, by examining the firmware dump of a DSLR.

Even done any assembler programming?

Sadly, I have not. I'm actually deciding on whether or not I should begin learning it, as the only programming language I've ever dabbled in is Java.

What I meant originally by my statement was that I'd gladly test/debug any builds of CHDK. I am never satisfied with a stable release, so I frequently subscribe to dev channels to get nightly builds and such.

In any case, while no-one wants to brick anything they own, I've been fairly lucky in the past and wouldn't mind doing things considered dangerous/risky. Like I mentioned earlier, I did snag this camera fairly cheap, so I wouldn't be bothered too much if I were to somehow turn this into a paperweight. I just really had my eyes set on CHDK when I bought the camera, and that's what I attend to do with it.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 14 / February / 2011, 12:57:50
The general consensus on this forum is that its not possible to update firmware on Canon cameras.

That's interesting, as with Canon's DSLR line you can update firmware just fine. Simply copying the .fir file to the SD card gets the job done. I wonder if it's possible to add this functionality within CHDK, by examining the firmware dump of a DSLR.
There is a misunderstanding. It is certainly possible to update Canon P&S cameras, Canon simply doesn't release firmware updates for them most of the time.

Updating without a Canon update (using a firmware dump from another version) is possible in theory, but in practice has never been done (that we know of) and has a very high likelihood of destroying the camera, or at least degrading it's performance due to incorrect camera specific calibration. In any case creating a CHDK port for a new Canon version would be far easier and safer than attempting this.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / February / 2011, 21:36:51
vid_get_viewport_live_fb not being implemented means MD will be slow.

@reyalp :  any suggestions for DIGIC IV cameras that have this implemented well?  I've looked at the G12 and S90 code and its either not implemented or too different than anything I can find in the SD940 code.

TIA
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 14 / February / 2011, 21:39:44
vid_get_viewport_live_fb not being implemented means MD will be slow.

@reyalp :  any suggestions for DIGIC IV cameras that have this implemented well?  I've looked at the G12 and S90 code and its either not implemented or too different than anything I can find in the SD940 code.

TIA

I know D10 is correct, but it's quite a bit older so I don't know how much help it will be.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 15 / February / 2011, 16:54:56
hi guys, i m form italy, i ve bought this canon ixus 120 in first 2010.
do anyone knows if anybody is working on firmware 1.01a ? unfortunally i have this rare firmware, and i suck in coding  :) i ve noticed that there is still a dum for this firmware on the site, if i can do anything elese to help let me know

see ya
gesualdo
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 15 / February / 2011, 23:10:58
do anyone knows if anybody is working on firmware 1.01a ?
I don't believe anyone is currently working on this version.  However, now that we have releases for two firmware versions and a third on the way, the process is much easier than back when your camera was released and no port existed.  Maybe other owners of cameras with firmware 1.01a will come forward to help product a port.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 16 / February / 2011, 07:51:57
i hope so
:)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 17 / February / 2011, 16:12:30
I know D10 is correct, but it's quite a bit older so I don't know how much help it will be.

@reyalp :  Found some good code matches for the SD940 in the SD780 and SD980 ports so I now have a version of vid_get_viewport_live_fb() that build and seems to run. 

Any suggestions of how to test and validate that its working for fast MD ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 17 / February / 2011, 16:25:58
I know D10 is correct, but it's quite a bit older so I don't know how much help it will be.

@reyalp :  Found some good code matches for the SD940 in the SD780 and SD980 ports so I now have a version of vid_get_viewport_live_fb() that build and seems to run. 

Any suggestions of how to test and validate that its working for fast MD ?
Watching the value with misc debug values should show addresses that look like framebuffer addresses, alternating. If the are, and the logic is the same as known working cameras, that may be good enough.

There are some MD test tools floating around as well: http://chdk.wikia.com/wiki/Software (http://chdk.wikia.com/wiki/Software)

Making an built in MD test that triggers itself using  the AF LED and times the response is on my TODO list, but it might be a while ;)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Microfunguy on 17 / February / 2011, 16:27:13
I now have a version of vid_get_viewport_live_fb() that build and seems to run. 

So, with other builds such as the IXUS105, what exactly are we looking for ?

Any distinctive text strings or unusual assembler code ?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 17 / February / 2011, 16:38:23
I now have a version of vid_get_viewport_live_fb() that build and seems to run. 

So, with other builds such as the IXUS105, what exactly are we looking for ?

Any distinctive text strings or unusual assembler code ?
In my ports, I try to put some clues / reminders of how I found in the comments.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 17 / February / 2011, 18:19:05
There are some MD test tools floating around as well: http://chdk.wikia.com/wiki/Software (http://chdk.wikia.com/wiki/Software)
First pass testing with the web based tool gives me 180 - 200 mSec response times.  I loaded the previous version of the port (without my new vid_get_viewport_live_fb() code) and I also get 180-200 mSec response.

Any idea how fast vid_get_viewport_live_fb() should be ?  Or how slow things are supposed to be without it ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: fe50 on 18 / February / 2011, 01:08:06
Any idea how fast vid_get_viewport_live_fb() should be ?
IMO you should get something around 80-120ms when working with two raw buffer addresses (SD870 sample (http://tools.assembla.com/chdk/browser/trunk/platform/ixus860_sd870/sub/100c/lib.c#L23)), most cameras are in this range (e.g. my SD400, SD870 & SX10). Using only one buffer address slows done MD speed...

See also reyalP's changelog for the D10 (http://tools.assembla.com/chdk/changeset/982)...

The camera's settings may also influence the response time; use M mode, continuos AF off, face detection etc. off, fix ISO...
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 19 / February / 2011, 20:16:17
IMO you should get something around 80-120ms when working with two raw buffer addresses
If I read the code from the SD870 and D10 correctly, there are three possible buffer address returned by *vid_get_viewport_live_fb() - not two ?

Also, in my port vid_get_viewport_fb() returns the same address as vid_get_viewport_live_fb()'s first buffer. Does that seem right ?

EDIT :  I guess what I should have asked for is a link or short explanation of the different buffers that CHDK hooks into ??

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 19 / February / 2011, 22:35:39
IMO you should get something around 80-120ms when working with two raw buffer addresses
If I read the code from the SD870 and D10 correctly, there are three possible buffer address returned by *vid_get_viewport_live_fb() - not two ?
Yes.
Quote
Also, in my port vid_get_viewport_fb() returns the same address as vid_get_viewport_live_fb()'s first buffer. Does that seem right ?
Yes, one of the buffers should be the same.
Quote
EDIT :  I guess what I should have asked for is a link or short explanation of the different buffers that CHDK hooks into ??
I don't think such a thing exists. It would be good to have.

edit:
I actually started writing a page about frame buffers a long time ago. I've posted my work-in-progress here: http://chdk.wikia.com/wiki/Frame_buffers (http://chdk.wikia.com/wiki/Frame_buffers)
Don't think it will help you, but maybe someone wants to add too it ;)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 20 / February / 2011, 09:28:26
Yes, one of the buffers should be the same.
Thanks - I think I've got vid_get_viewport_live_fb() solved then.  I'll update the two firmware beta files on this thread and submit a patch file for the trunk.

I actually started writing a page about frame buffers a long time ago. I've posted my work-in-progress here: http://chdk.wikia.com/wiki/Frame_buffers (http://chdk.wikia.com/wiki/Frame_buffers)
Don't think it will help you, but maybe someone wants to add too it ;)
Thanks ! That was actually helpful - even in its current state. Did you link it to the "For Developers" wiki page ?


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 20 / February / 2011, 09:46:54
Any distinctive text strings or unusual assembler code ?
I looked at four different DigicIV cameras and was able to convince myself that I had found the same routine in all four - but they were all different code (register usage, additional subroutines in places) so it was just reading the general flow.  One of the two necessary variables (pointer to the viewport base address?)  is used in four places while other (the index value) shows up 65 times in the code.  Not much help I'm afraid.

In my ports, I try to put some clues / reminders of how I found in the comments.
I've started documenting the ROM address (for stubs_min.S and lib.c) where I've found things in the dump for my camera.  At least that way somebody can compare my camera's code to their camera to try and find something similar in their camera.



Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 20 / February / 2011, 11:03:04
Patch file to integrate vid_get_viewport_live_fb() fix into trunk 1066 attached here.

Edit :  Also finally fixed up RefreshPhysicalScreen() , removing the hacked version we have been using for the last 8 months.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 25 / February / 2011, 06:54:37
CHDK Porting for the IXUS120-SD940 Update

@1.03C owners :
Main trunk has the latest updates as of today!

@1.02C owners :
I've been doing my best to update the 1.02C version at the same time as changes made in the 1.03C version.  I can test the 1.03C version myself and I'm really really careful translating the changes to the 1.02c version.  But would somebody please confirm that the latest 1.02C version works ?  Especially :

1) do the <ALT> mode menus draw correctly when you change from a long menu to a shorter menu ?
2) do the Motion Detection (MD) scripts work ?

1.03B owners :
Still working on that.  Its moving ahead - you are not forgotten.

1.01a owners :
So far one person has expressed interest.  Anybody else out there?  And can you help with the porting?

Thanks to all for your patience.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: evosonic on 26 / February / 2011, 09:47:03
CHDK Porting for the IXUS120-SD940 Update

1.03B owners :
Still working on that.  Its moving ahead - you are not forgotten.


Optimism up!... Thank you!  :)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: mir on 03 / March / 2011, 07:56:10
Hey!
Many thanks to you and the chdk community for this great work!

I have an ixus 120 IS, version 1.02c. Up to now, everything works fine. :) If I can help, I test some functions and give feedback.

I think a little problem is the new directory naming strategy for the jpg files. (e.g. when I use raw_merge_end in a script, a directory "100CANON" is created, which is the old name.)

1) do the <ALT> mode menus draw correctly when you change from a long menu to a shorter menu ?
This works for me.
When I'm in record mode, the menu sometimes gets invisible. I think this is normal, isn't it?

2) do the Motion Detection (MD) scripts work ?
Sometimes it takes a picture, sometimes not. I'll test it later in detail...

Thanks again and regards
Title: Re: SD940 (IXUS120) alpha version for firmware 1.03B now available
Post by: waterwingz on 03 / March / 2011, 11:07:52
Early Alpha release of 1.03B firmware by Rulen  (http://chdk.setepontos.com/index.php?action=profile;u=15772).   Logo displays and menus work.  Other features not enabled just yet.

ixus120_sd940-103b-0.9.9-1067-full.zip - 0.51MB (http://www.zshare.net/download/87333005e9c140a9/)

EDIT :  link deleted as Beta version is now available
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: fe50 on 05 / March / 2011, 04:24:39
Early Alpha release of 1.03B firmware.   Logo displays and menus work.  Other features not enabled just yet.
ixus120_sd940-103b-0.9.9-1067-full.zip - 0.51MB (http://www.zshare.net/download/87333005e9c140a9/)

Mirror dl location: http://www.box.net/shared/208h7icjry (http://www.box.net/shared/208h7icjry)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 05 / March / 2011, 09:43:52
Mirror dl location: http://www.box.net/shared/208h7icjry (http://www.box.net/shared/208h7icjry)
I guess I should switch to box.net - no annoying pause before downloading.

Can you somehow flag this file as Alpha so that somebody does not find it somewhere down the road and wonder why it does not work ?  Would have changed the filename myself if I'd thought somebody would be good enough to mirror it for us.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: evosonic on 05 / March / 2011, 10:49:51
Early Alpha release of 1.03B firmware by Rulen  (http://chdk.setepontos.com/index.php?action=profile;u=15772).   Logo displays and menus work.  Other features not enabled just yet.

ixus120_sd940-103b-0.9.9-1067-full.zip - 0.51MB (http://www.zshare.net/download/87333005e9c140a9/)

I've justed tested this one. Works great.
Title: Re: SD940 (IXUS120) porting thread [1.03B Beta Release Announcement]
Post by: waterwingz on 13 / March / 2011, 14:53:27
First beta release of 1.03B firmware by Rulen  (http://chdk.setepontos.com/index.php?action=profile;u=15772).   All functions now implemented - testing and feedback needed.

zShare :
ixus120_sd940-103b-0.9.9-1067-full.zip - 0.51MB (http://www.zshare.net/download/877450297c33a752/)

Box.net :
ixus120_sd940-103b-0.9.9-1067-full.zip - 0.51MB (http://www.box.net/shared/1yh6n93ant/)


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: evosonic on 13 / March / 2011, 17:00:23
First beta release of 1.03B firmware by Rulen  (http://chdk.setepontos.com/index.php?action=profile;u=15772).   All functions now implemented - testing and feedback needed.

zShare :
ixus120_sd940-103b-0.9.9-1067-full.zip - 0.51MB (http://www.zshare.net/download/877450297c33a752/)



Camera seems to work normally.
I can access the script menu but it shuts down randomly.
Correction: I think it doesn't shut down but isn't visible anymore. When you press a button it appears again.
Starting scripts with the shutter button works.
When you access the menu with DISP and MENU it's the same. You can navigate through the menu but it vanishes from time to time.
Battery icon in the middle shows 0% all the time.
The live histogramm flickers from time to time, just like all of the green overlay items.(Maybe it's supposed to be that way. I don't have any experience with CHDK firmwares.)

Not much time today. I will report when I've done more testing.

Thank you Rulen and waterwingz!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: tommasoferrarese on 13 / March / 2011, 17:13:04
just downloaded beta for firmware 103b..

it starts up, it looks like all options are available..

but i cannot find a way to make the camera use the big partition to save media on, so it doesn't have the space to save raw files..

what have i done wrong?

thanks,

Tommaso
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / March / 2011, 18:00:51
I can access the script menu but it shuts down randomly.
Correction: I think it doesn't shut down but isn't visible anymore. When you press a button it appears again.
Do the menu's dissappear in shooting mode or playback mode or both ?  My nemisis RefreshPhysicalScreen() might be coming back to haunt me still.


Battery icon in the middle shows 0% all the time.
Easy one - you just need to calibrate the camera by changing the battery min and max voltage using the OSD parameters menu to go to the Battery menu. Rulen report good results setting Battery MAX Voltage (mV) to 4200 and Battery MIN Voltage (mV) to 3200.

At some point I will make it so the defaults work without this fiddle,  along with better default screen positioning for the OSD items and a better default set of colors.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / March / 2011, 18:14:10
but i cannot find a way to make the camera use the big partition to save media on, so it doesn't have the space to save raw files..
Hmmm - I can get lots of raw files on a 2G card so I assume you have partiioned your card into a small FAT16 partition and a larger FAT32 parition ?

There are many (probably too many) posts on the forum on this topic.  Here's some good ones I found :
http://chdk.setepontos.com/index.php?topic=6173.0 (http://chdk.setepontos.com/index.php?topic=6173.0)
and this
http://chdk.wikia.com/wiki/Bootable_SD_card (http://chdk.wikia.com/wiki/Bootable_SD_card)

At what point does the SD940 not match what you see there - I don't have a big SD card so have not tried this.  I guess that I really need to buy a big card and try it out.  I have a whole bunch of 2G & 4G cards so I have not been in a hurry to do that though.

 
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 13 / March / 2011, 18:21:20
At what point does the SD940 not match what you see there - I don't have a big SD card so have not tried this.  I guess that I really need to buy a big card and try it out.
You don't need a big card, you can partition a smaller card with a FAT16 and FAT32 partition to test.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / March / 2011, 18:42:44
You don't need a big card, you can partition a smaller card with a FAT16 and FAT32 partition to test.
Yea, I know - we talked about that a while back -  http://chdk.setepontos.com/index.php?topic=5855.msg59916#msg59916 (http://chdk.setepontos.com/index.php?topic=5855.msg59916#msg59916).

Still hasn't bubbled to the top of my "to do" list as I still don't have a need for it.  I'll take a look this week if tommasoferrarese can't solve it using the existing forum / wiki info.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: tommasoferrarese on 13 / March / 2011, 19:35:39
i solved it using cardtricks on a pc to ake my 4Gb card bootable.. thanks for the info!!

anyway as everything looks like it's working, still on my 103b raw files aren't saved, it just saves jpgs..

any clue to where the problem could be?

i am more than willing to do all the testing i can, btw, to give my modest contribution to your valuable efforts.

Tommaso
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / March / 2011, 19:51:09
i solved it using cardtricks on a pc to ake my 4Gb card bootable.. thanks for the info!!

YES !!

EDIT:  so are you using a single paritiion now ?  if so - dual partiitions on the SD940 are still a TBD

anyway as everything looks like it's working, still on my 103b raw files aren't saved, it just saves jpgs..
RAW is tricky - lots of post on this forum about that too.  I'll dig some up but what immediately comes to mind is that RAW is saved in a different folder on the SD card and you can't see them over a USB cable from your computer.  You need to plug the card into a card reader on your PC and navigate the folders.   All that assumes you have enabled RAW via the CHDK menus on your camera of coarse.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: tommasoferrarese on 13 / March / 2011, 22:06:20
no, it's not that..

i always connect a card reader and import through Lightroom with it looking into all subfolders..

but i also checked card space and every folder manually  and it simply doesn't write them down.. it looks..

it gives on screen info about how many raws i could save on the camera..

i'll check that out tomorrow, i think..

thanks for every effort btw!

Tommaso
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 13 / March / 2011, 22:16:57
Have you tried looking using the CHDK file browser ? (misc->file browser in the CHDK menu)

If you are using multiple partitions (rather than just formatting 4gb fat32 fat16) then you would need to swap partitions to the large one for to see the raws on your card reader.

You should be able to tell if raws are being saved, because the save time will be much longer.
no, it's not that..

i always connect a card reader and import through Lightroom with it looking into all subfolders..

but i also checked card space and every folder manually  and it simply doesn't write them down.. it looks..

it gives on screen info about how many raws i could save on the camera..

i'll check that out tomorrow, i think..

thanks for every effort btw!

Tommaso
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / March / 2011, 22:46:22
Have you tried looking using the CHDK file browser ? (misc->file browser in the CHDK menu)
This is a  really good way to see if the camera is writing RAW images. If the CHDK browser can see them.  PC software makes no difference here.

If you are using multiple partitions (rather than just formatting 4gb fat32) then you would need to swap partitions to the large one for to see the raws on your card reader.
reyalp - do you mean  4gb fat16   ("rather than just formatting 4gb fat32)" - I think the bootable CHDK partition needs to be FAT16  ?

You should be able to tell if raws are being saved, because the save time will be much longer.
Oh yea - no mistaking when the camera is storing RAW files !

 
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / March / 2011, 22:58:15
no, it's not that..
Tommaso

@Tommaso ... THANK YOU .. for your feedback.  This porting process is really hard - I will try to deal with your discoveries one by one.



Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 13 / March / 2011, 23:57:32
reyalp - do you mean  4gb fat16   ("rather than just formatting 4gb fat32)" - I think the bootable CHDK partition needs to be FAT16  ?
Yes
<- fat fingers
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: tommasoferrarese on 14 / March / 2011, 03:19:37
Yes, i also checked with chdk file browser, AND i can tell it by saving times.

it is not saving RAWs..

my IXUS wouldn't save raw files faster than my 550D, right? <-(rethorical)

i'll be able to tell what else wrks or not later tonight, but definitely i'll do my best to help!

Tommaso

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: evosonic on 14 / March / 2011, 11:30:36
Do the menu's dissappear in shooting mode or playback mode or both ?  My nemisis RefreshPhysicalScreen() might be coming back to haunt me still.


Playback mode works just fine. The menu only flickers or disappears in both of the shooting modes.
When I enter the regular menu in shooting mode the chdk menu works fine, too.
There are only problems when there's a "live image" in the background.

I can confirm that it doesn't save raw files. I couldn't find them using the file browser.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 14 / March / 2011, 14:47:19
1.03b beta testing:
I am trying to start it using a Kingston 8GB SDHC, FAT32. I can test with my 2GB cards later tonight.

1. Does CDHK start when it's on FAT32? After extracting the files directly to the FAT32-formatted flash and starting the camera, the 'Firmware Update' choice is not available in the playback-mode menus.
EDIT: Oh. That's because the PS.FI2 file is missing from ixus120_sd940-103b-0.9.9-1067-full.zip

2. Partitioned the 8GB SDHC to two partitions (FAT12: 2MB, FAT32:7673MB) and copied files as described by SkyWalker9 (http://chdk.setepontos.com/index.php?topic=6173.msg62637#msg62637). (BOOTDISK.BIN to FAT12; CDHK folders to FAT32). The SD is set to autoboot (FAT12 partition) via the SDM Installer, physically set to "lock", and inserted into the camera. The camera is started, and after a 4 second delay, the "CDHK Firmware..." splash screen is displayed, and the CDHK menu is available.
a. No pictures can be taken because memory is full (2MB), and the 2nd partition is not available (Is the partition supposed to be automatically detected/used?) [dual partitions doesn't seem to work]
b. "Firmware update..." is still not available in the menus. [can autostart, but not manual start? (missing PS.FI2)]

3. Selecting "Show Memory Info" causes the "CDHK Firmware 'CDHK 0.9.9-1067..." splash screen to be displayed continuously until the device is powered off.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 14 / March / 2011, 22:28:53
[103b-0.9.9-1067 port]
Ok, so I tried it with a bootable 2GB SD. The splash screen graphic is the full graphic, unlike when it is loaded on a partitioned 8GB SDHC which only displays the text in the box, without the camera dials graphic above it. "Firm update..." option is available after autoboot with 2GB SD, unlike with 8GB SDHC.

Persistent splash menu when 'show memory info' is activated is still present.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / March / 2011, 23:05:38
Thanks for your feedback.

Ok, so I tried it with a bootable 2GB SD. The splash screen graphic is the full graphic, unlike when it is loaded on a partitioned 8GB SDHC which only displays the text in the box, without the camera dials graphic above it.
The splash screen logo is read from a file on the SD card.  If it was in the wrong partition on your 8G card that might explain why you can't see it.

"Firm update..." option is available after autoboot with 2GB SD, unlike with 8GB SDHC.
Where do you see a "Firm update.." option ?   The Canon menus or the CHDK menus ?

Persistent splash menu when 'show memory info' is activated is still present.
Works properly in the 1.03C release.  I'll add it to the things still to fix on the 1.03B.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / March / 2011, 23:08:03
Playback mode works just fine. The menu only flickers or disappears in both of the shooting modes.
When I enter the regular menu in shooting mode the chdk menu works fine, too.
There are only problems when there's a "live image" in the background.
Confirmed on the 1.03C too.   I'll take a look later this week but we might have to live with pressing a key to make the menu appear again.  Its still there - just overwritten.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 14 / March / 2011, 23:14:42
Confirmed on the 1.03C too.   I'll take a look later this week but we might have to live with pressing a key to make the menu appear again.  Its still there - just overwritten.
This sounds like normal CHDK behavior to me.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 14 / March / 2011, 23:15:11
[1.03b]
Are the visual settings (color) supposed to be set separately in the shoot modes and in playback/canon menu modes? Default loads a white/green scheme in the shoot modes, and a white/gray scheme in playback/canon menu.

Where do you see a "Firm update.." option ?   The Canon menus or the CHDK menus ?
It's present in the Canon menu when I autoboot from the 2GB card, but not when I autoboot the partitioned 8GB SDHC. Maybe it's something to do with the CDHK folder not in the right partition as well?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / March / 2011, 23:21:08
This sounds like normal CHDK behavior to me.
I was wondering about that.  RefreshPhysicalScreen() doesn't really do a lock/unlock thing that would tell the Canon f/w not to overwrite the screen.  Nor does anything else in CHDK from what I can tell.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / March / 2011, 23:23:12
Are the visual settings (color) supposed to be set separately in the shoot modes and in playback/canon menu modes? Default loads a white/green scheme in the shoot modes, and a white/gray scheme in playback/canon menu.
Different colors in playback and shoot modes are normal. Some time I'll pick something less ugly and make them the same for both playback and shoot modes.  It just has not been a high priority.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 14 / March / 2011, 23:30:01
[1.03b]
Is the built-in bracketing supposed to work yet? How about zooming during video capture?  They both don't work.

Is the OSD supposed to vanish when you press the FUNC.SET key during a shoot mode? It doesn't.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / March / 2011, 23:41:02
Is the built-in bracketing supposed to work yet? How about zooming during video capture?  They both don't work.
Rulen is still plugging away at getting thinks working.  With so much to test, you are discovering things that he has not tried yet.  Both functions work on the 1.03C version so its just a matter of time to see which addresses he did not quite get right.

Is the OSD supposed to vanish when you press the FUNC.SET key during a shoot mode? It doesn't.
Doesn't do that on the 1.03C either.  Is it supposed to ?  (In my case, it actually launches a Canon BASIC file that I have laying around on my  SD card.)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 14 / March / 2011, 23:47:12
Different colors in playback and shoot modes are normal. Some time I'll pick something less ugly and make them the same for both playback and shoot modes.  It just has not been a high priority.

oh I see. FYI, the color tables for playback and shoot modes are different; that is 0x44 is gray in one mode, and green in another.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / March / 2011, 23:54:56
oh I see. FYI, the color tables for playback and shoot modes are different; that is 0x44 is gray in one mode, and green in another.
True.  There was a big discussion about that a couple of times here in the forum - you can probably search for it.   The best way to handle it is to pick colors from the first two rows in the color map.  Those are the same in both modes.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: fri.k on 15 / March / 2011, 07:16:55
Hello
Is chdk working on 1.03b?
I have Ixus 120IS with fw GM1.03B + 4GB Patriot SDHC, but ixus120_sd940-103b-0.9.9-1067-full doesn't start
What I made:
1. Downloaded zip file and unpacked it
2. Formated SDHC card to one FAT16 partition and made it bootable
3. Putted files from zip file to card (DISKBOOT.BIN, vers.req, CHDK)
4. Turned SDHC card to LOCKED
5. Power on camera with this card.

Nothing happens, long-pressing DISP. button only change brightness. Im I missing something?

Card was formated on Fedora 14 with gpared 0.7.0. Sorry for bad English :)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: fe50 on 15 / March / 2011, 07:48:46
Hello & welcome, fri.k !

What I made:
1. Downloaded zip file and unpacked it
2. Formated SDHC card to one FAT16 partition and made it bootable
3. Putted files from zip file to card (DISKBOOT.BIN, vers.req, CHDK)
4. Turned SDHC card to LOCKED
5. Power on camera with this card.
Nothing happens
The card must also be CHDK-bootable --> http://chdk.wikia.com/wiki/Bootable_SD_card (http://chdk.wikia.com/wiki/Bootable_SD_card)

You could also start CHDK manually:

1) expand ALL files & folders from the package to the root of your SD card
    (the file PS.FI2 is essential for manual loading)
2) power on your camera with the PLAY button [>]
3) enter the Canon menu, scroll down & select "Firmware Update", then confirm...

Read more here: http://chdk.wikia.com/wiki/CHDK_User_Manual (http://chdk.wikia.com/wiki/CHDK_User_Manual)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 15 / March / 2011, 08:35:05
    (the file PS.FI2 is essential for manual loading)
Note that the .zip archive for 1.03b does not contain the PS.FI2 file.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 15 / March / 2011, 09:19:51
Is chdk working on 1.03b?
Yes - people are successfully booting the 1.03b firmware using a bootable card and the card lock switch.  There is a lot of detail on the wiki and this forum on how to do that so I won't try to repeat it here.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: fri.k on 15 / March / 2011, 10:21:08
The card must also be CHDK-bootable
That's it. I missed
Code: (bash) [Select]
echo -n BOOTDISK | dd bs=1 count=8 seek=64 of=/dev/sdx1 Now it works like a charm. So you have another happy CHDK user. Thanks all of you for help and hard work :)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 15 / March / 2011, 11:00:56
Now it works like a charm. So you have another happy CHDK user. Thanks all of you for help and hard work :)
Just be aware that the 1.03B version is still very new and mostly untested.  Many things will not work quite correctly yet.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 16 / March / 2011, 00:40:54
[1.03b]
Shutter and focus overrides don't seem to work yet either.

Some more minor things not high on priority:
1. Are the canon image compression, recording pixels, and number of images left in the shoot supposed to disappear after a few seconds? It does.
2. When "enable symbols" is activated, the setting is not saved and is deactivated after reboot.
3. Is not opening the lens and flashing the autofocus LED after pressing the power button intentional?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 16 / March / 2011, 08:44:46
3. Is not opening the lens and flashing the autofocus LED after pressing the power button intentional?
To open the lens on power up,  press and hold the power button on top (rather than just briefly press it).

The autofocus LED was just something I put in there so that during the development process I could be sure CHDK was booting from the SD card even if it crashed before putting the logo up.  I suppose at some point I'll take it out.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: kdaniel7979 on 16 / March / 2011, 15:48:54
Absolute newbie here. I have a whole two hours experience here with CHDK. I have just purchased an IXUS 120 IS, but didn't know that I should have checked the current firmware version. I figured this out after trying 1.03C with no success in upgrading.

I have 1.03B.

I was momentarily hopeful when I found this thread for 1.03B, but unfortunately, my camera doesn't even give me the option to upgrade the firmware.

Not sure where to go from here.

Right now I'm thinking of returning this camera and trying another one, checking the firmware at the shop.

Any ideas??

KD
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 16 / March / 2011, 16:00:48
but unfortunately, my camera doesn't even give me the option to upgrade the firmware.

You won't be able to find the upgrade firmware option because the PS.FI2 file is not present in the zip archive for 1.03b beta port. You have to make your <4GB SD card bootable, and the easiest way is to use cardtricks.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: fri.k on 16 / March / 2011, 16:29:09
my camera doesn't even give me the option to upgrade the firmware.
Your SD card MUST be LOCKED! Only then you will see "updated firmware" but for now you can only use CHDK with 1.03B by bootable SD.
Read my earlier posts to know more.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 16 / March / 2011, 16:35:26
You SD card MUST be LOCKED! Only then you will see "updated firmware"
This is not true on most (if not all ?) CHDK cameras. The card must be for autoboot. Firm update does not care.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: fri.k on 16 / March / 2011, 17:46:02
This is not true on most (if not all ?) CHDK cameras. The card must be for autoboot. Firm update does not care.
Have You test it with Ixus 120IS fw.1.03B? On my, only in this situation I can use firm update (Play mode). I spend some time looking for it.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 16 / March / 2011, 23:31:30
I was momentarily hopeful when I found this thread for 1.03B, but unfortunately, my camera doesn't even give me the option to upgrade the firmware.
You don't need to change or upgrade the firmware on your camera. If you have a camera with 1.03B firmware installed, use the 1.03B beta version of CHDK for the IXUS120-SD940

You won't be able to find the upgrade firmware option because the PS.FI2 file is not present in the zip archive for 1.03b beta port. You have to make your <4GB SD card bootable, and the easiest way is to use cardtricks.
Actually, you cannot upgrade or change the firmware on your IXUS120-S940 at all.  Canon does not provide support for this and CHDK does not change the firmware on the cameras it operates on.

You also cannot use the "upgrade firmware" method for activating CHDK.  Only the bootable SD card with the Lock switch in the "On' position is currently support for activating CHDK on the IXUS120-SD940.   The PS.FI2 file needed for "upgrade firmware" booting is not available for the IXUS120-SD940.

Title: Re: SD940 (IXUS120) porting thread - updated test version for firmware 1.03B
Post by: waterwingz on 27 / March / 2011, 16:29:23
Found a few potential problems with the code for f/w 1.03B and fixed them. I have no way to test this - two changes were in boot.c  so it might not even boot but if somebody wants to give it a try,  here's the file:

http://www.box.net/shared/1mt59984fu (http://www.box.net/shared/1mt59984fu)

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 27 / March / 2011, 17:56:04
It appears to be able to boot.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: tommasoferrarese on 27 / March / 2011, 18:01:02
it does boot, even if at times menus don't stay on screen and just disappear..
but still it's not saving raw files, yet..

wish I could help a little more with this..

Tommaso
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 27 / March / 2011, 18:39:00
it does boot, even if at times menus don't stay on screen and just disappear..
Menus will disappear in shooting mode - this is apparently normal with CHDK.  The menu is still there,  but the real time image buffer has overwritten it.  Pressing the up or down key will bring it back.

Note that menus should not be disappearing in playback mode.  Post here if that starts happening.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: tommasoferrarese on 27 / March / 2011, 19:34:10
ok,then, I was talking about record mode, so everything is fine about that..

anything else i could check? trying to make myself as useful as possible...

Tommaso
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 27 / March / 2011, 20:19:26
anything else i could check? trying to make myself as useful as possible...
From a previous post :
Quote
Is the built-in bracketing supposed to work yet? How about zooming during video capture?  They both don't work.

It would be interesting to know if the manual overrides work - shutter, ISO, aperature (ND filter) etc....

But what would be really helpful is to work your way throught the online manual and make notes about what works and what doesn't :
http://chdk.wikia.com/wiki/CHDK_User_Manual (http://chdk.wikia.com/wiki/CHDK_User_Manual)

That has not really been done well for any version of the SD940 so you would be doing our small group a big favor.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: brakar on 28 / March / 2011, 05:03:33
Waterwings, thanks for your enormous effort on this port !

I downloaded the latest version for the 1.02 yesterday and gave it a brief try. Most of the functions I have tested so far worked, amongst others;
- ISO and shutterspeed override,
- RAW format, both CRW and DNG worked perfect.
 
The options for turning off the autofocus (setting to fixed infinate) I could however not get to work. It might be related to the camera itself, -or to my competence-level, I don't know. Besides, I have not found any functions for turning off the lcd screen, (might not be in there).

I did also test the majority of the scripts in the script-folder. The Scriptingmenu appears to be fully operational, but I could not get any of the scripts to run properly. The scripts started ok, then some of them crashed the camera (black screen), and some of them gave no or little response after they were started.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: tommasoferrarese on 29 / March / 2011, 05:58:24
as much as i can see, all photographic extra functions are not working, in 1.03b firm...

zebra is ok, but NDfilter,flash,ev,overrides are not changing camera's behavior..

anything I could do to troubleshoot?

Tommaso
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 29 / March / 2011, 07:27:41
I downloaded the latest version for the 1.02 yesterday and gave it a brief try.
@brakar : do you mean 1.02C ?  Waldo had reported scripting working with that version.  Did you try both LUA and BASIC scripts ?  Some of the default ones actually don't do much - a simple script that take pictures in a loop with a time delay might be an interesting test - I'll post something like that if you can't find / write it yourself.

zebra is ok, but NDfilter,flash,ev,overrides are not changing camera's behavior..
I've been comparing the stubs_entry_2.S files between the three firmware versions using a dissassembly utility that I've been working on.  I have found some differences that need to be fixed but need a little more time to understand them.  Should have another release ready later this week / weekend depending on what else I need to get done.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: brakar on 29 / March / 2011, 08:22:11
@waterwings,
Yes, the firmware version was 1.02C
I just tried an time-interval script (BASIC) as you suggested - and had it working nicely.
The other BASIC-scrips I have bin testing for remote control of the camera (input 5V into the cameras usb), are however still not working. The simplest one looks like this:

@title Remote button
:loop
wait_click 1
is_key k "remote"
if k=1 then shoot
goto "loop"
end

The script was working nicely on my SD980.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 29 / March / 2011, 09:49:58
The other BASIC-scrips I have bin testing for remote control of the camera (input 5V into the cameras usb), are however still not working.

Thanks brakar - always nice to have a clear problem description!  I can look into it - its not something I have tested because I have not taken the time to build a remote switch.  However, its something I have wanted to try out so I'll move it to the top of the priority list - right behind getting the 1.03b firmware working,.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 29 / March / 2011, 13:08:28
The other BASIC-scrips I have bin testing for remote control of the camera (input 5V into the cameras usb), are however still not working.

Thanks brakar - always nice to have a clear problem description!  I can look into it - its not something I have tested because I have not taken the time to build a remote switch.  However, its something I have wanted to try out so I'll move it to the top of the priority list - right behind getting the 1.03b firmware working,.
I think I've mentioned this before, but you can use your PC usb cable to test the remote code, just plug and unplug it... as long as remote is enabled, the camera won't got into ptp mode.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: brakar on 29 / March / 2011, 16:46:42
I discovered the problem with running my remote.bas script was due to a faulty connection in the remote switch. Now that I have fixed it, the script is running as it's supposed to.
----
PS: I have still not managed to override the cameras autofous by setting focus to "infinate", either directly in chdk - or by the use of scripts. Anyone who knows if this should be possible? (I am a rookie on chdk, so I don't know if I have tried the right things).
Title: Re: SD940 (IXUS120) porting thread [new test version for firmware 1.03b here]
Post by: waterwingz on 29 / March / 2011, 21:10:46
Changed a couple of addresses in stub_entry_2.S to match what's in the other two firmware versions. Maybe somebody can try this version and see if we are closer now ?

http://www.box.net/shared/7sjz17u57p (http://www.box.net/shared/7sjz17u57p)

My apologies to the 1.03B firmware owners.  This is not a great way to debug software but its all I can do for you as I don't have a camera with that firmware.  

Update :  rulem reports no improvement with his problems - other things might work better.  These corrections are definitely needed in any case.  Feedback from others would be good.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Fred_Feuerstein on 31 / March / 2011, 04:43:05
My apologies to the 1.03B firmware owners.  This is not a great way to debug software but its all I can do for you as I don't have a camera with that firmware.
No problem, I'm thankful for your work.

Yesterday I used ixus120_sd940-103b-0.9.9-1114-full.zip and it worked quite good for an alpha version. Hardware zoom while taking a video didn't work and battery voltage level for the battery symbol was not predefined.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Sulpog on 01 / April / 2011, 04:53:00
The scripts doesn't work very well.
If i start a intervall script, the camera just take one picture.
After this nothing happens.
Its the same with many scipts.
Can someone help?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 01 / April / 2011, 06:17:54
The scripts doesn't work very well.
What firmware version are you using ?   This is one of the issues we are currently trying to fix with the 1.03B version of the firmware.   Scripts work well with the other firmware versions.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Sulpog on 01 / April / 2011, 07:22:47
I use the 1.03B version, sadly ;-)
I hope you can solve the problem.
Thanks for your work,
kind regards
Title: Re: SD940 (IXUS120) porting thread [third 1.03B firmware release needs testing]
Post by: waterwingz on 02 / April / 2011, 17:45:43
Another beta release for firmware 1.03B - but this time I think I might have it fixed !   

http://www.box.net/shared/40ymdqx4og (http://www.box.net/shared/40ymdqx4og)

Looking for testing help and feedback as usual - I don't have a camera with this firmware version.

Title: Re: SD940 (IXUS120) porting thread [1.03B firmware success!!]
Post by: waterwingz on 02 / April / 2011, 18:46:31
If i start a intervall script, the camera just take one picture.
User rulen  reports this is now working using the beta 3 release !! :D

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: rulen on 02 / April / 2011, 19:15:24
Looks good to me now - focus bracketing certainly works - many many public thanks to Waterwingz for getting this far.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 03 / April / 2011, 10:35:04
Oh how Exciting!! 1.03b Tv bracketing, and saving RAW now works! I haven't fully tested it yet, but it does bracket, and DNG files can be saved and then opened with photoshop. zooming during video works as well (although the gears are quite loud lol) Many thanks!!  :D

The "enable symbols" option still doesn't remain selected after you restart the camera. But CDHK starts very quickly!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 03 / April / 2011, 13:40:35
The "enable symbols" option still doesn't remain selected after you restart the camera.
Curious - it seems to "stick" in whatever state I leave it with the 1.03C firmware version. Tried various combinations of changing state and powering off/on and can't fool it.

Anyone else seeing this ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: philmoz on 03 / April / 2011, 15:57:32
The "enable symbols" option still doesn't remain selected after you restart the camera. But CDHK starts very quickly!

Did you use 'Reset Files' under the 'Visual Settings' menu?
If so this sets the symbol font file to no file selected so the symbols are disabled each time you restart.
Go into visual settings and reselect the icon_10.rbf symbol file then re-enable the symbols under the OSD settings.

Phil.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: rulen on 03 / April / 2011, 16:47:06
Motion detection seems to be working on 103b, but be warned that:
a) I am new to CHDK, so am a little unsure what "working" looks like (ps can anyone suggest a script and parameter settings to capture birds in flight with flash?)
b) after some use the grid of detection areas seemed to get lost, which was fixed by a reboot, so maybe there are still minor issues.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 03 / April / 2011, 16:51:43
The "enable symbols" option still doesn't remain selected after you restart the camera. But CDHK starts very quickly!

Did you use 'Reset Files' under the 'Visual Settings' menu?
If so this sets the symbol font file to no file selected so the symbols are disabled each time you restart.
Go into visual settings and reselect the icon_10.rbf symbol file then re-enable the symbols under the OSD settings.

Phil.
Strangely, I wasn't able to reproduce this on d10. Tested
- reset files
- leave alt menu
- reboot camera, symbols are off
- enable symbols, symbols appear
Title: Re: SD940 (IXUS120) porting thread [new release for f/w 1.03B available]
Post by: waterwingz on 04 / April / 2011, 00:32:38
Update Note :  stub_entry_2.S for firmware version 1.02C updated to match routines used by f/w 1.03B and 1.03C ports.   Available in autobuild as of changeset 1127.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 04 / April / 2011, 01:31:15
Did you use 'Reset Files' under the 'Visual Settings' menu?
If so this sets the symbol font file to no file selected so the symbols are disabled each time you restart.
Go into visual settings and reselect the icon_10.rbf symbol file then re-enable the symbols under the OSD settings.

Phil.
Strangely, I wasn't able to reproduce this on d10. Tested
- reset files
- leave alt menu
- reboot camera, symbols are off
- enable symbols, symbols appear

Curiously strange indeed. Reselecting the icon_10.rbf symbol file fixed the problem. Thanks Phil!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: philmoz on 04 / April / 2011, 04:03:57
Strangely, I wasn't able to reproduce this on d10. Tested
- reset files
- leave alt menu
- reboot camera, symbols are off
- enable symbols, symbols appear

Try:
- reset files
- leave alt menu
- reboot camera, symbols are off
- enable symbols, symbols appear
- reboot camera again - do you still have symbols?

Phil.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 04 / April / 2011, 09:37:15
hi guys, any new rumors bout a possible chdk for ixus 120 with 1.01A firmware?
tnx for answer and compliments for your good work
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 04 / April / 2011, 12:16:46
i solved it using cardtricks on a pc to ake my 4Gb card bootable.. thanks for the info!!
EDIT:  so are you using a single paritiion now ?  if so - dual partiitions on the SD940 are still a TBD

I can now confirm that dual partitions on 1.03b works using an 8Gb card. Partitioned the card to 2 partitions using SDM. Made the first 2Mb partition bootable and put the bootdisk.bin there. The second <8Gb partition contained the CDHK directory. After powering up, there was a brief hang, perhaps it crashed, but afterwards CDHK booted normally. When pictures are taken, they are stored on the 2nd partition as expected. DNG/RAW saves there too. "Swap partitions" using the camera behaves as expected.

However, pressing the 'play' button to turn on the camera in playback mode makes the canon startup screen to be displayed, then the camera shuts off (automatically as if it crashed). (Pressing the power button initially had this same effect, but I could not reproduce it after a couple of power on/off cycles, and the camera started normally).
EDIT: The behavior is sporadic; sometimes it starts in playback mode fine, other times it just shuts down.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 04 / April / 2011, 13:18:28
However, pressing the 'play' button to turn on the camera in playback mode makes the canon startup screen to be displayed, then the camera shuts off (automatically as if it crashed). (Pressing the power button initially had this same effect, but I could not reproduce it after a couple of power on/off cycles, and the camera started normally).
EDIT: The behavior is sporadic; sometimes it starts in playback mode fine, other times it just shuts down.

Common problem with recent CHDK releases (and maybe old ones ?) - this does not appear to be SD940 specific.

Details here :  http://chdk.setepontos.com/index.php?topic=6179.msg62619#msg62619 (http://chdk.setepontos.com/index.php?topic=6179.msg62619#msg62619)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 04 / April / 2011, 18:41:54
hi guys, any new rumors bout a possible chdk for ixus 120 with 1.01A firmware?

Anyone interested in CHDK for firmware 1.01A should send me a personal message with their real email address.  If I can get a couple of people with that firmware interested and I have contact information for them,  I will consider doing the port.  Its too much work doing the port without some more permanent way to contact those interested.
 

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 05 / April / 2011, 00:45:00
How would you edit the user menu? The User Manual says to press the "+/- button or the equivalent button on the camera" when User Menu is set to edit. The half-shoot button doesn't do it either.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: mgg on 05 / April / 2011, 21:35:55
Hi, have a 103c and have downloaded and installed the ixus120_sd940-103c-0.9.9-1118_BETA code successfully.  I tried to install the basic program I currently run on an SD400's - and it fails early.  
If I get_prop 0,x which is camera mode - it always reads 0 no matter where the switches are set.  I switched to x=get_mode - and I always get 1 no matter how the switches are set.

as in:

:TT
x=get_mode
print " camera mode is ",x
if x=1 then goto "DM"
print " Camera MODE error",x
sleep 250
goto "TT"
:DM
set_prop 6 0
set_prop 8 1
set_prop 9 0
print " eval mode",0

I shows x is one, appears to jump to :DM, then crashes somewhere before the print.

My question is - should code like this run in this beta or do I have some problem specific to my setup?

tnx
mgg
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 05 / April / 2011, 22:14:42

If I get_prop 0,x which is camera mode - it always reads 0 no matter where the switches are set.  I switched to x=get_mode - and I always get 1 no matter how the switches are set.
I will confess here to not having looked at any of these functions.  Its quite possible that the SD940 port has not set this up correctly and I'm not even sure where that is supposed to happen.  I'm not even sure what they are supposed to do - is there a link where I could take a look ?


My question is - should code like this run in this beta or do I have some problem specific to my setup?
You are probably the first person to try this out on this port.  Frustrating as that might be,  I thank you for looking at it and reporting your findings here.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 05 / April / 2011, 22:25:38
How would you edit the user menu? The User Manual says to press the "+/- button or the equivalent button on the camera" when User Menu is set to edit. The half-shoot button doesn't do it either.
Another good question about something I have not tried myself.  Worked through the User Manual and discovered the same thing you did - the +/- button moves the cursor up and down the menu and apparently cannot be used to select a menu item to add to the User Menu.    If nobody offers a clarification here,  I'll wade through the code to figure out what it is trying to do.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 05 / April / 2011, 22:40:58
If nobody offers a clarification here,  I'll wade through the code to figure out what it is trying to do.

FYI the half-shoot button is used in some cameras, i think Maybe the SD400 used that when I had it. http://chdk.wikia.com/wiki/User_menu (http://chdk.wikia.com/wiki/User_menu) ...but it doesn't work on the SD940. does that have to be assigned or something?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 05 / April / 2011, 23:01:02
FYI the half-shoot button is used in some cameras, i think Maybe the SD400 used that when I had it. http://chdk.wikia.com/wiki/User_menu (http://chdk.wikia.com/wiki/User_menu) ...but it doesn't work on the SD940. does that have to be assigned or something?
Most likely something else I missed.  I'll look at it when I get a few moments in the next couple of days.  Thanks for the "heads-up".

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: IOOI on 06 / April / 2011, 16:27:07
Another beta release for firmware 1.03B - but this time I think I might have it fixed !   

http://www.box.net/shared/40ymdqx4og (http://www.box.net/shared/40ymdqx4og)

Looking for testing help and feedback as usual - I don't have a camera with this firmware version.



Hi,

I have version ixus120_sd940-103b-0.9.9-1114-full-rev3 successfully installed on my 103b. Now I am ready for tests. There seems to be quite a lot what I could test but maybe you're interested in some dedicated tests of certain things. Let me know!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 06 / April / 2011, 19:33:55
If I get_prop 0,x which is camera mode - it always reads 0 no matter where the switches are set.  
Did a little research and here's what I've found so far.  There are four different versions of the camera properties you are trying to access - it changes with camera model.  In the CHDK source code, these are defined as CAM_PROPSET  1, 2, 3 or 4.   Your SD400 used propset 1 but the SD940 uses propset 3 (this may or may not be right).   With propset 1,  you use get_prop 0 x to read the camera mode dial - with propset 3 the correct value appears to be get_prop 49 x .  

I'm basing this on the definitions in propset1.h and propset3.h in the directory  trunk\trunknnnn\include


UPDATE :  
I tried this :
Code: [Select]
@title set mode test
@param a param
@default a 49
:TT
sleep 500
get_prop a x
print "param=",a, "value=",x
goto "TT"

If I am in shooting mode then I get -32768 in auto mode, -32764 in manual mode and 2603 in movie mode.
If I am in playback mode then I get -32768 regardless ( -1 in 16 bit land)

Check out : http://chdk.wikia.com/wiki/Mode_dial_propcase_values (http://chdk.wikia.com/wiki/Mode_dial_propcase_values) and
http://chdk.wikia.com/wiki/PropertyCase (http://chdk.wikia.com/wiki/PropertyCase)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 06 / April / 2011, 20:52:47
FYI the half-shoot button is used in some cameras, i think Maybe the SD400 used that when I had it.
I tried it on my camera using the half-shoot button and can confirm that it does not add entries to the user menu.   I took a look at the code in gui.c and confirmed that half-shoot is what the code is looking for.  I'll wade through debugging when I have a little more time.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 06 / April / 2011, 21:42:42
I tried it on my camera using the half-shoot button and can confirm that it does not add entries to the user menu.   I took a look at the code in gui.c and confirmed that half-shoot is what the code is looking for.  I'll wade through debugging when I have a little more time.

Great thanks!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 06 / April / 2011, 21:53:45
Another beta release for firmware 1.03B - but this time I think I might have it fixed !   
Turns out we do  have it fixed!
I have version ixus120_sd940-103b-0.9.9-1114-full-rev3 successfully installed on my 103b. Now I am ready for tests. There seems to be quite a lot what I could test but maybe you're interested in some dedicated tests of certain things. Let me know!
I would suggest just using the CHDK features that interest you the most and let us know how that goes?  Bug reports are good - reports of success are good too.   Right now it would be nice to know which scripts (BASIC and/or LUA) are working well with the SD940 if you want to search this forum and the wiki for things to try out ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 06 / April / 2011, 22:14:26
Did a little research and here's what I've found so far.  There are four different versions of the camera properties you are trying to access - it changes with camera model.  In the CHDK source code, these are defined as CAM_PROPSET  1, 2, 3 or 4.   Your SD400 used propset 1 but the SD940 uses propset 3 (this may or may not be right).   With propset 1,  you use get_prop 0 x to read the camera mode dial - with propset 3 the correct value appears to be get_prop 49 x
Note that if you use lua, you can use the propcase module and refer to propcases by name, without worrying about which propset your camera has. Of course, the ports propset still has to be defined correctly in camera.h
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: zawin on 09 / April / 2011, 10:04:56
Hello,
are you planning port CHDK for firmware GM1.01A? Thank you!
Title: Re: SD940 (IXUS120) porting thread [firmware 1.01A ??]
Post by: waterwingz on 09 / April / 2011, 10:36:44
Hello,  are you planning port CHDK for firmware GM1.01A? Thank you!
@zawin : As suggested in my earlier post on this forum, [http://chdk.setepontos.com/index.php?topic=5855.msg64039#msg64039 (http://chdk.setepontos.com/index.php?topic=5855.msg64039#msg64039)]  I will port for the 1.01A if I can get at least two users who will give me a real email address and commit to testing early releases of the port.  A port is a lot of work but part of my motivation is to test some porting utilities that I have been working on that should make it easier.  However, as I do not have that camera firmware,  I have no way to test the results and will not do that much work without a couple of committed "helpers".

I have the email address you sent me in a PM (thank you).  We just need one more volunteer.



Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: mgg on 09 / April / 2011, 19:03:51
Ah, yes, get_prop 49 shows 32768, 32764 and 2603 - but, and I may have missed this somewhere, whenever CHDK starts up on the 940, it is in playback mode.  Is that a feature of this camera (I can put it in record mode by hitting shutter to stop script, Alt to drop chdk menu, half press to go to record, alt to bring chdk back and full shutter to restart script.  I've also found that holding the power button for a second when turning on, brings out the lens. 

ok, more tests.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 09 / April / 2011, 19:29:52
whenever CHDK starts up on the 940, it is in playback mode.  Is that a feature of this camera (I can put it in record mode by hitting shutter to stop script, Alt to drop chdk menu, half press to go to record, alt to bring chdk back and full shutter to restart script.) 
I've also found that holding the power button for a second when turning on, brings out the lens. 
Normal behavior for a CHDK camera.  The playback button gets you playback mode.  A short press on the ON/OFF button gets you playback mode.  Hold the ON/OFF button for more than one second and you are in shooting mode.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: mgg on 09 / April / 2011, 21:28:27
I ran setmode.lua and got...


ixus120_sd940 103c CHDK 0.9.9-1133 Apr  9 2011 13:16:42 dryos 0x31e6
START                        |                    P   2 32772 STL
TRY                 AUTO   1 |                 AUTO   1 32768 STL  870ms OK
TRY                    P   2 |                    P   2 32772 STL 1110ms OK
TRY                   TV   3 |                    P   2 32772 STL 1010ms CHANGE FAIL req   3 got   2
TRY                   AV   4 |                    P   2 32772 STL  970ms CHANGE FAIL req   4 got   2
TRY                    M   5 |                    P   2 32772 STL 1100ms CHANGE FAIL req   5 got   2
TRY             PORTRAIT   6 |                    P   2 32772 STL  890ms CHANGE FAIL req   6 got   2
TRY            LANDSCAPE   8 |                    P   2 32772 STL  970ms CHANGE FAIL req   8 got   2
TRY            VIDEO_STD   9 |                    P   2 32772 STL  970ms CHANGE FAIL req   9 got   2
TRY               STITCH  15 |               STITCH  15 33290 STL  990ms OK
TRY             SCN_SNOW  22 |             SCN_SNOW  22 16404 STL  550ms OK
TRY            SCN_BEACH  23 |            SCN_BEACH  23 16405 STL  350ms OK
TRY         SCN_FIREWORK  24 |         SCN_FIREWORK  24 32790 STL  390ms OK
TRY     SCN_COLOR_ACCENT  25 |     SCN_COLOR_ACCENT  25 16923 STL  370ms OK
TRY       SCN_COLOR_SWAP  26 |       SCN_COLOR_SWAP  26 16924 STL  370ms OK
TRY         SCN_AQUARIUM  28 |         SCN_AQUARIUM  28 32792 STL  320ms OK
TRY      SCN_NIGHT_SCENE  30 |      SCN_NIGHT_SCENE  30 16398 STL  340ms OK
TRY         SCN_ISO_3200  31 |         SCN_ISO_3200  31 16413 STL  330ms OK
TRY       NIGHT_SNAPSHOT  36 |       NIGHT_SNAPSHOT  36 32779 STL  310ms OK
TRY          SCN_FOLIAGE  38 |          SCN_FOLIAGE  38 32787 STL  310ms OK
TRY           SCN_INDOOR  40 |           SCN_INDOOR  40 16401 STL  340ms OK
TRY               SPORTS  53 |               SPORTS  53 33287 STL  670ms OK
TRY           SCN_SUNSET  55 |           SCN_SUNSET  55 16402 STL  710ms OK
TRY                    P   2 |                    P   2 32772 STL  340ms OK
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: mgg on 09 / April / 2011, 21:47:33
Perhaps newer cameras work that way. My sd400's power on in record mode.  I can live with it.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 09 / April / 2011, 22:49:11
Perhaps newer cameras work that way. My sd400's power on in record mode.  I can live with it.
Understood, and CHDK source code is available at http://tools.assembla.com/svn/chdk/ (http://tools.assembla.com/svn/chdk/) for anytime you would like to change things to more closely suit your taste. The SD940 is my only CHDK camera so my frame of reference is limited by what I have been able to get working.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 09 / April / 2011, 22:53:41
I ran setmode.lua and got...
Cool - except that I have no idea what it means or what you want to know. 

Looks like most stuff worked and some stuff didn't ?  Would be nice to better understand how the whole mode thing works - I suspect its a question of mapping what the Digic IV cameras want / return rather than any bug in the SD940 port.   If you can work through this and provide an updated cross reference for current cameras that would be really good.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 10 / April / 2011, 00:59:44
Looks like most stuff worked and some stuff didn't ?  Would be nice to better understand how the whole mode thing works - I suspect its a question of mapping what the Digic IV cameras want / return rather than any bug in the SD940 port.   If you can work through this and provide an updated cross reference for current cameras that would be really good.
The script at http://tools.assembla.com/chdk/browser/trunk/CHDK/SCRIPTS/TEST/setmode.lua (http://tools.assembla.com/chdk/browser/trunk/CHDK/SCRIPTS/TEST/setmode.lua)

See also http://chdk.wikia.com/wiki/Lua/Scripts:Standard/Test/Setmode (http://chdk.wikia.com/wiki/Lua/Scripts:Standard/Test/Setmode)

Essentially, it tries to set all the modes listed in the cameras modemap and then get the current mode to verify it was set. Failures indicate your modemap contains modes which don't exist on your camera. This doesn't have anything to do with propsets or digic X vs. digic Y.

Code: [Select]
TRY                    P   2 |                    P   2 32772 STL 1110ms OK
TRY                   TV   3 |                    P   2 32772 STL 1010ms CHANGE FAIL req   3 got   2
TRY                   AV   4 |                    P   2 32772 STL  970ms CHANGE FAIL req   4 got   2
TRY                    M   5 |                    P   2 32772 STL 1100ms CHANGE FAIL req   5 got   2
TRY             PORTRAIT   6 |                    P   2 32772 STL  890ms CHANGE FAIL req   6 got   2
TRY            LANDSCAPE   8 |                    P   2 32772 STL  970ms CHANGE FAIL req   8 got   2
TRY            VIDEO_STD   9 |                    P   2 32772 STL  970ms CHANGE FAIL req   9 got   2
TRY               STITCH  15 |               STITCH  15 33290 STL  990ms OK
So, P was OK. Tv through VIDEO_STD were not. Tv, Av and M wouldn't be expected to exist on a camera without a real aperture, so they shouldn't be in the modemap. The other failures might not exist, or have the wrong canon mode value in the modemap.

To correct the modemap, look at the canon manual to find the actual modes available, and find the corresponding propcase values using the propcase display, or the modelist found in canon ROM. Most ports have a reference to the address of this table in shooting.c (because I went through every single port and found them when I implemented mode switching >:( edit: history http://chdk.setepontos.com/index.php?topic=3228.30 (http://chdk.setepontos.com/index.php?topic=3228.30) )
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: mgg on 10 / April / 2011, 09:04:24
Fraser McCrossan's lua time lapse script works fine on the 940!

now on to porting my code.
Title: Re: SD940 (IXUS120) porting thread [Alpha version for f/w 1.01A ready]
Post by: waterwingz on 10 / April / 2011, 12:03:53
are you planning port CHDK for firmware GM1.01A? Thank you!
Try this :
http://www.box.net/shared/yfhnxbj32a (http://www.box.net/shared/yfhnxbj32a)
You should be able to get the CHDK logo to show and the menus to work.  Shooting functions not implemented yet - I need somebody to test this and report back so that I know my porting utility is working.

Thanks.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 11 / April / 2011, 20:47:05
Updates to all firmware versions now in the autobuild server to patch for crashing on startup. More information at :

http://chdk.setepontos.com/index.php?topic=6179.msg62619#msg62619 (http://chdk.setepontos.com/index.php?topic=6179.msg62619#msg62619).
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 11 / April / 2011, 21:06:44
Sweet! looks good so far...
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 13 / April / 2011, 14:40:54
hi waterwingz
i have the canon ixux120 with firmware GM1.01A
i ve download the chdk http://www.box.net/shared/yfhnxbj32a (http://www.box.net/shared/yfhnxbj32a) from previous post
i can see the logo of chdk when i turn on the camera in playback mode, in shoot mode the optic doesent come out.
the camera semms to stay always in playback mode, i can enter and change values in chdk menu, but cannot take pic or go in shoot mode
let me know if u need more information

Gesualdo

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / April / 2011, 18:40:45
in shoot mode the optic doesent come out.
Hold down the On/Off button on the top of the camera (the shoot button) for 2 seconds and the camera should startup in shooting mode.   Or half-press the shutter release button when in playback mode and the camera should switch to shooting mode.

Title: Re: SD940 (IXUS120) porting thread [beta release 2 for 1.01A firmware]
Post by: waterwingz on 13 / April / 2011, 19:47:53
New version of CHDK for IXUS120 SD940 1.01A firmware now available at :

http://www.box.net/shared/mpb4zru12e (http://www.box.net/shared/mpb4zru12e)

All code complete, everything should now work but this is completely untested (as I do not have a camera with this firmware version).



Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 13 / April / 2011, 20:59:12
New version of CHDK for IXUS120 SD940 1.01A firmware now available at :

http://www.box.net/shared/mpb4zru12e (http://www.box.net/shared/mpb4zru12e)

All code complete, everything should now work but this is completely untested (as I do not have a camera with this firmware version).





ok i ve tryed this version,
zoom in video mode and works
histogram is showed
raw shoots but photoshop desent open it even if i rename file in raf
zebra works
changing language works, i ve switched to italian
lol the battery has left me, i ll go to sleep now, tomorrow afterwork i will continue testing

ps, the chdk menu disappear sometimes from screen but when i press down or up in joypad it appear, seems have some problem when original canon firmware draw something on screen like focus point etc
see you tomorrow and tnx very much for this firmware
 
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / April / 2011, 21:09:51
Sounds like good news !

raw shoots but photoshop desent open it even if i rename file in raf
I don't think I checked the raw buffer address - it might be using the address from the 1.03C.  I'll look at it tonight.

UPDATE :  RAW buffer is correct.  Have you read the various posts on this forum about how CHDK RAW is not a standard format so you have to use "special" software to decode it ?
http://chdk.setepontos.com/index.php?topic=1532.0 (http://chdk.setepontos.com/index.php?topic=1532.0)


ps, the chdk menu disappear sometimes from screen but when i press down or up in joypad it appear, seems have some problem when original canon firmware draw something on screen like focus point etc
This has been reported here before and my camera does the same thing as well.  Apparently this is normal behavior for CHDK and a know limitation with no fix.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 13 / April / 2011, 22:38:04
last report and then i ve really go to sleep
as i write to u in email i still have problem with raw, now i can open in photoshop but the pic seems to be taken with a fish eye.

i ve tryed to use scripts, the one i ve used is http://chdk.wikia.com/wiki/UBASIC/Scripts:_Ultra_Intervalometer (http://chdk.wikia.com/wiki/UBASIC/Scripts:_Ultra_Intervalometer) works fine on my cam takes shoots in raw and in jpeg without problem

ps: the chdk battery level indicator is always at 0% the canon one works fine
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / April / 2011, 22:51:21
li still have problem with raw, now i can open in photoshop but the pic seems to be taken with a fish eye.
If you search this forum for discussions about CHDK RAW format, you will discover that Canon cameras do a lot of optical correction to each image before storing the image as a JPG on the card.  What you get with the CHDK RAW is the just that - the raw image before any processing.  The fish eye you are seeing is worst when you have the zoom set for wide angle - you can obtain software that will let you correct that.

Take a look at : http://chdk.setepontos.com/index.php?topic=6146 (http://chdk.setepontos.com/index.php?topic=6146)


ps: the chdk battery level indicator is always at 0% the canon one works fine
You need to go into the setup menu and enter min & max values for the battery gage.  

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 17 / April / 2011, 06:18:09
sorry for the deley waterwingz but i m moving from my house in this days.
ok news,
cannot see the preview pic after shoot, i ve to go in play mode

shutter speed changing works
nd filter works
override shutter speed works
bracketing in continous mode works
force manual flash works

video parmas changing, zoom during shoot, focus dirung shoot, works

let me know if u need some specific test
ps even the games works :)
tnx for ur work
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 17 / April / 2011, 09:22:57
If you search this forum for discussions about CHDK RAW format, you will discover that Canon cameras do a lot of optical correction to each image before storing the image as a JPG on the card.  What you get with the CHDK RAW is the just that - the raw image before any processing.  The fish eye you are seeing is worst when you have the zoom set for wide angle - you can obtain software that will let you correct that.

Take a look at : http://chdk.setepontos.com/index.php?topic=6146 (http://chdk.setepontos.com/index.php?topic=6146)

the raw image before any processing

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi52.tinypic.com%2F21jsvbc.jpg&hash=959c3073684298feb5c77a74ba13d3a9)
Title: Re: SD940 (IXUS120) porting thread [1.01a now in the autobuild server]
Post by: waterwingz on 17 / April / 2011, 19:03:27
Firmware 1.01A is now supported in the autobuild server - thanks reyalp for adding the update!  Also thanks to forum members gesualdo and zawin for testing out this version and reporting back to me with details.

Total time to do the port was about six hours.  Once I finish up the GUI for my tools I'll post them in this forum.  Porting across firmware versions is nowhere near as hard as starting fresh with a new camera - especially if you have never done this before.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 18 / April / 2011, 03:46:49
tnx to you Waterwingz, i made the easy part, testing :)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: zawin on 18 / April / 2011, 06:03:33
Thank you very much :)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 24 / April / 2011, 22:10:28
IXUS120-SD940 owners - the last few updates in the autobuild server contain a number of bug fixes specific to these cameras.  Its probably worth your time to download the latest version and update your camera.
Title: Firmware Dumping 1.00e
Post by: trogg on 02 / May / 2011, 07:35:15
Hi there.

Congrats on the great work. I've got a 1.03B (working great) and now a 1.00e (not yet ported)

My plan is to creat a 3d SDM rig with the two cameras so a 1.00e port would be awesome.

I've tried using CardTricks to dump the firmware but it didn't seem to work - turned on in playback mode and the camera does seemingly nothing (a good thing I think) left for a couple of minutes.  CardTricks says no valid data and bintext shows no strings in empty.dum

What's the best way of dumping a 120IS?

I'm a C# developer with some past assembler and C background. I don't have much spare time these days but when I do I would happily get involved.

All the best.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 02 / May / 2011, 08:00:14
@Trogg : Where in the world did you drag up a 1.00E ?

What's the best way of dumping a 120IS?
Hands down, this is what you need:
http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Dumper (http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Dumper)
I  have not tried the latest version but text color was wrong on the original version so I did this, which should work for you:
http://chdk.setepontos.com/index.php?topic=4310.msg57252#msg57252 (http://chdk.setepontos.com/index.php?topic=4310.msg57252#msg57252)


I'm a C# developer with some past assembler and C background. I don't have much spare time these days but when I do I would happily get involved.
Well, here's something I just happen to be working on.  The paint is still wet but you get the idea.  If it seems interesting and you want a prerelease copy them PM me and we can go from there :
http://chdk.wikia.com/wiki/CHDK-PT_:_A_tool_for_porting_different_firmware_versions_on_the_same_camera (http://chdk.wikia.com/wiki/CHDK-PT_:_A_tool_for_porting_different_firmware_versions_on_the_same_camera)

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: IOOI on 02 / May / 2011, 19:17:39
Another beta release for firmware 1.03B - but this time I think I might have it fixed !   
Turns out we do  have it fixed!
I have version ixus120_sd940-103b-0.9.9-1114-full-rev3 successfully installed on my 103b. Now I am ready for tests. There seems to be quite a lot what I could test but maybe you're interested in some dedicated tests of certain things. Let me know!
I would suggest just using the CHDK features that interest you the most and let us know how that goes?  Bug reports are good - reports of success are good too.   Right now it would be nice to know which scripts (BASIC and/or LUA) are working well with the SD940 if you want to search this forum and the wiki for things to try out ?



I'll downloaded release ixus120_sd940-103b-0.9.9-1165-full_BETA on sunday. This fixed a bug of ixus120_sd940-103b-0.9.9-1114-full-rev3 where image numbering started from IMG_0001 every time I switched the camera on by creating consecutive folders like "134___04", "134CANON", the next time "135___04", "135CANON" and so on. Manually loading CHDK, using the "PS.FI2" file now also works like a charm. Keep up the good work!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 07 / May / 2011, 06:16:06
Battery is always showing up as 0%, red, and empty.
Using the latest release (downloaded today 0.9.9.1176).
Firmware is 1.01A.

is there a fix for this/are you planning on fixing it?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 07 / May / 2011, 07:21:20
Battery is always showing up as 0%, red, and empty.
Using the latest release (downloaded today 0.9.9.1176).
Firmware is 1.01A.

is there a fix for this/are you planning on fixing it?
See if this works :
http://chdk.setepontos.com/index.php?topic=5855.msg59495;topicseen#msg59495 (http://chdk.setepontos.com/index.php?topic=5855.msg59495;topicseen#msg59495)

I know where to change the defaults in the code - just haven't yet take the time to watch a battery run down from full charge to empty to see what to set them to.  I'll look at it today.

Edit :  default value now fixed and released effective trunk 1177 - see note from reyalp below though for warning.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 07 / May / 2011, 16:47:36
Battery is always showing up as 0%, red, and empty.
Using the latest release (downloaded today 0.9.9.1176).
Firmware is 1.01A.

is there a fix for this/are you planning on fixing it?
Just FWIW, you can adjust the battery thresholds yourself in the menu. This also means that if the defaults are changed in code, you one see the change without resetting the CHDK configuration file.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 07 / May / 2011, 20:29:36
The new build (1177) still doesnt fix it.
I manually changed the values to 4250 max and 3500 min, and now it works, but how do i know that that is an acurate reading?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 07 / May / 2011, 20:40:33
The new build (1177) still doesnt fix it.
I manually changed the values to 4250 max and 3500 min, and now it works, but how do i know that that is an acurate reading?
Read the post from reyalp above .. I think the new build does fix it, but you already have the old default values in your CCHDK.CFG file.

As far as accurate 0-100% readings go ... that depends on the age of your battery and where you got it from (Canon or after-market).  In other words,  there is no "accurate" reading for battery status displayed in "percent" mode.  The best you can do is set a range - I have four batteries and they all vary a bit on the voltage they deliver when fully charged and when discharged. One option is to change your OSD to display in volts rather than percent.

There are a whole lot of other CHDK things to explore that are even more vague than this - welcome to the world of CHDK.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 08 / May / 2011, 01:56:55
So from reading reyalp's post, i assume that i should charge my battery full, see what the voltage is then, set that as the max, and then let it drain all the way down, and get the value of the battery just before it dies, and then use that as the min value?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 08 / May / 2011, 02:31:07
So from reading reyalp's post, i assume that i should charge my battery full, see what the voltage is then, set that as the max, and then let it drain all the way down, and get the value of the battery just before it dies, and then use that as the min value?
That ensures that it uses the full scale, but as waterwingz says, it can vary between battery, on temperature etc. The whole thing is a crude approximation.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 09 / May / 2011, 08:00:19
Thanks for that ^.

Another small issue, in video mode, the remaining time and space thingie only updates every 15-20 seconds, whereas on the older builds, it was updating live...
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 09 / May / 2011, 09:16:43
Another small issue, in video mode, the remaining time and space thingie only updates every 15-20 seconds, whereas on the older builds, it was updating live...
I don't believe that anything has changed in the SD940 specific code that would cause this so it would have to be something in the core.  I wonder if other cameras are seeing this.

Do you happen to know the build number of a older build that worked properly ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 10 / May / 2011, 00:40:49
Another small issue, in video mode, the remaining time and space thingie only updates every 15-20 seconds, whereas on the older builds, it was updating live...
I don't believe that anything has changed in the SD940 specific code that would cause this so it would have to be something in the core.  I wonder if other cameras are seeing this.

I don't experience this issue with build 1176 on the 1.03b.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 12 / May / 2011, 04:29:57
I realised it was because the refresh rate was set to 20 (seconds).

Now i'm having a different problem: Vieo stops after 10 -20 seconds, with no script running, and an empty 4GB memory card!!
Im downgrading to an older build, because i need zoom in video for a trip tommorow, and i cant video if it cuts out every ten secs.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / May / 2011, 03:02:23
I realised it was because the refresh rate was set to 20 (seconds).
Ah yes - PEBKAC.   That happens sometimes.

Now i'm having a different problem: Vieo stops after 10 -20 seconds, with no script running, and an empty 4GB memory card!!
Im downgrading to an older build, because i need zoom in video for a trip tommorow, and i cant video if it cuts out every ten secs.
Just tried this with builds 1176 and 1184 using an SD940 with firmware 1.03C.  Shot a couple of boring 5 minute videos using the default Canon and CHDK settings.  Everything worked fine on record and playback.  So it seems that :

1) There might be a bug in the 1.01A version of CHDK for the SD940.  I suppose its possible except that its basically the same code in both versions (as I did both ports) and nothing has changed that I know of related to video since code that you state works okay.

2) You might be using a feature that I didn't use ?  How did you setup CHDK video ?

3) You might have a bad SD card - or at least one that is not formatted correctly.  That has turned out to be the root cause of a number of strange problems reported on this forum.

Did reverting to an earlier version help out ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 14 / May / 2011, 09:45:13
I was doing a normal video. Optical zoom and change quality in video were both selected.
I'm using a 4GB Class 2 Micros SD in an adapter. I'll format it and reload CHDK. The older version did not fix the problem.
edit: Formatted. Problem still occuring. Now video goes for about 6-10 seconds.

Also, force manula flash does not work, both in Auto mode and P. All the other overrides work fine. I tried with power set to 0, 1 and 2, and even turned on the canon flash, but that just resutled in a normal flash firing. According to the users guide, the flash should still fire even if in the canon interface flash is turned off.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: whim on 14 / May / 2011, 10:37:11
@Maron

From the manual (p. 32 English)
Quote
Recording may stop even if the maximum clip length has not been reached on
some memory cards. SD Speed Class 4 or higher memory cards are recommended.

HTH,

wim
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 14 / May / 2011, 10:56:11
Optical zoom and change quality in video were both selected.
I'm using a 4GB Class 2 Micros SD in an adapter.
Tried changing the Video Mode to "Quality" per your comment.  If I then set the Video Quality to anything higher than 80, the video times out as you have reported and the higher the setting,  the faster the time out.  But this is on a "no name" el-cheapo SD card so I'm pretty sure it does meet Class 4 specs as mentioned in whim's post.

EDIT :  So the conclusion is that as the video quality is increased,  the camera via CHDK needs to be able to write to the SD card more quickly.  A fast SD card is required for "best" quality shooting.

Quote
Also, force manula flash does not work, both in Auto mode and P. All the other overrides work fine. I tried with power set to 0, 1 and 2, and even turned on the canon flash, but that just resutled in a normal flash firing. According to the users guide, the flash should still fire even if in the canon interface flash is turned off.
I'll take a look at this.  I remember testing this during the initial release test and confirming that it was working but that was quite a while ago so who knows ?



Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 15 / May / 2011, 01:17:59
You are right about the quality vs default. i chagned it back to default and now there is no problem. Thanks for that!
Regarding using a Class 2, i've never had a problem with it (till now), and its SanDisk, so it does work. (I paln on upgrading to 16gb Class 6+ spometime soon, as Ted's is offering a 20% discount for members...)

Just downloaded 1187. Any major fixes?
Also, i was reading the users manual the other day, and i saw that some cameras let you take photos while videoing. Is it possible with the 120?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 15 / May / 2011, 03:48:16
Regarding using a Class 2, i've never had a problem with it (till now), and its SanDisk, so it does work.
Its not really a problem with the card - its just that class 2 cards are slow.  When you try for higher quality video,  there is more data to write to the card every second and a class 2 card runs out of speed at some point.   The SD card class tells you how fast the camera can write data to the card.  If the camera trys to record data faster than it can write it out to the card, then recording will stop.  A class 2 card is half the speed of a class 4 card, a third the speed of a class 6 car and a fifth the speed of a class 10 card. 
http://en.wikipedia.org/wiki/SD_card#Speed_Class_Rating (http://en.wikipedia.org/wiki/SD_card#Speed_Class_Rating)
Quote
Just downloaded 1187. Any major fixes?
Not sure how to answer that - it depends on which version you are using previously.  Probably not though - lots of the trunk updates are for small changes or fixes to other cameras.  Occasionally something important changes though so getting a new version from time to time is a good idea.  Or you could register for to be notified with each update if you like receiving a lot of email.

Quote
Also, i was reading the users manual the other day, and i saw that some cameras let you take photos while videoing. Is it possible with the 120?
Not that I know of, but I didn't realize it was possible with any of the cameras either. (manual ?  read the user's manual ?  :-[ )

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 15 / May / 2011, 04:51:47
My plan is to creat a 3d SDM rig with the two cameras so a 1.00e port would be awesome.
Here you go - at least I think so as I don't have a 1.00e camera to test this with.

IXUS120SD940 Firmware 1.00e (http://www.box.net/shared/do8bncz7mg)

Let me know how it goes ?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: eincognito on 15 / May / 2011, 10:51:49
Also, force manula flash does not work, both in Auto mode and P. All the other overrides work fine. I tried with power set to 0, 1 and 2, and even turned on the canon flash, but that just resutled in a normal flash firing. According to the users guide, the flash should still fire even if in the canon interface flash is turned off.
I'll take a look at this.  I remember testing this during the initial release test and confirming that it was working but that was quite a while ago so who knows ?

Manual flash works in 1.03b.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 15 / May / 2011, 19:09:03
Here you go - at least I think so as I don't have a 1.00e camera to test this with.
IXUS120SD940 Firmware 1.00e (http://www.box.net/shared/do8bncz7mg)
Great stuff Waterwingz. I should be able to test monday evening. Many Thanks.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 16 / May / 2011, 03:50:29
Not that I know of, but I didn't realize it was possible with any of the cameras either. (manual ?  read the user's manual ?  :-[ )

Page 16 in the CHDK user guide says somethign about the S series being able to take photos whiel videoing by using a dedicated video record button. I know the 120 doesnt have one, but is it still possible?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 16 / May / 2011, 09:59:11
Manual flash works in 1.03b.

Confirmed for the 1.03c tonight - works fine at changing the flash power although it appears that you can force the flash off with the Canon setting regardless of the CHDK setting. 

Triple checked the address for FlashParamsTable in stubs_min.S for the 1.01a and it looks okay.

Not sure what else I can do at this point.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: schunta1 on 20 / May / 2011, 02:09:04
Greetings, I am new to CHDK as well as this forum, so please have patience with my ignorance.

I am trying to use the Remote function in conjunction with a product made for kite aerial photography, the "clickPAN-USB" (http://www.gentles.ltd.uk/clickpan/usb.htm (http://www.gentles.ltd.uk/clickpan/usb.htm)), which is supposed to trigger the shutter release via the USB cable. When it actuates, the camera acts as though the shutter release button has been pushed halfway down, causing the camera to focus rather than actually taking a picture. Is there any hope of making this device work so that it remotely triggers a shot rather than just the focusing mechanism?

A second, somewhat unrelated question: I have looked for a script for an intervalometer for the SD940 and haven't found one. I suspect I'm looking in the wrong place; could someone direct me if one does exist?

If it helps, my camera's firmware is 1.03b (filename of the version I am running is "ixus120_sd940-103b-0.9.9-1177-full_BETA").

Thanks for your attention.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: zeno on 20 / May / 2011, 04:33:06
Here's a simple test script for the click-pan (make sure enable remote is on):
Code: [Select]
rem test usb
while 1
   do
      a = get_usb_power
   until a > 0
   print "take a picture"
   shoot
   sleep 500
wend
end

and here's a simple intervalometer:

Code: [Select]
@title Simple Intervalometer
@param i Interval (Secs)
@default i 5
@param d Delay before start (Secs)
@default d 2

sleep 1000*d
while 1
   shoot
   sleep i*1000
wend
end
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 20 / May / 2011, 09:21:58
When it actuates, the camera acts as though the shutter release button has been pushed halfway down, causing the camera to focus rather than actually taking a picture. Is there any hope of making this device work so that it remotely triggers a shot rather than just the focusing mechanism?
Take a look at the four postings in this thread starting at :  http://chdk.setepontos.com/index.php?topic=5855.msg60212#msg60212 (http://chdk.setepontos.com/index.php?topic=5855.msg60212#msg60212).   Should point you in the right direction..

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: schunta1 on 21 / May / 2011, 01:32:11
zeno, thanks for the scripts and waterwingz, thanks for the additional info.

The intervalometer works great, but unfortunately my setup appears to fail the click-pan test. I have the remote enabled, I load the script, and while in <Alt> mode I switch on the power to the click-pan, wait, and I don't see anything happening. Am I missing something?

Regarding

So by plugging the USB cable in and out twice I can get the shutter to fire in non-scripted mode if I get the timing right.  Good enough for me - I'm going to declare the remote feature working on this port.


I can get the same thing to work-- in non-scripted mode, plugging in/out the USB cable twice pretty fast will cause the camera to take a picture. I see in the CHDK manual that the half shutter-press reaction to a quick press of the remote is normal behavior. Unfortunately, in my case I'm not manually pushing a remote shutter button (if I were I could just push it twice). The control of the remote is automated by the click-pan.

Looks like I need to explore options besides the remote function/click-pan combination.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 21 / May / 2011, 04:16:39
The intervalometer works great, but unfortunately my setup appears to fail the click-pan test. I have the remote enabled, I load the script, and while in <Alt> mode I switch on the power to the click-pan, wait, and I don't see anything happening. Am I missing something?  If it does not generate a double pulse,  how does it take a picture ?

The IXUS120 is not listed on the click-pan web site.  But as far as I know,  the code it uses for USB remote is identical to that used by all the supported cameras.  Which makes me wonder how it works with something like the IXUS100 for example ?

From http://www.gentles.ltd.uk/gentwire/chdk_sdm/index.htm (http://www.gentles.ltd.uk/gentwire/chdk_sdm/index.htm) it says "Note that the latest builds of CHDK and SDM have this functionality built in - i.e. You don't need a script to take a picture"   There are also some sample scripts listed there - did you try any of them ?



Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 21 / May / 2011, 05:58:37
Sorry for interrupting this conversation, but I just brought myself a 16gb card,  and i recall everyone saying that you have to partition it in order for anything more than 4GB to work. I just copied the CHDK files from my old card to the new one, loaded it thru the firm update, and it runs fine. I took a few photos and a video just to make sure it would write, and it did. (The only gripe is that the capacity thingie at the top says 14GB, and I would prefer and amount in MB's.)
Am i missing something, or is this the first time that someone has successfully loaded CHDK to a more-than-4gb-card-without-partitions...? (or was it always possible?)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 21 / May / 2011, 06:25:07
Am i missing something, or is this the first time that someone has successfully loaded CHDK to a more-than-4gb-card-without-partitions...? (or was it always possible?)
Its because you are using the "firmware update" method of loading rather then using a bootable SD card.

You only need to fool around with partitions if you want to create a bootable card.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: schunta1 on 21 / May / 2011, 12:09:57
From http://www.gentles.ltd.uk/gentwire/chdk_sdm/index.htm (http://www.gentles.ltd.uk/gentwire/chdk_sdm/index.htm) it says "Note that the latest builds of CHDK and SDM have this functionality built in - i.e. You don't need a script to take a picture"   There are also some sample scripts listed there - did you try any of them ?
I hadn't seen that page with the sample scripts until you mentioned it, but I then did try the Remoteshutter.bas script with no luck. The camera doesn't appear to respond in any way to the click-pan's signal when running the script (i.e. not even initiate the half-press focusing behavior, which it does when only running CHDK with Remote enabled and no script).

Yep, I had found earlier that the IXUS120 isn't listed on the click-pan website when I started troubleshooting. Rather than give up at that point I thought I'd try asking to see if anyone could point to a work-around, but looks like my best bet will be to use an intervalometer in place of remote shutter firing. 
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 21 / May / 2011, 12:22:37
The camera doesn't appear to respond in any way to the click-pan's signal when running the script (i.e. not even initiate the half-press focusing behavior, which it does when only running CHDK with Remote enabled and no script).

Yep, I had found earlier that the IXUS120 isn't listed on the click-pan website when I started troubleshooting. Rather than give up at that point I thought I'd try asking to see if anyone could point to a work-around, but looks like my best bet will be to use an intervalometer in place of remote shutter firing.  
Interesting.  I'll take a look (or at least put it on my list of 3 or 4 things that don't seem quite right with the IXUS120).  No promises but this is one of the things I want to see work with the camera so I should have an answer in the next week or two (other work permitting).

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: schunta1 on 21 / May / 2011, 12:44:19
Thanks. I appreciate your suggestions so far.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 22 / May / 2011, 05:36:14
Here you go - at least I think so as I don't have a 1.00e camera to test this with.
IXUS120SD940 Firmware 1.00e (http://www.box.net/shared/do8bncz7mg)
Great stuff Waterwingz. I should be able to test monday evening. Many Thanks.

Wow that works a treat! Nice one.

I Haven't used it in anger yet but it seems the same as my 1.03b. Did your porting app work smoothly?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 22 / May / 2011, 16:26:05
Wow that works a treat! Nice one.
I Haven't used it in anger yet but it seems the same as my 1.03b. Did your porting app work smoothly?

Submitted a patch file to add the 100e to the autobuild server.  I believe this means that all know firmware versions of the SD940 are now supported.

Using CHDK-PT got the process of porting to a different firmware version down to a couple of hours.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: msl on 23 / May / 2011, 05:18:36
Hi waterwingz,

During the integration of the firmware version 100.e  in CHDK-DE I noticed the following difference:

Your adress: NSTUB(SetFileTimeStamp, 0xff9257d0)
My adress: NSTUB(SetFileTimeStamp, 0xff835640)

Can you please check this difference.

msl
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 23 / May / 2011, 07:55:28
During the integration of the firmware version 100.e  in CHDK-DE I noticed the following difference:

Your adress: NSTUB(SetFileTimeStamp, 0xff9257d0)
My adress: NSTUB(SetFileTimeStamp, 0xff835640)

Can you please check this difference.
I wonder if this is related to the recent changes in the findsig.c tool ?

The NSTUB values in stubs_entry.S are found automatically and your version automatically found a different value than my version.   In fact,  your version found the correct value - in my version I had to override the value of SetFileTImeStamp via an entry in stubs_entry_2.S with the correct 0xff835640 value.

The resulting executable code will be the same in both our versions.   The reason for the difference probably needs some attention.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: philmoz on 23 / May / 2011, 08:18:40
During the integration of the firmware version 100.e  in CHDK-DE I noticed the following difference:

Your adress: NSTUB(SetFileTimeStamp, 0xff9257d0)
My adress: NSTUB(SetFileTimeStamp, 0xff835640)

Can you please check this difference.
I wonder if this is related to the recent changes in the findsig.c tool ?

The NSTUB values in stubs_entry.S are found automatically and your version automatically found a different value than my version.   In fact,  your version found the correct value - in my version I had to override the value of SetFileTImeStamp via an entry in stubs_entry_2.S with the correct 0xff835640 value.

The resulting executable code will be the same in both our versions.   The reason for the difference probably needs some attention.


The changes to finsig.c were performance optimisations only - it did not affect the generated stubs.

CHDK-DE has differences in sig_ref_dryos_3.txt and sig_ref_dryos_1.txt. Two additional signatures exist in sig_ref_dryos_3.txt for CHDK-DE that are not in CHDK, one of which is SetFileTimeStamp.

This is why CHDK-DE is finding the correct signature match and CHDK is not.

Phil.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 31 / May / 2011, 03:42:35
Any updates on the manual flash not working on 1.01A?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 31 / May / 2011, 21:07:12
Any updates on the manual flash not working on 1.01A?
If there were updates,  they would have been posted here.

I tried changing the flash power on the 1.03c version and was able to get 3 very different pictures from an exposure point of view.   I won't bore you by posting pictures of my desk here.

I also checked the entry in stubs_min.S for FlashParamsTable.  The 1.01a entry from the table at 0xFFA759FC is 0xFFB972DC, matching the table entry of 0xFFB974C8 at 0xFFA75BE8 for the 1.03C.   I believe it is correct - the same analysis works for the other versions of the SD940.

This is the only thing related to the camera flash that I know of related to porting between firmware versions.   As the 1.03c works,  the 1.01a should too.   Without a camera with the 1.01a firmware to test with, that's the best I can do. 

Unless any of the other developers who monitor this forum have ideas ?
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 31 / May / 2011, 22:04:24
FWIW FlashParams is for parameters stored in onboard flash memory (see http://chdk.wikia.com/wiki/Params (http://chdk.wikia.com/wiki/Params) ) not the electronic strobe light.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 31 / May / 2011, 22:20:25
FWIW FlashParams is for parameters stored in onboard flash memory (see http://chdk.wikia.com/wiki/Params (http://chdk.wikia.com/wiki/Params) ) not the electronic strobe light.
Okay - wondered about that. 

So do you know if there is anything at all in stubs_entry.S, stubs_entry_2.S, stubs_min.S, lib.c,  boot.c, capt_seq.c or capture_seq.c that might be worth looking at to explain why manual flash control does not seem to work on 1 out of 5 firmware versions for the SD940.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 31 / May / 2011, 23:08:16
So do you know if there is anything at all in stubs_entry.S, stubs_entry_2.S, stubs_min.S, lib.c,  boot.c, capt_seq.c or capture_seq.c that might be worth looking at to explain why manual flash control does not seem to work on 1 out of 5 firmware versions for the SD940.
Not offhand, I haven't played with the manual flash stuff. I'd start by looking through the functions is uses and looking for differences in the functions and variables it uses from stubs.

The other thing to look out for is whether it interacts with some other settings (canon or CHDK), maybe it works the same on all versions but something you didn't expect to be related affects it.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: jabbawashere on 02 / June / 2011, 23:28:59
Hello all,

I just bought a SD940 from Sams Club and it's 1.00E.
I followed the instructions on the CHDK wiki and I had CHDK auto booting in no time flat.
My desire is to use exposure bracketing. I've tried with continuous drive and using the custom timer method - No luck. I get a bunch of pictures all with the same exposure.

Before I obsess and spend way to much time on this, Can someone verify bracketing actually works on the the SD940 with 1.00E
(Extra Photo Operations / Bracketing in continuous mode / TV bracketing value [] )

Thanks in advance.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 02 / June / 2011, 23:42:45
Before I obsess and spend way to much time on this, Can someone verify bracketing actually works on the the SD940 with 1.00E
(Extra Photo Operations / Bracketing in continuous mode / TV bracketing value [] )

Welcome to CHDK.  You might get a flood of responses to your post but I'm guessing probably not.  But then I've only been working on the SD940 port for the last 8 months so there is a lot I don't know.

Having said that, I do know it might not seem like a bit deal but the fact that you got CHDK loaded and mostly running is a big deal.  So many people fail before this point.  And quite frankly, there is a lot of CHDK that SD940 users have not tested.

So,  when I get a rare free minute,  I will try TV bracketing on my 1.03C port just to see what happens.  We can take it from there if you are up for it ?


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: jabbawashere on 03 / June / 2011, 00:32:50
the fact that you got CHDK loaded and mostly running is a big deal.
Waterwingz,
Thanks for the quick response. Reading through this thread beforehand was a big help. I've spent a lot of time with the AndroidOS and loading custom ROMS, so I was familiar with the basic concept of what was needed and why.

From what I've read in the past couple hours - I seems like it (TV bracketing) worked in 1.03C at some point  but not 1.00E. Maybe an address tweak is needed?

Let me know if I can do anything to help.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: white_58 on 03 / June / 2011, 07:45:49
Hi All,

A few friends and I are planning on launching a weather balloon to take some aerial shots and videos with our SD940.

I've been battling away writing a LUA script to automate the process and have finally (after many many hours) gotten it to work! It now alternates between periods of video, and periods of interval shots.... and even disables the screen to conserve battery life.

What I'm trying to do now is get it to use infinity focus mode (without CHDK, when the camera is in program mode, pressing 'right' will give you the option between macro, normal and infinity). But I can't seem to find any way of accessing this through script.

Any ideas?

Thanks!
Nathan
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 03 / June / 2011, 08:30:50
Any updates on the manual flash not working on 1.01A?
@Maron :  Please post the exact steps you follow when setting this  up in CHDK and I will take a look.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 03 / June / 2011, 08:35:42
What I'm trying to do now is get it to use infinity focus mode (without CHDK, when the camera is in program mode, pressing 'right' will give you the option between macro, normal and infinity). But I can't seem to find any way of accessing this through script.
I've wondered that myself but I have not found a way either.  However,  I did not look too hard.

How about posting the rest of your script - sounds like a really good one.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: white_58 on 03 / June / 2011, 20:21:48
Sure thing... It isn't great (so I'd appreciate any refinements, etc), but it is finally working!


Code: [Select]
--[[\
@title BalloonTimer - by Nathan White
@param k InitDelay --initial delay length
@default k 300
@param x InitVid -- launch video length (liftoff)
@default x 300
@param a LoopDelay -- Delay before moving into the loop
@default a 600
@param b Pduration --Duration of stills cycle
@default b 300
@param c Pinterval -- Time between stills
@default c 5
@param d Vduration -- Duration of video
@default d 120
@param e backlight: 0=Off 1=On
default e 0
@param p printf --toggle print to screen
@default p 0
@param l logf --toggle print to log file
@default l 1
@param n Pmode: 1=Auto 2=Program 8=Landscape
@default n 2
--]]

--This is a script designed for a near-space balloon launch using our SD940 IS
--It alternatives between video and stills, and turns the backlight off to conserver battery
--Would like to set it to infinity focus mode, but havent found a way yet
--Hopefully "landscape" mode will favour long focal distances.

capmode=require("capmode")
props = require("propcase")

logname = "A/BalloonTimer.log"
log = io.open(logname,"wb")
if not log then
error("Failed to Open Log\n")
end

function printf(...)
if (p == 1) then --if we're writing to the screen
print(string.format(...))
end
if (l == 1) then --if we're writing to the log
log:write(string.format(...))
log:close()
log = io.open(logname,"ab")
end
end

function log_rec_change(rec) --switch between shoot and playback mode
local status_str, sleep_count
if rec then
printf("Leaving Playback Mode\n")
else
printf("Entering Playback Mode\n")
end
set_record(rec)
sleep_count = 0
while sleep_count < 100 do -- wait up to 10 seconds for function change
if (rec and get_mode()) or not (rec or get_mode()) then
break
end
sleep(100)
sleep_count = sleep_count + 1
end
if (rec and get_mode()) or not (rec or get_mode()) then
printf("Left Playback Mode, Success!\n")
elseif not (rec or get_mode()) then
printf("Entered Playback Mode, Success!\n")
else
printf("Display Mode Not Set!\n")
end
end

function change_mode(mCode) --change shooting mode (auto/program/video/etc)
local status, sleep_count, id

if mCode == "Picture" then --translate mCode into id value
id = n --photo mode
else
id = 9 --video
end

if not get_mode() then
log_rec_change(true)
end

printf("Changing to " .. mCode .. " mode\n")
status = capmode.set(id)
if status then
sleep_count = 0
while sleep_count < 100 do --wait up to 10 seconds for mode to change
if (capmode.get() == id) then
printf("Changed to " .. mCode .. " mode\n")
break
end
sleep(100)
sleep_count = sleep_count + 1
end
if capmode.get() ~= id then
printf("Could not change to " .. mCode .. " mode\n")
end
else
printf("Error setting " .. mCode .. " mode\n")
end
end

function delay_cycle(duration) --delay
printf("Delaying for " .. duration .. " seconds\n")
if e == 0 then --if we're turning the backlight off
set_backlight(0)
end
sleep(duration*1000)
end

function pic_cycle(duration, interval) --take photos for a specified duration with a specified interval between each
local numShots = duration/interval
local i = 0
change_mode("Picture")
sleep(1000)
printf("Will now shoot " .. numShots .. " shots\n")
while i < numShots do
printf("Shot " .. i+1 .. " of " .. numShots .. " \n")
shoot()
i = i + 1
if e == 0 then --if we're turning the backlight off (after shoot, it automatically turns back on)
set_backlight(0)
end
sleep(interval*1000)
end
end

function vid_cycle(duration) --take video for a specified duration
local sleep_count, status
change_mode("Video")
printf("Will now shoot " .. duration .. " seconds of video\n")
if e == 0 then --if we're turning the backlight off
set_backlight(0)
end
press("shoot_full")
sleep(300)
release("shoot_full")
sleep(duration*1000)
press("shoot_full")
sleep(300)
release("shoot_full")
while (get_movie_status == 4) do --needed this because sometimes it wouldnt stop recording without pressing the button a few times (weird)
printf("Video Termination Required")
sleep(1000)
if (get_movie_status == 4) then
press("shoot_full")
sleep(300)
release("shoot_full")
end
end
printf("Video Done\n")
end

--program runs as follows:
-- delay initially (once we press the shutter button because we need a few more minutes to setup the launch)
-- take a video of the launch (lift-off!)
-- transition into a cycle of video and photos until the battery runs out.

printf("***\n")
printf("** BEGIN **\n")
log_rec_change(true)

printf("***\n")
printf("** INITIAL DELAY **\n")
delay_cycle(k)

printf("***\n")
printf("** INITIAL LAUNCH VIDEO **\n")
vid_cycle(x)

printf("***\n")
printf("** VID/STILL CYCLE **\n")
local t = 1
while 0 < 1 do --loop forever
printf("Cycle " .. t .. " and counting\n")
delay_cycle(a)
pic_cycle(b, c)
sleep(5000)
vid_cycle(d)
t = t + 1
printf(" \n")
end
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 04 / June / 2011, 01:54:00
What I'm trying to do now is get it to use infinity focus mode (without CHDK, when the camera is in program mode, pressing 'right' will give you the option between macro, normal and infinity). But I can't seem to find any way of accessing this through script.
I've wondered that myself but I have not found a way either.  However,  I did not look too hard.
You may be able to set the focus mode propcase.

Failing that (if setting it is ignored), you can send key presses and watch the propcase until it is in the right mode.

Assuming the propset is correct, props.FOCUS_MODE should be the right one.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 04 / June / 2011, 05:08:26
Any updates on the manual flash not working on 1.01A?
@Maron :  Please post the exact steps you follow when setting this  up in CHDK and I will take a look.
Using build 1196.
Load CHDK manually (turn on in playback, firm update, etc)
Turn off canon flash.
Press DISP.
Press Menu.
Extra Photo Operations
Froce Manual Flash (check)
(Power of flash: 2)
Menu. (to exit the menu)
"Flash: Manual" is displayign in the override box.
Press DISP (to exit alt mode)
Press shutter halfway, (this might help:) the canon flash icon (zig-zag arrow) shows up as if the flash will fire even though the canon flash has been disabled
Depress shutter fully, takes a normal photo without flash.

The detaield camera veiw in palyback mode shows up with no flash symbol on it.

Hope you can help.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 04 / June / 2011, 16:50:30
<snip>
Turn off canon flash.
<snip>
Okay - using your sequence, the flash does not fire in manual mode for me either.

But why did you do the third step (above)- turn off canon flash.    If I leave the flash in Auto mode then enable manual flash in the CHDK menus, I can take pictures in a dark room at the three different manual levels and get three completely different levels of brightness.

So that part is okay - but if the camera does not think it needs to fire the flash when you have manual mode enabled,  it will not take a picture at all.

I think this is an issue with CHDK in general rather than the SD940 port.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Maron on 04 / June / 2011, 23:48:58
Oh, ok. Thanks for that.
I turned it off because i thought it might interfere, etc.
The reason i turned it off, is because i assumed that "override" mean override!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 10 / June / 2011, 09:56:13
Trunk revision 1202 has updated stubs_entry_2.S files for firmware 1.00e 1.01a 1.02c 1.03c.  Details at assembla (http://tools.assembla.com/chdk/changeset/1202/trunk)
Title: IXUS 120 IS, CHDK and USB_shutter_remote_cable
Post by: Jeppie on 11 / June / 2011, 15:45:57
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 21 / June / 2011, 20:13:15
Can someone verify bracketing actually works on the the SD940 with 1.00E
(Extra Photo Operations / Bracketing in continuous mode / TV bracketing value [] )

Hi there. I have a 1.00E and a 1.03B. I can confirm that bracketing does not work on the 1.00E and does work on the 1.03B in  I think it's something more fundamental because I can't get interval timers working either.

It seems that the script will stop working after a shoot command has been issued. No basic errors, CHDK thinks the script is still running because pressing the shutter again gives the *** INTERUPTED ***

The first shoot does work but nothing after that. It's like the scripting engine isn't getting a callback (although I have no idea what's going on under the hood)

This is the scipt I tried:

print "started"
sleep 3000
print "slept once, about to shoot..."
shoot                                                       -- shoot works but nothing below executes
print "shot once, gonna sleep"
sleep 3000
print "slept again, about to shoot..."
shoot

I've had loads of projects on lately so sorry I couldn't reply sooner.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 21 / June / 2011, 20:22:09
Hi there. I have a 1.00E and a 1.03B. I can confirm that bracketing does not work on the 1.00E and does work on the 1.03B in  I think it's something more fundamental because I can't get interval timers working either.
Three questions :
1) Do you have the latest builds from the autobuild server on both cameras ?
2) Does the script you tried work on the 1.03B but not the 1.00E ? Or not work on both cameras ?
3) Tell me more about interval timers ?  Do you mean the custom timer in the Canon menu or something in CHDK ?

TIA
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 22 / June / 2011, 19:32:16
Three questions :
1) Do you have the latest builds from the autobuild server on both cameras ?
2) Does the script you tried work on the 1.03B but not the 1.00E ? Or not work on both cameras ?
3) Tell me more about interval timers ?  Do you mean the custom timer in the Canon menu or something in CHDK ?

TIA

HI WaterWingz.

1) it's the respective 0.9.9-1206-full_BETA on both cameras. Downloaded at the weekend
2) works fine on 1.03b but not on 1.00e
3) Interval timers simply take a picture at a given interval. Great for time lapse etc. UltraInterval works well on 1.03b (get the later more compact version)

Basically the script will bomb out after a shoot is issued. If you have any pointers I could look at tweaking the port.

Many Thanks.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 22 / June / 2011, 21:24:19
Basically the script will bomb out after a shoot is issued.
hmmm ... tried the script on my 1.03c.   The second shoot never happens but the script does terminate.

Here's what worked better :

Code: [Select]
rem Test Shooting2
@title Shoot Test 
print "started - sleeping 2 seconds"
sleep 2000
print "sleep over, about to shoot..."
shoot                             
print "shot once, gonna sleep 2 seconds again"
sleep 2000
print "slept again, about to shoot again..."
shoot
print "shot again, gonna sleep 2 seconds again"
sleep 2000

Quote
If you have any pointers I could look at tweaking the port.
Not even sure where to begin.  I'll play a bit and get back to you here.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 23 / June / 2011, 15:15:20
hmmm ... tried the script on my 1.03c.   The second shoot never happens but the script does terminate.
Interesting. Both yours and mine work fine on the 1.03b but bomb out on the 1.00e. I wonder if the 1.03c has a similar problem with shoot? did your script execute both shoots on 1.03c? Have you tried ultraintervalometer by the way? a handy script to have.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 23 / June / 2011, 19:45:47
I wonder if the 1.03c has a similar problem with shoot? did your script execute both shoots on 1.03c?
I got both shoots on the 1.03c with my script.  With your script I only got the first shoot. 

Gives me some things to look into anyway.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 24 / June / 2011, 21:37:16
I wonder if the 1.03c has a similar problem with shoot? did your script execute both shoots on 1.03c?
I got both shoots on the 1.03c with my script.  With your script I only got the first shoot. 
Gives me some things to look into anyway.

@trogg : Rechecked the propset to confirm its 3 - used debugs to confirm that PROPCASE_RESOLUTION is 220 (rather than 218 in propset2 or 222 in propset4).   So that eliminates that.

Not sure if it matters but the modemap[] values have never been setup for the SD940.  Fixing that now.  Did you have the camera in Auto or Program mode for your tests ? (the three position vertical slide switch in the center right of the back of the camera).



Title: Re: SD940 (IXUS120) porting thread [pre-release of latest fixes available here]
Post by: waterwingz on 25 / June / 2011, 12:14:13
Interesting. Both yours and mine work fine on the 1.03b but bomb out on the 1.00e.
Using the new sigfinder code from philmoz,  I've updated all versions of the IXUS120-SD940.  Then now have new sig values for write & rename - basically "wrapper" functions higher up in the call sequence that seem to do a litttle more checking before acting.  The 100e has several fixes to its stubs_min.S file so let's see if that fixed the uBasic script issues.

IXUS120-SD940 firmware 1.00e (http://www.box.net/shared/3o03zazhdrszi94x3tg7)
IXUS120-SD940 firmware 1.01a (http://www.box.net/shared/c3puxpc2rntt5hvvkuu5)
IXUS120-SD940 firmware 1.02c (http://www.box.net/shared/t224mz9os2rsailulemo)
IXUS120-SD940 firmware 1.03b (http://www.box.net/shared/1aaomox9d0big6ufkrrh)
IXUS120-SD940 firmware 1.03c (http://www.box.net/shared/ojaxue6kfvdg7o05je1r)

Incidentally,  apparently uBasic scripts are supposed to have the command "End" as the last line in the .bas file.  Thanks to philmoz for that one too.

UPDATE : these changes now available through the autobuild server.

Title: Re: SD940 (IXUS120) porting thread [Time to graduate from Beta status ?]
Post by: waterwingz on 26 / June / 2011, 15:34:08
I've reviewed the IXUS120-SD980 CHDK code to try and determine if its time to recommend graduation from BETA status.  The code seems to be stable based my personal experience and on the lack of complaints over the last six months.  But there are still a few loose ends. 

I went through the code and looked for anything that has still not been tested / verified.  Most of what I found were things that were simply dragged in during the initial ports.  Here's the final list :

platform/ixus120_sd940/main.c : 
    fl_tbl[]
    CF_EFL
      
platform/ixus120-sd940/shooting.c
    #define PARAM_FILE_COUNTER      0x38          <=not used anywhere ?
    #define PARAM_EXPOSURE_COUNTER  0x02    <= not used anywhere ?
    aperture_sizes_table[]
    shutter_speeds_table[]
    iso_table[]

core/kbd.c :
    ZSTEP_TABLE_SIZE
    nTxtbl[]

platform/ixus120_sd940/sub/10xn/movie_rec.c :
    set_quality()
      
platform/ixus120-sd940/platform_camera.h
    cam_CFAPattern
    CAM_BITMAP_PALETTE
    CAM_COLORMATRIX1
    cam_CalibrationIlluminant1

There are some notes in the wiki on getting the values for shooting.c & main.c

ZSTEP_TABLE_SIZE & nTxtbl[]  seems to be a hack where any value will do ?

And while I may have other mistakes in platform_camera.h,  I'm lost as to what to use for the four values I've listed. 

Comments and suggestions welcome.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 26 / June / 2011, 16:02:15
fl_tbl should have the focal length of each zoom step. You can get this from exif. CF_EFL is the constant used to covert to 35mm equivalent (edit: with a constant multiplier, e.g. 10000 to make the calculation in get_effective_focal_length work nicely with integers)

ZSTEP_TABLE_SIZE etc should also match the number of zoom steps.

See http://chdk.setepontos.com/index.php?topic=6528.0 (http://chdk.setepontos.com/index.php?topic=6528.0) has a little information. I'm not suggesting using Phils code, just a reference.

If cam_CFAPatter is wrong, DNG will look very very wrong. If DNG looks reasonable, it's fine.

PARAM_FILE_COUNTER is used in generic/shooting.c - remember this is *included* from the platform shooting.c. Same for EXPOSURE_COUNTER. I highly recommend http://tools.tortoisesvn.net/grepWin.html (http://tools.tortoisesvn.net/grepWin.html) for finding stuff like this.

These are used for things like numbering the raw files.

aperture_sizes_table should be filled in using exif data, from each zoom step with and without ND filter.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 26 / June / 2011, 16:23:10
PARAM_FILE_COUNTER is used in generic/shooting.c - remember this is *included* from the platform shooting.c. Same for EXPOSURE_COUNTER. I highly recommend http://tools.tortoisesvn.net/grepWin.html (http://tools.tortoisesvn.net/grepWin.html) for finding stuff like this.
That's what I was using.  I didn't notice the shooting.c in the generic directory though - I did a scan of the grepWin output and missed it while ignored all the files named shooting.c  in the camera specific directories.  I'll refrain from comments about the naming conventions ....

The rest of your tips will also help a lot - I'll plug away at that. Thanks again.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: reyalp on 26 / June / 2011, 16:45:31
PARAM_FILE_COUNTER is used in generic/shooting.c - remember this is *included* from the platform shooting.c. Same for EXPOSURE_COUNTER. I highly recommend http://tools.tortoisesvn.net/grepWin.html (http://tools.tortoisesvn.net/grepWin.html) for finding stuff like this.
That's what I was using.  I didn't notice the shooting.c in the generic directory though - I did a scan of the grepWin output and missed it while ignored all the files named shooting.c  in the camera specific directories.  I'll refrain from comments about the naming conventions ....
I've done the same thing ....

I'm still not sure why the generic stuff is included rather than being compiled separately. Obviously these defines take advantage of that but that could just as well be a .h file...
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: philmoz on 26 / June / 2011, 19:02:21
   fl_tbl[]
    CF_EFL

Be careful with CF_EFL that you don't get integer overflow at the long end of the zoom range.

For fl_tbl[] there are three variants I've seen in the different ports:
- for cameras with a small number of zoom steps fl_tbl[] contains the actual camera focal length at each position, usually multiplied by 1000.
- for cameras with a large number of zoom steps fl_tbl[] contains on a subset of values spaced across the range and the code interpolates between them.
- for the G12 and SX30 I found the equivalent tables in the firmware so I use a stubs_min.S value to give the address of the firmware table and then use that in the CHDK code. I found these by searching the firmware for the shortest and longest focal lengths for each camera (multiplied by 1000). This saves space in CHDK (especially for the SX30 which has 201 zoom positions) and also means the table has the correct values without needing to extract the info from EXIF data, or interpolate values.

Phil.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: sevnthsin on 28 / June / 2011, 17:54:51
Just installed on my new SD940 IS and loads up beautifully. One question, I don't see Time Lapse in the build. Am I missing something or is there a script I can download somewhere? And help would be greatly appreciated.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 28 / June / 2011, 18:11:14
Just installed on my new SD940 IS and loads up beautifully. One question, I don't see Time Lapse in the build. Am I missing something or is there a script I can download somewhere? And help would be greatly appreciated.
Its done with scripts.  Search this forum and the wiki for Intervalometer.  You should get lots of ideas like this http://chdk.wikia.com/wiki/UBASIC/Scripts:_Ultra_Intervalometer (http://chdk.wikia.com/wiki/UBASIC/Scripts:_Ultra_Intervalometer)

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: sevnthsin on 28 / June / 2011, 18:42:36
Last Question, I promise. Got the Intervalometer working real nicely. Now, is there a script I can run to get the screen on the back to turn off immediately after it shoots? The default power saver only goes as low as 10 seconds, I'm hoping for a 3-5. What might I search under?

Thanks.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 28 / June / 2011, 19:07:49
Last Question, I promise. Got the Intervalometer working real nicely. Now, is there a script I can run to get the screen on the back to turn off immediately after it shoots? The default power saver only goes as low as 10 seconds, I'm hoping for a 3-5. What might I search under?
Questions are good.   I'd start by searching the forum for "backlight".  Lots of posts - not sure if there is a magic answer, or at least a magic answer that works for the SD940.   Report back here if you work it out ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 30 / June / 2011, 18:15:26
Quote
The 100e has several fixes to its stubs_min.S file so let's see if that fixed the uBasic script issues.
UPDATE : these changes now available through the autobuild server.

Just tried 100e-0.9.9-1218 from the build server but no luck. I've tried script with P mode, Auto mode, single shot and continuous drive.

Is there anything I can do my end to help troubleshoot?

Thanks
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 30 / June / 2011, 19:43:30
Just tried 100e-0.9.9-1218 from the build server but no luck. I've tried script with P mode, Auto mode, single shot and continuous drive.
So does the script I posted here work ?  http://chdk.setepontos.com/index.php?topic=5855.msg69243#msg69243 (http://chdk.setepontos.com/index.php?topic=5855.msg69243#msg69243)

Where does it stop ?  After the first shoot ? What is the last thing printed on the display ?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 04 / July / 2011, 16:40:30
Where does it stop ?  After the first shoot ? What is the last thing printed on the display ?

After the first shot. So "sleep over, about to shoot..." is the last message you see.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 04 / July / 2011, 17:28:14
Where does it stop ?  After the first shoot ? What is the last thing printed on the display ?

After the first shot. So "sleep over, about to shoot..." is the last message you see.
Does it actually capture an image and save that to the SD card?  Also, it probably doesn't matter but do you have RAW disabled?

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: trogg on 28 / July / 2011, 07:08:48
Does it actually capture an image and save that to the SD card?  Also, it probably doesn't matter but do you have RAW disabled?
Hi Waterwingz.

It takes the first shot, saves it then doesn't run anything else in the script.

I think I may give my 1.00e to my brother in law as he needs a quality pocket camera. If I do i'll be getting another CHDKable sd940 in the future and finally getting that stereo rig working.

Thanks for all your work on this. My 1.03b works like a charm.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 28 / July / 2011, 18:41:31
I think I may give my 1.00e to my brother in law as he needs a quality pocket camera. If I do i'll be getting another CHDKable sd940 in the future and finally getting that stereo rig working.
I just rebuilt the 1.00e with the newest sigfinder2 and checked its output.  Unfortunately,  it didn't find anything suspicious.  So whatever is causing this is going to be a lot of work to fix.

Quote
Thanks for all your work on this. My 1.03b works like a charm.
You're welcome.  Although,  the 1.03b version is the only one that I did not actually port myself :)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 30 / July / 2011, 18:34:41
NOTE:  IXUS120-SD940 updated in the autobuild server today with a fix for the dissappearing menu problem in shooting mode.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Suomineiti on 30 / August / 2011, 12:10:27
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 30 / August / 2011, 12:43:42
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: Suomineiti on 30 / August / 2011, 14:00:49
You have to actually start the camera in "Play" mode.   This means you start the camera by pressing the "Play" [>] button on the back of the camera - not the On/Off button on the top of the camera.

Thanks x1000 :) :)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: rudi on 11 / September / 2011, 09:58:10
I'm looking for a full dump from version 102c.

Here's what I have on  my SD940 1.02C port:

Binaries (1.02C):
http://www.zshare.net/download/8383614653354d3f/ (http://www.zshare.net/download/8383614653354d3f/)
This link ist to old and the dump on http://www.box.net/chdk (http://www.box.net/chdk) is to small for finsig2.

I think a wrong stubs_entry.S is the bug on CHDK-DE trunk for version 102c.

rudi
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 11 / September / 2011, 10:05:33
I think a wrong stubs_entry.S is the bug on CHDK-DE trunk for version 102c.

rudi :  what bug are you seeing ?  and what stubs_entry.S is possibly wrong ?  does it match what's in the international versions - I thought that I checked all of them using the new sigfinder ...

meanwhile,  I'll look and see if I have a better dump of the 1.02c

Update :   here you go  http://www.box.net/shared/uvtjug4ylqsa4c22e5do (http://www.box.net/shared/uvtjug4ylqsa4c22e5do)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: rudi on 11 / September / 2011, 13:12:19
rudi :  what bug are you seeing ?  and what stubs_entry.S is possibly wrong ?  does it match what's in the international versions - I thought that I checked all of them using the new sigfinder ...
At first, thanks a lot for dump. The new sigfinder works fine.

for example (Changeset 800 (http://my-trac.assembla.com/chdkde/changeset/800#file0)):
Code: [Select]
NSTUB(GetZoomLensCurrentPoint                 ,0xffa3a7a8) //old
NSTUB(GetZoomLensCurrentPoint                 ,0xff93a7a8) //new
  or
DEF(task_MovieRecord                        ,0xffa3d648) //old
DEF(task_MovieRecord                        ,0xff93d648) //new

remark:
I generated with finsig2 new stubs_entry.S files for all DryOS Cams on chdkde-trunk and cleaned-up all related stubs_entry_2.S files (Changeset 763 (http://my-trac.assembla.com/chdkde/changeset/763)).

rudi
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 11 / September / 2011, 13:22:01
remark:
I generated with finsig2 new stubs_entry.S files for all DryOS Cams on chdkde-trunk and cleaned-up all related stubs_entry_2.S files (Changeset 763 (http://my-trac.assembla.com/chdkde/changeset/763)).

rudi

While you are updating the IXUS120, you might want to look at a patch that I just posted that fixes a major bug affecting all firmware versions of that camera :  http://chdk.setepontos.com/index.php?topic=650.msg73050#msg73050 (http://chdk.setepontos.com/index.php?topic=650.msg73050#msg73050)
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / September / 2011, 20:38:11
UPDATE NOTE :   all firmware versions updated on Sept 12 2011 with a major fix in capt_seq.c.    This allows USB remote operation to work properly in "Synch" modes and may fix other random bugs.   There have been quite a few other cleanups that affect the SD940 so a new download for most users is probably in order.

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: TomP on 08 / November / 2011, 15:10:06
Hi,

I bought the CAMremote from VP-Systems and a Canon Ixus 120.
I want to automatically trigger the camera using an RC-remote.

Unfortunately it doesn't seem to be working.
When I start the CHDK script from VP-systems (http://vp-systems.eu/download/cr1sdm.bas (http://vp-systems.eu/download/cr1sdm.bas)) The camera freezes a while and crashes a few seconds later (black screen).

Isn't the firmware port stable enough? Could I be doing something wrong?

Thanks,

Tom
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 08 / November / 2011, 15:24:57
The port has been pretty stable for almost a year now.  But this script may be exercising somethings new.

Did you enable USB remote in the Canon menus before running the script?  Did you enable any other USB remote options?
Also, what firmware version are you using ?

I'll take a look at the script tonight on my SD940.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: TomP on 08 / November / 2011, 18:02:11
Yes i enabled usb remote. I tried several options.
The firmware version is the B one.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 08 / November / 2011, 20:04:00
When I start the CHDK script from VP-systems (http://vp-systems.eu/download/cr1sdm.bas (http://vp-systems.eu/download/cr1sdm.bas)) The camera freezes a while and crashes a few seconds later (black screen).
Okay, here's the main problem - this script is written for SDM (http://stereo.jpn.org/eng/sdm/index.htm) not CHDK.   SDM forked away from CHDK several years ago and created its own version, adding special commands to uBasic (amongst other differences).

For example,  line 10 in the script has the statement :   sync_off.    This is a SDM command but not used in CHDK.  CHDK will shutdown when it hits an unrecognized statement like that.

Having said that,  I think that the set_zoom 0 statement on line 9 should be a valid CHDK uBASIC command but it seems to crash on both my SD940 and G10 cameras.  So the set_zoom code for  CHDK maybe needs to be looked at.

If I comment out the zoom lines and the sync_off line, the script runs and waits for USB pulses.  However,  once it gets one, it still hangs up.  I have not traced further through the code for more SDM only commands.  But with a little work,  it should be possible to trace through those and convert from SDM back to clean CHDK code.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 08 / November / 2011, 21:04:56
Update :  I wrote this simple script and tested it on both my SD940 and G10.  Works perfectly on both cameras so zoom functions are okay and the issues with the vp-systems script are likely SDM related.

Code: [Select]
@title set zoom test
s=0
p=0

print "started ..."
sleep 2000

s=get_zoom_steps
print "zoom steps = ", s
sleep 2000

p=get_zoom
print "zoom position = ", p
sleep 2000

set_zoom_speed 10
print "zoom speed set to 10"
sleep 2000

set_zoom 5
print "zoom to 5"
sleep 2000

end

Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: TomP on 10 / November / 2011, 12:53:37
Thanks a lot, this seemed to fix it!
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 10 / November / 2011, 13:00:22
Thanks a lot, this seemed to fix it!
Unfortunately, not really.  I've started another thread to deal with it :

http://chdk.setepontos.com/index.php?topic=7071 (http://chdk.setepontos.com/index.php?topic=7071)

Once I get the zoom fixed,  I'll look at removing the rest of the SDM specific stuff from that script so that there is a generic CHDK compatible version.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 04 / January / 2012, 23:16:23
Autobuild updated today with patch that fixes some shooting problems for firmware 1.00e.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: gesualdo on 22 / January / 2012, 11:14:39
hi Waterwingz, i m another time here to ask you a question, is it possible in any way to toggle the auto audio level during video recording? every time i try to record something with a very loud volume the audio is distorted, so is it possible to have a sort of manual level ? with a script or something?
tnx for all and tnx again for porting chdk for ixus 120
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: richie967 on 12 / May / 2013, 13:55:56
Hi, I've read through the wiki documentation, and it doesnt seem to say anywhere if you can automatically load the chdk when you turn the camera on.

"Not all cameras support dual partitions. Check the wiki page and forum porting thread for your camera before trying to use dual partitions."

How do i know if the ixus120 supports bootable card?

It doesn't say anywhere on the specific camera page whether you can boot from the card automatically, any help greatly appreciated1
Rich
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 12 / May / 2013, 14:14:13
How do i know if the ixus120 supports bootable card?
Good question.  First of all - it does.   Although as a camera release prior to 2011,  it will only boot from a FAT16 partition  (i.e one 4G or less).  So you will need to use the dual partition scheme if you want to autoboot from a larger card.  More details here : http://chdk.wikia.com/wiki/Prepare_your_SD_card (http://chdk.wikia.com/wiki/Prepare_your_SD_card)

The note on the wiki page was put there to cover the one or two cameras that do not support either firmware update or autobooting.  Almost all cameras support both - athough cameras released after 2010 usually don't need dual partitions as they can boot from FAT32 so they don't support it.  I guess we should add a standard section to each camera's wiki page stating what configurations work - although that's going to take somebody a long time to complete.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: richie967 on 13 / May / 2013, 08:44:54
Hi waterwingz, thanks for the quick reply, I have found this page on the Wiki explaining about a program that I can use to create the partitions.

http://chdk.wikia.com/wiki/Using_SDMinste_to_Create_Dual_Partition_SD_cards (http://chdk.wikia.com/wiki/Using_SDMinste_to_Create_Dual_Partition_SD_cards)

I will follow all 31 steps tonight and hopeully get it working! Thanks for your help, A small section on each camera page explaining what methods work would be good. I have just ordered a shiny new SX230, which supports  a more straight forward way of using CHDK on boot by the looks of things :)

Cheers, rich
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / May / 2013, 12:23:30
Hi waterwingz, thanks for the quick reply, I have found this page on the Wiki explaining about a program that I can use to create the partitions.
http://chdk.wikia.com/wiki/Using_SDMinste_to_Create_Dual_Partition_SD_cards (http://chdk.wikia.com/wiki/Using_SDMinste_to_Create_Dual_Partition_SD_cards)
That page should work for you - those are the instructions I used when I was porting the IXUS120 (check out the page history to see who created it)

Quote
I will follow all 31 steps tonight and hopeully get it working!
I'd still recommend using STICK instead.
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: richie967 on 13 / May / 2013, 13:42:04
Hi waterwingz, I would use STICK, but get this error.....

"Installation failed - see log for details" (but the log says the exact same thing, "...see log for details");

On the forum, this has been written and it applies to me.... looks like the 30 steps are going to be needed!! If the below has been fixed please let me know!

"I apologize to all those who've had problems with ASSIST. The problems seem localised to Windows 7/8 users with cards > 4Gb and pre-2011 cameras (which requires partitioning the card into a small FAT16 and a large FAT32 partition). I only have Windows XP and cannot reproduce the problem myself. Until the problem is fixed, I advise Windows users with pre-2011 camera to stick to cards 4Gb or less.
For UK people with the problem I'm happy to offer a card preparation service - send my your card with a photo on it taken with the camera in question and I'll post it back to you with SDM installed. I'll do this for users outside the UK too, but the two postal trips might take some time."


I proceeded with the SDMinste program and successfully navigated through the steps to the end, and have successfully made it so the camera boots on then loads the firmware. However it says the memory card is full.
What I don't understand, is that the final state of the partitions is that the main partition (FAT16) is only 2mb. It seems like I am half way there. The partitions have been created correctly. But the camera for some reason doesn't want to write to the main FAT32 partition.

Any ideas?
Rich 
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 13 / May / 2013, 18:36:35
On the forum, this has been written and it applies to me.... looks like the 30 steps are going to be needed!! If the below has been fixed please let me know!
To save me some searching,  can you please a link to where you got the quote?

Quote
I proceeded with the SDMinste program and successfully navigated through the steps to the end, and have successfully made it so the camera boots on then loads the firmware. However it says the memory card is full.
What I don't understand, is that the final state of the partitions is that the main partition (FAT16) is only 2mb. It seems like I am half way there. The partitions have been created correctly. But the camera for some reason doesn't want to write to the main FAT32 partition.
If you've done things correctly,  you should end up with a primary partition formatted as FAT16 of about 2MB.   You should also have a second partition formatted as FAT32 that uses up the rest of the card (7.999 GB).  If CHDK does not see a correctly partitioned SD Card,  it will just boot from the first small partition and not switch to the larger partition after booting.  Which is what the "Card Full" error is telling you - its running from the first partition and thus has no space to save pictures.


Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: archduk3 on 21 / October / 2014, 12:58:44
Hi there,

Might be a bit slow to awaken a sleepy thread but I need help and hopefully someone will be able to share their knowledge.

I have succesfully managed to install CHDK on the IXUS 120 IS. But there is a problem. All RAW-photos comes out with pretty bad distortion, is there a way to fix this in Camera or will I have to resort to Photoshop? :(

Carl
Title: Re: SD940 (IXUS120) porting thread [Now available from the autobuild server]
Post by: waterwingz on 21 / October / 2014, 13:04:25
I have succesfully managed to install CHDK on the IXUS 120 IS. But there is a problem. All RAW-photos comes out with pretty bad distortion, is there a way to fix this in Camera or will I have to resort to Photoshop? :(
There are probably a few things you need to review :
link> CHDK Wiki Page about RAW (http://chdk.wikia.com/wiki/Raw)
link> CHDK Forum thread on RAW (http://chdk.setepontos.com/index.php?topic=1532.msg13819#msg13819)
link> CHDK Wiki Page about Raw Software (http://chdk.wikia.com/wiki/Software#RAW_related)
link> CHDK Forum Board for RAW (http://chdk.setepontos.com/index.php?board=15.0)
link> How do you fix lens distortion with CHDK RAW files? (http://chdk.setepontos.com/index.php?topic=6996)
link> msl’s collection of lens profiles for adobe products (https://www.box.com/chdk-de/1/195008111)
link> Decoding CHDK RAW images from a new cameras (http://chdk.setepontos.com/index.php?topic=5855.msg59260#msg59260)
link> rawconvert utility to allow manipulation of CHDK RAW files (http://chdk.wikia.com/wiki/CHDK_Tools#rawconvert.c)
link> DNG4PS-2 utility to convert CHDK RAW images to DNG format (http://chdk.wikia.com/wiki/DNG4PS-2)

tl;dr : what you are seeing is exactly what the sensor sees - an image created by a lens that contains all kinds of compromises - especially at wide angle settings.  There is currently no way way to fix that in the camera with CHDK so you will have to post process using Photoshop or the equivalent