PDA

View Full Version : SDK on WinXP Problems


texdba
24th of November 2003 (Mon), 12:04
I am developing a project in VB 6 using the 6.01 SDK. The only thing I can't get working is remote shutter release -- the program hangs on the CDRelease call for about 1 minute, and then gives an error that I can't find.

In Canon's sample application (RetCtl), it works about 50% of the time, and the other 50% it hangs like in my own code.

atleypnorth
24th of November 2003 (Mon), 15:04
what error does it give ?

texdba
24th of November 2003 (Mon), 18:04
ErrorCode=0xC000002

atleypnorth
25th of November 2003 (Tue), 02:31
that is ...
cdERROR_CDSDK_COMPONENTID && cdINTERNAL_ERROR

which is a 'usefull' error cause it means something went wrong in the SDK :)

Which camera ?

texdba
25th of November 2003 (Tue), 23:46
Thanks for the info -- how does one look up the error codes?

The camera is a PowerShot G5.

atleypnorth
26th of November 2003 (Wed), 02:27
they are in the file cdError.h, you have to AND them together to see the codes you will get ...

I have had problems with the G5 doing strange things on XP. Only thing i can really suggest is re installing.
I should be doing something with a G5 later on today and will see if hit those problems again ...

Emret
3rd of March 2005 (Thu), 02:41
Hi all,
I have some trouble with CDRelease().
If I understand the documentation in CD-SDK 7.1, the bSync-parameter set to FALSE in CDRelease() would return immediately and let me pass the transfer handling to the ReleaseCallbackFunction. But it doesn´t. It won´t return from CDRelease() until the CDGetReleasedData() in the callback function has retrived the data/image, what am I doing wrong?

Setting up ReleaseCallbackFunction:
CDEnterReleaseControl( m_hSource, CameraReleaseEventCallbackFunction, 1);

Calling CDRelease in main():
CDRelease( m_hSource, FALSE, CameraProgressCallbackFunction,1, cdPROG_NO_REPORT, &count);

Upon cdRESEASE_EVENT_RELEASE_COMPLETE in my ReleaseCallbackFunction():
CDGetReleasedData( m_hSource, CameraProgressCallbackFunction, 2, cdPROG_REPORT_PERIODICALLY, &Camera_ReleaseImageInfo, &Camera_StgMedium);

I all works fine, but I would like to return immediately to process the previous image by calling/starting another application, while taking the next picture

Best regards,
Mikael Emretsson
Mikael@Emretsson.se

atleypnorth
4th of March 2005 (Fri), 05:32
From reading the description of the bSync flag you shouldnt call CDGetReleasedData() in the callback, but after the CDRelease has returned. The release callback should be used to keep a count of how many releases have been done.


Hi all,
I have some trouble with CDRelease().
If I understand the documentation in CD-SDK 7.1, the bSync-parameter set to FALSE in CDRelease() would return immediately and let me pass the transfer handling to the ReleaseCallbackFunction. But it doesn´t. It won´t return from CDRelease() until the CDGetReleasedData() in the callback function has retrived the data/image, what am I doing wrong?

Setting up ReleaseCallbackFunction:
CDEnterReleaseControl( m_hSource, CameraReleaseEventCallbackFunction, 1);

Calling CDRelease in main():
CDRelease( m_hSource, FALSE, CameraProgressCallbackFunction,1, cdPROG_NO_REPORT, &count);

Upon cdRESEASE_EVENT_RELEASE_COMPLETE in my ReleaseCallbackFunction():
CDGetReleasedData( m_hSource, CameraProgressCallbackFunction, 2, cdPROG_REPORT_PERIODICALLY, &Camera_ReleaseImageInfo, &Camera_StgMedium);

I all works fine, but I would like to return immediately to process the previous image by calling/starting another application, while taking the next picture

Best regards,
Mikael Emretsson
Mikael@Emretsson.se

Emret
7th of March 2005 (Mon), 06:38
From reading the description of the bSync flag you shouldnt call CDGetReleasedData() in the callback, but after the CDRelease has returned. The release callback should be used to keep a count of how many releases have been done.

Thanks for youre reply, but...


Cut from the CDSDK71UserGuide.pdf






If bSync = TRUE:


The CD-SDK automatically transfers the captured image data to the computer and saves it within the CD-SDK. In this case, this function does not return until the data transfer is complete.

To retrieve the capture data, after this function completes, execute the CDGetReleasedData function described next as many times as is shown in pNumData. The CDGetReleasedData function copies the data saved internally in the CD-SDK to the cdStgMedium prepared by the client.












If bSync = FALSE:


This function finishes immediately upon completion of image capture. In this case, the data generated during image capture stays in the camera memory.

To retrieve the capture data after the cdRESEASE_EVENT_RELEASE_COMPLETE release event notification is sent, repeat the CDGetReleasedData function only the number of times indicated by the event data. The CDGetReleasedData function transfers the image data stored in the camera memory to the computer and then passes it to cdStgMedium.

For example, to display only thumbnails in an application immediately after the camera shutter is released, set the cdREL_KIND_THUMB_TO_PC and cdREL_KIND_PICT_TO_PC parameters in the CDSelectReleaseDataKind function, specify FALSE for bSync, and then capture the images. After the cdRESEASE_EVENT_RELEASE_COMPLETE event is received, execute CDGetReleasedData to transfer the thumbnails. Display these, and then execute CDGetReleasedData again to transfer the high resolution data. This makes it possible to check the captured images immediately using the thumbnail data.







But, in my case I will not return from CDRelease until my callbackfunction has received the captured image, and in my case, saved it to disk. This takes several seconds, time that I would like to use for other tasks.

Other stranged and/or undocumeted features.
From a Digital IXUS 500 I receive a final DevPropID == 0x00000011 from CDEnumDevicePropertyNext.
CDGetDevicePropertyData with the ID will return 4 bytes of data containing 00 00 01 00 (Bytewise HEX), I don´t know what the representation is, but it could be 0x00010000 if it´s a cdUInt32.
The last #define in the cdType.h is cdDEVICE_PROP_DIRECT_TRANSFER_STATUS (0x00000010).

I know I have a long way to go before I understand this SDK, but where do I turn when this things keep happening? Are there only a few of us, fighting with Canons SDK? Wouldn´t Canon be interested in keeping us happy? If we provide the world with software that only goes with Canon products, would this not sell Canon products?



Best regards,
Mikael Emretsson
Mikael@Emretsson.se

atleypnorth
7th of March 2005 (Mon), 14:34
So really the problem is that the CDGetReleasedData takes time to get data and you want to be doing something else while that is happening ? In that case you need to look at threading and have a thread that takes care of the getting the image data while the main application thread is doing some else.

Emret
8th of March 2005 (Tue), 01:40
So really the problem is that the CDGetReleasedData takes time to get data and you want to be doing something else while that is happening ? In that case you need to look at threading and have a thread that takes care of the getting the image data while the main application thread is doing some else.

My thought was that this was done by the callback function, like any other windows callbackfunctions, in the microsoft "multitasking"-way :rolleyes:.

But anyway, I'm not returning from the CDRelease until the Callbackfunction has retrived the image, despite the statement in the CD-SDK7.1 UserGuide.:confused:

a small portion from my log-file:

Entering CDRelease @ CPU-tick 0x00001676 <----------------------------------In Main
cdRELEASE_EVENT_RELEASE_START - Starts the capture operation with asynchronous mode.
CameraProgressCallbackFunction:
Progress = 003%
Status = Transfer for Context = 1
CameraProgressCallbackFunction:
Progress = 006%
Status = Transfer for Context = 1
CameraProgressCallbackFunction:
Progress = 009%
Status = Transfer for Context = 1
|
|
|
CameraProgressCallbackFunction:
Progress = 098%
Status = Transfer for Context = 1
CameraProgressCallbackFunction:
Progress = 100%
Status = Transfer for Context = 1
cdRESEASE_EVENT_RELEASE_COMPLETE - 1 images captured
Time to CDGetReleasedData in CameraReleaseEventCallbackFunction = 860 Ticks
CDGetReleasedData OK in CameraReleaseEventCallbackFunction
Finnished CDRelease @ CPU-tick 0x000023A5 <----------------------------------In Main
Time to CDRelease = 860 Ticks
CDRelease OK = 1


All log-lines between "<-------- In Main" are from the callbackfunctions

A piece of my code calling CDRelease,

start = clock();
fprintf(log_file,"Entering CDRelease @ CPU-tick 0x%08X", clock());
err = CDRelease( m_hSource, FALSE, (cdProgressCallbackFunction *) NULL,1, cdPROG_REPORT_PERIODICALLY, &count);
fprintf(log_file,"Finnished CDRelease @ CPU-tick 0x%08X", clock());
end = clock();
fprintf(log_file, "Time to CDRelease = %d Ticks", end - start);

As you can see , I don't return from CDRelease until the callbackfunction has retrived the image.

Ok, the BIG question is, am I doing something wrong, or is there an error in the documentation or what?

Do I need to thread my call to CDRelease in order to be able to do things "concurrently"?


Best Regards,
Mikael Emretsson

atleypnorth
8th of March 2005 (Tue), 02:50
You need to change it so you do no processing in the callback - the point I was trying to make (badly) before. Callbacks happen into the main thread so if you do something that takes time in a callback then yes it blocks the main thread ...

So calling the CDGetReleasedData function to get the data should be handled in a seperate thread. No where in the documentation does it say that function is threaded, as to wether it should say it isnt is another matter ....



Ok, the BIG question is, am I doing something wrong, or is there an error in the documentation or what?

Do I need to thread my call to CDRelease in order to be able to do things "concurrently"?

Best Regards,
Mikael Emretsson

Emret
21st of March 2005 (Mon), 11:07
Ok, I opened a thread for my image evaluation, and it works!
I’ve also created a thread for my ViewFinder proc, but Canon’s SDK redist-file “cdproc.exe” goes banana from time to time, even sometimes without using the ViewFinder.
I have noticed some flicker of my ViewFinder-data, and suddenly without any warning, it locks and cdproc.exe takes all processing-time. It seems to loose communication with the camera.
I thought I’ve found the problem once, enabling HT in BIOS, and It worked for several days. But now I’m back on square one again!
Any ides?

Best Regards,
/Emret

atleypnorth
21st of March 2005 (Mon), 15:05
If you are updating the view finder image then this has to be done in the main thread - handling the callback should be quick since it is 'only' displaying the image data. You can display from another thread but in has to synchronize to the main thread since the main thread 'owns' the visual components of your program.

Patrick

Adil Abdulhadi
1st of October 2005 (Sat), 00:34
Hi texdba,

first! have you sovled your problem - i may encountered the same. Second is i am also developing a similar project in VB6 like yours but i dont have the SDK becuase i am staying in Saudi Arabia. i could not get any help neither from Caon local agent nor from Canon Europe!. i feel embarassed because i am the one who sauggested to buying and using PowerShot A85 to sovle our clients request for a User-free capturing, saving and printing Id cards.

Could you please help in this regard.

Thanks

Adil Abdulhadi
amaxco@hotmail.com