From 6d12e58a5ae3538b50953f8aa8155810ca9f10c0 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 26 Oct 2020 16:02:43 +0100 Subject: added serial number of device to output of 'mtp-files' --- examples/files.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/files.c b/examples/files.c index 6af3b7b..3ee0846 100644 --- a/examples/files.c +++ b/examples/files.c @@ -21,6 +21,7 @@ * Boston, MA 02111-1307, USA. */ #include "common.h" +#include "ptp.h" #include static void dump_fileinfo(LIBMTP_file_t *file) @@ -117,6 +118,7 @@ int main(int argc, char **argv) for (i = 0; i < numrawdevices; i++) { LIBMTP_mtpdevice_t *device; LIBMTP_devicestorage_t *storage; + PTPParams *params; char *friendlyname; device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]); @@ -127,10 +129,13 @@ int main(int argc, char **argv) /* Echo the friendly name so we know which device we are working with */ friendlyname = LIBMTP_Get_Friendlyname(device); + params = (PTPParams *) device->params; if (friendlyname == NULL) { - printf("Listing File Information on Device with name: (NULL)\n"); + printf("Listing File Information on Device with name: (NULL) [SN:%s]\n", + params->deviceinfo.SerialNumber); } else { - printf("Listing File Information on Device with name: %s\n", friendlyname); + printf("Listing File Information on Device with name: %s [SN:%s]\n", + friendlyname, params->deviceinfo.SerialNumber); free(friendlyname); } -- cgit v1.2.1