[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gp_camera_file_read vs. gp_camera_file_get #101

Open
peterbud opened this issue Oct 15, 2016 · 5 comments
Open

gp_camera_file_read vs. gp_camera_file_get #101

peterbud opened this issue Oct 15, 2016 · 5 comments
Assignees

Comments

@peterbud
Copy link
Contributor
peterbud commented Oct 15, 2016

I was using the sample program sample-capture and sample-trigger-capture, and found the following on my Windows port:

  • call to function gp_camera_file_get used in sample-capture WORKS, captures 2 images (both way) without any problem
  • call to function gp_camera_file_read used in sample-trigger-capture with the same camera and setting FAILS. As far as I can debug, gp_camera_file_read calls gp_filesystem_read_file, which then calls read_file_func. This one impleneted in ptp2/libary.c, and has a define for folder_to_storage, which expects that the folder paramter should have the name like "/store_xxxxxxxxx/"

Question: is this really a necessary check? Why then the gp_camera_file_get works perfectly?

Sorry if the question is stupid, I have started getting familiar with the library only recently.

@romainreignier
Copy link
Contributor

I have faced the same issue.
I wanted to avoid the unnecessary write/delete operation on host filesystem.
But I have figured out that the function gp_camera_file_read is never used in the libgphoto2 and gphoto2.

@romainreignier
Copy link
Contributor

In my case, for a Sony PTP camera, the path->folder value is overridden in the capture function here:

sprintf (path->folder,"/");

So the check in folder_to_storage cannot be valid.

@romainreignier
Copy link
Contributor

Removing the folder_to_storage check does not help, the function fail later because the file is not found.
Because the gp_camera_file_read is never called I doubt it will work out of the box for ptp camera.
@msmeissn what do you think about it?

@msmeissn msmeissn self-assigned this Dec 27, 2018
@msmeissn
Copy link
Contributor

Hmm. The gp_camera_file_read does not cover this case, it should check the filesystem backed cached storage here. This is missing. the _read function is not complete :/

But gp_camera_file_get() does not touch the host filesystem, unless you use gp_file_new_from_fd() or so, so you can still use that.

@romainreignier
Copy link
Contributor

Oh! I've missed the point that I can initialize a CameraFile from memory with gp_file_new() and not gp_file_new_from_fd().
Thanks.
Until now, I was creating a temporary file with mkstemp() and then delete it with unlink().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants