Commit Graph

12476 Commits

Author SHA1 Message Date
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
axxel
d75762e0d8 ptp2: remove unused function ptp_have_event 2024-09-25 11:47:21 +02:00
axxel
f4e853a6fc ptp2: building with LIBXML2, olympus-wrap.c does need #include "ptp-pack.c" 2024-09-25 11:47:21 +02:00
axxel
5f2f383926 ptp2: remove unused PTPDeviceProperty::value member
The current value of the device property is only stored in the
desc.CurrentValue field.
2024-09-25 11:47:21 +02:00
axxel
8a2c257ce4 ptp2: remove PTPCanon_Propery::proptype member
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.
2024-09-25 11:47:21 +02:00
axxel
d0c91fd99e ptp2: rename ptp_unpack_... functions for Canon events
Make the names more consistent and expressive.
2024-09-25 11:47:21 +02:00
axxel
f91442f5cc ptp2: remove unused PTPCanon_Property members size and data
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.
2024-09-25 11:47:21 +02:00
axxel
4b3cd2452d ptp2: fix -Wsign-compare compiler warning in chdk.c 2024-09-25 11:47:21 +02:00
axxel
2c36303fdf ptp_pack.c: harmonize PTP_EC_CANON_EOS_PropValueChanged indentation
Layout this one case block just like the other ones. This is basically a
whitespace only change.
2024-09-25 11:47:21 +02:00
axxel
19a03c3c9e remove 7 unnecessary #include "ptp-pack.c" statements
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.
2024-09-25 11:47:21 +02:00
axxel
910f0d9f75 introduce helper macros for automatic offset increment after dtoh
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.
2024-09-24 16:44:26 +02:00
axxel
05920762e4 improve API of ptp_unpack_string and ptp_unpack_uint[16|32]_array
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.
2024-09-24 16:44:26 +02:00
axxel
db4320a092 ptp2: trivial code cosmetic, mostly whitespace in switch() blocks 2024-09-23 17:29:35 +02:00
axxel
2b24e3716f fix olcsizes table entry for 5Ds
See discussion in #1020 for details.
2024-09-23 17:29:35 +02:00
axxel
e9a88c7974 summary: fix embarrassing bug in recent commit (broke %x output) 2024-09-23 17:29:35 +02:00
axxel
c5a5644035 summary: fix accidental ')' misplacement in recent commit 2024-09-23 14:23:40 +02:00
axxel
baa817cca9 summary: tune table layout of properties some more
e.g.:

Device Property Summary:
Model ID                  (d049 ro u32): 2147484546
Friendly Device Name      (d402 ro str): 'Canon EOS 5DS'
Perceived Device Type     (d407 ro u32): 1
Session Initiator Info    (d406 rw str): 'Unknown Initiator'
2024-09-23 14:23:40 +02:00
axxel
62f50604ab Canon cameras may also use MTP vendor extension codes (0xd4..)
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'
2024-09-23 14:23:40 +02:00
axxel
f5e51fd63b summary: add info about Canon vendor extension properties
They only show up if the camera is in capturemode=on, see #1024.
2024-09-23 14:23:40 +02:00
axxel
95dc8815fd improve logging output for EOS_AutoPowerOff and EOS_ShutterReleaseCounter 2024-09-23 14:23:40 +02:00
axxel
6177718525 ptp_unpack_CANON_changes: fix bug in bounds checking code 2024-09-23 14:23:40 +02:00
axxel
4d6f9b664d ptp_generic_getdevicepropdesc: remove code duplication 2024-09-23 14:23:40 +02:00
axxel
08dca93f53 summary: layout property summary in a more table based look
Also represent type as human readable string instead of hex code and
drop the 0x prefix in the hex-representation of the property id. Example:

```
Device Property Summary:
[...]
SerialNumber      (d1af): (ro str) '153022001713'
Artist            (d1d0): (rw str) ''
Copyright         (d1d1): (rw str) ''
AEB               (d1d9): (rw u16) Enumeration [0,3,5,8,11,13,16,19, ...
LvAfSystem        (d1ba): (ro u32) Enumeration [10,1,5,6,11,12,13,14]...
MovieParam5       (d20d): (rw ???) Enumeration [] value: Undefined
```
2024-09-23 14:23:40 +02:00
axxel
b3aa6fc607 ptp2: shorten 3 overly long EOS property names (remove "Setting" substr) 2024-09-23 14:23:40 +02:00
Hans Ulrich Niedermann
18b910932b m4: fix output alignment in gettext domain check
Increase the field width from 7 to 8 characters just like
the other AM_V_* messages.

Also use MAKE_TIME_DOMAIN shell var everywhere.
2024-09-20 23:46:54 +02:00