From b74453a6ca3eda4aa313be0edec50e9b8f671f3f Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 21 Jul 2018 20:16:34 +0200 Subject: [PATCH] more cleanups and defines from traces in https://github.com/gphoto/libgphoto2/issues/229 --- camlibs/ptp2/library.c | 11 +---------- camlibs/ptp2/ptp.c | 21 ++++++++++++++++++++- camlibs/ptp2/ptp.h | 6 +++--- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index d8c7d9a98..d7f2bc401 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -4494,16 +4494,7 @@ camera_olympus_omd_capture (Camera *camera, CameraCaptureType type, CameraFilePa } } while (waiting_for_timeout (&back_off_wait, event_start, 65000)); /* wait for 0.5 seconds after busy is no longer signaled */ - //do { - // C_PTP_REP (ptp_olympus_omd_check_new_objects(params, &objects, &length)); - // if(length > 0) { - // newobject = objects[0]; - // free(*objects); - // break; - // } - //} while (waiting_for_timeout (&back_off_wait, event_start, 65000)); /* wait for 66 seconds after busy is no longer signaled */ - - downloadfile: +downloadfile: path->name[0]='\0'; path->folder[0]='\0'; diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index 1f3894dd1..2004908cd 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -852,6 +852,7 @@ ptp_olympus_omd_capture (PTPParams* params) unsigned int size = 0; unsigned char *buffer = NULL; +/* these two trigger the capture ... one might be "shutter down", the other "shutter up"? */ PTP_CNT_INIT(ptp, PTP_OC_OLYMPUS_OMD_Capture, 0x3); // initiate capture ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); PTP_CNT_INIT(ptp, PTP_OC_OLYMPUS_OMD_Capture, 0x6); // initiate capture @@ -859,7 +860,8 @@ ptp_olympus_omd_capture (PTPParams* params) usleep(500); - PTP_CNT_INIT(ptp, 0x9486); // initiate capture +/* this only fetches changed props */ + PTP_CNT_INIT(ptp, 0x9486); /* query changed properties */ ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &buffer, &size); free (buffer); return ret; @@ -895,6 +897,23 @@ ptp_olympus_init_pc_mode (PTPParams* params) if (ptp_get_one_event(params, &event)) break; usleep(100000); } + +/* + * 9489 code: sends a list of PTP device properties supported apparently? on E-M1. + * F4 00 00 00 count +02 D0 03 D0 04 D0 05 D0 06 D0 07 D0 08 D0 09 D0 0C D0 0D D0 0E D0 0F D0 10 D0 11 D0 13 D0 14 D0 18 D0 1A D0 1B D0 1C D0 1D D0 1E D0 1F D0 20 D0 21 D0 22 D0 23 D0 24 D0 25 D0 26 D0 27 D0 28 D0 29 D0 2A D0 2B D0 2C D0 2D D0 2E D0 2F D0 30 D0 31 D0 32 D0 33 D0 34 D0 35 D0 36 D0 37 D0 38 D0 39 D0 3A D0 3B D0 3C D0 3D D0 3E D0 3F D0 40 D0 41 D0 42 D0 43 D0 44 D0 45 D0 46 D0 47 D0 48 D0 49 D0 4A D0 4B D0 4C D0 4D D0 4E D0 4F D0 50 D0 51 D0 52 D0 58 D0 59 D0 5F D0 60 D0 61 D0 62 D0 64 D0 65 D0 66 D0 68 D0 69 D0 70 D0 73 D0 67 D0 5A D0 5B D0 63 D0 6A D0 6B D0 6C D0 71 D0 72 D0 7A D0 7B D0 7C D0 7D D0 7F D0 80 D0 81 D0 82 D0 86 D0 87 D0 8B D0 8C D0 8E D0 8F D0 97 D0 9F D0 C4 D0 C5 D0 A2 D0 A3 D0 A4 D0 A6 D0 A7 D0 A8 D0 A9 D0 AA D0 AB D0 AC D0 AD D0 AE D0 B2 D0 B3 D0 B4 D0 B5 D0 B6 D0 B7 D0 B8 D0 B9 D0 BA D0 BC D0 BD D0 BE D0 BF D0 C0 D0 C6 D0 C7 D0 C8 D0 C9 D0 CB D0 CC D0 CD D0 CE D0 CF D0 D0 D0 D1 D0 D2 D0 D3 D0 D4 D0 D5 D0 D6 D0 D7 D0 D8 D0 D9 D0 DA D0 DB D0 DC D0 DD D0 DE D0 E2 D0 E3 D0 E4 D0 E5 D0 E6 D0 E7 D0 E8 D0 E9 D0 EA D0 EC D0 EF D0 F0 D0 F1 D0 F2 D0 F3 D0 F4 D0 F5 D0 F6 D0 F7 D0 F8 D0 F9 D0 FA D0 FB D0 FC D0 FD D0 FE D0 FF D0 00 D1 01 D1 02 D1 03 D1 04 D1 05 D1 06 D1 07 D1 08 D1 09 D1 0A D1 0B D1 0C D1 0D D1 0E D1 0F D1 10 D1 11 D1 12 D1 13 D1 14 D1 15 D1 16 D1 17 D1 18 D1 19 D1 1A D1 1B D1 1C D1 1D D1 1E D1 1F D1 20 D1 51 D1 52 D1 5A D1 24 D1 25 D1 26 D1 27 D1 28 D1 2D D1 2E D1 2F D1 30 D1 31 D1 34 D1 35 D1 36 D1 37 D1 38 D1 39 D1 3A D1 + * + * 9486: queries something. gets 00 00 00 00 ... or list of devicepropdesc in standard ptp propdesc format. + * could be some form of "properties changed" query perhaps? (32bit count in front) + * might only monitor/return properties set by 9489? + * + * 948a: seems also be some kind of polling function, returns 32bit 0 if nothing is there. similar to above? + * returns properties sent by 94b8. + * + * 948b: also sends a list of ptp devprops: + * 11 00 00 00 53 D0 54 D0 55 D0 56 D0 57 D0 6D D0 5C D0 5D D0 5E D0 74 D0 75 D0 83 D0 84 D0 85 D0 ED D0 79 D0 E1 D0 + * Events: c008: 21 D1 00 00 0F 00 00 00 01 00 00 00 + */ //ptp_debug (params,"PTP: (Olympus Init) getting response..."); //gp_port_set_timeout (camera->port, timeout); //ret=ptp_transaction(params, &ptp, PTP_DP_RESPONSEONLY, size, &data, NULL); diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h index d0d239119..f5b72f169 100644 --- a/camlibs/ptp2/ptp.h +++ b/camlibs/ptp2/ptp.h @@ -679,8 +679,10 @@ typedef struct _PTPIPHeader PTPIPHeader; /* Olympus OMD series commands */ #define PTP_OC_OLYMPUS_OMD_Capture 0x9481 +#define PTP_OC_OLYMPUS_GetLiveViewImage 0x9484 +#define PTP_OC_OLYMPUS_OMD_ChangedProperties 0x9486 #define PTP_OC_OLYMPUS_OMD_MFDrive 0x9487 - +#define PTP_OC_OLYMPUS_OMD_SetProperties 0x9489 /* Sends to the device a PTP list of all 16 bit device properties , count 32bit, then 16bit vals */ /* Olympus E series commands */ @@ -699,8 +701,6 @@ typedef struct _PTPIPHeader PTPIPHeader; #define PTP_OC_OLYMPUS_SetCameraID 0x9501 #define PTP_OC_OLYMPUS_GetCameraID 0x9581 -#define PTP_OC_OLYMPUS_GetLiveViewImage 0x9484 - /* Android Random I/O Extensions Codes */ #define PTP_OC_ANDROID_GetPartialObject64 0x95C1