Wednesday, January 08, 2014

Canon shutter count and Linux...

Canon is well known for not allowing easy access to a camera's total shutter click count.  Apparently other manufacturers are not so guarded.  I use Canon cameras, so what to do?


A quick search using the Force (google) revealed several methods.
  • EOS Count is a for (small) pay website
  • EOSInfo is free, but can't report some DSLR shutter counts (including the 7D)
  • Linux + gPhoto2 is an Open Source Software solution that might drive some people nuts
You can probably guess which approach I took.  Yes, it was the Linux + gPhoto2 approach.

To be completely honest, I tried EOSInfo first.  It gave a correct count when I connected a 5D MkII, but it did nothing for a 7D.  This is why I turned to Linux and gPhoto2.

My recipe for getting at the 7D's shutter count and confirming the 5D MkII's shutter count is as follows -
  • MintOS Linux
  • Installed on a 4 gig USB stick using unetbootin
  • HP Pavilion dv7 booted to Linux
  • gPhoto2 installed from a terminal command line "sudo apt-get install gphoto2"
  • USB connect a camera to the computer
  • Turn on the camera
  • Open a terminal to access a command line interface
  • Type "gphoto2 --get-config /main/status/shuttercounter" to read the shutter count

I experienced two wrinkles, both having to do with being unable to lock the port or finding the port in use by another program.  The 7D required the following to work -
  • Terminal command line "ps aux | grep gphoto2"
  • Read the process(es) ID (PID(s)) of anything that says "gvfs gphoto"
  • "kill -9 " of all processes found in the prior command
  • In my case, the "gphoto2 --get-config /main/status/shuttercounter" command then worked
 In the case of the 5D MkII, I needed to do the following -
  • Connect a USB cable between the computer and camera
  • Turn on the 5D MkII
  • Terminal command line "gphoto2 --get-config /main/status/shuttercounter"
Attempting the 7D approach of finding and then killing PIDs related to gPhoto2 when connecting a 5D MkII did nothing but bump the PID by 2.  Go figure.  I'm sure there is plenty of detailed information in the various bug lists for Debian based Linux releases for what's happening or how to properly operate gPhoto2.  I didn't take the time to read any of it after finding my own work around. 

Brute Force and Ignorance (BF&I) rules!

In the end, the 5D MkII reports just a few ticks over 58,000 shutter actuations after five years of very hard use.  The 7D is much more lightly used, reporting just over 17,000 shutter clicks.  The 7D is still a youngster.  Though I heard from a friend yesterday that he knows of an original 12.8mpixel 5D that has over 800,000 shutter releases after having it's shutter mechanism attended to on a regular basis.  So with that in mind, the 5D mkII is also a youngster.

13 comments:

Christopher Mark Perez said...

You're welcome.

I tried to keep is short and sweet, knowing full well there are many side-paths a person can take or traps a person can fall into.

Unknown said...
This comment has been removed by the author.
Unknown said...

Thanks for sharing your knowledge, very simple and useful tip. With your solution I succeeded where proper websites failed, It worked perfectly on my Canon 70D.

Christopher Mark Perez said...

Lucio - I'm glad it helped. Sometimes these kinds of instructions fail for others where it might succeed for myself.

ms24503 said...

Thanks, this worked perfectly for me on the 7DM2
http://mbah.net/2017/06/19/7dshuttercount/

Tapani Tarvainen said...

Any idea how to do this with 5D mk IV?
It doesn't seem to have main/status/shuttercounter in the tree.

Unknown said...

Thanks! I am amazed it works

Had to kill processes, so did

kill -9 1234

for four separate processes (where 1234 is sample process ID)

I did it on Linux mint on VMWARE

Castillonis said...

Similar to the Mark IV the output for the Mark iii complains about there not being a "/main", but I was able to get the shutter value by redirecting standard out to a file. Standard error will go to the console and the shutter value is written to the file. The example below uses log.txt

ps aux | grep gphoto2

if the output shows a process id such as 25632 and 25442 for gvfs-gphoto2-volume-monitor
kill -9 25632 25442

gphoto2 --debug --get-config /main/status/shuttercounter > log.txt


Cancun Manny said...

Figured I would add what I learned! So I was having issues, so I ran
"gphoto2 --auto-detect" to first see if gphoto was even finding my camera.

It would find a mass storage camera, and my Canon 70D, but when I ran the "gphoto2 --get-config /main/status/shuttercounter" it would give me an error. I was assuming gphoto2 was finding my camera twice, once as a mass storage and then as a camera.

Went on a rabbit hole trying to figure out how to force the 70D onto PTP mode only, but then I realized the mass storage camera was actually my big hard drive not the cameras memory card. I then unmounted the hard drive and gave "gphoto2 --get-config /main/status/shuttercounter" a try again, and this time I got my result:

Label: Shutter Counter
Readonly: 0
Type: TEXT
Current: 75528
END

gdel said...

Hi , I have tried with 5DIV , using Mint or Ubuntu .

it does not work , as indicated I killed the process linked to gvfs-gphoto2-volume-monitor

then entered : gphoto2 --debug --get-config /main/status/shuttercounter > log.txt

log.txt is created but don't show the shutter counter .

thank's if someone give a working step by step procedure for 5DIV ........

Christopher Mark Perez said...

gdel - did you try Castillonis' approach?

To all readers - I'm sorry I've not followed up on the original instructions for newer Canon cameras. I've moved out of that marque and haven't owned a Canon camera in years. But I'm happy to keep these comments open so as you find solutions you can add them.

Tapani Tarvainen said...

The gphoto2 technique does not work with 5D mark IV or newer Canons. For reasons known only to them, Canon has removed shuttercount from the config entries gphoto2 can read. I don't know exactly when the change happened, but I can confirm the technique works with 5DmkIII and 7DmkII butt not with 5DmkIV. You can check the output of

gphoto2 --list-config

to see what settings it can get out of your camera. --list-all-config will also show the values (be ready for a long output).

Unfortunately I don't know of any free software that can get the shutter count from new(ish) Canon cameras. Or indeed anything that works in Linux or Windows. There are some MacOS programs that claim to do it, but I can't vouch for them.

Unknown said...

Thanks a lot for this tips. It helps me to retrieve the shutter count on my 5d mk2