Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: patches/02_check_ptp_operation_support.patch

Issue 2364793002: Revert "Uprev libmtp to 1.1.12" (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libmtp@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « patches/01_build_fixes.patch ('k') | patches/03_enable_ptp_support.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patches/02_check_ptp_operation_support.patch
diff --git a/patches/02_check_ptp_operation_support.patch b/patches/02_check_ptp_operation_support.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2338fefe562c2eab4faa9e13891916dd2d0de42c
--- /dev/null
+++ b/patches/02_check_ptp_operation_support.patch
@@ -0,0 +1,98 @@
+Index: src/libmtp.c
+===================================================================
+--- src/libmtp.c (revision 148597)
++++ src/libmtp.c (working copy)
+@@ -1144,6 +1144,9 @@
+ int supported = 0;
+ uint16_t ptp_prop = map_libmtp_property_to_ptp_property(property);
+
++ if (!ptp_operation_issupported(device->params, PTP_OC_MTP_GetObjectPropsSupported))
++ return 0;
++
+ ret = ptp_mtp_getobjectpropssupported(device->params, map_libmtp_type_to_ptp_type(filetype), &propcnt, &props);
+ if (ret != PTP_RC_OK) {
+ add_ptp_error_to_errorstack(device, ret, "LIBMTP_Is_Property_Supported(): could not get properties supported.");
+@@ -1974,40 +1977,42 @@
+ }
+
+ /* Determine if the object size supported is 32 or 64 bit wide */
+- for (i=0;i<current_params->deviceinfo.ImageFormats_len;i++) {
+- PTPObjectPropDesc opd;
++ if (ptp_operation_issupported(current_params,PTP_OC_MTP_GetObjectPropsSupported)) {
++ for (i=0;i<current_params->deviceinfo.ImageFormats_len;i++) {
++ PTPObjectPropDesc opd;
+
+- if (ptp_mtp_getobjectpropdesc(current_params,
+- PTP_OPC_ObjectSize,
+- current_params->deviceinfo.ImageFormats[i],
+- &opd) != PTP_RC_OK) {
+- LIBMTP_ERROR("LIBMTP PANIC: "
+- "could not inspect object property descriptions!\n");
+- } else {
+- if (opd.DataType == PTP_DTC_UINT32) {
+- if (bs == 0) {
+- bs = 32;
+- } else if (bs != 32) {
+- LIBMTP_ERROR("LIBMTP PANIC: "
+- "different objects support different object sizes!\n");
+- bs = 0;
+- break;
+- }
+- } else if (opd.DataType == PTP_DTC_UINT64) {
+- if (bs == 0) {
+- bs = 64;
+- } else if (bs != 64) {
+- LIBMTP_ERROR("LIBMTP PANIC: "
+- "different objects support different object sizes!\n");
+- bs = 0;
+- break;
+- }
++ if (ptp_mtp_getobjectpropdesc(current_params,
++ PTP_OPC_ObjectSize,
++ current_params->deviceinfo.ImageFormats[i],
++ &opd) != PTP_RC_OK) {
++ LIBMTP_ERROR("LIBMTP PANIC: "
++ "could not inspect object property descriptions!\n");
+ } else {
+- // Ignore if other size.
+- LIBMTP_ERROR("LIBMTP PANIC: "
+- "awkward object size data type: %04x\n", opd.DataType);
+- bs = 0;
+- break;
++ if (opd.DataType == PTP_DTC_UINT32) {
++ if (bs == 0) {
++ bs = 32;
++ } else if (bs != 32) {
++ LIBMTP_ERROR("LIBMTP PANIC: "
++ "different objects support different object sizes!\n");
++ bs = 0;
++ break;
++ }
++ } else if (opd.DataType == PTP_DTC_UINT64) {
++ if (bs == 0) {
++ bs = 64;
++ } else if (bs != 64) {
++ LIBMTP_ERROR("LIBMTP PANIC: "
++ "different objects support different object sizes!\n");
++ bs = 0;
++ break;
++ }
++ } else {
++ // Ignore if other size.
++ LIBMTP_ERROR("LIBMTP PANIC: "
++ "awkward object size data type: %04x\n", opd.DataType);
++ bs = 0;
++ break;
++ }
+ }
+ }
+ }
+@@ -4107,7 +4112,7 @@
+ break;
+ }
+ }
+- } else {
++ } else if (ptp_operation_issupported(params,PTP_OC_MTP_GetObjectPropsSupported)) {
+ uint16_t *props = NULL;
+ uint32_t propcnt = 0;
+ int ret;
« no previous file with comments | « patches/01_build_fixes.patch ('k') | patches/03_enable_ptp_support.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698