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

CHDK PTP interface

  • 1227 Replies
  • 373304 Views
*

Offline srsa_4c

  • ******
  • 4426
Re: CHDK PTP interface
« Reply #1020 on: 04 / July / 2013, 20:26:57 »
Advertisements
Code: [Select]
press('shoot_half')
repeat sleep(10) until (get_flash_ready() and get_shooting())
click('shoot_full')
This one works better (using the a410 this time), but still not completely reliable.
I think this issue can be simulated by hand, the camera sometimes fails to notice short shutter presses when flash is involved. It's also camera dependent, happens only rarely on the a470.

*

Online reyalp

  • ******
  • 13400
Re: CHDK PTP interface
« Reply #1021 on: 04 / July / 2013, 21:16:38 »
This one works better (using the a410 this time), but still not completely reliable.
I think this issue can be simulated by hand, the camera sometimes fails to notice short shutter presses when flash is involved. It's also camera dependent, happens only rarely on the a470.
What if you use a
press('shoot_full')
sleep(500)
release('shoot_full')

edit:
I get the same thing on a540. Now I understand the timeout is client timeout, not remotecap timeout
« Last Edit: 04 / July / 2013, 21:25:23 by reyalp »
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4426
Re: CHDK PTP interface
« Reply #1022 on: 04 / July / 2013, 21:28:01 »
What if you use a
press('shoot_full')
sleep(500)
release('shoot_full')
It doesn't shoot (so it's worse than the previous script). It's still the a410, and I'm commanding it through ptp. Increasing the delay increases the success rate (1000 ms sometimes works, 5000ms probably always works...).

*

Online reyalp

  • ******
  • 13400
Re: CHDK PTP interface
« Reply #1023 on: 04 / July / 2013, 21:34:56 »
It doesn't shoot (so it's worse than the previous script). It's still the a410, and I'm commanding it through ptp. Increasing the delay increases the success rate (1000 ms sometimes works, 5000ms probably always works...).
In case it wasn't clear, I meant the above instead of click('shoot_full') in the previous code.
Don't forget what the H stands for.


*

Offline srsa_4c

  • ******
  • 4426
Re: CHDK PTP interface
« Reply #1024 on: 04 / July / 2013, 21:47:40 »
In case it wasn't clear, I meant the above instead of click('shoot_full') in the previous code.
I see. That seemed to have increased the success rate, but still tends to fail when it wakes the camera from  'sleep'. I wonder what nafraf's cameras will do.

*

Online reyalp

  • ******
  • 13400
Re: CHDK PTP interface
« Reply #1025 on: 04 / July / 2013, 22:06:23 »
In changeset 2924 I made it so a PTP error is generated if timeout occurs while a chunk is being transferred. The resulting file will be corrupt, but at least the client can notice.

Regarding the previous discussion of PTP_CHDK_RemoteCaptureIsReady status when remotecap has not been initialized (or has been cleared by a timeout etc) I've decided to leave it as a status value rather than a PTP error. In changeset 2923 I renamed the constant to PTP_CHDK_CAPTURE_NOTSET to make this distinction clearer. My reasoning is this is something you might want to query as a status, not treat as an error, although it does mean that the treatment of timeouts is a bit weird.

I think this completes all the significant structure / logic / protocol I wanted to do before merging to the trunk. A final cosmetic change is to rename the script functions to *usb_capture* to match the read/write_usb_msg. After that, I'm going to merge it into the trunk unless there are objections.
Don't forget what the H stands for.

*

Offline nafraf

  • *****
  • 1308
Re: CHDK PTP interface
« Reply #1026 on: 04 / July / 2013, 22:44:37 »
In case it wasn't clear, I meant the above instead of click('shoot_full') in the previous code.
I see. That seemed to have increased the success rate, but still tends to fail when it wakes the camera from  'sleep'. I wonder what nafraf's cameras will do.
I'm testing with script. 15 shoots on each camera (a810, sx160) 100% worked.

*

Online reyalp

  • ******
  • 13400
Re: CHDK PTP interface
« Reply #1027 on: 05 / July / 2013, 02:40:17 »
Remote capture support merged to trunk in changeset 2927.

Any further work on this should be done in the trunk.

Raw/dng capture should work on all cameras, but the jpeg will be saved to the card. To support jpeg and and suppressing jpeg writes, filewritetask needs to be implemented. Patches adding filewrite support for more cameras are welcome. Requests for filewrite support on specific cameras are also welcome.

You will need the chdkptp from the latest svn (r382 or later) to use. I'll release a new snapshot build soon. There are still some things to do on the client, but they don't need to hold up the initial release.

edit:
Apparently I broke the build... working on it

edit:
OK, I guess hook_raw_size went away while I wasn't paying attention.

This means that the workaround in remotecap for the stupidity with a470 having raw size != raw_rows * raw_rowpix is gone.

I suggest we update a470 to use the actual sensor size values from the firmware.
« Last Edit: 05 / July / 2013, 03:02:50 by reyalp »
Don't forget what the H stands for.


*

Offline philmoz

  • *****
  • 3332
    • Photos
Re: CHDK PTP interface
« Reply #1028 on: 06 / July / 2013, 06:32:24 »
G12 seems ok.

G1X & IXUS310 timeout if flash enabled 90% of the time.

(The flashtest.lua script works on both cameras without any problems.)

Edit:
Problem with flash appears to be twofold.
 - rs_shoot_single (rlibs.lua) is not waiting for get_flash_ready()
 - luaCB_get_flash_ready() is calling shooting_is_flash(); but should be calling shooting_is_flash_ready()

Making these two changes fixes IXUS310 & G1X.
Note sure if the above change to luaCB_get_flash_ready is the right thing to do or if it should be a new function (might break other scripts).

Phil.
« Last Edit: 06 / July / 2013, 08:03:55 by philmoz »
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Online reyalp

  • ******
  • 13400
Re: CHDK PTP interface
« Reply #1029 on: 06 / July / 2013, 15:57:42 »
- luaCB_get_flash_ready() is calling shooting_is_flash(); but should be calling shooting_is_flash_ready()
Ah, that makes sense.

Ubasic also uses shooting_is_flash() ....

It looks like this snuck in in changeset 1632, so I'd say we should fix both.

The fact that no one complained probably means it is rarely used.

edit:
Ugh, it gets more complicated:
shooting_is_flash returns:
shooting_get_prop_int(PROPCASE_IS_FLASH_READY), which is what the old ubasic code did.

shooting_flash_is_ready checks more stuff.
« Last Edit: 06 / July / 2013, 16:04:53 by reyalp »
Don't forget what the H stands for.

 

Related Topics