From: <mar...@us...> - 2011-08-24 14:50:55
|
Revision: 13687 http://gphoto.svn.sourceforge.net/gphoto/?rev=13687&view=rev Author: marcusmeissner Date: 2011-08-24 14:50:49 +0000 (Wed, 24 Aug 2011) Log Message: ----------- 2 olympus usb opcodes, typo fix fasttimeout merge from 2.4 branch Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/ptp.h trunk/libgphoto2/camlibs/ptp2/usb.c Modified: trunk/libgphoto2/camlibs/ptp2/ptp.h =================================================================== --- trunk/libgphoto2/camlibs/ptp2/ptp.h 2011-08-24 14:09:02 UTC (rev 13686) +++ trunk/libgphoto2/camlibs/ptp2/ptp.h 2011-08-24 14:50:49 UTC (rev 13687) @@ -541,6 +541,8 @@ #define PTP_OC_OLYMPUS_GetCameraControlMode 0x910a #define PTP_OC_OLYMPUS_SetCameraControlMode 0x910b #define PTP_OC_OLYMPUS_SetWBRGBGain 0x910c +#define PTP_OC_OLYMPUS_GetDeviceInfo 0x9301 +#define PTP_OC_OLYMPUS_Init1 0x9302 #define PTP_OC_OLYMPUS_SetDateTime 0x9402 #define PTP_OC_OLYMPUS_GetDateTime 0x9482 #define PTP_OC_OLYMPUS_SetCameraID 0x9501 @@ -1732,7 +1734,7 @@ #define PTP_DPC_OLYMPUS_CustomWB 0xD10B #define PTP_DPC_OLYMPUS_CustomWBValue 0xD10C #define PTP_DPC_OLYMPUS_ExposureTimeEx 0xD10D -#define PTP_DPC_OLYMPUS_BulbModeee 0xD10E +#define PTP_DPC_OLYMPUS_BulbMode 0xD10E #define PTP_DPC_OLYMPUS_AntiMirrorMode 0xD10F #define PTP_DPC_OLYMPUS_AEBracketingFrame 0xD110 #define PTP_DPC_OLYMPUS_AEBracketingStep 0xD111 Modified: trunk/libgphoto2/camlibs/ptp2/usb.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/usb.c 2011-08-24 14:09:02 UTC (rev 13686) +++ trunk/libgphoto2/camlibs/ptp2/usb.c 2011-08-24 14:50:49 UTC (rev 13687) @@ -60,9 +60,7 @@ #define PTP_CNT_INIT(cnt) {memset(&cnt,0,sizeof(cnt));} /* PTP2_FAST_TIMEOUT: how long (in milliseconds) we should wait for - * an URB to come back on an interrupt endpoint - * 50 is insufficient. - */ + * an URB to come back on an interrupt endpoint */ #define PTP2_FAST_TIMEOUT 100 /* Pack / unpack functions */ @@ -158,6 +156,7 @@ written = 0; while(bytes_left_to_transfer > 0) { unsigned long readlen, toread, oldwritten = written; + int res; toread = 4096; if (toread > bytes_left_to_transfer) @@ -298,6 +297,7 @@ ); /* stuff data directly to passed data handler */ while (1) { + unsigned long written; int result = gp_port_read (camera->port, (char*)data, PTP_USB_BULK_HS_MAX_PACKET_LEN_READ); if (result < 0) { free (data); @@ -370,6 +370,7 @@ curread = 0; res = 0; while (bytes_to_read > 0) { unsigned long toread = bytes_to_read; + int res; /* read in large blobs. * if smaller than large blob, read all but the last short packet @@ -485,11 +486,16 @@ static inline uint16_t ptp_usb_event (PTPParams* params, PTPContainer* event, int wait) { - int result, timeout; + int result, timeout, fasttimeout; unsigned long rlen; PTPUSBEventContainer usbevent; Camera *camera = ((PTPData *)params->data)->camera; + if (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) + fasttimeout = PTP2_FAST_TIMEOUT*2; + else + fasttimeout = PTP2_FAST_TIMEOUT; + PTP_CNT_INIT(usbevent); if (event==NULL) @@ -502,7 +508,7 @@ break; case PTP_EVENT_CHECK_FAST: gp_port_get_timeout (camera->port, &timeout); - gp_port_set_timeout (camera->port, PTP2_FAST_TIMEOUT); + gp_port_set_timeout (camera->port, fasttimeout); result = gp_port_check_int (camera->port, (char*)&usbevent, sizeof(usbevent)); if (result <= 0) result = gp_port_check_int (camera->port, (char*)&usbevent, sizeof(usbevent)); gp_port_set_timeout (camera->port, timeout); @@ -517,7 +523,7 @@ return PTP_ERROR_IO; } if (result == 0) { - gp_log (GP_LOG_DEBUG, "ptp2/usb_event", "reading event a 0 read occurred, reporting timeout."); + gp_log (GP_LOG_DEBUG, "ptp2/usb_event", "reading event an 0 read occurred, assuming timeout."); return PTP_ERROR_TIMEOUT; } rlen = result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |