canon: repair --wait-event-and-download

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

canon: repair --wait-event-and-download

Wolfram Sang
I noticed that --wait-event-and-download did not work with latest trunk
and a 5D. This patch fixes it. After applying, I can use this mode again
and --capture-image-and-download successfully on a 5D Mark I and on a 350D.

Thanks,

    Wolfram

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

0002-canon-fix-wait-for-event.patch (803 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

Marcus Meissner-4
On Sun, Aug 18, 2013 at 10:04:28AM +0200, Wolfram Sang wrote:
> I noticed that --wait-event-and-download did not work with latest
> trunk and a 5D. This patch fixes it. After applying, I can use this
> mode again and --capture-image-and-download successfully on a 5D
> Mark I and on a 350D.

Doh ... Applied, thanks!

(Got only a Digital IXUS 2 here for canon driver testing, not sure
 if it can do this even.)

Ciao, Marcus
 
> Thanks,
>
>    Wolfram

> Since switching from n_times to timeout in canon_usb_poll_interrupt_pipe() we
> might be returning a timeout error instead of 0 when hitting the timeout. This
> broke wait-event-and-download on the 5D. Restore the old behaviour.
>
> Signed-off-by: Wolfram Sang <[hidden email]>
>
> Index: camlibs/canon/usb.c
> ===================================================================
> --- camlibs/canon/usb.c (revision 14502)
> +++ camlibs/canon/usb.c (working copy)
> @@ -911,8 +911,11 @@
>           gettimeofday ( &cur, NULL );
>   curduration = (cur.tv_sec-start.tv_sec)*1000 +
>   (cur.tv_usec-start.tv_usec)/1000;
> - if (curduration >= timeout)
> + if (curduration >= timeout) {
> + /* Timeout is not an error */
> + status = 0;
>   break;
> + }
>          }
>          gettimeofday ( &end, NULL );
>  

> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk

> _______________________________________________
> Gphoto-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gphoto-devel


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck
I saw the same thing with Canon 1D Mark IV, it wouldnt take an picture if you pressed the shutter button for some reason while gphoto was waiting. I will apply your patch and see if it works....


I saw two other problems, canon 1D Mark IV crashed when taking a picture using gphoto. I spend the whole weekend debugging it.

problems were in function ptp_unpack_CANON_changes in ptp-pack.c

one was here:

                                case PTP_DPC_CANON_EOS_CustomFuncEx:
                                        dpd->DataType = PTP_DTC_STR;
                                        if (dpd->FactoryDefaultValue.str) free (dpd->FactoryDefaultValue.str);
                                        if (dpd->CurrentValue.str)        free (dpd->CurrentValue.str);
                                        dpd->FactoryDefaultValue.str    = ptp_unpack_EOS_CustomFuncEx( params, &data );
                                        dpd->CurrentValue.str           = strdup( (char*)dpd->FactoryDefaultValue.str );   // <<<<<----------CRASHED ON THIS LINE
                                        ptp_debug (params,"event %d: decoded custom function, currentvalue of %x is %s", i, proptype, dpd->CurrentValue.str);


Dont know if its a good fix, but I just commented out that whole case, and added PTP_DPC_CANON_EOS_CustomFunEX: to the previous case so the previous case would handle that event, because thats the code that got executed with my other Canon, so maybe its god enough for 1D also. After I did that it stopped crashing...dont know if that was the correct thing to do. seems strdup failed.



Another crash in the same function on this line

                        ptp_debug (params, "event %d: objectinfo added oid %08lx, parent %08lx, ofc %04x, size %d, filename %s", i, (*ce)[i].u.object.oid, (*ce)[i].u.object.oi.ParentObject, (*ce)[i].u.object.oi.ObjectFormat, (*ce)[i].u.object.oi.ObjectCompressedSize, (*ce)[i].u.object.oi.Filename);


since its just a debug line, I commented it out and it worked (when in doubt... comment it out).

happy day!

rough




Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

Wolfram Sang
On 19/08/13 15:22, rough_neck wrote:

> I saw the same thing with Canon 1D Mark IV, it wouldnt take an picture if you
> pressed the shutter button for some reason while gphoto was waiting. I will
> apply your patch and see if it works....

My fix is for the canon driver, not the ptp2 you are using...


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

Marcus Meissner
In reply to this post by rough_neck
On Mon, Aug 19, 2013 at 06:22:43AM -0700, rough_neck wrote:

> I saw the same thing with Canon 1D Mark IV, it wouldnt take an picture if you
> pressed the shutter button for some reason while gphoto was waiting. I will
> apply your patch and see if it works....
>
>
> I saw two other problems, canon 1D Mark IV crashed when taking a picture
> using gphoto. I spend the whole weekend debugging it.
>
> problems were in function ptp_unpack_CANON_changes in ptp-pack.c
>
> one was here:
>
>                                 case PTP_DPC_CANON_EOS_CustomFuncEx:
>                                         dpd->DataType = PTP_DTC_STR;
>                                         if (dpd->FactoryDefaultValue.str)
> free (dpd->FactoryDefaultValue.str);
>                                         if (dpd->CurrentValue.str)      
> free (dpd->CurrentValue.str);
>                                         dpd->FactoryDefaultValue.str    =
> ptp_unpack_EOS_CustomFuncEx( params, &data );
>                                         dpd->CurrentValue.str           =
> strdup( (char*)dpd->FactoryDefaultValue.str );   // <<<<<----------CRASHED
> ON THIS LINE
>                                         ptp_debug (params,"event %d: decoded
> custom function, currentvalue of %x is %s", i, proptype,
> dpd->CurrentValue.str);

>
> Dont know if its a good fix, but I just commented out that whole case, and
> added PTP_DPC_CANON_EOS_CustomFunEX: to the previous case so the previous
> case would handle that event, because thats the code that got executed with
> my other Canon, so maybe its god enough for 1D also. After I did that it
> stopped crashing...dont know if that was the correct thing to do. seems
> strdup failed.
 

The size calculation in ptp_unpack_EOS_CustomFuncEx was wrong, which corrupted memory
leading to this crash.

It is fixed in libgphoto2 TRUNK and will be in 2.5.3.


 
> Another crash in the same function on this line
>
>                         ptp_debug (params, "event %d: objectinfo added oid
> %08lx, parent %08lx, ofc %04x, size %d, filename %s", i,
> (*ce)[i].u.object.oid, (*ce)[i].u.object.oi.ParentObject,
> (*ce)[i].u.object.oi.ObjectFormat,
> (*ce)[i].u.object.oi.ObjectCompressedSize, (*ce)[i].u.object.oi.Filename);

The "filename" seems to be invalid, I replaced %s by %p in TRUNK.

> since its just a debug line, I commented it out and it worked (when in
> doubt... comment it out).

So both issues will be fixed in 2.5.3

Ciao, Marcus

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck

Awesome, when will 2.5.3 be released? I cant wait!
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

Marcus Meissner
On Mon, Aug 19, 2013 at 10:45:52AM -0700, rough_neck wrote:
>
> Awesome, when will 2.5.3 be released? I cant wait!

I had not planned it yet. Perhaps in some weeks :)

Ciao, Marcus

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck
Nice, I wonder what cool features you will be adding in 2.5.3
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

Marcus Meissner-4
On Mon, Aug 19, 2013 at 05:59:35PM -0700, rough_neck wrote:
> Nice, I wonder what cool features you will be adding in 2.5.3

Not much, its summer and my work days are full :)

What would you like to see / are you missing?

Ciao, Marcus

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck
Hello Marcus,

Since you asked, here is my wish list for gphotos next release...

1. Canon Movie Start/Stop capability (only works with Nikon now)

2. Take a picture without the camera automatically refocusing for Nikon (Only works with canon now).
    For Nikon it works if target set to "internal memory". But that doesnt help because there is no function
    to fetch the image from internal memory unless I use a big malloc which runs out of memory for big 16 meg picture.

3. Being able to copy an image from internal RAM to SD card without mallocing a big memory for photo.

Those are the main problems I'm having at the moment....

rough
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

Marcus Meissner-4
On Sun, Aug 25, 2013 at 07:11:56AM -0700, rough_neck wrote:
> Hello Marcus,
>
> Since you asked, here is my wish list for gphotos next release...
>
> 1. Canon Movie Start/Stop capability (only works with Nikon now)


> 2. Take a picture without the camera automatically refocusing for Nikon
> (Only works with canon now).

In 2.5.2 now with my D7000:

        gphoto2 --set-config remotemode=1 --set-config focusmode2=4    ( MF (selection) here )

        gphoto2 --capture-image-and-download
        gphoto2 --capture-image-and-download
        ...

not refocusing, even though capture is on sdcard.

>     For Nikon it works if target set to "internal memory". But that doesnt
> help because there is no function
>     to fetch the image from internal memory unless I use a big malloc which
> runs out of memory for big 16 meg picture.

Not allocating memory is kind of hard with "SDRAM" captures, yes.

But I think the focusing less mode should work also with SD card.
 
> 3. Being able to copy an image from internal RAM to SD card without
> mallocing a big memory for photo.

On camera? I think this is not possible.
 
> Those are the main problems I'm having at the moment....

I hope I could even help right now :)

Ciao, Marcus

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck
> 2. Take a picture without the camera automatically refocusing for Nikon
> (Only works with canon now).
>>
>>In 2.5.2 now with my D7000:
>>
>>       gphoto2 --set-config remotemode=1 --set-config focusmode2=4    ( MF (selection) here )
>>
>>        gphoto2 --capture-image-and-download
>>        gphoto2 --capture-image-and-download
>>        ...
>>
>>not refocusing, even though capture is on sdcard.

Great I will try it on my Nikon D7000. However.... it seems the canon 5D Mark III is also refocusing automatically when I take a picture.

Is there a way to make it take a picture without refocusing? Canon doesnt have the "remotemode" or "focusmode2" config, just gives error widget is not configurable.

thanks

rough

Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck
In reply to this post by Marcus Meissner-4
Hello,

I tried it on my Nikon D7000 but it didnt work.... I had the camera switch set to manual (M)  this is what happened

user@ubuntu:~/tmp/canon$ gphoto2 --set-config remotemode=1 --set-config focusmode2=4
                                                                               
*** Error ***              
The property 'Focus Mode 2' / 0xd161 was not set, PTP errorcode 0x200f.

*** Error ***              
Failed to set new configuration value 4 for configuration entry focusmode2.
*** Error (-1: 'Unspecified error') ***      

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@lists.sourceforge.net>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --set-config remotemode=1 --set-config focusmode2=4

Please make sure there is sufficient quoting around the arguments.

user@ubuntu:~/tmp/canon$


Does the camera have to be in a certain mode, or the switches on the camera in a certain position?

I also tried focusmode2=3, that didnt work either

any ideas?

rough
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

mald
Interesting thing to note.

On my Nikon D90, remotemode widget doesn't exist. I also could only set the focusmode2 to choice 0..2. chocie 3 and 4 consistently failed. However, on my lens, I flipped the switch from (M/A) -> (M), and then choices 0..2|4 failed, and only chocie 3 worked. So if the D90 doesn't have a "remotemode" then it means I will always have to flip my lens switch to M?

focusmode2 choices:
0 AF-S
1 AF-C
2 AF-A
3 MF (fixed)
4 MF (selection)
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck
I thought of doing that also, but if the lens switch is flipped to M (manual) I think the camera cant control the lens anymore, its disconnected from the camera electrically?

So gphoto2 cant change the focus anymore using manualfocusdrive or any other command.
Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

rough_neck
I find it very strange that the camera has so much difficulty taking a picture without auto focusing first.

Seems the Nikon refuses to take a picture unless "IT" does the focusing.

Should'nt there be an "auto focus DISABLE" widget that just releases the shutter no matter what is going on? That way the photographer can compose the scene however he wants to without the camera forcing him to do it a certain way.

rough

Reply | Threaded
Open this post in threaded view
|

Re: canon: repair --wait-event-and-download

Rogier Wolff
On Mon, Aug 26, 2013 at 07:49:56PM -0700, rough_neck wrote:
> I find it very strange that the camera has so much difficulty taking a
> picture without auto focusing first.
>
> Seems the Nikon refuses to take a picture unless "IT" does the focusing.
>
> Should'nt there be an "auto focus DISABLE" widget that just releases the
> shutter no matter what is going on? That way the photographer can compose
> the scene however he wants to without the camera forcing him to do it a
> certain way.

When you're making a product you have to make assumptions about how
people are going to use your product. So some cameras are made with
the assumption: "the user doesn't know anything about photography and
just wants a reasonable snapshot". Fine. You get a point-and-shoot
camera.

But for the more expensive cameras the assumptions are different, but
still there.

If the designers decided that if the user is not there to focus (but
the computer is controlling the camera), then the camera has to do it.

This is an assumption that might lead to the camera you have.

Maybe it's a marketing decision: Only if you buy the most expensive
version, do they expect you to use a computer to display the live-view
on the computer and focus through an app on the computer.

For example the point-and-shoot cameras could of course take a picture
under computer-control. But the manufacturer decided that they want to
force you to buy a more expensive camera if you want to do that. So
they disable/remove that feature in the firmware.

It is uncommon that you can replace the firmware, so it is often not
possible to add computer-control for some things that the camera
manufacturer decided nobody would use. Or for things the camera
manufacturer decided that they want you to buy a more expensive camera
for.

        Roger.


--
** [hidden email] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel