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
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
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)
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.
The proptype (a.k.a. device property code) is already stored in
dpd.DevicePropertyCode member. This patch introduces the
ptp_find_eos_devicepropdesc() function for the commonly repeated for-loop
looking for the DevicePropDesc* in the cache.
This now allows to completely replace PTPCanon_Property with
PTPDevicePropDesc and then drop the canon_props array altogether and use
the generic one.
PTPDeviceProperty data of EOS cameras is not polled but rather pro-actively
sent by the camera via a PropValueChanged event. The unpack function used
to interpret the data and unpack it into the PTPDevicePropDesc struct
but also copied the raw event data block into an extra member (data, size)
of the special special PTPCanon_Property struct. This data is then never
looked at again.
This patch removes those data members and is a first step to completely
eliminate the special PTPCanon_Property struct.
Move the byte-order-swapping helpers from ptp-pack.c to ptp.h as well as 2
ptp_free_deviceinfo variants and remove all but one ptp-pack.c inclusions.
This speeds up compile time and removes lots of compiler warning
repetitions if one shows up in ptp-pack.c.
The idea is to remove 'manual' offset adjustments:
```
unsigned offset = 0;
unsigned val = dtoh32o(data, offset);
// offset is now 4
```
Also contains some code beautification near the use of dtoh style macros.
Those functions get passed an offset value into the data buffer. This
offset value needed to be updated on the calling side after the call with
internal knowledge of what exactly the unpack function itself was doing.
Now the offset becomes an in/out parameter and in updated internally. This
substantially reduces the complexity of the calling code.
Furthermore, the return value is now an error indicator and the array
length gets set via a pointer.
This further fixes a few places where there was a bug in the bounds
checking or no bounds checking at all.
E.g. the 5Ds:
Friendly Device Name (d402): (ro str) 'Canon EOS 5DS'
Perceived Device Type (d407): (ro u32) 1
Session Initiator Info (d406): (rw str) 'Unknown Initiator'