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

CHDK PTP interface

  • 1227 Replies
  • 381164 Views
*

Online philmoz

  • *****
  • 3332
    • Photos
Re: CHDK PTP interface
« Reply #770 on: 21 / April / 2012, 18:49:04 »
Advertisements
After our chat yesterday I worked on fixing things for the G1X and also stitch mode.

Essentially this adds two new offset values to define the position of the viewport on the LCD/liveview display - the existing offset values now only define the position of the viewport in the memory buffer.

Hopefully this will be general enough to cater for cameras like the A540 and D10 too.

The attached patch is against your live view branch (it includes your previous patch changes as well).
This works with your current client (with the previous patch applied).

I'm thinking that all the viewport_???_proper() functions should be replaced by a single function that populates the live view data structure with the correct values. These are only used in the live view code.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline srsa_4c

  • ******
  • 4426
Re: CHDK PTP interface
« Reply #771 on: 21 / April / 2012, 19:03:31 »
Maybe we don't have to worry about the ones with combined USB/video (can you make a splitter ?)
http://chdk.setepontos.com/index.php?topic=5691.msg62525#msg62525
Quote
I don't have anything plugged in.
Interesting, I assumed all TV-out models behave the same regarding viewport width.
Quote
It turns out that plugging in the TV out does change the height though (probably to 528), and worse, doesn't change the value I've been using to get the actual viewport height.

edit:
Ooops, change in viewport height is in playback mode, which I have hard coded because that value never works in playback. In rec mode, it seems to be normal with TV out connected.
There's a reason why the buffers follow each other at a distance of >>240 lines.

*

Offline reyalp

  • ******
  • 13456
Re: CHDK PTP interface
« Reply #772 on: 21 / April / 2012, 19:06:41 »
After our chat yesterday I worked on fixing things for the G1X and also stitch mode.

Essentially this adds two new offset values to define the position of the viewport on the LCD/liveview display - the existing offset values now only define the position of the viewport in the memory buffer.
Thanks, I'll take a look.

Quote
I'm thinking that all the viewport_???_proper() functions should be replaced by a single function that populates the live view data structure with the correct values. These are only used in the live view code.
I was thinking about that too, but having a bunch of really simple functions that can be overridden individually may be better. Not sure...
Don't forget what the H stands for.

*

Online philmoz

  • *****
  • 3332
    • Photos
Re: CHDK PTP interface
« Reply #773 on: 21 / April / 2012, 22:34:45 »
After our chat yesterday I worked on fixing things for the G1X and also stitch mode.

Essentially this adds two new offset values to define the position of the viewport on the LCD/liveview display - the existing offset values now only define the position of the viewport in the memory buffer.
Thanks, I'll take a look.

Attached is an updated patch against your current branch.
This changes all the code that uses viewports (including live view) to use the physical address of the top left visible pixel as the start address of the viewport. The buffer x & y offset functions are then only needed to calculate the correct address. The code using the viewport only needs to know the display offsets for correct screen position.

I left the variables in the live view data structure (set to 0) so I didn't need to change the client.

This also only sends the visible lines of the viewport not the full height.

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


*

Offline reyalp

  • ******
  • 13456
Re: CHDK PTP interface
« Reply #774 on: 22 / April / 2012, 01:25:56 »
Thanks phil.

I've checked in a slightly modified version of that on my branch, plus the corresponding chdkptp code. I changed the live_view_get_data to be safe if a null buffer is returned. Also included my fake variable aspect test code.

Note these are quite unfinished and is likely to change in incompatible ways in the next revisions, it's just getting too unwieldy to deal with in patches. Anyone using the previous version might want to just stick with that and the corresponding chdkptp for a while.
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #775 on: 02 / May / 2012, 07:06:24 »
thank you phil, reyalp, (and every one who contributes to chdk)
i am so glad to see progress on the liveview. i have been using the mweerden (manualy) patched version (with sx130) and am therefore wary of upgrading my version of chdk.
liveview in the main trunk will make it possible for me to update my chdk.
thanks once again

Re: CHDK PTP interface
« Reply #776 on: 07 / May / 2012, 20:56:53 »
Guys, I am trying ptpcam on windows (7 64 bits). It seems to have some sort of communication:
- if I "Enable Remote", I can see "wait for camera" ...  "State: disconnected" on the main screen and """
>> reset
>> reset
>> reset
>> reset"""

on the other one. If I disable remote on the cam, I see this:

>> reset
>> reset
>> reset
>> reset
>> reset
>> reset
>> reset
>> reset <<  (Length: 0)
** init() start ...** init() fail
** init() start ...
>> version << ptpcam: 2.0
camera: 2.0 (Length: 24)
>> script-support << script-support:0x1 lua=yes (Length: 26)
>> luar not(os.stat("A/CHDK/LUALIB/lptpgui.lua")==nil) << script:5
5:ret:false (Length: 21)
>> upload lptpgui.lua A/CHDK/LUALIB/lptpgui.lua << upload failed! (Length: 14) [unexpected return code 0x2002 (Length: 29)]
** init() fail
** init() start ...
>> version << ptpcam: 2.0
camera: 2.0 (Length: 24)
>> script-support << script-support:0x1 lua=yes (Length: 26)
>> luar not(os.stat("A/CHDK/LUALIB/lptpgui.lua")==nil) << script:6
6:ret:false (Length: 21)
>> upload lptpgui.lua A/CHDK/LUALIB/lptpgui.lua << upload failed! (Length: 14) [unexpected return code 0x2002 (Length: 29)]
** init() fail
** init() start ...
>> version << ptpcam: 2.0
camera: 2.0 (Length: 24)
>> script-support << script-support:0x1 lua=yes (Length: 26)
>> luar not(os.stat("A/CHDK/LUALIB/lptpgui.lua")==nil)


etc....

This happens on a SX200IS with firmware full 1.0d. The libusb drivers seem to be correctly installed (as per device manager information). Also when "enable remote" it doesnt show on listing of ptp devices, and when disabling I see it:

C:\tmp\ptpcam>__ptpcam.exe -l

Listing devices...
bus/dev vendorID/prodID device model
bus-0/\\.\libusb0-0001--0x04a9-0x31c0   0x04A9/0x31C0   Canon PowerShot SX200 IS


Is there anything logical about this ? Can someone get me to the correct path please ?
Thank you all !

Re: CHDK PTP interface
« Reply #777 on: 07 / May / 2012, 22:03:05 »
ok nevermind... I had a LUALIB folder on the 2MB partition, however the camera created the same structure on the other partition too without letting me know, and there, there wasnt a LUALIB dir ! I created and it started executing ! However I cant find how do I see the live preview on the PC ! Hope someone can help !


*

Offline reyalp

  • ******
  • 13456
Re: CHDK PTP interface
« Reply #778 on: 08 / May / 2012, 00:14:29 »
However I cant find how do I see the live preview on the PC ! Hope someone can help !
The live preview is still not integrated into the main CHDK. Sorry :(

If you look further back in this thread, and in the chdkptp thread http://chdk.setepontos.com/index.php?topic=6231.msg81941#msg81941 you will find information about using the current work in progress stuff that's in my branch.

Note that ptpcamgui does not support this in any form. You will have to use my chdkptp client. If you want to use the latest pre-built chdkptp binary (r230), then you will have to build a CHDK build from my branch, r1817 or earlier. If you want to use the latest, you will have to build both CHDK and the client.
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #779 on: 08 / May / 2012, 07:49:41 »
Reyalp, thanks for your comments. 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 ? In the livepreview do we get the viewfinder images or also the menus and everything on the LCD screen ? Also, how do I check out latest version and am I able to compile with mingw ? 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.
Sorry about asking here, maybe this is pointed out on different forum threads but there are so many different status pages and subprojects that it is quite difficult to see what is trunk and what is fork :)

 

Related Topics