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

chdkptp - alternative ptp client

  • 1106 Replies
  • 515656 Views
*

Offline reyalp

  • ******
  • 14080
Re: alternative ptp client
« Reply #360 on: 02 / June / 2013, 17:27:50 »
Advertisements
I have played a little bit around the GUI. It's my first try to design some icons for IUP.Lua. All icons were converted with the program iupview.
Nice work. My only comment on the buttons is I'm not sure the half shoot and shoot are very clear. If they had a tooltip, that could solve it.
Quote
- added function for shoot+download with selection of a destination (user request from German forum)
I don't know if you saw, but yesterday I added some download options to the the 'shoot' cli command http://trac.assembla.com/chdkptp/changeset/347/trunk  Not finished yet, still need to allow specifying the destination directory and name(s). It's a little complicated because there might be more than one file.

For the gui, I'd like to have a "shoot options" somewhere, which would have controls like
raw [dropdown <none>,dng,chdk]
download  [] jpeg [] raw
delete [] jpeg [] raw
[folder button] [c:\selected\path...]
tv [....] av [...] sv [...]
This could go in a non-modal popup window maybe. Most of the actual work could be done with the shoot cli command.
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 #361 on: 02 / June / 2013, 18:05:04 »
My only comment on the buttons is I'm not sure the half shoot and shoot are very clear.
You're right. But I had no better idea: a green rectangle (focus ready) for 'half shoot' & a stylized shutter for 'shoot'. A tooltip is a good idea.

I don't know if you saw, but yesterday I added some download options to the the 'shoot' cli command
Yes, I saw it. But the 'shoot&download' function was already finished. Your suggestion is good.

Maybe we need an additional tab for user defined functions. I have read about a HDR GUI function in any post, don't remember where. Also a kind of .ini file would be interesting.

msl
CHDK-DE:  CHDK-DE links

*

Offline reyalp

  • ******
  • 14080
Re: alternative ptp client
« Reply #362 on: 02 / June / 2013, 19:29:45 »
Also a kind of .ini file would be interesting.
Yes, some way to save settings would be good.  This is on my todo list... but as you can see my progress is slow. My original intention for the "prefs" is that they could be saved and loaded.

If you want to load customization at startup, you can use the "rc file" functionality.

.chdkptprc is run when you start the cli, .chdkptpguirc is used for the gui. On windows, _ is used instead of a . because windows explorer doesn't let you name files .foo

You can run any chdkptp commands there, so you could load your own lua addons with

!require'mymodule'

in your startup file

For additions to the gui, this might be tricky because the rc file is run before the main gui is fully created. Possibly the gui startup should have a hook of some kind to call user functions.
Don't forget what the H stands for.

Re: alternative ptp client
« Reply #363 on: 06 / June / 2013, 16:50:45 »
Hi reyalp,

I think a few posts are missing...

I was trying to put my camera into record mode with LUA script but I had no luck. It works if I run script from camera but if I try to run it with chdkptp nothing happens and it's stuck. If I try anything afterwards I get: ERROR: a script is already running. The only thing I'm left with is to press on power button on camera to shut it down and start it again.

Code: [Select]
if (get_mode()==false) then
    sleep(1000)
    set_record(1)
    while (get_mode()==false) do
        sleep(100)
    end
    sleep(1000)
end

shoot()

This code works if I run it directly on a camera, but in chdkptp it won't. Any ideas how to put camera into record mode when running script on chdkptp?


*

Offline reyalp

  • ******
  • 14080
Re: alternative ptp client
« Reply #364 on: 06 / June / 2013, 17:36:29 »
Hi reyalp,

I think a few posts are missing...
It does look that way  :blink:
Quote
I was trying to put my camera into record mode with LUA script but I had no luck.
You need to use switch_mode_usb() rather than set_record (this is a historical artifact, different calls are needed when the camera is connected via ptp, but really chdk should detect do the right thing). You can look at the source of the rec and play cli commands for examples:
http://trac.assembla.com/chdkptp/browser/trunk/lua/cli.lua#L1402

The code inside the call to con:execwait is what is sent to the camera.

If you are going to do something immediately after switching, you should wait until the switch completes, as in the code you posted. It's a good idea to not call switch_mode_usb() if you are already in the desired mode.

http://chdk.wikia.com/wiki/Lua/PTP_Scripting describes a lot of the ptp specific issues.
Don't forget what the H stands for.

Re: alternative ptp client
« Reply #365 on: 06 / June / 2013, 17:47:52 »
Thank you reyalp :)

Time to rewrite a few lines :) Much appreciated!
« Last Edit: 06 / June / 2013, 18:01:56 by frojnd »

Re: alternative ptp client
« Reply #366 on: 27 / June / 2013, 20:37:24 »
I'm currently have an inconsistent problem with downloading photos from my camera using chdkptp and the mdl command.

My setup is basically this a Raspberry Pi + Canon Ixus 110 IS (SD960IS) + stepper motor.

The motor turns the camera and a photo is taken at each position (usually at least 13), then all the photos should be downloaded then sent to another system to do the panorama stitching.

Sometimes all the photos download absolutely fine off the camera but other times there's some errors after around about 10 photos. I get this...

Code: [Select]
unexpected return code 0x2ff
ERROR: download failed
unexpected return code 0x2ff
ERROR: ptp error
ERROR: Could not close session!

Sometimes it seems to stall at about 10 photos but then manages to carry on and complete the download without error.

I've tried adding the -batchsize=n option in case that made a difference (using either 1 or 10 for n) but it doesn't seem to make any difference. What does "batchsize" refer to anyway? What is one batch?

I've never had any SD card issues with my Raspberry Pi even though it is only a Class 2 2GB card, but could the card speed be an issue here?

Currently using CHDK version 2904 and chdkptp r330.

*

Offline reyalp

  • ******
  • 14080
Re: alternative ptp client
« Reply #367 on: 27 / June / 2013, 22:16:19 »
Code: [Select]
unexpected return code 0x2ff
ERROR: download failed
This is just a generic error that means the connection is gone or not working, so it doesn't really tell us much. Is the camera crashed when this happens?

If the camera is crashed, try to get a romlog: http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29

If it isn't crashed, try to describe what state the camera is in: can you reconnect chdkptp, can you interact with it using the physical buttons etc.

Is the shoot and download automated by some process? Having the download too close to the shoot can cause crashes. This will produce a distinct romlog.

Quote
I've tried adding the -batchsize=n option in case that made a difference (using either 1 or 10 for n) but it doesn't seem to make any difference. What does "batchsize" refer to anyway? What is one batch?
batchsize controls how the directory listing information is sent. This is used to limit the amount of memory used on the camera. It should not be an issue if there are only a few files on the card. -dbgmem should print some memory info, but it appears to be broken in the current svn.

edit:
I fixed the dbgmem option in changeset 377.
« Last Edit: 27 / June / 2013, 22:21:29 by reyalp »
Don't forget what the H stands for.


Re: alternative ptp client
« Reply #368 on: 28 / June / 2013, 07:03:16 »
When the error occurs I am able to reconnect with chdkptp right away and issue commands.

The camera doesn't crash and still responds to button presses that are available whilst plugged in via USB, Menu, Power.

I already have a 2 second delay in to allow any commands to finish, as well as that I've tried closing the connection after taking the photos then opening a new session to download them. This doesn't improve things.

For the time being I could add a few lines to my script to check how many photos have been downloaded and if it's not the right amount to try again until I get them all.

*

Offline reyalp

  • ******
  • 14080
Re: alternative ptp client
« Reply #369 on: 28 / June / 2013, 23:20:38 »
When the error occurs I am able to reconnect with chdkptp right away and issue commands.
OK, that doesn't sound like any of the problems I had in mind.

This could happen if some other program grabbed the USB connection. You could try looking in the kernal log (dmesg output) to see of something particular happens at the times you lose connection.

It could also be the USB connection being flaky I guess. Do you have any other USB devices plugged into the pi? Are you using a powered hub? The camera itself should be fine on USB, but other devices that expect to get a significant amount of power can cause problems if you aren't using a powered hub.

Quote
I already have a 2 second delay in to allow any commands to finish, as well as that I've tried closing the connection after taking the photos then opening a new session to download them. This doesn't improve things.
Yeah, if the camera doesn't crash, it's not the timing thing.

Quote
For the time being I could add a few lines to my script to check how many photos have been downloaded and if it's not the right amount to try again until I get them all.
You could also use chdkptp side lua or modify the mdownload cli command to reconnect if there is an error.

When you get the error, do you get an incomplete file?
Don't forget what the H stands for.

 

Related Topics