CHDKPTP with Auto-file-transfer-to-PC for the S90 - Developmental Version - CHDK Releases - CHDK Forum

CHDKPTP with Auto-file-transfer-to-PC for the S90 - Developmental Version

  • 6 Replies
  • 8725 Views
*

Offline SticK

  • *****
  • 779
Advertisements
CHDKPTP with Auto-file-transfer-to-PC for the S90 - Developmental Version

Attached r291.zip is my Win32 developmental version of CHDKPTP optimized for the S90.  The stock version allows you to manually save your shot image files on your SD card from the FILES tab.  This version has an additional function myshoot() in the Lua code that makes CHDKPTP behave more like Canon's RemoteCapture for shoot and automatic file transfer to your PC.   The function is S90-specific, but you should be able to get it to work with your camera with some minor mods in case it doesn't out-of-box (follow the code thread).

File transfer timing for the myshoot() function is presently set up for a C10 fast SD card  -- highly recommended -- I use Duracell C10s. 

You need CHDK working on your camera already.  Please refer to the wiki in case you don't.

STEP 1

Download and install libusb.  Note that when you install this USB driver, you'll be asked to "register" each camera you want to use with CHDKPTP to libusb, via an intermediate file.  That's the normal route.  The important thing to keep in mind whatever camera you register with libusb, Canon software will no longer see it.  There is a way of unregestering a camera but I don't know how to do it.
http://sourceforge.net/projects/libusb-win32/files/
More info here:
http://sourceforge.net/apps/trac/libusb-win32/wiki

STEP 2

Install the CHDKPTP r291 folder anywhere and launch the start.bat file.  You get a DOS window and CHDKPTP screen.

  > Make sure you set your Canon menus scrolling tips (if you have) to OFF,  and in the CHDK menu "Disable LCD Off" to "Always"
  > Plug in your camera.
  > Switch to the LIVE tab.
  > Check all the boxes except "Viewfinder 1:1" (play with it later once all's fine)
  > Press CONNECT (upper right) and you should see your PLAY mode viewfinder (Canon RemoteCapture can't do this).
  > Press REC and you get the liveview from the CCD in your camera.
  > Try pressing the SHOOT button.  This will take a shot at the current settings in your camera.
  > Go to the FILES tab, right-click and choose REFRESH.
  > Your new image(s) should appear under DCIM/ folder (you can right-click, select one-at-a-time and download to your PC)
  > Next right-click and delete all the subfolders in DCIM/, making sure DCIM/ is empty.
  > From the mode dropdown, choose M for manual.
  > Set your liveview ISO value with the usual "Set" process (CHDKPTP  set button etc, up, down left right etc as needed).
  > Before exiting Set mode, highlight the ISO### icon in the upper left corner of the OSD.
  > In the command execution window try the function (the ! is important):
             !myshoot(1,5.6,1600,"C:\\CANON_S90\\")
  > This will temporarily override the exposure settings in your camera, take the shot, transfer the file(s) to PC and delete them from DCIM/.  You can monitor file transfer activity in the CONSOLE tab.

The syntax is myshoot(Tv, Av, Sv, "destdir"). destdir is created on your PC if it doesn't exist and cannot contain spaces, otherwise the folder string gets truncated at the first space.  Tv is the shutter open time in seconds (eg 1/125 or 2 are valid values and correctly shown in EXIF).  Av is the aperture value (f-stop) in the range of your camera (eg 2 or 5.6 are valid values and correctly shown in EXIF).  Sv is the sensitivity value (ISO) you want to expose at.  The function converts the Sv parameter to the Canon marketing value, so both EXIF and exposure are consistent between say SHOOT at a Canon setting of ISO 100 (equivalent to pressing the camera release) and myshoot(..., ..., 100, ...).  This code also displays free memory in the camera to the DOS window after every myshoot() call.  Once you're down to about 200k, you can get a malloc fail (out of memory error) due to a (minor) Canon memory leak on each shot.  On an S90 with ~900kB initial freemem I can get about 4000 shots before needing a camera reboot.

IMPORTANT NOTES

myshoot() takes the shot at the specified exposure values temporarily overriding your camera settings and transfers the new image files to destdir on your PC (Canon RAWs, CHDK RAWs, and/or JPGs, whatever you have set).  It does that by an intermediate write to the SD card and then file move to the PC.  If there are any other older image files on your SD card, it moves them as well.  Hence it's best to start with a blank DCIM folder on your SD card to avoid getting confused.  It might be a good idea to dedicate one SD card just for remote shooting.  When CHDKPTP is connected with your camera the <Alt> button may appear dead: you often have to press the <Alt> button a few times before CHDK responds.

At present the only camera I support and offer (very limited) help with is the S90.   If you manage to get myshoot() to work for your camera, please post the code on this thread.

Good luck!

=============== FAQ ===============

Q. What versions of Windows OS can be used?

The ZIP I posted is for WinXP.  I have it running on an old WinXP laptop with USB 1.0.  But, with USB 1.0 you can't get more than 1 fps.  With USB 2.0 on a 2 GHz machine (laptop or desktop) you can hit a nice smooth 15 fps (set Target FPS to 20 or more).  However, if you see a nuisance horizontal  tearing when you pan your camera, it means your CHDK firmware does not have the "tearing" fix the S90 versions have.  Put an APB request on the forum and someone can update your camera code for the fix.  If it works on WinXP, it should work on all of the Wins.  Try it.

Q. How much memory is needed?

Very little.  My laptop has 500 KB RAM and it works perfectly, but recall with USB 1.0 you'll only get 1 fps.

Q.  Can CHDKPTP be used on other operating systems?

I think yes.  However, these are the kind of questions I can't give you effective help on.  There is info on the CHDKPTP wiki about incarnations for other O/Ses.  Look around there first.  If not, start a thread and someone should be able to help you.  Since the one in the ZIP is a WinXP app, I am pretty certain it won't work on ME, and it won't work on DOS for sure.   If you install an O/S incarnation of EXE files different than my ZIP, look for the text file differences (bat files and Lua files only) and replace the appropriate files from my ZIP in your O/S incarnation.  It should be safe to replace all the Lua files with those in my ZIP.
« Last Edit: 30 / March / 2013, 10:46:20 by SticK »

*

Offline Taka

  • *
  • 12
Re: CHDKPTP with Auto-file-transfer-to-PC for the S90 - Developmental Version
« Reply #1 on: 29 / December / 2012, 09:28:18 »
Hi SticK,

I have an interface of a project and I wish join her a button that allows taking a photo, download, and delete it from the SD card. Could you help me with your function? I'm only interested in this functionality.

Thanks for your attention :)

Happy new year!

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP with Auto-file-transfer-to-PC for the S90 - Developmental Version
« Reply #2 on: 29 / December / 2012, 12:57:28 »
@Taka
Quote
I have an interface of a project and I wish join her a button that allows taking a photo, download, and delete it from the SD card
That is exactly what this solution does out-of-box with CHDKPTP: please read again what I wrote very carefully and refer to the wiki for more information.  My solution will work on the S90.  I don't know if, or how well, it will work on other cameras.  For that you are on your own.  For an S90 (S90 firmware versions 100c and 101a known good), please follow my instructions.
« Last Edit: 02 / January / 2013, 20:10:06 by SticK »

Re: CHDKPTP with Auto-file-transfer-to-PC for the S90 - Developmental Version
« Reply #3 on: 18 / February / 2013, 10:25:36 »
Is there a chance for this on the other Canon cameras?  It seems like this would be great for tethered shooting.


*

Offline SticK

  • *****
  • 779
Re: CHDKPTP with Auto-file-transfer-to-PC for the S90 - Developmental Version
« Reply #4 on: 18 / February / 2013, 13:59:06 »
Is there a chance for this on the other Canon cameras?  It seems like this would be great for tethered shooting.
Yes of course ... the infrastructure is all there and you can start with the ZIP.  If you can get the liveview  to work on your camera, then likely just it's a matter on modifying the myshoot() function to work with yours.  It's Lua text script - just write and run - no compiling required.  Gook luck.

Your program works under Windows 8 and 1.00d of the firmware.

*

Offline SticK

  • *****
  • 779
Your program works under Windows 8 and 1.00d of the firmware.

That's very good to know and I hope it bears some nice fruit in your photographic endeavors.  Thanks for your input.  This is a hugely collaborative effort of many.

For clarity I split myshoot() in myfile.lua into two functions.  Functionally the code below is the same as in the ZIP package.  For this code to work properly on the S90, after setting the camera ISO with "Func Set" button, be sure to leave the [ISO ####] icon highlighted (upper left corner of OSD).
Code: [Select]
function reset_ISO()  -- After doing a myshoot() with the S90, Canon ISO is left at the override value.  This function resets the last liveview Canon ISO after taking a shot.
con:execwait('click "set"')
sys.sleep(400)
con:execwait('click "left"')
sys.sleep(200)
con:execwait('click "right"')
sys.sleep(200)
con:execwait('click "set"')
sys.sleep(400)
end

-- usage: >!myshoot(1/8, 2.8, 400, "C:\\CANON_S90\\")
function myshoot(tv, av, canon_sv, destdir)
sv = canon_sv / 1.6461 -- ISO correction for S90 so that CHDK EXIF data is the same as Canon.
cli:execute('shoot -tv='..tv..' -av='..av..' -sv='..sv..'')
sys.sleep(2400)  -- Adjust depending on response of your particular camera & SD card.
local l,r=con:execwait('return get_meminfo().free_size') 
print(" free", r)   
printf(" free: %s\n",r)   
dcimdl(destdir, true, false)
reset_ISO()
end
« Last Edit: 30 / March / 2013, 09:55:45 by SticK »

 

Related Topics