aboutsummaryrefslogtreecommitdiff
path: root/src/libmtp.h.in
AgeCommit message (Collapse)Author
2017-02-04Add LIBMTP_FILES_AND_FOLDERS_ROOT and fix examplesStanisław Pitucha
Examples assumed that parent id 0 will list only the top directory, but actually that's an id for all files (it does happen to correspond to the reported parent id however). The actual id to be used for the top folder is 0xffffffff. Add a new define to make the value more obvious as well.
2016-04-14[events] Add an asynchronous function to check for eventsPhilip Langdale
The existing LIBMTP_Read_Event function blocks while waiting for an event. This can lead to race conditions where a client attempts to disconnect from the device in one thread while an event just happens to arrive in the polling thread, with unpredictable results, including attempts to disconnect twice. To make life easier for clients, we can offer an asynchronous form of event checking, which gives the client the ability to terminate polling when necessary. To do this, we can leverage the asynchronous capabilities of libusb-1. That's only one of three possible backends, but it's the most commonly and heavily used library. Starting an asynchronous transfer is pretty straightforward, but polling can be done in a variety of ways, some of which are very complicated. For my purposes, one of the simpler forms is sufficient, and, in fact, the most generalised form doesn't offer me any advantages. Accordingly, I put a trivial wrapper around this method so that it can be used without making the client explicitly pull in libusb-1. It's a bit weird, but worth the convenience. So, we now have a Read_Events_Async that takes a callback and a Handle_Events method that will poll for activity. How have we solved the original problem? There are two ways. 1) We can pass a timeout to Handle_Events. This will cause it to return if no activity happened. We can then assess whether it is safe to poll some more or give up. 2) libusb has recently added an 'interrupt_event_handler' function https://github.com/libusb/libusb/commit/a6db382ad11f7662b550338e0570d5a2dfd8ce5a This function finally offers a way to interrupt polling on demand. No release of libusb with this in it has happened yet, but hopefully it will happen soon. Now, you could ask, with fairness, why this interrupt mechanism shouldn't work with the existing synchronous Read_Event; and I agree - it should - but it doesn't. Due to a bug in libusb, even though the interruption works, the synchronous wrapper code they have will immediately start the polling again and never return control to the caller. So, even when we're in a position to use this interruption function, we'll still need to be using the async API to take advantage of it. I've verified that all this logic works in gvfs.
2013-04-29Add capability to check for capabilitiesLinus Walleij
This adds and API to check a device for specific capabilities, when need be. Signed-off-by: Linus Walleij <triad@df.lth.se>
2013-03-11Propagate StoreRemoved, ObjectAdded and ObjectRemoved events.Philip Langdale
These events, along with the previously exposed StoreAdded event, are the most frequently implemented events on MTP devices. In the case of Google's Android MTP stack, they are the only events exposed. In the case of StoreRemoved, the param value is the storage ID and in the case of ObjectAdded/Removed, it is the entity ID. Signed-off-by: Philip Langdale <philipl@overt.org> Signed-off-by: Linus Walleij <triad@df.lth.se>
2013-03-06Move object handlers into the right groupLinus Walleij
Signed-off-by: Linus Walleij <triad@df.lth.se>
2013-03-05Expose libptp methods for android read/write extensions.Philip Langdale
This change just adds simple libmtp wrappers for the libptp methods that in turn expose the android in-place read/write extensions. Signed-off-by: Philip Langdale <philipl@overt.org> Signed-off-by: Linus Walleij <triad@df.lth.se>
2012-09-04Expose LIBMTP_Read_Event to support Add Storage events.Philip Langdale
I noticed that, for my MTP devices, Windows appeared to detect when storages appeared after unlocking the device. So, I figured there were probably StoreAdded events being generated, and this turned out to be the case. So, it would be highly desirable to pass these events on to clients so they can react accordingly. This implementation is quite ad-hoc, and can't really be considered fully baked. I don't know what the grand scheme is/was for events, but I'm sure passing each param out separately was not part of it. In any case, I'm passing out param1 as it is the ID of the added storage entity. I've tested this with my in-progress mtp backend for gvfs and it works as hoped; I can pass on a gvfs notification that results in the storage appearing in Nautilus. Signed-off-by: Philip Langdale <philipl@overt.org>
2012-08-19Expose the getthumbnail method.Philip Langdale
Even though this is theoretically obsolete in MTP, it may still be the only working mechanism to obtain thumbnails from an MTP device. Signed-off-by: Philip Langdale <philipl@overt.org>
2012-07-30Oops.. restore examples to their original debug flags.Catalin Patulea
Signed-off-by: Catalin Patulea <cat@vv.carleton.ca> Signed-off-by: Linus Walleij <triad@df.lth.se>
2012-06-27Fix typo in header, VCARD v2 and v3 now detected properly.Linus Walleij
Signed-off-by: Linus Walleij <triad@df.lth.se>
2011-11-17Clean up separation between libusb 1.0 and libusb 0.xLinus Walleij
Some symbols from <usb.h> were still used here and there in the libusb glue code. Remove <usb.h> from the libmtp.h header, what did it do there in the first place? Signed-off-by: Linus Walleij <triad@df.lth.se>
2011-03-22Adding tentative event ID from Jonas Salling.Linus Walleij
2011-03-05Some constingLinus Walleij
2011-03-05Add a new interface for getting the folder list for a certainLinus Walleij
storage, useful in file handling: LIBMTP_Get_Folder_List_For_Storage()
2011-03-05More API changesLinus Walleij
2011-03-05Refactor and revamp the new interface a bit.Linus Walleij
Introduce new mtp-filetree test program for the new interface.
2011-03-03Code revamps and new interfaces based on a large patchLinus Walleij
from Yavor Goulishev <yavor@google.com> for use in an OS X MTP file transfer program for Android. Refactor: - Break out obj2file and reuse in all functions that want to fill in a LIBMTP_file_t from a PTP object. Introduce new interfaces: - LIBMTP_Open_Raw_Device_Uncached() to open an uncached device from a raw device. - LIBMTP_Get_Files_And_Folders() that will only work on uncached devices. Signed-off-by: Yavor Goulishev <yavor@google.com> Signed-off-by: Linus Walleij <triad@df.lth.se>
2010-12-05Improbe the hotplug capabilityLinus Walleij
2010-07-24Implemented an extension parserLinus Walleij
2010-01-02We use time_t so include time.hLinus Walleij
2009-11-07Add function LIBMTP_Get_Tracklisting_With_Callback_For_Storagenicklas79
This function permits you to select all tracks only for a device storage
2009-11-07Add function LIBMTP_Get_Album_List_For_Storagenicklas79
This function permits you to select all albums only for a device storage
2009-10-10Move debugmacros to util.hLinus Walleij
2009-09-28Add DEBUG flags definition to be cleannicklas79
See : LIBMTP_DEBUG_NONE LIBMTP_DEBUG_PTP LIBMTP_DEBUG_USB LIBMTP_DEBUG_PLST LIBMTP_DEBUG_DATA LIBMTP_DEBUG_ALL
2009-09-28Add a new function to API to enable debug modenicklas79
To avoid build and build only to enable (or disable) debug mode, we work now as the lib libusb :) As libusb, you can do : LIBMTP_Set_Debug(flags); or use an environnement variable : export LIBMTP_DEBUG=flags flags value details : * 0x00 [0000 0000] : no debug (default) * 0x01 [0000 0001] : PTP debug * 0x02 [0000 0010] : Playlist debug * 0x04 [0000 0100] : USB debug * 0x08 [0000 1000] : USB data debug
2009-05-04Change my mind; docs updatedRichard Low
2009-05-04Make LIBMTP_Create_Folder take const nameRichard Low
2009-05-03Add general property supportRichard Low
2009-04-16handler wrapperRichard Low
2009-04-11Add send/get file from/to handler function, and modificationdate and add ↵Richard Low
album & playlist types
2009-01-10Mingw32 fixesLinus Walleij
2008-11-17 Version bump to 3.4.5.alistair_boyle
Changed LIBMTP_Update_Playlist metadata from const * const to * const, since Samsung playlist updates can't promise that the playlist ID will remain unchanged due to the inability to modify files in place.
2008-09-23Florent Mertens file rename functions patch.Linus Walleij
2008-09-17New helper macrosLinus Walleij
2008-06-22Bomb in storage ID support everywhere.Linus Walleij
2008-05-28Add raw device interface and wrap around it internally.Linus Walleij
2008-05-28Refactor to use raw devices internally (major change!)Linus Walleij
2008-05-23Add some documentation.Linus Walleij
2008-05-04Export macros to detect audio/video/both and trackLinus Walleij
content, use this in sendtr.c.
2008-05-02Support for composer metadata.Linus Walleij
2008-04-23Added a raw device detection interface.Linus Walleij
2008-03-12New parent_id for playlists and albums.Linus Walleij
2008-01-28Withdraw parent set.Linus Walleij
2008-01-27New commands from Florent Martens.Linus Walleij
2008-01-20LIBMTP_Get_Representative_Sample()Richard Low
2008-01-14One new function, some more default foldersLinus Walleij
2007-10-16Update the so major number due to the device entry struct reworking. Fix ↵jefferai
values in libusb-glue.c. Update fdi file generation.
2007-10-11Whoops, didn't realize that libmtp.h was being autogenerated. Fix compile...jefferai
2007-10-02Replace OPD calls by using the unused uint8_t in device_t toLinus Walleij
hold the object size for objects on a certain device.
2007-09-16A final stab at cancellationLinus Walleij