13e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
23e667aea0778310451a896231186c6cf034ac93eLinus Walleij * \file device-flags.h
33e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Special device flags to deal with bugs in specific devices.
43e667aea0778310451a896231186c6cf034ac93eLinus Walleij *
53e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Copyright (C) 2005-2007 Richard A. Low <richard@wentnet.com>
60dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se>
73e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Copyright (C) 2006-2007 Marcus Meissner
83e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Copyright (C) 2007 Ted Bullock
93e667aea0778310451a896231186c6cf034ac93eLinus Walleij *
103e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This library is free software; you can redistribute it and/or
113e667aea0778310451a896231186c6cf034ac93eLinus Walleij * modify it under the terms of the GNU Lesser General Public
123e667aea0778310451a896231186c6cf034ac93eLinus Walleij * License as published by the Free Software Foundation; either
133e667aea0778310451a896231186c6cf034ac93eLinus Walleij * version 2 of the License, or (at your option) any later version.
143e667aea0778310451a896231186c6cf034ac93eLinus Walleij *
153e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This library is distributed in the hope that it will be useful,
163e667aea0778310451a896231186c6cf034ac93eLinus Walleij * but WITHOUT ANY WARRANTY; without even the implied warranty of
173e667aea0778310451a896231186c6cf034ac93eLinus Walleij * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
183e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Lesser General Public License for more details.
193e667aea0778310451a896231186c6cf034ac93eLinus Walleij *
203e667aea0778310451a896231186c6cf034ac93eLinus Walleij * You should have received a copy of the GNU Lesser General Public
213e667aea0778310451a896231186c6cf034ac93eLinus Walleij * License along with this library; if not, write to the
223e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
233e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Boston, MA 02111-1307, USA.
243e667aea0778310451a896231186c6cf034ac93eLinus Walleij *
253e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This file is supposed to be included by both libmtp and libgphoto2.
263e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
273e667aea0778310451a896231186c6cf034ac93eLinus Walleij
283e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
293e667aea0778310451a896231186c6cf034ac93eLinus Walleij * These flags are used to indicate if some or other
303e667aea0778310451a896231186c6cf034ac93eLinus Walleij * device need special treatment. These should be possible
313e667aea0778310451a896231186c6cf034ac93eLinus Walleij * to concatenate using logical OR so please use one bit per
323e667aea0778310451a896231186c6cf034ac93eLinus Walleij * feature and lets pray we don't need more than 32 bits...
333e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
343e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_NONE 0x00000000
353e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
363e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This means that the PTP_OC_MTP_GetObjPropList is broken
373e667aea0778310451a896231186c6cf034ac93eLinus Walleij * in the sense that it won't return properly formatted metadata
38e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * for ALL files on the device when you request an object
393e667aea0778310451a896231186c6cf034ac93eLinus Walleij * property list for object 0xFFFFFFFF with parameter 3 likewise
40e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * set to 0xFFFFFFFF. Compare to
413e667aea0778310451a896231186c6cf034ac93eLinus Walleij * DEVICE_FLAG_BROKEN_MTPGETOBJECTPROPLIST which only signify
423e667aea0778310451a896231186c6cf034ac93eLinus Walleij * that it's broken when getting metadata for a SINGLE object.
43e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * A typical way the implementation may be broken is that it
44aed0f4d95d54796a643287752fe5fdedbce04fe2Linus Walleij * may not return a proper count of the objects, and sometimes
45aed0f4d95d54796a643287752fe5fdedbce04fe2Linus Walleij * (like on the ZENs) objects are simply missing from the list
46aed0f4d95d54796a643287752fe5fdedbce04fe2Linus Walleij * if you use this. Sometimes it has been used incorrectly to
47aed0f4d95d54796a643287752fe5fdedbce04fe2Linus Walleij * mask bugs in the code (like handling transactions of data
48aed0f4d95d54796a643287752fe5fdedbce04fe2Linus Walleij * with size given to -1 (0xFFFFFFFFU), in that case please
498a6c77dfe4ef91b35cce74c53d1dcd37adaaf8beLinus Walleij * help us remove it now the code is fixed. Sometimes this is
508a6c77dfe4ef91b35cce74c53d1dcd37adaaf8beLinus Walleij * used because getting all the objects is just too slow and
518a6c77dfe4ef91b35cce74c53d1dcd37adaaf8beLinus Walleij * the USB transaction will time out if you use this command.
523e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
533e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL 0x00000001
543e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
55e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * This means that under Linux, another kernel module may
56e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * be using this device's USB interface, so we need to detach
573e667aea0778310451a896231186c6cf034ac93eLinus Walleij * it if it is. Typically this is on dual-mode devices that
583e667aea0778310451a896231186c6cf034ac93eLinus Walleij * will present both an MTP compliant interface and device
593e667aea0778310451a896231186c6cf034ac93eLinus Walleij * descriptor *and* a USB mass storage interface. If the USB
603e667aea0778310451a896231186c6cf034ac93eLinus Walleij * mass storage interface is in use, other apps (like our
613e667aea0778310451a896231186c6cf034ac93eLinus Walleij * userspace libmtp through libusb access path) cannot get in
62e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * and get cosy with it. So we can remove the offending
633e667aea0778310451a896231186c6cf034ac93eLinus Walleij * application. Typically this means you have to run the program
643e667aea0778310451a896231186c6cf034ac93eLinus Walleij * as root as well.
653e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
663e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_UNLOAD_DRIVER 0x00000002
673e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
68b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * This means that the PTP_OC_MTP_GetObjPropList (9805)
69b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * is broken in some way, either it doesn't work at all
70b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * (as for Android devices) or it won't properly return all
71b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * object properties if parameter 3 is set to 0xFFFFFFFFU.
723e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
733e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST 0x00000004
743e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
753e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This means the device doesn't send zero packets to indicate
76e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * end of transfer when the transfer boundary occurs at a
77e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * multiple of 64 bytes (the USB 1.1 endpoint size). Instead,
78e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * exactly one extra byte is sent at the end of the transfer
79e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * if the size is an integer multiple of USB 1.1 endpoint size
803e667aea0778310451a896231186c6cf034ac93eLinus Walleij * (64 bytes).
813e667aea0778310451a896231186c6cf034ac93eLinus Walleij *
82e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * This behaviour is most probably a workaround due to the fact
83e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * that the hardware USB slave controller in the device cannot
84e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * handle zero writes at all, and the usage of the USB 1.1
85e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * endpoint size is due to the fact that the device will "gear
86e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * down" on a USB 1.1 hub, and since 64 bytes is a multiple of
873e667aea0778310451a896231186c6cf034ac93eLinus Walleij * 512 bytes, it will work with USB 1.1 and USB 2.0 alike.
883e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
893e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_NO_ZERO_READS 0x00000008
903e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
913e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This flag means that the device is prone to forgetting the
923e667aea0778310451a896231186c6cf034ac93eLinus Walleij * OGG container file type, so that libmtp must look at the
933e667aea0778310451a896231186c6cf034ac93eLinus Walleij * filename extensions in order to determine that a file is
943e667aea0778310451a896231186c6cf034ac93eLinus Walleij * actually OGG. This is a clear and present firmware bug, and
953e667aea0778310451a896231186c6cf034ac93eLinus Walleij * while firmware bugs should be fixed in firmware, we like
963e667aea0778310451a896231186c6cf034ac93eLinus Walleij * OGG so much that we back it by introducing this flag.
973e667aea0778310451a896231186c6cf034ac93eLinus Walleij * The error has only been seen on iriver devices. Turning this
983e667aea0778310451a896231186c6cf034ac93eLinus Walleij * flag on won't hurt anything, just that the check against
993e667aea0778310451a896231186c6cf034ac93eLinus Walleij * filename extension will be done for files of "unknown" type.
10007bb538aa44c1b8b6f48480b1648c759b5d91b02Linus Walleij * If the player does not even know (reports) that it supports
101e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * ogg even though it does, please use the stronger
10207bb538aa44c1b8b6f48480b1648c759b5d91b02Linus Walleij * OGG_IS_UNKNOWN flag, which will forcedly support ogg on
10307bb538aa44c1b8b6f48480b1648c759b5d91b02Linus Walleij * anything with the .ogg filename extension.
1043e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
1053e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010
1063e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
1073e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This flag indicates a limitation in the filenames a device
1083e667aea0778310451a896231186c6cf034ac93eLinus Walleij * can accept - they must be 7 bit (all chars <= 127/0x7F).
1093e667aea0778310451a896231186c6cf034ac93eLinus Walleij * It was found first on the Philips Shoqbox, and is a deviation
1103e667aea0778310451a896231186c6cf034ac93eLinus Walleij * from the PTP standard which mandates that any unicode chars
1113e667aea0778310451a896231186c6cf034ac93eLinus Walleij * may be used for filenames. I guess this is caused by a 7bit-only
1123e667aea0778310451a896231186c6cf034ac93eLinus Walleij * filesystem being used intrinsically on the device.
1133e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
1143e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_ONLY_7BIT_FILENAMES 0x00000020
1153e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
1163e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This flag indicates that the device will lock up if you
1173e667aea0778310451a896231186c6cf034ac93eLinus Walleij * try to get status of endpoints and/or release the interface
1183e667aea0778310451a896231186c6cf034ac93eLinus Walleij * when closing the device. This fixes problems with SanDisk
1193e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Sansa devices especially. It may be a side-effect of a
1203e667aea0778310451a896231186c6cf034ac93eLinus Walleij * Windows behaviour of never releasing interfaces.
1213e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
1223e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_NO_RELEASE_INTERFACE 0x00000040
1233e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
1243e667aea0778310451a896231186c6cf034ac93eLinus Walleij * This flag was introduced with the advent of Creative ZEN
1253e667aea0778310451a896231186c6cf034ac93eLinus Walleij * 8GB. The device sometimes return a broken PTP header
1263e667aea0778310451a896231186c6cf034ac93eLinus Walleij * like this: < 1502 0000 0200 01d1 02d1 01d2 >
1273e667aea0778310451a896231186c6cf034ac93eLinus Walleij * the latter 6 bytes (representing "code" and "transaction ID")
1283e667aea0778310451a896231186c6cf034ac93eLinus Walleij * contain junk. This is breaking the PTP/MTP spec but works
1293e667aea0778310451a896231186c6cf034ac93eLinus Walleij * on Windows anyway, probably because the Windows implementation
1303e667aea0778310451a896231186c6cf034ac93eLinus Walleij * does not check that these bytes are valid. To interoperate
131e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * with devices like this, we need this flag to emulate the
1320dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * Windows bug. Broken headers has also been found in the
1330dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * Aricent MTP stack.
1343e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
1353e667aea0778310451a896231186c6cf034ac93eLinus Walleij#define DEVICE_FLAG_IGNORE_HEADER_ERRORS 0x00000080
1363e667aea0778310451a896231186c6cf034ac93eLinus Walleij/**
1373e667aea0778310451a896231186c6cf034ac93eLinus Walleij * The Motorola RAZR2 V8 (others?) has broken set object
1383e667aea0778310451a896231186c6cf034ac93eLinus Walleij * proplist causing the metadata setting to fail. (The
1393e667aea0778310451a896231186c6cf034ac93eLinus Walleij * set object prop to set individual properties work on
1403e667aea0778310451a896231186c6cf034ac93eLinus Walleij * this device, but the metadata is plain ignored on
1413e667aea0778310451a896231186c6cf034ac93eLinus Walleij * tracks, though e.g. playlist names can be set.)
1423e667aea0778310451a896231186c6cf034ac93eLinus Walleij */
143335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij#define DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST 0x00000100
144a3544f6f93ca507b7e84d1050d1ec32aadf27888Linus Walleij/**
145a3544f6f93ca507b7e84d1050d1ec32aadf27888Linus Walleij * The Samsung YP-T10 think Ogg files shall be sent with
146e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * the "unknown" (PTP_OFC_Undefined) file type, this gives a
147e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * side effect that is a combination of the iRiver Ogg Alzheimer
148a3544f6f93ca507b7e84d1050d1ec32aadf27888Linus Walleij * problem (have to recognized Ogg files on file extension)
149a3544f6f93ca507b7e84d1050d1ec32aadf27888Linus Walleij * and a need to report the Ogg support (the device itself does
150e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * not properly claim to support it) and need to set filetype
151a3544f6f93ca507b7e84d1050d1ec32aadf27888Linus Walleij * to unknown when storing Ogg files, even though they're not
15207bb538aa44c1b8b6f48480b1648c759b5d91b02Linus Walleij * actually unknown. Later iRivers seem to need this flag since
15307bb538aa44c1b8b6f48480b1648c759b5d91b02Linus Walleij * they do not report to support OGG even though they actually
15401fc9c8cb667c844fad0f20c832d2bfa1aabfd14Linus Walleij * do. Often the device supports OGG in USB mass storage mode,
15501fc9c8cb667c844fad0f20c832d2bfa1aabfd14Linus Walleij * then the firmware simply miss to declare metadata support
15601fc9c8cb667c844fad0f20c832d2bfa1aabfd14Linus Walleij * for OGG properly.
157a3544f6f93ca507b7e84d1050d1ec32aadf27888Linus Walleij */
158335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij#define DEVICE_FLAG_OGG_IS_UNKNOWN 0x00000200
159bb9fb4af008aaf564b5b394933d35d41b662657fRichard Low/**
160bb9fb4af008aaf564b5b394933d35d41b662657fRichard Low * The Creative Zen is quite unstable in libmtp but seems to
161bb9fb4af008aaf564b5b394933d35d41b662657fRichard Low * be better with later firmware versions. However, it still
162bb9fb4af008aaf564b5b394933d35d41b662657fRichard Low * frequently crashes when setting album art dimensions. This
163bb9fb4af008aaf564b5b394933d35d41b662657fRichard Low * flag disables setting the dimensions (which seems to make
164bb9fb4af008aaf564b5b394933d35d41b662657fRichard Low * no difference to how the graphic is displayed).
165bb9fb4af008aaf564b5b394933d35d41b662657fRichard Low */
166335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij#define DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS 0x00000400
167335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij/**
168335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij * Some devices, particularly SanDisk Sansas, need to always
169335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij * have their "OS Descriptor" probed in order to work correctly.
170335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij * This flag provides that extra massage.
171335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij */
172335a81cf1f504d9ba87702181eaa13f8476f3166Linus Walleij#define DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR 0x00000800
173f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij/**
174f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * Samsung has implimented its own playlist format as a .spl file
175f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * stored in the normal file system, rather than a proper mtp
176f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * playlist. There are multiple versions of the .spl format
177f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * identified by a line in the file: VERSION X.XX
178f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * Version 1.00 is just a simple playlist.
179f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij */
180f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij#define DEVICE_FLAG_PLAYLIST_SPL_V1 0x00001000
181f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij/**
182f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * Samsung has implimented its own playlist format as a .spl file
183f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * stored in the normal file system, rather than a proper mtp
184f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * playlist. There are multiple versions of the .spl format
185f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * identified by a line in the file: VERSION X.XX
186f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * Version 2.00 is playlist but allows DNSe sound settings
187f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij * to be stored, per playlist.
188f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij */
189f3c4405edbf6a9b5c61057c0c2ffbaf067e89cf4Linus Walleij#define DEVICE_FLAG_PLAYLIST_SPL_V2 0x00002000
1903758814b2f8cba3555d2b8ac79dd95f1a743629aLinus Walleij/**
1913758814b2f8cba3555d2b8ac79dd95f1a743629aLinus Walleij * The Sansa E250 is know to have this problem which is actually
1923758814b2f8cba3555d2b8ac79dd95f1a743629aLinus Walleij * that the device claims that property PTP_OPC_DateModified
1933758814b2f8cba3555d2b8ac79dd95f1a743629aLinus Walleij * is read/write but will still fail to update it. It can only
1943758814b2f8cba3555d2b8ac79dd95f1a743629aLinus Walleij * be set properly the first time a file is sent.
1953758814b2f8cba3555d2b8ac79dd95f1a743629aLinus Walleij */
196cf8dc2bb1c3a1f75f4efd0a1a85ddcc66e60341aLinus Walleij#define DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED 0x00004000
197f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij/**
198f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij * This avoids use of the send object proplist which
199f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij * is used when creating new objects (not just updating)
200f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij * The DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST is related
201f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij * but only concerns the case where the object proplist
202f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij * is sent in to update an existing object. The Toshiba
203f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij * Gigabeat MEU202 for example has this problem.
204f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij */
205f67c1ada12299062333b7d622509b403ab925e8aLinus Walleij#define DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST 0x00008000
2064096c88324c7199d3bb16ae716be3ddc0a1c66b1Linus Walleij/**
2074096c88324c7199d3bb16ae716be3ddc0a1c66b1Linus Walleij * Devices that cannot support reading out battery
2084096c88324c7199d3bb16ae716be3ddc0a1c66b1Linus Walleij * level.
2094096c88324c7199d3bb16ae716be3ddc0a1c66b1Linus Walleij */
2104096c88324c7199d3bb16ae716be3ddc0a1c66b1Linus Walleij#define DEVICE_FLAG_BROKEN_BATTERY_LEVEL 0x00010000
211d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij
212d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij/**
213d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * Devices that send "ObjectDeleted" events after deletion
214e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * of images. (libgphoto2)
215e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij */
216d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij#define DEVICE_FLAG_DELETE_SENDS_EVENT	0x00020000
217d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij
218d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij/**
219d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * Cameras that can capture images. (libgphoto2)
220e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij */
221d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij#define DEVICE_FLAG_CAPTURE		0x00040000
222d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij
223d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij/**
224d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * Cameras that can capture images. (libgphoto2)
225e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij */
226d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij#define DEVICE_FLAG_CAPTURE_PREVIEW	0x00080000
227d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij
228d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij/**
229d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * Nikon broken capture support without proper ObjectAdded events.
230d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * (libgphoto2)
231e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij */
232d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij#define DEVICE_FLAG_NIKON_BROKEN_CAPTURE	0x00100000
233d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij
234d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij/**
235d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * Broken capture support where cameras do not send CaptureComplete events.
236d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * (libgphoto2)
237e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij */
238d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij#define DEVICE_FLAG_NO_CAPTURE_COMPLETE		0x00400000
239d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij
240d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij/**
241d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * Direct PTP match required.
242d4637506d9551957a152cab2cfb80fdfed029424Linus Walleij * (libgphoto2)
243e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij */
244d9ee8cd37f0704a501b62a185c3305d236c7c8dfLinus Walleij#define DEVICE_FLAG_OLYMPUS_XML_WRAPPED		0x00800000
24589bb1cdbe1d57fe8c43b3993047532024ac453bfLinus Walleij/**
24689bb1cdbe1d57fe8c43b3993047532024ac453bfLinus Walleij * This flag is like DEVICE_FLAG_OGG_IS_UNKNOWN but for FLAC
24789bb1cdbe1d57fe8c43b3993047532024ac453bfLinus Walleij * files instead. Using the unknown filetype for FLAC files.
24889bb1cdbe1d57fe8c43b3993047532024ac453bfLinus Walleij */
249094b450b7ce920e43eb701d6cdcd9c7d2a61e79eLinus Walleij#define DEVICE_FLAG_FLAC_IS_UNKNOWN		0x01000000
250094b450b7ce920e43eb701d6cdcd9c7d2a61e79eLinus Walleij/**
251094b450b7ce920e43eb701d6cdcd9c7d2a61e79eLinus Walleij * Device needs unique filenames, no two files can be
252094b450b7ce920e43eb701d6cdcd9c7d2a61e79eLinus Walleij * named the same string.
253094b450b7ce920e43eb701d6cdcd9c7d2a61e79eLinus Walleij */
254094b450b7ce920e43eb701d6cdcd9c7d2a61e79eLinus Walleij#define DEVICE_FLAG_UNIQUE_FILENAMES		0x02000000
255fea4f53595425274263166b92797e3bb2349b549Linus Walleij/**
256fea4f53595425274263166b92797e3bb2349b549Linus Walleij * This flag performs some random magic on the BlackBerry
257fea4f53595425274263166b92797e3bb2349b549Linus Walleij * device to switch from USB mass storage to MTP mode we think.
258fea4f53595425274263166b92797e3bb2349b549Linus Walleij */
259094b450b7ce920e43eb701d6cdcd9c7d2a61e79eLinus Walleij#define DEVICE_FLAG_SWITCH_MODE_BLACKBERRY	0x04000000
260e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij/**
261e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * This flag indicates that the device need an extra long
262e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij * timeout on some operations.
263e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij */
264e04a1b943a8cab73dc03b14382e1803fcf7eaf3fLinus Walleij#define DEVICE_FLAG_LONG_TIMEOUT		0x08000000
265f691317b6e4c37b22f5f1b3e3b94a717031db695Linus Walleij/**
266f691317b6e4c37b22f5f1b3e3b94a717031db695Linus Walleij * This flag indicates that the device need an explicit
267f691317b6e4c37b22f5f1b3e3b94a717031db695Linus Walleij * USB reset after each connection. Some devices don't
268f691317b6e4c37b22f5f1b3e3b94a717031db695Linus Walleij * like this, so it's not done by default.
269f691317b6e4c37b22f5f1b3e3b94a717031db695Linus Walleij */
270f691317b6e4c37b22f5f1b3e3b94a717031db695Linus Walleij#define DEVICE_FLAG_FORCE_RESET_ON_CLOSE	0x10000000
27103f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij/**
272b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * Early Creative Zen (etc) models actually only support
273b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * command 9805 (Get object property list) and will hang
274b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * if you try to get individual properties of an object.
2750c1a71d27e2c099a7dc7f226f9a9a0c89ab17bf6Linus Walleij * Or so it seemed. Later bug fixes to the library has made
2760c1a71d27e2c099a7dc7f226f9a9a0c89ab17bf6Linus Walleij * this work flawlessly so the bug flag is moot.
2770c1a71d27e2c099a7dc7f226f9a9a0c89ab17bf6Linus Walleij * NOT USED ANYMORE, THIS FLAG MAY BE RECYCLED.
278b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij */
279b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij#define DEVICE_FLAG_BROKEN_GET_OBJECT_PROPVAL	0x20000000
2804950c02db9a9ac0f519ff095c7290c9b56f14b44Ignacio Martinez/**
2814950c02db9a9ac0f519ff095c7290c9b56f14b44Ignacio Martinez * It seems that some devices return an bad data when
2821e68f96e076f6e15165a175d277f7a4851a08675Linus Walleij * using the GetObjectInfo operation. So in these cases
2831e68f96e076f6e15165a175d277f7a4851a08675Linus Walleij * we prefer to override the PTP-compatible object infos
2841e68f96e076f6e15165a175d277f7a4851a08675Linus Walleij * with the MTP property list.
2851e68f96e076f6e15165a175d277f7a4851a08675Linus Walleij *
2861e68f96e076f6e15165a175d277f7a4851a08675Linus Walleij * For example Some Samsung Galaxy S devices contain an MTP
2871e68f96e076f6e15165a175d277f7a4851a08675Linus Walleij * stack that present the ObjectInfo in 64 bit instead of
2881e68f96e076f6e15165a175d277f7a4851a08675Linus Walleij * 32 bit.
2894950c02db9a9ac0f519ff095c7290c9b56f14b44Ignacio Martinez */
2906d7ea637b57993970b3fe9a841820716381e4239Linus Walleij#define DEVICE_FLAG_PROPLIST_OVERRIDES_OI	0x40000000
29115c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij
29215c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij/**
29315c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij * All these bug flags need to be set on SONY NWZ Walkman
29415c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij * players, and will be autodetected on unknown devices
29515c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij * by detecting the vendor extension descriptor "sony.net"
29615c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij */
29715c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij#define DEVICE_FLAGS_SONY_NWZ_BUGS \
29815c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij  (DEVICE_FLAG_UNLOAD_DRIVER | \
29915c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij   DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | \
30015c7d1b12d4de045f21b3dfe5463f6ad1dcb872cLinus Walleij   DEVICE_FLAG_UNIQUE_FILENAMES | \
301729f5d388d6dde38a9607a2fc340888bb9824272Linus Walleij   DEVICE_FLAG_FORCE_RESET_ON_CLOSE)
302b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij/**
30303f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij * All these bug flags need to be set on Android devices,
30403f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij * they claim to support MTP operations they actually
305b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * cannot handle, especially 9805 (Get object property list).
306b989cf1e7585c6e6a81526bdfbc78f9d9b633ca3Linus Walleij * These are auto-assigned to devices reporting
30703f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij * "android.com" in their device extension descriptor.
30803f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij */
30903f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij#define DEVICE_FLAGS_ANDROID_BUGS \
31003f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij  (DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | \
31103f0c036fd0b69e8a5e6bcf17c2fc99c2bae3340Linus Walleij   DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST | \
31214cee67b7010b45dd363972aa23707f6c280e8fdLinus Walleij   DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST | \
31314cee67b7010b45dd363972aa23707f6c280e8fdLinus Walleij   DEVICE_FLAG_UNLOAD_DRIVER | \
314729f5d388d6dde38a9607a2fc340888bb9824272Linus Walleij   DEVICE_FLAG_LONG_TIMEOUT | \
315729f5d388d6dde38a9607a2fc340888bb9824272Linus Walleij   DEVICE_FLAG_FORCE_RESET_ON_CLOSE)
3160dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij/**
3170dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * All these bug flags appear on a number of SonyEricsson
3180dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * devices including Android devices not using the stock
3190dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * Android 4.0+ (Ice Cream Sandwich) MTP stack. It is highly
3200dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * supected that these bugs comes from an MTP implementation
3210dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * from Aricent, so it is called the Aricent bug flags as a
3220dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij * shorthand. Especially the header errors that need to be
3234c570a97ebbbea4d582a4d6092594c61fb93cebcLinus Walleij * ignored is typical for this stack.
3244c570a97ebbbea4d582a4d6092594c61fb93cebcLinus Walleij *
3254c570a97ebbbea4d582a4d6092594c61fb93cebcLinus Walleij * After some guesswork we auto-assign these bug flags to
3264c570a97ebbbea4d582a4d6092594c61fb93cebcLinus Walleij * devices that present the "microsoft.com/WPDNA", and
3274c570a97ebbbea4d582a4d6092594c61fb93cebcLinus Walleij * "sonyericsson.com/SE" but NOT the "android.com"
3284c570a97ebbbea4d582a4d6092594c61fb93cebcLinus Walleij * descriptor.
3290dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij */
3300dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij#define DEVICE_FLAGS_ARICENT_BUGS \
3310dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij  (DEVICE_FLAG_IGNORE_HEADER_ERRORS | \
3320dcf2e870744411686d9b897d37ccff2f596c55cLinus Walleij   DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST | \
333729f5d388d6dde38a9607a2fc340888bb9824272Linus Walleij   DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST)
334