From 22efc91425fe296ff9c66c9a8a7b879c19dab7cd Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 14 Aug 2005 15:17:39 +0000 Subject: [PATCH] support autodetection of disk ports. stat for dcim/ or DCIM/ directories. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8207 67ed7778-7388-44ab-90cf-0a291f65f57c --- libgphoto2/gphoto2-abilities-list.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c index e319871e4..65f9bec9d 100644 --- a/libgphoto2/gphoto2-abilities-list.c +++ b/libgphoto2/gphoto2-abilities-list.c @@ -407,6 +407,23 @@ gp_abilities_list_detect (CameraAbilitiesList *list, break; } + case GP_PORT_DISK: { + char *s, path[1024]; + struct stat stbuf; + + s = strchr (info.path, ':'); + if (!s) + break; + s++; + snprintf (path, sizeof(path), "%s/DCIM", s); + if (-1 == stat(path, &stbuf)) { + snprintf (path, sizeof(path), "%s/dcim", s); + if (-1 == stat(path, &stbuf)) + continue; + } + gp_list_append (l, "Directory Browse", info.path); + break; + } default: /* * We currently cannot detect any cameras on this