From 6446e8c6124eeae131b21d2c8ceff24ed2bfa659 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 16 Aug 2014 11:15:17 +0000 Subject: [PATCH] if a DeviceProperytChanged event arrives, invalidate this properties cache git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15126 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/ptp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index cb01ae3ed..445e74a5c 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -2134,6 +2134,24 @@ store_event: if (ret == PTP_RC_OK) { ptp_debug (params, "event: nparams=0x%X, code=0x%X, trans_id=0x%X, p1=0x%X, p2=0x%X, p3=0x%X", event.Nparam,event.Code,event.Transaction_ID, event.Param1, event.Param2, event.Param3); ptp_add_event (params, &event); + + /* handle some PTP stack internal events */ + switch (event.Code) { + case PTP_EC_DevicePropChanged: { + unsigned int i; + + /* mark the property for a forced refresh on the next query */ + for (i=0;inrofdeviceproperties;i++) + if (params->deviceproperties[i].desc.DevicePropertyCode == event.Param1) { + params->deviceproperties[i].timestamp = 0; + break; + } + break; + } + default: /* check if we should handle it internally too */ + break; + } + } if (ret == PTP_ERROR_TIMEOUT) /* ok, just new events */ ret = PTP_RC_OK;