chdkptp - alternative ptp client - page 40 - General Discussion and Assistance - CHDK Forum
supplierdeeply

chdkptp - alternative ptp client

  • 1106 Replies
  • 513046 Views
Re: alternative ptp client
« Reply #390 on: 23 / July / 2013, 10:17:55 »
Advertisements

Quote
I would highly recommend using the INF driver if you aren't already.
Using the INF driver with the camera listed in device manager

Quote
Does the camera screen go black when you plug it in?
No. Continues to show the last image taken.

Quote
Also to be clear, the camera should be in PLAY mode when you plug it in, and when you want to switch mode, you should use the "rec" command in chdkptp. If you try to switch using the physical controls on the camera, it probably won't work.
If you power the camera into rec mode it reverts to play mode as soon as the USB is connected. Once connected you cannot access rec mode by any means (direct camera, script or command line).

Quote
I don't recall anyone reporting using the G7 with PTP before, so another possibility is that mode switching over PTP just doesn't work on this camera.
So far that appears to be the case.

Quote
AFAIK the G7 does support Canon's remote capture API
The G7 works with software from the company with the windy name :-)

Canon's decision to remove remote capture on its later model P&S cameras is what led me to CHDK & PTP in the first place. My aim is to use a basic late model camera (like the A4000) and a RaspberryPi to upload an image every 15 min or so to a web server. I am only using the G7 to experiment before committing to a purchase. Any advice on any other suitable late model cameras would be appreciated.

Thanks

*

Online reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #391 on: 23 / July / 2013, 16:24:33 »
If you power the camera into rec mode it reverts to play mode as soon as the USB is connected. Once connected you cannot access rec mode by any means (direct camera, script or command line).
Right, I'm suggesting that you try just powering on the camera in play before you connect. The mode switching is hack, and can be sensitive to the previous states the camera was in so it could be worth a try.

However, I would guess that this camera probably needs some additional magic for mode switching to work at all. IIRC we have also seen this with a580 and some very early vxworks cams.

Implementing the equivalent of "switch_mode_usb" used for DryOS cams would probably be the next thing to try, if the corresponding functions exist. Someone may be able to make a test build if you are interested.
Quote
Canon's decision to remove remote capture on its later model P&S cameras is what led me to CHDK & PTP in the first place. My aim is to use a basic late model camera (like the A4000) and a RaspberryPi to upload an image every 15 min or so to a web server. I am only using the G7 to experiment before committing to a purchase. Any advice on any other suitable late model cameras would be appreciated.
Some other users have done or are working on similar things, see http://antthomas.co.uk/webcam/guide.php (scroll down to second camera) and http://antthomas.co.uk/motion/

I know another user from IRC who is working on a similar project using a4000. If you want to find cameras that are known to work, skimming through this thread and the PTP thread is one way to start.
Don't forget what the H stands for.

Re: alternative ptp client
« Reply #392 on: 25 / July / 2013, 09:08:38 »

However, I would guess that this camera probably needs some additional magic for mode switching to work at all. IIRC we have also seen this with a580 and some very early vxworks cams.

Implementing the equivalent of "switch_mode_usb" used for DryOS cams would probably be the next thing to try, if the corresponding functions exist. Someone may be able to make a test build if you are interested.

Have decided not to waste any more time on the G7. I will source another camera and continue from there.

Thanks for all your help and I will report back with progress.

*

Online reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #393 on: 27 / August / 2013, 02:02:51 »
I've uploaded a chdkptp snapshot build 426 to the files area https://www.assembla.com/spaces/chdkptp/documents#

Remote capture now has all the exposure options available in regular "shoot". Errors in remote continuous mode are now handled more gracefully. Starting video recording from the GUI should also work better.

Remote capture dng now includes a (ugly, not color corrected) thumbnail. You can also optionally patch badpixels in the capture DNG file with the the rs -badpix option.

Additionally, there is preliminary support for manipulating CHDK DNG files outside of the remote shoot process. This allows you to patch bad pixels on your DNG 1.3 files, extract the raw data and thumbnail in various formats, and display various information about the file. See the dng* commands in cli help for details. This is in early stages, but the idea is that you will be able to download DNGs and prepare them for your favorite raw software in one go. You can also use Lua code to analyze or modify the contents of DNG images. The code can also be used on plain frame buffer dump raw files, but this isn't exposed in the CLI yet.

Some random examples
Code: [Select]
___> dngload test12.dng
loaded test12.dng
___> dnginfo
test12.dng:
4104x3048x12, GBRG, DNG 1.3.0.0 / 1.1.0.0, CHDK ver. 1.3.0, Canon PowerShot D10
# save raw data as a 16 bit pgm test12.pgm
___> dngdump -raw -rfmt=16pgm
# build a histogram in lua
___> !d=dngcli.selected; histo={}; for y=0,d.img:height()-1 do for x=0,d.img:width()-1 do v=d.img:get_pixel(x,y) if not
histo[v] then histo[v]=1 else histo[v]=histo[v]+1 end end end
___> !c=0 for i=0,126 do if histo[i] then c=c+histo[i] end end printf("%d pixels below blacklevel\n",c)
168985 pixels below blacklevel

edit:
I also split the IUP and CD libraries into a standalone download for the raspberry pi builds. You must download both  chdkptp-r426-Linux-raspbian-gui.zip and chdkptp-raspbian-libs-20130826.zip

Additionally, the raspbian build contains a cli-only executable which does not require the libraries. For future snapshots, you should not need to re-download the library package.
 
 
« Last Edit: 27 / August / 2013, 02:06:46 by reyalp »
Don't forget what the H stands for.


*

Offline JvdP

  • ***
  • 174
Re: alternative ptp client
« Reply #394 on: 31 / August / 2013, 16:51:18 »
Since I don't want to mix up programs in the ptpcamgui topic I will reply here.

While a script like ultimate.lua is running on the camera, most PTP controls won't work, because they also need to execute script and only one script can run at a time. You can download files while a script is running, although in chdkptp you have to use the -nolua option.

The -nolua option is nice, but then you have to know the exact file name. Not too convenient for downloading lots of photos of which the filename is unknown. Too bad the mdl option can't work with -nolua, but I suppose you have to run lua on the camera when you run a mdl command.


Rebooting through gui
Another thing I wanted to discuss is the reboot functions in CHDK PTP. Somehow, my Canon IXUS240HS doesn't reboot properly when issuing the command. I'm not sure if this is related to my port of CHDK or whether it's a PTP problem.

Shutdown works fine!

When I press "reboot", the camera power just goes (without retracting the lens) and I need to reinstall the battery to get it back to life again.

ptpcamgui also has troubles with rebooting, but not it's not the same...
« Last Edit: 31 / August / 2013, 17:03:24 by JvdP »

*

Online reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #395 on: 31 / August / 2013, 18:05:31 »
Since I don't want to mix up programs in the ptpcamgui topic I will reply here.
Thanks :)

Quote
The -nolua option is nice, but then you have to know the exact file name. Not too convenient for downloading lots of photos of which the filename is unknown. Too bad the mdl option can't work with -nolua, but I suppose you have to run lua on the camera when you run a mdl command.
Exactly, you need lua to find the files on the card.

For this kind of application, you'd be much better off writing a script that is PTP aware, or just controlling everything from chdkptp either using an external program or a chdkptp side lua script. CHDK scripts an read and send "messages". So for example, you could have an intervalometer that exit when it receives a "quit" message.  Then you could download under chkdptp control and restart the intervalometer.
You can send messages from chdkptp with the putm command. See http://chdk.wikia.com/wiki/Lua/PTP_Scripting for these functions.

You've posted a lot of question about various specifics, but if you gave an overall description of what you are trying to do, we might be able to offer better advice.

Quote
Another thing I wanted to discuss is the reboot functions in CHDK PTP. Somehow, my Canon IXUS240HS doesn't reboot properly when issuing the command. I'm not sure if this is related to my port of CHDK or whether it's a PTP problem.
It's unlikely to be a PTP problem, so you should report it in the porting thread.

Quote
When I press "reboot", the camera power just goes (without retracting the lens) and I need to reinstall the battery to get it back to life again.
It's not a good idea to call reboot in record mode or when the lens is extended. You can either set the retract delay short enough to so it can automatically retract, or possibly use an eventproc to tell it to retract: http://chdk.setepontos.com/index.php?topic=9287.msg95743#msg95743
Don't forget what the H stands for.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: alternative ptp client
« Reply #396 on: 01 / September / 2013, 03:55:58 »
ptpcamgui also has troubles with rebooting, but not it's not the same..
It's not a good idea to call reboot in record mode or when the lens is extended. You can either set the retract delay short enough to so it can automatically retract, or possibly use an eventproc to tell it to retract: http://chdk.setepontos.com/index.php?topic=9287.msg95743#msg95743
Btw., not ptpCamGui has troubles with a reboot. It's more a camera issue. ptpCamGui checks the camera mode. Is the camera in a record mode, first will be switched to playback mode before a reboot occurs.

msl
CHDK-DE:  CHDK-DE links

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: alternative ptp client
« Reply #397 on: 02 / September / 2013, 05:57:13 »
Here is a patch for gui icons based on reply#359.

- old images from scratchpad deleted
- new lua library for icons added
- window icon & on/off in gui added
- window dimension changed (height 560 instead 460 because different height of the tabs, prevents windows jumping.)

All other icon are only available in the library, because there was some trouble with the linux version.

msl
CHDK-DE:  CHDK-DE links


*

Offline JvdP

  • ***
  • 174
Re: alternative ptp client
« Reply #398 on: 02 / September / 2013, 10:57:31 »
Could anybody tell me how I go about making a chdkptp command file on windows?

*

Online reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #399 on: 02 / September / 2013, 14:43:32 »
Could anybody tell me how I go about making a chdkptp command file on windows?
Write the commands you would use in chdkptp into a plain ASCII text file, using your favorite text editor.

To run the file, use
source filename
in the cli.

If you want to run it from the command line, you can use

chdkptp -rfilename

note there is no space space between the -r and the filename


This will just run a sequence of commands, as if you had typed them into the console. There are no variables or control structures. If you need to do something more complicated, you can write it in lua, and execute it using the normal lua require or dofile functions from the exec command. The CLI has fairly extensive help, which is also listed in USAGE.TXT
Don't forget what the H stands for.

 

Related Topics