Commit Graph

12500 Commits

Author SHA1 Message Date
axxel
63dc01effb ptp2: use calloc to zero-initialize CameraFilePath objects 2024-10-10 20:13:07 +02:00
axxel
3696ba9594 ptp2: disable some unused canon functions 2024-10-10 20:13:07 +02:00
axxel
b67ac166ad ptp2: replace (most) oid/object_id symbols with handle
See last commit for reasoning of choosing this terminology.

TLDR: consistency spec / other API
2024-10-10 20:13:07 +02:00
axxel
381243104c ptp2: move 'oid' variable into PTPObjectInfo as (Object) 'Handle'
The (Object) Handle member is not part of the "ObjectInfo dataset" in the
specification but added here to avoid having to carry it around by
separate means throughout the code base, as it is regularly required in
combination. While the spec always refers to this item as "ObjectHandle",
the term "Handle" is only used in this context, so we omit the
"Object"-prefix for brevity.

Switching from oid/ObjectID, which is nowere to be found the spec,
increases consistency with the spec and the rest of the code base.

This allows to remove the struct _PTPCanon_New_Object from the codebase.

@msmeissn I added 2 TODO comments for you take a close look, pointing out:
 * a memory leak that I did not want to touch because I can't test it
 * a presumed bug fix where newobject was 0 when passed to ptp_getobject
2024-10-10 20:13:07 +02:00
Marcus Meissner
48e4b4910d rename event -> canonevent to avoid shadow variable warning 2024-10-09 10:10:36 +02:00
Marcus Meissner
f7b97ab75f added fuji gfx100 ii 2024-10-09 10:08:06 +02:00
Marcus Meissner
2231d211bb updated NEWS 2024-10-09 09:20:54 +02:00
axxel
0720269772 ptp2: rename PTPParams::uilocked -> eos_uilocked to make scope clearer 2024-10-08 09:47:44 +02:00
axxel
2eed98a494 ptp2: comment out currently unused MTPObjectFormat 2024-10-08 09:47:44 +02:00
axxel
af6cc96530 ptp2: rename MTPProperties struct and members...
... to be consistent with specification and also with the names of
similar symbols in the rest of the code.
2024-10-08 09:47:44 +02:00
axxel
eef6369669 ptp2: replace nrofsomearray pattern with somearray_len pattern
The "_len"-suffix to denote the length of an array of values is more
readable than the "nrof"-prefix and also used 3 times more often in the
rest of the code base.

Also replace the params->deviceproperties name with params->dpd_cache to
make it clearer what it actually is: an array of cached DevicePropDesc
structs.
2024-10-08 09:47:44 +02:00
axxel
8863c68c05 ptp2: replace "sizeof(a) / sizeof(a[0])"-pattern with ARRAYSIZE() macro 2024-10-08 09:47:44 +02:00
axxel
47b8f612e5 ptp2: drop the "Supported" string in some PTPDeviceInfo members
The PTPDeviceInfo struct contains information about the Operations, Events,
DeviceProperties, ImageFormats and CaptureFormats. With 3 of those 5 the
variables contained the additional "Supported" string, which does not add
any discriminating value and only makes for very long and therefore less
readable code lines and it is inconsistent.

Also use the term "DeviceProps" here as well for brevity and consistency.
2024-10-08 09:47:44 +02:00
axxel
06b7643b8d ptp2: rename DevicePropertyCode -> DevicePropCode for consistency 2024-10-08 09:47:44 +02:00
axxel
873185f734 ptp2: rename ObjectPropertyCode -> ObjectPropCode for consistency 2024-10-08 09:47:44 +02:00
axxel
4550a87355 ptp2: rename PTPPropertyValue to PTPPropValue for consistency
There are lots of other symbols like GetDevicePropValue that use the short
version "PropValue" already. Also the variables of this type are also most
often called "propval".
2024-10-08 09:47:44 +02:00
axxel
0a06af0e1d ptp2: rename (Object|Thumb)CompressedSize -> (Object|Thumb)Size
The terms ObjectCompressedSize and ThumbCompressedSize come from the PTP
specification. But I find them to be overly verbose because there is no
other size than this "compressed" size.

Other places like the CameraFileInfoFile struct also use the term "size"
instead of "compressed_size" for the same thing.
2024-10-08 09:47:44 +02:00
axxel
9bf1d49a4b ptp2: rename Maximum/MinimumValue -> Max/MinValue for better readability 2024-10-08 09:47:44 +02:00
axxel
8f19f80178 ptp2: rename FactoryDefaultValue -> DefaultValue for better readability 2024-10-08 09:47:44 +02:00
axxel
a0c45bd4e3 ptp: tune EOS_FocusInfoEx, FocusInfo event related code
With the re-enabled FocusInfoEx, the 5Ds spams the log and the
--wait-event console output with a 64 entry long focus info list.
Assuming no tooling is dependent on the particular string format of the
FocusInfoEx value, since it seems to only ever contain a no-empty
set of selected AF-points at the beginning of the capture process, where
the event is 'swollowed' by the focus detection code. This changeset
strips it down to only contain the list of selected AF-points, meaning
without focus, we now get a simple "{}".

Furthermore, the olcmask 0x0100 (FocusInfo) data of the 5Ds, R8 and R5m2
has been analyzed and the in-focus detection code during trigger_capture
has been improved. See code comments for details.
2024-10-07 09:13:10 +02:00
axxel
ee446cb940 ptp2: fix ptp_unpack_EOS_FocusInfoEx
I believe this was broken since
99dceba032

With my 5Ds the datasize and size are always equal (which is how I would
expect it to be). Hence I always got a "bad size" value back.
2024-10-07 09:13:10 +02:00
Hans Ulrich Niedermann
415496f63e README.Sony: Add inferred year 2024 to content
Add the year 2024 to the content of README.Sony which can be
inferred from the original commit date of the README.Sony file.
2024-10-06 12:57:52 +02:00
Hans Ulrich Niedermann
0673db0fa3 Makefile cleanups
Makefile cleanups:

  * sipix/blink.c is already in _SOURCES, no need for EXTRA_DIST
  * Formatting fix for quicktake Makefile
  * Formatting fix for largan lmini Makefile
2024-10-06 11:47:31 +02:00
axxel
95c65146d1 ptp2: print human readable EOS event names in log
new function ptp_get_eos_event_name()
2024-10-02 13:47:30 +02:00
axxel
4fd7b94a99 ptp2: fix focus info/mask event handling regression
This was introduced here:
6df6fbb1d8 (diff-95f258520332f90be210420cbdb44baad50e8d6b2bcf4c15a4f3dc7293a84838L2790-R2773)
2024-10-02 13:47:30 +02:00
axxel
2bb5920c02 ptp2: Canon EOS event handling naming improvements
The EOS event handling code was partly using the term "change_entry" or
"entry" when referring to an event. I found this unnecessarily confusing.

This is mostly a symbol rename patch:
 * PTPCanon_changes_entry -> PTPCanonEOSEvent
 * PTP_CANON_EOS_CHANGES_TYPE_* -> PTP_EOSEvent_*
 * entry -> event
 * backlogentries -> eos_events
 * type -> ec (event code)
 * proptype -> dpc (device property code)
 * a few more ptp_unpack internal offset constants renamed
2024-10-02 13:47:30 +02:00
Marcus Meissner
29459d1e94 added new EOS command codes and event codes
https://github.com/gphoto/libgphoto2/issues/1028
2024-10-02 11:41:23 +02:00
Marcus Meissner
c07a7c1c20 config: set default value to a string only if we have a string widget (AFL) 2024-10-01 20:04:33 +02:00
Marcus Meissner
c760c460eb more debugoutput 2024-10-01 11:51:19 +02:00
Marcus Meissner
8b8c81c205 added NULL check for params->deviceinfo.Model (afl) 2024-10-01 11:25:27 +02:00
Marcus Meissner
9c026d6602 init some variables, as they are reported uninitialized in some paths via afl 2024-10-01 11:19:16 +02:00
axxel
cedc2507e5 ptp2: add EOS event code/type info and make sure every events is logged
This shall help with comparing the event log with USB packet traces. Also
tune the layout to accommodate the new info.

example log:

event 635:c18a: prop d175 options changed, type 3, count  1 (EOS_NetworkCommunicationMode)
                prop d175 option[ 0] == 0x00
event 636:c18a: prop d244 options changed, type 3, count  3 ((null)) (unknown)
event 637:c1a4: CTGInfoCheckComplete 0x00020001
event 638:c19d: unhandled EOS event PowerZoomInfoChanged (size 12)
         0x000:  -  -  -  -
event 639:c1a5: OLCInfoChanged (size 100, version 0x14, mask 0x1fff)
         0x000: 60  -  -  - ff 1f  -  - 01  - 01 01  - a0  - 10
         0x010:  - 68  - 01 03  - 50  - 20  - 38  - 01 01  -  -
         0x020: 78 28  - 04 01 06 41  -  -  -  -  -  - 01 01  -
         0x030:  -  -  -  -  -  -  - 01  -  -  -  -  -  -  -  -
         0x040:  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
         0x050:  -  -  -  -  -  -  -  -  -  -  -  -
event 639:0001: (olcmask) 2 bytes: 01 00
event 640:0002: (olcmask) 9 bytes: 01 01 00 a0 00 10 00 68 00
event 641:0004: (olcmask) 9 bytes: 01 03 00 50 00 20 00 38 00
event 642:0008: (olcmask) 7 bytes: 01 01 00 00 78 28 00
2024-10-01 09:47:28 +02:00
axxel
ad66ce639b ptp_unpack_EOS_events: fix "BAD: i vs entries" situations
Properly count the number of events, such that amount allocated fits with
amount required. Warn if a mismatch happens.
2024-10-01 09:47:28 +02:00
axxel
64e26132ce ptp2 log: remove the list of "missed EOS ptp type" lines in camera_exit 2024-10-01 09:47:28 +02:00
axxel
9e9b149ddc ptp2: work around an apparent firmware bug in the R5m2 causing it to hang 2024-10-01 09:47:28 +02:00
Marcus Meissner
56885c02c8 added GoPro Max https://github.com/libmtp/libmtp/issues/225 2024-09-30 10:49:43 +02:00
Marcus Meissner
b966ca50d2 added missing header 2024-09-29 13:34:17 +02:00
Marcus Meissner
2956dc945b handle Nikon D3x capture function detection better
https://github.com/gphoto/gphoto2/issues/635#issuecomment-2373279482
2024-09-29 13:26:25 +02:00
Marcus Meissner
4f1b3d46f8 add a null check to avoid NULL ptr deref (AFL) 2024-09-29 11:22:28 +02:00
axxel
67e47ef4d6 ptp2: update a few OLC related comments 2024-09-29 11:09:31 +02:00
axxel
4952b37efb ptp2: make ptp_debug_data output easier to parse at a glance
* replace "00 " with " - "
 * don't repeat lines with all zeros

e.g.:
```
event 146: EOS prop d212 value changed, size 408 ((null))
    0x000: 0a  -  -  - 01  -  -  -  -  -  -  -  -  -  -  -
    0x010:  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
    [...]:
    0x190:  -  -  -  -  -  -  -  -
```
2024-09-29 11:09:31 +02:00
axxel
5b70cdf6dc remove lots of "discarding event type" lines from the debug log
200 lines of "discarding event type %d" on capture_image in the log is not
helpful. Replace with one line "discarding %d EOS events".
2024-09-29 11:09:31 +02:00
Marcus Meissner
57dbf7ed53 fixed NULL ptr deref in sigma fp config handling (afl) 2024-09-27 18:52:53 +02:00
Marcus Meissner
72364f304c added EOS 5rm2 2024-09-27 13:50:08 +02:00
axxel
042c4f3809 new EOS ImageFormat get/set implementation
The current `imageformat` with it's table lookup for every RAW+JPEG
combination became cumbersome to maintain and outdated. This leads to
e.g. lost of unsupported JPEG variants for e.g. the 5Ds, R5m2, 1DX.

The used naming also became inconsistent with the addition of the 1DXm2
labels in 1402f88d1a

This patch adds an (incompatible) new imageformat2 widget as a temporary
test to then hopefully replace the existing imageformat. I expect this new
implementation to fix all "Unknown value" occurrences of all currently
available EOS cameras.

I chose to do away with the verbose and arbitrary labels like
"Smaller Fine JPEG" and instead tried to mimic the strings that are
actually used by the cameras, like 'S2', etc. I added a 'c' for the
higher compression versions, along the lines of 'cRAW'. The 'c' could
also stand for 'coarse' to describe the blocky curve that is used by the
Canons to distinguish between lower and higher Jpeg quality.

Here is some sample output from the 5Ds:
Choice: 5 cM2
Choice: 6 S1
Choice: 7 cS1
Choice: 8 S2
Choice: 9 S3
Choice: 10 RAW + L
Choice: 11 RAW + cL
Choice: 12 RAW + M1
Choice: 13 RAW + cM1
2024-09-27 10:18:39 +02:00
axxel
1874ee28cf ptp2: fix missing JPEG info for RAW+JPEG formats of 1DX and R5m2
This brings my original ptp_unpack_EOS_ImageFormat() documentation
up-to-date with new M1/M2 and new 0/1 compression info added with 5Ds,
1DXm2 and R5m2.

It also fixes the problem that led to a double entry of e.g. `RAW` in the
imageformat config output visible in #1028 and also in the 1DX sample here:
5b7f7c168d/camlibs/ptp2/cameras/canon-eos-1dx.txt (L255-L269)
2024-09-27 10:18:39 +02:00
axxel
02b75096d9 ptp2: use hex format in debug output for GenericTable enum lookups
We use hex format for the same information in other parts of the log file.
2024-09-27 10:18:39 +02:00
axxel
5b7f7c168d ptp2: fix a regression in ptp_get_property_description
Generally looking for MTP prop names when searching for a Canon prop was
the wrong approach. This leads to "Aperture" beeing called "Secure Time".

Instead just copy the 3 MTP prop names actually required into the
Canon prop name list.
2024-09-26 10:06:10 +02:00
axxel
da7dead692 remove code duplication in ptp_check_event 2024-09-25 11:47:21 +02:00
axxel
8d4975f52c ptp2: make ptp_add_event(s) cleaner and more performant 2024-09-25 11:47:21 +02:00