A490 Porting - page 2 - DryOS Development - CHDK Forum  

A490 Porting

  • 224 Replies
  • 82466 Views
Re: A490 Porting
« Reply #10 on: 09 / June / 2011, 12:41:51 »
Advertisements
I for one applaud your efforts !  No programming experience on my end either, but wish this camera would get more support.

*

Offline mrowl

  • *
  • 11
Re: A490 Porting
« Reply #11 on: 14 / June / 2011, 15:14:45 »
I've got to somewhere. CHDK splash logo appears, shows version and camera info. There is a long way to go as I can foresee. For the record, here is how the camera behaves currently:

- If I press any button, the logo disappears. No CHDK features are shown (battery life etc)
- If I try to access the SD Card (e.g. delete a picture) it still complains "Memory card locked"
- I cannot use ALT function (I copied the kbd.c code from A495 so the ALT key must be the Play button)
- With the help of mode selection, I can go to record mode but of course it says the card is locked and I can't use Shoot button. With Play button I can return to picture view mode.

That's all for today, I hope I can bring more news soon. Please dear gurus, if you have comments or thoughts where I should continue, please let me know.

mrowl
« Last Edit: 14 / June / 2011, 15:16:32 by mrowl »

*

Offline reyalp

  • ******
  • 14080
Re: A490 Porting
« Reply #12 on: 14 / June / 2011, 16:36:12 »
I've got to somewhere. CHDK splash logo appears, shows version and camera info. There is a long way to go as I can foresee. For the record, here is how the camera behaves currently:

- If I press any button, the logo disappears. No CHDK features are shown (battery life etc)
- If I try to access the SD Card (e.g. delete a picture) it still complains "Memory card locked"
- I cannot use ALT function (I copied the kbd.c code from A495 so the ALT key must be the Play button)
- With the help of mode selection, I can go to record mode but of course it says the card is locked and I can't use Shoot button. With Play button I can return to picture view mode.

That's all for today, I hope I can bring more news soon. Please dear gurus, if you have comments or thoughts where I should continue, please let me know.

mrowl
Good progress. To unlock the SD card, you must find the correct SD_READONLY_FLAG in platform/kbd.c. It seems you must also adjust the keys. It's also possible you physw_status is wrong.

Since it does boot and display the logo, the next obvious step is to display some debug values. There are various checks for showing the normal OSD, which may fail if variables or function addresses are wrong, but you can skip them. In core/gui.c you will find gui_draw_debug_vals_osd, and a commented out call to it. You can uncomment this to have it draw on top of most everything, or move it to gui_redraw. You'll also want to comment out the check of conf.debug_misc_vals_show, since you can't yet change conf values.

Once you've got that showing, you can display the various words of physw_status to help find the bits for the different buttons, sd card lock and so on.

Please understand that you cannot just copy platform stuff from another port. *all* the stubs need to be checked, all the inline assembler needs to be redone, everywhere there's a reference to something camera specific needs to be fixed. Copying a port and then just trying to "fix" the things that are broken leads to many difficult to fix bugs.
Don't forget what the H stands for.

*

Offline mrowl

  • *
  • 11
Re: A490 Porting
« Reply #13 on: 15 / June / 2011, 16:42:54 »
Thanks for the help, Reyalp! I can bring all of you very good news!  :D  :lol

After I amended many stubs today, CHDK is working surprisingly well. I can confirm that the followings work:

- CHDK menu, switching to ALT mode back and forth both in Play and in Shooting mode
- Taking photos in JPG and in CR2 format (yes, RAW works! But how? I did not run badpixel.lua?! Anyway, the .CR2 file can be opened with UFRaw)
- I could start some LUA scripts, so far I tried only those that don't use shooting; e.g. eggtimer and they works
- Video recording works in 640x480, (AVI container, video is mjpeg and audio is 12kHz PCM). I could record a 38 seconds video and I could use optical zoom
- Live histogram is working nicely

I could find some bugs, too:

- During video recording if I zoom in too much so the camera starts using digital zoom, I could only zoom out with digital zoom and then optical zoom out does not work anymore, the camera stays in maximum optical zoom state. Of course after I stop recording video, I can use zoom out again
- The on/off button doesn't work at all. I tested with led test in the beginning of boot() and the led is lit for a moment, but then the camera go shutdown. The problem must be in boot.c, I believe.
- I can switch on the camera with the Play button (as you must have found out :)), then I can use the Play to switch to Alt mode (there is no Print button so I adapted the way A495 works). However, if I can press the Play button long, nothing happened (it must be go to Shooting mode).
- The only way to go to Shooting mode is to turn on it with Play, then use the Mode selector button next to the Menu button.

I'm afraid I'm going to have a hard time with these two problems, but I'll do my best. Is there anyone who could help me a little? By the way, how can I share the source code? (I'm sure it's written somewhere. This project has the best documentation I have ever seen from volunteers.  :) )

I have not tried any further fancy feature of CHDK yet.

The first beta can be downloaded from here, for whom it concern.

mrowl

UPDATE: I have found another bug. I had the eggtimer script running and turned off the camera. It saved the status and next time I turned it on, the eggtimer screen was shown for a subsecond, then the camera shut down. It remained in this status until I deleted the config file.

UPDATE2: I have already fixed the bug with the on/off button. Now I have to go get some sleep, because my eyes are aching. :) But I'm really satisfied with the progress of the last day.
« Last Edit: 15 / June / 2011, 17:28:09 by mrowl »


*

Offline mrowl

  • *
  • 11
Re: A490 Porting
« Reply #14 on: 15 / June / 2011, 16:57:38 »
Quote from: reyalp
In core/gui.c you will find gui_draw_debug_vals_osd, and a commented out call to it. You can uncomment this to have it draw on top of most everything, or move it to gui_redraw. You'll also want to comment out the check of conf.debug_misc_vals_show, since you can't yet change conf values.

Once you've got that showing, you can display the various words of physw_status to help find the bits for the different buttons, sd card lock and so on.

I did it as you said but I can only see battery status, free space on SD, a clock, the temperature of something and a bar on the very bottom of the screen that shows some misterious thing. There are no debug messages or bites anywhere. What am I missing?

mrowl

*

Offline reyalp

  • ******
  • 14080
Re: A490 Porting
« Reply #15 on: 15 / June / 2011, 17:11:10 »
Excellent progress.
I did it as you said but I can only see battery status, free space on SD, a clock, the temperature of something and a bar on the very bottom of the screen that shows some misterious thing. There are no debug messages or bites anywhere. What am I missing?
mrowl
You have to either enable misc debug values in the debug menu, or hard code it to always display by skipping the option check. You may also want to edit which values it displays.

The mysterious bar is another way of showing SD card space.

Quote
- Taking photos in JPG and in CR2 format (yes, RAW works! But how? I did not run badpixel.lua?! Anyway, the .CR2 file can be opened with UFRaw)
badpixel is only needed for DNG. The fact that "CR2" opens means the framebuffer size and bit depth is exactly the same as some already supported camera. CHDK raw (usually saved with CRW or CR2 extension) isn't actually in the canon CRW or CR2 format, it's just a dump of the sensor buffer.

Quote
- During video recording if I zoom in too much so the camera starts using digital zoom, I could only zoom out with digital zoom and then optical zoom out does not work anymore, the camera stays in maximum optical zoom state.
This is a common problem. I believe there is a workaround in the the sx30 and g12 ports.

Quote
- I can switch on the camera with the Play button (as you must have found out), then I can use the Play to switch to Alt mode (there is no Print button so I adapted the way A495 works). However, if I can press the Play button long, nothing happened (it must be go to Shooting mode).
I guess A490 does not have a power button separate from play ? Normally, that's what you would hold down to switch to record (this also needs some special code in boot.c to work).

Pressing the shutter should also switch you to record mode.

Quote
I'm afraid I'm going to have a hard time with these two problems, but I'll do my best. Is there anyone who could help me a little? By the way, how can I share the source code?
If you want to collaborate with other people, you can use a source code hosting site like google code, assembla, github etc.

You can also post a patch or zip here, either as an attachment or link to a file host.

If you want to submit it to be included in the trunk, I prefer a patch from tortoisesvn, with all the new files svn added.
Don't forget what the H stands for.

*

Offline mrowl

  • *
  • 11
Re: A490 Porting
« Reply #16 on: 15 / June / 2011, 17:35:56 »
Quote
Excellent progress.
I guess A490 does not have a power button separate from play ? Normally, that's what you would hold down to switch to record (this also needs some special code in boot.c to work).
Thank you, and thanks for all the explanations, too! Since then I could do the trick in boot.c so the (separated) on/off button works as expected; as well as Play and the Shutter button. So we can say it is fixed.

That's all for today, I'll answer the rest later. I'm falling asleep...

mrowl

*

everbloom

Re: A490 Porting
« Reply #17 on: 17 / June / 2011, 03:28:46 »
I've got an A490 too. Mine has the e firmware, which I got a dump of (its at http://www.cl.ly/0a0L1U0u1S3N1P2Y011x).

I haven't disassembled it because my Assembler skills are nix, but looking at it in a hex editor I couldn't find a single reference to A490 - but there were a stack to A495. Weird?


*

Offline mrowl

  • *
  • 11
Re: A490 Porting
« Reply #18 on: 17 / June / 2011, 18:42:03 »
This evening I experienced more with CHDK:

- Creating .DNG files works (I could create badpixel.bin, too)
- I tested ND filters more or less (I need to have a really bright day for thorough test), it seems to be working also
- I changed the taskHook code to use pointers instead of string comparison, as suggested by Philmoz in the A495 porting thread

Quote
Quote from: mrowl
- During video recording if I zoom in too much so the camera starts using digital zoom, I could only zoom out with digital zoom and then optical zoom out does not work anymore, the camera stays in maximum optical zoom state.
This is a common problem. I believe there is a workaround in the the sx30 and g12 ports.

Hmm, I'd really like to fix it. I looked into G12 patch and it modifies platform/generic/wrappers.c - I found this a bit strange since it is a platform specific code. Or is it normal?
I couldn't understand a word of it for the first time, of course but I won't give up.

Quote
If you want to submit it to be included in the trunk, I prefer a patch from tortoisesvn, with all the new files svn added.
I posted it here: http://chdk.setepontos.com/index.php?topic=650.msg68942#msg68942
I hope it's OK.

mrowl

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: A490 Porting
« Reply #19 on: 17 / June / 2011, 20:40:14 »
Quote
Quote from: mrowl
- During video recording if I zoom in too much so the camera starts using digital zoom, I could only zoom out with digital zoom and then optical zoom out does not work anymore, the camera stays in maximum optical zoom state.
This is a common problem. I believe there is a workaround in the the sx30 and g12 ports.

Hmm, I'd really like to fix it. I looked into G12 patch and it modifies platform/generic/wrappers.c - I found this a bit strange since it is a platform specific code. Or is it normal?
I couldn't understand a word of it for the first time, of course but I won't give up.


The code is conditionally compiled only for the G12 and SX30 using the '#if defined(CAMERA_g12)...' directive.
It's not recommended but sometime the simplest way to get something done is to add some camera specific code to the common code base. You will see a lot of this sprinkled throughout the code.

The fix I implemented (after a lot of trial and error) is to detect when the camera is in digital zoom mode; but at the very start digital zoom and then call the PT_MoveDigitalZoomToWide function. I don't know why this unlocks the optical zoom; but it does on the G12 and SX30. No guarantees it will work on the A490.

You also need find the PROPCASE_DIGITAL_ZOOM_xxx property values and add them to the correct propset?.h file for your camera - the property display in the debug menu on the camera will help here.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics