CHDK PTP interface - page 52 - General Discussion and Assistance - CHDK Forum supplierdeeply

CHDK PTP interface

  • 1244 Replies
  • 525317 Views
Re: CHDK PTP interface
« Reply #510 on: 13 / June / 2011, 11:03:04 »
Advertisements
hello mweerden, can you pls help me a little - i am trying to patch CHDK for the live preview
I am using the Compiler Shell V 3.26

it has downloaded the Trunk 1204 and CHDK DE trunk 685

i am facing two problems -
1. the int Trunk 1204 does not list my SX120
however if i go to Source Tools an Apply Patch it basically ends with the following

|Index: core/ptp.h
|===================================================================
|--- core/ptp.h (revision 1174)
|+++ core/ptp.h (working copy)
-- ------------------------
Patching file core/ptp.h using Plan A...
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 30.
2 out of 2 hunks FAILED -- saving rejects to file core/ptp.h.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: core/luascript.c
|===================================================================
|--- core/luascript.c   (revision 1174)
|+++ core/luascript.c   (working copy)
--------------------------
Patching file core/luascript.c using Plan A...
Reversed (or previously applied) patch detected!  Assume -R? [n] y
Hunk #1 succeeded at 1389 (offset 6 lines).
Hunk #2 FAILED at 1745.
1 out of 2 hunks FAILED -- saving rejects to file core/luascript.c.rej
done


2. if i use CHDK which does indeed list SX120 the patch fails at multiple locations

i am a newbie to this compiling can you point me where the patch may be going wrong

thank you

*

Offline reyalp

  • ******
  • 14119
Re: CHDK PTP interface
« Reply #511 on: 13 / June / 2011, 13:13:17 »
@nstatic
It's up to you to understand the use off diff/patch. This is not a CHDK problem or a problem with mweerdens patch.

You can look at the .rej files to see what failed. You can probably find some tutorials on working with patches on the internet somewhere. You may also find some gui tools that let you interactively resolve the problems, but understanding the code will still be required to do this successfully. If the original patch was generated with svn, tortoisesvn apply patch is very good, assuming the patch came from the same svn tree.

Note that you should almost certainly not answer yes to the "reversed" question.

The patch should apply cleanly if you start with whatever revision it was made against, but assuming that was from the CHDK tree rather than the CHDKDE tree, you won't have the sx120 so that won't solve your problem.

As you may have realized by now, this is not something you should expect to get working without some hacking...
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #512 on: 14 / June / 2011, 10:18:24 »
@nstatic
It's up to you to understand the use off diff/patch. This is not a CHDK problem or a problem with mweerdens patch.

You can look at the .rej files to see what failed. You can probably find some tutorials on working with patches on the internet somewhere. You may also find some gui tools that let you interactively resolve the problems, but understanding the code will still be required to do this successfully. If the original patch was generated with svn, tortoisesvn apply patch is very good, assuming the patch came from the same svn tree.

Note that you should almost certainly not answer yes to the "reversed" question.

The patch should apply cleanly if you start with whatever revision it was made against, but assuming that was from the CHDK tree rather than the CHDKDE tree, you won't have the sx120 so that won't solve your problem.

As you may have realized by now, this is not something you should expect to get working without some hacking...

oh, i am not implying something is wrong either with the patch or mweerdens code. Very Sorry if that was the impression my previous post gave, it only ment to imply that i am ignorant about what to do :)

it is the first time that i am compiling it for myself

i was just asking if the version(branch?) of the trunk i am using is ok and if the patch should work against it

or if it should work with the CHDK DE current version.

i am not against putting in some ( or considerable ) effort to make it work  :)

i will do as you say and see what failed

Re: CHDK PTP interface
« Reply #513 on: 16 / June / 2011, 06:41:17 »
......
i am not against putting in some ( or considerable ) effort to make it work  :)

i will do as you say and see what failed


i managed to pach the files manually (i skipped the G12 and IXUS 870 files) to the CHDK DE trunk 685 and compiled for SX120. it compiled ok  (apart from a warning about a skewed time stamp). i loaded it into the camera and it loaded properly. ptpcam worked ok. 'luar get_video_details()' in ptpcam returns a few funny characters where it used to fail in the non patched version.

i need a little help from the gurus - mweerden, reyalp
where do i go from here - how do i try getting a preview. i have your .net test project compiled but it doesnt give me a preview (it works excellently otherwise !), and also the get overlay and get image buttons are disabled. ill look in to the c# code next but a little help on the way would be welcome
thanks

oh by the way while patching i numbered the ptp to version 2.1 instead of 0x10002.0 - hope that is not the problem.


« Last Edit: 16 / June / 2011, 06:45:15 by ntstatic »


Re: CHDK PTP interface
« Reply #514 on: 16 / June / 2011, 08:24:30 »
where do i go from here - how do i try getting a preview. i have your .net test project compiled but it doesnt give me a preview (it works excellently otherwise !), and also the get overlay and get image buttons are disabled. ill look in to the c# code next but a little help on the way would be welcome
thanks

oh by the way while patching i numbered the ptp to version 2.1 instead of 0x10002.0 - hope that is not the problem.
Sounds to me like you are using the master branch instead of the remote-preview one. In the first the buttons are indeed disabled (as that one is intended for unpatched CHDK) and in the other they are always enabled. The latter also needs the version to be 0x10002 (unless you change it as well in CHDKPTPUtil.cs).



Re: CHDK PTP interface
« Reply #515 on: 16 / June / 2011, 08:35:47 »
where do i go from here - how do i try getting a preview. i have your .net test project compiled but it doesnt give me a preview (it works excellently otherwise !), and also the get overlay and get image buttons are disabled. ill look in to the c# code next but a little help on the way would be welcome
thanks

oh by the way while patching i numbered the ptp to version 2.1 instead of 0x10002.0 - hope that is not the problem.
Sounds to me like you are using the master branch instead of the remote-preview one. In the first the buttons are indeed disabled (as that one is intended for unpatched CHDK) and in the other they are always enabled. The latter also needs the version to be 0x10002 (unless you change it as well in CHDKPTPUtil.cs).




wow !! that was a lightning reply,  thank you
let me check it out -
i will recompile with 0x10002 and get it working with your settings .
it is indeed possible that i may have downloaded from the master branch. ill download a fresh copy and recompile and get back

thank you again

Re: CHDK PTP interface
« Reply #516 on: 16 / June / 2011, 09:06:32 »
Got It mweerden !!

it just proves that even a muggle can perform tricks (not magic) if a wizard shows how !!!

thank you
it was indeed the master branch and so the two buttons were disabled. also i compiled the trunk with 0x10002.0 in ptp.h (will try updating to 2.1 at ptp.h and the cs file later)
pressing the 'Get Image' gives me an image from the preview.

however 'Get Overlay' does nothing. should i be getting a live moving preview ??

Re: CHDK PTP interface
« Reply #517 on: 16 / June / 2011, 09:46:29 »
Quote
however 'Get Overlay' does nothing. should i be getting a live moving preview ??
My test program only gets one image when you press the button. If you want something more dynamic you'll have to write the code to repeatedly get the image. Or just press the button rapidly. ;)

As for the overlay, it does get it, but per default it uses an "empty" palette (i.e. every colour is fully transparent). To change that you'll have to patch the CHDK code to send the correct palette for your camera. For the ixus870 you can see how it is done in the patch. This does mean figuring out the right address from the firmware, though. Or you can hack the code to use some made up palette.


Re: CHDK PTP interface
« Reply #518 on: 16 / June / 2011, 09:56:57 »
Quote
however 'Get Overlay' does nothing. should i be getting a live moving preview ??
My test program only gets one image when you press the button. If you want something more dynamic you'll have to write the code to repeatedly get the image. Or just press the button rapidly. ;)

ok then ill probably put it on a timer - do you think it will be able to give me around 7-10 fps (rapidly pressing the button gives me a feeling it may be possible)

Quote
As for the overlay, it does get it, but per default it uses an "empty" palette (i.e. every colour is fully transparent). To change that you'll have to patch the CHDK code to send the correct palette for your camera. For the ixus870 you can see how it is done in the patch. This does mean figuring out the right address from the firmware, though. Or you can hack the code to use some made up palette.

ok, will try to do that, thank you

the thing is i need to compile it on a remote machine as mine doesnt have VS 2010. anyways thanks once again i will keep this thread posted on whatever small progress i make

Re: CHDK PTP interface
« Reply #519 on: 16 / June / 2011, 14:53:37 »
ok then ill probably put it on a timer - do you think it will be able to give me around 7-10 fps (rapidly pressing the button gives me a feeling it may be possible)
When I started working on this I tried it out by just dumping the data to files. This got me about 100 images in 5 to 6 seconds, if I recall correctly. The code on the camera is a bit different now, but I don't think it should matter much.

Also, the C# code I wrote to convert the image to an RGB .NET Image might not be the fastest method to get it on the screen. So I would guess 10 fps should definitely be possible (assuming your camera isn't much slower than mine for some reason).

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal