Linus Walleij | 3e667ae | 2007-10-29 23:29:39 +0000 | [diff] [blame^] | 1 | /** |
| 2 | * \file device-flags.h |
| 3 | * Special device flags to deal with bugs in specific devices. |
| 4 | * |
| 5 | * Copyright (C) 2005-2007 Richard A. Low <richard@wentnet.com> |
| 6 | * Copyright (C) 2005-2007 Linus Walleij <triad@df.lth.se> |
| 7 | * Copyright (C) 2006-2007 Marcus Meissner |
| 8 | * Copyright (C) 2007 Ted Bullock |
| 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Lesser General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public |
| 21 | * License along with this library; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
| 25 | * This file is supposed to be included by both libmtp and libgphoto2. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * These flags are used to indicate if some or other |
| 30 | * device need special treatment. These should be possible |
| 31 | * to concatenate using logical OR so please use one bit per |
| 32 | * feature and lets pray we don't need more than 32 bits... |
| 33 | */ |
| 34 | #define DEVICE_FLAG_NONE 0x00000000 |
| 35 | /** |
| 36 | * This means that the PTP_OC_MTP_GetObjPropList is broken |
| 37 | * in the sense that it won't return properly formatted metadata |
| 38 | * for ALL files on the device when you request an object |
| 39 | * property list for object 0xFFFFFFFF with parameter 3 likewise |
| 40 | * set to 0xFFFFFFFF. Compare to |
| 41 | * DEVICE_FLAG_BROKEN_MTPGETOBJECTPROPLIST which only signify |
| 42 | * that it's broken when getting metadata for a SINGLE object. |
| 43 | * A typical way the implementation may be broken is that it |
| 44 | * may not return a proper count of the objects. |
| 45 | */ |
| 46 | #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL 0x00000001 |
| 47 | /** |
| 48 | * This means that under Linux, another kernel module may |
| 49 | * be using this device's USB interface, so we need to detach |
| 50 | * it if it is. Typically this is on dual-mode devices that |
| 51 | * will present both an MTP compliant interface and device |
| 52 | * descriptor *and* a USB mass storage interface. If the USB |
| 53 | * mass storage interface is in use, other apps (like our |
| 54 | * userspace libmtp through libusb access path) cannot get in |
| 55 | * and get cosy with it. So we can remove the offending |
| 56 | * application. Typically this means you have to run the program |
| 57 | * as root as well. |
| 58 | */ |
| 59 | #define DEVICE_FLAG_UNLOAD_DRIVER 0x00000002 |
| 60 | /** |
| 61 | * This means that the PTP_OC_MTP_GetObjPropList is broken and |
| 62 | * won't properly return all object properties if parameter 3 |
| 63 | * is set to 0xFFFFFFFFU. |
| 64 | */ |
| 65 | #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST 0x00000004 |
| 66 | /** |
| 67 | * This means the device doesn't send zero packets to indicate |
| 68 | * end of transfer when the transfer boundary occurs at a |
| 69 | * multiple of 64 bytes (the USB 1.1 endpoint size). Instead, |
| 70 | * exactly one extra byte is sent at the end of the transfer |
| 71 | * if the size is an integer multiple of USB 1.1 endpoint size |
| 72 | * (64 bytes). |
| 73 | * |
| 74 | * This behaviour is most probably a workaround due to the fact |
| 75 | * that the hardware USB slave controller in the device cannot |
| 76 | * handle zero writes at all, and the usage of the USB 1.1 |
| 77 | * endpoint size is due to the fact that the device will "gear |
| 78 | * down" on a USB 1.1 hub, and since 64 bytes is a multiple of |
| 79 | * 512 bytes, it will work with USB 1.1 and USB 2.0 alike. |
| 80 | */ |
| 81 | #define DEVICE_FLAG_NO_ZERO_READS 0x00000008 |
| 82 | /** |
| 83 | * This flag means that the device is prone to forgetting the |
| 84 | * OGG container file type, so that libmtp must look at the |
| 85 | * filename extensions in order to determine that a file is |
| 86 | * actually OGG. This is a clear and present firmware bug, and |
| 87 | * while firmware bugs should be fixed in firmware, we like |
| 88 | * OGG so much that we back it by introducing this flag. |
| 89 | * The error has only been seen on iriver devices. Turning this |
| 90 | * flag on won't hurt anything, just that the check against |
| 91 | * filename extension will be done for files of "unknown" type. |
| 92 | */ |
| 93 | #define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010 |
| 94 | /** |
| 95 | * This flag indicates a limitation in the filenames a device |
| 96 | * can accept - they must be 7 bit (all chars <= 127/0x7F). |
| 97 | * It was found first on the Philips Shoqbox, and is a deviation |
| 98 | * from the PTP standard which mandates that any unicode chars |
| 99 | * may be used for filenames. I guess this is caused by a 7bit-only |
| 100 | * filesystem being used intrinsically on the device. |
| 101 | */ |
| 102 | #define DEVICE_FLAG_ONLY_7BIT_FILENAMES 0x00000020 |
| 103 | /** |
| 104 | * This flag indicates that the device will lock up if you |
| 105 | * try to get status of endpoints and/or release the interface |
| 106 | * when closing the device. This fixes problems with SanDisk |
| 107 | * Sansa devices especially. It may be a side-effect of a |
| 108 | * Windows behaviour of never releasing interfaces. |
| 109 | */ |
| 110 | #define DEVICE_FLAG_NO_RELEASE_INTERFACE 0x00000040 |
| 111 | /** |
| 112 | * This flag was introduced with the advent of Creative ZEN |
| 113 | * 8GB. The device sometimes return a broken PTP header |
| 114 | * like this: < 1502 0000 0200 01d1 02d1 01d2 > |
| 115 | * the latter 6 bytes (representing "code" and "transaction ID") |
| 116 | * contain junk. This is breaking the PTP/MTP spec but works |
| 117 | * on Windows anyway, probably because the Windows implementation |
| 118 | * does not check that these bytes are valid. To interoperate |
| 119 | * with devices like this, we need this flag to emulate the |
| 120 | * Windows bug. |
| 121 | */ |
| 122 | #define DEVICE_FLAG_IGNORE_HEADER_ERRORS 0x00000080 |
| 123 | /** |
| 124 | * The Motorola RAZR2 V8 (others?) has broken set object |
| 125 | * proplist causing the metadata setting to fail. (The |
| 126 | * set object prop to set individual properties work on |
| 127 | * this device, but the metadata is plain ignored on |
| 128 | * tracks, though e.g. playlist names can be set.) |
| 129 | */ |
| 130 | #define DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST 0x000000100 |