CHDK PTP interface - General Discussion and Assistance - CHDK Forum

CHDK PTP interface

  • 1244 Replies
  • 525312 Views
CHDK PTP interface
« on: 08 / October / 2009, 18:35:31 »
Advertisements
Hi all,

The last couple of days I've been working on a PTP extension for the CHDK that allows various remote operations (e.g. memory inspection/manipulation, function calls, uploading/downloading, switching to record mode and LUA script execution). I've also made an ad-hoc command-line tool to use it (based on ptpcam).

Have a look here for patches and documentation of what I did: http://www.mweerden.net/chdk_ptp.html

Re: CHDK PTP interface
« Reply #1 on: 08 / October / 2009, 19:39:46 »
wow - I will be checking this out tonight.  Wonderful work.
Canon Models - SD300, SD780, & SX210

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: CHDK PTP interface
« Reply #2 on: 09 / October / 2009, 03:21:59 »
Great stuff !
...will have a look to this, too - but first i need to apply the LongDay patch to extend my available CHDK-ing time from Day24h to Day32h   :-[

Re: CHDK PTP interface
« Reply #3 on: 09 / October / 2009, 11:02:55 »
I've added some similar functions to Magic Lantern for the 5D Mark II.  It looks like we duplicated each others efforts in reverse engineering the PTP context structure and callback interface.  I added fine grained focus control for interfacing with remote focus controllers like the Impero.

One of my other goals was to build a command console that would work over the PTP interface.  Perhaps it would allow arbitrary Lua commands to be sent, and use the USB as the stdout.  And as an outside goal, I wanted to add a gdb interface so that extensions could be more easily debugged.


Re: CHDK PTP interface
« Reply #4 on: 09 / October / 2009, 12:28:34 »
I've added some similar functions to Magic Lantern for the 5D Mark II.  It looks like we duplicated each others efforts in reverse engineering the PTP context structure and callback interface.
First time I even hear of Magic Lantern. ;) Fortunately the PTP part wasn't much work, but it would be nice if we can avoid duplication in the future. As I've said before, there is a lot of knowledge floating around these project, but most of it is inaccessible.

By the way, I just tried to find your functions (for comparison) but had no luck; can you give a me pointer?


Quote
One of my other goals was to build a command console that would work over the PTP interface.  Perhaps it would allow arbitrary Lua commands to be sent, and use the USB as the stdout.
This shouldn't be hard. I'm not sure if it's clear, but my "LUA script execution" means you can already execute arbitrary commands (e.g. "lua shoot();" with "ptpcam --chdk"). What I haven't looked at is something to preserve context between executions. Sending of output should be fairly simple (e.g. with a simple hook).

Quote
And as an outside goal, I wanted to add a gdb interface so that extensions could be more easily debugged.
Do you think this is possible? It seems to me that this requires support from the OS to provide tracing and breakpoints and what not. Has anything like this been found?

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: CHDK PTP interface
« Reply #5 on: 09 / October / 2009, 16:04:05 »
Great!
How about developers under Windows, can they use libptp or something else?

Re: CHDK PTP interface
« Reply #6 on: 09 / October / 2009, 17:56:14 »
How about developers under Windows, can they use libptp or something else?
A quick search gave me the following: http://code.assembla.com/CuteCanonCapture/subversion/nodes/libptp2?rev=30 This seems to be the libptp2-1.1.10 that I used with some minor changes to make it work on Windows. I don't think my code uses anything Linux specific. I currently don't have the right configuration around to try it out, however.

Re: CHDK PTP interface
« Reply #7 on: 09 / October / 2009, 23:09:43 »
First time I even hear of Magic Lantern. ;) Fortunately the PTP part wasn't much work, but it would be nice if we can avoid duplication in the future. As I've said before, there is a lot of knowledge floating around these project, but most of it is inaccessible.
Since I'm working solely on the 5D Mark II and 7D cameras and focusing almost entirely on the cinematography features, there isn't a whole lot of overlap with the CHDK dev team.  I hope there will be more cross-pollination in the future, however.

Quote
By the way, I just tried to find your functions (for comparison) but had no luck; can you give a me pointer?
ptp.h.  It isn't near as complete as your implementation; I plan to hack your hacked ptpcam program to work for me, as well work on a AVR PTP library so that the Impero can talk to the 5D.

Quote
I'm not sure if it's clear, but my "LUA script execution" means you can already execute arbitrary commands (e.g. "lua shoot();" with "ptpcam --chdk"). What I haven't looked at is something to preserve context between executions. Sending of output should be fairly simple (e.g. with a simple hook).
Neat.  I hadn't realized that.  ML doesn't have Lua yet, although we do have a simple embedded Python.  I've been meaning to port the Lua library patches so that we can put Lua into it.

Quote
Quote
And as an outside goal, I wanted to add a gdb interface so that extensions could be more easily debugged.
Do you think this is possible? It seems to me that this requires support from the OS to provide tracing and breakpoints and what not. Has anything like this been found?
I see things that look like a debugger interface in the command shell inside DryOS.  As you had found, there are equivalents to ps, top, and a few other programs.  We also have control of the scheduler, so we might be able to do some simple profiling.


Re: CHDK PTP interface
« Reply #8 on: 10 / October / 2009, 04:48:43 »
Have a look here for patches and documentation

This is a bit too advanced for my basic knowledge.

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 ?

Assume that I do not know anything.

If I manage to get that working, I will see if I can support my A620.

It would be VERY tedious to support all cameras.


David

Re: CHDK PTP interface
« Reply #9 on: 10 / October / 2009, 07:48:57 »
Quote
By the way, I just tried to find your functions (for comparison) but had no luck; can you give a me pointer?
ptp.h.  It isn't near as complete as your implementation; I plan to hack your hacked ptpcam program to work for me, as well work on a AVR PTP library so that the Impero can talk to the 5D.
Thanks, I somehow completely missed that file.

Quote
I see things that look like a debugger interface in the command shell inside DryOS.  As you had found, there are equivalents to ps, top, and a few other programs.  We also have control of the scheduler, so we might be able to do some simple profiling.
Hmmm, I'm not sure I'm as positive about the possibilities, but who knows? ;)

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal