.TH "The basic device management API." 3 "Wed Apr 19 2017" "Version 1.1.12" "libmtp" \" -*- nroff -*- .ad l .nh .SH NAME libmtp \- The basic device management API. .SS "Macros" .in +1c .ti -1c .RI "#define \fBLIBMTP_STORAGE_SORTBY_NOTSORTED\fP 0" .br .ti -1c .RI "#define \fBLIBMTP_STORAGE_SORTBY_FREESPACE\fP 1" .br .ti -1c .RI "#define \fBLIBMTP_STORAGE_SORTBY_MAXSPACE\fP 2" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "\fBLIBMTP_error_number_t\fP \fBLIBMTP_Detect_Raw_Devices\fP (\fBLIBMTP_raw_device_t\fP **, int *)" .br .ti -1c .RI "int \fBLIBMTP_Check_Specific_Device\fP (int busno, int devno)" .br .ti -1c .RI "\fBLIBMTP_mtpdevice_t\fP * \fBLIBMTP_Open_Raw_Device\fP (\fBLIBMTP_raw_device_t\fP *)" .br .ti -1c .RI "\fBLIBMTP_mtpdevice_t\fP * \fBLIBMTP_Open_Raw_Device_Uncached\fP (\fBLIBMTP_raw_device_t\fP *)" .br .ti -1c .RI "\fBLIBMTP_mtpdevice_t\fP * \fBLIBMTP_Get_First_Device\fP (void)" .br .ti -1c .RI "\fBLIBMTP_error_number_t\fP \fBLIBMTP_Get_Connected_Devices\fP (\fBLIBMTP_mtpdevice_t\fP **)" .br .ti -1c .RI "uint32_t \fBLIBMTP_Number_Devices_In_List\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "void \fBLIBMTP_Release_Device_List\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "void \fBLIBMTP_Release_Device\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "void \fBLIBMTP_Dump_Device_Info\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "int \fBLIBMTP_Reset_Device\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "char * \fBLIBMTP_Get_Manufacturername\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "char * \fBLIBMTP_Get_Modelname\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "char * \fBLIBMTP_Get_Serialnumber\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "char * \fBLIBMTP_Get_Deviceversion\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "char * \fBLIBMTP_Get_Friendlyname\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "int \fBLIBMTP_Set_Friendlyname\fP (\fBLIBMTP_mtpdevice_t\fP *, char const *const)" .br .ti -1c .RI "char * \fBLIBMTP_Get_Syncpartner\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "int \fBLIBMTP_Set_Syncpartner\fP (\fBLIBMTP_mtpdevice_t\fP *, char const *const)" .br .ti -1c .RI "int \fBLIBMTP_Get_Batterylevel\fP (\fBLIBMTP_mtpdevice_t\fP *, uint8_t *const, uint8_t *const)" .br .ti -1c .RI "int \fBLIBMTP_Get_Secure_Time\fP (\fBLIBMTP_mtpdevice_t\fP *, char **const)" .br .ti -1c .RI "int \fBLIBMTP_Get_Device_Certificate\fP (\fBLIBMTP_mtpdevice_t\fP *, char **const)" .br .ti -1c .RI "int \fBLIBMTP_Get_Supported_Filetypes\fP (\fBLIBMTP_mtpdevice_t\fP *, uint16_t **const, uint16_t *const)" .br .ti -1c .RI "int \fBLIBMTP_Check_Capability\fP (\fBLIBMTP_mtpdevice_t\fP *, \fBLIBMTP_devicecap_t\fP)" .br .ti -1c .RI "\fBLIBMTP_error_t\fP * \fBLIBMTP_Get_Errorstack\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "void \fBLIBMTP_Clear_Errorstack\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "void \fBLIBMTP_Dump_Errorstack\fP (\fBLIBMTP_mtpdevice_t\fP *)" .br .ti -1c .RI "int \fBLIBMTP_Get_Storage\fP (\fBLIBMTP_mtpdevice_t\fP *, int const)" .br .ti -1c .RI "int \fBLIBMTP_Format_Storage\fP (\fBLIBMTP_mtpdevice_t\fP *, \fBLIBMTP_devicestorage_t\fP *)" .br .ti -1c .RI "char * \fBLIBMTP_Get_String_From_Object\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const)" .br .ti -1c .RI "uint64_t \fBLIBMTP_Get_u64_From_Object\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, uint64_t const)" .br .ti -1c .RI "uint32_t \fBLIBMTP_Get_u32_From_Object\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, uint32_t const)" .br .ti -1c .RI "uint16_t \fBLIBMTP_Get_u16_From_Object\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, uint16_t const)" .br .ti -1c .RI "uint8_t \fBLIBMTP_Get_u8_From_Object\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, uint8_t const)" .br .ti -1c .RI "int \fBLIBMTP_Set_Object_String\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, char const *const)" .br .ti -1c .RI "int \fBLIBMTP_Set_Object_u32\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, uint32_t const)" .br .ti -1c .RI "int \fBLIBMTP_Set_Object_u16\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, uint16_t const)" .br .ti -1c .RI "int \fBLIBMTP_Set_Object_u8\fP (\fBLIBMTP_mtpdevice_t\fP *, uint32_t const, \fBLIBMTP_property_t\fP const, uint8_t const)" .br .ti -1c .RI "char const * \fBLIBMTP_Get_Property_Description\fP (\fBLIBMTP_property_t\fP inproperty)" .br .ti -1c .RI "int \fBLIBMTP_Is_Property_Supported\fP (\fBLIBMTP_mtpdevice_t\fP *, \fBLIBMTP_property_t\fP const, \fBLIBMTP_filetype_t\fP const)" .br .ti -1c .RI "int \fBLIBMTP_Get_Allowed_Property_Values\fP (\fBLIBMTP_mtpdevice_t\fP *, \fBLIBMTP_property_t\fP const, \fBLIBMTP_filetype_t\fP const, \fBLIBMTP_allowed_values_t\fP *)" .br .ti -1c .RI "void \fBLIBMTP_destroy_allowed_values_t\fP (\fBLIBMTP_allowed_values_t\fP *)" .br .in -1c .SH "Detailed Description" .PP .SH "Function Documentation" .PP .SS "int LIBMTP_Check_Capability (\fBLIBMTP_mtpdevice_t\fP *device, \fBLIBMTP_devicecap_t\fPcap)" This function checks if the device has some specific capabilities, in order to avoid calling APIs that may disturb the device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to check the capability on\&. .br \fIcap\fP the capability to check\&. .RE .PP \fBReturns:\fP .RS 4 0 if not supported, any other value means the device has the requested capability\&. .RE .PP .PP References LIBMTP_DEVICECAP_EditObjects, LIBMTP_DEVICECAP_GetPartialObject, LIBMTP_DEVICECAP_SendPartialObject, and LIBMTP_mtpdevice_struct::params\&. .SS "int LIBMTP_Check_Specific_Device (intbusno, intdevno)" Checks if a specific device with a certain bus and device number has an MTP type device descriptor\&. .PP \fBParameters:\fP .RS 4 \fIbusno\fP the bus number of the device to check .br \fIdeviceno\fP the device number of the device to check .RE .PP \fBReturns:\fP .RS 4 1 if the device is MTP else 0 .RE .PP .SS "void LIBMTP_Clear_Errorstack (\fBLIBMTP_mtpdevice_t\fP *device)" This function clears the error stack of a device and frees any memory used by it\&. Call this when you're finished with using the errors\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the MTP device to clear the error stack for\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::errorstack\&. .PP Referenced by LIBMTP_Release_Device()\&. .SS "void LIBMTP_destroy_allowed_values_t (\fBLIBMTP_allowed_values_t\fP *allowed_vals)" Destroys a LIBMTP_allowed_values_t struct .PP \fBParameters:\fP .RS 4 \fIallowed_vals\fP the struct to destroy .RE .PP .PP References LIBMTP_allowed_values_struct::datatype, and LIBMTP_allowed_values_struct::is_range\&. .SS "\fBLIBMTP_error_number_t\fP LIBMTP_Detect_Raw_Devices (\fBLIBMTP_raw_device_t\fP **devices, int *numdevs)" Detect the raw MTP device descriptors and return a list of of the devices found\&. .PP \fBParameters:\fP .RS 4 \fIdevices\fP a pointer to a variable that will hold the list of raw devices found\&. This may be NULL on return if the number of detected devices is zero\&. The user shall simply \fCfree()\fP this variable when finished with the raw devices, in order to release memory\&. .br \fInumdevs\fP a pointer to an integer that will hold the number of devices in the list\&. This may be 0\&. .RE .PP \fBReturns:\fP .RS 4 0 if successful, any other value means failure\&. .RE .PP .PP \fBExamples: \fP .in +1c \fBdetect\&.c\fP, \fBfiles\&.c\fP, \fBfolders\&.c\fP, and \fBtracks\&.c\fP\&. .PP References LIBMTP_raw_device_struct::bus_location, LIBMTP_raw_device_struct::device_entry, LIBMTP_device_entry_struct::device_flags, device_unknown(), LIBMTP_raw_device_struct::devnum, LIBMTP_device_entry_struct::product, LIBMTP_device_entry_struct::product_id, LIBMTP_device_entry_struct::vendor, and LIBMTP_device_entry_struct::vendor_id\&. .PP Referenced by LIBMTP_Get_Connected_Devices(), and LIBMTP_Get_First_Device()\&. .SS "void LIBMTP_Dump_Device_Info (\fBLIBMTP_mtpdevice_t\fP *device)" This function dumps out a large chunk of textual information provided from the PTP protocol and additionally some extra MTP-specific information where applicable\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the MTP device to report info from\&. .RE .PP .PP References LIBMTP_devicestorage_struct::AccessCapability, LIBMTP_mtpdevice_struct::default_album_folder, LIBMTP_mtpdevice_struct::default_music_folder, LIBMTP_mtpdevice_struct::default_organizer_folder, LIBMTP_mtpdevice_struct::default_picture_folder, LIBMTP_mtpdevice_struct::default_playlist_folder, LIBMTP_mtpdevice_struct::default_text_folder, LIBMTP_mtpdevice_struct::default_video_folder, LIBMTP_mtpdevice_struct::default_zencast_folder, dump_usbinfo(), LIBMTP_mtpdevice_struct::extensions, LIBMTP_devicestorage_struct::FilesystemType, LIBMTP_devicestorage_struct::FreeSpaceInBytes, LIBMTP_devicestorage_struct::FreeSpaceInObjects, LIBMTP_devicestorage_struct::id, LIBMTP_Get_Property_Description(), LIBMTP_device_extension_struct::major, LIBMTP_devicestorage_struct::MaxCapacity, LIBMTP_device_extension_struct::minor, LIBMTP_device_extension_struct::name, LIBMTP_device_extension_struct::next, LIBMTP_devicestorage_struct::next, LIBMTP_mtpdevice_struct::object_bitsize, LIBMTP_mtpdevice_struct::params, LIBMTP_mtpdevice_struct::storage, LIBMTP_devicestorage_struct::StorageDescription, LIBMTP_devicestorage_struct::StorageType, LIBMTP_mtpdevice_struct::usbinfo, and LIBMTP_devicestorage_struct::VolumeIdentifier\&. .SS "void LIBMTP_Dump_Errorstack (\fBLIBMTP_mtpdevice_t\fP *device)" This function dumps the error stack to \fCstderr\fP\&. (You still have to clear the stack though\&.) .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the MTP device to dump the error stack for\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::errorstack\&. .SS "int LIBMTP_Format_Storage (\fBLIBMTP_mtpdevice_t\fP *device, \fBLIBMTP_devicestorage_t\fP *storage)" Formats device storage (if the device supports the operation)\&. WARNING: This WILL delete all data from the device\&. Make sure you've got confirmation from the user BEFORE you call this function\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device containing the storage to format\&. .br \fIstorage\fP the actual storage to format\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure\&. .RE .PP .PP References LIBMTP_devicestorage_struct::id, and LIBMTP_mtpdevice_struct::params\&. .SS "int LIBMTP_Get_Allowed_Property_Values (\fBLIBMTP_mtpdevice_t\fP *device, \fBLIBMTP_property_t\fP constproperty, \fBLIBMTP_filetype_t\fP constfiletype, \fBLIBMTP_allowed_values_t\fP *allowed_vals)" Gets the allowed values (range or enum) for a property .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device .br \fIproperty\fP the property to query .br \fIfiletype\fP the filetype of the object you want to set values for .br \fIallowed_vals\fP pointer to a LIBMTP_allowed_values_t struct to receive the allowed values\&. Call LIBMTP_destroy_allowed_values_t on this on successful completion\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure .RE .PP .PP References LIBMTP_allowed_values_struct::datatype, LIBMTP_allowed_values_struct::is_range, LIBMTP_allowed_values_struct::num_entries, and LIBMTP_mtpdevice_struct::params\&. .SS "int LIBMTP_Get_Batterylevel (\fBLIBMTP_mtpdevice_t\fP *device, uint8_t *constmaximum_level, uint8_t *constcurrent_level)" This function retrieves the current battery level on the device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the battery level for\&. .br \fImaximum_level\fP a pointer to a variable that will hold the maximum level of the battery if the call was successful\&. .br \fIcurrent_level\fP a pointer to a variable that will hold the current level of the battery if the call was successful\&. A value of 0 means that the device is on external power\&. .RE .PP \fBReturns:\fP .RS 4 0 if the storage info was successfully retrieved, any other means failure\&. A typical cause of failure is that the device does not support the battery level property\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::maximum_battery_level, LIBMTP_mtpdevice_struct::params, and LIBMTP_mtpdevice_struct::usbinfo\&. .SS "\fBLIBMTP_error_number_t\fP LIBMTP_Get_Connected_Devices (\fBLIBMTP_mtpdevice_t\fP **device_list)" Get the first connected MTP device node in the linked list of devices\&. Currently this only provides access to USB devices .PP \fBParameters:\fP .RS 4 \fIdevice_list\fP A list of devices ready to be used by the caller\&. You need to know how many there are\&. .RE .PP \fBReturns:\fP .RS 4 Any error information gathered from device connections .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Number_Devices_In_List()\fP .RE .PP .PP References LIBMTP_Detect_Raw_Devices()\&. .SS "int LIBMTP_Get_Device_Certificate (\fBLIBMTP_mtpdevice_t\fP *device, char **constdevcert)" This function returns the device (public key) certificate as an XML document string from the device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the device certificate for\&. .br \fIdevcert\fP the device certificate as an XML string or NULL if the call failed or the device certificate property is not supported\&. This string must be \fCfree()\fP:ed by the caller after use\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure\&. .RE .PP .SS "char* LIBMTP_Get_Deviceversion (\fBLIBMTP_mtpdevice_t\fP *device)" This retrieves the device version (hardware and firmware version) of an MTP device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the device version for\&. .RE .PP \fBReturns:\fP .RS 4 a newly allocated UTF-8 string representing the device version\&. The string must be freed by the caller after use\&. If the call was unsuccessful this will contain NULL\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "\fBLIBMTP_error_t\fP* LIBMTP_Get_Errorstack (\fBLIBMTP_mtpdevice_t\fP *device)" This returns the error stack for a device in case you need to either reference the error numbers (e\&.g\&. when creating multilingual apps with multiple-language text representations for each error number) or when you need to build a multi-line error text widget or something like that\&. You need to call the \fCLIBMTP_Clear_Errorstack\fP to clear it when you're finished with it\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the MTP device to get the error stack for\&. .RE .PP \fBReturns:\fP .RS 4 the error stack or NULL if there are no errors on the stack\&. .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Clear_Errorstack()\fP .PP \fBLIBMTP_Dump_Errorstack()\fP .RE .PP .PP References LIBMTP_mtpdevice_struct::errorstack\&. .SS "\fBLIBMTP_mtpdevice_t\fP* LIBMTP_Get_First_Device (void)" Get the first (as in 'first in the list of') connected MTP device\&. .PP \fBReturns:\fP .RS 4 a device pointer\&. .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Get_Connected_Devices()\fP .RE .PP .PP References LIBMTP_Detect_Raw_Devices()\&. .SS "char* LIBMTP_Get_Friendlyname (\fBLIBMTP_mtpdevice_t\fP *device)" This retrieves the 'friendly name' of an MTP device\&. Usually this is simply the name of the owner or something like 'John Doe's Digital Audio Player'\&. This property should be supported by all MTP devices\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the friendly name for\&. .RE .PP \fBReturns:\fP .RS 4 a newly allocated UTF-8 string representing the friendly name\&. The string must be freed by the caller after use\&. .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Set_Friendlyname()\fP .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "char* LIBMTP_Get_Manufacturername (\fBLIBMTP_mtpdevice_t\fP *device)" This retrieves the manufacturer name of an MTP device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the manufacturer name for\&. .RE .PP \fBReturns:\fP .RS 4 a newly allocated UTF-8 string representing the manufacturer name\&. The string must be freed by the caller after use\&. If the call was unsuccessful this will contain NULL\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "char* LIBMTP_Get_Modelname (\fBLIBMTP_mtpdevice_t\fP *device)" This retrieves the model name (often equal to product name) of an MTP device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the model name for\&. .RE .PP \fBReturns:\fP .RS 4 a newly allocated UTF-8 string representing the model name\&. The string must be freed by the caller after use\&. If the call was unsuccessful this will contain NULL\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "char const* LIBMTP_Get_Property_Description (\fBLIBMTP_property_t\fPinproperty)" This helper function returns a textual description for a libmtp property to be used in dialog boxes etc\&. .PP \fBParameters:\fP .RS 4 \fIinproperty\fP the libmtp internal property to get a description for\&. .RE .PP \fBReturns:\fP .RS 4 a string representing the filetype, this must \fBNOT\fP be free():ed by the caller! .RE .PP .PP References propertymap_struct::description, and propertymap_struct::id\&. .PP Referenced by LIBMTP_Dump_Device_Info()\&. .SS "int LIBMTP_Get_Secure_Time (\fBLIBMTP_mtpdevice_t\fP *device, char **constsectime)" This function returns the secure time as an XML document string from the device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the secure time for\&. .br \fIsectime\fP the secure time string as an XML document or NULL if the call failed or the secure time property is not supported\&. This string must be \fCfree()\fP:ed by the caller after use\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure\&. .RE .PP .SS "char* LIBMTP_Get_Serialnumber (\fBLIBMTP_mtpdevice_t\fP *device)" This retrieves the serial number of an MTP device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the serial number for\&. .RE .PP \fBReturns:\fP .RS 4 a newly allocated UTF-8 string representing the serial number\&. The string must be freed by the caller after use\&. If the call was unsuccessful this will contain NULL\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "int LIBMTP_Get_Storage (\fBLIBMTP_mtpdevice_t\fP *device, int constsortby)" This function updates all the storage id's of a device and their properties, then creates a linked list and puts the list head into the device struct\&. It also optionally sorts this list\&. If you want to display storage information in your application you should call this function, then dereference the device struct (\fCdevice->storage\fP) to get out information on the storage\&. .PP You need to call this everytime you want to update the \fCdevice->storage\fP list, for example anytime you need to check available storage somewhere\&. .PP \fBWARNING:\fP since this list is dynamically updated, do not reference its fields in external applications by pointer! E\&.g do not put a reference to any \fCchar *\fP field\&. instead \fCstrncpy()\fP it! .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the storage for\&. .br \fIsortby\fP an integer that determines the sorting of the storage list\&. Valid sort methods are defined in \fBlibmtp\&.h\fP with beginning with LIBMTP_STORAGE_SORTBY_\&. 0 or LIBMTP_STORAGE_SORTBY_NOTSORTED to not sort\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, 1 success but only with storage id's, storage properities could not be retrieved and \-1 means failure\&. .RE .PP .PP References LIBMTP_devicestorage_struct::AccessCapability, LIBMTP_devicestorage_struct::FilesystemType, LIBMTP_devicestorage_struct::FreeSpaceInBytes, LIBMTP_devicestorage_struct::FreeSpaceInObjects, LIBMTP_devicestorage_struct::id, LIBMTP_devicestorage_struct::MaxCapacity, LIBMTP_devicestorage_struct::next, LIBMTP_mtpdevice_struct::params, LIBMTP_devicestorage_struct::prev, LIBMTP_mtpdevice_struct::storage, LIBMTP_devicestorage_struct::StorageDescription, LIBMTP_devicestorage_struct::StorageType, and LIBMTP_devicestorage_struct::VolumeIdentifier\&. .PP Referenced by LIBMTP_Open_Raw_Device_Uncached()\&. .SS "char* LIBMTP_Get_String_From_Object (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id)" Get/set arbitrary properties\&. These do not update the cache; should only be used on properties not stored in structs .PP Retrieves a string from an object .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .RE .PP \fBReturns:\fP .RS 4 valid string or NULL on failure\&. The returned string must bee \fCfree()\fP:ed by the caller after use\&. .RE .PP .SS "int LIBMTP_Get_Supported_Filetypes (\fBLIBMTP_mtpdevice_t\fP *device, uint16_t **constfiletypes, uint16_t *constlength)" This function retrieves a list of supported file types, i\&.e\&. the file types that this device claims it supports, e\&.g\&. audio file types that the device can play etc\&. This list is mitigated to inlcude the file types that libmtp can handle, i\&.e\&. it will not list filetypes that libmtp will handle internally like playlists and folders\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the filetype capabilities for\&. .br \fIfiletypes\fP a pointer to a pointer that will hold the list of supported filetypes if the call was successful\&. This list must be \fCfree()\fP:ed by the caller after use\&. .br \fIlength\fP a pointer to a variable that will hold the length of the list of supported filetypes if the call was successful\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure\&. .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Get_Filetype_Description()\fP .RE .PP .PP References LIBMTP_mtpdevice_struct::params, and LIBMTP_mtpdevice_struct::usbinfo\&. .SS "char* LIBMTP_Get_Syncpartner (\fBLIBMTP_mtpdevice_t\fP *device)" This retrieves the syncronization partner of an MTP device\&. This property should be supported by all MTP devices\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to get the sync partner for\&. .RE .PP \fBReturns:\fP .RS 4 a newly allocated UTF-8 string representing the synchronization partner\&. The string must be freed by the caller after use\&. .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Set_Syncpartner()\fP .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "uint16_t LIBMTP_Get_u16_From_Object (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, uint16_t constvalue_default)" Retrieves an unsigned 16-bit integer from an object attribute .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIvalue_default\fP Default value to return on failure .RE .PP \fBReturns:\fP .RS 4 a value .RE .PP .SS "uint32_t LIBMTP_Get_u32_From_Object (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, uint32_t constvalue_default)" Retrieves an unsigned 32-bit integer from an object attribute .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIvalue_default\fP Default value to return on failure .RE .PP \fBReturns:\fP .RS 4 the value .RE .PP .SS "uint64_t LIBMTP_Get_u64_From_Object (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, uint64_t constvalue_default)" Retrieves an unsigned 64-bit integer from an object attribute .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIvalue_default\fP Default value to return on failure .RE .PP \fBReturns:\fP .RS 4 the value .RE .PP .SS "uint8_t LIBMTP_Get_u8_From_Object (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, uint8_t constvalue_default)" Retrieves an unsigned 8-bit integer from an object attribute .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIvalue_default\fP Default value to return on failure .RE .PP \fBReturns:\fP .RS 4 a value .RE .PP .SS "int LIBMTP_Is_Property_Supported (\fBLIBMTP_mtpdevice_t\fP *device, \fBLIBMTP_property_t\fP constproperty, \fBLIBMTP_filetype_t\fP constfiletype)" Determine if a property is supported for a given file type .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device .br \fIproperty\fP the property to query .br \fIfiletype\fP the filetype of the object you want to set values for .RE .PP \fBReturns:\fP .RS 4 0 if not supported, positive if supported, negative on error .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "uint32_t LIBMTP_Number_Devices_In_List (\fBLIBMTP_mtpdevice_t\fP *device_list)" Get the number of devices that are available in the listed device list .PP \fBParameters:\fP .RS 4 \fIdevice_list\fP Pointer to a linked list of devices .RE .PP \fBReturns:\fP .RS 4 Number of devices in the device list device_list .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Get_Connected_Devices()\fP .RE .PP .PP References LIBMTP_mtpdevice_struct::next\&. .SS "\fBLIBMTP_mtpdevice_t\fP* LIBMTP_Open_Raw_Device_Uncached (\fBLIBMTP_raw_device_t\fP *rawdevice)" This function opens a device from a raw device\&. It is the preferred way to access devices in the new interface where several devices can come and go as the library is working on a certain device\&. .PP \fBParameters:\fP .RS 4 \fIrawdevice\fP the raw device to open a 'real' device for\&. .RE .PP \fBReturns:\fP .RS 4 an open device\&. .RE .PP .PP References LIBMTP_raw_device_struct::bus_location, LIBMTP_mtpdevice_struct::cached, configure_usb_device(), LIBMTP_mtpdevice_struct::default_album_folder, LIBMTP_mtpdevice_struct::default_music_folder, LIBMTP_mtpdevice_struct::default_organizer_folder, LIBMTP_mtpdevice_struct::default_picture_folder, LIBMTP_mtpdevice_struct::default_playlist_folder, LIBMTP_mtpdevice_struct::default_text_folder, LIBMTP_mtpdevice_struct::default_video_folder, LIBMTP_mtpdevice_struct::default_zencast_folder, LIBMTP_raw_device_struct::device_entry, DEVICE_FLAG_FLAC_IS_UNKNOWN, DEVICE_FLAG_OGG_IS_UNKNOWN, LIBMTP_device_entry_struct::device_flags, DEVICE_FLAGS_ANDROID_BUGS, DEVICE_FLAGS_ARICENT_BUGS, DEVICE_FLAGS_SONY_NWZ_BUGS, LIBMTP_raw_device_struct::devnum, LIBMTP_mtpdevice_struct::errorstack, LIBMTP_mtpdevice_struct::extensions, LIBMTP_Get_Storage(), LIBMTP_mtpdevice_struct::maximum_battery_level, LIBMTP_device_extension_struct::name, LIBMTP_device_extension_struct::next, LIBMTP_mtpdevice_struct::object_bitsize, LIBMTP_mtpdevice_struct::params, _PTP_USB::rawdevice, LIBMTP_mtpdevice_struct::storage, and LIBMTP_mtpdevice_struct::usbinfo\&. .SS "void LIBMTP_Release_Device (\fBLIBMTP_mtpdevice_t\fP *device)" This closes and releases an allocated MTP device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the MTP device to release\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::extensions, LIBMTP_Clear_Errorstack(), LIBMTP_device_extension_struct::name, LIBMTP_device_extension_struct::next, LIBMTP_mtpdevice_struct::params, and LIBMTP_mtpdevice_struct::usbinfo\&. .PP Referenced by LIBMTP_Release_Device_List()\&. .SS "void LIBMTP_Release_Device_List (\fBLIBMTP_mtpdevice_t\fP *device)" This closes and releases an allocated MTP device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the MTP device to release\&. .RE .PP .PP References LIBMTP_Release_Device(), LIBMTP_Release_Device_List(), and LIBMTP_mtpdevice_struct::next\&. .PP Referenced by LIBMTP_Release_Device_List()\&. .SS "int LIBMTP_Reset_Device (\fBLIBMTP_mtpdevice_t\fP *device)" This resets a device in case it supports the \fCPTP_OC_ResetDevice\fP operation code (0x1010)\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to reset\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure\&. .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "int LIBMTP_Set_Friendlyname (\fBLIBMTP_mtpdevice_t\fP *device, char const *constfriendlyname)" Sets the 'friendly name' of an MTP device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to set the friendly name for\&. .br \fIfriendlyname\fP the new friendly name for the device\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure\&. .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Get_Friendlyname()\fP .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SS "int LIBMTP_Set_Object_String (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, char const *conststring)" Sets an object attribute from a string .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIstring\fP string value to set .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure .RE .PP .SS "int LIBMTP_Set_Object_u16 (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, uint16_t constvalue)" Sets an object attribute from an unsigned 16-bit integer .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIvalue\fP 16-bit unsigned integer to set .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure .RE .PP .SS "int LIBMTP_Set_Object_u32 (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, uint32_t constvalue)" Sets an object attribute from an unsigned 32-bit integer .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIvalue\fP 32-bit unsigned integer to set .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure .RE .PP .SS "int LIBMTP_Set_Object_u8 (\fBLIBMTP_mtpdevice_t\fP *device, uint32_t constobject_id, \fBLIBMTP_property_t\fP constattribute_id, uint8_t constvalue)" Sets an object attribute from an unsigned 8-bit integer .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to an MTP device\&. .br \fIobject_id\fP Object reference .br \fIattribute_id\fP MTP attribute ID .br \fIvalue\fP 8-bit unsigned integer to set .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure .RE .PP .SS "int LIBMTP_Set_Syncpartner (\fBLIBMTP_mtpdevice_t\fP *device, char const *constsyncpartner)" Sets the synchronization partner of an MTP device\&. Note that we have no idea what the effect of setting this to 'foobar' may be\&. But the general idea seems to be to tell which program shall synchronize with this device and tell others to leave it alone\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP a pointer to the device to set the sync partner for\&. .br \fIsyncpartner\fP the new synchronization partner for the device\&. .RE .PP \fBReturns:\fP .RS 4 0 on success, any other value means failure\&. .RE .PP \fBSee also:\fP .RS 4 \fBLIBMTP_Get_Syncpartner()\fP .RE .PP .PP References LIBMTP_mtpdevice_struct::params\&. .SH "Author" .PP Generated automatically by Doxygen for libmtp from the source code\&.