CHDK PTP interface - page 79 - General Discussion and Assistance - CHDK Forum

CHDK PTP interface

  • 1244 Replies
  • 523348 Views
*

Offline reyalp

  • ******
  • 14117
Re: CHDK PTP interface
« Reply #780 on: 08 / May / 2012, 23:22:30 »
Advertisements
Let me understand: you do patch the camera firmware or the external ptpcam dll ? Is the ptp livepreview a binary compiled thing or some kind of LUA hack to provide realtime buffers ?
Liveview support requires code in CHDK on the camera. It also requires a client that understands the protocol.
Quote
In the livepreview do we get the viewfinder images or also the menus and everything on the LCD screen ?
The UI (aka bitmap) and viewfinder (aka viewport) are separate framebuffers on the camera. Both are available in the current work-in-progress PTP protocol, although support is not complete for every camera. See http://chdk.wikia.com/wiki/Frame_buffers for information about the various camera frame buffers.

You can see some screenshots in the chdkptp thread.
Quote
Also, how do I check out latest version and am I able to compile with mingw ?
For the client, see http://www.assembla.com/wiki/show/chdkptp - The readme explains the prerequisites. mingw is the preferred toolchain for windows.

For the CHDK side, you need to use this branch http://trac.assembla.com/chdk/browser/branches/reyalp-ptp-live
You can use chdkshell to build on windows. See http://chdk.wikia.com/wiki/For_Developers for more information about how to set up a CHDK development environment on various platforms.

Quote
Finally, I would like to create a python wrapper and make this work both on windows and linux via libusb. I can use some functions to convert from yuv to rgb et.al so if I am able to access the raw buffers it would be nice.
That should be possible. If you want to use libusb directly, you will need to make your own implementation of the CHDK PTP protocol. OTOH, chdkptp is cross platform and already has a Lua API (in fact, it's mostly written in Lua, the C code only provides some low level APIs), so you might just want to use lua. It includes code to convert the framebuffers to RGB.
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #781 on: 28 / May / 2012, 20:49:09 »
I've been reading this thread all day today hoping I could find someone who experienced the problem I am having.  I can't seem to get chdkptp to connect for me.  I've a SX130IS with firmware 1.01f.  I've downloaded reyalp-ptp-live1871 and successfully built that within CHDK-Shell and installed it on my camera.  I'm using chdkptp r230-win32 as my client.  I've installed libusb as suggested and seem to have no problems at all when running ptpcamgui. After I start chdkptp, I turn on my camera (in play mode) and hit the connect button. I then get an error in the dos console "unexpected return code 0x2fd" and also in the chdkptp console the error "error initializing live streaming: error getting handler: ptp error".  Is there something I missed in my setup?  I read of at least a few users who had this working on an SX130, but I'm not sure what firmware version they were using.  Thanks, Glen

Re: CHDK PTP interface
« Reply #782 on: 28 / May / 2012, 21:06:20 »
After I start chdkptp, I turn on my camera (in play mode) and hit the connect button.
reyalp will be better able to help you,  but what happens if you start your camera before you start chdkptp ?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK PTP interface
« Reply #783 on: 28 / May / 2012, 21:53:15 »
reyalp will be better able to help you,  but what happens if you start your camera before you start chdkptp ?
The same thing really.  I don't see any difference trying it either way. Not sure what else I could try.


*

Offline reyalp

  • ******
  • 14117
Re: CHDK PTP interface
« Reply #784 on: 29 / May / 2012, 01:10:29 »
I've been reading this thread all day today hoping I could find someone who experienced the problem I am having.  I can't seem to get chdkptp to connect for me.  I've a SX130IS with firmware 1.01f.  I've downloaded reyalp-ptp-live1871 and successfully built that within CHDK-Shell and installed it on my camera.  I'm using chdkptp r230-win32 as my client.
You will need to use the latest chdkptp from svn if you want to use the latest CHDK code from my branch. The reason it's in a private branch is so I don't have to worry about compatibility from version to version.

If you want to use the r230 chdkptp binary build, then you should build chdk 1817. You can download the source for that here http://trac.assembla.com/chdk/browser/branches/reyalp-ptp-live?rev=1817

I'll try to put up a new binary snapshot of chdkptp up soon, I think I'm about though messing with the protocol as of today.

edit:
new chdkptp snapshot is uploaded. I haven't tested the recent very thoroughly.

The protocol should now be able to handle most of the weird variations (like variable aspects, digital zoom, digic 2 640x480 video, even stitch) but many of these will require platform specific code on each camera. It should work reasonably well in normal modes on most cameras.
« Last Edit: 29 / May / 2012, 02:57:22 by reyalp »
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #785 on: 29 / May / 2012, 07:51:14 »
Wow, thanks!  That made all the difference in the world!  I don't have much time to play with it this morning but most functions I've tried seem to be working.  Livevview doesn't though.  I get this error: "WARNING: camera live view protocol not supported by this client, live view disabled"  I may try building 1817 as you suggested and see how that goes.  Thanks again!

*

Offline reyalp

  • ******
  • 14117
Re: CHDK PTP interface
« Reply #786 on: 29 / May / 2012, 13:11:36 »
Wow, thanks!  That made all the difference in the world!  I don't have much time to play with it this morning but most functions I've tried seem to be working.  Livevview doesn't though.  I get this error: "WARNING: camera live view protocol not supported by this client, live view disabled"  I may try building 1817 as you suggested and see how that goes.  Thanks again!
If you use the chdkptp r248 snapshot, then you need to use chdk 1873 (not the 1871 you built earlier, sorry) or later from my CHDK branch.
« Last Edit: 29 / May / 2012, 13:17:18 by reyalp »
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #787 on: 29 / May / 2012, 20:09:32 »
I can't believe I didn't think of that :) I'm in sync now and it seems that everything is working as it should.  I really appreciate your help, and the quick build.


*

Offline reyalp

  • ******
  • 14117
Re: CHDK PTP interface
« Reply #788 on: 16 / June / 2012, 20:23:49 »
Something I noticed with PTP on D10.

If you are connected to PTP and switch to record mode, and then switch to movie mode using lua set_capture_mode(), the func menu is confused. Only white balance and "my colors", are available, not the video size option. If you select video mode using the camera buttons, the func menu is correct. It's also correct if video mode is the default when you switched to rec mode in the first place (meaning it was the last mode selected using the normal Canon UI)

edit:
Same thin happens with a540.

This happens when using script on the camera without PTP so I guess it's a setmode issue not a PTP issue.
« Last Edit: 16 / June / 2012, 22:26:48 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14117
Re: CHDK PTP interface
« Reply #789 on: 17 / June / 2012, 20:20:05 »
Another random observation: On a540 at least, sending data from cached addresses with send_data is much slower than than uncached. I suspect it uses DMA, and has to do an additional copy if address is in cached ranged.

Sending a full viewport (uncached address) normally takes ~30ms. Clearing the uncached bit on the address basically doubled it.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal