Last night I've cleaned up a script that
annotates this kind of logs, printing the property ID and GUI event names for most of the MPU messages.
Noticed a bug: the log files must have Unix-style newlines, otherwise the script won't work well. The logs from here seem to be with Windows-style newlines.
Tried to diff the CR2 logs, but LiveView is way too noisy. Please capture the same info with call("Release") somewhere at startup, without entering LiveView. For example, with CONFIG_DEBUG_INTERCEPT_STARTUP, locate the 20-second blinks that indicate the experiment is running:
#ifdef CONFIG_DEBUG_INTERCEPT_STARTUP
info_led_blink(20,500,500);
debug_intercept();
#endif
and change to:
#ifdef CONFIG_DEBUG_INTERCEPT_STARTUP
info_led_blink(10,500,500);
beep();
DryosDebugMsg(0, 0, "*** Attempting to take a picture...");
call("Release");
info_led_blink(10,500,500);
debug_intercept();
#endif
What I could tell from the two CR2 logs was that both logs have the SW1 (half-shutter) event, but only one has SW2 (full shutter press or capture start, an event initiated by the MPU).
cr2-nobug-vs-bug.html (too noisy)
Diff'ed the two startup logs:
startup-nobug-vs-bug.html- 02 12 is a
group of properties related to lens (sent by MPU to main CPU)
- 09 2e is some property related to LiveView (sent by MPU to main CPU); seems to arrive with some delay (edit: 80050045 PROP_LV_FOCAL_DISTANCE)
- PROP_AVAIL_SHOT: likely given by free space on the card (it's sent by main CPU to MPU)
- PROP_POWER_KIND appears in a different order (multitasking during EOS startup - PowerShot firmware doesn't do that)
- 03 25: no idea, also out of order
- 02 15 is PROP_LENS
- 06 05 06 12 00 00 is some
unidentified GUI event (GUICMD_CLOSE_SLOT_COVER)
Note: both startup logs were created with:
StartupCondition : 4, 0:
StartupCondition : 4, 0 = on/off/on trick that somehow kills the shutter-bug
Shouldn't they be created with this one instead?
StartupCondition : 16, 0 = camera powered on via the Play button
The above logs can be used in QEMU.
1) convert them with
extract_init_spells.pypython extract_init_spells.py EOSM-start-bug-a.log > EOSM-bug.h
python extract_init_spells.py EOSM-start-nobug-a.log > EOSM-nobug.h
That way, I can switch between the two by renaming the header used in mpu.c .
This will allow comparing the different properties and figuring out what they might be.
2) run ML and try to print the contents of PROP_LENS, for example:
PROP_HANDLER(PROP_LENS)
{
uint8_t* info = (uint8_t *) buf;
qprintf("PROP_LENS: ");
for (int i = 0; i < len; i++)
{
qprintf("%02x ", info[i]);
}
qprintf("\n");
...
(./run_canon_fw.sh EOSM,firmware="boot=1" -s -S & arm-none-eabi-gdb -x EOSM/patches.gdb) |& grep -a PROP_LENS
# good
[MPU] Sending : 20 1f 03 24 45 46 2d 4d 31 31 2d 32 32 6d 6d 20 66 2f 34 2d 35 2e 36 20 49 53 20 53 54 4d 00 00 (PROP_LENS_NAME)
[MPU] Sending : 24 23 03 15 01 2a 52 10 33 00 0b 00 16 90 53 9a 7c 08 ff 00 00 00 00 00 00 00 00 49 04 01 00 00 37 2a 01 00 (PROP_LENS)
[MPU] Sending : 24 23 03 15 01 2a 52 10 33 00 0b 00 16 90 53 9a 7c 08 ff 00 00 00 00 00 00 00 00 49 04 01 00 00 37 2a 01 00 (PROP_LENS)
PROP_LENS: 01 2a 52 10 33 00 0b 00 16 90 53 9a 7c 08 ff 00 00 00 00 00 00 00 00 49 04 01 00 00 37 2a 01
# bad
[MPU] Sending : 20 1f 03 24 45 46 2d 4d 31 31 2d 32 32 6d 6d 20 66 2f 34 2d 35 2e 36 20 49 53 20 53 54 4d 00 00 (PROP_LENS_NAME)
[MPU] Sending : 24 23 03 15 01 28 50 10 33 00 0b 00 16 90 53 9a 7c 08 ff 00 00 00 00 00 00 00 00 49 04 01 00 00 37 29 01 00 (PROP_LENS)
[MPU] Sending : 24 23 03 15 01 28 50 10 33 00 0b 00 16 90 53 9a 7c 08 ff 00 00 00 00 00 00 00 00 49 04 01 00 00 37 29 01 00 (PROP_LENS)
PROP_LENS: 01 28 50 10 33 00 0b 00 16 90 53 9a 7c 08 ff 00 00 00 00 00 00 00 00 49 04 01 00 00 37 29 01
The two differences are raw_aperture_min and raw_aperture_max (f4.3-f24 vs f4-f22). Likely different focal length - that one is taken from PROP_LV_LENS. Though, in QEMU, using the startup logs only, focal length is reported as 1408 (ignored by ML).
Focal length is reported in LiveView, in the CR2 logs, but there are a couple of different values (showing the lens was probably zoomed in and out during the experiment).
3) Try to identify
properties from unknown MPU messages:
# properties
if 1
b *0xFF11FB04
prop_request_change_log
b *0xFF31F6F0
mpu_analyze_recv_data_log
b *0xFF31CE8C
prop_lookup_maybe_log
b *0xFF325994
mpu_prop_lookup_log
end
4) ... ??
StartupCondition is a property that comes from the MPU:
*** mpu_recv(06 05 03 20 04 00), from 1dedc ; PROP_STARTUP_CONDITION
Can be easily faked on the main CPU side. Guess: maybe it skips sensor cleaning if camera is powered often?
# edit PROP_STARTUP_CONDITION in mpu_spells/EOSM.h (values: 0x01, 0x04, 0x10)
# we need -icount for deterministic emulation (so the stuff that appears in logs will be in the same order)
(./run_canon_fw.sh EOSM,firmware="boot=1" -s -S -d debugmsg -icount 5 & arm-none-eabi-gdb -x EOSM/patches.gdb) &> startup-condition-01
(./run_canon_fw.sh EOSM,firmware="boot=1" -s -S -d debugmsg -icount 5 & arm-none-eabi-gdb -x EOSM/patches.gdb) &> startup-condition-04
(./run_canon_fw.sh EOSM,firmware="boot=1" -s -S -d debugmsg -icount 5 & arm-none-eabi-gdb -x EOSM/patches.gdb) &> startup-condition-10
startup-condition-01-vs-04.html (looks like - START_AS_CHECK is sensor cleaning)
startup-condition-01-vs-10.html (16 decimal)
Long shot: what if you disable sensor cleaning?
Some more tests I'd like to run:
1) to exclude differences in SD card contents (including, but not limited to, card size):
- prepare the smaller SD card out of these two (format, make bootable, copy logging code)
- create a card image (dd if=/dev/sdcard of=sd.img bs=1M)
- copy the image to the large card (dd if=sd.img of=/dev/sdcard bs=1M)
- run the logging experiment from both cards (starting with the same initial conditions)
2) to exclude timing differences while loading autoexec.bin:
- compile with CONFIG_MARK_UNUSED_MEMORY_AT_STARTUP
- this will slow down the boot process by a few seconds
- the slowdown happens before the MPU is initialized (06 04 02 00 00)
- it's likely some times larger than any timing difference caused by different card speeds
- I should probably think of a way to get repeatable timings (maybe by delaying certain debug messages until some preset value)
3) can the bug be reproduced without autofcus? (if yes, turn it off)