I wanted to make the work-in-progress alternative to ptpcam, chdkptp, work from my Dockstar, an Arm device with no video output, with debian squeeze installed, with a 1.8-inch 20gb hard drive.
There is an active thread for chdkptp here:http://chdk.setepontos.com/index.php?topic=6231
This page Getting CHDKPTP on BeagleBone Black to work might be helpful also.
I downloaded chdkptp with svn:
$ cd /usr/src $ svn co http://subversion.assembla.com/svn/chdkptp/trunk chdkptp $ cd chdkptp
The developer, reyalp, was helpful with a number of items which still require intervention by hand. I downloaded a ptp.h file which differs from the ptp.h file in the svn download, and put it into /usr/src/chdkptp/core. I did this by downloading it to my laptop and copying it to the dockstar with Winscp. The file came from here:
Per reyalp's guidence, I copied a config file via:
$ cp /usr/src/chdkptp/config-sample-linux.mk config.mk
and edited it by changing "CHDK_SRC_DIR=/path/to/chdk/source" to "CHDK_SRC_DIR=/usr/src/chdkptp". I then ran "make" to compile the program.
When I ran the program, there were some errors regarding lua files. I found the files in the "lua" subdirectory, and so switched to that: cd /usr/src/chdkptp/lua. Running again got me into the program and connected to my camera (an A590is). Note that the mode switch commands are different from ptpcam
Power up the camera in playback mode, then run chdkptp application
$ cd /usr/src/chdkptp/lua $ ../chdkptp -i -c
<con> lua set_zoom(3)
<con> lua shoot()
<con> download A/DCIM/133CANON/IMG_7440.JPG /var/www/7440.jpg
IMG_7440.JPG is downloaded directly my web server directory, /var/www.
Then in a browser, http://192.168.1.84/7440.jpg shows the following; note that the dockstar is visible on the left of the photo.
If you follow the thread, you will see that my path to reaching this result was not so straightforward.
New commands have become available since this article was first written. "rec" is a replacement for "switch_mode_usb(1)" and "play" for "switch_mode_usb(0)". More importantly with "rs" ("remoteshoot"), you can now shoot and record to a local file immediately without it being saved first on the camera.
<con> rec /var/www/test
Now test.jpg can be viewed from a browser, for example: http://192.168.1.84/test.jpg
You can set the resolution of the image with "lua set_prop(220,x)". These settings work on the SX120IS with chdkptp:
220,4 sets it to vga mode (640x480); 220,0 is full resolution, 10 megapixels, 3648x2736; 220,1 is 6 megapixels, 2816x2112; 220,2 is 4 megapixels, 2272x1704; 220,3 is 2 megapixels, 1600x1200; 220,5 is widescreen, 3648x2048.
Other cameras use different property sets ("220" will be different, and the "x" values and their meanings)--see: http://chdk.wikia.com/wiki/PropertyCase
/usr/src/chdkptp/chdkptp -i -c
connected: Canon PowerShot SX120 IS, max packet size 512
con 1> lua set_zoom(25)
con 2> lua set_prop(220,4)
con 3> rs /var/www/test23
con 6> lua set_prop(220,0)
con 7> rs /var/www/test24
con 10> q
Command Line ArgumentsEdit
You can also do the whole job with arguments on the command line:
/usr/src/chdkptp/chdkptp -c -e"rec" -e"lua set_prop(220,4)" -e"luar set_zoom(10)" -e"rs /var/www/current" -e"q"
(Note: The use of "luar" for the set_zoom (instead of "lua") causes the command to wait for a return value (which means it has completed). This keeps the following "rs" command from failing because the zoom script had not finished running.)