summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Woloszyn <emsi@ipartners.pl>2002-05-16 13:14:13 +0000
committerMariusz Woloszyn <emsi@ipartners.pl>2002-05-16 13:14:13 +0000
commit01edf07f77f10966e1717c6302ee3a1d8acaa97e (patch)
treed4160f42fb0f014dba09767e7cb3d5968d893599
parent92fb2c4e1dc25637b6af1725ac9d9e4c5e033a93 (diff)
downloadlibgphoto2-01edf07f77f10966e1717c6302ee3a1d8acaa97e.tar.gz
Added ptp_getdeviceinfo
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4514 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r--camlibs/ptp/ptp.c33
-rw-r--r--camlibs/ptp/ptp.h4
2 files changed, 27 insertions, 10 deletions
diff --git a/camlibs/ptp/ptp.c b/camlibs/ptp/ptp.c
index b69b95afc..2721550ae 100644
--- a/camlibs/ptp/ptp.c
+++ b/camlibs/ptp/ptp.c
@@ -287,20 +287,35 @@ ptp_event_wait (PTPParams* params, PTPEvent* event) {
return PTP_RC_OK;
}
-// PTP operation functions
+/**
+ * PTP operation functions
+ *
+ * all ptp_ functions should take integer parameters
+ * in host byte order!
+ **/
+
-#if 0
-// Do GetDevInfo (we may use it for some camera_about)
+/**
+ * ptp_getdeviceinfo:
+ * params: PTPParams*
+ *
+ * Gets device info dataset and fills deviceinfo structure.
+ *
+ * Return values: Some PTP_RC_* code.
+ **/
uint16_t
-ptp_getdevinfo (PTPParams* params, PTPDeviceInfo* devinfo)
+ptp_getdeviceinfo (PTPParams* params, PTPDeviceInfo* deviceinfo)
{
+ uint16_t ret;
+ PTPReq di;
+ PTPReq req;
+
+ ret=ptp_transaction(params, &req, PTP_OC_GetDeviceInfo,
+ PTP_DP_GETDATA | PTP_RQ_PARAM0, PTP_REQ_DATALEN, &di);
+ ptp_unpack_DI(params, &di, deviceinfo);
+ return ret;
}
-#endif
-/**
- * all ptp_ functions should take integer parameters
- * in host byte order!
- **/
/**
* ptp_opensession:
diff --git a/camlibs/ptp/ptp.h b/camlibs/ptp/ptp.h
index 2038c65b2..d5d122ebb 100644
--- a/camlibs/ptp/ptp.h
+++ b/camlibs/ptp/ptp.h
@@ -56,7 +56,7 @@ typedef struct _PTPReq PTPReq;
// Operation Codes
#define PTP_OC_Undefined 0x1000
-#define PTP_OC_GetDevInfo 0x1001
+#define PTP_OC_GetDeviceInfo 0x1001
#define PTP_OC_OpenSession 0x1002
#define PTP_OC_CloseSession 0x1003
#define PTP_OC_GetStorageIDs 0x1004
@@ -362,6 +362,8 @@ typedef struct _PTPParams PTPParams;
uint16_t ptp_event_check (PTPParams* params, PTPEvent* event);
uint16_t ptp_event_wait (PTPParams* params, PTPEvent* event);
+uint16_t ptp_getdeviceinfo (PTPParams* params, PTPDeviceInfo* deviceinfo);
+
uint16_t ptp_opensession (PTPParams *params, uint32_t session);
uint16_t ptp_closesession (PTPParams *params);