Putting Canon S110 into MF or AFL - page 4 - Script Writing - CHDK Forum supplierdeeply

Putting Canon S110 into MF or AFL

  • 37 Replies
  • 8283 Views
Re: Putting Canon S110 into MF or AFL
« Reply #30 on: 28 / April / 2014, 07:03:29 »
Advertisements
Hi, regarding killscript command.

I'm now working with firmware 103a and CHDK v1.3.
Any reason why killscript will generate perfectly on my windows PC using:
Code: [Select]
chdkptp -c -e"killscript;"
But it won't on my Linux operated Odroid using:
Code: [Select]
/root/chdkptp/chdkptp/chdkptp-sample.sh -c -e"killscript"
???

What am I missing?

Thanks  :D
Nadav

*

Offline reyalp

  • ******
  • 11848
Re: Putting Canon S110 into MF or AFL
« Reply #31 on: 28 / April / 2014, 15:46:32 »

But it won't on my Linux operated Odroid using:
Code: [Select]
/root/chdkptp/chdkptp/chdkptp-sample.sh -c -e"killscript"
???

What am I missing?
It would help if you could describe specifically what happens.
Is there any output or error messages?
Do other chdkptp commands work?
Are you using the same version of CHDK and chdkptp in both cases?

If chdkptp can't connect at all, it's probably either a permissions issue, or some other program has already opened the device. The two forum posts linked from https://www.assembla.com/spaces/chdkptp/wiki/Install have some information on these cases.

 If it's just killscript that is broken, I need more information.


Note if you are building your own chdkptp from source, I've started some destabilizing changes after r549, so you may want to stick to this version or earlier for a while.
Don't forget what the H stands for.

Re: Putting Canon S110 into MF or AFL
« Reply #32 on: 29 / April / 2014, 18:07:49 »
I'll check the revision and then I'll supply further information if it wont be solved.

Meanwhile, is there a command which in I can use for determining whether the camera is still busy or ready for a new command?
I could use it as a loop condition for nagging with the 'killscript' till it succeed.

*

Offline reyalp

  • ******
  • 11848
Re: Putting Canon S110 into MF or AFL
« Reply #33 on: 29 / April / 2014, 20:54:50 »
I'll check the revision and then I'll supply further information if it wont be solved.
The other questions are likely to be more important than the version. What actually happens when you try to the run the command?

Just saying it doesn't work doesn't give any possible way to know what your problem is. If it fails, there is almost certainly some output. If you aren't able to see the output on the Odroid, you need to fix that.
Quote
Meanwhile, is there a command which in I can use for determining whether the camera is still busy or ready for a new command?
What do you mean by "busy"?
If a script is running, attempting to run another script will result in a "script already running" message, but since you are asking about killscript, I guess this isn't what you mean.
Quote
I could use it as a loop condition for nagging with the 'killscript' till it succeed.
I don't understand this at all. killscript executes immediately. If it's failing you need to figure out what specifically is failing.
Don't forget what the H stands for.


Re: Putting Canon S110 into MF or AFL
« Reply #34 on: 30 / April / 2014, 03:13:10 »
Reyalp, I know I'm not cooperating so well.
The reason is that the system on which I'm running running the chdkptp is different then the one I'm talking with you right now, and more then that, most of the time it's spread between the group's members for additional development... So it's difficult for me to get the information (This is my mistake that I didn't copy it in the sec it occurred..  ).

Any way, my last question was if I can some how check whether the camera is currently running a script.
Since I send the commands via "chdkptp -e" I can't be sure that the the camera had finished doing what it had to do and ready for the next command (perhaps sent by another thread in my program).

I will supply you the error message I get when using the killscript ASAP.

Thanks.

*

Offline reyalp

  • ******
  • 11848
Re: Putting Canon S110 into MF or AFL
« Reply #35 on: 30 / April / 2014, 16:54:02 »
Any way, my last question was if I can some how check whether the camera is currently running a script.
Since I send the commands via "chdkptp -e" I can't be sure that the the camera had finished doing what it had to do and ready for the next command (perhaps sent by another thread in my program).
If you started the original script with the luar (=), then that instance of chdkptp won't exit until it completes.

Within chdkptp, you can just try to execute script (like lua return 1), and you will get a "script is already running" message.

You can also check directly in chdkptp lua:
Code: [Select]
con> exec return con:script_status()
={
 msg=false,
 run=false,
}
run will be true if a script is running.

Note that either of these options require that you already be connected to the camera. If you are wanting to start a new chdkptp process with chdkptp -e ... to while another instances is still potentially doing something, you cannot do that safely. There can only be one connection to a given camera at a time.
Don't forget what the H stands for.

Re: Putting Canon S110 into MF or AFL
« Reply #36 on: 01 / May / 2014, 01:57:12 »
Quote
Note that either of these options require that you already be connected to the camera. If you are wanting to start a new chdkptp process with chdkptp -e ... to while another instances is still potentially doing something, you cannot do that safely. There can only be one connection to a given camera at a time.

This means that if I'm running a command like:
Code: [Select]
chdkptp -c -e"remoteshoot -con=6000"
and I like to force-stop the remoteshooting inst I cannot open another instance of chdkptp for the 'killscript'?
Code: [Select]
chdkptp -c -ekillscript
This is what I currently do, and it results with a not too bad statistics.
I run the 'killscript' command with a repeat(7) and one of them almost always succeed.

But if I understand you correctly, it shouldn't be able to connect to the camera as long as the other instance is already connected.
Did I miss something again?

*

Offline reyalp

  • ******
  • 11848
Re: Putting Canon S110 into MF or AFL
« Reply #37 on: 01 / May / 2014, 16:40:47 »
and I like to force-stop the remoteshooting inst I cannot open another instance of chdkptp for the 'killscript'?

This is what I currently do, and it results with a not too bad statistics.
I run the 'killscript' command with a repeat(7) and one of them almost always succeed.

But if I understand you correctly, it shouldn't be able to connect to the camera as long as the other instance is already connected.
I said you can't do it safely. If you try to open a connection to a device that is already open by another process, chdkptp will attempt to reset the device (edit to clarify: this is a USB connection reset, not a reboot). What exactly happens if you do that in the middle of remoteshoot is not specified, but it is likely you will get corrupt data and the camera side (independent of the camera side script) may hang around waiting for various things to time out. If it happens mid transaction, I would not be surprised if the camera crashes or the PTP task hangs.

There is no way to check if there is a "safe" time to do this, because there can only be one connection at a time.

I would strongly recommend against using this approach.

A much better alternative would be to control as single instance of chdkptp, either by using standard input (with rsint, for example) or writing some Lua code that sits in a loop waiting for commands of some kind. A simple way to do the latter would be to modify the rsint code to look for a control file, so it shoots continuously as long as a file called "shoot" exists, and stops when it goes away.

If you are more specific about what you need to do, I may be able to come up with some example code or at least provide some suggestions on how to code it. It seems like there is a fair bit of interest in this kind of scenario, it's something I would like to support directly in chdkptp at some point.
« Last Edit: 01 / May / 2014, 16:43:06 by reyalp »
Don't forget what the H stands for.


 

Related Topics