a495 chdk ptp - General Discussion and Assistance - CHDK Forum
supplierdeeply

a495 chdk ptp

  • 36 Replies
  • 8484 Views
a495 chdk ptp
« on: 01 / May / 2011, 19:40:55 »
Advertisements
Hi Guys

I really need to use PTP with an A495. It looks like it was enabled in changeset 1116, http://tools.assembla.com/chdk/changeset/1116
But, there's no build for the A495 on the main autobuild server.

There IS a build for a495 here: http://forum.chdk-treff.de/download.php,
but that build date is Jan 2011, which would place it before changeset 1116.

I have tested that a495 build on two cameras and it works great.

Can someone explain what it is I need to do to get PTP support?
If I have to compile from source, that's no problem, but I won't have memory addresses etc for the A495 which are presumably wrapped up in the chdk-de build?

Thanks in advance,

BTW: we're trying to do a 40 camera bullet time rig with the a495s, i've managed to script the usb trigger etc but we have no way of getting the photos off the camera (we've investigated eye-fi but it looks like you need 1 pc per camera- not an option)
When the camera goes to download mode, we can't control it as I have to turn remote mode off to get it here.

I was hoping PTP would allow me to switch it back to record mode so I can signal the camera to take a photo.
We're speeding our shutter release up by putting the camera into shutter depressed mode and then doing a full_shutter on usb trigger. I would like to do the same with PTP.

Gareth
gareth.evans@snipersystems.co.nz

*

Offline reyalp

  • ******
  • 12366
Re: a495 chdk ptp
« Reply #1 on: 01 / May / 2011, 19:48:19 »
But, there's no build for the A495 on the main autobuild server.
A495 isn't in the main source tree at all.
Quote
There IS a build for a495 here: http://forum.chdk-treff.de/download.php,
but that build date is Jan 2011, which would place it before changeset 1116.
CHDK changesets are irrelevant to CHDKDE, they are two different source trees. PTP has been enabled in CHDKDE for longer than CHDK.

That said, the CHDKDE autobuild should update every time there's a change in CHDKDE, so it should be much newer than that (last checkin in CHDKDE was May 1)

They list A495 as alpha, so it should be expected that not everything is working in that build. Don't know whether that includes PTP.

Don't forget what the H stands for.

Re: a495 chdk ptp
« Reply #2 on: 01 / May / 2011, 20:15:15 »
Thanks :)
I'll test PTP with our working CHDKDE on the a495 this afternoon

Gareth

*

Offline msl

  • *****
  • 1266
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: a495 chdk ptp
« Reply #3 on: 02 / May / 2011, 03:03:55 »
PTP support works fine for the A495 with a recent autobuild version of CHDK-DE, was reported in German CHDK forum.  Only the motion detection has maybe a problem.

msl
CHDK-DE:  CHDK-DE links


Re: a495 chdk ptp
« Reply #4 on: 02 / May / 2011, 05:06:00 »
PTP support works fine for the A495 with a recent autobuild version of CHDK-DE, was reported in German CHDK forum.  Only the motion detection has maybe a problem.

msl

Hi msl,
I can't read german, except with the help of a translator.. but I've been testing the a495 for the last few hours.

After I figured out how to get libusb working, it all seemed very promising. I can control the camera via lua script commands (struggling to find a nice api guide here though) and can shoot photos etc.
I haven't discovered interactive commands to list files and download files (once you're in the interactive shell)

Because I need to control 40 cameras, I was planning on using ptpcam --chdk in a c# piped process, one for each camera, then I'll have streams for each camera's stdin and stdout

Everything works except downloading photos - I can't get anything to transfer.
I'm in windows 7 with UAC, but most stuff works, and i've tried running the processes as administrator.
When I try a -G, I just hear the USB connect/disconnect noise and nothing else happens.
if I try a -g=handle then I get an error message.
Here's an example of me listing the files on a device and then attempting a download.
I located what looked like a beta build of the 100f firmware for the a495 on the german forum and tried that instead of the alpha i'm getting from autobuild but I think it's actually older.

Download didn't work in that either.

C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam -G
Camera: Canon PowerShot A495

C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam -l

Listing devices...
bus/dev vendorID/prodID device model
bus-0/\\.\libusb0-0001--0x04a9-0x31ef   0x04A9/0x31EF   Canon PowerShot A495


C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam -L

Listing files...
Camera: Canon PowerShot A495
Handler:           Size:        Captured:       name:
0x01980841:      1699380        2011-05-02 07:58        IMG_0132.JPG
0x01980851:      1711728        2011-05-02 08:21        IMG_0133.JPG


C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam -g=0x01980
851:
Camera: Canon PowerShot A495
Could not get object info
PTP: Invalid Object Handle

C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam -g=0x01980
851
Camera: Canon PowerShot A495
Could not get object info
PTP: Invalid Object Handle

C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam -g=0198085
1
Camera: Canon PowerShot A495
Could not get object info
PTP: Invalid Object Handle

C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam -g=0198085
1:
Camera: Canon PowerShot A495
Could not get object info
PTP: Invalid Object Handle


This is the only feature we are stuck on - we can do everything else

Re: a495 chdk ptp
« Reply #5 on: 02 / May / 2011, 05:09:05 »
Should add that if I try the download with the known path in interactive mode...

C:\Users\Gareth Evans\Desktop\libusb-win32-bin-1.2.4.0\bin\x86>ptpcam --chdk
error: camera has unsupported camera version 2.0; some functionality may be miss
ing or cause unintented consequences
<conn> download A/DCIM/101___04/IMG_0133.JPG c:/temp/
unexpected return code 0x2fe
download failed!
<conn>

Re: a495 chdk ptp
« Reply #6 on: 02 / May / 2011, 05:25:04 »
My mistake, that particular flash card has a different file path

<conn> download A/DCIM/102___05/IMG_0133.JPG c:\temp\img.jpg
This worked.

My next question is how can I determine what the last saved file was?
Assuming I just did a lua shoot() from the console session, how can I know what the download command should be?
Also, can I somehow do a delete from within here? I don't mind if I have to run a bit of lua to do both these tasks but figuring out the exact commands is driving me crazy.
Once I got the camera connected via libusb I can't browse the camera as mass storage anymore, so I have to put the SD card in a cardreader to get the files.

Getting the files unattended is really important as the cameras will be mounted on a 20ft metal ring about 60ft off the ground!
We'll have a computer up near the cameras, which they'll be hooked to with USB - and then I can obviously RDP to that computer but getting SD cards out of readers isn't an option, I'm worried that this 100___05 folder name is going to change all the time and I'm not going to know what the last saved file is.
Also, I need the delete (btw: ptpcam --D works, but I have to drop out of the interactive session for that) so the SD cards don't fill up.

Gareth

*

Offline reyalp

  • ******
  • 12366
Re: a495 chdk ptp
« Reply #7 on: 02 / May / 2011, 12:41:56 »
Quote
error: camera has unsupported camera version 2.0; some functionality may be missing or cause unintented consequences

It looks like you are not using a current version of ptpcam. There should be an up to date version somewhere in the chdkde threads.

Also just an FYI, the non-chdk functionality of ptpcam (everything that doesn't involve --chdk) should not necessarily be expected to work. They might, but ptpcam has generally just been used as a convenient place to put the CHDK code.

If you want a programmatic interface, you may find chdkptp to be a useful starting point http://www.assembla.com/wiki/show/chdkptp (discussion thread here http://chdk.setepontos.com/index.php?topic=6231.0). This provides a lua interface to the CHDK PTP protocol on the PC. You can use it as is, or replace / modify main.lua to suit your needs. On the down side, it's in a pretty early development stage right now.

You can delete files with the os.remove('filename') in camera side lua. However, you should be aware that when you remove files this way, not all parts of the Canon OS notice. They can still show up as 'unknown file' the camera, and not all in memory resources are are freed. So if you are shooting and deleting indefinitely, it's probably a good idea to reboot periodically.

You can use os.listdir('path') to list files and directories, but directories with very large numbers of files may cause problems.

see here: http://chdk.wikia.com/wiki/Lua/Lua_Reference for information about on-camera lua.
Don't forget what the H stands for.


*

Offline msl

  • *****
  • 1266
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: a495 chdk ptp
« Reply #8 on: 02 / May / 2011, 14:36:51 »
In this box.net folder you can find a recent ptpcam.exe (version 2.0) as zip file.

msl
CHDK-DE:  CHDK-DE links

Re: a495 chdk ptp
« Reply #9 on: 02 / May / 2011, 19:45:54 »
Cool, thanks for the help. I think i'll pipe to the updated version of ptpcam.
I tried the chdkptp yesterday and it crashed the camera a couple of times, most notably when I hit the display button in the gui, plus there was no obvious way to download the photos.
I think that wrapping up the interop/direct USB stuff inside the console application and then just piping command and responses will be more reliable in the longterm.
My plan is to write a class which wraps a console instance for a particular camera, and knows about that camera's state and handles downloading and deleting.
The idea being then I can have a whole bunch of instances (which correspond to ptpcam instances) and multithread signal them to tell the cameras to shoot.
One thing I noticed (this may be fixed with the updated ptpcam) was that this command:
lua press("shoot_half") seemed to focus the camera, but didn't focus lock, that is - it was like the button got half depressed and then released, so it was a click("shoot_half") instead.
I'll test this with the updated ptpcam when I get to testing later today.

Thanks for all your help, If this class works I'll share it online.

 

Related Topics