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

supporting USB remote and PTP communications concurrently

  • 33 Replies
  • 14919 Views
Re: supporting USB remote and PTP communications concurrently
« Reply #30 on: 16 / October / 2014, 20:13:30 »
Advertisements
Would it be possible to get this enabled for the A3400 IS?
If I read your post correctly,  you are already making your own builds (in order to get the battery 3rd terminal hack working) ?

If so then you should be able to just add :

Code: [Select]
#define CAM_ALLOWS_USB_PORT_FORCING   1 to your platform_camera.h file,  modify my_kbd_read_keys() in your kbd.c file,and rebuild to resolve this.  You can use the code in the kbd.c file for the A1200 as a model :

Code: [Select]
void my_kbd_read_keys() {

    kbd_prev_state[0] = kbd_new_state[0];
    kbd_prev_state[1] = kbd_new_state[1];
    kbd_prev_state[2] = kbd_new_state[2];

    _GetKbdState(kbd_new_state);
    _kbd_read_keys_r2(kbd_new_state);

    if (kbd_process() == 0) {
        // we read keyboard state with _kbd_read_keys()
        physw_status[0] = kbd_new_state[0];
        physw_status[1] = kbd_new_state[1];
        physw_status[2] = kbd_new_state[2];
    } else {
        // override keys
        physw_status[0] = (kbd_new_state[0] | KEYS_MASK0) & (~KEYS_MASK0 | kbd_mod_state[0]);
        physw_status[1] = (kbd_new_state[1] | KEYS_MASK1) & (~KEYS_MASK1 | kbd_mod_state[1]);
        physw_status[2] = (kbd_new_state[2] | KEYS_MASK2) & (~KEYS_MASK2 | kbd_mod_state[2]);
    }

    #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

}

Sounds like you are working on a fun project - please post pictures and more details when you get a little farther along.  If you need help with the stuff I posted above just let me know?
« Last Edit: 16 / October / 2014, 20:55:24 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline cdg

  • **
  • 53
Re: usb remote w/ptp
« Reply #31 on: 06 / October / 2015, 05:29:53 »
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.

Hi reyalp:
    It's been a while  since last time i came to forum,i just have same problem like what you said----the crash problem.A startup script will be very helpful ,so how to write this startup scritup?

*

Offline cdg

  • **
  • 53
Re: supporting USB remote and PTP communications concurrently
« Reply #32 on: 06 / October / 2015, 05:34:07 »
or can we Reset option to Default ererytime we turn on the camera 

*

Offline reyalp

  • ******
  • 14079
Re: usb remote w/ptp
« Reply #33 on: 06 / October / 2015, 15:48:37 »
Hi reyalp:
    It's been a while  since last time i came to forum,i just have same problem like what you said----the crash problem.A startup script will be very helpful ,so how to write this startup scritup?
Note the text you quoted does not refer to the final implementation of this feature. It's been a while since I looked at this, but I thought the final did not require setting the remote cfg settings.

If you do need to use a startup script, just select it in the script menu and choose one of the autostart options. You should also be able to do this with set_config_value.

Don't forget what the H stands for.


 

Related Topics