| Index: examples/folders.c
|
| diff --git a/examples/folders.c b/examples/folders.c
|
| index 34ea9ce30f7e3b1ac49fdc919a9ccf31f031b1be..f139343474d10be20f1e3c22b559522711884b79 100644
|
| --- a/examples/folders.c
|
| +++ b/examples/folders.c
|
| @@ -41,14 +41,13 @@ static void dump_folder_list(LIBMTP_folder_t *folderlist, int level)
|
|
|
| int main (int argc, char **argv)
|
| {
|
| - LIBMTP_raw_device_t *rawdevices;
|
| - int numrawdevices;
|
| - int i;
|
| + LIBMTP_mtpdevice_t *device_list, *device;
|
|
|
| LIBMTP_Init();
|
| printf("Attempting to connect device(s)\n");
|
|
|
| - switch (LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices)) {
|
| + switch(LIBMTP_Get_Connected_Devices(&device_list))
|
| + {
|
| case LIBMTP_ERROR_NO_DEVICE_ATTACHED:
|
| printf("mtp-folders: no devices found\n");
|
| return 0;
|
| @@ -64,7 +63,7 @@ int main (int argc, char **argv)
|
| default:
|
| fprintf(stderr, "mtp-folders: Unknown error, please report "
|
| "this to the libmtp developers\n");
|
| - return 1;
|
| + return 1;
|
|
|
| /* Successfully connected at least one device, so continue */
|
| case LIBMTP_ERROR_NONE:
|
| @@ -72,18 +71,12 @@ int main (int argc, char **argv)
|
| }
|
|
|
| /* iterate through connected MTP devices */
|
| - for (i = 0; i < numrawdevices; i++) {
|
| - LIBMTP_mtpdevice_t *device;
|
| + for(device = device_list; device != NULL; device = device->next)
|
| + {
|
| LIBMTP_devicestorage_t *storage;
|
| char *friendlyname;
|
| int ret;
|
|
|
| - device = LIBMTP_Open_Raw_Device(&rawdevices[i]);
|
| - if (device == NULL) {
|
| - fprintf(stderr, "Unable to open raw device %d\n", i);
|
| - continue;
|
| - }
|
| -
|
| /* Echo the friendly name so we know which device we are working with */
|
| friendlyname = LIBMTP_Get_Friendlyname(device);
|
| if (friendlyname == NULL) {
|
| @@ -121,10 +114,9 @@ int main (int argc, char **argv)
|
| }
|
| LIBMTP_destroy_folder_t(folders);
|
| }
|
| - LIBMTP_Release_Device(device);
|
| }
|
|
|
| - free(rawdevices);
|
| + LIBMTP_Release_Device_List(device_list);
|
| printf("OK.\n");
|
|
|
| return 0;
|
|
|