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

CHDK PTP interface

  • 1244 Replies
  • 525390 Views
Re: CHDK PTP interface
« Reply #260 on: 06 / October / 2010, 12:26:12 »
Advertisements
In theory, there is a Canon PTP operation code (0x901d) to send the 320x240 JPG viewfinder image.

Has anyone been able to read the values of Canon custom operation codes (9xxx)  ?

Type ptpcam -o to see the codes and ptpcam --show-property=9002    for example.


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #261 on: 06 / October / 2010, 14:00:52 »
In theory, there is a Canon PTP operation code (0x901d) to send the 320x240 JPG viewfinder image.

Has anyone been able to read the values of Canon custom operation codes (9xxx)  ?

Type ptpcam -o to see the codes and ptpcam --show-property=9002    for example.

At least my a570 doesn't support opcode 0x901d. There are about 25 opcodes unknown to ptpcam in this camera's opcode list (but an opcode existing doesn't mean it actually does something, of course).

Properties != opcodes i.e. --show-property goes with ptpcam -p, not ptpcam -o. See ptpcam --show-all-properties.

To find out how to use unknown opcodes, one probably needs to search for the opcode's handler from disassembly. The Canon remote capture SDK could help, assuming they use similar commands in cameras that do not support ptp remote capture. Spying on USB connection using Canon's windows applications could also help, especially if it's known for some camera that those tools do more than regular camera PTP 'mass storage'-ish mount functinality.

*

Offline reyalp

  • ******
  • 14119
Re: CHDK PTP interface
« Reply #262 on: 16 / October / 2010, 23:43:40 »
I'm working on getting a version of this into the trunk. This will mostly be mweerden's proposal, with a few adjustments
- PTP is a build time option. If OPT_PTP is set in build conf, it is built for those cameras that have it enabled in camera.h
- PTP task starting is reworked so it requires no camera specific code.
- reboot stuff is merged with my reboot code.
- add_ptp_handler is added to sigs. This is the only thing strictly required for minimal PTP operation, so most cameras should be able to support PTP just by adding CAM_CHDK_PTP to camera.h. However, many will also need additional code to allow switching to rec and shooting.
- on dryos cameras, reboot_fw_update is also added to sigs. if reboot() is passed a filename that ends in .FI*, it will be loaded with this function. I haven't got around to adding the equivalent for vxworks, so reboot with an .FI* file it will just return.

OPT_PTP will be disabled by default initially. I don't see this as the definitive PTP implementation, rather as a starting point to get this moving again. Some outstanding issues
- I would really like to see ewavrs tool, or something like it compatible with the final version. The live view streaming is worthwhile, and should be supported in the core features somehow. Generally, it looks like we just need a way of returning the video buffer configuration. I think there could be default weak functions that work with most layouts based on existing lib.c functions, and cameras with different configurations could override them. Or maybe there's a native canon way to do it.
- the play/rec switching stuff should be unified, and if possible a portable way of doing this on newer cameras should be found. Maybe the pb2rec etc functions can be added to the sig finder, or maybe there are some event procs we can use. I'll be working on this since it applies to D10.
- scripting should be made a bit more flexible somehow, so you don't have to put the entire script in each command line.

Since this will be disable by default, I plan to commit it as soon as I've verified that there are no build-breaking sig finder failures. I haven't added all the individual camera specific patches yet, so initially only D10, A540 and ixus870_sd880 will be enabled in camera.h. I'll try to add the others later. For cameras that don't need specific mode switching code, just enabling it in camera.h may be enough. I probably won't go through and verify all the sig finder matches, so caution is advised before enabling it on your camera.

edit:
Checked in changeset 957 . I have not verified all the stubs, but I sampled a range of new and old cameras and all I checked were fine, including some low matches for reboot_fw_update
« Last Edit: 17 / October / 2010, 01:45:24 by reyalp »
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #263 on: 17 / October / 2010, 06:51:14 »
Is it worth adding the signature for set_control_event ?

Are you saying that the DRYOS-based cameras will work with PTP in Record mode without any mode switching from playback ?

My VxWorks A620 only works if connected in Playback mode and then switched to Record by a 'mode 1' command with ptpcam.



*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #264 on: 17 / October / 2010, 08:08:45 »
Goodie :)

Mode switching should indeed be handled better somehow. For a570 I tested it quite extensively a while back and the result was that normal mode switching commands in Lua work fine and that no matter how I choose to switch between modes, I must keep my hands off the rec/play lever while in PTP mode (typically causes PTP to stop working with no way to reconnect until camera reboot). I was unable to replicate the failed mode switchings I thought I saw in previous tests.

Are you saying that the DRYOS-based cameras will work with PTP in Record mode without any mode switching from playback ?

My VxWorks A620 only works if connected in Playback mode and then switched to Record by a 'mode 1' command with ptpcam.

My vxworks Digic III a570 doesn't start PTP services in REC mode either. But that's not a problem since I can run an autorun script that switches to PLAY. PTP will start. The reason I may choose to do it this way is that the mode lever will be in physically correct position after I command the camera back to REC mode using PTP.

Using current default Lua implementation of mode switching, I haven't experienced any problems with having the lever in incorrect position, though, but I haven't really used this much yet. My old implementation using _PB2Rec() / _Rec2PB() with _DisableNotificationPTP() performed worse in some tests (sometimes screen would go black and sometimes switching would appear to work but the cam immediately returned to the previous mode).
[/quote]

Re: CHDK PTP interface
« Reply #265 on: 17 / October / 2010, 08:52:49 »
How about  :-

Code: [Select]
void switch_mode(int mode)
{
  if ( mode == 0 )
  {
    PostLogicalEventForNotPowerType(0x1003);
  } else if ( mode == 1 )
  {
   PostLogicalEventForNotPowerType(0x1001);
  }
}

*

Offline reyalp

  • ******
  • 14119
Re: CHDK PTP interface
« Reply #266 on: 17 / October / 2010, 14:04:19 »
Is it worth adding the signature for set_control_event ?
If it's needed by many cameras, and matches reasonably well.
Quote
Are you saying that the DRYOS-based cameras will work with PTP in Record mode without any mode switching from playback ?
No. I'm saying that (some ? most ? all ?) dryos cams will need something more than PressRecButton (0x1001)/PressPBButton(0x1003), possibly involving set_control_event and/or pb2rec etc. so they can switch to record mode in PTP. Without this, shooting will not be available.

BTW, I'd suggest pairing each press with an Unpress.
Quote
My VxWorks A620 only works if connected in Playback mode and then switched to Record by a 'mode 1' command with ptpcam.
Don't forget what the H stands for.

*

Offline c10ud

  • ***
  • 245
Re: CHDK PTP interface
« Reply #267 on: 17 / October / 2010, 14:10:42 »
i tried mweerden's original patch with some dryos cameras, pb2rec and rec2pb along with set_control_event work pretty well, i think it could be worth it adding them to the sigfinder..


*

Offline waldo

  • ***
  • 238
Re: CHDK PTP interface
« Reply #268 on: 17 / October / 2010, 15:06:46 »
FYI, I am adding PTP support to my S95 port and the S95 firmware is identical to the ixus870 firmware for the PTP code.  This includes the functions add_ptp_handler, set_control_event, PB2Rec, and Rec2PB. 

Re: CHDK PTP interface
« Reply #269 on: 17 / October / 2010, 15:45:36 »
I have added PTP support to IXUS95 and have used   set_control_event(0x80000902) and set_control_event(0x902).

I am told it works.

@reyalp
If you have all the firmware dumps and can apply a set_control_event signature to them, it would be appreciated.

I really do not feel like manually checking all the DRYOS cameras.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal