BenV's notes

Libgphoto retarded limits

by on Mar.11, 2012, under Software

Today Digikam didn’t quite want to do what I wanted. Yesterday I made a bunch of new photos and all I wanted was to transfer the new photos to my disk.
Import -> Cameras -> Canon EOS 600D -> … what the, there are no images?

Digikam Import - List Error

Digikam Import - List Error


Looking through the history at the bottom I noticed the error: “13:20:37 :: Failed to list files in /store_00020001/DCIM/100CANON.“. What the, this worked fine a few days ago.
After restarting digikam and retrying this import a few times and getting the same results (no surprise) I looked further down the layers. The one responsible for the actual transfer is libgphoto2.
So first I listed the folders:

benv@jemoeder:~$ gphoto2 -l
There is 1 folder in folder '/'.
- store_00020001
There are 2 folders in folder '/store_00020001'.
- DCIM
- MISC
There is 1 folder in folder '/store_00020001/DCIM'.
- 100CANON
There are 0 folders in folder '/store_00020001/DCIM/100CANON'.
There are 0 folders in folder '/store_00020001/MISC'.

Looks fine. Next the files:

benv@jemoeder:~$ gphoto2 -L
There is no file in folder '/'.
There is no file in folder '/store_00020001'.
There is no file in folder '/store_00020001/DCIM'.
*** Error (-8: 'Fixed limit exceeded') ***

What the…. fixed limit? What kind of retarded thing is that? A quick look at the images on the camera showed a magic number: I now had more than 1024 images on that disk. *sigh*
So the morons that coded this were too stupid to use dynamic memory allocation? Promising. Especially these days with huge memory cards in excess up to 128GB it’s nothing special to end up with more than 1024 images on a memory card. Looking at the libgphoto source there are some comments about backwards binary compatibility in an #idef statement. With the else not implemented. Hopefully this will be fixed in their official tree soon.

Since I’m not in the mood to rewrite the entire thing, here’s a quick patch to increase the ridiculously low limit to somewhat more sensible:

--- libgphoto2/gphoto2-list.c 2012-03-11 13:54:02.845794954 +0100
+++ libgphoto2/gphoto2-list.c.org 2012-03-11 13:41:32.310591985 +0100
@@ -72,7 +72,7 @@

#ifdef CAMERALIST_STRUCT_COMPATIBILITY

-#define MAX_ENTRIES 16384
+#define MAX_ENTRIES 1024
#define MAX_LIST_STRING_LENGTH 128
struct _CameraList {
int count;

Or as a diff file here:
[Download not found]




:

Leave a Reply

You must be logged in to post a comment.