From eaf6ad331c41ebd24f0f5320a8628080850a6783 Mon Sep 17 00:00:00 2001 From: "Stephen H. Westin" Date: Fri, 10 Jun 2005 21:46:46 +0000 Subject: [PATCH] We now have a true "is this awake?" query. Slight tidying. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8060 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/canon/usb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/camlibs/canon/usb.c b/camlibs/canon/usb.c index 5e409f465..35d3a7c8f 100644 --- a/camlibs/canon/usb.c +++ b/camlibs/canon/usb.c @@ -2325,21 +2325,28 @@ canon_usb_list_all_dirs (Camera *camera, unsigned char **dirent_data, /** * canon_usb_ready: - * @camera: camera to get ready + * @camera: camera to check * - * USB part of canon_int_ready + * Checks whether camera is available for communication. * * Returns: gphoto2 error code + * GP_OK if camera is ready * */ int -canon_usb_ready (Camera *camera) +canon_usb_ready (Camera *camera, GPContext *context) { + unsigned char *msg; + int len; + GP_DEBUG ("canon_usb_ready()"); - /* XXX send a 'ping' packet and check that the camera is - * still alive. - */ + /* "Identify camera" seems to be a command compatible with all + * cameras, and one that doesn't change the camera state. */ + msg = canon_usb_dialogue (camera, CANON_USB_FUNCTION_IDENTIFY_CAMERA, + &len, NULL, 0); + if ( msg == NULL ) + return GP_ERROR_OS_FAILURE; return GP_OK; }