I've started this developer's thread to hopefully open a discussion about what should be done with the USB remote code in CHDK. This includes the
core/kbd.c and
platform/model/kbd.c files.
While the first question might be "Why?", one only has to spend a little time looking at the current code to answer that question. Its undocumented, complicated, buggy and in some places broken. Never mind it being difficult to configure from the menus. There is a lot of history behind the current code - some of it here in the forum & wiki and some lost with the passage of time.
This is probably as good as it gets for documentation :
USB Remote CableI'm part way through the process of documenting the code as it exists now - just trying to figure out what its supposed to do. The next step is probably to clean things up by breaking it into logical functions, changing variable naming to reflect function and fix the parts that are broken. Right now there are also whole sections of code that can never be reached for example.
What to do next is a big question. For argument sake, if there is consensus on what to do, I'll take on the coding (with whatever help I can get). I think we can start the discussion by breaking things down as follows :
Current Capability - Hardware devices.
- Built-in Script-less Remote functions.
- Scripting support.
Hardware DevicesCurrent code supports two input devices :
- a "hand made switch" that simply turns power to the USB port on & off. There are several sources for these or you can build your own.
- the Ricoh CA-1 USB switch, widely avaible on Amazon or eBay. This device generates a specific series of pulses on the USB port power line
There are other devices on the market, for RC airplane, KAP and balloon flights, principally from gentles (
http://www.gentles.ltd.uk/ ). These are currently only supported via scripting.
Built-In Script-less Remote FunctionsThere are several different interrelated modes currently supported.
- Two press mode - click once for "half press", click again for "full press". Currently implemented in "Alex scriptless remote code". Allows you to cancel a shot by not following the exact required timing. Should work with CA-1 but does not with my cameras
- One press mode - apply power to USB port to "half press", remove power from USB port for "full press". Works in "syncable remote mode.
- Sync functions - waits in a tight loop for USB power to go away and then fires the shutter. A programmable delay is also available. This is mostly useful when coordinating with another camera or device ( i.e. SDM).
- Remote zoom - allows you to specify the zoom direction by pressing the right or left keys and then starts zooming on USB pulse. Mostly useful for coordinating zoom between two cameras ( i.e. SDM).
Scripting Support for USB RemoteCurrently two scripting methods of determining the USB remote state.
- wait_click 1 | is_key k "remote"
- get_usb_power - returns pulse width of last USB pulse
Note : its not clear that the scriptless / sync code is currently fully disabled when a script is running.
Finally, here's what I propose should be done (if its agreed to even allow a rewrite) :
- Provide built-in scriptless support for both "hand made switches" and the "Ricoh CA1".
- Support "one press" and "two press" activation methods.
- Other devices supported via scripting only.
- Support Sync and Sync delay for "one press" mode. Disabled for two press and script modes.
- Add scripting support to buffer up to 10 pulses widths - never miss a command.
- Add scripting support for pulse counting - returns number of pulses since last called.
- Delete built-in support for syncable zoom (defer to SDM for this).
- Rework the Remote Parameters menu to reflect the changes
But that's just my opinion. Other comments ?