~ubuntu-branches/ubuntu/precise/libmtp/precise-updates

« back to all changes in this revision

Viewing changes to .pc/0001-broken_object_info.patch/src/device-flags.h

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2012-04-03 08:45:30 UTC
  • mfrom: (0.2.6)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: package-import@ubuntu.com-20120403084530-4pzddlb80jviafad
* New upstream bugfix release:
  - Soname libmtp.so.9.0.3 - binary compatible.
  - Probably nailed the bugs in the Samsung Galaxy Tab S2 family
    of devices. Ignacio Martinez helped us fixing this!
  - Build fixes by Alessio Treglia and others.
  - A horde of new devices in the database.
* Remove patches applied upstream:
  - 0001-broken_object_info.patch
  - 0002-devicedb_updates.patch
  - 2001-pkgconfig_requires.patch
* Refresh 1001-kfreebsd_hurd_ftbfs.patch.
* Refresh symbols file.
* Update debian/copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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-2011 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 (9805)
69
 
 * is broken in some way, either it doesn't work at all
70
 
 * (as for Android devices) or it won't properly return all
71
 
 * object properties if parameter 3 is set to 0xFFFFFFFFU.
72
 
 */
73
 
#define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST 0x00000004
74
 
/**
75
 
 * This means the device doesn't send zero packets to indicate
76
 
 * end of transfer when the transfer boundary occurs at a
77
 
 * multiple of 64 bytes (the USB 1.1 endpoint size). Instead,
78
 
 * exactly one extra byte is sent at the end of the transfer
79
 
 * if the size is an integer multiple of USB 1.1 endpoint size
80
 
 * (64 bytes).
81
 
 *
82
 
 * This behaviour is most probably a workaround due to the fact
83
 
 * that the hardware USB slave controller in the device cannot
84
 
 * handle zero writes at all, and the usage of the USB 1.1
85
 
 * endpoint size is due to the fact that the device will "gear
86
 
 * down" on a USB 1.1 hub, and since 64 bytes is a multiple of
87
 
 * 512 bytes, it will work with USB 1.1 and USB 2.0 alike.
88
 
 */
89
 
#define DEVICE_FLAG_NO_ZERO_READS 0x00000008
90
 
/**
91
 
 * This flag means that the device is prone to forgetting the
92
 
 * OGG container file type, so that libmtp must look at the
93
 
 * filename extensions in order to determine that a file is
94
 
 * actually OGG. This is a clear and present firmware bug, and
95
 
 * while firmware bugs should be fixed in firmware, we like
96
 
 * OGG so much that we back it by introducing this flag.
97
 
 * The error has only been seen on iriver devices. Turning this
98
 
 * flag on won't hurt anything, just that the check against
99
 
 * filename extension will be done for files of "unknown" type.
100
 
 * If the player does not even know (reports) that it supports
101
 
 * ogg even though it does, please use the stronger
102
 
 * OGG_IS_UNKNOWN flag, which will forcedly support ogg on
103
 
 * anything with the .ogg filename extension.
104
 
 */
105
 
#define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010
106
 
/**
107
 
 * This flag indicates a limitation in the filenames a device
108
 
 * can accept - they must be 7 bit (all chars <= 127/0x7F).
109
 
 * It was found first on the Philips Shoqbox, and is a deviation
110
 
 * from the PTP standard which mandates that any unicode chars
111
 
 * may be used for filenames. I guess this is caused by a 7bit-only
112
 
 * filesystem being used intrinsically on the device.
113
 
 */
114
 
#define DEVICE_FLAG_ONLY_7BIT_FILENAMES 0x00000020
115
 
/**
116
 
 * This flag indicates that the device will lock up if you
117
 
 * try to get status of endpoints and/or release the interface
118
 
 * when closing the device. This fixes problems with SanDisk
119
 
 * Sansa devices especially. It may be a side-effect of a
120
 
 * Windows behaviour of never releasing interfaces.
121
 
 */
122
 
#define DEVICE_FLAG_NO_RELEASE_INTERFACE 0x00000040
123
 
/**
124
 
 * This flag was introduced with the advent of Creative ZEN
125
 
 * 8GB. The device sometimes return a broken PTP header
126
 
 * like this: < 1502 0000 0200 01d1 02d1 01d2 >
127
 
 * the latter 6 bytes (representing "code" and "transaction ID")
128
 
 * contain junk. This is breaking the PTP/MTP spec but works
129
 
 * on Windows anyway, probably because the Windows implementation
130
 
 * does not check that these bytes are valid. To interoperate
131
 
 * with devices like this, we need this flag to emulate the
132
 
 * Windows bug.
133
 
 */
134
 
#define DEVICE_FLAG_IGNORE_HEADER_ERRORS 0x00000080
135
 
/**
136
 
 * The Motorola RAZR2 V8 (others?) has broken set object
137
 
 * proplist causing the metadata setting to fail. (The
138
 
 * set object prop to set individual properties work on
139
 
 * this device, but the metadata is plain ignored on
140
 
 * tracks, though e.g. playlist names can be set.)
141
 
 */
142
 
#define DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST 0x00000100
143
 
/**
144
 
 * The Samsung YP-T10 think Ogg files shall be sent with
145
 
 * the "unknown" (PTP_OFC_Undefined) file type, this gives a
146
 
 * side effect that is a combination of the iRiver Ogg Alzheimer
147
 
 * problem (have to recognized Ogg files on file extension)
148
 
 * and a need to report the Ogg support (the device itself does
149
 
 * not properly claim to support it) and need to set filetype
150
 
 * to unknown when storing Ogg files, even though they're not
151
 
 * actually unknown. Later iRivers seem to need this flag since
152
 
 * they do not report to support OGG even though they actually
153
 
 * do. Often the device supports OGG in USB mass storage mode,
154
 
 * then the firmware simply miss to declare metadata support
155
 
 * for OGG properly.
156
 
 */
157
 
#define DEVICE_FLAG_OGG_IS_UNKNOWN 0x00000200
158
 
/**
159
 
 * The Creative Zen is quite unstable in libmtp but seems to
160
 
 * be better with later firmware versions. However, it still
161
 
 * frequently crashes when setting album art dimensions. This
162
 
 * flag disables setting the dimensions (which seems to make
163
 
 * no difference to how the graphic is displayed).
164
 
 */
165
 
#define DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS 0x00000400
166
 
/**
167
 
 * Some devices, particularly SanDisk Sansas, need to always
168
 
 * have their "OS Descriptor" probed in order to work correctly.
169
 
 * This flag provides that extra massage.
170
 
 */
171
 
#define DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR 0x00000800
172
 
/**
173
 
 * Samsung has implimented its own playlist format as a .spl file
174
 
 * stored in the normal file system, rather than a proper mtp
175
 
 * playlist. There are multiple versions of the .spl format
176
 
 * identified by a line in the file: VERSION X.XX
177
 
 * Version 1.00 is just a simple playlist.
178
 
 */
179
 
#define DEVICE_FLAG_PLAYLIST_SPL_V1 0x00001000
180
 
/**
181
 
 * Samsung has implimented its own playlist format as a .spl file
182
 
 * stored in the normal file system, rather than a proper mtp
183
 
 * playlist. There are multiple versions of the .spl format
184
 
 * identified by a line in the file: VERSION X.XX
185
 
 * Version 2.00 is playlist but allows DNSe sound settings
186
 
 * to be stored, per playlist.
187
 
 */
188
 
#define DEVICE_FLAG_PLAYLIST_SPL_V2 0x00002000
189
 
/**
190
 
 * The Sansa E250 is know to have this problem which is actually
191
 
 * that the device claims that property PTP_OPC_DateModified
192
 
 * is read/write but will still fail to update it. It can only
193
 
 * be set properly the first time a file is sent.
194
 
 */
195
 
#define DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED 0x00004000
196
 
/**
197
 
 * This avoids use of the send object proplist which
198
 
 * is used when creating new objects (not just updating)
199
 
 * The DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST is related
200
 
 * but only concerns the case where the object proplist
201
 
 * is sent in to update an existing object. The Toshiba
202
 
 * Gigabeat MEU202 for example has this problem.
203
 
 */
204
 
#define DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST 0x00008000
205
 
/**
206
 
 * Devices that cannot support reading out battery
207
 
 * level.
208
 
 */
209
 
#define DEVICE_FLAG_BROKEN_BATTERY_LEVEL 0x00010000
210
 
 
211
 
/**
212
 
 * Devices that send "ObjectDeleted" events after deletion
213
 
 * of images. (libgphoto2)
214
 
 */
215
 
#define DEVICE_FLAG_DELETE_SENDS_EVENT  0x00020000
216
 
 
217
 
/**
218
 
 * Cameras that can capture images. (libgphoto2)
219
 
 */
220
 
#define DEVICE_FLAG_CAPTURE             0x00040000
221
 
 
222
 
/**
223
 
 * Cameras that can capture images. (libgphoto2)
224
 
 */
225
 
#define DEVICE_FLAG_CAPTURE_PREVIEW     0x00080000
226
 
 
227
 
/**
228
 
 * Nikon broken capture support without proper ObjectAdded events.
229
 
 * (libgphoto2)
230
 
 */
231
 
#define DEVICE_FLAG_NIKON_BROKEN_CAPTURE        0x00100000
232
 
 
233
 
/**
234
 
 * Broken capture support where cameras do not send CaptureComplete events.
235
 
 * (libgphoto2)
236
 
 */
237
 
#define DEVICE_FLAG_NO_CAPTURE_COMPLETE         0x00400000
238
 
 
239
 
/**
240
 
 * Direct PTP match required.
241
 
 * (libgphoto2)
242
 
 */
243
 
#define DEVICE_FLAG_MATCH_PTP_INTERFACE         0x00800000
244
 
/**
245
 
 * This flag is like DEVICE_FLAG_OGG_IS_UNKNOWN but for FLAC
246
 
 * files instead. Using the unknown filetype for FLAC files.
247
 
 */
248
 
#define DEVICE_FLAG_FLAC_IS_UNKNOWN             0x01000000
249
 
/**
250
 
 * Device needs unique filenames, no two files can be
251
 
 * named the same string.
252
 
 */
253
 
#define DEVICE_FLAG_UNIQUE_FILENAMES            0x02000000
254
 
/**
255
 
 * This flag performs some random magic on the BlackBerry
256
 
 * device to switch from USB mass storage to MTP mode we think.
257
 
 */
258
 
#define DEVICE_FLAG_SWITCH_MODE_BLACKBERRY      0x04000000
259
 
/**
260
 
 * This flag indicates that the device need an extra long
261
 
 * timeout on some operations.
262
 
 */
263
 
#define DEVICE_FLAG_LONG_TIMEOUT                0x08000000
264
 
/**
265
 
 * This flag indicates that the device need an explicit
266
 
 * USB reset after each connection. Some devices don't
267
 
 * like this, so it's not done by default.
268
 
 */
269
 
#define DEVICE_FLAG_FORCE_RESET_ON_CLOSE        0x10000000
270
 
/**
271
 
 * Early Creative Zen (etc) models actually only support
272
 
 * command 9805 (Get object property list) and will hang
273
 
 * if you try to get individual properties of an object.
274
 
 */
275
 
#define DEVICE_FLAG_BROKEN_GET_OBJECT_PROPVAL   0x20000000
276
 
 
277
 
 
278
 
/**
279
 
 * All these bug flags need to be set on SONY NWZ Walkman
280
 
 * players, and will be autodetected on unknown devices
281
 
 * by detecting the vendor extension descriptor "sony.net"
282
 
 */
283
 
#define DEVICE_FLAGS_SONY_NWZ_BUGS \
284
 
  (DEVICE_FLAG_UNLOAD_DRIVER | \
285
 
   DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | \
286
 
   DEVICE_FLAG_UNIQUE_FILENAMES | \
287
 
   DEVICE_FLAG_FORCE_RESET_ON_CLOSE )
288
 
/**
289
 
 * All these bug flags need to be set on Android devices,
290
 
 * they claim to support MTP operations they actually
291
 
 * cannot handle, especially 9805 (Get object property list).
292
 
 * These are auto-assigned to devices reporting
293
 
 * "android.com" in their device extension descriptor.
294
 
 */
295
 
#define DEVICE_FLAGS_ANDROID_BUGS \
296
 
  (DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | \
297
 
   DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST | \
298
 
   DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST | \
299
 
   DEVICE_FLAG_UNLOAD_DRIVER | \
300
 
   DEVICE_FLAG_LONG_TIMEOUT )