From 8773afa4720ed600d34c7a811f1a832edf3700a1 Mon Sep 17 00:00:00 2001 From: Patrick Mansfield Date: Sat, 2 Nov 2002 01:38:06 +0000 Subject: [PATCH] * PROTOCOL, epson-desc.c, library.c, nikon-desc.c * olympus-desc.c, sierra-desc.h, sierra.c, sierra.h: Add changes to support the 0x6 get register strings, the extended protocol. This gives roughly twice the download speed. This is not supported for the default cases. Thanks to Selmeczi David for discovering and coding up the original patch for this support. Also includes a minor change in library.c for the message when a recursive call is detected. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@5521 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/sierra/ChangeLog | 10 ++++++++++ camlibs/sierra/PROTOCOL | 2 +- camlibs/sierra/epson-desc.c | 2 +- camlibs/sierra/library.c | 20 ++++++++++++++------ camlibs/sierra/nikon-desc.c | 5 ++--- camlibs/sierra/olympus-desc.c | 5 +++-- camlibs/sierra/sierra-desc.h | 1 + camlibs/sierra/sierra.c | 3 +++ camlibs/sierra/sierra.h | 3 ++- 9 files changed, 37 insertions(+), 14 deletions(-) diff --git a/camlibs/sierra/ChangeLog b/camlibs/sierra/ChangeLog index 562f153aa..4082aaf21 100644 --- a/camlibs/sierra/ChangeLog +++ b/camlibs/sierra/ChangeLog @@ -1,3 +1,13 @@ +2002-11-01 Patrick Mansfield + * PROTOCOL, epson-desc.c, library.c, nikon-desc.c + * olympus-desc.c, sierra-desc.h, sierra.c, sierra.h: Add changes to + support the 0x6 get register strings, the extended protocol. + This gives roughly twice the download speed. This is not + supported for the default cases. Thanks to Selmeczi David + for discovering and coding up the original + patch for this support. Also includes a minor change in + library.c for the message when a recursive call is detected. + 2002-10-27 Patrick Mansfield * library.c: rename ifdef around recursive call problem, and change ifdef-ed out code to use gp_context_progress_start. diff --git a/camlibs/sierra/PROTOCOL b/camlibs/sierra/PROTOCOL index 0732110db..4fa0e2d6c 100644 --- a/camlibs/sierra/PROTOCOL +++ b/camlibs/sierra/PROTOCOL @@ -73,4 +73,4 @@ For further information , see http://photopc.sourceforge.net/protocol.html. 03 yy zz... set string register yy to value zz... 04 yy get string register yy - + 06 yy get string register yy using 32k packets (USB, extended protocol) diff --git a/camlibs/sierra/epson-desc.c b/camlibs/sierra/epson-desc.c index 4762ce82b..5599886bb 100644 --- a/camlibs/sierra/epson-desc.c +++ b/camlibs/sierra/epson-desc.c @@ -556,4 +556,4 @@ N_( " please send a mail to (in English)\n" ); -const CameraDescType ep3000z_cam_desc = { ep3000z_desc, ep3000z_manual }; +const CameraDescType ep3000z_cam_desc = { ep3000z_desc, ep3000z_manual, TRUE, }; diff --git a/camlibs/sierra/library.c b/camlibs/sierra/library.c index 7a8c1e0b4..58ea714b5 100644 --- a/camlibs/sierra/library.c +++ b/camlibs/sierra/library.c @@ -501,7 +501,7 @@ sierra_read_packet (Camera *camera, unsigned char *packet, GPContext *context) switch (camera->port->type) { case GP_PORT_USB: - blocksize = 2054; + blocksize = 32774; break; case GP_PORT_SERIAL: blocksize = 1; @@ -1168,18 +1168,21 @@ int sierra_get_string_register (Camera *camera, int reg, int fnumber, CameraFile *file, unsigned char *b, unsigned int *b_len, GPContext *context) { - unsigned char p[4096]; + unsigned char p[34816]; const char *file_name; unsigned int packlength, total = *b_len; unsigned int id = 0; int retries, r; static int in_function = 0; - GP_DEBUG ("sierra_get_string_register: reg %i, file number %i", - reg, fnumber); + GP_DEBUG ("sierra_get_string_register: reg %i, file number %i," + " ext protocol %x", reg, fnumber, + camera->pl->use_extended_protocol); if (in_function != 0) { - GP_DEBUG ("sierra_get_string_register called recursively!\n"); + gp_context_error (context, _("recursive calls are not" + " supported by the sierra driver! Please contact" + " .")); return GP_ERROR; } in_function = 1; @@ -1190,7 +1193,12 @@ int sierra_get_string_register (Camera *camera, int reg, int fnumber, /* Build and send the request */ CHECK (sierra_build_packet (camera, SIERRA_PACKET_COMMAND, 0, 2, p)); - p[4] = 0x04; + /* + * If the extended protocol is enabled, use code 0x06 so we can send + * and receive 32k size packages, otherwise code 0x04 is used and + * we have 2k size packages. + */ + p[4] = camera->pl->use_extended_protocol ? 0x06 : 0x04; p[5] = reg; CHECK (sierra_write_packet (camera, p, context)); diff --git a/camlibs/sierra/nikon-desc.c b/camlibs/sierra/nikon-desc.c index 1bfa9de14..b5d40f64e 100644 --- a/camlibs/sierra/nikon-desc.c +++ b/camlibs/sierra/nikon-desc.c @@ -625,6 +625,5 @@ N_( " The download should function correctly.\n" ); - -const CameraDescType cp880_cam_desc = { cp880_desc, cp880_manual }; -const CameraDescType cp995_cam_desc = { cp880_desc, cp995_manual }; +const CameraDescType cp880_cam_desc = { cp880_desc, cp880_manual, TRUE, }; +const CameraDescType cp995_cam_desc = { cp880_desc, cp995_manual, TRUE, }; diff --git a/camlibs/sierra/olympus-desc.c b/camlibs/sierra/olympus-desc.c index fa7e6b677..e25e51e85 100644 --- a/camlibs/sierra/olympus-desc.c +++ b/camlibs/sierra/olympus-desc.c @@ -587,5 +587,6 @@ N_( " please contact gphoto-devel@gphoto.net\n" ); -const CameraDescType oly3040_cam_desc = { oly3040_desc, oly3040_manual }; -const CameraDescType sierra_default_cam_desc = { oly3040_desc, default_manual }; +const CameraDescType oly3040_cam_desc = { oly3040_desc, oly3040_manual, TRUE, }; +const CameraDescType sierra_default_cam_desc = { oly3040_desc, default_manual, + FALSE, }; diff --git a/camlibs/sierra/sierra-desc.h b/camlibs/sierra/sierra-desc.h index c0185919e..a0373c56b 100644 --- a/camlibs/sierra/sierra-desc.h +++ b/camlibs/sierra/sierra-desc.h @@ -127,6 +127,7 @@ typedef struct CameraRegisterSet { typedef struct CameraDesc { const CameraRegisterSetType *regset; const char * const manual; + const unsigned use_extended_protocol:1; } CameraDescType; extern const CameraDescType sierra_default_cam_desc; diff --git a/camlibs/sierra/sierra.c b/camlibs/sierra/sierra.c index a89138c27..0bf5d6119 100644 --- a/camlibs/sierra/sierra.c +++ b/camlibs/sierra/sierra.c @@ -1956,6 +1956,7 @@ camera_init (Camera *camera, GPContext *context) camera->pl->model = SIERRA_MODEL_DEFAULT; camera->pl->first_packet = 1; camera->pl->usb_wrap = 0; + camera->pl->use_extended_protocol = 0; /* Retrieve Camera information from name */ gp_camera_get_abilities (camera, &a); @@ -1983,6 +1984,8 @@ camera_init (Camera *camera, GPContext *context) return (GP_ERROR_MODEL_NOT_FOUND); } camera->pl->cam_desc = cam_desc; + camera->pl->use_extended_protocol = + cam_desc->use_extended_protocol; camera->functions->get_config = camera_get_config_cam_desc; camera->functions->set_config = camera_set_config_cam_desc; break; diff --git a/camlibs/sierra/sierra.h b/camlibs/sierra/sierra.h index 03ba00e15..5958a5733 100644 --- a/camlibs/sierra/sierra.h +++ b/camlibs/sierra/sierra.h @@ -11,7 +11,8 @@ struct _CameraPrivateLibrary { int folders; int speed; int first_packet; - int usb_wrap; /* 0: packets sent "raw", 1: see sierra-usbwrap.h */ + int usb_wrap:1; /* 0: packets sent "raw", 1: see sierra-usbwrap.h */ + int use_extended_protocol:1; struct CameraDesc const *cam_desc; char folder[128]; };