Hello community,

here is the log from the commit of package simple-mtpfs for openSUSE:Leap:15.2 
checked in at 2020-02-19 19:42:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/simple-mtpfs (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.simple-mtpfs.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "simple-mtpfs"

Wed Feb 19 19:42:43 2020 rev:11 rq:777357 version:0.3.0

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/simple-mtpfs/simple-mtpfs.changes      
2020-01-15 16:02:48.539906018 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.simple-mtpfs.new.26092/simple-mtpfs.changes   
2020-02-19 19:42:58.993343004 +0100
@@ -1,0 +2,8 @@
+Mon Aug 12 10:56:02 UTC 2019 - Tomáš Chvátal <tchva...@suse.com>
+
+- Update to 0.3.0:
+  * fix FreeBSD ports upgrade path
+  * mount by device file (eg. /dev/libmtp-*)
+  * various fixes, improvements and code cleanup
+
+-------------------------------------------------------------------

Old:
----
  simple-mtpfs-0.2.tar.gz

New:
----
  simple-mtpfs-0.3.0.tar.gz

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

Other differences:
------------------
++++++ simple-mtpfs.spec ++++++
--- /var/tmp/diff_new_pack.DfyfH7/_old  2020-02-19 19:42:59.573344148 +0100
+++ /var/tmp/diff_new_pack.DfyfH7/_new  2020-02-19 19:42:59.577344157 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package simple-mtpfs
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,25 +12,24 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           simple-mtpfs
-Version:        0.2
+Version:        0.3.0
 Release:        0
 Summary:        Simple MTP fuse filesystem driver
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Productivity/Multimedia/Other
-Url:            http://github.com/phatina/simple-mtpfs
+URL:            https://github.com/phatina/simple-mtpfs
 Source:         
http://github.com/phatina/simple-mtpfs/archive/%{name}-%{version}.tar.gz
 BuildRequires:  autoconf
 BuildRequires:  automake
-BuildRequires:  fuse-devel
 BuildRequires:  gcc-c++
-BuildRequires:  libmtp-devel
-BuildRequires:  pkg-config
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  pkgconfig
+BuildRequires:  pkgconfig(fuse)
+BuildRequires:  pkgconfig(libmtp)
 
 %description
 SIMPLE-MTPFS (Simple Media Transfer Protocol FileSystem) is a file system for
@@ -51,12 +50,12 @@
 make %{?_smp_mflags}
 
 %install
-make DESTDIR=%{buildroot} install %{?_smp_mflags}
+%make_install
 
 %files
-%defattr(-,root,root)
-%doc COPYING README.md
+%license COPYING
+%doc README.md
 %{_bindir}/%{name}
-%{_mandir}/man1/%{name}.1.*
+%{_mandir}/man1/%{name}.1%{?ext_man}
 
 %changelog

++++++ simple-mtpfs-0.2.tar.gz -> simple-mtpfs-0.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/INSTALL 
new/simple-mtpfs-simple-mtpfs-0.3.0/INSTALL
--- old/simple-mtpfs-simple-mtpfs-0.2/INSTALL   2013-12-03 22:02:39.000000000 
+0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/INSTALL 2016-12-25 13:24:21.000000000 
+0100
@@ -1,7 +1,7 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
+Copyright (C) 1994-1996, 1999-2002, 2004-2014 Free Software Foundation,
 Inc.
 
    Copying and distribution of this file, with or without modification,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/NEWS 
new/simple-mtpfs-simple-mtpfs-0.3.0/NEWS
--- old/simple-mtpfs-simple-mtpfs-0.2/NEWS      2013-12-03 22:02:39.000000000 
+0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/NEWS    2016-12-25 13:24:21.000000000 
+0100
@@ -1,3 +1,10 @@
+New in version 0.3.0:
+- fix FreeBSD ports upgrade path
+
+New in version 0.2.1:
+- mount by device file (eg. /dev/libmtp-*)
+- various fixes, improvements and code cleanup
+
 New in version 0.2:
 - introduced special device file as mount parameter
   - MTP device can be specified by special file placed in /dev
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/autogen.sh 
new/simple-mtpfs-simple-mtpfs-0.3.0/autogen.sh
--- old/simple-mtpfs-simple-mtpfs-0.2/autogen.sh        2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/autogen.sh      2016-12-25 
13:24:21.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # exit on errors
 set -e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/configure.ac 
new/simple-mtpfs-simple-mtpfs-0.3.0/configure.ac
--- old/simple-mtpfs-simple-mtpfs-0.2/configure.ac      2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/configure.ac    2016-12-25 
13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([simple-mtpfs], [0.2], [phat...@gmail.com])
+AC_INIT([simple-mtpfs], [0.3.0], [phat...@gmail.com])
 
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -14,32 +14,32 @@
 m4_include([m4/cxx11.m4])
 AX_CXX_COMPILE_STDCXX_11([noext])
 AC_CHECK_LIB([mtp], [LIBMTP_Init], [], [AC_MSG_ERROR([libmtp not found])])
+AC_CHECK_LIB([mtp], [LIBMTP_Check_Capability],
+    [AC_DEFINE([HAVE_LIBMTP_CHECK_CAPABILITY], [1], [Check device 
capabilities])],
+    [])
 AC_CHECK_HEADERS([libmtp.h])
 
 dnl Enable fdatasync, but not on OSX
-test `uname -s` == "Darwin" || AC_CHECK_FUNCS([fdatasync])
+os_name=$(uname -s)
+test "x$os_name" == "xDarwin" || AC_CHECK_FUNCS([fdatasync])
 
 PKG_CHECK_MODULES([FUSE], [fuse >= 2.7.3])
-AC_SUBST([FUSE_CFLAGS])
-AC_SUBST([FUSE_LIBS])
+if test "x$os_name" == "xDarwin"; then
+    AC_SUBST([FUSE_CFLAGS],["-D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE 
-I/usr/local/include/osxfuse"])
+    AC_SUBST([FUSE_LIBS],["-L/usr/local/lib -losxfuse -pthread -liconv"])
+fi
 
 PKG_CHECK_MODULES(
     [LIBUSB1],
     [libusb-1.0 >= 1.0.0],
     [AC_DEFINE([HAVE_LIBUSB1], [], [Have libusb 1.0])]
 )
-AC_SUBST([LIBUSB1_CFLAGS])
-AC_SUBST([LIBUSB1_LIBS])
 
 dnl Configurable temporary directory
 AC_ARG_WITH(
     [tmpdir],
-    [AS_HELP_STRING([--with-tmpdir@<:=DIR@:>@],
+    [AS_HELP_STRING([--with-tmpdir=DIR],
         [Directory for temporary files, defaults to /tmp])],
-    [], []
-)
-AS_IF(
-    [test "x$withval" != "x"],
     [tmpdir="$withval"],
     [tmpdir="/tmp"]
 )
@@ -49,6 +49,35 @@
     [Directory for temporary files]
 )
 
+dnl Configurable USB device path
+case $os_name in
+    Linux)
+        usb_devpath="/dev/bus/usb/%u/%u"
+        ;;
+    FreeBSD)
+        usb_devpath="/dev/usb/%u.%u.0"
+        ;;
+    *)
+        usb_devpath="%u/%u"
+        ;;
+esac
+AC_ARG_WITH(
+    [usbdev],
+    [AS_HELP_STRING([--with-usbdev=FILE],
+        [USB device path. String in sscanf() format])],
+    [usb_devpath="$withval"],
+    []
+)
+if test "x$usb_devpath" != "x%u/%u"; then
+    AC_DEFINE_UNQUOTED(
+        [USB_DEVPATH],
+        ["$usb_devpath"],
+        [USB device path format string]
+    )
+else
+    AC_MSG_WARN([Mounting by real device path is not supported. Fallback to 
<bus>/<device> notation]);
+fi
+
 AC_OUTPUT([
     makefile
     src/makefile
@@ -58,10 +87,11 @@
 AC_MSG_NOTICE([
 
     simple-mtpfs $VERSION
-    ================
+    ==================
 
     prefix: ${prefix}
     tmpdir: ${tmpdir}
+    usbdev: ${usb_devpath}
 
     Now type 'make' to build $PACKAGE
 ])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/debian/changelog 
new/simple-mtpfs-simple-mtpfs-0.3.0/debian/changelog
--- old/simple-mtpfs-simple-mtpfs-0.2/debian/changelog  2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/debian/changelog        2016-12-25 
13:24:21.000000000 +0100
@@ -1,8 +1,20 @@
+simple-mtpfs (0.3.0-1) unstable; urgency=low
+
+  * Upgrade to 0.3.0
+
+ -- Peter Hatina <phat...@gmail.com>  Sun, 25 Dec 2016 11:39:22 +0100
+
+simple-mtpfs (0.2.1-1) unstable; urgency=low
+
+  * Upgrade to v0.2.1
+
+ -- Peter Hatina <phat...@gmail.com>  Sun, 27 Nov 2016 16:05:41 +0100
+
 simple-mtpfs (0.2-1) unstable; urgency=low
 
   * Upgrade to v0.2
 
- -- Peter Hatina <phat...@gmail.com> Tue, 03 Dec 2013 21:51:20 +0100
+ -- Peter Hatina <phat...@gmail.com>  Tue, 03 Dec 2013 21:51:20 +0100
 
 simple-mtpfs (0.1-1) precise; urgency=low
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/debian/control 
new/simple-mtpfs-simple-mtpfs-0.3.0/debian/control
--- old/simple-mtpfs-simple-mtpfs-0.2/debian/control    2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/debian/control  2016-12-25 
13:24:21.000000000 +0100
@@ -9,7 +9,7 @@
 
 Package: simple-mtpfs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, fuse-utils
+Depends: ${shlibs:Depends}, ${misc:Depends}, fuse
 Provides: mtpfs
 Conflicts: mtpfs
 Description: Simple MTP fuse filesystem driver
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/debian/copyright 
new/simple-mtpfs-simple-mtpfs-0.3.0/debian/copyright
--- old/simple-mtpfs-simple-mtpfs-0.2/debian/copyright  2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/debian/copyright        2016-12-25 
13:24:21.000000000 +0100
@@ -5,13 +5,13 @@
 
 Copyright:
 
-    Copyright (C) 2012-2013 Peter Hatina <phat...@gmail.com>
+    Copyright (C) 2012-2016 Peter Hatina <phat...@gmail.com>
 
     This program can be distributed under the terms of the GNU GPL.
     See the file COPYING.
 
-The Debian packaging is (C) 2013, Eugene San (eugenesan) <eugene...@gmail.com>
-and is licensed under the GPL.
+The Debian packaging is (C) 2013-2014, Eugene San (eugenesan)
+<eugene...@gmail.com> and is licensed under the GPL.
 
 On Debian systems, you can find the GNU General Public License in the file
 /usr/share/common-licenses/GPL.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/man/simple-mtpfs.1 
new/simple-mtpfs-simple-mtpfs-0.3.0/man/simple-mtpfs.1
--- old/simple-mtpfs-simple-mtpfs-0.2/man/simple-mtpfs.1        2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/man/simple-mtpfs.1      2016-12-25 
13:24:21.000000000 +0100
@@ -1,4 +1,4 @@
-.TH SIMPLE-MTPFS "1" "December 2013" "SIMPLE-MTPFS version 0.2" "User Commands"
+.TH SIMPLE-MTPFS "1" "January 2015" "SIMPLE-MTPFS version 0.2" "User Commands"
 .SH NAME
 SIMPLE-MTPFS \- filesystem driver for MTP based devices
 .SH SYNOPSIS
@@ -30,7 +30,7 @@
 .SS "SIMPLE-MTPFS options:"
 .TP
 \fB\-l\fR   \fB\-\-list\-devices\fR
-list available MTP devices
+list available MTP devices. Supports \fB<device>\fR option
 .TP
      \fB\-\-device\fR
 select device no. to mount
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/simple-mtpfs.spec 
new/simple-mtpfs-simple-mtpfs-0.3.0/simple-mtpfs.spec
--- old/simple-mtpfs-simple-mtpfs-0.2/simple-mtpfs.spec 2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/simple-mtpfs.spec       2016-12-25 
13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 Name:          simple-mtpfs
-Version:       0.2
+Version:       0.3.0
 Release:       1%{?dist}
 Summary:       Fuse-based MTP driver
 License:       GPLv2+
@@ -34,6 +34,12 @@
 %{_mandir}/man1/simple-mtpfs.1.gz
 
 %changelog
+* Sun Dec 25 2016 Peter Hatina <phat...@gmail.com> - 0.3.0-1
+- upgrade to v0.3.0
+
+* Sun Nov 27 2016 Peter Hatina <phat...@gmail.com> - 0.2.1-1
+- upgrade to v0.2.1
+
 * Tue Dec  3 2013 Peter Hatina <phat...@redhat.com> - 0.2-1
 - upgrade to v0.2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-fuse.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-fuse.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-fuse.cpp 2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-fuse.cpp       
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -161,18 +161,14 @@
     , m_enable_move(false)
     , m_list_devices(false)
     , m_device_no(1)
-#ifdef HAVE_LIBUSB1
     , m_device_file(nullptr)
-#endif // HAVE_LIBUSB1
     , m_mount_point(nullptr)
 {
 }
 
 SMTPFileSystem::SMTPFileSystemOptions::~SMTPFileSystemOptions()
 {
-#ifdef HAVE_LIBUSB1
     free(static_cast<void*>(m_device_file));
-#endif // HAVE_LIBUSB1
     free(static_cast<void*>(m_mount_point));
 }
 
@@ -184,22 +180,16 @@
     SMTPFileSystemOptions *options = static_cast<SMTPFileSystemOptions*>(data);
 
     if (key == FUSE_OPT_KEY_NONOPT) {
-#ifdef HAVE_LIBUSB1
-        if (options->m_mount_point && !options->m_device_file) {
-            options->m_device_file = options->m_mount_point;
-            options->m_mount_point = nullptr;
-        } else if (options->m_mount_point && options->m_device_file) {
+        if (options->m_mount_point && options->m_device_file) {
             // Unknown positional argument supplied
             return -1;
         }
-#else
-        if (options->m_mount_point) {
-            // Unknown positional argument supplied
-            return -1;
+        if (options->m_device_file) {
+            fuse_opt_add_opt(&options->m_mount_point, arg);
+            return 0;
         }
-#endif //HAVE_LIBUSB1
 
-        fuse_opt_add_opt(&options->m_mount_point, arg);
+        fuse_opt_add_opt(&options->m_device_file, arg);
         return 0;
     }
     return 1;
@@ -298,6 +288,11 @@
         return true;
     }
 
+    if (m_options.m_device_file && !m_options.m_mount_point) {
+        m_options.m_mount_point = m_options.m_device_file;
+        m_options.m_device_file = nullptr;
+    }
+
     if (!m_options.m_mount_point) {
         logerr("Mount point missing.\n");
         m_options.m_good = false;
@@ -314,13 +309,11 @@
 
     --m_options.m_device_no;
 
-#ifdef HAVE_LIBUSB1
     // device file and -- device are mutually exclusive, fail if both set
     if (m_options.m_device_no && m_options.m_device_file) {
         m_options.m_good = false;
         return false;
     }
-#endif // HAVE_LIBUSB1
 
     m_options.m_good = true;
     return true;
@@ -332,16 +325,14 @@
     struct fuse_operations tmp_operations;
     memset(&tmp_operations, 0, sizeof(tmp_operations));
     std::cerr << "usage: " << smtpfs_basename(m_args.argv[0])
-#ifdef HAVE_LIBUSB1
-              << " <source>"
-#endif // HAVE_LIBUSB1
-              << " mountpoint [options]\n\n"
+              << " <source> mountpoint [options]\n\n"
         << "general options:\n"
         << "    -o opt,[opt...]        mount options\n"
         << "    -h   --help            print help\n"
         << "    -V   --version         print version\n\n"
         << "simple-mtpfs options:\n"
-        << "    -l   --list-devices    print available devices\n"
+        << "    -v   --verbose         verbose output, implies -f\n"
+        << "    -l   --list-devices    print available devices. Supports 
<source> option\n"
         << "         --device          select a device number to mount\n"
         << "    -o enable-move         enable the move operations\n\n";
     fuse_opt_add_arg(&args, m_args.argv[0]);
@@ -363,6 +354,13 @@
     fuse_opt_free_args(&args);
 }
 
+bool SMTPFileSystem::listDevices() const
+{
+    const std::string dev_file = m_options.m_device_file ? 
m_options.m_device_file : "";
+
+    return MTPDevice::listDevices(m_options.m_verbose, dev_file);
+}
+
 bool SMTPFileSystem::exec()
 {
     if (!m_options.m_good)
@@ -381,14 +379,11 @@
         return false;
     }
 
-#ifdef HAVE_LIBUSB1
     if (m_options.m_device_file) {
         // Try to use device file first, if provided
         if (!m_device.connect(m_options.m_device_file))
             return false;
-    } else
-#endif // HAVE_LIBUSB1
-    {
+    } else {
         // Connect to MTP device by order number, if no device file supplied
         if (!m_device.connect(m_options.m_device_no))
             return false;
@@ -432,6 +427,7 @@
             buf->st_ino = dir->id();
             buf->st_mode = S_IFDIR | 0775;
             buf->st_nlink = 2;
+            buf->st_mtime = dir->modificationDate();
         } else if (content->file(tmp_file)) {
             const TypeFile *file = content->file(tmp_file);
             buf->st_ino = file->id();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-fuse.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-fuse.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-fuse.h   2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-fuse.h 2016-12-25 
13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -34,12 +34,6 @@
 private:
     struct SMTPFileSystemOptions {
     public:
-        enum { KEY_VERSION,
-               KEY_HELP,
-               KEY_LIST_DEVICES,
-               KEY_DEVICE,
-               KEY_ENABLE_MOVE};
-
         int m_good;
         int m_help;
         int m_version;
@@ -47,9 +41,7 @@
         int m_enable_move;
         int m_list_devices;
         int m_device_no;
-#ifdef HAVE_LIBUSB1
         char *m_device_file;
-#endif // HAVE_LIBUSB1
         char *m_mount_point;
 
         SMTPFileSystemOptions();
@@ -78,7 +70,7 @@
     bool parseOptions(int argc, char **argv);
     void printHelp() const;
     void printVersion() const;
-    bool listDevices() { return m_device.listDevices(); }
+    bool listDevices() const;
 
     bool exec();
     bool isGood() const { return m_options.m_good; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-libmtp.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-libmtp.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-libmtp.cpp       
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-libmtp.cpp     
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-libmtp.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-libmtp.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-libmtp.h 2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-libmtp.h       
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-log.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-log.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-log.cpp  2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-log.cpp        
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -35,7 +35,7 @@
     time_info = localtime(&raw_time);
     std::stringstream ss;
     ss  << std::setfill('0') << std::setw(4) << time_info->tm_year + 1900
-        << '/' << std::setw(2) << time_info->tm_mon
+        << '/' << std::setw(2) << time_info->tm_mon + 1
         << '/' << std::setw(2) << time_info->tm_mday
         << ' ' << std::setw(2) << time_info->tm_hour
         << ':' << std::setw(2) << time_info->tm_min
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-log.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-log.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-log.h    2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-log.h  2016-12-25 
13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-main.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-main.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-main.cpp 2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-main.cpp       
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-mtp-device.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-mtp-device.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-mtp-device.cpp   
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-mtp-device.cpp 
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -20,6 +20,7 @@
 #include <sstream>
 #include <vector>
 #include <cstring>
+#include <cstdint>
 #include <cstdlib>
 extern "C" {
 #  include <unistd.h>
@@ -37,11 +38,14 @@
 
 MTPDevice::MTPDevice():
     m_device(nullptr),
+    m_capabilities(),
     m_device_mutex(),
     m_root_dir(),
     m_move_enabled(false)
 {
+    StreamHelper::off();
     LIBMTP_Init();
+    StreamHelper::on();
 }
 
 MTPDevice::~MTPDevice()
@@ -49,7 +53,34 @@
     disconnect();
 }
 
-bool MTPDevice::connect(int dev_no)
+bool MTPDevice::connect(LIBMTP_raw_device_t *dev)
+{
+    if (m_device) {
+        logerr("Already connected.\n");
+        return true;
+    }
+
+    // Do not output LIBMTP debug stuff
+    StreamHelper::off();
+    m_device = LIBMTP_Open_Raw_Device_Uncached(dev);
+    StreamHelper::on();
+
+    if (!m_device) {
+        LIBMTP_Dump_Errorstack(m_device);
+        return false;
+    }
+
+    if (!enumStorages())
+        return false;
+
+    // Retrieve capabilities.
+    m_capabilities = MTPDevice::getCapabilities(*this);
+
+    logmsg("Connected.\n");
+    return true;
+}
+
+bool MTPDevice::connect_priv(int dev_no, const std::string &dev_file)
 {
     if (m_device) {
         logerr("Already connected.\n");
@@ -65,12 +96,6 @@
         &raw_devices, &raw_devices_cnt);
     StreamHelper::on();
 
-    if (dev_no < 0 || dev_no >= raw_devices_cnt) {
-        logerr("Can not connect to device no. ", dev_no + 1, ".\n");
-        free(static_cast<void*>(raw_devices));
-        return false;
-    }
-
     if (err != LIBMTP_ERROR_NONE) {
         switch(err) {
         case LIBMTP_ERROR_NO_DEVICE_ATTACHED:
@@ -94,9 +119,36 @@
         return false;
     }
 
+#ifndef HAVE_LIBUSB1
+    if (!dev_file.empty()) {
+        uint8_t bnum, dnum;
+        dev_no = raw_devices_cnt;
+
+        if (smtpfs_usb_devpath(dev_file, &bnum, &dnum))
+            for (dev_no = 0; dev_no < raw_devices_cnt; ++dev_no)
+                if (bnum == raw_devices[dev_no].bus_location &&
+                    dnum == raw_devices[dev_no].devnum)
+                    break;
+
+        if (dev_no == raw_devices_cnt) {
+            logerr("Can not open such device '", dev_file, "'.\n");
+            free(static_cast<void*>(raw_devices));
+            return false;
+        }
+    }
+#endif // !HAVE_LIBUSB1
+
+    if (dev_no < 0 || dev_no >= raw_devices_cnt) {
+        logerr("Can not connect to device no. ", dev_no + 1, ".\n");
+        free(static_cast<void*>(raw_devices));
+        return false;
+    }
+
+    LIBMTP_raw_device_t *raw_device = &raw_devices[dev_no];
+
     // Do not output LIBMTP debug stuff
     StreamHelper::off();
-    m_device = LIBMTP_Open_Raw_Device_Uncached(&raw_devices[dev_no]);
+    m_device = LIBMTP_Open_Raw_Device_Uncached(raw_device);
     StreamHelper::on();
     free(static_cast<void*>(raw_devices));
 
@@ -108,10 +160,18 @@
     if (!enumStorages())
         return false;
 
+    // Retrieve capabilities.
+    m_capabilities = MTPDevice::getCapabilities(*this);
+
     logmsg("Connected.\n");
     return true;
 }
 
+bool MTPDevice::connect(int dev_no)
+{
+    return connect_priv(dev_no, std::string());
+}
+
 #ifdef HAVE_LIBUSB1
 bool MTPDevice::connect(const std::string &dev_file)
 {
@@ -120,28 +180,23 @@
         return true;
     }
 
-    LIBMTP_raw_device_t *device = smtpfs_raw_device_new(dev_file);
-    if (!device) {
+    LIBMTP_raw_device_t *raw_device = smtpfs_raw_device_new(dev_file);
+    if (!raw_device) {
         logerr("Can not open such device '", dev_file, "'.\n");
         return false;
     }
 
-    // Do not output LIBMTP debug stuff
-    StreamHelper::off();
-    m_device = LIBMTP_Open_Raw_Device_Uncached(device);
-    StreamHelper::on();
-    smtpfs_raw_device_free(device);
+    bool rval = connect(raw_device);
 
-    if (!m_device) {
-        LIBMTP_Dump_Errorstack(m_device);
-        return false;
-    }
+    // TODO:  Smart pointer with alloc, free hooks.
+    smtpfs_raw_device_free(raw_device);
 
-    if (!enumStorages())
-        return false;
-
-    logmsg("Connected.\n");
-    return true;
+    return rval;
+}
+#else
+bool MTPDevice::connect(const std::string &dev_file)
+{
+    return connect_priv(-1, dev_file);
 }
 #endif
 
@@ -155,32 +210,6 @@
     logmsg("Disconnected.\n");
 }
 
-bool MTPDevice::listDevices()
-{
-    int raw_devices_cnt;
-    LIBMTP_raw_device_t *raw_devices;
-
-    // Do not output LIBMTP debug stuff
-    StreamHelper::off();
-    LIBMTP_error_number_t err = LIBMTP_Detect_Raw_Devices(
-        &raw_devices, &raw_devices_cnt);
-    StreamHelper::on();
-
-    if (err != 0) {
-        if (err == LIBMTP_ERROR_NO_DEVICE_ATTACHED)
-            std::cerr << "No raw devices found.\n";
-        return false;
-    }
-
-    for (int i = 0; i < raw_devices_cnt; ++i) {
-        std::cout << i + 1 << ": " << raw_devices[i].device_entry.vendor
-            << raw_devices[i].device_entry.product << "\n";
-    }
-    free(static_cast<void*>(raw_devices));
-
-    return true;
-}
-
 uint64_t MTPDevice::storageTotalSize() const
 {
     uint64_t total = 0;
@@ -202,6 +231,8 @@
     criticalEnter();
     LIBMTP_Clear_Errorstack(m_device);
     if (LIBMTP_Get_Storage(m_device, LIBMTP_STORAGE_SORTBY_NOTSORTED) < 0) {
+        std::cerr << "Could not retrieve device storage.\n";
+        std::cerr << "For android phones make sure the screen is unlocked.\n";
         logerr("Could not retrieve device storage. Exiting.\n");
         LIBMTP_Dump_Errorstack(m_device);
         LIBMTP_Clear_Errorstack(m_device);
@@ -569,3 +600,85 @@
     logmsg("File '", oldpath, "' renamed to '", tmp_new_basename, "'.\n");
     return 0;
 }
+
+MTPDevice::Capabilities MTPDevice::getCapabilities() const
+{
+    return m_capabilities;
+}
+
+MTPDevice::Capabilities MTPDevice::getCapabilities(const MTPDevice &device)
+{
+    MTPDevice::Capabilities capabilities;
+
+#ifdef HAVE_LIBMTP_CHECK_CAPABILITY
+    if (device.m_device) {
+        capabilities.setCanGetPartialObject(
+            static_cast<bool>(
+                LIBMTP_Check_Capability(
+                    device.m_device,
+                    LIBMTP_DEVICECAP_GetPartialObject)));
+        capabilities.setCanSendPartialobject(
+            static_cast<bool>(
+                LIBMTP_Check_Capability(
+                    device.m_device,
+                    LIBMTP_DEVICECAP_SendPartialObject)));
+        capabilities.setCanEditObjects(
+            static_cast<bool>(
+                LIBMTP_Check_Capability(
+                    device.m_device,
+                    LIBMTP_DEVICECAP_EditObjects)));
+    }
+#endif
+
+    return capabilities;
+}
+
+bool MTPDevice::listDevices(bool verbose, const std::string &dev_file)
+{
+    int raw_devices_cnt;
+    LIBMTP_raw_device_t *raw_devices;
+
+    // Do not output LIBMTP debug stuff
+    StreamHelper::off();
+    LIBMTP_error_number_t err = LIBMTP_Detect_Raw_Devices(
+        &raw_devices, &raw_devices_cnt);
+    StreamHelper::on();
+
+    if (err != 0) {
+        if (err == LIBMTP_ERROR_NO_DEVICE_ATTACHED)
+            std::cerr << "No raw devices found.\n";
+        return false;
+    }
+
+    uint8_t bnum, dnum;
+    if (!dev_file.empty() && !smtpfs_usb_devpath(dev_file, &bnum, &dnum)) {
+        std::cerr << "Can not open such device '" << dev_file << "'.\n";
+        return false;
+    }
+
+    for (int i = 0; i < raw_devices_cnt; ++i) {
+        if (!dev_file.empty() &&
+            !(bnum == raw_devices[i].bus_location && dnum == 
raw_devices[i].devnum))
+            continue;
+        std::cout << i + 1 << ": "
+            << (raw_devices[i].device_entry.vendor ? 
raw_devices[i].device_entry.vendor : "Unknown vendor ")
+            << (raw_devices[i].device_entry.product ? 
raw_devices[i].device_entry.product : "Unknown product")
+            << std::endl;
+#ifdef HAVE_LIBMTP_CHECK_CAPABILITY
+            MTPDevice dev;
+            if (verbose) {
+                if (!dev.connect(&raw_devices[i]))
+                    return false;
+
+                const MTPDevice::Capabilities &cap = dev.getCapabilities();
+                std::cout << "  - can get  partial object: " << 
(cap.canGetPartialObject() ? "yes" : "no") << std::endl;
+                std::cout << "  - can send partial object: " << 
(cap.canSendPartialObject() ? "yes" : "no") << std::endl;
+                std::cout << "  - can edit objects       : " << 
(cap.canEditObjects() ? "yes" : "no") << std::endl;
+                dev.disconnect();
+            }
+#endif
+    }
+    free(static_cast<void*>(raw_devices));
+
+    return true;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-mtp-device.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-mtp-device.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-mtp-device.h     
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-mtp-device.h   
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -32,14 +32,40 @@
 class MTPDevice
 {
 public:
+    class Capabilities
+    {
+    public:
+        Capabilities()
+            : m_get_partial_object(false)
+            , m_send_partial_object(false)
+            , m_edit_objects(false)
+        {
+        }
+
+        void setCanGetPartialObject(bool b) { m_get_partial_object = b; }
+        void setCanSendPartialobject(bool b) { m_send_partial_object = b; }
+        void setCanEditObjects(bool b) { m_edit_objects = b; }
+
+        bool canGetPartialObject()  const { return m_get_partial_object; }
+        bool canSendPartialObject() const { return m_send_partial_object; }
+        bool canEditObjects() const { return m_edit_objects; }
+
+    private:
+        bool m_get_partial_object;
+        bool m_send_partial_object;
+        bool m_edit_objects;
+    };
+
+    // 
-------------------------------------------------------------------------
+
     MTPDevice();
     ~MTPDevice();
 
+    bool connect(LIBMTP_raw_device_t *dev);
     bool connect(int dev_no = 0);
     bool connect(const std::string &dev_file);
     void disconnect();
 
-    bool listDevices();
     void enableMove(bool e = true) { m_move_enabled = e; }
 
     uint64_t storageTotalSize() const;
@@ -57,14 +83,22 @@
     int fileRemove(const std::string &path);
     int fileRename(const std::string &oldpath, const std::string &newpath);
 
+    Capabilities getCapabilities() const;
+
+    static bool listDevices(bool verbose, const std::string &dev_file);
+
+private:
     void criticalEnter() { m_device_mutex.lock(); }
     void criticalLeave() { m_device_mutex.unlock(); }
 
-private:
     bool enumStorages();
 
+    static Capabilities getCapabilities(const MTPDevice &device);
+    bool connect_priv(int dev_no, const std::string &dev_file);
+
 private:
     LIBMTP_mtpdevice_t *m_device;
+    Capabilities m_capabilities;
     std::mutex m_device_mutex;
     TypeDir m_root_dir;
     bool m_move_enabled;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-sha1.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-sha1.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-sha1.cpp 2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-sha1.cpp       
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-sha1.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-sha1.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-sha1.h   2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-sha1.h 2016-12-25 
13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-tmp-files-pool.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-tmp-files-pool.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-tmp-files-pool.cpp       
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-tmp-files-pool.cpp     
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-tmp-files-pool.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-tmp-files-pool.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-tmp-files-pool.h 
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-tmp-files-pool.h       
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-basic.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-basic.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-basic.h     
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-basic.h   
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-dir.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-dir.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-dir.cpp     
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-dir.cpp   
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -29,7 +29,8 @@
     m_dirs(),
     m_files(),
     m_access_mutex(),
-    m_fetched(false)
+    m_fetched(false),
+    m_modif_date(0)
 {
 }
 
@@ -39,7 +40,8 @@
     m_dirs(),
     m_files(),
     m_access_mutex(),
-    m_fetched(false)
+    m_fetched(false),
+    m_modif_date(0)
 {
 }
 
@@ -49,7 +51,8 @@
     m_dirs(),
     m_files(),
     m_access_mutex(),
-    m_fetched(false)
+    m_fetched(false),
+    m_modif_date(file->modificationdate)
 {
 }
 
@@ -58,7 +61,8 @@
     m_dirs(copy.m_dirs),
     m_files(copy.m_files),
     m_access_mutex(),
-    m_fetched(copy.m_fetched)
+    m_fetched(copy.m_fetched),
+    m_modif_date(copy.m_modif_date)
 {
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-dir.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-dir.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-dir.h       
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-dir.h     
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -54,6 +54,9 @@
     std::set<TypeFile> files() const { return m_files; }
     bool isEmpty() const { return m_dirs.empty() && m_files.empty(); }
 
+       time_t modificationDate() const { return m_modif_date; }
+    void setModificationDate(time_t modif_date) { m_modif_date = modif_date; }
+       
     LIBMTP_folder_t *toLIBMTPFolder() const;
     TypeDir &operator =(const TypeDir &rhs);
     bool operator ==(const std::string &rhs) const { return 
TypeBasic::operator ==(rhs); }
@@ -66,6 +69,7 @@
     std::set<TypeFile> m_files;
     mutable std::mutex m_access_mutex;
     bool m_fetched;
+    time_t m_modif_date;
 };
 
 #endif // SMTPFS_TYPE_DIR_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-file.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-file.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-file.cpp    
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-file.cpp  
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-file.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-file.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-file.h      
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-file.h    
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-tmp-file.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-tmp-file.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-tmp-file.cpp        
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-tmp-file.cpp      
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-tmp-file.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-tmp-file.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-type-tmp-file.h  
2013-12-03 22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-type-tmp-file.h        
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-util.cpp 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-util.cpp
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-util.cpp 2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-util.cpp       
2016-12-25 13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -16,6 +16,7 @@
 * ***** END LICENSE BLOCK ***** */
 
 #include <config.h>
+#include <cstdio>
 #include <cstring>
 #ifdef HAVE_LIBUSB1
 #  include <iomanip>
@@ -37,6 +38,7 @@
 #  include <libusb.h>
 }
 #endif // HAVE_LIBUSB1
+#include "simple-mtpfs-log.h"
 #include "simple-mtpfs-util.h"
 
 const std::string devnull = "/dev/null";
@@ -77,11 +79,6 @@
     s_enabled = true;
 }
 
-#ifdef HAVE_LIBUSB1
-const char smtpfs_path_delimiter = '/';
-const std::string smtpfs_devbususb = "/dev/bus/usb/";
-#endif // HAVE_LIBUSB1
-
 std::string smtpfs_dirname(const std::string &path)
 {
     char *str = strdup(path.c_str());
@@ -119,7 +116,7 @@
     }
 
     tmp_dir += "/simple-mtpfs-XXXXXX";
-    char *c_tmp_dir = ::mktemp(::strdup(tmp_dir.c_str()));
+    char *c_tmp_dir = ::mkdtemp(::strdup(tmp_dir.c_str()));
 
     tmp_dir.assign(c_tmp_dir);
     ::free(static_cast<void*>(c_tmp_dir));
@@ -155,6 +152,25 @@
     return true;
 }
 
+bool smtpfs_usb_devpath(const std::string &path, uint8_t *bnum, uint8_t *dnum)
+{
+    unsigned int bus, dev;
+#ifdef USB_DEVPATH
+    std::string realpath(smtpfs_realpath(path));
+    if (realpath.empty() ||
+        sscanf(realpath.c_str(), USB_DEVPATH, &bus, &dev) != 2)
+#endif
+        if (sscanf(path.c_str(), "%u/%u", &bus, &dev) != 2)
+            return false;
+
+    if (bus > 255 || dev > 255)
+        return false;
+
+    *bnum = bus;
+    *dnum = dev;
+    return true;
+}
+
 #ifdef HAVE_LIBUSB1
 LIBMTP_raw_device_t *smtpfs_raw_device_new_priv(libusb_device *usb_device)
 {
@@ -188,33 +204,25 @@
 
 LIBMTP_raw_device_t *smtpfs_raw_device_new(const std::string &path)
 {
-    libusb_context *ctx;
-    int err = libusb_init(&ctx);
-    if (err)
+    uint8_t bnum, dnum;
+    if (!smtpfs_usb_devpath(path, &bnum, &dnum))
+        return nullptr;
+
+    if (libusb_init(NULL) != 0)
         return nullptr;
 
-    std::string dev_path(smtpfs_realpath(path));
     libusb_device **dev_list;
-    ssize_t num_devs = libusb_get_device_list(ctx, &dev_list);
-    if (num_devs < 1) {
-        libusb_exit(ctx);
+    ssize_t num_devs = libusb_get_device_list(NULL, &dev_list);
+    if (!num_devs) {
+        libusb_exit(NULL);
         return nullptr;
     }
 
     libusb_device *dev = nullptr;
     for (auto i = 0; i < num_devs; ++i) {
         dev = dev_list[i];
-        uint8_t bnum = libusb_get_bus_number(dev_list[i]);
-        uint8_t dnum = libusb_get_device_address(dev_list[i]);
-
-        std::stringstream ss;
-        ss << smtpfs_devbususb
-           << std::setw(3) << std::setfill('0')
-           << static_cast<uint16_t>(bnum) << "/"
-           << std::setw(3) << std::setfill('0')
-           << static_cast<uint16_t>(dnum);
-
-        if (ss.str() == dev_path)
+        if (bnum == libusb_get_bus_number(dev_list[i]) &&
+            dnum == libusb_get_device_address(dev_list[i]))
             break;
         dev = nullptr;
     }
@@ -222,11 +230,44 @@
     LIBMTP_raw_device_t *raw_device = smtpfs_raw_device_new_priv(dev);
 
     libusb_free_device_list(dev_list, 0);
-    libusb_exit(ctx);
+    libusb_exit(NULL);
 
     return raw_device;
 }
 
+bool smtpfs_reset_device(LIBMTP_raw_device_t *device)
+{
+    if (libusb_init(NULL) != 0)
+        return false;
+
+    libusb_device **dev_list;
+    ssize_t num_devs = libusb_get_device_list(NULL, &dev_list);
+    if (!num_devs) {
+        libusb_exit(NULL);
+        return false;
+    }
+
+    libusb_device_handle *dev_handle = nullptr;
+    for (auto i = 0; i < num_devs; ++i) {
+        uint8_t bnum = libusb_get_bus_number(dev_list[i]);
+        uint8_t dnum = libusb_get_device_address(dev_list[i]);
+
+        if (static_cast<uint32_t>(bnum) == device->bus_location &&
+            dnum == device->devnum)
+        {
+            libusb_open(dev_list[i], &dev_handle);
+            libusb_reset_device(dev_handle);
+            libusb_close(dev_handle);
+            break;
+        }
+    }
+
+    libusb_free_device_list(dev_list, 0);
+    libusb_exit(NULL);
+
+    return true;
+}
+
 void smtpfs_raw_device_free(LIBMTP_raw_device_t *device)
 {
     if (!device)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-util.h 
new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-util.h
--- old/simple-mtpfs-simple-mtpfs-0.2/src/simple-mtpfs-util.h   2013-12-03 
22:02:39.000000000 +0100
+++ new/simple-mtpfs-simple-mtpfs-0.3.0/src/simple-mtpfs-util.h 2016-12-25 
13:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 /* ***** BEGIN LICENSE BLOCK *****
-*   Copyright (C) 2012-2013, Peter Hatina <phat...@gmail.com>
+*   Copyright (C) 2012-2016, Peter Hatina <phat...@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as
@@ -19,6 +19,7 @@
 #define SIMPLE_MTPFS_UTIL
 
 #include <config.h>
+#include <cstdint>
 #include <string>
 
 #ifdef HAVE_LIBUSB1
@@ -47,10 +48,12 @@
 bool smtpfs_create_dir(const std::string &dirname);
 bool smtpfs_remove_dir(const std::string &dirname);
 bool smtpfs_check_dir(const std::string &path);
+bool smtpfs_usb_devpath(const std::string &path, uint8_t *bnum, uint8_t *dnum);
 
 #ifdef HAVE_LIBUSB1
 LIBMTP_raw_device_t *smtpfs_raw_device_new(const std::string &path);
 void smtpfs_raw_device_free(LIBMTP_raw_device_t *device);
+bool smtpfs_reset_device(LIBMTP_raw_device_t *device);
 #endif // HAVE_LIBUSB1
 
 #endif // SIMPLE_MTPFS_UTIL


Reply via email to