Wikia

CHDK Wiki

Waterwingz/Using PTP for Development

Talk0
573pages on
this wiki

< User:Waterwingz

Using PTP for loading CHDK and CHDK uBASIC & Lua ScriptsEdit

One major hassle with developing code for CHDK - either with porting for a new camera, developing new functions or simply writing uBASIC & Lua scripts it the need to get that code onto your camera's SD card. Swapping the card between the camera and a card reader on your PC is time consuming and puts a lot wear and tear on your camera, SD card and PC card reader. Fortunately, once you have CHDK running on your PC you can use the chdkptp program (on Windows or Linux) to load your scripts and code over a USB cable


Where to get CHDKPTPEdit

http://chdk.wikia.com/wiki/PTP_Extension

Setting up a CHDK development EnvironmentEdit

Windows Batch FilesEdit

script_upload.batEdit

..\ptp\chdkptp -c -e"u %1 CHDK\SCRIPTS\%1"


up.batEdit

@echo off
if exist bin\CHDK\MODULES del bin\CHDK\MODULES\*.* /Q
if exist bin\CHDK\MODULES rmdir bin\CHDK\MODULES 
if exist bin\CHDK del bin\CHDK\*.* /Q
if exist bin\CHDK rmdir bin\CHDK
if exist bin del bin\*.* /Q
if not exist %1\bin\%2-%3-1.0.0.zip goto not1
unzip -uo %1\bin\%2-%3-1.0.0.zip -d bin
goto found
:not1
if not exist %1\bin\%2-%3-1.1.0.zip goto not2
unzip -uo %1\bin\%2-%3-1.1.0.zip -d bin
goto found
:not2
if not exist %1\bin\%2-%3-1.2.0.zip goto notfound
unzip -uo %1\bin\%2-%3-1.2.0.zip -d bin
:found
bash upload.bash
goto done
:notfound
echo "%1\platform\%2\sub\%3" not found
:done

upload.bash

#!/bin/bash
(
 echo u bin/DISKBOOT.BIN
 if [ -f bin/PS.FI2 ] ; then
	echo u bin/PS.FI2
 fi
 if [ -f bin/PS.FIR ] ; then
 	echo u bin/PS.FIR
 fi
 if [ -d bin/chdk/modules ] ; then
   for f in bin/chdk/modules/*.flt ; do 
	  echo u $f CHDK/MODULES/
   done
 fi
 echo reboot -norecon
# echo quit
) | ../ptp/chdkptp -c -i


mk.batEdit

@echo off
if not exist %1/platform/%2/sub/%3 goto notfound
cd %1 
gmake PLATFORM=%2 PLATFORMSUB=%3 firzipsubcomplete
cd ..
goto done
:notfound
echo "%1/platform/%2/sub/%3" not found
:done



Linux Batch FilesEdit

load_scriptEdit

#!/bin/bash
(
 echo  "u $1 A/CHDK/SCRIPTS/$1"
) | ./chdkptp/trunk/run -c -i


mkEdit

#!/bin/bash
if [ -d "$1/platform/$2/sub/$3" ]; then
  cd $1
    make distclean
    make clean
    make PLATFORM=$2 PLATFORMSUB=$3 firzipsubcomplete
  cd ..
else
  echo "ERROR. usage =   mk version camera firmware"
fi


upEdit

#!/bin/bash
if [ -d "$1" ]; then
  mkdir -p $1/SDimage
else
  echo "Error : can't find specfied directory $1"
  exit
fi

if   [ -f     "$1/bin/$2-$3-1.2.0.zip" ]; then
    unzip -uo "$1/bin/$2-$3-1.2.0.zip" -d $1/SDimage
elif [ -f     "$1/bin/$2-$3-1.1.0.zip" ]; then
    unzip -uo "$1/bin/$2-$3-1.1.0.zip" -d $1/SDimage
elif [ -f     "$1/bin/$2-$3-1.0.0.zip" ]; then
    unzip -uo "$1/bin/$2-$3-1.0.0.zip" -d $1/SDimage
else
    echo "Error :  zip file not found."
    exit
fi

(
    echo u $1/SDimage/DISKBOOT.BIN
 
    if [ -f $1/SDimage/PS.FI2 ] ; then
	echo u $1/SDimage/PS.FI2
    fi

    if [ -f $1/SDimage/PS.FIR ] ; then
 	echo u $1/SDimage/PS.FIR
    fi

    if [ -d "$1/SDimage/CHDK/MODULES" ]; then
       for f in $1/SDimage/CHDK/MODULES/*.flt ; do 
           echo u $f CHDK/MODULES/
       done
    fi

    echo reboot -norecon

    # echo quit

) | chdkptp/trunk/run -c -i

echo " ...done"

Around Wikia's network

Random Wiki