aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <meissner@suse.de>2018-10-07 18:13:01 +0200
committerMarcus Meissner <meissner@suse.de>2018-10-07 18:13:01 +0200
commite5b302f45e5db9e1e328386eeb189697c8319c27 (patch)
tree813415950b388acf247bbd2bebaa60998e431b35
parentdd5602bb2d4a9b87f06c10711c5dbb0876dcb346 (diff)
downloadlibmtp-e5b302f45e5db9e1e328386eeb189697c8319c27.tar.gz
merge from libgphoto2, no relevant changes
-rw-r--r--src/ptp-pack.c19
-rw-r--r--src/ptp.c234
-rw-r--r--src/ptp.h185
3 files changed, 423 insertions, 15 deletions
diff --git a/src/ptp-pack.c b/src/ptp-pack.c
index 497acd3..5319525 100644
--- a/src/ptp-pack.c
+++ b/src/ptp-pack.c
@@ -2422,6 +2422,7 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
* 6D: 7
* M10: 8
* 70D: 8
+ * 5Dsr: b
* 200D: f
*/
case PTP_EC_CANON_EOS_OLCInfoChanged: {
@@ -2479,10 +2480,18 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_PROPERTY;
ce[i].u.propid = proptype;
/* hack to differ between older EOS and EOS 200D newer */
- if (olcver >= 8) {
+ switch (olcver) {
+ case 0x8:
+ case 0xf:
curoff += 7; /* f (200D), 8 (M10) */
- } else {
- curoff += 6; /* 7 */
+ break;
+ case 0x7:
+ case 0xb:
+ curoff += 6; /* 7 , b (5ds) */
+ break;
+ default:
+ curoff += 6;
+ break;
}
i++;
}
@@ -2501,7 +2510,7 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
if (olcver >= 0xf) {
curoff += 6; /* f */
} else {
- curoff += 5; /* 7, 8 */
+ curoff += 5; /* 7, 8, b */
}
i++;
}
@@ -2514,7 +2523,7 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_PROPERTY;
ce[i].u.propid = proptype;
- curoff += 4;
+ curoff += 4; /* 7, 8, b, f*/
i++;
}
if (mask & 0x0010) {
diff --git a/src/ptp.c b/src/ptp.c
index fa93add..5327865 100644
--- a/src/ptp.c
+++ b/src/ptp.c
@@ -170,7 +170,6 @@ ptp_transaction_new (PTPParams* params, PTPContainer* ptp,
ptp->SessionID=params->session_id;
/* send request */
CHECK_PTP_RC(params->sendreq_func (params, ptp, flags));
-
/* is there a dataphase? */
switch (flags&PTP_DP_DATA_MASK) {
case PTP_DP_SENDDATA:
@@ -183,7 +182,10 @@ ptp_transaction_new (PTPParams* params, PTPContainer* ptp,
break;
case PTP_DP_GETDATA:
{
- CHECK_PTP_RC(params->getdata_func(params, ptp, handler));
+ uint16_t ret = params->getdata_func(params, ptp, handler);
+ if (ret == PTP_ERROR_CANCEL)
+ CHECK_PTP_RC(params->cancelreq_func(params, params->transaction_id-1));
+ CHECK_PTP_RC(ret);
}
break;
case PTP_DP_NODATA:
@@ -841,7 +843,228 @@ parse_9301_tree (PTPParams *params, xmlNodePtr node, PTPDeviceInfo *di)
/*traverse_tree (0, node);*/
return PTP_RC_OK;
}
+#endif
+
+uint16_t
+ptp_olympus_omd_capture (PTPParams* params)
+{
+ PTPContainer ptp;
+ uint16_t ret;
+ 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
+ ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
+
+ usleep(500);
+
+/* 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;
+}
+
+uint16_t
+ptp_panasonic_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size)
+{
+ PTPContainer ptp;
+
+ PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_LiveviewImage);
+ return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
+}
+
+uint16_t
+ptp_olympus_init_pc_mode (PTPParams* params)
+{
+ uint16_t ret;
+ PTPPropertyValue propval;
+ PTPContainer event;
+ int i;
+
+ ptp_debug (params,"PTP: (Olympus Init) switching to PC mode...");
+
+ propval.u16 = 1;
+ ret = ptp_setdevicepropvalue (params, 0xD052, &propval, PTP_DTC_UINT16);
+ usleep(100000);
+
+ for(i = 0; i < 2; i++) {
+ ptp_debug (params,"PTP: (Olympus Init) checking events...");
+ /* Just busy loop until the camera is ready again. */
+ ptp_check_event (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);
+ //if(data) free(data);
+ return ret;
+}
+
+uint16_t
+ptp_olympus_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size)
+{
+ PTPContainer ptp;
+ uint32_t param1 = 1;
+
+ PTP_CNT_INIT(ptp, PTP_OC_OLYMPUS_GetLiveViewImage, param1);
+ return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
+}
+
+uint16_t
+ptp_olympus_sdram_image (PTPParams* params, unsigned char **data, unsigned int *size)
+{
+ PTPContainer ptp;
+
+ PTP_CNT_INIT(ptp, PTP_OC_OLYMPUS_OMD_GetImage);
+ return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
+}
+
+uint16_t
+ptp_panasonic_setdeviceproperty (PTPParams* params, uint32_t propcode,
+ unsigned char *value, uint16_t valuesize)
+{
+ PTPContainer ptp;
+ uint16_t ret;
+ unsigned char *data;
+ uint32_t size = 4 + 4 + valuesize;
+
+ data = calloc(size, sizeof(unsigned char));
+
+ htod32a(data, propcode); /* memcpy(data, &propcode, 4); */
+ htod16a(&data[4], valuesize); /* memcpy(&data[4], &valuesize, 2); */
+
+ memcpy(&data[8], value, valuesize); /* perhaps check if one of the DPV packagers work? */
+
+ PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_SetProperty, propcode);
+ ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
+ free(data);
+ return ret;
+}
+
+uint16_t
+ptp_panasonic_getdevicepropertysize (PTPParams *params, uint32_t propcode)
+{
+ PTPContainer ptp;
+ unsigned char *data = NULL;
+ unsigned int size = 0;
+
+ PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_9107, propcode, 0, 0);
+ CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
+ if (!data) return PTP_RC_GeneralError;
+
+ if (size < 4) return PTP_RC_GeneralError;
+ uint32_t headerLength = dtoh32a( (data) + 4 );
+ if (size < 4 + 6 * 4) return PTP_RC_GeneralError;
+ uint32_t propertyCode = dtoh32a( (data) + 4 + 6 * 4 );
+ if (size < headerLength * 4 + 2 * 4) return PTP_RC_GeneralError;
+
+ ptp_debug(params, "header: %lu, code: %lu\n", headerLength, propertyCode);
+
+ return PTP_RC_OK;
+}
+
+uint16_t
+ptp_panasonic_getdevicepropertydesc (PTPParams *params, uint32_t propcode, uint16_t valuesize, uint32_t *currentValue, uint32_t **propertyValueList, uint32_t *propertyValueListLength)
+{
+ PTPContainer ptp;
+ unsigned char *data = NULL;
+ unsigned int size = 0;
+ uint16_t ret = 0;
+
+ PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_ListProperty, propcode, 0, 0);
+ CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
+ if (!data) return PTP_RC_GeneralError;
+
+
+ if (size < 4) return PTP_RC_GeneralError;
+ uint32_t headerLength = dtoh32a( (data) + 4 );
+ if (size < 4 + 6 * 4) return PTP_RC_GeneralError;
+ uint32_t propertyCode = dtoh32a( (data) + 4 + 6 * 4 );
+ if (size < headerLength * 4 + 2 * 4) return PTP_RC_GeneralError;
+
+ if(valuesize == 2) {
+ *currentValue = (uint32_t) dtoh16a( (data) + headerLength * 4 + 2 * 4 );
+ } else if(valuesize == 4) {
+ *currentValue = dtoh32a( (data) + headerLength * 4 + 2 * 4 );
+ } else {
+ return PTP_RC_GeneralError;
+ }
+ if (size < headerLength * 4 + 2 * 4 + valuesize) return PTP_RC_GeneralError;
+ *propertyValueListLength = dtoh32a( (data) + headerLength * 4 + 2 * 4 + valuesize);
+
+ ptp_debug(params, "header: %lu, code: 0x%lx, value: %lu, count: %lu", headerLength, propertyCode, *currentValue, *propertyValueListLength);
+
+ if (size < headerLength * 4 + 3 * 4 + valuesize + (*propertyValueListLength) * valuesize) return PTP_RC_GeneralError;
+
+ *propertyValueList = calloc(*propertyValueListLength, sizeof(uint32_t));
+
+ uint16_t i;
+ for(i = 0; i < *propertyValueListLength; i++) {
+ if(valuesize == 2) {
+ (*propertyValueList)[i] = (uint32_t) dtoh16a( (data) + headerLength * 4 + 3 * 4 + valuesize + i * valuesize);
+ } else if(valuesize == 4) {
+ (*propertyValueList)[i] = dtoh32a( (data) + headerLength * 4 + 3 * 4 + valuesize + i * valuesize);
+ }
+ //printf("Property: %lu\n", (*propertyValueList)[i]);
+ }
+
+ free (data);
+ return ret;
+}
+
+uint16_t
+ptp_panasonic_getdeviceproperty (PTPParams *params, uint32_t propcode, uint16_t *valuesize, uint32_t *currentValue)
+{
+ PTPContainer ptp;
+ unsigned char *data = NULL;
+ unsigned int size = 0;
+ uint16_t ret = PTP_RC_OK;
+
+ PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_GetProperty, propcode);
+ CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
+ if (!data) return PTP_RC_GeneralError;
+
+ if(size < 8) return PTP_RC_GeneralError;
+ *valuesize = dtoh32a( (data + 4) );
+
+ if(size < 8 + (*valuesize)) return PTP_RC_GeneralError;
+ if(*valuesize == 4) {
+ *currentValue = dtoh32a( (data + 8) );
+ } else if(*valuesize == 2) {
+ *currentValue = (uint32_t) dtoh16a( (data + 8) );
+ } else {
+ return PTP_RC_GeneralError;
+ }
+ //printf("ptp_panasonic_getdeviceproperty: size: %lu, valuesize: %d, currentValue: %lu\n", size, *valuesize, *currentValue);
+
+ free (data);
+ return ret;
+}
+
+#ifdef HAVE_LIBXML2
static uint16_t
ptp_olympus_parse_output_xml(PTPParams* params, char*data, int len, xmlNodePtr *code)
{
@@ -5482,7 +5705,8 @@ ptp_get_property_description(PTPParams* params, uint16_t dpc)
return (ptp_device_properties[i].txt);
if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_MICROSOFT
- || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP)
+ || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP
+ || params->deviceinfo.VendorExtensionID==PTP_VENDOR_PANASONIC)
for (i=0; ptp_device_properties_MTP[i].txt!=NULL; i++)
if (ptp_device_properties_MTP[i].dpc==dpc)
return (ptp_device_properties_MTP[i].txt);
@@ -6200,7 +6424,8 @@ ptp_render_property_value(PTPParams* params, uint16_t dpc,
}
}
if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_MICROSOFT
- || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP) {
+ || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP
+ || params->deviceinfo.VendorExtensionID==PTP_VENDOR_PANASONIC) {
switch (dpc) {
case PTP_DPC_MTP_SynchronizationPartner:
case PTP_DPC_MTP_DeviceFriendlyName:
@@ -6740,6 +6965,7 @@ ptp_get_opcode_name(PTPParams* params, uint16_t opcode)
switch (params->deviceinfo.VendorExtensionID) {
case PTP_VENDOR_MICROSOFT:
+ case PTP_VENDOR_PANASONIC:
case PTP_VENDOR_MTP: RETURN_NAME_FROM_TABLE(ptp_opcode_mtp_trans, opcode);
case PTP_VENDOR_NIKON: RETURN_NAME_FROM_TABLE(ptp_opcode_nikon_trans, opcode);
case PTP_VENDOR_CANON: RETURN_NAME_FROM_TABLE(ptp_opcode_canon_trans, opcode);
diff --git a/src/ptp.h b/src/ptp.h
index d45fb10..ddfd362 100644
--- a/src/ptp.h
+++ b/src/ptp.h
@@ -155,6 +155,7 @@ struct _PTPIPHeader {
typedef struct _PTPIPHeader PTPIPHeader;
/* Vendor IDs */
+/* List is linked from here: http://www.imaging.org/site/IST/Standards/PTP_Standards.aspx */
#define PTP_VENDOR_EASTMAN_KODAK 0x00000001
#define PTP_VENDOR_SEIKO_EPSON 0x00000002
#define PTP_VENDOR_AGILENT 0x00000003
@@ -180,7 +181,9 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_VENDOR_MTP 0xffffffff
/* gphoto overrides */
-#define PTP_VENDOR_GP_OLYMPUS 0xfffffffe
+#define PTP_VENDOR_GP_OLYMPUS 0x0000fffe
+#define PTP_VENDOR_GP_OLYMPUS_OMD 0x0000fffd
+
/* Operation Codes */
@@ -537,7 +540,7 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_NIKON_GetPartialObjectHiSpeed 0x9400 /* 3 params, data in */
/* From Nikon V1 Trace */
-#define PTP_OC_NIKON_GetDevicePropEx 0x9504 /* gets device prop dataa */
+#define PTP_OC_NIKON_GetDevicePropEx 0x9504 /* gets device prop data */
/* Casio EX-F1 (from http://code.google.com/p/exf1ctrl/ ) */
#define PTP_OC_CASIO_STILL_START 0x9001
@@ -675,8 +678,16 @@ typedef struct _PTPIPHeader PTPIPHeader;
/* WiFi Provisioning MTP Extension Codes (microsoft.com/WPDWCN: 1.0) */
#define PTP_OC_MTP_WPDWCN_ProcessWFCObject 0x9122
+/* Olympus OMD series commands */
+#define PTP_OC_OLYMPUS_OMD_Capture 0x9481
+#define PTP_OC_OLYMPUS_GetLiveViewImage 0x9484 /* liveview */
+#define PTP_OC_OLYMPUS_OMD_GetImage 0x9485 /* gets an JPEG image (from the capture? SDRAM style?) */
+#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 */
+
#define PTP_OC_OLYMPUS_Capture 0x9101
#define PTP_OC_OLYMPUS_SelfCleaning 0x9103
#define PTP_OC_OLYMPUS_SetRGBGain 0x9106
@@ -692,6 +703,7 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_OLYMPUS_SetCameraID 0x9501
#define PTP_OC_OLYMPUS_GetCameraID 0x9581
+
/* Android Random I/O Extensions Codes */
#define PTP_OC_ANDROID_GetPartialObject64 0x95C1
#define PTP_OC_ANDROID_SendPartialObject 0x95C2
@@ -732,6 +744,54 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_PARROT_MagnetoCalibStatus 0x9212
#define PTP_OC_PARROT_SendFirmwareUpdate 0x9213
+#define PTP_OC_PANASONIC_9101 0x9101
+#define PTP_OC_PANASONIC_OpenSession 0x9102 /* opensession (1 arg, seems to be storage id 0x00010001)*/
+#define PTP_OC_PANASONIC_CloseSession 0x9103 /* closesession (no arg) */
+#define PTP_OC_PANASONIC_9104 0x9104 /* get ext device id (1 arg?) */
+/* 9104 gets this data:
+0000 24 00 00 00 02 00 04 91-04 00 00 00 01 00 01 00 $...............
+0010 01 00 e1 07 10 00 00 00-00 00 00 00 00 00 00 00 ................
+0020 00 00 00 00 - ....
+*/
+
+#define PTP_OC_PANASONIC_9107 0x9107 /* getsize? */
+#define PTP_OC_PANASONIC_ListProperty 0x9108
+#define PTP_OC_PANASONIC_9110 0x9110 /* Get_Object infos */
+#define PTP_OC_PANASONIC_9112 0x9112 /* Get Partial Object , 4 args */
+#define PTP_OC_PANASONIC_9113 0x9113 /* Skip Objects Transfer , 1 arg */
+
+#define PTP_OC_PANASONIC_9401 0x9401
+#define PTP_OC_PANASONIC_GetProperty 0x9402
+#define PTP_OC_PANASONIC_SetProperty 0x9403
+#define PTP_OC_PANASONIC_InitiateCapture 0x9404 /* Rec Ctrl Release */
+#define PTP_OC_PANASONIC_9405 0x9405 /* Rec Ctrl AF AE */
+#define PTP_OC_PANASONIC_9406 0x9406 /* Setup Ctrl various functions: Format, Sensor Cleaning, Menu Save, firmware update? */
+#define PTP_OC_PANASONIC_9408 0x9408
+#define PTP_OC_PANASONIC_9409 0x9409 /* 1 arg */
+#define PTP_OC_PANASONIC_940A 0x940A /* 1 arg, e.g. 0x08000010 */
+#define PTP_OC_PANASONIC_940B 0x940B /* 1 arg, e.g. 0x08000010 */
+#define PTP_OC_PANASONIC_MoveRecControl 0x940C /* 07000011 start, 07000012 stop, 0700013 still capture */
+#define PTP_OC_PANASONIC_PowerControl 0x940D /* 1 arg: 0x0A000011 power off, 0x0a00012 device reset, 0x0a00013 device restart */
+#define PTP_OC_PANASONIC_PlayControl 0x940E /* 2 arg? 0x05000011 current=0, next=1, prev=0xffffffff */
+#define PTP_OC_PANASONIC_PlayControlPlay 0x940F /* 0x05000020 */
+#define PTP_OC_PANASONIC_9410 0x9410 /* Rec Ctrl Other */
+#define PTP_OC_PANASONIC_SetGPSDataInfo 0x9411
+#define PTP_OC_PANASONIC_Liveview 0x9412 /* 0d000010 start, 0d000011 stop */
+#define PTP_OC_PANASONIC_9414 0x9414 /* 1 arg e.g 12000020 */
+#define PTP_OC_PANASONIC_9416 0x9416 /* Rec Ctrl Mf Assist, Rec Ctrl Backup Req ... 1 arg */
+
+#define PTP_OC_PANASONIC_ChangeEvent 0x9603 /* 2 args ... e.g. 0x4002, new (change object added event) */
+#define PTP_OC_PANASONIC_GetFromEventInfo 0x9605 /* 1 arg, e.g. 0x41000013 , 15c00021: setup exec menu save comp, 15c00022: setup exec pixel refresh comp */
+#define PTP_OC_PANASONIC_SendDataInfo 0x9606 /* no args? used during firmware update */
+#define PTP_OC_PANASONIC_StartSendData 0x9607 /* no args? used during firmware update */
+
+#define PTP_OC_PANASONIC_9703 0x9703 /* Mnt_GetInfo_GetVersion ... 1 arg? */
+#define PTP_OC_PANASONIC_9704 0x9704 /* Set USB Mode ... 80040001 */
+#define PTP_OC_PANASONIC_9705 0x9705 /* Ctrl Liveview */
+#define PTP_OC_PANASONIC_LiveviewImage 0x9706 /* Get Liveview Data */
+#define PTP_OC_PANASONIC_9707 0x9707 /* 4k6k cutting get stream */
+
+
/* Proprietary vendor extension operations mask */
#define PTP_OC_EXTENSION_MASK 0xF000
@@ -947,6 +1007,8 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_EC_PARROT_Status 0xC201
#define PTP_EC_PARROT_MagnetoCalibrationStatus 0xC202
+#define PTP_EC_PANASONIC_ObjectAdded 0xC108
+
/* constants for GetObjectHandles */
#define PTP_GOH_ALL_STORAGE 0xffffffff
@@ -2100,6 +2162,7 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_FUJI_ReleaseMode 0xD201
#define PTP_DPC_FUJI_FocusAreas 0xD206
#define PTP_DPC_FUJI_AELock 0xD213
+#define PTP_DPC_FUJI_Copyright 0xD215
#define PTP_DPC_FUJI_Aperture 0xD218
#define PTP_DPC_FUJI_ShutterSpeed 0xD219
@@ -2123,6 +2186,22 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_MTP_Zune_UnknownVersion 0xD181
/* Olympus */
+/* these are from OMD E-M1 Mark 2 */
+#define PTP_DPC_OLYMPUS_Aperture 0xD002
+#define PTP_DPC_OLYMPUS_FocusMode 0xD003
+#define PTP_DPC_OLYMPUS_ExposureMeteringMode 0xD004
+#define PTP_DPC_OLYMPUS_ISO 0xD007
+#define PTP_DPC_OLYMPUS_ExposureCompensation 0xD008
+#define PTP_DPC_OLYMPUS_OMD_DriveMode 0xD009
+#define PTP_DPC_OLYMPUS_ImageFormat 0xD00D
+#define PTP_DPC_OLYMPUS_FaceDetection 0xD01A
+#define PTP_DPC_OLYMPUS_AspectRatio 0xD01B
+#define PTP_DPC_OLYMPUS_Shutterspeed 0xD01C
+#define PTP_DPC_OLYMPUS_WhiteBalance 0xD01E
+#define PTP_DPC_OLYMPUS_LiveViewModeOM 0xD06D
+#define PTP_DPC_OLYMPUS_CaptureTarget 0xD0DC
+
+/* unsure where these were from */
#define PTP_DPC_OLYMPUS_ResolutionMode 0xD102
#define PTP_DPC_OLYMPUS_FocusPriority 0xD103
#define PTP_DPC_OLYMPUS_DriveMode 0xD104
@@ -2287,6 +2366,83 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_PARROT_MultisensorsIrradianceIntegrationTime 0xD218
#define PTP_DPC_PARROT_OverlapRate 0xD219
+/* Panasonic does not have regular device properties, they use some 32bit values */
+#define PTP_DPC_PANASONIC_PhotoStyle 0x02000010
+#define PTP_DPC_PANASONIC_ISO 0x02000020
+#define PTP_DPC_PANASONIC_ShutterSpeed 0x02000030
+#define PTP_DPC_PANASONIC_Aperture 0x02000040
+#define PTP_DPC_PANASONIC_WhiteBalance 0x02000050
+#define PTP_DPC_PANASONIC_Exposure 0x02000060
+#define PTP_DPC_PANASONIC_AFArea 0x02000070
+#define PTP_DPC_PANASONIC_CameraMode 0x02000080
+#define PTP_DPC_PANASONIC_ImageFormat 0x020000A2
+#define PTP_DPC_PANASONIC_MeteringInfo 0x020000B0
+#define PTP_DPC_PANASONIC_IntervalInfo 0x020000C0
+#define PTP_DPC_PANASONIC_RecDispConfig 0x020000E0
+#define PTP_DPC_PANASONIC_RecInfoFlash 0x02000110
+#define PTP_DPC_PANASONIC_BurstBracket 0x02000140
+#define PTP_DPC_PANASONIC_RecPreviewConfig 0x02000170
+#define PTP_DPC_PANASONIC_RecInfoSelfTimer 0x020001A0
+#define PTP_DPC_PANASONIC_RecInfoFlash2 0x020001B0
+#define PTP_DPC_PANASONIC_MovConfig 0x06000010
+#define PTP_DPC_PANASONIC_08000010 0x08000010
+/* various modes of the camera, HDMI, GetDateTimeWorldTime Mode/Area, SetupCfgInfo, SetupConfig_DateTime, GetSystemFreq Mode, GetSetupConfig Info */
+/*
+0000 54 00 00 00 02 00 0a 94-04 00 00 00 11 00 00 08 T...............
+0010 0a 00 00 00 e2 07 07 00-10 00 11 00 09 00 12 00 ................
+0020 00 08 02 00 00 00 00 00-13 00 00 08 02 00 00 00 ................
+0030 00 00 14 00 00 08 04 00-00 00 00 00 00 00 15 00 ................
+0040 00 08 04 00 00 00 00 00-00 00 16 00 00 08 02 00 ................
+0050 00 00 01 00 - ....
+
+0000 d0 00 00 00 02 00 07 91-04 00 00 00 10 00 00 08 ................
+0010 14 00 00 00 14 00 00 00-01 00 01 00 00 00 00 00 ................
+0020 06 00 00 00 38 03 00 00-11 00 00 08 14 00 00 00 ....8...........
+0030 14 00 00 00 01 00 01 00-00 00 00 00 05 00 00 00 ................
+0040 c8 00 00 00 12 00 00 08-14 00 00 00 14 00 00 00 ................
+0050 01 00 01 00 00 00 00 00-01 00 00 00 36 00 00 00 ............6...
+0060 13 00 00 08 14 00 00 00-14 00 00 00 01 00 01 00 ................
+0070 00 00 00 00 01 00 00 00-2a 00 00 00 14 00 00 08 ........*.......
+0080 14 00 00 00 14 00 00 00-01 00 01 00 00 00 00 00 ................
+0090 02 00 00 00 9e 00 00 00-15 00 00 08 14 00 00 00 ................
+00a0 14 00 00 00 01 00 01 00-00 00 00 00 02 00 00 00 ................
+00b0 9e 00 00 00 16 00 00 08-14 00 00 00 14 00 00 00 ................
+00c0 01 00 01 00 00 00 00 00-01 00 00 00 2c 00 00 00 ............,...
+ */
+#define PTP_DPC_PANASONIC_08000091 0x08000091 /* SetupFilesConfig_Set_Target */
+/*
+0000 16 00 00 00 02 00 0a 94-04 00 00 00 91 00 00 08 ................
+0010 02 00 00 00 00 00 - ......
+
+0000 44 00 00 00 02 00 07 91-04 00 00 00 90 00 00 08 D...............
+0010 14 00 00 00 14 00 00 00-01 00 01 00 00 00 00 00 ................
+0020 01 00 00 00 48 00 00 00-91 00 00 08 14 00 00 00 ....H...........
+0030 14 00 00 00 01 00 01 00-00 00 00 00 01 00 00 00 ................
+0040 2c 00 00 00 - ,...
+ */
+
+#define PTP_DPC_PANASONIC_GetFreeSpaceInImages 0x12000010
+/*
+0000 98 00 00 00 02 00 14 94-04 00 00 00 11 00 00 12 ................
+0010 04 00 00 00 4e 00 00 00-12 00 00 12 04 00 00 00 ....N...........
+0020 00 00 00 00 13 00 00 12-02 00 00 00 00 00 14 00 ................
+0030 00 12 04 00 00 00 00 00-00 00 15 00 00 12 06 00 ................
+0040 00 00 02 00 01 00 00 00-16 00 00 12 3a 00 00 00 ............:...
+0050 02 00 4e 00 00 00 00 00-00 00 4e 00 00 00 ff ff ..N.......N.....
+0060 ff ff 00 00 00 00 ff ff-ff ff 00 00 00 00 00 00 ................
+0070 00 00 00 00 00 00 ff ff-ff ff 00 00 00 00 ff ff ................
+0080 ff ff 00 00 00 00 00 00-00 00 17 00 00 12 06 00 ................
+0090 00 00 00 00 00 00 00 00- ........
+ */
+#define PTP_DPC_PANASONIC_GetBatteryInfo 0x16000010
+/*
+0000 1c 00 00 00 02 00 14 94-04 00 00 00 11 00 00 16 ................
+0010 08 00 00 00 4b 00 00 00-4b 00 ff ff ....K...K...
+ */
+#define PTP_DPC_PANASONIC_LensGetMFBar 0x12010040
+/* 15c00010 GetSetupInfo Error */
+/* 18000010 GetUSBSpeed */
+
/* MTP specific Object Properties */
#define PTP_OPC_StorageID 0xDC01
@@ -2510,7 +2666,6 @@ typedef uint16_t (* PTPIOGetResp) (PTPParams* params, PTPContainer* resp);
typedef uint16_t (* PTPIOGetData) (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *putter);
typedef uint16_t (* PTPIOCancelReq) (PTPParams* params, uint32_t transaction_id);
-typedef uint16_t (* PTPIODevStatReq) (PTPParams* params);
/* debug functions */
typedef void (* PTPErrorFunc) (void *data, const char *format, va_list args)
@@ -2572,7 +2727,6 @@ struct _PTPParams {
PTPIOGetResp event_check_queue;
PTPIOGetResp event_wait;
PTPIOCancelReq cancelreq_func;
- PTPIODevStatReq devstatreq_func;
/* Custom error and debug function */
PTPErrorFunc error_func;
@@ -2683,8 +2837,6 @@ uint16_t ptp_usb_control_get_extended_event_data (PTPParams *params, char *buffe
uint16_t ptp_usb_control_device_reset_request (PTPParams *params);
uint16_t ptp_usb_control_get_device_status (PTPParams *params, char *buffer, int *size);
uint16_t ptp_usb_control_cancel_request (PTPParams *params, uint32_t transid);
-uint16_t ptp_usb_control_cancel_request (PTPParams *params, uint32_t transid);
-uint16_t ptp_usb_control_device_status_request (PTPParams *params);
int ptp_ptpip_connect (PTPParams* params, const char *port);
@@ -3440,6 +3592,9 @@ uint16_t ptp_olympus_opensession (PTPParams*, unsigned char**, unsigned int *);
#define ptp_olympus_capture(params,p1) ptp_generic_no_data (params, PTP_OC_OLYMPUS_Capture, 1, p1)
uint16_t ptp_olympus_getcameraid (PTPParams*, unsigned char**, unsigned int *);
+uint16_t ptp_olympus_omd_capture (PTPParams* params);
+uint16_t ptp_olympus_omd_move_focus (PTPParams* params, uint32_t direction, uint32_t step_size);
+
/* Non PTP protocol functions */
static inline int
ptp_operation_issupported(PTPParams* params, uint16_t operation)
@@ -3559,7 +3714,25 @@ uint16_t ptp_chdk_call_function(PTPParams* params, int *args, int size, int *ret
uint16_t ptp_fuji_getevents (PTPParams* params, uint16_t** events, uint16_t* count);
+#define ptp_panasonic_liveview(params,enable) ptp_generic_no_data(params,PTP_OC_PANASONIC_Liveview,1,enable?0xD000010:0xD000011)
+uint16_t ptp_panasonic_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size);
+
+uint16_t ptp_panasonic_setdeviceproperty (PTPParams* params, uint32_t propcode, unsigned char *value, uint16_t valuesize);
+uint16_t ptp_panasonic_getdeviceproperty (PTPParams *params, uint32_t propcode, uint16_t *valuesize, uint32_t *currentValue);
+uint16_t ptp_panasonic_getdevicepropertydesc (PTPParams *params, uint32_t propcode, uint16_t valuesize, uint32_t *currentValue, uint32_t **propertyValueList, uint32_t *propertyValueListLength);
+uint16_t ptp_panasonic_getdevicepropertysize (PTPParams *params, uint32_t propcode);
+
+
+
+uint16_t ptp_olympus_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size);
+#define ptp_olympus_omd_move_focus(params,direction,step_size) ptp_generic_no_data(params,PTP_OC_OLYMPUS_OMD_MFDrive,2,direction,step_size)
+uint16_t ptp_olympus_omd_capture (PTPParams* params);
+uint16_t ptp_olympus_init_pc_mode (PTPParams* params);
+uint16_t ptp_olympus_sdram_image (PTPParams* params, unsigned char **data, unsigned int *size);
+
+
+#define ptp_panasonic_capture(params) ptp_generic_no_data(params,PTP_OC_PANASONIC_InitiateCapture,1,0x3000011)
#ifdef __cplusplus
}