USB Download - page 2 - Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) - CHDK Forum
supplierdeeply

USB Download

  • 26 Replies
  • 8648 Views
Re: USB Download
« Reply #10 on: 03 / April / 2014, 14:26:51 »
Advertisements
Thanks. It falls falls into place.
This works for me too.

Re: USB Download
« Reply #11 on: 04 / April / 2014, 06:25:07 »
Hi Waterwingz. it may help if i attached my script.
Best regards.

Re: USB Download
« Reply #12 on: 04 / April / 2014, 07:49:30 »
Hi Waterwingz. it may help if i attached my script.
Best regards.
I have a newer version of this that works perfectly and that already supports "USB download mode".  It's a rev or two behind the current release so I need to do a quick update tonight before I post it.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: USB Download
« Reply #13 on: 04 / April / 2014, 09:13:41 »
Many thanks, i'm looking forward to trying to understand the change you have made regarding the Usb.
Cheers


Re: USB Download
« Reply #14 on: 04 / April / 2014, 20:26:02 »
Many thanks, i'm looking forward to trying to understand the change you have made regarding the Usb.
Cheers
Updated script now available here :  https://www.box.com/s/muq2pumz3cqv5qk7kpej

Wiki page for documentation is here : http://chdk.wikia.com/wiki/Ultimate_Intervalometer#Pause_when_USB_connected.3F

Note that this change will not work with chdkptp as it wants to run scripts on the camera when it connects.  Conventional PTP image download from your PC should work though.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: USB Download
« Reply #15 on: 05 / April / 2014, 07:43:06 »
Thanks for this, i will pick it up when i get home from Work. Looking forward to trying this.

Many thanks will report back.

Re: USB Download
« Reply #16 on: 05 / April / 2014, 15:28:06 »
Well thank you Waterwingz. this works great on my A1200 and A2300 not tried the others yet.
I spent much time going right through the Ultimate Script and got a bit hooked. It dawned on me that my work wit Basica in the 80's and with Visual Basic 15 years ago, that the methods are almost the same and i actually understand much of what is going on.

Thanks Again Waterwingz for your kind assistance and not forgetting the help from Reyalp, i have learned much from you both.

Best regards.

Re: USB Download
« Reply #17 on: 05 / April / 2014, 15:31:28 »
Well thank you Waterwingz. this works great on my A1200 and A2300 not tried the others yet.
I spent much time going right through the Ultimate Script and got a bit hooked. It dawned on me that my work wit Basica in the 80's and with Visual Basic 15 years ago, that the methods are almost the same and i actually understand much of what is going on.
Yea - scripting can be a lot of fun.  And with Lua available for CHDK, you can do a lot of really sophisticated things without needing to add random functions to the core CHDK C code.  Never mind trying to write and maintain anything more than a few tens of lines long in something like uBASIC.

FWIW, I also have a version that switches to Playback mode based on a message passed over USB to the script using the script PTP functions.  Does much the same thing as the patch you looked at but doesn't require plugging & unplugging the cable from the PC as the indication that image transfer is about to take place.  However it does require a PC client that can send the correct message (chdkptp for example) so is really for different circumstances.
« Last Edit: 05 / April / 2014, 15:46:43 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14117
Re: USB Download
« Reply #18 on: 05 / April / 2014, 16:05:46 »
Note that this change will not work with chdkptp as it wants to run scripts on the camera when it connects.  Conventional PTP image download from your PC should work though.
FWIW, there's a couple ways you could work around this.

1) chdkptp  -nolua  can be used with single file download (not mdownload) to avoid any lua calls. Problem: You need to know the exact filesnames, which is only available using script. You could iterate over the possible file and directory names, but that would be pretty slow/ugly.

2) with chdkptp 1.3, you could use killscript to terminate the script, download as normal, and then restart the script over ptp. However, any script state would be lost.

Both of these could be made cleaner using the message interface, as you suggest in the next post. For #1 you could send a message that gets a list of file names, and then run lua in chdkptp to iterate over that with download. For #2, you could send a message that tells the script to save any required state and quit cleanly. The script could check if it's being started from ptp since the standard a,b,c etc variable will be nil unless you explicitly set them before the loadfile()() call.
Don't forget what the H stands for.

Re: USB Download
« Reply #19 on: 05 / April / 2014, 16:21:47 »
FWIW, there's a couple ways you could work around this.
Thanks for that additional info.  There are definitely a lot of more advanced things that can be done. 

As it stands,  the code will pause the script and wait when a USB cable is connected to a PC.  I've tested (Win7) that the standard Windows explorer application can then connect to the camera, browse, transfer files, and delete them. 

When you unplug the cable,  the camera resumes running the script. That took a few additional calls to sleep() to make it work correctly.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal