Some time ago I posted a simple hack to allow the USB remote to work in conjunction with PTP so that precision sync could be used.
http://chdk.setepontos.com/index.php?topic=8769.msg105488#msg105488While simple, it requires a custom build to use. I've had several requests for customized CHDK versions implementing that hack so maybe it's time to roll it into the dev trunk ? And make it so that the hack can be enabled/disabled at run time.
I believe that the options at this point are :
- Do nothing. Custom hacks are the way to go.
- Add the hack as a build option.
- Make the hack something that can be enabled/disabled in the CHDK Settings or USB Remote menu.
- Add a script function that enables / disables the hack.
- Add a ptp only function that enables / disable the hack.
Obviously, the first two options have big support and compatability problems with being obsolete days after they are created.
The third option (CHDK menu) adds a very specialized function of limited use to most people. Not that CHDK does not already have more than a few of those but why continue to do that?
Option four is promising and option five is really just a subset of option four without the need to document and support the function. Although option five would require support from the PC client so generic PTP programs would not be able to use it.
One big draw back to all this is that the hack currently happens in the kbd.c file for each camera. It's going to be quite a bit of edit / script work to update all those files. But is has been done before.
int ptp_and_usb_remote_play_nice_together_flag = 0 ;
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);
if ( ptp_and_usb_remote_play_nice_together_flag )
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;
}
}
Maybe there is a simpler / more elegant way to do this ?
edit : fixed spelling on subject line