supporting USB remote and PTP communications concurrently - page 3 - General Discussion and Assistance - CHDK Forum

supporting USB remote and PTP communications concurrently

  • 33 Replies
  • 14943 Views
*

Offline reyalp

  • ******
  • 14080
Re: usb remote w/ptp
« Reply #20 on: 16 / August / 2014, 18:05:44 »
Advertisements
I think I explained that right but I'm not sure it's as bad as you are thinking.  After all, that's how it works today - if you have the USB Remote enabled, you can't do PTP.
So without my second version,  the sequence for ptp with precision sync is :
  • make a ptp connection
  • switch to shooting mode via switch_mode_usb()
  • enable USB remote (and sync if it's not already set) by poking the CHDK menu item
  • call share_usb_port(1)
  • shoot
  • drop the USB 5V line
  • restore the USB 5V line
  • repeat steps 5 to 7 until happy
  • call share_usb_port(0)
  • disable USB remote by again by poking the CHDK menu item
  • profit
Right, but if you missed step 10 due to a crash or something, you wouldn't be able to to get back to 1 without doing something on the camera, or using a startup script. A startup script wouldn't be a bad idea for this kind of application anyway, but with the other option isn't required.
Don't forget what the H stands for.

Re: usb remote w/ptp
« Reply #21 on: 16 / August / 2014, 18:09:49 »
Right, but if you missed step 10 due to a crash or something, you wouldn't be able to to get back to 1 without doing something on the camera, or using a startup script. A startup script wouldn't be a bad idea for this kind of application anyway, but with the other option isn't required.
My point exactly - we are on the same page here.

Are you in favor of adding the modified patch ( shared_usb_v11.patch ) to the autobuild then ?  It has the new script function plus "option two" from this discussion.

Or would it be better to get some feedback from the two A2500 3D imaging rig people (elizabeth.m & novsela) currently using a custom build ?

« Last Edit: 16 / August / 2014, 18:21:12 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: supporting USB remote and PTP communications concurrently
« Reply #22 on: 16 / August / 2014, 19:32:20 »
In passing, it may or may not be of interest to know that not all multicam rig users require PTP support.
Since the beginning of the year, and as recently as this week, an SDM user has been using a 24-camera rig for professional shoots and apparently has been handsomely paid for his work.

He just uses a simple remote with his outdoor SX160 rig and can also capture timelapse multicam sequences.

Seems quite happy with the arrangement.

Re: supporting USB remote and PTP communications concurrently
« Reply #23 on: 16 / August / 2014, 19:41:08 »
Seems quite happy with the arrangement.
Makes one wonder how much happier he would be with a setup that let him transfer images automatically too.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: supporting USB remote and PTP communications concurrently
« Reply #24 on: 16 / August / 2014, 19:45:37 »
Makes one wonder how much happier he would be with a setup that let him transfer images automatically too.

Makes no difference, the fees he is paid will be the same.

Anyway, if he ever needs such a feature he will just use CHDK, no point in creating hard work :)

EDIT

The pictures ARE transferred automatically to individual folders.
« Last Edit: 16 / August / 2014, 19:47:49 by Microfunguy »

Re: supporting USB remote and PTP communications concurrently
« Reply #25 on: 17 / August / 2014, 18:50:15 »
Updated patch file based on IRC conversations and an interesting uBASIC side effect ( hint : don't try to add a new function starting with the letters "for..." )

The new script function is usb_force_active().   Patch file and example scripts attached.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: supporting USB remote and PTP communications concurrently
« Reply #26 on: 17 / August / 2014, 19:15:04 »
I think the following part of kbd.c could be moved into a common function:
Code: [Select]
+    #ifdef CAM_ALLOWS_USB_PORT_FORCING
+        if ( forced_usb_port )  physw_status[USB_IDX] = (physw_status[USB_IDX]& ~(SD_READONLY_FLAG)) | USB_MASK ;
+        else if (conf.remote_enable)
+                                physw_status[USB_IDX] =  physw_status[USB_IDX] & ~(SD_READONLY_FLAG  | USB_MASK);
+             else               physw_status[USB_IDX] =  physw_status[USB_IDX] & ~SD_READONLY_FLAG;
+    #else
+        if (conf.remote_enable) physw_status[USB_IDX] =  physw_status[USB_IDX] & ~(SD_READONLY_FLAG  | USB_MASK);
+        else                    physw_status[USB_IDX] =  physw_status[USB_IDX] & ~SD_READONLY_FLAG;
+    #endif
In case there are cameras with negated USB or SD_READONLY flags, that will need to be considered somehow.

Re: supporting USB remote and PTP communications concurrently
« Reply #27 on: 17 / August / 2014, 19:24:52 »
I think the following part of kbd.c could be moved into a common function:
Or it could be a macro - it only gets called once per build after all.  But this gets back to the number of changes to all the kbd.c files we want to make prior to flipping 1.3.0 to stable.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14080
Re: supporting USB remote and PTP communications concurrently
« Reply #28 on: 17 / August / 2014, 23:03:13 »
Updated patch file based on IRC conversations and an interesting uBASIC side effect ( hint : don't try to add a new function starting with the letters "for..." )

The new script function is usb_force_active().   Patch file and example scripts attached.
Added in trunk changeset  3584

I agree this can and should be made generic, but it's a niche enough feature that having it enabled on request for now shouldn't be a big deal for now.

A couple of other notes:
If you set usb_force_active, unplug the camera, and plug it back in you may get a windows error. I assume this is because the camera thinks it never disconnected, but the PC does. It seems like there's some kind of time out on the camera, so if you wait long enough before plugging in, it works OK.

After all the trouble ubasic gave us, I'm not sure it makes any sense to have a ubasic function. This feature only makes sense with PTP, which means you will be using lua anyway. If this is correct, I'd be tempted to remove it.

edit:
Even if we don't add support to all the cams at once, it would make sense to use a common function (or macro) for the new code and use that in the cameras we enabled this for.
« Last Edit: 17 / August / 2014, 23:12:29 by reyalp »
Don't forget what the H stands for.

Re: supporting USB remote and PTP communications concurrently
« Reply #29 on: 16 / October / 2014, 20:02:27 »
I agree this can and should be made generic, but it's a niche enough feature that having it enabled on request for now shouldn't be a big deal for now.

Would it be possible to get this enabled for the A3400 IS?

We're trying to run some tests with a few cameras using CHDKPTP (bcam) and using the battery temperature sensor for remote sync triggering.

I've added and enabled the A/D channel setting in platform.h and have no trouble getting the cameras to sync and shoot, but when running the bcamRem script (or with any PTP connection) I can't seem to get the camera to acknowledge the battery trigger. I haven't been able to figure out what needs to be enabled to get PTP and the A/D trigger to play nice together. Running the bcamRem script with the remote sync value set seems to force off the remote parameter under CHDK settings - which is the only place I see the option of specifying the remote channel.

This project is just starting out and we've made it pretty far by digging through the forums, but we've hit a bit of a wall. Any assistance would be greatly appreciated.

 

Related Topics