Mod edit:
For anyone stumbling on this post later, the code modification described below is now available using
usb_force_active, available by default for almost all ports in CHDK 1.4 and later.
Based on some of your notes I guess my primary school picture, attached, is not a particularly sound basis to meditate upon ?
You've pretty much got it with that drawing. I can't comment on how well the daisy chaining of USB hubs like that will work. And you will have to manage the PTP PC software on your own. But here is what's needed on the CHDK side :
I turns out that the simplest way to make PTP communication co-exist with CHDK's USB Remote code only takes one line of code added to a camera's kbd.c file (marked as NEW in this code snippet).
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]);
}
usb_remote_key() ;
if (conf.remote_enable) {
physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK);
physw_status[USB_IDX] = physw_status[USB_IDX] | USB_MASK ; // NEW : make it look like 5V is there no matter what
} else {
physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG;
}
}
I've tested it with a modified USB cable I use for CHDK development. Its a regular USB cable with a toggle switch inserted into the red 5V wire. This lets me test USB Remote code by toggling the switch. It also lets me download CHDK or a script or upload photos and then throw the switch to disconnect PTP without having to unplug the cable.
Using this setup and the switch closed, I was able to connect to my camera with CHDKPTP, go into shooting mode and issue a "shoot" command. With USB Remote enabled and sync enabled, this caused the picture shooting process to start but then wait on the USB 5V signal. I opened the switch and the picture taking process completed immediately. I was able to continue issuing commands to the camera - all I had to do next was make sure I closed the switch before the next shot.
Using your pictured setup, you would have to make a ptp connection to each camera and issue shoot commands to each over ptp. If your microcontroller then opened the 5V line, all cameras would shoot at exactly the same time. Which I believe is exactly what you are looking for!
Obviously, this requires a custom build and you will only be able to go into shooting mode using chdkptp using this simple code while CHDK is active. Adding a command to chdkptp to enable/disable this feature over ptp would be trivial. A CHDK menu option could also be added to do the same and/or some clever code inserted into the shooting sequence. Given the recent interest in this subject, maybe someone can convince reyalp that this is worth adding to the autobuild after suitable discussion about the implementation.