diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2017-02-24 12:04:06 +0100 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2017-02-24 12:04:06 +0100 |
commit | 850ba537f131c375627d120b4698e3cf477ce1ef (patch) | |
tree | d5e0f1a21b299eba526c618e8d1d748a77059bb4 | |
parent | 717cd61ff41b96a6671fd4af43f1dd63202a5319 (diff) | |
download | libgphoto2-850ba537f131c375627d120b4698e3cf477ce1ef.tar.gz |
Sony A7r II also is liveview capable
sony liveview occasionaly resulted in accessdenied, try again
-rw-r--r-- | camlibs/ptp2/library.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 08a71191f..e6b831f9d 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -955,7 +955,7 @@ static struct { {"Sony:ILCE-7M2 (Control)", 0x054c, 0x0a6a, PTP_CAP}, /* Andre Crone, andre@elysia.nl */ - {"Sony:Alpha-A7r II (Control)", 0x054c, 0x0a6b, PTP_CAP}, + {"Sony:Alpha-A7r II (Control)", 0x054c, 0x0a6b, PTP_CAP|PTP_CAP_PREVIEW}, /* Andre Crone <andre@elysia.nl> */ {"Sony:DSC-RX100M4", 0x054c, 0x0a6d, 0}, @@ -2796,10 +2796,16 @@ enable_liveview: } case PTP_VENDOR_SONY: { uint32_t preview_object = 0xffffc002; /* this is where the liveview image is accessed */ + unsigned char *ximage = NULL; + int tries = 20; - unsigned char *ximage = NULL; - - C_PTP_REP (ptp_getobject_with_size(params, preview_object, &ximage, &size)); + do { + ret = ptp_getobject_with_size(params, preview_object, &ximage, &size); + if (ret == PTP_RC_OK) + break; + if (ret != PTP_RC_AccessDenied) /* we get those when we are too fast */ + C_PTP (ret); + } while (tries--); /* look for the JPEG SOI marker (0xFFD8) in data */ jpgStartPtr = (unsigned char*)memchr(ximage, 0xff, size); |