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. |
Linus Walleij | 07bb538 | 2008-07-31 20:21:09 +0000 | [diff] [blame] | 92 | * If the player does not even know (reports) that it supports |
| 93 | * ogg even though it does, please use the stronger |
| 94 | * OGG_IS_UNKNOWN flag, which will forcedly support ogg on |
| 95 | * anything with the .ogg filename extension. |
Linus Walleij | 3e667ae | 2007-10-29 23:29:39 +0000 | [diff] [blame] | 96 | */ |
| 97 | #define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010 |
| 98 | /** |
| 99 | * This flag indicates a limitation in the filenames a device |
| 100 | * can accept - they must be 7 bit (all chars <= 127/0x7F). |
| 101 | * It was found first on the Philips Shoqbox, and is a deviation |
| 102 | * from the PTP standard which mandates that any unicode chars |
| 103 | * may be used for filenames. I guess this is caused by a 7bit-only |
| 104 | * filesystem being used intrinsically on the device. |
| 105 | */ |
| 106 | #define DEVICE_FLAG_ONLY_7BIT_FILENAMES 0x00000020 |
| 107 | /** |
| 108 | * This flag indicates that the device will lock up if you |
| 109 | * try to get status of endpoints and/or release the interface |
| 110 | * when closing the device. This fixes problems with SanDisk |
| 111 | * Sansa devices especially. It may be a side-effect of a |
| 112 | * Windows behaviour of never releasing interfaces. |
| 113 | */ |
| 114 | #define DEVICE_FLAG_NO_RELEASE_INTERFACE 0x00000040 |
| 115 | /** |
| 116 | * This flag was introduced with the advent of Creative ZEN |
| 117 | * 8GB. The device sometimes return a broken PTP header |
| 118 | * like this: < 1502 0000 0200 01d1 02d1 01d2 > |
| 119 | * the latter 6 bytes (representing "code" and "transaction ID") |
| 120 | * contain junk. This is breaking the PTP/MTP spec but works |
| 121 | * on Windows anyway, probably because the Windows implementation |
| 122 | * does not check that these bytes are valid. To interoperate |
| 123 | * with devices like this, we need this flag to emulate the |
| 124 | * Windows bug. |
| 125 | */ |
| 126 | #define DEVICE_FLAG_IGNORE_HEADER_ERRORS 0x00000080 |
| 127 | /** |
| 128 | * The Motorola RAZR2 V8 (others?) has broken set object |
| 129 | * proplist causing the metadata setting to fail. (The |
| 130 | * set object prop to set individual properties work on |
| 131 | * this device, but the metadata is plain ignored on |
| 132 | * tracks, though e.g. playlist names can be set.) |
| 133 | */ |
Linus Walleij | 335a81c | 2008-06-02 23:01:00 +0000 | [diff] [blame] | 134 | #define DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST 0x00000100 |
Linus Walleij | a3544f6 | 2007-11-30 01:20:04 +0000 | [diff] [blame] | 135 | /** |
| 136 | * The Samsung YP-T10 think Ogg files shall be sent with |
| 137 | * the "unknown" (PTP_OFC_Undefined) file type, this gives a |
| 138 | * side effect that is a combination of the iRiver Ogg Alzheimer |
| 139 | * problem (have to recognized Ogg files on file extension) |
| 140 | * and a need to report the Ogg support (the device itself does |
| 141 | * not properly claim to support it) and need to set filetype |
| 142 | * to unknown when storing Ogg files, even though they're not |
Linus Walleij | 07bb538 | 2008-07-31 20:21:09 +0000 | [diff] [blame] | 143 | * actually unknown. Later iRivers seem to need this flag since |
| 144 | * they do not report to support OGG even though they actually |
| 145 | * do. |
Linus Walleij | a3544f6 | 2007-11-30 01:20:04 +0000 | [diff] [blame] | 146 | */ |
Linus Walleij | 335a81c | 2008-06-02 23:01:00 +0000 | [diff] [blame] | 147 | #define DEVICE_FLAG_OGG_IS_UNKNOWN 0x00000200 |
Richard Low | bb9fb4a | 2008-05-18 14:49:34 +0000 | [diff] [blame] | 148 | /** |
| 149 | * The Creative Zen is quite unstable in libmtp but seems to |
| 150 | * be better with later firmware versions. However, it still |
| 151 | * frequently crashes when setting album art dimensions. This |
| 152 | * flag disables setting the dimensions (which seems to make |
| 153 | * no difference to how the graphic is displayed). |
| 154 | */ |
Linus Walleij | 335a81c | 2008-06-02 23:01:00 +0000 | [diff] [blame] | 155 | #define DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS 0x00000400 |
| 156 | /** |
| 157 | * Some devices, particularly SanDisk Sansas, need to always |
| 158 | * have their "OS Descriptor" probed in order to work correctly. |
| 159 | * This flag provides that extra massage. |
| 160 | */ |
| 161 | #define DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR 0x00000800 |
Linus Walleij | f3c4405 | 2008-08-16 21:14:56 +0000 | [diff] [blame^] | 162 | /** |
| 163 | * Samsung has implimented its own playlist format as a .spl file |
| 164 | * stored in the normal file system, rather than a proper mtp |
| 165 | * playlist. There are multiple versions of the .spl format |
| 166 | * identified by a line in the file: VERSION X.XX |
| 167 | * Version 1.00 is just a simple playlist. |
| 168 | */ |
| 169 | #define DEVICE_FLAG_PLAYLIST_SPL_V1 0x00001000 |
| 170 | /** |
| 171 | * Samsung has implimented its own playlist format as a .spl file |
| 172 | * stored in the normal file system, rather than a proper mtp |
| 173 | * playlist. There are multiple versions of the .spl format |
| 174 | * identified by a line in the file: VERSION X.XX |
| 175 | * Version 2.00 is playlist but allows DNSe sound settings |
| 176 | * to be stored, per playlist. |
| 177 | */ |
| 178 | #define DEVICE_FLAG_PLAYLIST_SPL_V2 0x00002000 |