CHDK PTP interface - page 2 - General Discussion and Assistance - CHDK Forum

CHDK PTP interface

  • 1244 Replies
  • 534523 Views
Re: CHDK PTP interface
« Reply #10 on: 10 / October / 2009, 08:16:23 »
Advertisements
This is a bit too advanced for my basic knowledge.
Sorry about that.

Quote
It would be VERY tedious to support all cameras.
I don't know about that. Of course, every feature that relies on previously unused functions from the firmware requires each and every firmware to be inspected, but that is inherent to the CHDK. Perhaps it is possible to find a few generic signatures that can be used instead. Otherwise you can just give empty definitions by default and override them only for some cameras (as is done with other "optional" functionality).

The only thing that is really needed is the address of add_ptp_handler. For specific features (shutdown/reboot and mode switching) you need a few more.

Quote
Could you list the steps that I have to take to compile and patch the various softwares (under Windows) and run the command line for testing ?
Sure, but I'm not sure about the Windows part as I can't test it. Also, I haven't looked at VxWorks, so that might also be a bit different.

For the CHDK you need the following:

  • NHSTUB for add_ptp_handler (found as discussed in my documentation)
  • Platform functions shutdown_soft, reboot and switch_mode (I've put them in lib.c)
  • Make sure init_chdk_ptp is started as task (see boot.c of IXUS 870 IS 1.01a)

The platform function need not have anything as body, unless you want the appropriate functionality to work. In the latter case you also need the following:

  • Address for power button (I've found it, together with the playback button, in taskcreate_Startup, most clearly in function 0xFF845D18)
  • NHSTUB for reboot_fw_update (can be found by searching for "FirmUpgrade.c")
  • NHSTUB for set_control_event (discussed in documentation; for VxWorks you seem to need DisableNotificationPTP)
  • NHSTUB for PB2Rec and Rec2PB functions (searchable as strings)
  • Values to pass to set_control_event (can be found as discussed in documentation; not needed for VxWorks)

To get libptp/ptpcam you should download the latest version (1.1.10) or, in case of Windows, I'd download the sources linked to before in this thread. Then apply my patch (I think it should work for the Windows variant as well) and compile it. I'm not sure which compilers work for Windows and whether or not you need libusb as well.

I think that should be it. Let me know how things work out.

Edit: added creation of init_chdk_ptp as task to todo list.
« Last Edit: 10 / October / 2009, 14:48:59 by mweerden »

Re: CHDK PTP interface
« Reply #11 on: 10 / October / 2009, 08:32:23 »
Many thanks for that.

I will do a few chores and start this later.

I am sure I will have problems, I will contact you directly  :)


David

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: CHDK PTP interface
« Reply #12 on: 10 / October / 2009, 09:23:28 »
@mweerden

many thanks for this, great project !

Quote
I'm not sure which compilers work for Windows
are you using the same compiler setup for this as for compiling CHDK ?  and which native/ARM GCC versions do you use ?

TIA,

wim
 


Re: CHDK PTP interface
« Reply #13 on: 10 / October / 2009, 09:55:41 »
Quote
I'm not sure which compilers work for Windows
are you using the same compiler setup for this as for compiling CHDK ?  and which native/ARM GCC versions do you use ?
Yes. For CHDK I'm using 4.3.3 and for libptp/ptpcam 4.3.3-12 (Debian).

Re: CHDK PTP interface
« Reply #14 on: 10 / October / 2009, 13:16:11 »
In conversation with Microfunguy I realised that getting things done on Windows isn't always as easy. I've created a zip with sources for Windows (here). This works for me with MinGW and libusb for Windows (filter binary). You'll probably have to adjust some paths in the Makefile to make things work for your system.

One problem I noticed on Windows is that with certain request (as the ones Windows automatically makes) the camera goes into a deeper mode of sleep (if you will). In this mode not everything works as otherwise (e.g. shutdown and mode switching; edit: you shouldn't test another function if the previous has already crashed the camera). Edit: it seems that mode switching first makes the camera stay in the current mode. Perhaps a wrapper around PTP_OC_OpenSession that calls set_control_event(0x902) should be used.

I also noticed that my ptpcam patch had a small bug (the last #endif should have been just before the preceding else). This has been fixed.
« Last Edit: 10 / October / 2009, 13:29:05 by mweerden »

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: CHDK PTP interface
« Reply #15 on: 10 / October / 2009, 17:03:58 »
I've created a zip with sources for Windows (here). This works for me with MinGW and libusb for Windows (filter binary).
I also noticed that my ptpcam patch had a small bug (the last #endif should have been just before the preceding else). This has been fixed.

Oh, many thanks, now ptpcam.exe works (sometimes), still w/o CHDK
I had to turn off "Canon Camera Access Library 8" service for more stable work.

Re: CHDK PTP interface
« Reply #16 on: 10 / October / 2009, 17:10:13 »
now ptpcam.exe works

Is that with A710IS ?

Nothing happens with my A460 or A620.

I have disabled external programmes starting when the 'Camera Connected' event happens.

ptpcam -L  just waits forever.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: CHDK PTP interface
« Reply #17 on: 10 / October / 2009, 17:35:07 »
Is that with A710IS ?
Yes.
Quote
ptpcam -L  just waits forever.
How about disable "Canon Camera Access Library" service (and in extreme case, WIA service) in services applet?

Re: CHDK PTP interface
« Reply #18 on: 10 / October / 2009, 17:53:11 »
How about disable "Canon Camera Access Library" service (and in extreme case, WIA service) in services applet?


Whoaaah  ....   that works !

Is there any way the ptpcam code can do that  ?


David

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: CHDK PTP interface
« Reply #19 on: 10 / October / 2009, 19:02:16 »
Is there any way the ptpcam code can do that  ?

Maybe you can do this in batch file:
Code: [Select]
net stop CCALib8
ptpcam --chdk
net start CCALib8

p.s. For a710 NHSTUB(add_ptp_handler, 0xFFE59FE4) - and transfer works! But uploading/downloading of files fails - ptpcam reports about unexpected result code, then camera shuts down.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal