Re: syntax for shell wait-event command?

Marcus Meissner <[email protected]>
Newsgroups gmane.comp.multimedia.gphoto.user
Message-ID <[email protected]>
Hi,

On Sat, Dec 09, 2017 at 08:48:27PM +0000, fred konkin via Gphoto-user wrote:
> Hi - gphoto works well for the most part but I have one question: what is the syntax for the shell equivalent of the CLI command (which works perfectly):
> 
> gphoto2 --set-config /main/settings/capturetarget=1 -q --keep --wait-event-and-download=FILEADDED
> 
> When I start the shell and try the obvious guess: "wait-event-and-download=FILEADDED", I get "ERROR: Invalid command".  Other variants also don't work.  Eg, "wait-event-and-download FILEADDED" gives "Waiting for  FILEADDED event from camera. Press Ctrl-C to abort."  Note the double space - it appears to be waiting for " FILEADDED" instead of "FILEADDED", and it doesn't detect a picture capture.
> 
> I don't want to use "gphoto2  --wait-event-and-download=FILEADDED --shell" because I need to intersperse multiple get/set commands with multiple picture captures, all within the same shell instance (for speed and efficiency - I do time lapse and may have thousands of frames by the end of the sequence).
> 
> I use gphoto2 v 2.5.15, libgphoto2 v 2.5.16, running on up to date Raspbian Jessie, connected to a Nikon D7000.

This was a bug in the --shell parser.

I have applied the attached patch to GIT. 

Thanks for the report!

Ciao, Marcus

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Gphoto-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gphoto-user
xx.pat (text/plain, 2.1 KB)
commit f8a05cad676ee922622b9fa2faefb7d05a0f7fed
Author: Marcus Meissner <[email protected]>
Date:   Tue Dec 12 09:20:55 2017 +0100

    shell lcd does not need an argument, empty means $HOME
    shell wait-event and capture-tetehred ... remove leading space

diff --git a/gphoto2/actions.c b/gphoto2/actions.c
index b1f98d5..8f30e53 100644
--- a/gphoto2/actions.c
+++ b/gphoto2/actions.c
@@ -1131,7 +1131,7 @@ action_camera_wait_event (GPParams *p, enum download_type downloadtype, const ch
 		} else {
 			wp.type = WAIT_STRING;
 			wp.u.str = arg;
-			printf ( _("Waiting for %s event from camera. Press Ctrl-C to abort.\n"), wp.u.str);
+			printf ( _("Waiting for '%s' event from camera. Press Ctrl-C to abort.\n"), wp.u.str);
 		}
 	}
 
diff --git a/gphoto2/shell.c b/gphoto2/shell.c
index ba0c6d1..1b26496 100644
--- a/gphoto2/shell.c
+++ b/gphoto2/shell.c
@@ -121,7 +121,7 @@ static const struct _ShellFunctionTable {
 	{"cd", shell_cd, N_("Change to a directory on the camera"),
 	 N_("directory"), 1},
 	{"lcd", shell_lcd, N_("Change to a directory on the local drive"),
-	 N_("directory"), 1},
+	 N_("directory"), 0},
 	{"exit", shell_exit, N_("Exit the gPhoto shell"), NULL, 0},
 	{"get", shell_get, N_("Download a file"), N_("[directory/]filename"), 1},
 	{"put", shell_put, N_("Upload a file"), N_("[directory/]filename"), 1},
@@ -613,7 +613,7 @@ shell_cd (Camera __unused__ *camera, const char *arg)
 	int arg_count = shell_arg_count (arg);
 
 	if (!arg_count)
-		return (GP_OK);
+		return GP_OK;
 
 	/* shell_arg(arg, 0, arg_dir); */
 
@@ -916,12 +916,18 @@ shell_capture_preview (Camera __unused__ *camera, const char __unused__ *args) {
 
 static int
 shell_wait_event (Camera *camera, const char *args) {
-	return action_camera_wait_event (p, DT_NO_DOWNLOAD, args);
+	char argument[1024];
+
+	shell_arg (args, 0, argument);
+	return action_camera_wait_event (p, DT_NO_DOWNLOAD, argument);
 }
 
 static int
 shell_capture_tethered (Camera *camera, const char *args) {
-	return action_camera_wait_event (p, DT_DOWNLOAD, args);
+	char argument[1024];
+
+	shell_arg (args, 0, argument);
+	return action_camera_wait_event (p, DT_DOWNLOAD, argument);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.