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

chdkptp - alternative ptp client

  • 1106 Replies
  • 517695 Views
Re: alternative ptp client
« Reply #280 on: 01 / January / 2013, 12:14:26 »
Advertisements
Thanks for the advice reyalp!

I've got it mostly working as I want now. The camera does occasionally crash/turn off and I can't figure out why. It's not a huge issue because I've now attached a relay to the power button of the camera so the Raspberry Pi running chdk-ptp can turn the camera back on when it goes off. But has this been seen in the past?

It is seemingly random, I've logged the times the camera needs restarting to see if there was any trend and there isn't....

Quote
12-12-31_21-20-42 - Internet Online - No camera - No capture
12-12-31_21-45-21 - Internet Online - No camera - No capture
12-12-31_22-37-21 - Internet Online - No camera - No capture
12-12-31_23-53-21 - Internet Online - No camera - No capture
13-01-01_01-38-02 - Internet Online - No camera - No capture
13-01-01_02-59-22 - Internet Online - No camera - No capture
13-01-01_04-18-41 - Internet Online - No camera - No capture
13-01-01_04-41-21 - Internet Online - No camera - No capture
13-01-01_07-57-21 - Internet Online - No camera - No capture
13-01-01_09-12-41 - Internet Online - No camera - No capture
13-01-01_09-39-21 - Internet Online - No camera - No capture
13-01-01_10-24-41 - Internet Online - No camera - No capture
13-01-01_10-33-21 - Internet Online - No camera - No capture
13-01-01_11-08-42 - Internet Online - No camera - No capture
13-01-01_11-10-01 - Internet Online - No camera - No capture
13-01-01_12-46-01 - Internet Online - No camera - No capture
13-01-01_14-17-22 - Internet Online - No camera - No capture
13-01-01_15-02-42 - Internet Online - No camera - No capture

One more thing, is it possible to set the focus distance?

I've tried "set_prop(6, 4); set_focus(1000);" but that doesn't seem to set the focus distance.

I may not be asking this in the right place since it's probably a general CHDK/lua question, but any help would be appreciated.

*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #281 on: 01 / January / 2013, 14:50:27 »
I've got it mostly working as I want now. The camera does occasionally crash/turn off and I can't figure out why. It's not a huge issue because I've now attached a relay to the power button of the camera so the Raspberry Pi running chdk-ptp can turn the camera back on when it goes off. But has this been seen in the past?
Without knowing what you are doing, it's hard to say if it has been seen before. If you can get ROMLOG from the camera http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29 that may help.

Quote
One more thing, is it possible to set the focus distance?
In theory, set_focus should do it. However, this feature frequently has problems or only works under certain Canon settings, so there may be issues specific to your camera. You should check the porting thread for your camera and post there if it isn't working.

In auto focus modes, the focus override will only be applied on half-press (after the normal AF is complete). If your camera has MF, it should be applied immediately, and in general for cameras that have MF, it is probably preferable to do it this way.
Don't forget what the H stands for.

Re: alternative ptp client
« Reply #282 on: 04 / January / 2013, 11:02:52 »
The command I'm running is currently

Code: [Select]
sudo sh /home/pi/chdkptp/chdkptp-sample.sh -c -e"delete DCIM" -e"exec sys.sleep(2000)" -e"luar switch_mode_usb(1); set_zoom(0); set_prop(6, 3); shoot(); switch_mode_usb(0)" -e"exec sys.sleep(2000)"  -e"mdl DCIM /tmp/chdk-download" -e"exec sys.sleep(2000)" -e"delete DCIM"
This can sometimes work for hours at a time or can cause the camera to crash/turn off/disconnect after a few minutes. It is run every 40 seconds via a cronjob. Along with a resize and FTP command but they won't be causing the camera issue.

My log today showed...
Quote
13-01-03_13-12-41 - Internet Online - No camera - No capture
13-01-03_14-25-22 - Internet Online - No camera - No capture
13-01-03_16-07-21 - Internet Online - No camera - No capture
13-01-03_19-22-41 - Internet Online - No camera - No capture
13-01-04_03-12-01 - Internet Online - No camera - No capture
13-01-04_03-37-21 - Internet Online - No camera - No capture
13-01-04_04-10-01 - Internet Online - No camera - No capture
13-01-04_05-51-21 - Internet Online - No camera - No capture
13-01-04_05-54-41 - Internet Online - No camera - No capture
13-01-04_06-10-41 - Internet Online - No camera - No capture
13-01-04_06-28-41 - Internet Online - No camera - No capture
13-01-04_09-47-21 - Internet Online - No camera - No capture
13-01-04_10-30-41 - Internet Online - No camera - No capture
13-01-04_10-44-02 - Internet Online - No camera - No capture
13-01-04_11-37-21 - Internet Online - No camera - No capture
13-01-04_14-09-21 - Internet Online - No camera - No capture
13-01-04_15-00-41 - Internet Online - No camera - No capture
13-01-04_15-04-42 - Internet Online - No camera - No capture
13-01-04_15-17-21 - Internet Online - No camera - No capture

...just an example of inconsistency of the crashes. I'll try and get some sort of log tonight to see what causes the crashes. Like I said, it's not a problem now I've got the relay working to turn the camera (Canon Ixus 220 HS / ELPH300) on and off when I want via GPIO.

*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #283 on: 04 / January / 2013, 15:45:03 »
This can sometimes work for hours at a time or can cause the camera to crash/turn off/disconnect after a few minutes.
As I said before, getting a romlog from the camera may shed some light on what is making it crash.

You might want to put some delay (camera side sleep()) between the switch_mode_usb(), set_zoom() and shoot() but again if you get a romlog that may narrow things down.

Just FYI, you may find it more convenient to put the commands into a file rather than using so many -e commands. e.g you could put the following in myfile.chdkptp
Code: [Select]
delete DCIM
exec sys.sleep(2000)
luar switch_mode_usb(1); set_zoom(0); set_prop(6, 3); shoot(); switch_mode_usb(0)
exec sys.sleep(2000) 
mdl DCIM /tmp/chdk-download
exec sys.sleep(2000)
delete DCIM
and then you could execute it with
Code: [Select]
sudo sh /home/pi/chdkptp/chdkptp-sample.sh -c -rmyfile.chdkptp
Don't forget what the H stands for.


Re: alternative ptp client
« Reply #284 on: 08 / January / 2013, 10:30:41 »
Thanks for the tip on using the config file. It'll make things much neater.

Re: alternative ptp client
« Reply #285 on: 21 / January / 2013, 03:47:33 »
Hey, good work on the software.  I used it as the basis for the software for a photobooth recently, and it seemed to work pretty well.  I hacked up the lua code pretty deeply as I needed a custom interface and whatnot, so in the version I am running, it is mostly just using the 'library' functions.

I noted that I could crash the camera pretty reliably if I didn't wait a bit between the capture, download and delete steps, so thanks for that detail above, it was handy.

Too bad I can't just have the camera reboot on crash.  I made a function that notices that the camera connection is gone, and attempts to reconnect every few seconds.  Seems to work pretty well.

*

Offline ahull

  • *****
  • 634
Re: alternative ptp client
« Reply #286 on: 22 / January / 2013, 01:43:19 »
Good work as ever. I just set this up on my Raspberry pi using reyalp's recent raspian chdkptp UI from here...

https://www.assembla.com/spaces/chdkptp/documents/crhy7KfOqr4OAMacwqjQYw/download/crhy7KfOqr4OAMacwqjQYw

I am running this with my IXY25(SD770/IXUS85) f.w 1.00a using the latest developer build CHDK 1.2.0-2504 Jan 21, 2012.

I am running the UI on the laptop as follows.

ssh -X root@mr-kipling                                                 
This allows me to connect to "mr-kipling" (what else would you call a pi?) and export the X session back to the laptop.

cd /home/{actual_user}/chdk/chdkptp                           

I need to do this because the UI only runs as root, and I copied the code to my user folder

I then run a modified version of chdkptp-sample.sh which I have named run_chdkptp

root@mr-kipling:/home/{actual_user}/chdk/chdkptp# ./run_chdkptp
starting gui...
Gtk-Message: Failed to load module "canberra-gtk-module"

... and up pops the UI on the laptop. I can now sit in the comfort of the front room with the camera and Pi outside. (I am on holiday in India at the moment, so no risk of rain or snow to the camera). I can sit here and watch the wildlife in the garden (well I will be able to when I recharge the camera battery  ::) )

So far everything looks to work (live view, shooting etc) without any hitches, but I will report back if I hit any snags.

« Last Edit: 22 / January / 2013, 12:20:15 by ahull »

*

Offline ahull

  • *****
  • 634
Re: alternative ptp client
« Reply #287 on: 22 / January / 2013, 12:33:10 »
No real gotchas to report, there is an issue (possibly due to the limited oomph of the pi) which causes a lot of lag after I have been using the UI for a while, if I disable Live view it settles down again.

The colours on the Canon menu don't match what is on the Live view (I can live with that), and for some bizarre reason I cant see the Print menu in the main Canon menu, pressing right and left will show the other menus, but it stays on the previous menu when it should display the print menu (this menu looks OK on the camera LCD, so the behaviour of the Live view is slightly odd). Not a show stopper as I am unlikely to ever use the print menu, but worth reporting none the less. 

The  bottom few lines of pixels on the Live view are corrupted in Record mode I am still trying to work out exactly why, I'll post once I have a better idea.

I get the occasional lockup requiring the battery to be removed from the camera (I haven't yet been able to reproduce this at will, so I can't give any pointers so far as debugging goes yet. I will keep you posted).

Next I am going to map an nfs mount to the pi from the laptop so I can copy the images from the UI to a folder on the laptop, to save a step.

If I get a chance tomorrow, I'll test some more.

I am most impressed with the progress so far  :D Thanks to reyalp, and everyone else who has been involved.
« Last Edit: 22 / January / 2013, 12:38:07 by ahull »


*

Offline nafraf

  • *****
  • 1308
Re: alternative ptp client
« Reply #288 on: 22 / January / 2013, 13:22:55 »
The colours on the Canon menu don't match what is on the Live view (I can live with that), and for some bizarre reason I cant see the Print menu in the main Canon menu, pressing right and left will show the other menus, but it stays on the previous menu when it should display the print menu (this menu looks OK on the camera LCD, so the behaviour of the Live view is slightly odd). Not a show stopper as I am unlikely to ever use the print menu, but worth reporting none the less. 
I had a similiar problem with a2300, this should solve it: http://chdk.setepontos.com/index.php?topic=8318.msg88938#msg88938

*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #289 on: 22 / January / 2013, 16:11:08 »
No real gotchas to report, there is an issue (possibly due to the limited oomph of the pi) which causes a lot of lag after I have been using the UI for a while, if I disable Live view it settles down again.
I've found that on Linux if the requested frame rate exceeds the max frame rate that can actually be delivered, the UI gets very laggy. With the current code, this means you are in trouble if your system can't do at least 1fps, because the input doesn't accept lower vlaues.

If you aren't worried about the security of your connection, you might get better performance by making x directly accessible over the network rather than tunneling over ssh, since the latter requires the pi to encrypt all your X traffic.

As nafraf says, your display issues are likely due to incomplete implementation of the functions needed for live view.
Don't forget what the H stands for.

 

Related Topics