diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2010-01-22 19:21:59 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2010-01-22 19:21:59 +0000 |
commit | 2ad29985c992d6a7ac08ea75939b711a4c522021 (patch) | |
tree | b61f0b8eba98fa8152595f03c148983e6396fee4 | |
parent | aae28ab85238cdc41322b455ee9b5f48e5b729b9 (diff) | |
download | libgphoto2-2ad29985c992d6a7ac08ea75939b711a4c522021.tar.gz |
fixed the opensession code check for bad sequence ids (was wrong).
do not attempt to handle storage ids with 0x0000 lower bytes (do hang)
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_4/libgphoto2@12624 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | camlibs/ptp2/library.c | 8 | ||||
-rw-r--r-- | camlibs/ptp2/ptp.c | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 7d46aa106..c48c6b4a9 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -3090,11 +3090,10 @@ camera_summary (Camera* camera, CameraText* summary, GPContext *context) char tmpname[20], *s; PTPStorageInfo storageinfo; -#if 0 /* EOS testing */ + /* invalid storage, storageinfo might fail on it (Nikon D300s e.g.) */ if ((storageids.Storage[i]&0x0000ffff)==0) continue; -#endif - + n = snprintf (txt, spaceleft,"store_%08x:\n",(unsigned int)storageids.Storage[i]); if (n>=spaceleft) return GP_OK;spaceleft-=n;txt+=n; @@ -3393,9 +3392,8 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, for (i=0; i<storageids.n; i++) { char fname[PTP_MAXSTRLEN]; -#if 0 /* EOS has 2 entries, one with 0 in minor ... lets check */ + /* invalid storage, storageinfo might fail on it (Nikon D300s e.g.) */ if ((storageids.Storage[i]&0x0000ffff)==0) continue; -#endif snprintf(fname, sizeof(fname), STORAGE_FOLDER_PREFIX"%08x", storageids.Storage[i]); diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index 3c9c30bbc..d9370feb7 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -139,7 +139,8 @@ ptp_transaction_new (PTPParams* params, PTPContainer* ptp, uint16_t flags, unsigned int sendlen, PTPDataHandler *handler ) { - int tries; + int tries; + uint16_t cmd = ptp->Code; if ((params==NULL) || (ptp==NULL)) return PTP_ERROR_BADPARAM; @@ -207,7 +208,7 @@ ptp_transaction_new (PTPParams* params, PTPContainer* ptp, } if (ptp->Transaction_ID != params->transaction_id-1) { /* try to clean up potential left overs from previous session */ - if ((ptp->Code == PTP_OC_OpenSession) && tries) + if ((cmd == PTP_OC_OpenSession) && tries) continue; ptp_error (params, "PTP: Sequence number mismatch %d vs expected %d.", |