CHDK PTP multiple instances - page 2 - General Discussion and Assistance - CHDK Forum  

CHDK PTP multiple instances

  • 180 Replies
  • 65669 Views
Re: CHDK PTP multiple instances
« Reply #10 on: 15 / September / 2013, 13:22:54 »
Advertisements
A guess: CHDK is able to mask the USB bit. If you know for sure that USB data connection is available, you could set/unset the USB bit independently from the hardware... It's just not a CHDK feature yet.
That's what I meant.  I have a little familiarity with that code after all.   ;)

In an IRC discussion with reyalp a few weeks ago we talked about converting the code so that the CHDK USB remote code only masks the bit when you are in shooting mode.  In playback mode it leaves it free for PTP communication.

We both agreed it was a good idea,  but it would disable the USB remotes ability to advance images in playback mode (something I was told was important when I wrote the v2 code).  It also requires editing over 100 individual kbd.c files - been there, done that, got the t-shirt.   reyalp had a pretty good idea of how to script that so that but it would still take a lot of patience to make sure it was done correctly.

I kinda assume that's what nafraf has done for his cameras - or something similiar.

Update : I suppose we could change the USB remote enable to allow a read only mode as well as the current OFF & ON modes
« Last Edit: 15 / September / 2013, 14:28:50 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK PTP multiple instances
« Reply #11 on: 15 / September / 2013, 14:20:46 »
[sort of] Makes sense to me.

Appreciate your comments srsa_4c & waterwingz

Re: CHDK PTP multiple instances
« Reply #12 on: 15 / September / 2013, 14:44:33 »
Update : I suppose we could change the USB remote enable to allow a read only mode as well as the current OFF & ON modes

You'd not be surprised to hear that i'm 'all ears' ?  ;)

*

Offline reyalp

  • ******
  • 14080
Re: CHDK PTP multiple instances
« Reply #13 on: 15 / September / 2013, 14:47:42 »
Reading through this thread and the others linked from it,  it's not clear to me how nafraf gets all his cameras to enable/disable the USB remote functionality locally so that PTP communications can be used interchangably with CHDK USB remote 5V sync?    But then nafraf has done quite a bit of CHDK porting work and is quite capable of spinning a custom version to support that I guess?
You could also switch in/out of usb remote mode using set_config_value. You'd need to take some care to not lock yourself out of PTP or be stuck with a camera side script running, but it's definitely possible.
Don't forget what the H stands for.


Re: CHDK PTP multiple instances
« Reply #14 on: 15 / September / 2013, 14:53:45 »
You could also switch in/out of usb remote mode using set_config_value. You'd need to take some care to not lock yourself out of PTP or be stuck with a camera side script running, but it's definitely possible.

Ah, interestinger and interestinger more and more interesting !

Re: CHDK PTP multiple instances
« Reply #15 on: 15 / September / 2013, 16:15:05 »
You could also switch in/out of usb remote mode using set_config_value. You'd need to take some care to not lock yourself out of PTP or be stuck with a camera side script running, but it's definitely possible.
Ummm ... how would that work?

If you did it over a chdkptp link,  wouldn't you immediately crash the link?

And if you do it from a script local to the camera,  how does it know when to call the set_config_value() funtion?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14080
Re: CHDK PTP multiple instances
« Reply #16 on: 15 / September / 2013, 16:59:45 »
Ummm ... how would that work?

If you did it over a chdkptp link,  wouldn't you immediately crash the link?
A script started over PTP isn't affected by the PTP connection going away.

so in ptp you do the usual
.loadfile('A/foo.lua')()

foo.lua would set_config_value to enable USB remote (edit: your client would get disconnected here. If you want a chance to disconnect cleanly, you could just have a delay in the script)

The next question is how you get back to PTP mode. If the script ends, and your remote is ON, you'll be stuck.

If the script stays running, then it could handle the shooting based on the remote signal, but I'm not sure how this interacts with sync?

Alternatively, the script could just use exit_alt() and go into a sleep loop waiting for the shot to happen (based on exposure count perhaps?) and disable remote once it's done to switch back to ptp mode.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDK PTP multiple instances
« Reply #17 on: 15 / September / 2013, 17:25:40 »
What would happen if CHDK could optionally set/clear the USB bit by itself, and the hw USB status would be practically ignored? Wouldn't that allow PTP and USB remote at the same time? I might be missing something obvious though.

(This is what I actually meant when I wrote this:)
CHDK is able to mask the USB bit. If you know for sure that USB data connection is available, you could set/unset the USB bit independently from the hardware...


Re: CHDK PTP multiple instances
« Reply #18 on: 15 / September / 2013, 17:33:08 »
A script started over PTP isn't affected by the PTP connection going away.
so in ptp you do the usual
.loadfile('A/foo.lua')()
foo.lua would set_config_value to enable USB remote (edit: your client would get disconnected here. If you want a chance to disconnect cleanly, you could just have a delay in the script)
The next question is how you get back to PTP mode. If the script ends, and your remote is ON, you'll be stuck.
If the script stays running, then it could handle the shooting based on the remote signal, but I'm not sure how this interacts with sync? Alternatively, the script could just use exit_alt() and go into a sleep loop waiting for the shot to happen (based on exposure count perhaps?) and disable remote once it's done to switch back to ptp mode.
Sounds a bit tricky to get it just right.   But then if the option to only enable USB remote when the camera is in shooting mode is implemented,  I guess its the same issue.  How does a script reliably know when to disable the USB remote and/or switch to playback mode ?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14080
Re: CHDK PTP multiple instances
« Reply #19 on: 15 / September / 2013, 17:42:50 »
Sounds a bit tricky to get it just right. 
Yes, as I said, it's not straightforward. But I think it should be possible. I wonder how nafraf is doing it?
Quote
But then if the option to only enable USB remote when the camera is in shooting mode is implemented,  I guess its the same issue.  How does a script reliably know when to disable the USB remote and/or switch to playback mode ?
That is implementation specific :P

Seriously though, it would depend on what your needs were. If you always take a specific number of shots between switches, then you could just watch the shot counter. If the script is usb_power aware, you could have more complicated signalling, but I'm not totally clear how this would interact with sync. Can you do a synced shot that is imitated by shoot() in script?

Another possible issue is that play / rec mode switching can interact weirdly with PTP. If you switch from PTP and then unplug the cable and plug it back in the camera can get into weird states.
Don't forget what the H stands for.

 

Related Topics