• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, and sometimes
45  * (like on the ZENs) objects are simply missing from the list
46  * if you use this. Sometimes it has been used incorrectly to
47  * mask bugs in the code (like handling transactions of data
48  * with size given to -1 (0xFFFFFFFFU), in that case please
49  * help us remove it now the code is fixed. Sometimes this is
50  * used because getting all the objects is just too slow and
51  * the USB transaction will time out if you use this command.
52  */
53 #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL 0x00000001
54 /**
55  * This means that under Linux, another kernel module may
56  * be using this device's USB interface, so we need to detach
57  * it if it is. Typically this is on dual-mode devices that
58  * will present both an MTP compliant interface and device
59  * descriptor *and* a USB mass storage interface. If the USB
60  * mass storage interface is in use, other apps (like our
61  * userspace libmtp through libusb access path) cannot get in
62  * and get cosy with it. So we can remove the offending
63  * application. Typically this means you have to run the program
64  * as root as well.
65  */
66 #define DEVICE_FLAG_UNLOAD_DRIVER 0x00000002
67 /**
68  * This means that the PTP_OC_MTP_GetObjPropList is broken and
69  * won't properly return all object properties if parameter 3
70  * is set to 0xFFFFFFFFU.
71  */
72 #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST 0x00000004
73 /**
74  * This means the device doesn't send zero packets to indicate
75  * end of transfer when the transfer boundary occurs at a
76  * multiple of 64 bytes (the USB 1.1 endpoint size). Instead,
77  * exactly one extra byte is sent at the end of the transfer
78  * if the size is an integer multiple of USB 1.1 endpoint size
79  * (64 bytes).
80  *
81  * This behaviour is most probably a workaround due to the fact
82  * that the hardware USB slave controller in the device cannot
83  * handle zero writes at all, and the usage of the USB 1.1
84  * endpoint size is due to the fact that the device will "gear
85  * down" on a USB 1.1 hub, and since 64 bytes is a multiple of
86  * 512 bytes, it will work with USB 1.1 and USB 2.0 alike.
87  */
88 #define DEVICE_FLAG_NO_ZERO_READS 0x00000008
89 /**
90  * This flag means that the device is prone to forgetting the
91  * OGG container file type, so that libmtp must look at the
92  * filename extensions in order to determine that a file is
93  * actually OGG. This is a clear and present firmware bug, and
94  * while firmware bugs should be fixed in firmware, we like
95  * OGG so much that we back it by introducing this flag.
96  * The error has only been seen on iriver devices. Turning this
97  * flag on won't hurt anything, just that the check against
98  * filename extension will be done for files of "unknown" type.
99  * If the player does not even know (reports) that it supports
100  * ogg even though it does, please use the stronger
101  * OGG_IS_UNKNOWN flag, which will forcedly support ogg on
102  * anything with the .ogg filename extension.
103  */
104 #define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010
105 /**
106  * This flag indicates a limitation in the filenames a device
107  * can accept - they must be 7 bit (all chars <= 127/0x7F).
108  * It was found first on the Philips Shoqbox, and is a deviation
109  * from the PTP standard which mandates that any unicode chars
110  * may be used for filenames. I guess this is caused by a 7bit-only
111  * filesystem being used intrinsically on the device.
112  */
113 #define DEVICE_FLAG_ONLY_7BIT_FILENAMES 0x00000020
114 /**
115  * This flag indicates that the device will lock up if you
116  * try to get status of endpoints and/or release the interface
117  * when closing the device. This fixes problems with SanDisk
118  * Sansa devices especially. It may be a side-effect of a
119  * Windows behaviour of never releasing interfaces.
120  */
121 #define DEVICE_FLAG_NO_RELEASE_INTERFACE 0x00000040
122 /**
123  * This flag was introduced with the advent of Creative ZEN
124  * 8GB. The device sometimes return a broken PTP header
125  * like this: < 1502 0000 0200 01d1 02d1 01d2 >
126  * the latter 6 bytes (representing "code" and "transaction ID")
127  * contain junk. This is breaking the PTP/MTP spec but works
128  * on Windows anyway, probably because the Windows implementation
129  * does not check that these bytes are valid. To interoperate
130  * with devices like this, we need this flag to emulate the
131  * Windows bug.
132  */
133 #define DEVICE_FLAG_IGNORE_HEADER_ERRORS 0x00000080
134 /**
135  * The Motorola RAZR2 V8 (others?) has broken set object
136  * proplist causing the metadata setting to fail. (The
137  * set object prop to set individual properties work on
138  * this device, but the metadata is plain ignored on
139  * tracks, though e.g. playlist names can be set.)
140  */
141 #define DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST 0x00000100
142 /**
143  * The Samsung YP-T10 think Ogg files shall be sent with
144  * the "unknown" (PTP_OFC_Undefined) file type, this gives a
145  * side effect that is a combination of the iRiver Ogg Alzheimer
146  * problem (have to recognized Ogg files on file extension)
147  * and a need to report the Ogg support (the device itself does
148  * not properly claim to support it) and need to set filetype
149  * to unknown when storing Ogg files, even though they're not
150  * actually unknown. Later iRivers seem to need this flag since
151  * they do not report to support OGG even though they actually
152  * do. Often the device supports OGG in USB mass storage mode,
153  * then the firmware simply miss to declare metadata support
154  * for OGG properly.
155  */
156 #define DEVICE_FLAG_OGG_IS_UNKNOWN 0x00000200
157 /**
158  * The Creative Zen is quite unstable in libmtp but seems to
159  * be better with later firmware versions. However, it still
160  * frequently crashes when setting album art dimensions. This
161  * flag disables setting the dimensions (which seems to make
162  * no difference to how the graphic is displayed).
163  */
164 #define DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS 0x00000400
165 /**
166  * Some devices, particularly SanDisk Sansas, need to always
167  * have their "OS Descriptor" probed in order to work correctly.
168  * This flag provides that extra massage.
169  */
170 #define DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR 0x00000800
171 /**
172  * Samsung has implimented its own playlist format as a .spl file
173  * stored in the normal file system, rather than a proper mtp
174  * playlist. There are multiple versions of the .spl format
175  * identified by a line in the file: VERSION X.XX
176  * Version 1.00 is just a simple playlist.
177  */
178 #define DEVICE_FLAG_PLAYLIST_SPL_V1 0x00001000
179 /**
180  * Samsung has implimented its own playlist format as a .spl file
181  * stored in the normal file system, rather than a proper mtp
182  * playlist. There are multiple versions of the .spl format
183  * identified by a line in the file: VERSION X.XX
184  * Version 2.00 is playlist but allows DNSe sound settings
185  * to be stored, per playlist.
186  */
187 #define DEVICE_FLAG_PLAYLIST_SPL_V2 0x00002000
188 /**
189  * The Sansa E250 is know to have this problem which is actually
190  * that the device claims that property PTP_OPC_DateModified
191  * is read/write but will still fail to update it. It can only
192  * be set properly the first time a file is sent.
193  */
194 #define DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED 0x00004000
195 /**
196  * This avoids use of the send object proplist which
197  * is used when creating new objects (not just updating)
198  * The DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST is related
199  * but only concerns the case where the object proplist
200  * is sent in to update an existing object. The Toshiba
201  * Gigabeat MEU202 for example has this problem.
202  */
203 #define DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST 0x00008000
204 /**
205  * Devices that cannot support reading out battery
206  * level.
207  */
208 #define DEVICE_FLAG_BROKEN_BATTERY_LEVEL 0x00010000
209 
210 /**
211  * Devices that send "ObjectDeleted" events after deletion
212  * of images. (libgphoto2)
213  */
214 #define DEVICE_FLAG_DELETE_SENDS_EVENT	0x00020000
215 
216 /**
217  * Cameras that can capture images. (libgphoto2)
218  */
219 #define DEVICE_FLAG_CAPTURE		0x00040000
220 
221 /**
222  * Cameras that can capture images. (libgphoto2)
223  */
224 #define DEVICE_FLAG_CAPTURE_PREVIEW	0x00080000
225 
226 /**
227  * Nikon broken capture support without proper ObjectAdded events.
228  * (libgphoto2)
229  */
230 #define DEVICE_FLAG_NIKON_BROKEN_CAPTURE	0x00100000
231 
232 /**
233  * Broken capture support where cameras do not send CaptureComplete events.
234  * (libgphoto2)
235  */
236 #define DEVICE_FLAG_NO_CAPTURE_COMPLETE		0x00400000
237 
238 /**
239  * Direct PTP match required.
240  * (libgphoto2)
241  */
242 #define DEVICE_FLAG_MATCH_PTP_INTERFACE		0x00800000
243 /**
244  * This flag is like DEVICE_FLAG_OGG_IS_UNKNOWN but for FLAC
245  * files instead. Using the unknown filetype for FLAC files.
246  */
247 #define DEVICE_FLAG_FLAC_IS_UNKNOWN 0x01000000
248