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

chdkptp - alternative ptp client

  • 1106 Replies
  • 517695 Views
*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #550 on: 13 / February / 2014, 14:07:47 »
Advertisements
Thanks to nafraf, rs is now working on the SX120IS, using the chdk build he posted on the thread for that camera.

My next question is--how can I switch to low-res to see where I am while remotely controlling pan, tilt, and zoom, and then switch back to hi-res to shoot?

Is it shown somewhere how to stream the lcd headlessly to a browser?

Re: alternative ptp client
« Reply #551 on: 13 / February / 2014, 14:26:26 »
What is the canon firmware version of your sd700 ?

sd700-101a and sd850-100c.

Thanks

*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #552 on: 13 / February / 2014, 14:58:16 »
Following nafraf's suggestion regarding resolution, I looked for set_prop information here:

http://chdk.wikia.com/wiki/UBASIC/propertyCaseUse

This text seemed relevant:

24 Image resolution: 0, 1, 2, 4, 8 for L, M1, M2, S, W  (these are S3
      designations: L is full resolution, M1 and M2 are progressively lower
      resolutions, S is 640x480, and W is a “wide screen” format: full
      resolution width, but less than full resolution height).

I tried the following session:

/usr/src/chdkptp/chdkptp -i -c
connected: Canon PowerShot SX120 IS, max packet size 512
con> rec
con 1> lua set_prop(24,4)
con 2> rs /var/www/test19
con 5> lua set_prop(24,5)
con 6> rs /var/www/test20
con 9> lua set_prop(24,0)
con 10> rs /var/www/test21
con 13> q
bye

I thought this would set higher or lower resolution on my SX120IS, but test19.jpg, test20.jpg, and test21.jpg all were 1600x1200, in accordance with the M3 setting on the camera. 

Is the form of my "lua set_prop(24,4) command correct, and if so, what do I need to do to get the settings to take?  (NOTE: (24,5) looks wrong--valid settings are single-bit--0,1,2,4,8.)

*

Offline nafraf

  • *****
  • 1308
Re: alternative ptp client
« Reply #553 on: 13 / February / 2014, 15:18:25 »
@lyzby
SX120 uses propset 3.  Property 220 for Resolution chdk.wikia.com/wiki/PropertyCase

@trig
Test version for ixus800_sd700-101b/101a (filewrite task and simpler loader support) in attachment.


*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #554 on: 13 / February / 2014, 16:54:37 »
Thank you, nafraf--"lua set_prop(220,x)" works for setting the resolution on the SX120IS with chdkptp. 

220,4 sets it to vga mode (640x480); 220,0 is full resolution, 10 megapixels, 3648x2736; 220,1 is 6 megapixels, 2816x2112; 220,2 is 4 megapixels, 2272x1704; 220,3 is 2 megapixels, 1600x1200; 220,5 is widescreen, 3648x2048.

Other cameras use different property sets--see:  http://chdk.wikia.com/wiki/PropertyCase

 /usr/src/chdkptp/chdkptp -i -c
connected: Canon PowerShot SX120 IS, max packet size 512
con> rec
con 1> lua set_zoom(25)
con 2> lua set_prop(220,4)
con 3> rs /var/www/test23
con 6> lua set_prop(220,0)
con 7> rs /var/www/test24
con 10> q
bye
« Last Edit: 13 / February / 2014, 16:57:32 by lyzby »

*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #555 on: 13 / February / 2014, 20:32:10 »
What command line arguments should I use to set resolution and zoom, shoot with rs, disconnect, quit, and then be able to do it again?

This is what I tried (3 sequences):

root@dock84:/usr/src/chdkptp/lua# /usr/src/chdkptp/chdkptp -c -e"rec" -e"lua set_prop(220,4)" -e"lua set_zoom(10)" -e"rs /var/www/current" -e"dis" -e"q"
connected: Canon PowerShot SX120 IS, max packet size 512
ERROR: already in rec
bye
root@dock84:/usr/src/chdkptp/lua# /usr/src/chdkptp/chdkptp -c -e"rec" -e"lua set_prop(220,4)" -e"lua set_zoom(5)" -e"rs /var/www/current" -e"dis" -e"q"
connected: Canon PowerShot SX120 IS, max packet size 512
ERROR: already in rec
ERROR: a script is already running
bye
root@dock84:/usr/src/chdkptp/lua# /usr/src/chdkptp/chdkptp -c -e"rec" -e"lua set_prop(220,4)" -e"lua set_zoom(5)" -e"rs /var/www/current" -e"dis" -e"q"
connected: Canon PowerShot SX120 IS, max packet size 512
ERROR: already in rec
bye

The camera stays in rec mode (should I put "play" at the end, or can I rely on it's being in rec mode after the first time)?

When I get "ERROR: a script is already running" it doesn't shoot.  If I re-enter the exact same command, that error doesn't occur and it does shoot.  How do I terminate the running script?

What is the proper way of doing this without getting errors (assuming we'll really always be in "rec" mode)?

(Note that it did shoot the first and 3rd times.)

SX120IS
« Last Edit: 13 / February / 2014, 20:49:37 by lyzby »

*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #556 on: 14 / February / 2014, 17:03:03 »
Is it shown somewhere how to stream the lcd headlessly to a browser?
There isn't currently a way to do this. You can run the GUI remotely with VNC or X, but performance is likely to be pretty poor.

It should be relatively easy for someone with the required programming skills to make something that reads the live view output and converts it to something an existing video streaming system accepts.
Don't forget what the H stands for.

*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #557 on: 14 / February / 2014, 17:10:31 »
Is it shown somewhere how to stream the lcd headlessly to a browser?
There isn't currently a way to do this. You can run the GUI remotely with VNC or X, but performance is likely to be pretty poor.

It should be relatively easy for someone with the required programming skills to make something that reads the live view output and converts it to something an existing video streaming system accepts.
Where is the live view output documented?


*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #558 on: 14 / February / 2014, 17:13:46 »
Thank you, nafraf--"lua set_prop(220,x)" works for setting the resolution on the SX120IS with chdkptp. 
Using the propcase module is highly recommended. Then you can refer to the propcases by name, which is not platform dependent, like
lua set_prop(require'propcase'.RESOLUTION,x)

The camera stays in rec mode (should I put "play" at the end, or can I rely on it's being in rec mode after the first time)?
It should stay in whatever mode you last put it in. Using -e commands, the error from rec should be harmless (this is not case for command files used with -r, in those an error will prevent all subsequent commands from completing.)

Quote
When I get "ERROR: a script is already running" it doesn't shoot.  If I re-enter the exact same command, that error doesn't occur and it does shoot.  How do I terminate the running script?
You are using lua ... which does not wait for the script to finish. Since set_zoom takes a significant amount of time, it isn't finished when you try to run the rs, so you get the "script already running" error.

To make chdkptp wait for the script, use luar instead.

You shouldn't need -e"dis" and -e"q", if you don't use -i it will automatically quit when the commands are done.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #559 on: 14 / February / 2014, 17:21:02 »
Where is the live view output documented?
In the source https://tools.assembla.com/svn/chdk/trunk/core/live_view.h

The chdkptp source has examples of how to decode it, in https://tools.assembla.com/svn/chdkptp/trunk/liveimg.c and https://tools.assembla.com/svn/chdkptp/trunk/lua/gui_live.lua

You could use the liveimg.c code to convert to RGB, but it currently only supports planar output (r, g and b each in their own buffer) and scaling is handled by the GUI code.

You would also have to arrange to get chdkptp to send the live view data while still accepting commands, which is not currently possible in the cli.
Don't forget what the H stands for.

 

Related Topics