Add bug print for broken direct access on early Creative
models.
Signed-off-by: Linus Walleij <[email protected]>
diff --git a/src/libmtp.c b/src/libmtp.c
index f69b200..7f86c8d 100644
--- a/src/libmtp.c
+++ b/src/libmtp.c
@@ -4196,6 +4196,7 @@
uint32_t const parent)
{
PTPParams *params = (PTPParams *) device->params;
+ PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
LIBMTP_file_t *retfiles = NULL;
LIBMTP_file_t *curfile = NULL;
PTPObjectHandles currentHandles;
@@ -4211,6 +4212,17 @@
return NULL;
}
+ if (FLAG_BROKEN_GET_OBJECT_PROPVAL(ptp_usb)) {
+ // These devices cannot handle the commands needed for
+ // Uncached access!
+ LIBMTP_ERROR("tried to use %s on an unsupported device, "
+ "this command does not work on all devices "
+ "due to missing low-level support to read "
+ "information on individual tracks\n",
+ __func__);
+ return NULL;
+ }
+
if (storage == 0)
storageid = PTP_GOH_ALL_STORAGE;
else
diff --git a/src/libusb-glue.h b/src/libusb-glue.h
index 82461c4..a8179d7 100644
--- a/src/libusb-glue.h
+++ b/src/libusb-glue.h
@@ -156,6 +156,8 @@
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_LONG_TIMEOUT)
#define FLAG_FORCE_RESET_ON_CLOSE(a) \
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_FORCE_RESET_ON_CLOSE)
+#define FLAG_BROKEN_GET_OBJECT_PROPVAL(a) \
+ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_GET_OBJECT_PROPVAL)
/* connect_first_device return codes */
#define PTP_CD_RC_CONNECTED 0