diff options
author | Linus Walleij <triad@df.lth.se> | 2009-01-14 21:39:50 +0000 |
---|---|---|
committer | Linus Walleij <triad@df.lth.se> | 2009-01-14 21:39:50 +0000 |
commit | f67c1ada12299062333b7d622509b403ab925e8a (patch) | |
tree | f1f159293e4b969d2ffbf493635eca2e3860c26d | |
parent | ae6c3fda344b303de235328ffa3325b26f36e6f3 (diff) | |
download | libmtp-f67c1ada12299062333b7d622509b403ab925e8a.tar.gz |
Fix a new device bug flag for broken sendobjproplist
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/device-flags.h | 9 | ||||
-rw-r--r-- | src/libmtp.c | 7 | ||||
-rw-r--r-- | src/libusb-glue.c | 19 | ||||
-rw-r--r-- | src/libusb-glue.h | 2 | ||||
-rw-r--r-- | src/music-players.h | 3 |
6 files changed, 44 insertions, 4 deletions
@@ -1,3 +1,11 @@ +2009-01-14 Linus Walleij <triad@df.lth.se> + + * src/device-flags.h: new device flag for broken + SendObjectPropList, as found broken in MEU202 + * src/music-players.h: use the new flag. + * src/libmtp.c: implement this device flag. + * src/libusb-glue.h: dito. + 2009-01-10 Linus Walleij <triad@df.lth.se> * src/libmtp.h.in: mingw32 fixes from James Ravenscroft. diff --git a/src/device-flags.h b/src/device-flags.h index 005e46e..2eb092b 100644 --- a/src/device-flags.h +++ b/src/device-flags.h @@ -190,3 +190,12 @@ * be set properly the first time a file is sent. */ #define DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED 0x00004000 +/** + * This avoids use of the send object proplist which + * is used when creating new objects (not just updating) + * The DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST is related + * but only concerns the case where the object proplist + * is sent in to update an existing object. The Toshiba + * Gigabeat MEU202 for example has this problem. + */ +#define DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST 0x00008000 diff --git a/src/libmtp.c b/src/libmtp.c index df65c67..2956a8a 100644 --- a/src/libmtp.c +++ b/src/libmtp.c @@ -4362,7 +4362,8 @@ int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *device, of = PTP_OFC_Undefined; } - if (ptp_operation_issupported(params,PTP_OC_MTP_SendObjectPropList)) { + if (ptp_operation_issupported(params, PTP_OC_MTP_SendObjectPropList) && + !FLAG_BROKEN_SEND_OBJECT_PROPLIST(ptp_usb)) { /* * MTP enhanched does it this way (from a sniff): * -> PTP_OC_MTP_SendObjectPropList (0x9808): @@ -5858,8 +5859,8 @@ static int create_new_abstract_list(LIBMTP_mtpdevice_t *device, fname[sizeof(fname)-1] = '\0'; } - if (ptp_operation_issupported(params,PTP_OC_MTP_SendObjectPropList)) { - + if (ptp_operation_issupported(params, PTP_OC_MTP_SendObjectPropList) && + !FLAG_BROKEN_SEND_OBJECT_PROPLIST(ptp_usb)) { MTPProperties *props = NULL; MTPProperties *prop = NULL; int nrofprops = 0; diff --git a/src/libusb-glue.c b/src/libusb-glue.c index d7cab1d..f6964a0 100644 --- a/src/libusb-glue.c +++ b/src/libusb-glue.c @@ -251,6 +251,25 @@ static int probe_device_descriptor(struct usb_device *dev, FILE *dumpfile) usb_close(devh); return 1; } +#ifdef LIBUSB_HAS_GET_DRIVER_NP + { + /* + * Specifically avoid probing anything else than USB mass storage devices + * and non-associated drivers in Linux. + */ + char devname[0x10]; + + devname[0] = '\0'; + ret = usb_get_driver_np(devh, + dev->config[i].interface[j].altsetting[k].iInterface, + devname, + sizeof(devname)); + if (devname[0] != '\0' && strcmp(devname, "usb-storage")) { + printf("avoid probing device using kernel interface \"%s\"\n", devname); + return 0; + } + } +#endif } } } diff --git a/src/libusb-glue.h b/src/libusb-glue.h index e00f2ac..6af8072 100644 --- a/src/libusb-glue.h +++ b/src/libusb-glue.h @@ -103,6 +103,8 @@ void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout); ((a)->rawdevice.device_entry.device_flags & (DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_PLAYLIST_SPL_V2)) #define FLAG_CANNOT_HANDLE_DATEMODIFIED(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED) +#define FLAG_BROKEN_SEND_OBJECT_PROPLIST(a) \ + ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST) /* connect_first_device return codes */ #define PTP_CD_RC_CONNECTED 0 diff --git a/src/music-players.h b/src/music-players.h index 84cc688..c5aab4f 100644 --- a/src/music-players.h +++ b/src/music-players.h @@ -405,7 +405,8 @@ // Reported by Michael Davis <slithy@yahoo.com> { "Toshiba", 0x0930, "Gigabeat U", 0x0016, DEVICE_FLAG_NONE }, // Reported by Devon Jacobs <devo@godevo.com> - { "Toshiba", 0x0930, "Gigabeat MEU202", 0x0018, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, + { "Toshiba", 0x0930, "Gigabeat MEU202", 0x0018, + DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Rolf <japan (at) dl3lar.de> { "Toshiba", 0x0930, "Gigabeat T", 0x0019, DEVICE_FLAG_NONE }, // Reported by Phil Ingram <ukpbert@users.sourceforge.net> |