New version - implemented as per my previous post. No more script function - just a simple change to switch_mode_usb() that I think should work for everyone.
I think I prefer having a separate script function to enable the "sharing" behavior.
Using USB remote + PTP is a pretty niche application, I would rather not add additional side effects to switch_mode_usb just for that.
switch_mode_usb is also declared weak in the expectation that some cameras need to override it. Currently none do AFAIK, but there are several that have issues with mode switching.
I'm also not convinced that enabling "shared" USB automatically when someone switch to rec mode in USB is desirable. Someone not using the remote might want the normal behavior if the USB is unplugged.
Quite frankly, just using chdkptp is niche as well. I'd venture to suggest the number of multicam rigs (stereo up to bullet time) out weigh devs like you and I (plus web cams replacements) using chdkptp in single camera mode? Call it a toss up?
if somebody is also doing an overload of the _weak_ definition then it's up to them how they handle (or ignore) the shared_usb_port flag ?
Does this really introduce a side effect that will ever matter to anyone?
I'd bet that if we go with the first option, most scripts will have switch_mode_usb() followed immediately by share_usb_port() anyway.
Sure, but having generic stuff that needs to be reproduced in camera specific files is a source of pain, as you must know from dealing with kbd.c. I'd rather not multiply it.
Sorry to be argumentative again, but as you know, I have opinions
If we go with the first, the code for kbd.c and usb_sync.c in the second version has a better workflow so I'd merge that back into the first patch prior to committing to the trunk.
Quote from: reyalp on 16 / August / 2014, 01:26:35Sure, but having generic stuff that needs to be reproduced in camera specific files is a source of pain, as you must know from dealing with kbd.c. I'd rather not multiply it.Unfortunately, the change to kbd.c needed to make this work will continue to be a pain.
He might mean that it would be better to reduce the change in camera-specific kbd.c files to an added function call, and do the actual work in a single generic routine.
I should probably expand a bit on this (and rant a bit). Currently, USB remote menu setup is partially coupled to how the USB remote scripting commands work. The USB remote enabled menu setting affects how some of the underlying code works but not other parts of it. Which can be confusing as the whole remote thing essentially works differently if you are in <ALT> than when you are not.With my second patch, I probably make this worse. Or start to make it better, depending on how you look at it. The first patch only works if the USB remote is enabled in the CHDK menu. Which is annoying if you are trying to use PTP.
So the second patch enables sharing use of the USB port and the precision sync functionality without needing the remote to be enabled. But it still requires the sync menu item to be selected. This all works fine if you understand the precedence but I can see where it will be confusing (as it already is - the whole remote thing essentially works differently if you are in <ALT> than not). So the question is whether to go with the second (more convenient) method or not ?
So PTP would be ignored until you set the sharing setting? That would definitely ugly for people who primarily wanted to control via PTP.
I think the second method sounds better. I guess the alternative would be to make the "share" setting a config option. This could still be set from script, and would make it explicit. (edit: not saying it should be this way, just thinking out loud)
Another thing occurred to me this morning. There's another situation where you might want to trick the camera into thinking there is a USB connection when there isn't, separate from the remote:If you you switch modes with USB connected, and then disconnect / reconnect USB, things get weird. If you want to have a camera that is occasionally connected to USB (e.g. to download photos from a camera in the field, or a setup where the USB host is only powered on some of the time) one way to do it would be to make it think USB is always there. Then (usb) mode switching would work as normal.
Started by bullfrog Feature Requests
Started by waterwingz General Discussion and Assistance
Started by Peter Machtschuß General Discussion and Assistance
Started by Josh P « 1 2 3 » Script Writing
Started by Kam_mim General Discussion and Assistance