Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libmtp for openSUSE:Factory checked 
in at 2023-04-25 16:53:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libmtp (Old)
 and      /work/SRC/openSUSE:Factory/.libmtp.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libmtp"

Tue Apr 25 16:53:47 2023 rev:84 rq:1082464 version:1.1.21

Changes:
--------
--- /work/SRC/openSUSE:Factory/libmtp/libmtp.changes    2022-07-10 
23:15:18.540946900 +0200
+++ /work/SRC/openSUSE:Factory/.libmtp.new.1533/libmtp.changes  2023-04-25 
16:53:48.494392509 +0200
@@ -1,0 +2,28 @@
+Mon Apr 24 09:46:21 UTC 2023 - Marcus Meissner <meiss...@suse.com>
+
+- updated to 1.1.21 release
+  Bugs fixed:
+
+  - Fix LIBMTP_STORAGE_SORTBY_MAXSPACE not working (copy-paste mistake)
+  - fix warnings regarding mismatched parameter docs
+  - fix comment above  sort_storage_bysort_storage_by
+  - Revert "ptp_pack_string: check string length for no iconv situation"
+  - remove dependency on ptp.h
+  - fixed paste error vendor/product id
+  - libusb-glue: check return value of ptp_init_send_memory_handler
+  - ptp_pack_string: check string length for no iconv situation
+  - ptp-pack: fix ucs2str overflow
+
+  Features:
+
+  - add a LIBMTP_FreeMemory function that wraps free()
+  - added functions to get device by serial number
+  - added serial number of device to output of 'mtp-files'
+  - added optional serial number parameter to 'mtp-getfile'
+  - added optional serial number parameter to 'mtp-delfile'
+  - feat: Add LIBMTP_Get_Children() to read the list of raw IDs of a folder.
+  - merge a patch from google 
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/chromiumos-overlay/media-libs/libmtp/files/libmtp-1.1.20-10_remove_nexus_s_from_device_list.patch
+
+  - several new devices added, some device renaming for consistency.
+
+-------------------------------------------------------------------

Old:
----
  libmtp-1.1.20.tar.gz
  libmtp-1.1.20.tar.gz.asc

New:
----
  libmtp-1.1.21.tar.gz
  libmtp-1.1.21.tar.gz.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libmtp.spec ++++++
--- /var/tmp/diff_new_pack.S9YQnn/_old  2023-04-25 16:53:49.054398282 +0200
+++ /var/tmp/diff_new_pack.S9YQnn/_new  2023-04-25 16:53:49.058398323 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libmtp
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
 %{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir 
udev)/rules.d }
 %{!?_udevdir: %global _udevdir %(pkg-config --variable=udevdir udev) }
 Name:           libmtp
-Version:        1.1.20
+Version:        1.1.21
 Release:        0
 Summary:        Commandline utilities for access to MTP Players
 License:        LGPL-2.1-or-later

++++++ libmtp-1.1.20.tar.gz -> libmtp-1.1.21.tar.gz ++++++
++++ 1849 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/INSTALL new/libmtp-1.1.21/INSTALL
--- old/libmtp-1.1.20/INSTALL   2018-09-05 07:22:16.000000000 +0200
+++ new/libmtp-1.1.21/INSTALL   2023-04-16 10:57:46.000000000 +0200
@@ -31,8 +31,10 @@
 ------------
 
 To build libmtp you should only need development files for libusb.
-(Often named libusb-devel or similar.) For working with CVS versions
-you may need autoconf, automake, libtool, pkg-config, gettext(-devel).
+(Often named libusb-devel or similar.)
+
+For working with the GIT versions you will need autoconf, automake,
+libtool, pkg-config, and gettext(-devel).
 
 To enable the optional MTPZ support using libgcrypt you need the
 libgcrypt library installed as well.
@@ -112,6 +114,14 @@
 BASIC BUILD PROCEDURE
 =====================
 
+If you checked out the sources from GIT, you must first run the
+autogen.sh script that generates all the GNU autotools files.
+Notice that this requires GNU autoconf, automake and libtool and
+possibly some other packages like gettext, readline, intltool and
+other M4 macro sources. This is done with:
+
+   % ./autogen.sh
+
 To build the package:
 
    % ./configure
@@ -133,14 +143,6 @@
 
    % make install-docs
 
-if you checked out the sources from CVS, you must first run the
-autogen.sh script that generates all the GNU autotools files.
-Notice that this requires GNU autoconf, automake and libtool and
-possibly some other packages like gettext, readline, intltool and
-other M4 macro sources. This is done with:
-
-   % ./autogen.sh
-
 
 Linux hotplugging
 -----------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/RELEASE-CHECKLIST.md new/libmtp-1.1.21/RELEASE-CHECKLIST.md
--- old/libmtp-1.1.20/RELEASE-CHECKLIST.md      2020-10-11 14:21:26.000000000 
+0200
+++ new/libmtp-1.1.21/RELEASE-CHECKLIST.md      2023-04-22 10:21:50.000000000 
+0200
@@ -5,7 +5,7 @@
 - make check
 - change configure.ac to the new version
 - commit
-- tag this commit with libmtp-1-1-x
+- tag this commit with libmtp-1-1-x and v1.1.x
 - git push --tags              to sourceforge and
 - git push --tags github       to github
 - make dist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/configure.ac new/libmtp-1.1.21/configure.ac
--- old/libmtp-1.1.20/configure.ac      2022-07-02 09:55:32.000000000 +0200
+++ new/libmtp-1.1.21/configure.ac      2023-04-22 10:21:18.000000000 +0200
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.52)
-AC_INIT([libmtp], [1.1.20], [libmtp-disc...@lists.sourceforge.net])
+AC_INIT([libmtp], [1.1.21], [libmtp-disc...@lists.sourceforge.net])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign])
 AC_CONFIG_SRCDIR([src/libmtp.c])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/doc/examples.h new/libmtp-1.1.21/doc/examples.h
--- old/libmtp-1.1.20/doc/examples.h    2013-03-17 09:04:49.000000000 +0100
+++ new/libmtp-1.1.21/doc/examples.h    2022-11-15 10:28:54.000000000 +0100
@@ -1,3 +1,23 @@
+/**
+ *
+ * Copyright (C) 2006 Linus Walleij <tr...@df.lth.se>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
 /*
  * List examples here...
  */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/doc/mainpage.h new/libmtp-1.1.21/doc/mainpage.h
--- old/libmtp-1.1.20/doc/mainpage.h    2013-03-17 09:04:49.000000000 +0100
+++ new/libmtp-1.1.21/doc/mainpage.h    2022-11-15 10:28:54.000000000 +0100
@@ -1,4 +1,24 @@
 /**
+ *
+ * Copyright (C) 2006 Linus Walleij <tr...@df.lth.se>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
  * \mainpage The official libmtp documentation
  *
  * \section Introduction
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/albums.c new/libmtp-1.1.21/examples/albums.c
--- old/libmtp-1.1.20/examples/albums.c 2017-03-06 07:00:27.000000000 +0100
+++ new/libmtp-1.1.21/examples/albums.c 2023-04-22 10:18:23.000000000 +0200
@@ -137,7 +137,7 @@
       printf("Retrieving Albums on Device with name: (NULL)\n");
     } else {
       printf("Retrieving Albums on Device with name: %s\n", friendlyname);
-      free(friendlyname);
+      LIBMTP_FreeMemory(friendlyname);
     }
 
     LIBMTP_Dump_Errorstack(device);
@@ -150,7 +150,7 @@
     LIBMTP_Release_Device(device);
   }
 
-  free(rawdevices);
+  LIBMTP_FreeMemory(rawdevices);
 
   printf("OK.\n");
   return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/delfile.c new/libmtp-1.1.21/examples/delfile.c
--- old/libmtp-1.1.20/examples/delfile.c        2020-07-22 10:57:52.000000000 
+0200
+++ new/libmtp-1.1.21/examples/delfile.c        2022-11-15 10:28:49.000000000 
+0100
@@ -34,7 +34,7 @@
 
 void delfile_usage(void)
 {
-  printf("Usage: delfile [<deviceid>] -n <fileid/trackid> | -f <filename> 
...\n");
+  printf("Usage: delfile [<deviceid> | SN:<serialnumber>] -n <fileid/trackid> 
| -f <filename> ...\n");
 }
 
 int
@@ -61,19 +61,8 @@
   if (argc >= 3 && argv[1][0] == '-')
     return LIBMTP_Get_First_Device();
 
-  if (argc >= 4) {
-    uint32_t id;
-    char *endptr;
-
-    // Sanity check device ID
-    id = strtoul(argv[1], &endptr, 10);
-    if ( *endptr != 0 ) {
-      fprintf(stderr, "illegal value %s\n", argv[1]);
-      return NULL;
-    }
-
-    return LIBMTP_Get_Device(id);
-  }
+  if (argc >= 4)
+    return LIBMTP_Get_Device_By_ID(argv[1]);
 
   delfile_usage();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/detect.c new/libmtp-1.1.21/examples/detect.c
--- old/libmtp-1.1.20/examples/detect.c 2017-03-06 07:00:27.000000000 +0100
+++ new/libmtp-1.1.21/examples/detect.c 2023-04-22 10:18:38.000000000 +0200
@@ -158,14 +158,14 @@
       fprintf(stdout, "   Friendly name: (NULL)\n");
     } else {
       fprintf(stdout, "   Friendly name: %s\n", friendlyname);
-      free(friendlyname);
+      LIBMTP_FreeMemory(friendlyname);
     }
     syncpartner = LIBMTP_Get_Syncpartner(device);
     if (syncpartner == NULL) {
       fprintf(stdout, "   Synchronization partner: (NULL)\n");
     } else {
       fprintf(stdout, "   Synchronization partner: %s\n", syncpartner);
-      free(syncpartner);
+      LIBMTP_FreeMemory(syncpartner);
     }
 
     // Some battery info
@@ -196,7 +196,7 @@
     ret = LIBMTP_Get_Secure_Time(device, &sectime);
     if (ret == 0 && sectime != NULL) {
       fprintf(stdout, "\nSecure Time:\n%s\n", sectime);
-      free(sectime);
+      LIBMTP_FreeMemory(sectime);
     } else {
       // Silently ignore - there may be devices not supporting secure time.
       LIBMTP_Clear_Errorstack(device);
@@ -214,7 +214,7 @@
       ret = LIBMTP_Get_Device_Certificate(device, &devcert);
       if (ret == 0 && devcert != NULL) {
        fprintf(stdout, "\nDevice Certificate:\n%s\n", devcert);
-       free(devcert);
+       LIBMTP_FreeMemory(devcert);
       } else {
        fprintf(stdout, "Unable to acquire device certificate, perhaps this 
device "
                "does not support this\n");
@@ -260,7 +260,7 @@
                    printf("Could not allocate %08x bytes...\n", XML_BUFSIZE);
                    LIBMTP_Dump_Errorstack(device);
                    LIBMTP_Clear_Errorstack(device);
-                   free(rawdevices);
+                   LIBMTP_FreeMemory(rawdevices);
                    return 1;
                  }
 
@@ -275,7 +275,7 @@
                    LIBMTP_Dump_Errorstack(device);
                    LIBMTP_Clear_Errorstack(device);
                  }
-                 free(buf);
+                 LIBMTP_FreeMemory(buf);
                } else {
                  LIBMTP_Dump_Errorstack(device);
                  LIBMTP_Clear_Errorstack(device);
@@ -293,7 +293,7 @@
     LIBMTP_Release_Device(device);
   } /* End For Loop */
 
-  free(rawdevices);
+  LIBMTP_FreeMemory(rawdevices);
 
   printf("OK.\n");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/evolution-sync.sh 
new/libmtp-1.1.21/examples/evolution-sync.sh
--- old/libmtp-1.1.20/examples/evolution-sync.sh        2013-03-17 
09:04:49.000000000 +0100
+++ new/libmtp-1.1.21/examples/evolution-sync.sh        2022-11-15 
10:28:54.000000000 +0100
@@ -1,4 +1,21 @@
 #!/bin/bash
+#
+# Copyright (C) 2006 Linus Walleij <tr...@df.lth.se>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
 
 # Example evolution synchronization script by Nicolas Tetreault,
 # modified by Linus Walleij.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/files.c new/libmtp-1.1.21/examples/files.c
--- old/libmtp-1.1.20/examples/files.c  2017-03-06 07:00:27.000000000 +0100
+++ new/libmtp-1.1.21/examples/files.c  2023-04-22 10:18:43.000000000 +0200
@@ -118,6 +118,7 @@
     LIBMTP_mtpdevice_t *device;
     LIBMTP_devicestorage_t *storage;
     char *friendlyname;
+    char *serialnr;
 
     device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]);
     if (device == NULL) {
@@ -127,11 +128,14 @@
 
     /* Echo the friendly name so we know which device we are working with */
     friendlyname = LIBMTP_Get_Friendlyname(device);
+    serialnr = LIBMTP_Get_Serialnumber(device);
     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",
+             serialnr);
     } else {
-      printf("Listing File Information on Device with name: %s\n", 
friendlyname);
-      free(friendlyname);
+      printf("Listing File Information on Device with name: %s [SN:%s]\n",
+             friendlyname, serialnr);
+      LIBMTP_FreeMemory(friendlyname);
     }
 
     LIBMTP_Dump_Errorstack(device);
@@ -144,7 +148,7 @@
     LIBMTP_Release_Device(device);
   }
 
-  free(rawdevices);
+  LIBMTP_FreeMemory(rawdevices);
 
   printf("OK.\n");
   exit (0);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/filetree.c new/libmtp-1.1.21/examples/filetree.c
--- old/libmtp-1.1.20/examples/filetree.c       2017-03-06 07:00:27.000000000 
+0100
+++ new/libmtp-1.1.21/examples/filetree.c       2023-04-22 10:18:47.000000000 
+0200
@@ -134,7 +134,7 @@
       printf("Device: (NULL)\n");
     } else {
       printf("Device: %s\n", friendlyname);
-      free(friendlyname);
+      LIBMTP_FreeMemory(friendlyname);
     }
 
     /* Get all storages for this device */
@@ -154,7 +154,7 @@
     LIBMTP_Release_Device(device);
   } /* End For Loop */
 
-  free(rawdevices);
+  LIBMTP_FreeMemory(rawdevices);
 
   printf("OK.\n");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/folders.c new/libmtp-1.1.21/examples/folders.c
--- old/libmtp-1.1.20/examples/folders.c        2013-11-30 19:15:12.000000000 
+0100
+++ new/libmtp-1.1.21/examples/folders.c        2023-04-22 10:18:51.000000000 
+0200
@@ -90,7 +90,7 @@
       printf("Friendly name: (NULL)\n");
     } else {
       printf("Friendly name: %s\n", friendlyname);
-      free(friendlyname);
+      LIBMTP_FreeMemory(friendlyname);
     }
 
     LIBMTP_Dump_Errorstack(device);
@@ -124,7 +124,7 @@
     LIBMTP_Release_Device(device);
   }
 
-  free(rawdevices);
+  LIBMTP_FreeMemory(rawdevices);
   printf("OK.\n");
 
   return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/getfile.c new/libmtp-1.1.21/examples/getfile.c
--- old/libmtp-1.1.20/examples/getfile.c        2020-07-20 13:00:55.000000000 
+0200
+++ new/libmtp-1.1.21/examples/getfile.c        2022-11-15 10:28:49.000000000 
+0100
@@ -33,7 +33,7 @@
 
 void getfile_usage (void)
 {
-  fprintf(stderr, "getfile [<deviceid>] <fileid/trackid> <filename>\n");
+  fprintf(stderr, "getfile [<deviceid> | SN:<serialnumber>] <fileid/trackid> 
<filename>\n");
 }
 
 int
@@ -57,19 +57,8 @@
   if (argc == 3)
     return LIBMTP_Get_First_Device();
 
-  if (argc == 4) {
-    uint32_t id;
-    char *endptr;
-
-    // Sanity check device ID
-    id = strtoul(argv[1], &endptr, 10);
-    if ( *endptr != 0 ) {
-      fprintf(stderr, "illegal value %s\n", argv[1]);
-      return NULL;
-    }
-
-    return LIBMTP_Get_Device(id);
-  }
+  if (argc == 4)
+    return LIBMTP_Get_Device_By_ID(argv[1]);
 
   getfile_usage();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/examples/tracks.c new/libmtp-1.1.21/examples/tracks.c
--- old/libmtp-1.1.20/examples/tracks.c 2017-03-06 07:00:27.000000000 +0100
+++ new/libmtp-1.1.21/examples/tracks.c 2023-04-22 10:20:08.000000000 +0200
@@ -168,7 +168,7 @@
       printf("Friendly name: (NULL)\n");
     } else {
       printf("Friendly name: %s\n", friendlyname);
-      free(friendlyname);
+      LIBMTP_FreeMemory(friendlyname);
     }
 
     LIBMTP_Dump_Errorstack(device);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/libmtp.pc new/libmtp-1.1.21/libmtp.pc
--- old/libmtp-1.1.20/libmtp.pc 2022-07-02 09:55:55.000000000 +0200
+++ new/libmtp-1.1.21/libmtp.pc 2023-04-22 10:22:18.000000000 +0200
@@ -1,13 +1,13 @@
 # libmtp pkg-config source file
 
-prefix=/usr
+prefix=/usr/local
 exec_prefix=${prefix}
-libdir=/usr/lib64
+libdir=${exec_prefix}/lib64
 includedir=${prefix}/include
 
 Name: libmtp
 Description: libmtp is a library for accessing Media Transfer Protocol devices
-Version: 1.1.20
+Version: 1.1.21
 Requires.private: libusb-1.0
 Conflicts:
 Libs: -L${libdir} -lmtp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/libmtp.c new/libmtp-1.1.21/src/libmtp.c
--- old/libmtp-1.1.20/src/libmtp.c      2022-06-28 10:49:16.000000000 +0200
+++ new/libmtp-1.1.21/src/libmtp.c      2023-04-22 10:16:46.000000000 +0200
@@ -1722,6 +1722,80 @@
 }
 
 /**
+ * Get connected MTP device by serial number.
+ * @return a device pointer.
+ * @see LIBMTP_Get_Connected_Devices()
+ */
+LIBMTP_mtpdevice_t *LIBMTP_Get_Device_By_SerialNumber(char *serial_number)
+{
+  LIBMTP_mtpdevice_t *device = NULL;
+  LIBMTP_raw_device_t *devices;
+  int numdevs;
+  LIBMTP_error_number_t ret;
+  PTPParams *params;
+  int found_device = 0;
+  int i;
+
+  if (serial_number == NULL || *serial_number == '\0')
+    return NULL;
+
+  ret = LIBMTP_Detect_Raw_Devices(&devices, &numdevs);
+  if (ret != LIBMTP_ERROR_NONE)
+    return NULL;
+
+  if (devices == NULL || numdevs == 0) {
+    free(devices);
+    return NULL;
+  }
+
+  for (i = 0; i < numdevs; i++) {
+    device = LIBMTP_Open_Raw_Device(&devices[i]);
+    if (device == NULL)
+      continue;
+
+    params = (PTPParams *) device->params;
+    if (strcmp(params->deviceinfo.SerialNumber, serial_number) == 0) {
+      found_device = 1;
+      break;
+    }
+
+    LIBMTP_Release_Device(device);
+  }
+
+  free(devices);
+
+  if (!found_device)
+    return NULL;
+
+  return device;
+}
+
+/**
+ * Get connected MTP device by list position or serial number.
+ * @return a device pointer.
+ * @see LIBMTP_Get_Connected_Devices()
+ */
+LIBMTP_mtpdevice_t *LIBMTP_Get_Device_By_ID(char *device_id)
+{
+  uint32_t device_nr;
+  char *endptr;
+
+  if (device_id == NULL || *device_id == '\0')
+    return NULL;
+
+  // 1st try: serial number
+  if (strlen(device_id) > 3 && strncmp(device_id, "SN:", 3) == 0)
+    return LIBMTP_Get_Device_By_SerialNumber(device_id + 3);
+
+  // 2nd try: device number
+  device_nr = strtoul(device_id, &endptr, 10);
+  if (*endptr == '\0')
+    return LIBMTP_Get_Device(device_nr);
+
+  return NULL;
+}
+
+/**
  * Overriding debug function.
  * This way we can disable debug prints.
  */
@@ -2956,10 +3030,9 @@
 }
 
 /**
- * This function traverses a devices storage list freeing up the
- * strings and the structs.
+ * This function sorts a devices storage list according to the criteria passed.
  * @param device a pointer to the MTP device to free the storage
- * list for.
+ * @param sortby LIBMTP_STORAGE_SORTBY_* flag to sort the list for (either by 
free space or maximum space)
  */
 static int sort_storage_by(LIBMTP_mtpdevice_t *device,int const sortby)
 {
@@ -2980,7 +3053,7 @@
 
       if (sortby == LIBMTP_STORAGE_SORTBY_FREESPACE && ptr1->FreeSpaceInBytes 
> ptr2->FreeSpaceInBytes)
         ptr2 = ptr1;
-      if (sortby == LIBMTP_STORAGE_SORTBY_MAXSPACE && ptr1->FreeSpaceInBytes > 
ptr2->FreeSpaceInBytes)
+      if (sortby == LIBMTP_STORAGE_SORTBY_MAXSPACE && ptr1->MaxCapacity > 
ptr2->MaxCapacity)
         ptr2 = ptr1;
 
       ptr1 = ptr1->next;
@@ -3117,7 +3190,7 @@
  * device storage list.
  * @param device a pointer to the MTP device to free the storage
  * list for.
- * @param storageid the storage ID for the storage to flush and
+ * @param storage a pointer to the storage to flush and
  * get free space for.
  * @param freespace the free space on this storage will be returned
  * in this variable.
@@ -3798,7 +3871,7 @@
  * if it's too big.
  * @param device a pointer to the device.
  * @param filesize the size of the file to check whether it will fit.
- * @param storageid the ID of the storage to try to fit the file on.
+ * @param storage a pointer to the storage to try to fit the file on.
  * @return 0 if the file fits, any other value means failure.
  */
 static int check_if_file_fits(LIBMTP_mtpdevice_t *device,
@@ -4584,6 +4657,63 @@
   return retfiles;
 }
 
+/**
+ * This function retrieves the list of ids of files and folders in a certain
+ * folder with id parent on a certain storage on a certain device.
+ * The device used with this operations must have been opened with
+ * LIBMTP_Open_Raw_Device_Uncached() or it will fail.
+ *
+ * NOTE: the request will always perform I/O with the device.
+ * @param device a pointer to the MTP device to report info from.
+ * @param storage a storage on the device to report info from. If
+ *        0 is passed in, the files for the given parent will be
+ *        searched across all available storages.
+ * @param parent the parent folder id.
+ * @param out the pointer where the array of ids is returned. It is
+ *        set only when the returned value > 0. The caller takes the
+ *        ownership of the array and has to free() it.
+ * @return the length of the returned array or -1 in case of failure.
+ */
+
+int LIBMTP_Get_Children(LIBMTP_mtpdevice_t *device,
+                        uint32_t const storage,
+                        uint32_t const parent,
+                        uint32_t **out)
+{
+  PTPParams *params = (PTPParams *) device->params;
+  PTPObjectHandles currentHandles;
+  uint32_t storageid;
+  uint16_t ret;
+
+  if (device->cached) {
+    // This function is only supposed to be used by devices
+    // opened as uncached!
+    LIBMTP_ERROR("tried to use %s on a cached device!\n", __func__);
+    return -1;
+  }
+
+  if (storage == 0)
+    storageid = PTP_GOH_ALL_STORAGE;
+  else
+    storageid = storage;
+
+  ret = ptp_getobjecthandles(params,
+                             storageid,
+                             PTP_GOH_ALL_FORMATS,
+                             parent,
+                             &currentHandles);
+
+  if (ret != PTP_RC_OK) {
+    add_ptp_error_to_errorstack(device, ret,
+        "LIBMTP_Get_Children(): could not get object handles.");
+    return -1;
+  }
+
+  if (currentHandles.Handler == NULL || currentHandles.n == 0)
+    return 0;
+  *out = currentHandles.Handler;
+  return currentHandles.n;
+}
 
 /**
  * This creates a new track metadata structure and allocates memory
@@ -4750,7 +4880,6 @@
  * This function retrieves the track metadata for a track
  * given by a unique ID.
  * @param device a pointer to the device to get the track metadata off.
- * @param trackid the unique ID of the track.
  * @param objectformat the object format of this track, so we know what it 
supports.
  * @param track a metadata set to fill in.
  */
@@ -5557,8 +5686,8 @@
 
 /**
  * This helper function checks if a filename already exists on the device
- * @param PTPParams*
- * @param string representing the filename
+ * @param params the PTP params to check against
+ * @param filename a string representing the filename
  * @return 0 if the filename doesn't exist, -1 if it does
  */
 static int check_filename_exists(PTPParams* params, char const * const 
filename)
@@ -5578,7 +5707,8 @@
 
 /**
  * This helper function returns a unique filename, with a random string before 
the extension
- * @param string representing the original filename
+ * @param params the PTP params to check against
+ * @param filename string representing the original filename
  * @return a string representing the unique filename
  */
 static char *generate_unique_filename(PTPParams* params, char const * const 
filename)
@@ -8905,7 +9035,7 @@
  * maximum size, dimensions, etc..
  * @param device a pointer to the device which the object is on.
  * @param id unique id of the object to set artwork for.
- * @param pointer to LIBMTP_filesampledata_t struct containing data
+ * @param sampledata pointer to LIBMTP_filesampledata_t struct containing data
  * @return 0 on success, any other value means failure.
  * @see LIBMTP_Get_Representative_Sample()
  * @see LIBMTP_Get_Representative_Sample_Format()
@@ -9000,7 +9130,7 @@
  * if the device supports it.
  * @param device a pointer to the device which the object is on.
  * @param id unique id of the object to get data for.
- * @param pointer to LIBMTP_filesampledata_t struct to receive data
+ * @param sampledata pointer to LIBMTP_filesampledata_t struct to receive data
  * @return 0 on success, any other value means failure.
  * @see LIBMTP_Send_Representative_Sample()
  * @see LIBMTP_Get_Representative_Sample_Format()
@@ -9333,3 +9463,12 @@
 
   return 0;
 }
+
+/**
+ * Free memory allocated by libmtp. Is doing the same as libc free(mem) in 
most cases.
+ * @mem pointer to allocated memory.
+ */
+void LIBMTP_FreeMemory(void *mem)
+{
+  free (mem);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/libmtp.h new/libmtp-1.1.21/src/libmtp.h
--- old/libmtp-1.1.20/src/libmtp.h      2022-07-02 09:55:55.000000000 +0200
+++ new/libmtp-1.1.21/src/libmtp.h      2023-04-22 10:22:17.000000000 +0200
@@ -29,8 +29,8 @@
 #ifndef LIBMTP_H_INCLUSION_GUARD
 #define LIBMTP_H_INCLUSION_GUARD
 
-#define LIBMTP_VERSION 1.1.20
-#define LIBMTP_VERSION_STRING "1.1.20"
+#define LIBMTP_VERSION 1.1.21
+#define LIBMTP_VERSION_STRING "1.1.21"
 
 /* This handles MSVC pecularities */
 #ifdef _MSC_VER
@@ -843,6 +843,8 @@
 /* Begin old, legacy interface */
 LIBMTP_mtpdevice_t *LIBMTP_Get_Device(int);
 LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void);
+LIBMTP_mtpdevice_t *LIBMTP_Get_Device_By_SerialNumber(char *);
+LIBMTP_mtpdevice_t *LIBMTP_Get_Device_By_ID(char *);
 LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **);
 uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *);
 void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*);
@@ -869,6 +871,8 @@
 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*);
 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*);
 
+void LIBMTP_FreeMemory(void *);
+
 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0
 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1
 #define LIBMTP_STORAGE_SORTBY_MAXSPACE  2
@@ -921,6 +925,10 @@
 LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *,
                                             uint32_t const,
                                             uint32_t const);
+int LIBMTP_Get_Children(LIBMTP_mtpdevice_t *,
+                        uint32_t const,
+                        uint32_t const,
+                        uint32_t **);
 LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const);
 int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
                        LIBMTP_progressfunc_t const, void const * const);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/libmtp.h.in new/libmtp-1.1.21/src/libmtp.h.in
--- old/libmtp-1.1.20/src/libmtp.h.in   2022-06-28 10:49:33.000000000 +0200
+++ new/libmtp-1.1.21/src/libmtp.h.in   2023-04-22 10:15:24.000000000 +0200
@@ -843,6 +843,8 @@
 /* Begin old, legacy interface */
 LIBMTP_mtpdevice_t *LIBMTP_Get_Device(int);
 LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void);
+LIBMTP_mtpdevice_t *LIBMTP_Get_Device_By_SerialNumber(char *);
+LIBMTP_mtpdevice_t *LIBMTP_Get_Device_By_ID(char *);
 LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **);
 uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *);
 void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*);
@@ -869,6 +871,8 @@
 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*);
 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*);
 
+void LIBMTP_FreeMemory(void *);
+
 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0
 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1
 #define LIBMTP_STORAGE_SORTBY_MAXSPACE  2
@@ -921,6 +925,10 @@
 LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *,
                                             uint32_t const,
                                             uint32_t const);
+int LIBMTP_Get_Children(LIBMTP_mtpdevice_t *,
+                        uint32_t const,
+                        uint32_t const,
+                        uint32_t **);
 LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const);
 int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
                        LIBMTP_progressfunc_t const, void const * const);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/libmtp.sym new/libmtp-1.1.21/src/libmtp.sym
--- old/libmtp-1.1.20/src/libmtp.sym    2020-07-20 13:00:55.000000000 +0200
+++ new/libmtp-1.1.21/src/libmtp.sym    2023-04-22 10:17:00.000000000 +0200
@@ -7,6 +7,8 @@
 LIBMTP_Open_Raw_Device_Uncached
 LIBMTP_Get_Device
 LIBMTP_Get_First_Device
+LIBMTP_Get_Device_By_SerialNumber
+LIBMTP_Get_Device_By_ID
 LIBMTP_Get_Connected_Devices
 LIBMTP_Number_Devices_In_List
 LIBMTP_Release_Device_List
@@ -49,6 +51,7 @@
 LIBMTP_Get_Filelisting
 LIBMTP_Get_Filelisting_With_Callback
 LIBMTP_Get_Files_And_Folders
+LIBMTP_Get_Children
 LIBMTP_Get_Filemetadata
 LIBMTP_Get_File_To_File
 LIBMTP_Get_File_To_File_Descriptor
@@ -114,3 +117,4 @@
 LIBMTP_TruncateObject
 LIBMTP_Check_Capability
 LIBMTP_Custom_Operation
+LIBMTP_FreeMemory
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/libopenusb1-glue.c 
new/libmtp-1.1.21/src/libopenusb1-glue.c
--- old/libmtp-1.1.20/src/libopenusb1-glue.c    2020-12-19 11:05:16.000000000 
+0100
+++ new/libmtp-1.1.21/src/libopenusb1-glue.c    2023-04-16 10:52:39.000000000 
+0200
@@ -700,7 +700,7 @@
     LIBMTP_INFO("         Vendor: %s\n", 
ptp_usb->rawdevice.device_entry.vendor);
     LIBMTP_INFO("         Vendor id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.vendor_id);
     LIBMTP_INFO("         Product: %s\n", 
ptp_usb->rawdevice.device_entry.product);
-    LIBMTP_INFO("         Vendor id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.product_id);
+    LIBMTP_INFO("         Product id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.product_id);
     LIBMTP_INFO("         Device flags: 0x%08x\n", 
ptp_usb->rawdevice.device_entry.device_flags);
     // TODO: (void) probe_device_descriptor(dev, stdout);
 }
@@ -1179,7 +1179,10 @@
     usbreq.payload.params.param5 = htod32(req->Param5);
     /* send it to responder */
     towrite = PTP_USB_BULK_REQ_LEN - (sizeof (uint32_t)*(5 - req->Nparam));
-    ptp_init_send_memory_handler(&memhandler, (unsigned char*) &usbreq, 
towrite);
+    ret = ptp_init_send_memory_handler(&memhandler, (unsigned char*) &usbreq, 
towrite);
+    if (ret != PTP_RC_OK) {
+        return ret;
+    }
     ret = ptp_write_func(
             towrite,
             &memhandler,
@@ -1244,7 +1247,10 @@
             return PTP_RC_GeneralError;
         }
     }
-    ptp_init_send_memory_handler(&memhandler, (unsigned char *) &usbdata, 
wlen);
+    ret = ptp_init_send_memory_handler(&memhandler, (unsigned char *) 
&usbdata, wlen);
+    if (ret != PTP_RC_OK) {
+        return ret;
+    }
     /* send first part of data */
     ret = ptp_write_func(wlen, &memhandler, params->data, &written);
     ptp_exit_send_memory_handler(&memhandler);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/libusb-glue.c new/libmtp-1.1.21/src/libusb-glue.c
--- old/libmtp-1.1.20/src/libusb-glue.c 2020-12-19 11:05:16.000000000 +0100
+++ new/libmtp-1.1.21/src/libusb-glue.c 2023-04-16 10:52:35.000000000 +0200
@@ -727,7 +727,7 @@
   LIBMTP_INFO("         Vendor: %s\n", ptp_usb->rawdevice.device_entry.vendor);
   LIBMTP_INFO("         Vendor id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.vendor_id);
   LIBMTP_INFO("         Product: %s\n", 
ptp_usb->rawdevice.device_entry.product);
-  LIBMTP_INFO("         Vendor id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.product_id);
+  LIBMTP_INFO("         Product id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.product_id);
   LIBMTP_INFO("         Device flags: 0x%08x\n", 
ptp_usb->rawdevice.device_entry.device_flags);
   (void) probe_device_descriptor(dev, stdout);
 }
@@ -1171,7 +1171,10 @@
        usbreq.payload.params.param5=htod32(req->Param5);
        /* send it to responder */
        towrite = PTP_USB_BULK_REQ_LEN-(sizeof(uint32_t)*(5-req->Nparam));
-       ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, 
towrite);
+       ret = ptp_init_send_memory_handler (&memhandler, (unsigned 
char*)&usbreq, towrite);
+       if (ret != PTP_RC_OK) {
+               return ret;
+       }
        ret=ptp_write_func(
                towrite,
                &memhandler,
@@ -1234,7 +1237,10 @@
                if (gotlen != datawlen)
                        return PTP_RC_GeneralError;
        }
-       ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, 
wlen);
+       ret = ptp_init_send_memory_handler (&memhandler, (unsigned char 
*)&usbdata, wlen);
+       if (ret != PTP_RC_OK) {
+               return ret;
+       }
        /* send first part of data */
        ret = ptp_write_func(wlen, &memhandler, params->data, &written);
        ptp_exit_send_memory_handler (&memhandler);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/libusb1-glue.c new/libmtp-1.1.21/src/libusb1-glue.c
--- old/libmtp-1.1.20/src/libusb1-glue.c        2021-09-25 16:13:25.000000000 
+0200
+++ new/libmtp-1.1.21/src/libusb1-glue.c        2023-04-22 10:00:20.000000000 
+0200
@@ -209,7 +209,6 @@
  * of USB MTP devices
  * @param devlist dynamic linked list of pointers to usb devices with MTP
  * properties.
- * @return nothing
  */
 static void free_mtpdevice_list(mtpdevice_list_t *devlist)
 {
@@ -748,7 +747,7 @@
   LIBMTP_INFO("         Vendor: %s\n", ptp_usb->rawdevice.device_entry.vendor);
   LIBMTP_INFO("         Vendor id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.vendor_id);
   LIBMTP_INFO("         Product: %s\n", 
ptp_usb->rawdevice.device_entry.product);
-  LIBMTP_INFO("         Vendor id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.product_id);
+  LIBMTP_INFO("         Product id: 0x%04x\n", 
ptp_usb->rawdevice.device_entry.product_id);
   LIBMTP_INFO("         Device flags: 0x%08x\n", 
ptp_usb->rawdevice.device_entry.device_flags);
   (void) probe_device_descriptor(dev, stdout);
 }
@@ -1278,7 +1277,10 @@
        usbreq.payload.params.param5=htod32(req->Param5);
        /* send it to responder */
        towrite = PTP_USB_BULK_REQ_LEN-(sizeof(uint32_t)*(5-req->Nparam));
-       ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, 
towrite);
+       ret = ptp_init_send_memory_handler (&memhandler, (unsigned 
char*)&usbreq, towrite);
+       if (ret != PTP_RC_OK) {
+               return ret;
+       }
        ret=ptp_write_func(
                towrite,
                &memhandler,
@@ -1341,7 +1343,10 @@
                if (gotlen != datawlen)
                        return PTP_RC_GeneralError;
        }
-       ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, 
wlen);
+       ret = ptp_init_send_memory_handler (&memhandler, (unsigned char 
*)&usbdata, wlen);
+       if (ret != PTP_RC_OK) {
+               return ret;
+       }
        /* send first part of data */
        ret = ptp_write_func(wlen, &memhandler, params->data, &written);
        ptp_exit_send_memory_handler (&memhandler);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/music-players.h new/libmtp-1.1.21/src/music-players.h
--- old/libmtp-1.1.20/src/music-players.h       2022-06-25 11:06:18.000000000 
+0200
+++ new/libmtp-1.1.21/src/music-players.h       2023-04-22 10:12:14.000000000 
+0200
@@ -1323,13 +1323,11 @@
       0x9039, DEVICE_FLAGS_ANDROID_BUGS },
 
   /* https://github.com/libmtp/libmtp/issues/78 */
-  { "OnePlus", 0x05c6, "OnePlus 7Pro (MTP)",
+  { "OnePlus", 0x05c6, "OnePlus 7 Pro (MTP)",
       0xf000, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1513/ */
-  { "Qualcomm (for OnePlus)", 0x05c6, "One Plus 2 (A2003) (MTP)",
-      0xf003, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1284/ */
-  { "Qualcomm (for Highscreen)", 0x05c6, "Omega Prime S",
+  { "Qualcomm (for OnePlus)", 0x05c6, "OnePlus 2 (A2003) (MTP)",
       0xf003, DEVICE_FLAGS_ANDROID_BUGS },
 
   /*
@@ -1558,9 +1556,11 @@
   { "LG Electronics Inc.", 0x1004, "Android phone (ID2)", 0x61f9,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1007/ */
-  { "LG Electronics Inc.", 0x1004, "LG VS980", 0x621c,
+  /* https://sourceforge.net/p/libmtp/bugs/1924/ */
+  { "LG Electronics Inc.", 0x1004, "G2 (VS980)", 0x621c,
       DEVICE_FLAGS_ANDROID_BUGS },
-  { "LG Electronics Inc.", 0x1004, "LG2 Optimus", 0x6225,
+  /* https://sourceforge.net/p/libmtp/bugs/1924/ */
+  { "LG Electronics Inc.", 0x1004, "G2", 0x6225,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1386/ */
   { "LG Electronics Inc.", 0x1004, "LG VS950", 0x622a,
@@ -1712,6 +1712,9 @@
   /* hartmut...@users.sourceforge.net */
   { "Sony", 0x054c, "NW-A45 Walkman", 0x0c71,
       DEVICE_FLAGS_SONY_NWZ_BUGS },
+  /* https://github.com/libmtp/libmtp/issues/130 */
+  { "Sony", 0x054c, "NW-A105", 0x0d00,
+      DEVICE_FLAGS_SONY_NWZ_BUGS },
   /* https://github.com/libmtp/libmtp/issues/81 */
   { "Sony", 0x054c, "NW-ZX500", 0x0d01,
       DEVICE_FLAGS_SONY_NWZ_BUGS },
@@ -1835,7 +1838,7 @@
    * Ah Hong <hongs...@users.sourceforge.net>
    * Eowyn Carter
    */
-  { "SonyEricsson", 0x0fce,  "c1605 Xperia Dual E MTP", 0x0146,
+  { "SonyEricsson", 0x0fce,  "Xperia Dual E MTP", 0x0146,
       DEVICE_FLAG_NONE },
   { "SonyEricsson", 0x0fce, "LT15i Xperia arc S MTP", 0x014f,
       DEVICE_FLAG_NONE },
@@ -1943,62 +1946,62 @@
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia Z3 Tablet MTP", 0x01c0,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria M4 Aqua Dual MTP", 0x01c4,
+  { "SONY", 0x0fce, "Xperia M4 Aqua Dual MTP", 0x01c4,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "E2115 MTP", 0x01c5,
+  { "SONY", 0x0fce, "Xperia E4 Dual MTP", 0x01c5,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z3+ MTP", 0x01c9,
+  { "SONY", 0x0fce, "Xperia Z3+ MTP", 0x01c9,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria E4g MTP", 0x01cb,
+  { "SONY", 0x0fce, "Xperia E4g MTP", 0x01cb,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "C4 Dual MTP", 0x01d2,
+  { "SONY", 0x0fce, "Xperia C4 Dual MTP", 0x01d2,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria M5 MTP", 0x01d6,
+  { "SONY", 0x0fce, "Xperia M5 MTP", 0x01d6,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 MTP", 0x01d9,
+  { "SONY", 0x0fce, "Xperia Z5 MTP", 0x01d9,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 Compact MTP", 0x01da,
+  { "SONY", 0x0fce, "Xperia Z5 Compact MTP", 0x01da,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/feature-requests/236/ */
-  { "SONY", 0x0fce, "XPeria Z5 Premium Dual Sim MTP", 0x01db,
+  { "SONY", 0x0fce, "Xperia Z5 Premium Dual Sim MTP", 0x01db,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/bugs/1649/ */
-  { "SONY", 0x0fce, "XPeria XA MTP", 0x01de,
+  { "SONY", 0x0fce, "Xperia XA MTP", 0x01de,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria X MTP", 0x01e0,
+  { "SONY", 0x0fce, "Xperia X MTP", 0x01e0,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/feature-requests/251/ */
-  { "SONY", 0x0fce, "XPeria SOV33", 0x01e1,
+  { "SONY", 0x0fce, "Xperia SOV33", 0x01e1,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ MTP", 0x01e7,
+  { "SONY", 0x0fce, "Xperia XZ MTP", 0x01e7,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria X Compact MTP", 0x01e8,
+  { "SONY", 0x0fce, "Xperia X Compact MTP", 0x01e8,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/feature-requests/252/ */
-  { "SONY", 0x0fce, "XPeria G3123", 0x01eb,
+  { "SONY", 0x0fce, "Xperia XA1", 0x01eb,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/support-requests/247/ */
-  { "SONY", 0x0fce, "XPeria XZ", 0x01ed,
+  { "SONY", 0x0fce, "Xperia XZ", 0x01ed,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/bugs/1812/ */
-  { "SONY", 0x0fce, "XPeria XA1 Ultra", 0x01ef,
+  { "SONY", 0x0fce, "Xperia XA1 Ultra", 0x01ef,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/support-requests/251/ */
-  { "SONY", 0x0fce, "XPeria XZ Premium", 0x01f1,
+  { "SONY", 0x0fce, "Xperia XZ Premium", 0x01f1,
       DEVICE_FLAG_NONE },
   /* Nicholas O'Connor <lavac...@lavacano.net> on libmtp-discuss */
-  { "SONY", 0x0fce, "XPeria XZ1", 0x01f3,
+  { "SONY", 0x0fce, "Xperia XZ1", 0x01f3,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/support-requests/252/ */
-  { "SONY", 0x0fce, "XPeria XZ1 Compact", 0x01f4,
+  { "SONY", 0x0fce, "Xperia XZ1 Compact", 0x01f4,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/feature-requests/281/ */
-  { "SONY", 0x0fce, "XPeria L2", 0x01f6,
+  { "SONY", 0x0fce, "Xperia L2", 0x01f6,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA2 Compact", 0x01f7,
+  { "SONY", 0x0fce, "Xperia XA2 Compact", 0x01f7,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/support-requests/285/ */
-  { "SONY", 0x0fce, "XPeria XA2 Ultra", 0x01f8,
+  { "SONY", 0x0fce, "Xperia XA2 Ultra", 0x01f8,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/bugs/1804/ */
   { "SONY", 0x0fce, "Xperia XZ2 Compact Dual Sim", 0x01f9,
@@ -2018,7 +2021,7 @@
   { "SONY", 0x0fce, "Xperia 1 (J9110)", 0x0205,
       DEVICE_FLAG_NONE },
   /* https://sourceforge.net/p/libmtp/bugs/1849/ */
-  { "SONY", 0x0fce, "Xperia I4312", 0x0207,
+  { "SONY", 0x0fce, "Xperia L3", 0x0207,
       DEVICE_FLAG_NONE },
   /* https://github.com/libmtp/libmtp/issues/113 */
   { "SONY", 0x0fce, "Xperia 5", 0x020a,
@@ -2118,51 +2121,51 @@
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia Z3 Tablet MTP+CDROM", 0x41c0,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria M4 Aqua Dual MTP+CDROM", 0x41c4,
+  { "SONY", 0x0fce, "Xperia M4 Aqua Dual MTP+CDROM", 0x41c4,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "E2115 MTP+CDROM", 0x41c5,
+  { "SONY", 0x0fce, "Xperia E4 Dual MTP+CDROM", 0x41c5,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z3+ MTP+CDROM", 0x41c9,
+  { "SONY", 0x0fce, "Xperia Z3+ MTP+CDROM", 0x41c9,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria E4g MTP+CDROM", 0x41cb,
+  { "SONY", 0x0fce, "Xperia E4g MTP+CDROM", 0x41cb,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "C4 Dual MTP+CDROM", 0x41d2,
+  { "SONY", 0x0fce, "Xperia C4 Dual MTP+CDROM", 0x41d2,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria M5 MTP+CDROM", 0x41d6,
+  { "SONY", 0x0fce, "Xperia M5 MTP+CDROM", 0x41d6,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 MTP+CDROM", 0x41d9,
+  { "SONY", 0x0fce, "Xperia Z5 MTP+CDROM", 0x41d9,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 Compact MTP+CDROM", 0x41da,
+  { "SONY", 0x0fce, "Xperia Z5 Compact MTP+CDROM", 0x41da,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 Premium Dual Sim MTP+CDROM", 0x41db,
+  { "SONY", 0x0fce, "Xperia Z5 Premium Dual Sim MTP+CDROM", 0x41db,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA MTP+CDROM", 0x41de,
+  { "SONY", 0x0fce, "Xperia XA MTP+CDROM", 0x41de,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria X MTP+CDROM", 0x41e0,
+  { "SONY", 0x0fce, "Xperia X MTP+CDROM", 0x41e0,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria SOV33 MTP+CDROM", 0x41e1,
+  { "SONY", 0x0fce, "Xperia SOV33 MTP+CDROM", 0x41e1,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ MTP+CDROM", 0x41e7,
+  { "SONY", 0x0fce, "Xperia XZ MTP+CDROM", 0x41e7,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria X Compact MTP+CDROM", 0x41e8,
+  { "SONY", 0x0fce, "Xperia X Compact MTP+CDROM", 0x41e8,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria G3123 MTP+CDROM", 0x41eb,
+  { "SONY", 0x0fce, "Xperia XA1 MTP+CDROM", 0x41eb,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ CDROM", 0x41ed,
+  { "SONY", 0x0fce, "Xperia XZ CDROM", 0x41ed,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA1 Ultra MTP+CDROM", 0x41ef,
+  { "SONY", 0x0fce, "Xperia XA1 Ultra MTP+CDROM", 0x41ef,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ Premium MTP+CDROM", 0x41f1,
+  { "SONY", 0x0fce, "Xperia XZ Premium MTP+CDROM", 0x41f1,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ1 MTP+CDROM", 0x41f3,
+  { "SONY", 0x0fce, "Xperia XZ1 MTP+CDROM", 0x41f3,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ1 Compact MTP+CDROM", 0x41f4,
+  { "SONY", 0x0fce, "Xperia XZ1 Compact MTP+CDROM", 0x41f4,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria L2 MTP+CDROM", 0x41f6,
+  { "SONY", 0x0fce, "Xperia L2 MTP+CDROM", 0x41f6,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA2 Compact MTP+CDROM", 0x41f7,
+  { "SONY", 0x0fce, "Xperia XA2 Compact MTP+CDROM", 0x41f7,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA2 Ultra MTP+CDROM", 0x41f8,
+  { "SONY", 0x0fce, "Xperia XA2 Ultra MTP+CDROM", 0x41f8,
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia XZ2 Compact Dual Sim MTP+CDROM", 0x41f9,
       DEVICE_FLAG_NONE },
@@ -2176,7 +2179,7 @@
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia 1 (J9110) MTP+CDROM", 0x4205,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "Xperia I4312 MTP+CDROM", 0x4207,
+  { "SONY", 0x0fce, "Xperia L3 MTP+CDROM", 0x4207,
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia 5 MTP+CDROM", 0x420a,
       DEVICE_FLAG_NONE },
@@ -2186,7 +2189,7 @@
   /*
    * MTP+ADB personalities of MTP devices (see above)
    */
-  { "SonyEricsson", 0x0fce,  "c1605 Xperia Dual E MTP+ADB", 0x5146,
+  { "SonyEricsson", 0x0fce,  "Xperia Dual E MTP+ADB", 0x5146,
       DEVICE_FLAG_NONE },
   { "SonyEricsson", 0x0fce, "LT15i Xperia Arc MTP+ADB", 0x514f,
       DEVICE_FLAG_NONE },
@@ -2294,51 +2297,51 @@
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia Z3 Tablet MTP+ADB", 0x51c0,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria M4 Aqua Dual MTP+ADB", 0x51c4,
+  { "SONY", 0x0fce, "Xperia M4 Aqua Dual MTP+ADB", 0x51c4,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "E2115 MTP+ADB", 0x51c5,
+  { "SONY", 0x0fce, "Xperia E4 Dual MTP+ADB", 0x51c5,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z3+ MTP+ADB", 0x51c9,
+  { "SONY", 0x0fce, "Xperia Z3+ MTP+ADB", 0x51c9,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce,  "XPeria E4g MTP+ADB", 0x51cb,
+  { "SONY", 0x0fce, "Xperia E4g MTP+ADB", 0x51cb,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "C4 Dual MTP+ADB", 0x51d2,
+  { "SONY", 0x0fce, "Xperia C4 Dual MTP+ADB", 0x51d2,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria M5 MTP+ADB", 0x51d6,
+  { "SONY", 0x0fce, "Xperia M5 MTP+ADB", 0x51d6,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 MTP+ADB", 0x51d9,
+  { "SONY", 0x0fce, "Xperia Z5 MTP+ADB", 0x51d9,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 Compact MTP+ADB", 0x51da,
+  { "SONY", 0x0fce, "Xperia Z5 Compact MTP+ADB", 0x51da,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria Z5 Premium Dual Sim MTP+ADB", 0x51db,
+  { "SONY", 0x0fce, "Xperia Z5 Premium Dual Sim MTP+ADB", 0x51db,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA MTP+ADB", 0x51de,
+  { "SONY", 0x0fce, "Xperia XA MTP+ADB", 0x51de,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria X MTP+ADB", 0x51e0,
+  { "SONY", 0x0fce, "Xperia X MTP+ADB", 0x51e0,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria SOV33 MTP+ADB", 0x51e1,
+  { "SONY", 0x0fce, "Xperia SOV33 MTP+ADB", 0x51e1,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ MTP+ADB", 0x51e7,
+  { "SONY", 0x0fce, "Xperia XZ MTP+ADB", 0x51e7,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria X Compact MTP+ADB", 0x51e8,
+  { "SONY", 0x0fce, "Xperia X Compact MTP+ADB", 0x51e8,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria G3123 MTP+ADB", 0x51eb,
+  { "SONY", 0x0fce, "Xperia XA1 MTP+ADB", 0x51eb,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ ADB", 0x51ed,
+  { "SONY", 0x0fce, "Xperia XZ ADB", 0x51ed,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA1 Ultra MTP+ADB", 0x51ef,
+  { "SONY", 0x0fce, "Xperia XA1 Ultra MTP+ADB", 0x51ef,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ Premium MTP+ADB", 0x51f1,
+  { "SONY", 0x0fce, "Xperia XZ Premium MTP+ADB", 0x51f1,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ1 ADB", 0x51f3,
+  { "SONY", 0x0fce, "Xperia XZ1 ADB", 0x51f3,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XZ1 Compact MTP+ADB", 0x51f4,
+  { "SONY", 0x0fce, "Xperia XZ1 Compact MTP+ADB", 0x51f4,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria L2 MTP+ADB", 0x51f6,
+  { "SONY", 0x0fce, "Xperia L2 MTP+ADB", 0x51f6,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA2 Compact MTP+ADB", 0x51f7,
+  { "SONY", 0x0fce, "Xperia XA2 Compact MTP+ADB", 0x51f7,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "XPeria XA2 Ultra MTP+ADB", 0x51f8,
+  { "SONY", 0x0fce, "Xperia XA2 Ultra MTP+ADB", 0x51f8,
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia XZ2 Compact Dual Sim MTP+ADB", 0x51f9,
       DEVICE_FLAG_NONE },
@@ -2352,7 +2355,7 @@
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia 1 (J9110) MTP+ADB", 0x5205,
       DEVICE_FLAG_NONE },
-  { "SONY", 0x0fce, "Xperia I4312 MTP+ADB", 0x5207,
+  { "SONY", 0x0fce, "Xperia L3 MTP+ADB", 0x5207,
       DEVICE_FLAG_NONE },
   { "SONY", 0x0fce, "Xperia 5 MTP+ADB", 0x520a,
       DEVICE_FLAG_NONE },
@@ -2566,12 +2569,6 @@
   /* https://sourceforge.net/p/libmtp/bugs/1837/ */
   { "Google Inc (for Samsung)", 0x18d1, "Nexus One (MTP)", 0x4e12,
       DEVICE_FLAGS_ANDROID_BUGS },
-  // 0x4e21 (Nexus S) is a USB Mass Storage device.
-  { "Google Inc (for Samsung)", 0x18d1, "Nexus S (MTP)", 0x4e25,
-      DEVICE_FLAGS_ANDROID_BUGS },
-  // 0x4e26 is also used by "Ramos W30HD Pro Quad Core"
-  { "Google Inc (for Samsung)", 0x18d1, "Nexus S (MTP+ADB)", 0x4e26,
-      DEVICE_FLAGS_ANDROID_BUGS },
   // Reported by Chris Smith <tcgsmy...@users.sourceforge.net>
   { "Google Inc (for Asus)", 0x18d1, "Nexus 7 (MTP)", 0x4e41,
       DEVICE_FLAGS_ANDROID_BUGS },
@@ -2602,7 +2599,7 @@
   { "Google Inc (for Toshiba)", 0x18d1, "Thrive 7/AT105", 0x7102,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://github.com/libmtp/libmtp/issues/88 */
-  { "OnePlus", 0x18d1, "6T A6013", 0x7169,
+  { "Google Inc (for OnePlus)", 0x18d1, "OnePlus 6T (A6013)", 0x7169,
       DEVICE_FLAGS_ANDROID_BUGS },
   { "Google Inc (for Lenovo)", 0x18d1, "Ideapad K1", 0x740a,
       DEVICE_FLAGS_ANDROID_BUGS },
@@ -2691,14 +2688,17 @@
       DEVICE_FLAG_SWITCH_MODE_BLACKBERRY | 
DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL },
 
   /* https://sourceforge.net/p/libmtp/bugs/1551/ */
-  { "RIM", 0x0fca, "BlackBerry Priv", 0x8031, DEVICE_FLAG_UNLOAD_DRIVER |
+  /* https://sourceforge.net/p/libmtp/bugs/1925/ */
+  { "BlackBerry", 0x0fca, "Priv", 0x8031, DEVICE_FLAG_UNLOAD_DRIVER |
       DEVICE_FLAG_SWITCH_MODE_BLACKBERRY | 
DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL },
 
   /* https://sourceforge.net/p/libmtp/bugs/1658/ */
-  { "RIM", 0x0fca, "BlackBerry Dtek 60", 0x8041, DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://sourceforge.net/p/libmtp/bugs/1925/ */
+  { "BlackBerry", 0x0fca, "DTEK60", 0x8041, DEVICE_FLAGS_ANDROID_BUGS },
 
   /* https://sourceforge.net/p/libmtp/feature-requests/264/ */
-  { "RIM", 0x0fca, "BlackBerry Keyone", 0x8042, DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://sourceforge.net/p/libmtp/bugs/1925/ */
+  { "BlackBerry", 0x0fca, "KEYone", 0x8042, DEVICE_FLAGS_ANDROID_BUGS },
 
   /*
    * Nextar
@@ -3153,6 +3153,12 @@
   /* https://github.com/libmtp/libmtp/issues/74 */
   { "Lenovo", 0x17ef, "TB-X606F (Lenovo Tab M10 FHD Plus)", 0x7c46,
       DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://github.com/libmtp/libmtp/issues/127 */
+  { "Lenovo", 0x17ef, "Lenovo Tab P11", 0x7c6f,
+      DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://github.com/libmtp/libmtp/issues/116 */
+  { "Lenovo", 0x17ef, "TB-X306F (3rd id)", 0x7c97,
+      DEVICE_FLAGS_ANDROID_BUGS },
   /*https://github.com/libmtp/libmtp/issues/111  */
   { "Lenovo", 0x17ef, "TAB M7 Gen 3", 0x7cb3,
       DEVICE_FLAGS_ANDROID_BUGS },
@@ -3487,19 +3493,19 @@
    * Michael Gurski <gur...@users.sourceforge.net>
    */
   /* https://sourceforge.net/p/libmtp/support-requests/221/ */
-  { "Nokia", 0x0489, "N1", 0x1ab0,
+  { "Foxconn (for Nokia)", 0x0489, "N1", 0x1ab0,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1567/ */
-  { "InFocus", 0x0489, "M808", 0xc00b,
+  { "Foxconn (for InFocus)", 0x0489, "M808", 0xc00b,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/support-requests/138/ */
-  { "InFocus", 0x0489, "M810", 0xc025,
+  { "Foxconn (for InFocus)", 0x0489, "M810", 0xc025,
       DEVICE_FLAGS_ANDROID_BUGS },
-  { "Vizio", 0x0489, "Unknown 1", 0xc026,
+  { "Foxconn (for Vizio)", 0x0489, "Unknown 1", 0xc026,
       DEVICE_FLAGS_ANDROID_BUGS },
-  { "Vizio", 0x0489, "VTAB1008", 0xe040,
+  { "Foxconn (for Vizio)", 0x0489, "VTAB1008", 0xe040,
       DEVICE_FLAGS_ANDROID_BUGS },
-  { "Vizio (for Lenovo)", 0x0489, "LIFETAB S9714", 0xe111,
+  { "Foxconn (for Lenovo)", 0x0489, "IdeaTab A2109/A2110/Medion LIFETAB 
S9714", 0xe111,
       DEVICE_FLAGS_ANDROID_BUGS },
 
 
@@ -3616,6 +3622,9 @@
   /* https://sourceforge.net/p/libmtp/bugs/1900/ */
   { "Onyx", 0x2207, "Boox Nova Pro", 0x0015,
       DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://github.com/libmtp/libmtp/issues/125 */
+  { "iBasso", 0x2207, "DX170 DAP", 0x0017,
+      DEVICE_FLAGS_ANDROID_BUGS },
   /* https://github.com/libmtp/libmtp/issues/82 */
   { "Supernote", 0x2207, "A5X", 0x0031,
       DEVICE_FLAGS_ANDROID_BUGS },
@@ -3699,10 +3708,8 @@
   { "Xiaomi", 0x2717, "Mi-2s (id2) (MTP)", 0xff40,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1905/ */
-  { "Xiaomi", 0x0a9d, "POCO X3 Pro (MTP)", 0xff40,
-      DEVICE_FLAGS_ANDROID_BUGS },
   /* https://github.com/libmtp/libmtp/issues/90 */
-  { "Xiaomi", 0x0a9d, "MI 9 M1902F1G", 0xff40,
+  { "Xiaomi", 0x0a9d, "MI 9 M1902F1G or POCO X3 Pro (MTP)", 0xff40,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1339/ */
   { "Xiaomi", 0x2717, "Mi-2s (MTP)", 0xff48,
@@ -3738,6 +3745,9 @@
   /* https://sourceforge.net/p/libmtp/bugs/1883/ */
   { "SHARP Corporation", 0x04dd, "AndroidOne S5", 0x9c90,
       DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://sourceforge.net/p/libmtp/bugs/1914/ */
+  { "SHARP Corporation", 0x04dd, "S7-SH", 0x9d6e,
+      DEVICE_FLAGS_ANDROID_BUGS },
 
   /*
    * T & A Mobile phones Alcatel and TCT
@@ -3819,19 +3829,18 @@
   { "Bravis", 0x0e8d, "A401 Neo", 0x0c03,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1422/ */
-  { "MediaTek Inc", 0x0e8d, "MT65xx", 0x2008,
-      DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1467/ */
-  { "elephone", 0x0e8d, "p6000", 0x2008,
+  /* https://sourceforge.net/p/libmtp/bugs/1922/ */
+  { "MediaTek Inc", 0x0e8d, "MT65xx/67xx (MTP mode)", 0x2008,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/feature-requests/234/ */
-  { "DOODGE", 0x0e8d, "X6pro", 0x200a,
+  /* https://sourceforge.net/p/libmtp/bugs/1923/ */
+  { "MediaTek Inc", 0x0e8d, "MT65xx/67xx (MTP + CDC + ADB mode)", 0x200a,
       DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/support-requests/289/ */
-  { "Jinga", 0x0e8d, "PassPluss", 0x2012, DEVICE_FLAGS_ANDROID_BUGS },
+  { "MediaTek Inc", 0x0e8d, "MT65xx/67xx (MTP + CDC mode)", 0x2012, 
DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/feature-requests/79/ */
-  { "MediaTek Inc", 0x0e8d, "Elephone P8000", 0x201d,
-      DEVICE_FLAGS_ANDROID_BUGS },
+  { "MediaTek Inc", 0x0e8d, "MT65xx/67xx (MTP + ADB mode)", 0x201d, 
DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1717/ */
   { "MediaTek Inc", 0x0e8d, "Wiko Sunny", 0x4001,
       DEVICE_FLAGS_ANDROID_BUGS },
@@ -3864,9 +3873,9 @@
    * Garmin
    */
   { "Garmin", 0x091e, "Monterra", 0x2585, DEVICE_FLAGS_ANDROID_BUGS },
+  { "Garmin", 0x091e, "D2 Air", 0x488b, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1779/ */
   { "Garmin", 0x091e, "Forerunner 645 Music", 0x4b48, 
DEVICE_FLAGS_ANDROID_BUGS },
-  { "Garmin", 0x091e, "D2 Air", 0x488b, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://github.com/libmtp/libmtp/issues/15 */
   { "Garmin", 0x091e, "Fenix 5/5S/5X Plus", 0x4b54, DEVICE_FLAGS_ANDROID_BUGS 
},
   /* https://sourceforge.net/p/libmtp/feature-requests/271/ */
@@ -3903,6 +3912,11 @@
   { "Garmin", 0x091e, "Fenix 7 Sapphire Solar", 0x4f42, 
DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/support-requests/299/ */
   { "Garmin", 0x091e, "EPIX 2", 0x4f67, DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://github.com/libmtp/libmtp/issues/150 */
+  { "Garmin", 0x091e, "Garmin Forerunner 255M", 0x4f96, 
DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://github.com/libmtp/libmtp/issues/146 */
+  { "Garmin", 0x091e, "Forerunner 255S Music", 0x4f97, 
DEVICE_FLAGS_ANDROID_BUGS },
+  { "Garmin", 0x091e, "Forerunner 955 Solar", 0x4fb8, 
DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1920/ */
   { "Garmin", 0x091e, "Tactix 7", 0x5027, DEVICE_FLAGS_ANDROID_BUGS },
 
@@ -3983,6 +3997,8 @@
   /* https://sourceforge.net/p/libmtp/bugs/1287/ */
   { "Gensis", 0x040d, "GT-7305 ", 0x885c, DEVICE_FLAGS_ANDROID_BUGS },
 
+  /* https://sourceforge.net/p/libmtp/support-requests/300/ */
+  { "realme", 0x22d9, "Phone", 0x202a, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/support-requests/182/ */
   { "Oppo", 0x22d9, "Find 5", 0x2764, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1207/ */
@@ -4038,21 +4054,16 @@
   { "Yota", 0x2916, "Phone 2 (ID2)", 0xf003, DEVICE_FLAGS_ANDROID_BUGS },
 
   /* https://sourceforge.net/p/libmtp/bugs/1212/ */
-  { "Fly", 0x2970, "Evo Tech 4", 0x2008, DEVICE_FLAGS_ANDROID_BUGS },
-  /* https://sourceforge.net/p/libmtp/bugs/1865/ */
-  { "Fly", 0x2970, "5S ", 0x4002, DEVICE_FLAGS_ANDROID_BUGS },
-
   /* https://sourceforge.net/p/libmtp/bugs/1720/ */
-  { "Wileyfox", 0x2970, "Spark Plus", 0x2008, DEVICE_FLAGS_ANDROID_BUGS },
-
+  { "Fly", 0x2970, "Evo Tech 4", 0x2008, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/feature-requests/289/ */
-  { "Wileyfox", 0x2970, "Spark", 0x201d, DEVICE_FLAGS_ANDROID_BUGS },
-
+  { "Wileyfox", 0x2970, "Spark/Spark Plus", 0x201d, DEVICE_FLAGS_ANDROID_BUGS 
},
   /* https://sourceforge.net/p/libmtp/feature-requests/146/ */
   { "Wileyfox", 0x2970, "Swift", 0x2281, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/feature-requests/159/ */
   { "Wileyfox", 0x2970, "Swift 2", 0x2282, DEVICE_FLAGS_ANDROID_BUGS },
-
+  /* https://sourceforge.net/p/libmtp/bugs/1865/ */
+  { "Fly", 0x2970, "5S ", 0x4002, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1554/ */
   { "Kazam", 0x2970, "Trooper 650 4G", 0x9039, DEVICE_FLAGS_ANDROID_BUGS },
 
@@ -4062,10 +4073,12 @@
   /* https://sourceforge.net/p/libmtp/bugs/1127/ */
   { "Fly", 0x2970, "iq4415 era style 3", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1082/ */
-  { "Fly", 0x1782, "iq449", 0x4001, DEVICE_FLAGS_ANDROID_BUGS },
-
+  /* https://sourceforge.net/p/libmtp/bugs/1932/ */
+  { "Spreadtrum (Unisoc)", 0x1782, "Various devices (MTP)", 0x4001, 
DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://sourceforge.net/p/libmtp/feature-requests/240/ */
+  { "Spreadtrum (Unisoc)", 0x1782, "Various devices (MTP+ADB, ID 1)", 0x4002, 
DEVICE_FLAGS_ANDROID_BUGS },
   /* https://github.com/libmtp/libmtp/issues/109 */
-  { "Alldocube", 0x1782, "Smile X", 0x4003, DEVICE_FLAGS_ANDROID_BUGS },
+  { "Spreadtrum (Unisoc)", 0x1782, "Various devices (MTP+ADB, ID 2)", 0x4003, 
DEVICE_FLAGS_ANDROID_BUGS },
 
   /*
   * YU Yureka.
@@ -4084,12 +4097,6 @@
   /* https://sourceforge.net/p/libmtp/feature-requests/135/. guessed android. 
*/
   { "OUYA", 0x2836, "Videogame Console", 0x0010, DEVICE_FLAGS_ANDROID_BUGS },
 
-  /* https://sourceforge.net/p/libmtp/bugs/1383/ */
-  { "BLU", 0x0e8d, "Studio HD", 0x2008, DEVICE_FLAGS_ANDROID_BUGS },
-
-  /* https://sourceforge.net/p/libmtp/feature-requests/161/ */
-  { "Cubot", 0x0e8d, "X17", 0x201d, DEVICE_FLAGS_ANDROID_BUGS },
-
   /* https://sourceforge.net/p/libmtp/bugs/1423/ */
   { "OnePlus", 0x2a70, "ONE A2001", 0x9011, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/bugs/1910/ */
@@ -4122,6 +4129,7 @@
   { "GoPro" , 0x2672, "HERO8 Black", 0x0049, DEVICE_FLAG_NONE },
   { "GoPro" , 0x2672, "HERO9 Black", 0x004d, DEVICE_FLAG_NONE },
   { "GoPro" , 0x2672, "HERO10 Black", 0x0056, DEVICE_FLAG_NONE },
+  { "GoPro" , 0x2672, "HERO11 Black", 0x0059, DEVICE_FLAG_NONE },
 #endif
 
   /* These Ricoh Theta cameras run Android but seem to work
@@ -4202,9 +4210,6 @@
   /* https://sourceforge.net/p/libmtp/bugs/1663/ */
   { "Nextbit" , 0x2c3f, "Robin", 0x0001, DEVICE_FLAGS_ANDROID_BUGS },
 
-  /* https://sourceforge.net/p/libmtp/feature-requests/240/ */
-  { "Spreadtrum" , 0x1782, "STK Storm 2e Pluz", 0x4002, 
DEVICE_FLAGS_ANDROID_BUGS },
-
   /* https://sourceforge.net/p/libmtp/support-requests/258/ */
   { "Essential Phone" , 0x2e17, "PH-1a", 0xc030, DEVICE_FLAGS_ANDROID_BUGS },
   /* https://sourceforge.net/p/libmtp/feature-requests/242/ */
@@ -4223,6 +4228,8 @@
 
   /* https://sourceforge.net/p/libmtp/support-requests/277/ */
   { "Vivo" , 0x2d95, "V11", 0x6002, DEVICE_FLAGS_ANDROID_BUGS },
+  /* https://github.com/libmtp/libmtp/issues/143 */
+  { "Vivo" , 0x2d95, "V19", 0x6003, DEVICE_FLAGS_ANDROID_BUGS },
 
   /* https://sourceforge.net/p/libmtp/bugs/1786/ */
   { "Longcheer" , 0x1c9e, "D", 0xf003, DEVICE_FLAGS_ANDROID_BUGS },
@@ -4256,5 +4263,14 @@
   /* https://sourceforge.net/p/libmtp/bugs/1911/ */
   { "Oculus", 0x2833, "Quest", 0x0183, DEVICE_FLAGS_ANDROID_BUGS },
 
+  /* https://sourceforge.net/p/libmtp/bugs/1921/ */
+  { "Tolino", 0x4173, "Tolino Vision 6", 0x8000, DEVICE_FLAGS_ANDROID_BUGS },
+
+  /* https://github.com/libmtp/libmtp/issues/122 */
+  { "FLIR", 0x09cb, "C5", 0x100b, DEVICE_FLAGS_ANDROID_BUGS },
+
+  /* https://github.com/libmtp/libmtp/issues/135 */
+  { "Honor", 0x339b, "X8/X9 5G", 0x107d, DEVICE_FLAGS_ANDROID_BUGS },
+
   /* qemu 3.0.0 hw/usb/dev-mtp.c */
   { "QEMU", 0x46f4, "Virtual MTP", 0x0004, DEVICE_FLAG_NONE }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/playlist-spl.c new/libmtp-1.1.21/src/playlist-spl.c
--- old/libmtp-1.1.20/src/playlist-spl.c        2020-10-19 14:41:10.000000000 
+0200
+++ new/libmtp-1.1.21/src/playlist-spl.c        2023-04-22 10:00:20.000000000 
+0200
@@ -256,7 +256,7 @@
  * ignored.
  *
  * @param device mtp device pointer
- * @param new the LIBMTP_playlist_t to convert (pl->playlist_id will be updated
+ * @param newlist the LIBMTP_playlist_t to convert (pl->playlist_id will be 
updated
  *           with the newly created object's id)
  * @return 0 on success, any other value means failure.
  */
@@ -555,7 +555,7 @@
  *               enough to accomodate all the tracks as reported by
  *               trackno_spl_text_t()
  * @param folders the folders list for the device
- * @param fiels the files list for the device
+ * @param files the files list for the device
  * @see spl_to_playlist_t()
  */
 static void tracks_from_spl_text_t(text_t* p,
@@ -582,7 +582,7 @@
  * @param p the text to search
  * @param tracks list of track id's to look up
  * @param folders the folders list for the device
- * @param fiels the files list for the device
+ * @param files the files list for the device
  * @see playlist_t_to_spl()
  */
 static void spl_text_t_from_tracks(text_t** p,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/libmtp-1.1.20/src/ptp-pack.c new/libmtp-1.1.21/src/ptp-pack.c
--- old/libmtp-1.1.20/src/ptp-pack.c    2022-01-31 10:50:55.000000000 +0100
+++ new/libmtp-1.1.21/src/ptp-pack.c    2023-04-03 13:21:50.000000000 +0200
@@ -213,6 +213,9 @@
        char *ucs2strp = (char *) ucs2str;
        size_t convlen = strlen(string);
 
+       if (convlen > PTP_MAXSTRLEN) {
+               convlen = PTP_MAXSTRLEN;
+       }
        /* Cannot exceed 255 (PTP_MAXSTRLEN) since it is a single byte, duh ... 
*/
        memset(ucs2strp, 0, sizeof(ucs2str));  /* XXX: necessary? */
 #if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H)
@@ -229,7 +232,9 @@
 #endif
        {
                unsigned int i;
-
+               if (convlen > PTP_MAXSTRLEN) {
+                       convlen = PTP_MAXSTRLEN;
+               }
                for (i=0;i<convlen;i++) {
                        ucs2str[i] = string[i];
                }

Reply via email to