CHDKPTP File Downloading

  • 59 Replies
  • 2466 Views
Re: CHDKPTP File Downloading
« Reply #50 on: 23 / January / 2018, 14:05:43 »
Advertisements
Quote
Do you mean the camera itself freezes (stays on but physical controls have no effect), or an actual crash (shuts down), or just an IO error like before?
The camera itself freezes. The screen is stuck on a single frame and none of the buttons on the camera work, including power. I'm using DC battery adapters so I just unplug it from power to force shut down.

Quote
I guess you mean IO error, since cycling the hubs resolves it?
Yes

It's possible that while I was updating some of the cameras firmware one of the cameras started acting up and haulted the install on some other cameras. I'm not sure if this could be the cause of any of my current errors, I feel like if the chdk install on the camera was missing some parts it would be FAR more problematic than this.

If I get a chance tonight I'll do a bit of research on usb stall handling and see if I can come up with a quick TL;DR for you. It might be completely useless to you but at the very least I might learn something.

*

Offline reyalp

  • ******
  • 11090
Re: CHDKPTP File Downloading
« Reply #51 on: 23 / January / 2018, 17:15:42 »
Quote
Do you mean the camera itself freezes (stays on but physical controls have no effect), or an actual crash (shuts down), or just an IO error like before?
The camera itself freezes. The screen is stuck on a single frame and none of the buttons on the camera work, including power. I'm using DC battery adapters so I just unplug it from power to force shut down.

Quote
I guess you mean IO error, since cycling the hubs resolves it?
Yes
I'm confused as to how these two scenarios relate:

1) Camera freezes, requires hard  camera power cycle to recover
2) IO error, resolved by hub power cycle.

Quote
I feel like if the chdk install on the camera was missing some parts it would be FAR more problematic than this.
Yeah, I would expect a bad / corrupted install to fail 100% of the time in whatever scenario triggers the failure. Edit: To clarify, if CHDK were corrupted in a way that caused downloads to fail, I'd expect downloads to fail all the time.

Quote
If I get a chance tonight I'll do a bit of research on usb stall handling and see if I can come up with a quick TL;DR for you. It might be completely useless to you but at the very least I might learn something.
I really need to spend time with it to do anything useful, but if your interested

Background: https://wiki.osdev.org/Universal_Serial_Bus

Things I need to understand:
1) What the "proper" response is for a host
2) How the relevant state and operations are exposed in libusb-0.1
3) Whether action is also required on the device side
4) What diagnostic information is available when an IO error is reported
5) Where the to capture it so it can be exposed in chdkptp error handling

There is some related code in chdkptp, inherited from ptpcam but not hooked up  https://app.assembla.com/spaces/chdkptp/subversion/source/815/trunk/chdkptp.c#ln560

usb_clear_stall_feature is used in reset_device.

I had actually forgotten about this but you can call chdk.reset_device() in chdkptp. It expects a devspec device/bus table to identify the connection, not a connection object, so you would use something like
Code: [Select]
!chdk.reset_device(con.condev)
where "con" is the connection of the camera you want to reset. This should probably clear the IO error state.
Don't forget what the H stands for.

Re: CHDKPTP File Downloading
« Reply #52 on: 25 / January / 2018, 11:46:40 »
Quote
where "con" is the connection of the camera you want to reset.
And if I want to reset all of them?

*

Offline reyalp

  • ******
  • 11090
Re: CHDKPTP File Downloading
« Reply #53 on: 25 / January / 2018, 13:03:52 »
Quote
where "con" is the connection of the camera you want to reset.
And if I want to reset all of them?
In mulitcam, the usual
Code: [Select]
for lcon in mc:icams() do
 chdk.reset_device(lcon.condev)
end
Don't forget what the H stands for.


*

Offline reyalp

  • ******
  • 11090
Re: CHDKPTP File Downloading
« Reply #54 on: 28 / January / 2018, 23:08:16 »
I had forgotten that chdkptp con:disconnect() implicitly does a reset.

reset_device on a connected connection ends up in a weird state, (usb_close is called, but the PTP session is not explicitly ended and chkdptp thinks it's still open) so rather than calling reset_device, I'd suggest calling con:disconnect()

In chdkptp r830 I added mc:disconnect(), which disconnects all selected cameras, and mc:reconnect(), which disconnects an then connects all selected cameras.

Note r831 changed the output format of mc:connect() and listing functions. In previous version, the bus and device identifiers were swapped, so it would output b=<device id> d=<bus id>. It now outputs b=<bus id> d=<device id> like it was supposed to. This could matter if you were parsing the output.
Don't forget what the H stands for.

Re: CHDKPTP File Downloading
« Reply #55 on: 01 / February / 2018, 16:28:58 »
Awesome, thanks for all your help. Things seem to be working smoothly on the CHDKPTP side, but once I bring my pictures into my photogrammetry software things start to fall apart.

I've gotten a few really good models, but 4/5 times I can hardly get anything. I'm fairly certain the problem is sync, I haven't gotten around to building a switch yet and I am trying to take pictures of people here. I have some designs ready but I wanted to run them by you first to make sure there are no glaring issues.

So I made a diagram of the USB hubs I'm using, I've never had to make any sort of electrical plan that other people actually have to understand so I apologize if my formatting is wrong/unconventional.

And from the outside


So my original plan was to just run a single wire between all six hubs with a switch on it

But as you can probably tell there are many problems with this idea. The biggest of which is that each hub needs to be individually powered to prevent overloading of the usb power lines.


Now before I go any further I want to clarify that I'm by no means experienced with electrical engineering, don't let my use of a couple circuit symbols deceive you. I mostly just tinker and experiment at the moment. I'd love to learn more but I need some social studies credits so until I finish econ I'll have to remain a novice.

From what I know what I'm about to describe to you just sounds like a transistor, but I don't trust what I know in the slightest and I fear I might be overlooking a critical factor. I'd like to run a DC line between my six hubs with a momentary SPST switch on the negative (or positive, I just assumed switching the negative would provide better sync) so when I cut power to the "switch line" it switches all the hubs off.

(I know I should have technically used this symbol for the switch on that last picture but whatever)

What are your thoughts?

Re: CHDKPTP File Downloading
« Reply #56 on: 09 / February / 2018, 16:48:19 »
So I'm trying to figure out how to adjust exposure values on the cameras but I'm really confused. I set the exposure time override using
Code: [Select]
.set_user_tv96(638)and when I call
Code: [Select]
.print(get_user_tv96())it tells me it's set to 640 (I assume its rounded) so I know the value is set, but when I take a picture it just auto-adjusts it anyway. I can use
Code: [Select]
.set_aelock(1)but then it just stays at whatever the auto exposure set it to earlier.

In the scripting cross reference it says overrides only work in M mode, which I'm guessing is manual, but I cant find anything on switching to M mode.

*

Offline reyalp

  • ******
  • 11090
Re: CHDKPTP File Downloading
« Reply #57 on: 09 / February / 2018, 23:44:10 »
So I'm trying to figure out how to adjust exposure values on the cameras but I'm really confused. I set the exposure time override using
Code: [Select]
.set_user_tv96(638)
From the '.' I guess you are doing this with just one camera? If you are using multicam, you should use mc:cmd('call ...').
If you want to set different exposure on different cameras in the rig, you could select them.
Quote
In the scripting cross reference it says overrides only work in M mode, which I'm guessing is manual, but I cant find anything on switching to M mode.
set_user_tv96 only works in modes where the canon firmware would let you set the shutter speed manually (usually M, Tv and Long Shutter). Your cameras may not have any such mode.

CHDK overrides in general do not require manual mode. You can use set_tv96 or set_tv96_direct to set the shutter speed for the next shot in other modes.

However, most CHDK script overrides only apply to the next half press within the same script. Each '.' or '=' command runs a new script, so
Code: [Select]
=set_tv96_direct(638)
=shoot()
does not apply the shutter override to the shoot. To do that, it must all be in one script, like
Code: [Select]
=set_tv96_direct(638) shoot()

In the case of multicam, the camera side script is started by mc:start() runs until you send the exit command, so you can use mc:cmd('call set_tv96_direct(638)') and have it apply to a the next shoot.

An alternate way to set overrides that aren't lost between script invocations is to use set_config_value to set CHDK menu overrides. These apply until you change them, but are considerably less convenient to work with.
Don't forget what the H stands for.


Re: CHDKPTP File Downloading
« Reply #58 on: 10 / February / 2018, 12:43:07 »
So I'm trying to figure out how to adjust exposure values on the cameras but I'm really confused. I set the exposure time override using
Code: [Select]
.set_user_tv96(638)
From the '.' I guess you are doing this with just one camera? If you are using multicam, you should use mc:cmd('call ...').
If you want to set different exposure on different cameras in the rig, you could select them.
Quote
In the scripting cross reference it says overrides only work in M mode, which I'm guessing is manual, but I cant find anything on switching to M mode.
set_user_tv96 only works in modes where the canon firmware would let you set the shutter speed manually (usually M, Tv and Long Shutter). Your cameras may not have any such mode.

CHDK overrides in general do not require manual mode. You can use set_tv96 or set_tv96_direct to set the shutter speed for the next shot in other modes.

However, most CHDK script overrides only apply to the next half press within the same script. Each '.' or '=' command runs a new script, so
Code: [Select]
=set_tv96_direct(638)
=shoot()
does not apply the shutter override to the shoot. To do that, it must all be in one script, like
Code: [Select]
=set_tv96_direct(638) shoot()

In the case of multicam, the camera side script is started by mc:start() runs until you send the exit command, so you can use mc:cmd('call set_tv96_direct(638)') and have it apply to a the next shoot.

An alternate way to set overrides that aren't lost between script invocations is to use set_config_value to set CHDK menu overrides. These apply until you change them, but are considerably less convenient to work with.

Okay awesome, that works well. Unfortunately adjusting the f-stop doesn't seem to follow the same rules. I assume I have to set it to aperture preferred (I make a lot of assumptions) and I thought I saw a command to do that a while ago but now I can't find it.

Apparently you can't change the f-stop on A3400s :/

Also I'd like to ask you a couple personal questions if you don't mind. These same questions apply to waterwingz if he ever sees this.

What do you do for a living?

What programs have you worked on in the past?

What did you use to create the GUI for chdkptp?

What coding languages do you know besides lua and ubasic?

Have you ever done/been interested in creative writing?

These aren't for work purposes, although I know my boss would hire you in a heartbeat if you're a contractor/looking for a job. Also we're still a very small startup so the pay wouldn't be great.

I'm asking you these questions out of personal curiosity, and also because I'm working on a side project which requires a good bit of programming and I'm thinking about getting a team together to work on it. It might just be a little open source thing to do on the side and it's still in its infancy but I'd like to have a team in mind.

*

Offline reyalp

  • ******
  • 11090
Re: CHDKPTP File Downloading
« Reply #59 on: 10 / February / 2018, 19:41:58 »
Apparently you can't change the f-stop on A3400s :/
Correct, cameras like this do not have an adjustable aperture. They do have an ND filter. See http://chdk.wikia.com/wiki/CameraFeatureTable for a list of which cameras have what. In script, you can use http://chdk.wikia.com/wiki/Script_commands#get_nd_present (despite the name, it also tells you if there's an iris)

Quote
Also I'd like to ask you a couple personal questions if you don't mind.
I'd rather not get into stuff that isn't directly related to CHDK here.

Quote
What did you use to create the GUI for chdkptp?
It's just Lua code using the IUP library. There's no GUI builder or anything like that involved, what you see in the chdkptp source is everything.

Quote
It might just be a little open source thing to do on the side and it's still in its infancy but I'd like to have a team in mind.
You're welcome to post about CHDK / photography relevant open source projects here. Personally, I don't have enough to time for the stuff I want to do in CHDK and chdkptp, so it's unlikely that I'd commit to another.
Don't forget what the H stands for.

 

Related Topics