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 3584I 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.