.TH "basic" 3 "Version 1.1.21" "libmtp" \" -*- nroff -*- .ad l .nh .SH NAME libmtp \- basic .SH SYNOPSIS .br .PP .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_Device\fP (int)" .br .ti -1c .RI "\fBLIBMTP_mtpdevice_t\fP * \fBLIBMTP_Get_First_Device\fP (void)" .br .ti -1c .RI "\fBLIBMTP_mtpdevice_t\fP * \fBLIBMTP_Get_Device_By_SerialNumber\fP (char *)" .br .ti -1c .RI "\fBLIBMTP_mtpdevice_t\fP * \fBLIBMTP_Get_Device_By_ID\fP (char *)" .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 "void \fBLIBMTP_FreeMemory\fP (void *)" .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\fP cap)" 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 \fBLIBMTP_DEVICECAP_CopyObject\fP, \fBLIBMTP_DEVICECAP_EditObjects\fP, \fBLIBMTP_DEVICECAP_GetPartialObject\fP, \fBLIBMTP_DEVICECAP_MoveObject\fP, \fBLIBMTP_DEVICECAP_SendPartialObject\fP, and \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "int LIBMTP_Check_Specific_Device (int busno, int devno)" 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 \fBLIBMTP_mtpdevice_struct::errorstack\fP\&. .PP Referenced by \fBLIBMTP_Release_Device()\fP\&. .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 \fBLIBMTP_allowed_values_struct::datatype\fP, and \fBLIBMTP_allowed_values_struct::is_range\fP\&. .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 \fBLIBMTP_raw_device_struct::bus_location\fP, \fBLIBMTP_raw_device_struct::device_entry\fP, \fBLIBMTP_device_entry_struct::device_flags\fP, \fBdevice_unknown()\fP, \fBLIBMTP_raw_device_struct::devnum\fP, \fBLIBMTP_device_entry_struct::product\fP, \fBLIBMTP_device_entry_struct::product_id\fP, \fBLIBMTP_device_entry_struct::vendor\fP, and \fBLIBMTP_device_entry_struct::vendor_id\fP\&. .PP Referenced by \fBLIBMTP_Get_Connected_Devices()\fP, \fBLIBMTP_Get_Device()\fP, and \fBLIBMTP_Get_Device_By_SerialNumber()\fP\&. .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 \fBLIBMTP_devicestorage_struct::AccessCapability\fP, \fBLIBMTP_mtpdevice_struct::default_album_folder\fP, \fBLIBMTP_mtpdevice_struct::default_music_folder\fP, \fBLIBMTP_mtpdevice_struct::default_organizer_folder\fP, \fBLIBMTP_mtpdevice_struct::default_picture_folder\fP, \fBLIBMTP_mtpdevice_struct::default_playlist_folder\fP, \fBLIBMTP_mtpdevice_struct::default_text_folder\fP, \fBLIBMTP_mtpdevice_struct::default_video_folder\fP, \fBLIBMTP_mtpdevice_struct::default_zencast_folder\fP, \fBLIBMTP_mtpdevice_struct::extensions\fP, \fBLIBMTP_devicestorage_struct::FilesystemType\fP, \fBLIBMTP_devicestorage_struct::FreeSpaceInBytes\fP, \fBLIBMTP_devicestorage_struct::FreeSpaceInObjects\fP, \fBLIBMTP_devicestorage_struct::id\fP, \fBLIBMTP_Get_Property_Description()\fP, \fBLIBMTP_device_extension_struct::major\fP, \fBLIBMTP_devicestorage_struct::MaxCapacity\fP, \fBLIBMTP_device_extension_struct::minor\fP, \fBLIBMTP_device_extension_struct::name\fP, \fBLIBMTP_device_extension_struct::next\fP, \fBLIBMTP_devicestorage_struct::next\fP, \fBLIBMTP_mtpdevice_struct::object_bitsize\fP, \fBLIBMTP_mtpdevice_struct::params\fP, \fBLIBMTP_mtpdevice_struct::storage\fP, \fBLIBMTP_devicestorage_struct::StorageDescription\fP, \fBLIBMTP_devicestorage_struct::StorageType\fP, \fBLIBMTP_mtpdevice_struct::usbinfo\fP, and \fBLIBMTP_devicestorage_struct::VolumeIdentifier\fP\&. .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 \fBLIBMTP_mtpdevice_struct::errorstack\fP\&. .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 \fBLIBMTP_devicestorage_struct::id\fP, and \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "void LIBMTP_FreeMemory (void * mem)" Free memory allocated by libmtp\&. Is doing the same as libc free(mem) in most cases\&. @mem pointer to allocated memory\&. .SS "int LIBMTP_Get_Allowed_Property_Values (\fBLIBMTP_mtpdevice_t\fP * device, \fBLIBMTP_property_t\fP const property, \fBLIBMTP_filetype_t\fP const filetype, \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 \fBLIBMTP_allowed_values_struct::datatype\fP, \fBLIBMTP_allowed_values_struct::is_range\fP, \fBLIBMTP_allowed_values_struct::num_entries\fP, and \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "int LIBMTP_Get_Batterylevel (\fBLIBMTP_mtpdevice_t\fP * device, uint8_t *const maximum_level, uint8_t *const current_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 \fBLIBMTP_mtpdevice_struct::maximum_battery_level\fP, \fBLIBMTP_mtpdevice_struct::params\fP, and \fBLIBMTP_mtpdevice_struct::usbinfo\fP\&. .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 \fBLIBMTP_Detect_Raw_Devices()\fP\&. .SS "\fBLIBMTP_mtpdevice_t\fP * LIBMTP_Get_Device (int device_nr)" Get connected MTP device by list position\&. .PP \fBReturns\fP .RS 4 a device pointer\&. .RE .PP \fBSee also\fP .RS 4 \fBLIBMTP_Get_Connected_Devices()\fP .RE .PP .PP References \fBLIBMTP_Detect_Raw_Devices()\fP\&. .PP Referenced by \fBLIBMTP_Get_Device_By_ID()\fP, and \fBLIBMTP_Get_First_Device()\fP\&. .SS "\fBLIBMTP_mtpdevice_t\fP * LIBMTP_Get_Device_By_ID (char * device_id)" Get connected MTP device by list position or serial number\&. .PP \fBReturns\fP .RS 4 a device pointer\&. .RE .PP \fBSee also\fP .RS 4 \fBLIBMTP_Get_Connected_Devices()\fP .RE .PP .PP References \fBLIBMTP_Get_Device()\fP, and \fBLIBMTP_Get_Device_By_SerialNumber()\fP\&. .SS "\fBLIBMTP_mtpdevice_t\fP * LIBMTP_Get_Device_By_SerialNumber (char * serial_number)" Get connected MTP device by serial number\&. .PP \fBReturns\fP .RS 4 a device pointer\&. .RE .PP \fBSee also\fP .RS 4 \fBLIBMTP_Get_Connected_Devices()\fP .RE .PP .PP References \fBLIBMTP_Detect_Raw_Devices()\fP, \fBLIBMTP_Release_Device()\fP, and \fBLIBMTP_mtpdevice_struct::params\fP\&. .PP Referenced by \fBLIBMTP_Get_Device_By_ID()\fP\&. .SS "int LIBMTP_Get_Device_Certificate (\fBLIBMTP_mtpdevice_t\fP * device, char **const devcert)" 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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .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 \fBLIBMTP_mtpdevice_struct::errorstack\fP\&. .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 \fBLIBMTP_Get_Device()\fP\&. .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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "char const * LIBMTP_Get_Property_Description (\fBLIBMTP_property_t\fP inproperty)" 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 \fBpropertymap_struct::description\fP, and \fBpropertymap_struct::id\fP\&. .PP Referenced by \fBLIBMTP_Dump_Device_Info()\fP\&. .SS "int LIBMTP_Get_Secure_Time (\fBLIBMTP_mtpdevice_t\fP * device, char **const sectime)" 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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "int LIBMTP_Get_Storage (\fBLIBMTP_mtpdevice_t\fP * device, int const sortby)" 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 every time 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 \fBLIBMTP_devicestorage_struct::AccessCapability\fP, \fBLIBMTP_devicestorage_struct::FilesystemType\fP, \fBLIBMTP_devicestorage_struct::FreeSpaceInBytes\fP, \fBLIBMTP_devicestorage_struct::FreeSpaceInObjects\fP, \fBLIBMTP_devicestorage_struct::id\fP, \fBLIBMTP_devicestorage_struct::MaxCapacity\fP, \fBLIBMTP_devicestorage_struct::next\fP, \fBLIBMTP_mtpdevice_struct::params\fP, \fBLIBMTP_devicestorage_struct::prev\fP, \fBLIBMTP_mtpdevice_struct::storage\fP, \fBLIBMTP_devicestorage_struct::StorageDescription\fP, \fBLIBMTP_devicestorage_struct::StorageType\fP, and \fBLIBMTP_devicestorage_struct::VolumeIdentifier\fP\&. .PP Referenced by \fBLIBMTP_Open_Raw_Device_Uncached()\fP\&. .SS "char * LIBMTP_Get_String_From_Object (\fBLIBMTP_mtpdevice_t\fP * device, uint32_t const object_id, \fBLIBMTP_property_t\fP const attribute_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 **const filetypes, uint16_t *const length)" 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 include 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 \fBLIBMTP_mtpdevice_struct::params\fP, and \fBLIBMTP_mtpdevice_struct::usbinfo\fP\&. .SS "char * LIBMTP_Get_Syncpartner (\fBLIBMTP_mtpdevice_t\fP * device)" This retrieves the synchronization 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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "uint16_t LIBMTP_Get_u16_From_Object (\fBLIBMTP_mtpdevice_t\fP * device, uint32_t const object_id, \fBLIBMTP_property_t\fP const attribute_id, uint16_t const value_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 const object_id, \fBLIBMTP_property_t\fP const attribute_id, uint32_t const value_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 const object_id, \fBLIBMTP_property_t\fP const attribute_id, uint64_t const value_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 const object_id, \fBLIBMTP_property_t\fP const attribute_id, uint8_t const value_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 const property, \fBLIBMTP_filetype_t\fP const filetype)" 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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .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 \fBLIBMTP_mtpdevice_struct::next\fP\&. .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 \fBLIBMTP_raw_device_struct::bus_location\fP, \fBLIBMTP_mtpdevice_struct::cached\fP, \fBLIBMTP_mtpdevice_struct::default_album_folder\fP, \fBLIBMTP_mtpdevice_struct::default_music_folder\fP, \fBLIBMTP_mtpdevice_struct::default_organizer_folder\fP, \fBLIBMTP_mtpdevice_struct::default_picture_folder\fP, \fBLIBMTP_mtpdevice_struct::default_playlist_folder\fP, \fBLIBMTP_mtpdevice_struct::default_text_folder\fP, \fBLIBMTP_mtpdevice_struct::default_video_folder\fP, \fBLIBMTP_mtpdevice_struct::default_zencast_folder\fP, \fBLIBMTP_raw_device_struct::device_entry\fP, \fBLIBMTP_device_entry_struct::device_flags\fP, \fBDEVICE_FLAGS_ANDROID_BUGS\fP, \fBDEVICE_FLAGS_ARICENT_BUGS\fP, \fBDEVICE_FLAGS_SONY_NWZ_BUGS\fP, \fBLIBMTP_raw_device_struct::devnum\fP, \fBLIBMTP_mtpdevice_struct::errorstack\fP, \fBLIBMTP_mtpdevice_struct::extensions\fP, \fBLIBMTP_Get_Storage()\fP, \fBLIBMTP_mtpdevice_struct::maximum_battery_level\fP, \fBLIBMTP_device_extension_struct::name\fP, \fBLIBMTP_device_extension_struct::next\fP, \fBLIBMTP_mtpdevice_struct::object_bitsize\fP, \fBLIBMTP_mtpdevice_struct::params\fP, \fB_PTP_USB::rawdevice\fP, \fBLIBMTP_mtpdevice_struct::storage\fP, and \fBLIBMTP_mtpdevice_struct::usbinfo\fP\&. .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 \fBLIBMTP_mtpdevice_struct::extensions\fP, \fBLIBMTP_Clear_Errorstack()\fP, \fBLIBMTP_device_extension_struct::name\fP, \fBLIBMTP_device_extension_struct::next\fP, \fBLIBMTP_mtpdevice_struct::params\fP, and \fBLIBMTP_mtpdevice_struct::usbinfo\fP\&. .PP Referenced by \fBLIBMTP_Get_Device_By_SerialNumber()\fP, and \fBLIBMTP_Release_Device_List()\fP\&. .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 \fBLIBMTP_Release_Device()\fP, \fBLIBMTP_Release_Device_List()\fP, and \fBLIBMTP_mtpdevice_struct::next\fP\&. .PP Referenced by \fBLIBMTP_Release_Device_List()\fP\&. .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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "int LIBMTP_Set_Friendlyname (\fBLIBMTP_mtpdevice_t\fP * device, char const *const friendlyname)" 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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .SS "int LIBMTP_Set_Object_String (\fBLIBMTP_mtpdevice_t\fP * device, uint32_t const object_id, \fBLIBMTP_property_t\fP const attribute_id, char const *const string)" 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 const object_id, \fBLIBMTP_property_t\fP const attribute_id, uint16_t const value)" 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 const object_id, \fBLIBMTP_property_t\fP const attribute_id, uint32_t const value)" 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 const object_id, \fBLIBMTP_property_t\fP const attribute_id, uint8_t const value)" 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 *const syncpartner)" 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 \fBLIBMTP_mtpdevice_struct::params\fP\&. .SH "Author" .PP Generated automatically by Doxygen for libmtp from the source code\&.