- Windows, Linux or macOS
- The
gphoto2command (sudo apt-get install gphoto2, also available onbrew) - A writable SD card in the SD slot
I made this guide based on Windows 11 / WSL2. macOS is untested.
The 5DM4 has a USB connection available. The cable provided with the camera will work best, but if you no longer have it you can use a micro USB cable just fine. I assume the smaller portion of the USB connector on the camera body is used to provide power, not data.
My Windows recognized the device and connected it right away.
Run usbipd list
PS C:\Users\%user%> usbipd list
Connected:
BUSID VID:PID DEVICE STATE
...
1-5 <hex>:<hex> Canon EOS 5D Mark IV Not shared
...
Persisted:
GUID DEVICEThe output should show you a list of connected USB devices. My camera was initially Not shared.
Run usbipd attach -b 1-5 --wsl
usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address <ip> to reach the host.Now the camera should be available on WSL.
Run gphoto2 --auto-detect
Model Port
----------------------------------------------------------
Canon EOS 5D Mark IV usb:001,009Run sudo gphoto2 --summary
Camera summary:
Manufacturer: Canon.Inc
Model: Canon EOS 5D Mark IV
...
tons of properties
...For some reason, some of gphoto2 subcommands required elevated permissions on my WSL Ubuntu install, your mileage may vary. I could not be bothered with finding out why.
Run sudo gphoto2 --debug --debug-logfile=before.log --list-config
This should output a log file in the current directory. The log file is full of hexadecimal byte code and hopefully, somewhere your shutter speed is set. Now go ahead and make 2-5 photos. I just took them with my lens cap on. Make sure you remember or write down the amount of photos you took, this is important later on.
Tip: I first took the photos without a writeable SD card, doing this however obfuscates the shutter count in the log file.
Turn your camera off, this gives the camera time to write a new log file. I had to wait until the sensor cleaning was done, the Windows USB disconnection sound rang and the screen on the camera turned off.
Turn your camera on and go through the connection processs again. Make sure to reattach the device to WSL if you are on Windows.
Run sudo gphoto2 --debug --debug-logfile=after.log --list-config
Now open the files and compare the two. Try to find a hexadecimal value that changed exactly with the amount of photos you took.
For me personally, it was on line 1548, at offset 0x01d0 or just 01d0. I have that offset in my file several times, but this one specifically showed a change in hexadecimal that is equal to the amount of photos I took.
Before: 01d0 00 00 00 00 00 00 00 00-00 00 00 00 07 01 22 0b ..............".
I took 2 pictures...
After: 01d0 00 00 00 00 00 00 00 00-00 00 00 00 07 01 22 0d ..............".
d - b = 2. I assume this equals to a shutter count of 01 22 0d, which reads as 74253 in decimal.
I sincerely hope the 07 is not part of the number ;)
Good luck!