* sierra.c: Output summary with warning if no memory card present.

* library.c: Check for memory card before capture or listing.
	* sierra-desc.c: add extern round() rather than a complete hack.


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4824 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Patrick Mansfield
2002-07-07 05:26:35 +00:00
parent 8a14af83b1
commit af3c4d3201
4 changed files with 28 additions and 7 deletions

View File

@@ -1,3 +1,9 @@
2002-07-06 Patrick Mansfield <patmans@users.sourceforge.net>
* sierra.c: Output summary with warning if no memory card present.
* library.c: Check for memory card before capture or listing.
* sierra-desc.c: add extern round() rather than a complete hack.
2002-07-05 Lutz Müller <lutz@users.sourceforge.net>
Patch by Thomas Reitelbach <tr@erdfunkstelle.de>:

View File

@@ -133,6 +133,12 @@ int sierra_list_files (Camera *camera, const char *folder, CameraList *list, GPC
GP_DEBUG ("Listing files in folder '%s'...", folder);
CHECK (sierra_get_int_register (camera, 51, &i, context));
if (i == 1) {
gp_context_error (context, _("No memory card present"));
return (GP_ERROR_NOT_SUPPORTED);
}
/* We need to change to the folder first */
CHECK (sierra_change_folder (camera, folder, context));
@@ -1279,6 +1285,12 @@ sierra_capture (Camera *camera, CameraCaptureType type,
if (type != GP_CAPTURE_IMAGE)
return (GP_ERROR_NOT_SUPPORTED);
CHECK (sierra_get_int_register (camera, 51, &n, context));
if (n == 1) {
gp_context_error (context, _("No memory card present"));
return (GP_ERROR_NOT_SUPPORTED);
}
/* Send to the camera the capture request and wait
for the completion */
CHECK (sierra_action (camera, SIERRA_ACTION_CAPTURE, context));

View File

@@ -23,8 +23,6 @@
#include <stdio.h>
#include <string.h>
/* XXX hack hack how do we define this via gcc? For use with round() */
#define __USE_ISOC99 1
#include <math.h>
#include <gphoto2-library.h>
@@ -55,6 +53,11 @@
#define GP_MODULE "sierra"
/*
* For some reason, round() does not get a prototype from math.h.
*/
extern double round(double x);
static int
camera_cam_desc_get_value (ValueNameType *val_name_p, CameraWidgetType widge,
u_int32_t reg_len, void *buff, int mask,

View File

@@ -1766,17 +1766,17 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
CHECK (camera_start (camera, context));
strcpy(buf, "");
/* At least on PhotoPC 3000z, if no card is present near all retrieved
info are either unreadable or invalid... */
if (sierra_get_int_register(camera, 51, &value, context) >= 0)
if (value == 1) {
strcpy (buf, _("NO MEMORY CARD PRESENT\n"));
strcpy (buf, _("Note: no memory card present, some"
" values may be invalid\n"));
strcpy (summary->text, buf);
return (camera_stop (camera, context));
}
strcpy(buf, "");
/* Get all the string-related info */
ret = sierra_get_string_register (camera, 27, 0, NULL, t, &value, context);
if (ret >= 0)
@@ -1810,7 +1810,7 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
/* Get date */
if (sierra_get_int_register (camera, 2, &value, context) >= 0)
sprintf (buf, _("%sDate: %s\n"), buf,
sprintf (buf, _("%sDate: %s"), buf,
ctime ((time_t*) &value));
strcpy (summary->text, buf);