ptp_eos_getstorageids done correctly and used correctly
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@11060 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2008-03-31 Marcus Meissner <marcus@jet.franken.de>
|
||||
|
||||
* ptp.c, ptp.h, config.c: Try to fix EOS capture preparation,
|
||||
by doing a real ptp_eos_getstorageids.
|
||||
|
||||
2008-03-15 Marcus Meissner <marcus@jet.franken.de>
|
||||
|
||||
* library.c: Adjust for GPPortInfo change.
|
||||
|
||||
@@ -149,6 +149,7 @@ camera_prepare_canon_eos_capture(Camera *camera, GPContext *context) {
|
||||
PTPCanon_changes_entry *entries = NULL;
|
||||
int nrofentries = 0;
|
||||
unsigned char startup9110[12];
|
||||
PTPStorageIDs sids;
|
||||
|
||||
ret = ptp_canon_eos_setremotemode(params, 1);
|
||||
if (ret != PTP_RC_OK) {
|
||||
@@ -191,25 +192,17 @@ camera_prepare_canon_eos_capture(Camera *camera, GPContext *context) {
|
||||
gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "getdeviceinfo failed!");
|
||||
return GP_ERROR;
|
||||
}
|
||||
ret = ptp_canon_eos_getstorageids(params);
|
||||
ret = ptp_canon_eos_getstorageids(params, &sids);
|
||||
if (ret != PTP_RC_OK) {
|
||||
gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9101 failed!");
|
||||
return GP_ERROR;
|
||||
}
|
||||
ret = ptp_canon_eos_getstorageinfo(params, 1);
|
||||
if (ret != PTP_RC_OK) {
|
||||
gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9102 failed!");
|
||||
return GP_ERROR;
|
||||
}
|
||||
ret = ptp_canon_eos_getstorageids(params);
|
||||
if (ret != PTP_RC_OK) {
|
||||
gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9101 failed!");
|
||||
return GP_ERROR;
|
||||
}
|
||||
ret = ptp_canon_eos_getstorageinfo(params, 1);
|
||||
if (ret != PTP_RC_OK) {
|
||||
gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9102 failed!");
|
||||
return GP_ERROR;
|
||||
if (sids.n >= 1) {
|
||||
ret = ptp_canon_eos_getstorageinfo(params, sids.Storage[0]);
|
||||
if (ret != PTP_RC_OK) {
|
||||
gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9102 failed!");
|
||||
return GP_ERROR;
|
||||
}
|
||||
}
|
||||
/* just exchange the value to 4 */
|
||||
startup9110[8] = 0x04; startup9110[9] = 0x00; startup9110[10] = 0x00; startup9110[11] = 0x00;
|
||||
|
||||
@@ -1424,6 +1424,7 @@ camera_canon_eos_capture (Camera *camera, CameraCaptureType type, CameraFilePath
|
||||
continue;
|
||||
}
|
||||
for (i=0;i<nrofentries;i++) {
|
||||
gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_capture", "entry type %04x", entries[i].type);
|
||||
if (entries[i].type == PTP_CANON_EOS_CHANGES_TYPE_OBJECTINFO) {
|
||||
gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_capture", "Found new object! OID %ux, name %s", (unsigned int)entries[i].u.object.oid, entries[i].u.object.oi.Filename);
|
||||
newobject = entries[i].u.object.oid;
|
||||
|
||||
@@ -1849,18 +1849,19 @@ ptp_canon_eos_getdevicepropdesc (PTPParams* params, uint16_t propcode,
|
||||
|
||||
|
||||
uint16_t
|
||||
ptp_canon_eos_getstorageids (PTPParams* params)
|
||||
ptp_canon_eos_getstorageids (PTPParams* params, PTPStorageIDs* storageids)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
unsigned char *data = NULL;
|
||||
unsigned int size = 0;
|
||||
PTPContainer ptp;
|
||||
unsigned int len = 0;
|
||||
uint16_t ret;
|
||||
unsigned char* sids=NULL;
|
||||
|
||||
PTP_CNT_INIT(ptp);
|
||||
ptp.Code = PTP_OC_CANON_EOS_GetStorageIDs;
|
||||
ptp.Nparam = 0;
|
||||
ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size);
|
||||
/* FIXME: do stuff with data */
|
||||
ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &sids, &len);
|
||||
if (ret == PTP_RC_OK) ptp_unpack_SIDs(params, sids, storageids, len);
|
||||
free(sids);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1707,7 +1707,7 @@ uint16_t ptp_canon_get_customize_data (PTPParams* params, uint32_t themenr,
|
||||
unsigned char **data, unsigned int *size);
|
||||
uint16_t ptp_canon_getpairinginfo (PTPParams* params, uint32_t nr, unsigned char**, unsigned int*);
|
||||
|
||||
uint16_t ptp_canon_eos_getstorageids (PTPParams* params);
|
||||
uint16_t ptp_canon_eos_getstorageids (PTPParams* params, PTPStorageIDs* storageids);
|
||||
uint16_t ptp_canon_eos_getstorageinfo (PTPParams* params, uint32_t p1);
|
||||
uint16_t ptp_canon_eos_getpartialobject (PTPParams* params, uint32_t oid, uint32_t off, uint32_t xsize, unsigned char**data);
|
||||
uint16_t ptp_canon_eos_setdevicepropvalueex (PTPParams* params, unsigned char* data, unsigned int size);
|
||||
|
||||
Reference in New Issue
Block a user