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

chdkptp - alternative ptp client

  • 1106 Replies
  • 534033 Views
*

Offline reyalp

  • ******
  • 14098
Re: alternative ptp client
« Reply #520 on: 27 / January / 2014, 00:58:08 »
Advertisements
Anyway, it works with two cameras. Tested it for around 50 photos in a row without any issues.
I figured out that I can set a custom save folder by changing the command line folder to the desired location before starting interactive mode and rsint.
Yes, most of the normal remoteshoot options should work with rsint.

In chdkptp changeset 482 I improved the timeout behavior. It now defaults to 60 seconds, and can be adjusted using the -cmdwait option to rsint.  So
 rsint -cmdwait=5
will time out after 5 seconds.

When it does time out, the camera script will end and rsint will exit the next time you enter something.

You must update extras/rsint.lua and chdku.lua to use this. You also need to update your CHDK build to 3342 or later.
Don't forget what the H stands for.

*

Offline tpont

  • **
  • 81
Re: alternative ptp client
« Reply #521 on: 27 / January / 2014, 13:17:16 »
I updated and it is working. I first tried setting a custom save path once in rsint mode like this
Code: [Select]
s 'C:\test\file'But that freezes chdkptp and the camera. I can press the shutter button on the camera to escape the freeze. But no file is saved to the target location.

Then I realized that the folder goes as parameter to rsint, like so
Code: [Select]
rsint C:\testThat works and saves each image with the filename format IMG_3410, IMG_3411, etcetera in the folder C:\test

*

Offline poussin

  • *
  • 36
  • A2200
Re: alternative ptp client
« Reply #522 on: 27 / January / 2014, 13:58:24 »
After I ran the test , I was wondering if it was possible to run the test from chkptp and how to do it. ( including the settings of the camera )

Further to my question I ran into a problem
Here is the log of the command  loadfile("A/CHDK/SCRIPTS/MF_TEST.LUA")()
For this to work, you need to set the menu parameters (a, b, c etc) before calling the script. Anyway, waterwingz script isn't designed to work in ptp, so other things might go wrong too.

It's not obvious to me why playing the dump failed.

Thanks for the answers.

Running the script in ptp was an interesting experiment to test the frame dump , display and "extract".

Since playing the dump succeeded after a PC reboot  and when  the camera was now longer connected , it may not be an important issue .

*

Offline tpont

  • **
  • 81
Re: alternative ptp client
« Reply #523 on: 27 / January / 2014, 15:31:00 »
reyalp, is it possible to later on add a parameter for custom filenames for each image by passing parameters to each individual "s" command?


*

Offline reyalp

  • ******
  • 14098
Re: alternative ptp client
« Reply #524 on: 27 / January / 2014, 16:07:27 »
reyalp, is it possible to later on add a parameter for custom filenames for each image by passing parameters to each individual "s" command?
That's a good idea, I'll see if I can find a reasonable way of doing it.
Don't forget what the H stands for.

*

Offline poussin

  • *
  • 36
  • A2200
Re: alternative ptp client
« Reply #525 on: 30 / January / 2014, 17:07:33 »
I was trying to connect to a A2200 chdk build  1.3.0.3152 and chdkptp build r438
using a .bat file
"chdkptp.exe" -g -c -r="C:\Users\exavue\Desktop\reader\rs.lua"
where  rs.lua is :
rec
rs
quit

The connect fails when executed with the batch file but succeed when executed from the console .

Any clue on the source of the problem.

Thanks

*

Offline reyalp

  • ******
  • 14098
Re: alternative ptp client
« Reply #526 on: 30 / January / 2014, 23:24:27 »
I was trying to connect to a A2200 chdk build  1.3.0.3152 and chdkptp build r438
using a .bat file
"chdkptp.exe" -g -c -r="C:\Users\exavue\Desktop\reader\rs.lua"
where  rs.lua is :
rec
rs
quit

The connect fails when executed with the batch file but succeed when executed from the console .
A few things:
1) What does "connect fails" mean? What actually happens?

2) Are you sure that this fails when run as a batch file, but works from the command line? I think the above should not work at all, whether from a batch file or command line. -r is processed before the connect option, and before the GUI is fully started. Processing it before the GUI is intentional, so you can set settings that need to set before the GUI is started. Doing it before the connect may be a bug, but in the case of the GUI, the connect should happen only after the GUI is started. The -r and .chdkptprc functionality is mainly intended for settings.

You can get around this using the "source" command with -e, like
chdkptp -g -c -e="source C:\Users\exavue\Desktop\reader\rs.lua"

or simply by using multiple -e commands for each command.

edit: I guess by "bat file" you maybe meant the -r option, not a .bat file?

3) Note that quit doesn't actually quit in the gui, so it will stay open. This is a bug. You could get around this using lua code to tell IUP to quit. You could use !os.exit() but I'm not sure everything would be cleaned up normally.
edit: actually quit works in the GUI if typed in the input, but not in a command file or -e command.

4) If you just want to run a command and quit, starting the GUI probably isn't a good idea, even if it worked, it will just slow things down. Just take the -g out of your command.

5) The file you run with -r is not a lua file, it's a chdkptp command file. chdkptp doesn't care what extension you use, but calling it .lua might confuse someone, or be a sign of confusion.

6) Using rec when you are already in rec mode is an error, so if you ran this multiple times without switching back to play, it would fail after the first one. There is supposed to be a setting to ignore errors, but I haven't implemented it yet.

The CLI commands aren't meant for heavy duty scripting, you can use Lua for that.
« Last Edit: 31 / January / 2014, 00:12:55 by reyalp »
Don't forget what the H stands for.

*

Offline poussin

  • *
  • 36
  • A2200
Re: alternative ptp client
« Reply #527 on: 31 / January / 2014, 05:44:04 »
Thanks for your answer .
I was trying to connect to a A2200 chdk build  1.3.0.3152 and chdkptp build r438
using a .bat file
"chdkptp.exe" -g -c -r="C:\rs.lua"
where  rs.lua is :
rec
rs
quit

The connect fails when executed with the batch file but succeed when executed from the console .

1) What does "connect fails" mean? What actually happens?

I modified the bat as suggested first  by removing the call to GUI second by using e instead of r :
1)----------------------------
if rssansg.bat is :

"chdkptp.exe"  -c -r="rs.lua"

if rs.lua is :

list
rec
rs
quit

then

rssansg.bat execution gives :

chdkptp.exe"  -c -r="C:\Users\exavue\Desktop\reader\rs.lua"



-1:Canon PowerShot A2200 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x322a v=0x4a9 p=0x3
22a s=85046B2D98F043448BDDA65F6A2726ED
ERROR: not connected
WARNING: rc rs.lua failed: error on line 2
open_camera_dev: ptp_opensession failed 0x2ff
open_camera_dev:usb_ptp_device_reset(): No such file or directory
usb_ptp_get_device_status(): No such file or directory
open_camera_dev: ptp_opensession 2 failed: 0x2ff
ERROR: connection failed

2) --------------------------------------------
with rsgce.bat

chdkptp.exe"  -g -c -e=" rs.lua"
starting gui...


with the error message on the GUI


connected: Canon PowerShot A2200, max packet size 512
ERROR: unknown command 'C'

UPDATE: the message originates during  function cli:execute(line)  at  line 269 of cli.lua
OOPS : forgot "source" in the command line
try with :
chdkptp.exe"  -g -e="source C:\rsconnect.lua"

where rsconnect.lua is

connect
list
rec
list
rs
quit

gives in GUI

connected: Canon PowerShot A2200, max packet size 512
*1:Canon PowerShot A2200 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x322a v=0x4a9 p=0x322a s=85046B2D98F043448BDDA65F6A2726ED
*1:Canon PowerShot A2200 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x322a v=0x4a9 p=0x322a s=85046B2D98F043448BDDA65F6A2726ED
ERROR: not in rec mode
ERROR: error on line 5



Note: The GUI is very useful to monitor the image ( and debug )

It seems to me there is a timing problem .
When the CHDKPTP commands are typed from the console in the GUI , it works but then they are included in the "rs.lua"  , the "connect" command may not not have the time to complete before the next command tries to execute.
Update : it seems to be true also for the "rec" command in the rsconnect.lua example
« Last Edit: 31 / January / 2014, 08:36:11 by poussin »


*

Offline reyalp

  • ******
  • 14098
Re: alternative ptp client
« Reply #528 on: 31 / January / 2014, 16:20:44 »
Note: The GUI is very useful to monitor the image ( and debug )
If the quit actually worked, you'd never have a chance to see it. While a command file is being run, you probably can't interact with the GUI, and the live view wouldn't update until it's finished.

I have no idea why a batch file would behave differently from typing the commands in a command prompt.

I'll look into these issues if I get a chance, but as I said I never intended cli command files to be used for serious scripting. You would probably be better off doing this kind of stuff in Lua.

If you can explain what you are actually trying to do, I might be able to suggest better approaches, or tell you whether it is possible.
Don't forget what the H stands for.

*

Offline poussin

  • *
  • 36
  • A2200
Re: alternative ptp client
« Reply #529 on: 31 / January / 2014, 17:45:00 »
Note: The GUI is very useful to monitor the image ( and debug )
If you can explain what you are actually trying to do, I might be able to suggest better approaches, or tell you whether it is possible.
I want to build a series of high level commands stored as a batch file to control the camera from the PC
by example : {connect , rec , remoteshoot ,disconnect }
{connect , rec , video , download }
{connect,liveview}
then I can display the image or the video  on the PC screen .

updates:

1)the problem is :
with the batch file , the command has not the time to finish its task before the next command is issued , hence the error message.


2)the PC OS is Windows 7 or higher.

3)the time necessary for a specific command to complete its task is "variable"
« Last Edit: 03 / February / 2014, 12:05:10 by poussin »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal