CHDKPTP File Downloading - page 4 - General Help and Assistance on using CHDK stable releases - CHDK Forum

CHDKPTP File Downloading

  • 92 Replies
  • 35412 Views
*

Offline reyalp

  • ******
  • 14125
Re: CHDKPTP File Downloading
« Reply #30 on: 10 / January / 2018, 14:13:57 »
Advertisements
So even after installing 1.4 onto the cameras I'm still getting I/O errors and a lot of "message from unexpected script id" errors. Is it possible I'm getting some of these problems because I'm using the 785 lua's? I feel like that probably isn't the case for the I/O errors though.
I agree, it's very unlikely the I/O errors have anything to do with which Lua version you are using. With the exmem issue eliminated, this suggests a hardware issue, although other CHDK or chdkptp bugs are possible. I'll repeat my earlier advice to examine the state of the camera after this happens. If the camera isn't crashed or frozen, one thing to check would be whether you can connect to it from chdkptp without rebooting the camera.

I'm not really clear what the sequence of events that gives you the "message from unexpected script id" error is. It may be an expected, harmless result of something you are doing, or may indicate a problem.

If you an give a concise, specific sequence that leads to this message, I may be able to tell.

Quote
Also I'm trying to turn off flash on the cameras but the only commands I can find relating to flash is get_flash_mode and get_flash_ready which I'm assuming are read only.
You should be able to set this by propcase, like
set_prop(props.FLASH_MODE,2)

see http://chdk.wikia.com/wiki/PropertyCase

Propcase settings do not persists across reboots, so you'll need to set this every session.
Don't forget what the H stands for.

Re: CHDKPTP File Downloading
« Reply #31 on: 10 / January / 2018, 15:07:17 »
So I modified my post like half a second before you responded so I'm just gonna quote the edit here in case you didn't see it.
Quote
edit: Also how do I format call? I tried
mc:cmd('call get_flash_mode')
mc:cmd('call', 'get_flash_mode')
mc:cmd(call(get_flash_mode))
mc:cmd('call(get_flash_mode))
etc.
and they didn't seem to work

In the case of I/O errors I can connect to the troublesome cameras and sometimes even take pictures with them, but whenever they're connected I get random chdkptp crashes. It's like they flicker between being assholes and working fine with no apparent schedule.

I haven't noticed a sequence behind the message from unexpected script id error but usually I can just hit continue and they'll sort themselves out.

Also can I use propcase with call in multicam?

*

Offline reyalp

  • ******
  • 14125
Re: CHDKPTP File Downloading
« Reply #32 on: 10 / January / 2018, 16:17:17 »
mc:cmd('call get_flash_mode')
Everything after call should be normal lua code. See the source: https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk/lua/multicam.lua#ln1145

It's also used several places in the existing code: shoot, testshots, find_files

Like it or not, the project you have chosen requires significant knowledge of the code, so you might as well dive in.

Generally you should use cmdwait and examine the status. If there is a syntax error, it will be reported in the status. Return values are also included in the status. If you want to get information back, you need to return it. So for get_flash_mode, you could use
!mc:print_cmd_status(mc:cmdwait('call return get_flash_mode()'))

Note that a runtime error in code you send with call will end the multicam camera side script. If you use pcall, it will catch runtime errors, but there are limitations on which CHDK functions you can use (you can't use anything that yields, including sleep(), key press/release, usb message functions that wait etc), and using the wrong ones will again cause uncaught runtime errors.

Quote
In the case of I/O errors I can connect to the troublesome cameras and sometimes even take pictures with them
So after a camera has I/O error, you can reconnect with chdkptp without rebooting the camera, and continue to use it? If this is correct, that definitely points to a problem in the USB layer.

If this is the case, it's possible that windows puts something in the event log. If you can test on linux, there might be something informative in the kernel or system logs. Note, I'm not suggesting you go set up a linux system if you don't have one, but if it's relatively easy, it would be worth a look.
Quote
, but whenever they're connected I get random chdkptp crashes.
Do you mean the chdkptp application actually crashes with a windows "this program has encountered an error" style dialog or something else?

I would again encourage you to test using the CLI. The GUI introduces a lot of room for confounding factors. I understand that your final application has to be GUI, but for the purpose of isolating this error, testing in the CLI may help you get to a root cause more quickly.

Quote
Also can I use propcase with call in multicam?
Of course. 'call' just executes CHDK camera side Lua.

Normally you have to do something like props=require'propcase' to use propcases by name, but the multicam script already does this.

Another general debugging approach would be to see if you can make one of the "bad" cameras fail in isolation, either as single camera with multicam, or without using multicam at all. For example, you could script the multicam start / stop sequence to run a hundred times with just one camera.
Don't forget what the H stands for.

Re: CHDKPTP File Downloading
« Reply #33 on: 11 / January / 2018, 15:43:18 »
Quote
Like it or not, the project you have chosen requires significant knowledge of the code, so you might as well dive in.
Whatever, I've grown kinda fond of working with chdk code. I have a linux laptop at home, I'll test the troublesome cameras with it tonight.

Where do I find the actual commands for propcase? I'm trying to implement a feature where all conected cameras turn on their auto focus lights so I can quickly figure out which ones arent connected. I tried
Code: [Select]
!mc:cmd('call AF_ASSIST_BEAM, 1') and nothing happened
but nothing happened.

Also I've switched over to CLI, and I made a new function that starts and stops the script a specified amount of times but so far I haven't been able to get a crash. Once I do I'll update with the event log.

Quote
Do you mean the chdkptp application actually crashes with a windows "this program has encountered an error" style dialog or something else?
Not a windows crash (crash wasn't really the right word), just an I/O error ever time I do anything until I restart the program.

edit: I got an I/O and I'm searching through windows event logs but I'm not totally sure what I'm looking for. Is there a usb event log? Should I be looking for a libusb log?
« Last Edit: 11 / January / 2018, 16:00:54 by jdstech »

*

Offline reyalp

  • ******
  • 14125
Re: CHDKPTP File Downloading
« Reply #34 on: 11 / January / 2018, 16:08:59 »
Code: [Select]
!mc:cmd('call AF_ASSIST_BEAM, 1') and nothing happened
but nothing happened.
As I mentioned above, you should use generally mc:cmdwait and check status (i.e. using !return mc:cmdwait(...) or mc:print_cmd_status(mc:cmdwait(...)) with any "call" command.

I'm not sure what you are trying to do with AF_ASSIST_BEAM, but to set propcase you must use the set_prop function, and the propcase id must be from the propcase module, like
Code: [Select]
mc:cmdwait('call set_prop(props.AF_ASSIST_BEAM,1)')

Quote
Also I've switched over to CLI, and I made a new function that starts and stops the script a specified amount of times but so far I haven't been able to get a crash. Once I do I'll update with the event log.
One difference with the GUI is that by default it periodically polls available cameras. I'm not sure offhand if this could interfere with multicam. You can disable the periodic polling by using
Code: [Select]
set gui_dev_check_interval=0

Quote
Not a windows crash (crash wasn't really the right word), just an I/O error ever time I do anything until I restart the program.
So you can reconnect to the "failed" camera, but you have to restart chdkptp to do it?

What if you disconnect and reconnect in chdkptp without restarting the program?

Quote
edit: I got an I/O and I'm searching through windows event logs but I'm not totally sure what I'm looking for. Is there a usb event log? Should I be looking for a libusb log?
Something mentioning USB, probably in the system log. The if you note when the error occurred, the timestamps should give you a pretty narrow range to look at.
Don't forget what the H stands for.

Re: CHDKPTP File Downloading
« Reply #35 on: 11 / January / 2018, 16:32:27 »
Quote
!mc:cmd('call AF_ASSIST_BEAM, 1')
That was just me being stupid while I was writing my reply. I meant
Code: [Select]
!mc:cmd('call set_prop(props.AF_ASSIST_BEAM, 1')
Then I tried cmdwait, then tried running probably the longest command I've ever written
Code: [Select]
!mc:print_cmd_status(mc:cmdwait('call return set_prop(props.AF_ASSIST_BEAM, 1)'))
And no cigar. Is turning the AF lights on indefinitely even possible?

Also still looking through the event logs and havent found anything usb related yet but I'll keep looking. The last I/O error I got was in the CL

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP File Downloading
« Reply #36 on: 11 / January / 2018, 16:57:57 »
I'm trying to implement a feature where all conected cameras turn on their auto focus lights so I can quickly figure out which ones arent connected.
Setting propcases won't do this, you need set_led(). Slight trouble is that you'll need to find out the ID corresponding to the AF LED - and that ID may not be the same across different camera models.
For camera side Lua, see this page if you haven't yet.

Re: CHDKPTP File Downloading
« Reply #37 on: 11 / January / 2018, 17:14:28 »
Quote
Setting propcases won't do this, you need set_led(). Slight trouble is that you'll need to find out the ID corresponding to the AF LED - and that ID may not be the same across different camera models.
Oh boy that sounds like fun. Thanks for the help.

This is gonna sound like a really stupid question, and it probably is, but how do you disconnect through multicam? The way I've been disconnecting is by reloading the program.

*

Offline reyalp

  • ******
  • 14125
Re: CHDKPTP File Downloading
« Reply #38 on: 11 / January / 2018, 17:44:26 »
This is gonna sound like a really stupid question, and it probably is, but how do you disconnect through multicam? The way I've been disconnecting is by reloading the program.
Not stupid, I forgot to implement an mc:disconnect() command  :-[

To disconnect all cameras, you could use something like:
Code: [Select]
for lcon in mc:icams() do lcon:disconnect() end

If you know the ID of the failed camera, you could use
Code: [Select]
mc:find_id(id):disconnect()

edit:
Oh boy that sounds like fun. Thanks for the help.
According to the source, the AF LED on both a3400 and a4000 should be 1, so set_led(1,1) would turn it on.
« Last Edit: 11 / January / 2018, 17:49:02 by reyalp »
Don't forget what the H stands for.

Re: CHDKPTP File Downloading
« Reply #39 on: 12 / January / 2018, 13:28:18 »
Quote
According to the source, the AF LED on both a3400 and a4000 should be 1, so set_led(1,1) would turn it on.

set_led is being weird. set_led(1,1) turns on the light for the a4000's, a2500's, and a3300's but not the a3400's. set_led(2,1) does nothing, as does (4,1), (6,1), (8,1) and all other even numbers up to 15. Every odd number up to 15 turns the AF light on for the 4000's, 2500's and 3300's, but the only set_led that works for the 3400's is (9, 1), which makes the green light near the screen blink, even though the command for blinking should be (9,2). (9,0) doesn't stop the blinking either, nor does (9,1). (8,1) however turns the green light off completely and I can't turn them back on without restarting the cameras.

I should probably call an exorcist.

Also I know I can use save_list to save camera id's, but is there a way to persistently map cameras to libusb id's?

 

Related Topics


SimplePortal © 2008-2014, SimplePortal