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

chdkptp - alternative ptp client

  • 1106 Replies
  • 448509 Views
*

Offline tpont

  • **
  • 81
Re: alternative ptp client
« Reply #150 on: 31 / March / 2012, 11:44:14 »
Advertisements
I have another issue. On cameras manufactured prior to 2011 you have to use two partitions to be able to use a large SD card. But then the chdkptp command "mdl" (download multiple files) throws a memory error when trying to downloading a large enough number of files. I could download up to around 80 photos without problems. (photo size ~1.7 megabyte.) Above that I get this error message:
Code: [Select]
ERROR:  :231: not enough memory
rlib msg_batcher:18

I tested the same commands on a newer camera and could download 235 files from it without problem (I didn't test above 235).

Is that a know bug? Any known fix?

I can download more than 80 photos from the same camera using ptpCamGui.exe . That's why I suspect the problem is specific to chdkptp or at least the mdl command.
« Last Edit: 31 / March / 2012, 11:56:23 by tpont »

*

Offline reyalp

  • ******
  • 13844
Re: alternative ptp client
« Reply #151 on: 31 / March / 2012, 15:01:05 »
I have another issue. On cameras manufactured prior to 2011 you have to use two partitions to be able to use a large SD card. But then the chdkptp command "mdl" (download multiple files) throws a memory error when trying to downloading a large enough number of files. I could download up to around 80 photos without problems. (photo size ~1.7 megabyte.) Above that I get this error message:
Code: [Select]
ERROR:  :231: not enough memory
rlib msg_batcher:18
I tested the same commands on a newer camera and could download 235 files from it without problem (I didn't test above 235).
Thanks for the report.

This has nothing to do with multiple partitions, or the size of the photos. It means the lua script on the camera is running out of heap, which is related to the amount of free memory on the camera and the number of photos.  There is a bug for this http://www.assembla.com/spaces/chdkptp/tickets/50

Unfortunately, architectural issues in the CHDK script system make this difficult to handle correctly.

You may be able to work around this by adjusting the batch size. In lua/rlibs.lua try changing line 654
Code: [Select]
batchsize=20,
to something smaller. I'd try 10 to start with. This will make the downloads slower.
Don't forget what the H stands for.

*

Offline tpont

  • **
  • 81
Re: alternative ptp client
« Reply #152 on: 01 / April / 2012, 06:32:07 »
Thanks. I did some testing  (average photo size 1.7 Mb ).

batchsize 10:
80 photos = downloads ok
160 = also ok
320 = memory error

batchsize 5:
320 = memory error

batchsize 2:
320 = some other error (I think it only said "mdl failed" or something similar)

batchsize 4:
320 = ok

I notice no big difference in download speed between the default 20 and 4. Are there any other drawbacks to having a lower batchsize value? If it affects (slows down) other commands then I could use a special copy of chdkptp with lower batchsize only for downloading.

*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #153 on: 01 / April / 2012, 12:43:26 »
I'm not sure whether this is a question for this thread or for the SX40HS porting thread.

I connected my new SX40HS to my dockstar device, as I had previously done for my A590IS.  I'm using chdkptp compiled as of February 19.  I am able to take shots with "lua shoot()", but zooming with "lua set_zoom(3)" had no effect.  No zoom setting appeared to have any effect.

Do I have the right zoom command, or is this likely to be an issue with the chdk firmware on the camera (firmware from March 31)?


*

Offline reyalp

  • ******
  • 13844
Re: alternative ptp client
« Reply #154 on: 01 / April / 2012, 16:08:53 »
Thanks. I did some testing  (average photo size 1.7 Mb ).
Again, the size of the photos is irrelevant. The actual transmission is done in chunks whose size is based on free RAM. Where you are running out is the code that builds the list of files and returns it to the PC.

Unfortunately, the current CHDK code for dealing with directories must list the entire directory, rather than reading each file name in turn and processing it, so the number of files will always have an impact.

Memory must be quite low on this camera to be running into this problem, can you post the output of
Code: [Select]
!return con:execwait('return get_meminfo()')
You can use CHDKshell to build a copy of CHDK that has some optional features turned off to get more free memory. Using the (unstable) trunk version should also give you quite a bit more free memory.

If you are running out of memory with a batchsize of 5, you are probably quite close to the limit and risk failing in other situations too. Or something else is going wrong...
Quote
I notice no big difference in download speed between the default 20 and 4. Are there any other drawbacks to having a lower batchsize value? If it affects (slows down) other commands then I could use a special copy of chdkptp with lower batchsize only for downloading.
No, there should be no other impact. I've optimized the chdkptp message wait functions since I implemented batching so maybe it isn't so important now. Anyway, the change I gave you only affects the multi-file operations (mdownload and mdelete).
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 13844
Re: alternative ptp client
« Reply #155 on: 01 / April / 2012, 16:14:30 »
I connected my new SX40HS to my dockstar device, as I had previously done for my A590IS.  I'm using chdkptp compiled as of February 19.  I am able to take shots with "lua shoot()", but zooming with "lua set_zoom(3)" had no effect.  No zoom setting appeared to have any effect.

Do I have the right zoom command, or is this likely to be an issue with the chdk firmware on the camera (firmware from March 31)?
Very unlikely this is a chdkptp issue. If the function works on one camera, it should generally work on the others.

As an alternative, you can use a script that clicks or holds zoom_in and zoom_out. Unfortunately, in my experience the zoom position propcase doesn't update until your release the key, so you can't use the obvious approach of pressing the key, sleeping until the desired position is reached, and releasing. For a camera with lots of zoom steps like the sx40, clicking the key over and over will be very slow.
Don't forget what the H stands for.

*

Offline tpont

  • **
  • 81
Re: alternative ptp client
« Reply #156 on: 01 / April / 2012, 17:47:57 »
Again, the size of the photos is irrelevant. The actual transmission is done in chunks whose size is based on free RAM. Where you are running out is the code that builds the list of files and returns it to the PC.

Unfortunately, the current CHDK code for dealing with directories must list the entire directory, rather than reading each file name in turn and processing it, so the number of files will always have an impact.
So, is it the listing itself that causes the memory error rather than the transfer of files? (Sorry if I'm asking obvious questions, still have much to learn about how CHDK works)

This command
Code: [Select]
!return con:execwait('return get_meminfo()')
gives this output - I'm not sure if it is bad or really bad or something else :D
Code: [Select]
chdk_start=1216832,
name="system",
chdk_size=273536,
free_block_max_size=180128,
chdk_malloc=true,
It is a PowerShot A490 camera.

Quote
You can use CHDKshell to build a copy of CHDK that has some optional features turned off to get more free memory. Using the (unstable) trunk version should also give you quite a bit more free memory.
Thanks, I'll look into both suggestions.

*

Offline reyalp

  • ******
  • 13844
Re: alternative ptp client
« Reply #157 on: 01 / April / 2012, 18:20:41 »
So, is it the listing itself that causes the memory error rather than the transfer of files?
Yes, listing the files and running the code to figure out what to download. There are various quirks in the implementation that amplify this problem.
Quote
Code: [Select]
free_block_max_size=180128,
It is a PowerShot A490 camera.
That means you have about 180kb free. That might sound like it should be plenty to list a few hundred files, but the Canon system can use more of that depending what it is doing, and the script is inefficient for various reasons.  180k is definitely on the low side. http://chdk.wikia.com/wiki/CHDK/Camera_RAM_memory_usage has some information
Don't forget what the H stands for.


*

Offline blackhole

  • *****
  • 868
  • A590IS 101b
    • Planetary astrophotography
Re: alternative ptp client
« Reply #158 on: 02 / April / 2012, 18:16:21 »
If someone is interested here is a version for the A530 100a, tested and works well.
I have a version for A1100 100c, but I do not have a camera, I do not know if it works, if someone wants to test let me know.

*

Offline tpont

  • **
  • 81
Re: alternative ptp client
« Reply #159 on: 03 / April / 2012, 13:28:03 »
A follow up on the memory issue. I did another test with a borrowed camera that had free_block_max_size=328k  . It began downloading ~300 photos but aborted after saving ~160 photos. I didn't catch any error message. Could it also be due to low memory? Or are there any other known issues with the mdl command in chdkptp? Again, ptpCamGui.exe could downloaded all the images so I think it is an issue with chdkptp.

 

Related Topics