summaryrefslogtreecommitdiff
path: root/camlibs
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2022-12-19 13:55:03 +0100
committerMarcus Meissner <marcus@jet.franken.de>2022-12-19 13:55:03 +0100
commit4e212b3df3c250fe9af644e8f99094b372b3d1a8 (patch)
treefd0893ca801261b6a301e843936aedc70ab56076 /camlibs
parent0fc36ea617a31d95787768990f434317d6eed069 (diff)
downloadlibgphoto2-4e212b3df3c250fe9af644e8f99094b372b3d1a8.tar.gz
if we fail to spot a direction, use single stepping instead.
https://github.com/gphoto/libgphoto2/issues/694
Diffstat (limited to 'camlibs')
-rw-r--r--camlibs/ptp2/config.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index 42b3dc0b9..693ca2915 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -5281,11 +5281,24 @@ _put_Sony_ShutterSpeed(CONFIG_PUT_ARGS) {
break;
}
- // Calculating jump width
- if (direction > 0)
- value.u8 = 0x00 + position_new - position_current;
- else
- value.u8 = 0x100 + position_new - position_current;
+ /* If something failed, fall back to single step, https://github.com/gphoto/libgphoto2/issues/694 */
+ if (position_current == position_new) {
+ GP_LOG_D ("posNew and pos_current both %d, fall back to single step", position_current);
+ if (old > new) {
+ value.u8 = 0x01;
+ direction = 1;
+ }
+ else {
+ value.u8 = 0xff;
+ direction = -1;
+ }
+ } else {
+ // Calculating jump width
+ if (direction > 0)
+ value.u8 = 0x00 + position_new - position_current;
+ else
+ value.u8 = 0x100 + position_new - position_current;
+ }
a = dpd->CurrentValue.u32>>16;
b = dpd->CurrentValue.u32&0xffff;