Hello community,
here is the log from the commit of package libmtp
checked in at Mon Mar 3 16:29:15 CET 2008.
--------
--- libmtp/libmtp.changes 2008-01-09 08:44:26.000000000 +0100
+++ libmtp/libmtp.changes 2008-03-03 09:58:23.000000000 +0100
@@ -1,0 +2,8 @@
+Mon Mar 3 09:57:15 CET 2008 - meissner@suse.de
+
+- upgraded to 0.2.6
+ - some new devices
+ - bugfixes
+ - remove LIBMTP_Set_Object_Parent function -> new major
+
+-------------------------------------------------------------------
Old:
----
libmtp-0.2.5.tar.bz2
New:
----
libmtp-0.2.6.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libmtp.spec ++++++
--- /var/tmp/diff_new_pack.K16352/_old 2008-03-03 16:28:40.000000000 +0100
+++ /var/tmp/diff_new_pack.K16352/_new 2008-03-03 16:28:40.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package libmtp (Version 0.2.5)
+# spec file for package libmtp (Version 0.2.6)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -10,6 +10,7 @@
# norootforbuild
+
Name: libmtp
Url: http://sf.net/projects/libmtp
%if %suse_version > 1020
@@ -21,7 +22,7 @@
Group: Productivity/Multimedia/Sound/Players
AutoReqProv: on
Summary: Access to MTP Players
-Version: 0.2.5
+Version: 0.2.6
Release: 1
Source0: %name-%version.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -101,11 +102,9 @@
install -d $RPM_BUILD_ROOT/usr/share/hal/fdi/information/20thirdparty/
install -c -m 644 libmtp.fdi $RPM_BUILD_ROOT/usr/share/hal/fdi/information/20thirdparty/10-usb-music-players-libmtp.fdi
-%post -n libmtp7
-%run_ldconfig
+%post -n libmtp7 -p /sbin/ldconfig
-%postun -n libmtp7
-%run_ldconfig
+%postun -n libmtp7 -p /sbin/ldconfig
%files
%defattr(-, root, root)
@@ -130,81 +129,86 @@
%{_prefix}/include/libmtp.h
%changelog
-* Wed Jan 09 2008 - meissner@suse.de
+* Mon Mar 03 2008 meissner@suse.de
+- upgraded to 0.2.6
+ - some new devices
+ - bugfixes
+ - remove LIBMTP_Set_Object_Parent function -> new major
+* Wed Jan 09 2008 meissner@suse.de
- upgraded to 0.2.5
- several new devices
- code cleanups and bugfixes
-* Mon Nov 26 2007 - meissner@suse.de
+* Mon Nov 26 2007 meissner@suse.de
- upgraded to 0.2.4
- various bug fixes and new fixes
- header-repairing for Zen devices
-* Sun Oct 28 2007 - meissner@suse.de
+* Sun Oct 28 2007 meissner@suse.de
- --program-prefix=mtp- is needed.
-* Fri Oct 26 2007 - meissner@suse.de
+* Fri Oct 26 2007 meissner@suse.de
- upgraded to 0.2.3
- new devices added
- varous bugfixes, speed ups
- bumped so from 6 to 7
- split off libmtp7 package
-* Mon Oct 08 2007 - meissner@suse.de
+* Mon Oct 08 2007 meissner@suse.de
- upgraded to 0.2.2
- bugfixes, new devices, faster metadata read
-* Fri Aug 10 2007 - meissner@suse.de
+* Fri Aug 10 2007 meissner@suse.de
- upgraded to 0.2.1 release
- fixed for LFS support
-* Sat Aug 04 2007 - meissner@suse.de
+* Sun Aug 05 2007 meissner@suse.de
- upgraded to 0.2.0 release
- more USB ids
- 64bit handling
-* Thu Jul 26 2007 - meissner@suse.de
+* Thu Jul 26 2007 meissner@suse.de
- uprgaded to current CVS state
- caching of fs and metadata
- new devices
- ptp reset binary
- bugfixes
-* Mon Jun 04 2007 - stbinner@suse.de
+* Mon Jun 04 2007 stbinner@suse.de
- fix build requires for older distributions
-* Wed May 16 2007 - olh@suse.de
+* Wed May 16 2007 olh@suse.de
- Buildrequires libusb -> libusb-devel
Remove unneded Requires libusb
-devel package requires libusb-devel
-* Tue Mar 27 2007 - meissner@suse.de
+* Tue Mar 27 2007 meissner@suse.de
- upstream 0.1.5
- uses SetObjPropList for most devices
- usb lowlevel communication fixes for
stubborn devices
- some new ids
-* Wed Mar 07 2007 - meissner@suse.de
+* Thu Mar 08 2007 meissner@suse.de
- upstream 0.1.4
- lots of bugfixes
- multiple device handling
-* Thu Feb 08 2007 - dmueller@suse.de
+* Thu Feb 08 2007 dmueller@suse.de
- split into -devel subpackage
-* Wed Jan 17 2007 - meissner@suse.de
+* Wed Jan 17 2007 meissner@suse.de
- upstream 0.1.3
- bugfixes.
-* Wed Jan 10 2007 - meissner@suse.de
+* Wed Jan 10 2007 meissner@suse.de
- use %%run_ldconfig in post/postun. (from rpmlint)
-* Mon Jan 08 2007 - meissner@suse.de
+* Mon Jan 08 2007 meissner@suse.de
- Upgraded to 0.1.2:
- new devices
- lots of bugfixes, rewritten lowlevel
communications layer.
-* Sat Dec 02 2006 - meissner@suse.de
+* Sat Dec 02 2006 meissner@suse.de
- Upgraded to 0.1.0:
- new devices
- metadata, tracks, vcf handling
- enhanced tools
- HAL snippet
-* Thu Sep 21 2006 - meissner@suse.de
+* Thu Sep 21 2006 meissner@suse.de
- Upgraded to 0.0.19:
- formatting of devices added
- lots of fixes
-* Mon Aug 28 2006 - meissner@suse.de
+* Mon Aug 28 2006 meissner@suse.de
- Upgraded to 0.0.16
- better handling of non-ascii filenames
- handling of large files
-* Wed Aug 23 2006 - meissner@suse.de
+* Wed Aug 23 2006 meissner@suse.de
- libmtp 0.0.13
- Library to access MTP devices.
- Small sample tools for accessing.
++++++ libmtp-0.2.5.tar.bz2 -> libmtp-0.2.6.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/ChangeLog new/libmtp-0.2.6/ChangeLog
--- old/libmtp-0.2.5/ChangeLog 2008-01-09 08:17:46.000000000 +0100
+++ new/libmtp-0.2.6/ChangeLog 2008-03-02 21:47:01.000000000 +0100
@@ -1,4 +1,100 @@
-2007-01-08 Linus Walleij
+2008-03-02 Linus Walleij
+
+ * configure.ac: prepare 0.2.6 release.
+ * src/Makefile.am: bump to compatible interface,
+ * src/ptp.c: sync in upstream, a Sansa fix!
+ * src/ptp.h: sync in upstream.
+ * doc/Doxyfile.in: retire obsoleted parameters.
+ * Release this as 0.2.6!
+
+2008-02-24 Richard Low
+
+ * src/music-players.h: add DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL
+ for a broken Philips player.
+
+2008-02-18 Linus Walleij
+
+ * examples/pathutils.c: fix up item ID typing to uint32_t,
+ handle file names passed in as arguments at suggestion from
+ anonymous mail list user.
+ * examples/pathutils.h: move a function static.
+
+2008-02-12 Nicolas Pennequin
+
+ * examples/sendtr.c: add transferred tracks to albums if possible.
+
+2008-02-10 Scott Snyder
+
+ * src/libusb-glue.c: finally fix up the short header detection
+ to skip over zero packets when encountered.
+ * examples/pathutils.c: fix a problem where all files sent has
+ to include a "." (period).
+
+2008-02-06 Linus Walleij
+
+ * src/libusb-glue.c: wait for response > 0 instead of > 2.
+
+2008-01-28 Linus Walleij
+
+ * src/libmtp.c: LIBMTP_Get_Filemetadata() return metadata for
+ folders (associations) too. There is really no reason why it
+ shouldn't and it's good for use internally.
+ LIBMTP_Get_Filelisting_With_Callback() will still not return
+ any associations however. We want to use the folder functions
+ for that.
+
+2008-01-28 Linus Walleij
+
+ * src/libmtp.h.in: withdraw LIBMTP_Set_Object_Parent() function,
+ no known devices will support this.
+ * src/libmtp.c: dito. Fix up some problems with the
+ LIBMTP_Set_Object_Filename() function.
+
+2008-01-27 Linus Walleij
+
+ * src/libmtp.c: fix up some minor things and documentation on
+ the object handling functions.
+
+2008-01-27 Florent Mertens
+
+ * src/libmtp.h.in: new functions to rename object filenames
+ and change object parents. Good when modifying the device
+ as a file system, LIBMTP_Set_Object_Filename(),
+ LIBMTP_Set_Object_Parent().
+ * src/libmtp.c: implementation.
+
+2008-01-27 Linus Walleij
+
+ * src/libusb-glue.c: re-read response from device until
+ it atleast exceeds two bytes. This fixes a problem with
+ the Samsung YP-U3 when populated with many, many songs.
+
+2008-01-21 Richard Low
+
+ * src/music-players.h: add Thomson Lyrca HC308A, remove
+ incorrect ID for Creative Zen 8GB
+
+2008-01-20 Richard Low
+
+ * src/libmtp.c: add LIBMTP_Get_Representative_Sample()
+ * src/libmtp.h.in: ditto
+
+2008-01-14 Linus Walleij
+
+ * src/libmtp.c: add LIBMTP_Get_Manufacturername(). Remember
+ to bump soname (compatible) in 0.2.6 (or whatever we name it).
+ 0.3.0 perhaps?
+ * src/libmtp.h.in: dito.
+ * src/libmtp.c: detect default folders named "Datacasts" and
+ "Texts".
+
+2008-01-11 Linus Walleij
+
+ * examples/pathutils.c: recognize .bin files as firmware,
+ used by e.g. RockBox developers. Doesn't cost anything to
+ add.
+
+2008-01-08 Linus Walleij
* configure.ac: bump to 0.2.5.
* src/Makefile.am: interface to libmtp.so.7.0.2
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/configure new/libmtp-0.2.6/configure
--- old/libmtp-0.2.5/configure 2008-01-09 08:18:06.000000000 +0100
+++ new/libmtp-0.2.6/configure 2008-03-02 21:48:05.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for libmtp 0.2.5.
+# Generated by GNU Autoconf 2.61 for libmtp 0.2.6.
#
# Report bugs to .
#
@@ -728,8 +728,8 @@
# Identity of this package.
PACKAGE_NAME='libmtp'
PACKAGE_TARNAME='libmtp'
-PACKAGE_VERSION='0.2.5'
-PACKAGE_STRING='libmtp 0.2.5'
+PACKAGE_VERSION='0.2.6'
+PACKAGE_STRING='libmtp 0.2.6'
PACKAGE_BUGREPORT='libmtp-users@lists.sourceforge.net'
ac_unique_file="src/libmtp.c"
@@ -1401,7 +1401,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libmtp 0.2.5 to adapt to many kinds of systems.
+\`configure' configures libmtp 0.2.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1471,7 +1471,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libmtp 0.2.5:";;
+ short | recursive ) echo "Configuration of libmtp 0.2.6:";;
esac
cat <<\_ACEOF
@@ -1573,7 +1573,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libmtp configure 0.2.5
+libmtp configure 0.2.6
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1587,7 +1587,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libmtp $as_me 0.2.5, which was
+It was created by libmtp $as_me 0.2.6, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2277,7 +2277,7 @@
# Define the identity of the package.
PACKAGE='libmtp'
- VERSION='0.2.5'
+ VERSION='0.2.6'
cat >>confdefs.h <<_ACEOF
@@ -22847,7 +22847,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libmtp $as_me 0.2.5, which was
+This file was extended by libmtp $as_me 0.2.6, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -22900,7 +22900,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-libmtp config.status 0.2.5
+libmtp config.status 0.2.6
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/configure.ac new/libmtp-0.2.6/configure.ac
--- old/libmtp-0.2.5/configure.ac 2008-01-09 08:17:46.000000000 +0100
+++ new/libmtp-0.2.6/configure.ac 2008-03-02 21:47:02.000000000 +0100
@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
-AC_INIT([libmtp], [0.2.5], [libmtp-users@lists.sourceforge.net])
+AC_INIT([libmtp], [0.2.6], [libmtp-users@lists.sourceforge.net])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([src/libmtp.c])
AM_CONFIG_HEADER(config.h)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/doc/Doxyfile.in new/libmtp-0.2.6/doc/Doxyfile.in
--- old/libmtp-0.2.5/doc/Doxyfile.in 2006-02-03 10:46:22.000000000 +0100
+++ new/libmtp-0.2.6/doc/Doxyfile.in 2008-03-02 21:47:02.000000000 +0100
@@ -54,16 +54,6 @@
OUTPUT_LANGUAGE = English
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
@@ -1120,22 +1110,6 @@
DOTFILE_DIRS =
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes that
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/examples/delfile.c new/libmtp-0.2.6/examples/delfile.c
--- old/libmtp-0.2.5/examples/delfile.c 2007-02-12 16:19:59.000000000 +0100
+++ new/libmtp-0.2.6/examples/delfile.c 2008-02-24 10:54:44.000000000 +0100
@@ -2,7 +2,7 @@
* \file delfile.c
* Example program to delete a file off the device.
*
- * Copyright (C) 2005-2007 Linus Walleij
+ * Copyright (C) 2005-2008 Linus Walleij
* Copyright (C) 2006 Chris A. Debenham
*
* This library is free software; you can redistribute it and/or
@@ -40,7 +40,8 @@
void
delfile_function(char * path)
{
- int id = parse_path (path,files,folders);
+ uint32_t id = parse_path (path,files,folders);
+
if (id > 0) {
printf("Deleting %s which has item_id:%d\n",path,id);
int ret = 1;
@@ -58,6 +59,8 @@
int FILENAME = 1;
int ITEMID = 2;
int field_type = 0;
+ int i;
+
if ( argc > 2 ) {
if (strncmp(argv[1],"-f",2) == 0) {
field_type = FILENAME;
@@ -73,10 +76,12 @@
delfile_usage();
return;
}
- int i;
+
for (i=1;i 0 ) {
printf("Deleting %s\n",argv[i]);
ret = LIBMTP_Delete_Object(device, id);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/examples/pathutils.c new/libmtp-0.2.6/examples/pathutils.c
--- old/libmtp-0.2.5/examples/pathutils.c 2007-11-22 21:43:09.000000000 +0100
+++ new/libmtp-0.2.6/examples/pathutils.c 2008-02-24 10:54:45.000000000 +0100
@@ -1,7 +1,7 @@
/**
* \file pathutils.c
*
- * Copyright (C) 2005-2007 Linus Walleij
+ * Copyright (C) 2005-2008 Linus Walleij
* Copyright (C) 2006 Chris A. Debenham
*
* This library is free software; you can redistribute it and/or
@@ -26,16 +26,20 @@
/* Find the folder_id of a given path
* Runs by walking through folders structure */
-int
+static uint32_t
lookup_folder_id (LIBMTP_folder_t * folder, char * path, char * parent)
{
+ char * current;
+ uint32_t ret = (uint32_t) -1;
+
if (strcmp(path,"/")==0)
return 0;
- int ret = -1;
+
if (folder == NULL) {
return ret;
}
- char * current = malloc (strlen(parent) + strlen(folder->name) + 2);
+
+ current = malloc (strlen(parent) + strlen(folder->name) + 2);
sprintf(current,"%s/%s",parent,folder->name);
if (strcasecmp (path, current) == 0) {
free (current);
@@ -57,41 +61,49 @@
parse_path (char * path, LIBMTP_file_t * files, LIBMTP_folder_t * folders)
{
char *rest;
+ uint32_t item_id;
+
// Check if path is an item_id
if (*path != '/') {
- int item_id = strtoul(path, &rest, 0);
+ item_id = strtoul(path, &rest, 0);
// really should check contents of "rest" here...
+ /* if not number, assume a file name */
+ if (item_id == 0) {
+ LIBMTP_file_t * file = files;
+
+ /* search for matching name */
+ while (file != NULL) {
+ if (strcasecmp (file->filename, path) == 0) {
+ return file->item_id;
+ }
+ file = file->next;
+ }
+ }
return item_id;
}
// Check if path is a folder
- int item_id = lookup_folder_id(folders,path,"");
- if (item_id == -1) {
+ item_id = lookup_folder_id(folders,path,"");
+ if (item_id == (uint32_t) -1) {
char * dirc = strdup(path);
char * basec = strdup(path);
char * parent = dirname(dirc);
char * filename = basename(basec);
-
- //int len = strlen(strrchr(path,'/'));
- //char * filename = malloc(len);
- //int index = strlen (path) - len;
- //filename = strncpy (filename, &path[index+1],len);
- //char * parent = malloc(index);
- //parent = strncpy(parent, path, index);
- //parent[index] = '\0';
- int parent_id = lookup_folder_id(folders,parent,"");
+ uint32_t parent_id = lookup_folder_id(folders,parent,"");
LIBMTP_file_t * file;
+
file = files;
while (file != NULL) {
if (file->parent_id == parent_id) {
if (strcasecmp (file->filename, filename) == 0) {
- int item_id = file->item_id;
- free(dirc); free(basec);
- return item_id;
+ free(dirc);
+ free(basec);
+ return file->item_id;
}
}
file = file->next;
}
- free(dirc); free(basec);
+ free(dirc);
+ free(basec);
} else {
return item_id;
}
@@ -116,8 +128,16 @@
find_filetype (const char * filename)
{
char *ptype;
- ptype = rindex(filename,'.')+1;
LIBMTP_filetype_t filetype;
+
+ ptype = rindex(filename,'.');
+ // This accounts for the case with a filename without any "." (period).
+ if (!ptype) {
+ ptype = "";
+ } else {
+ ++ptype;
+ }
+
/* This need to be kept constantly updated as new file types arrive. */
if (!strcasecmp (ptype, "wav")) {
filetype = LIBMTP_FILETYPE_WAV;
@@ -185,6 +205,8 @@
filetype = LIBMTP_FILETYPE_JP2;
} else if (!strcasecmp (ptype, "jpx")) {
filetype = LIBMTP_FILETYPE_JPX;
+ } else if (!strcasecmp (ptype, "bin")) {
+ filetype = LIBMTP_FILETYPE_FIRMWARE;
} else {
/* Tagging as unknown file type */
filetype = LIBMTP_FILETYPE_UNKNOWN;
@@ -197,6 +219,7 @@
#ifndef HAVE_LIBGEN_H
static char *basename(char *in) {
char *p;
+
if (in == NULL)
return NULL;
p = in + strlen(in) - 1;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/examples/pathutils.h new/libmtp-0.2.6/examples/pathutils.h
--- old/libmtp-0.2.5/examples/pathutils.h 2007-02-12 16:19:59.000000000 +0100
+++ new/libmtp-0.2.6/examples/pathutils.h 2008-02-24 10:54:45.000000000 +0100
@@ -20,7 +20,6 @@
*/
#ifndef PATHUTILS_H_INCLUSION_GUARD
#define PATHUTILS_H_INCLUSION_GUARD
-int lookup_folder_id (LIBMTP_folder_t *, char *, char *);
int parse_path (char *, LIBMTP_file_t *, LIBMTP_folder_t *);
LIBMTP_filetype_t find_filetype (const char *);
int progress (u_int64_t const, u_int64_t const, void const * const);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/examples/sendtr.c new/libmtp-0.2.6/examples/sendtr.c
--- old/libmtp-0.2.5/examples/sendtr.c 2007-08-07 18:07:31.000000000 +0200
+++ new/libmtp-0.2.6/examples/sendtr.c 2008-02-24 10:54:45.000000000 +0100
@@ -5,10 +5,11 @@
* based on Enrique Jorreto Ledesma's work on the original program by
* Shaun Jackman and Linus Walleij.
*
- * Copyright (C) 2003-2007 Linus Walleij
+ * Copyright (C) 2003-2008 Linus Walleij
* Copyright (C) 2003-2005 Shaun Jackman
* Copyright (C) 2003-2005 Enrique Jorrete Ledesma
* Copyright (C) 2006 Chris A. Debenham
+ * Copyright (C) 2008 Nicolas Pennequin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -81,9 +82,73 @@
}
}
+static int add_track_to_album(LIBMTP_album_t *albuminfo, LIBMTP_track_t *trackmeta)
+{
+ LIBMTP_album_t *album;
+ LIBMTP_album_t *found_album = NULL;
+ int ret;
+
+ /* Look for the album */
+ album = LIBMTP_Get_Album_List(device);
+ while(album != NULL) {
+ if (album->name != NULL &&
+ album->artist != NULL &&
+ !strcmp(album->name, albuminfo->name) &&
+ !strcmp(album->artist, albuminfo->artist)) {
+ /* Disconnect this album for later use */
+ found_album = album;
+ album = album->next;
+ found_album->next = NULL;
+ } else {
+ LIBMTP_album_t *tmp;
+
+ tmp = album;
+ album = album->next;
+ LIBMTP_destroy_album_t(tmp);
+ }
+ }
+
+ if (found_album != NULL) {
+ uint32_t *tracks;
+
+ tracks = (uint32_t *)malloc((found_album->no_tracks+1) * sizeof(uint32_t));
+ printf("Album \"%s\" found: updating...\n", found_album->name);
+ if (!tracks) {
+ printf("failed malloc in add_track_to_album()\n");
+ return 1;
+ }
+ found_album->no_tracks++;
+ if (found_album->tracks != NULL) {
+ memcpy(tracks, found_album->tracks, found_album->no_tracks * sizeof(uint32_t));
+ free(found_album->tracks);
+ }
+ tracks[found_album->no_tracks-1] = trackmeta->item_id;
+ found_album->tracks = tracks;
+ ret = LIBMTP_Update_Album(device, found_album);
+ LIBMTP_destroy_album_t(found_album);
+ } else {
+ uint32_t *trackid;
+
+ trackid = (uint32_t *)malloc(sizeof(uint32_t));
+ *trackid = trackmeta->item_id;
+ albuminfo->tracks = trackid;
+ albuminfo->no_tracks = 1;
+ printf("Album doesn't exist: creating...\n");
+ ret = LIBMTP_Create_New_Album(device, albuminfo, 0);
+ /* albuminfo will be destroyed later by caller */
+ }
+
+ if (ret != 0) {
+ printf("Error creating or updating album.\n");
+ LIBMTP_Dump_Errorstack(device);
+ LIBMTP_Clear_Errorstack(device);
+ } else {
+ printf("success!\n");
+ }
+}
+
int sendtrack_function(char * from_path, char * to_path, char *partist, char *ptitle, char *pgenre, char *palbum, uint16_t tracknum, uint16_t length, uint16_t year)
{
- printf("Sending track %s to %s\n",from_path,to_path);
char *filename, *parent;
char artist[80], title[80], genre[80], album[80];
char num[80];
@@ -95,7 +160,13 @@
struct stat sb;
#endif
LIBMTP_track_t *trackmeta;
+ LIBMTP_album_t *albuminfo;
+ int ret;
+
+ printf("Sending track %s to %s\n",from_path,to_path);
+
trackmeta = LIBMTP_new_track_t();
+ albuminfo = LIBMTP_new_album_t();
parent = dirname(to_path);
filename = basename(to_path);
@@ -133,15 +204,12 @@
return 1;
}
- int ret;
-
if (ptitle == NULL) {
ptitle = prompt("Title", title, 80, 0);
}
if (!strlen(ptitle))
ptitle = NULL;
-
if (palbum == NULL) {
palbum = prompt("Album", album, 80, 0);
}
@@ -192,7 +260,6 @@
length = 0;
}
}
-
printf("Sending track:\n");
printf("Codec: %s\n", LIBMTP_Get_Filetype_Description(trackmeta->filetype));
@@ -203,14 +270,17 @@
if (palbum) {
printf("Album: %s\n", palbum);
trackmeta->album = strdup(palbum);
+ albuminfo->name = strdup(palbum);
}
if (partist) {
printf("Artist: %s\n", partist);
trackmeta->artist = strdup(partist);
+ albuminfo->artist = strdup(partist);
}
if (pgenre) {
printf("Genre: %s\n", pgenre);
trackmeta->genre = strdup(pgenre);
+ albuminfo->genre = strdup(pgenre);
}
if (year > 0) {
char tmp[80];
@@ -245,8 +315,9 @@
printf("New track ID: %d\n", trackmeta->item_id);
}
+ LIBMTP_destroy_album_t(albuminfo);
LIBMTP_destroy_track_t(trackmeta);
-
+
return 0;
}
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/libmtp.pc new/libmtp-0.2.6/libmtp.pc
--- old/libmtp-0.2.5/libmtp.pc 2008-01-09 08:18:28.000000000 +0100
+++ new/libmtp-0.2.6/libmtp.pc 2008-03-02 21:49:00.000000000 +0100
@@ -7,7 +7,7 @@
Name: libmtp
Description: libmtp is a library for accessing Media Transfer Protocol devices
-Version: 0.2.5
+Version: 0.2.6
Requires: libusb
Conflicts:
Libs: -L${libdir} -lmtp
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/README new/libmtp-0.2.6/README
--- old/libmtp-0.2.5/README 2008-01-09 08:17:46.000000000 +0100
+++ new/libmtp-0.2.6/README 2008-02-24 10:54:44.000000000 +0100
@@ -342,6 +342,19 @@
these whenever we can, sometimes we cannot work around it or we
cannot test your solution.
+* Generic USB misbehaviour: some devices behave badly under MTP
+ and USB mass storage alike, even down to the lowest layers
+ of USB. You can always discuss such issues at the linux-usb
+ mailing list if you're using Linux:
+ http://www.linux-usb.org/mailing.html
+
+ If you have a problem specific to USB mass storage mode, there
+ is a list of strange behaving devices in the Linux kernel:
+ http://lxr.linux.no/linux/drivers/usb/storage/unusual_devs.h
+ You can discuss this too on the mentioned list, for understanding
+ the quirks, see:
+ http://www2.one-eyed-alien.net/~mdharm/linux-usb/target_offenses.txt
+
* The Zen Vision:M (possibly more Creative Zens) has a firmware bug
that makes it drop the last two characters off a playlist name.
It is fixed in later firmware.
@@ -405,6 +418,7 @@
usb 4-5: configuration #1 chosen from 1 choice
usb 4-5: can't set config #1, error -110
+
Lost symbols
------------
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/libmtp.c new/libmtp-0.2.6/src/libmtp.c
--- old/libmtp-0.2.5/src/libmtp.c 2008-01-09 08:17:47.000000000 +0100
+++ new/libmtp-0.2.6/src/libmtp.c 2008-02-24 10:54:50.000000000 +0100
@@ -1,10 +1,11 @@
/**
* \file libmtp.c
*
- * Copyright (C) 2005-2007 Linus Walleij
- * Copyright (C) 2005-2007 Richard A. Low
+ * Copyright (C) 2005-2008 Linus Walleij
+ * Copyright (C) 2005-2008 Richard A. Low
* Copyright (C) 2007 Ted Bullock
* Copyright (C) 2007 Tero Saarni
+ * Copyright (C) 2008 Florent Mertens
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1544,7 +1545,8 @@
device->default_organizer_folder =
params->handles.Handler[i];
}
- else if (!strcasecmp(oi->Filename, "ZENcast")) {
+ else if (!strcasecmp(oi->Filename, "ZENcast") ||
+ !strcasecmp(oi->Filename, "Datacasts")) {
device->default_zencast_folder =
params->handles.Handler[i];
}
@@ -1553,7 +1555,8 @@
device->default_album_folder =
params->handles.Handler[i];
}
- else if (!strcasecmp(oi->Filename, "Text")) {
+ else if (!strcasecmp(oi->Filename, "Text") ||
+ !strcasecmp(oi->Filename, "Texts")) {
device->default_text_folder =
params->handles.Handler[i];
}
@@ -2048,6 +2051,24 @@
}
/**
+ * This retrieves the manufacturer name of an MTP device.
+ * @param device a pointer to the device to get the manufacturer name for.
+ * @return a newly allocated UTF-8 string representing the manufacturer name.
+ * The string must be freed by the caller after use. If the call
+ * was unsuccessful this will contain NULL.
+ */
+char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t *device)
+{
+ char *retmanuf = NULL;
+ PTPParams *params = (PTPParams *) device->params;
+
+ if (params->deviceinfo.Manufacturer != NULL) {
+ retmanuf = strdup(params->deviceinfo.Manufacturer);
+ }
+ return retmanuf;
+}
+
+/**
* This retrieves the model name (often equal to product name)
* of an MTP device.
* @param device a pointer to the device to get the model name for.
@@ -2645,7 +2666,7 @@
/**
* This returns a long list of all files available
- * on the current MTP device. Typical usage:
+ * on the current MTP device. Folders will not be returned. Typical usage:
*
* <pre>
* LIBMTP_file_t *filelist;
@@ -2839,6 +2860,10 @@
* <code>LIBMTP_Get_Filelisting()</code> and cache the file, preferably
* as an efficient data structure such as a hash list.
*
+ * Incidentally this function will return metadata for
+ * a folder (association) as well, but this is not a proper use
+ * of it, it is intended for file manipulation, not folder manipulation.
+ *
* @param device a pointer to the device to get the file metadata from.
* @param fileid the object ID of the file that you want the metadata for.
* @return a metadata entry on success or NULL on failure.
@@ -2867,12 +2892,6 @@
oi = ¶ms->objectinfo[i];
- if (oi->ObjectFormat == PTP_OFC_Association) {
- // MTP use thesis object format for folders which means
- // these "files" will turn up on a folder listing instead.
- return NULL;
- }
-
// Allocate a new file type
file = LIBMTP_new_file_t();
@@ -3658,6 +3677,11 @@
* @param device a pointer to the device to send the track to.
* @param path the filename of a local file which will be sent.
* @param metadata a track metadata set to be written along with the file.
+ * After this call the field <code>item_id</code>
+ * will contain the new track ID. Other fields such
+ * as the filename may also change during this operation
+ * due to device restrictions, so do not rely on the
+ * contents of this struct to be preserved in any way.
* @param callback a progress indicator function or NULL to ignore.
* @param data a user-defined pointer that is passed along to
* the <code>progress</code> function in order to
@@ -3729,7 +3753,10 @@
* @param fd the filedescriptor for a local file which will be sent.
* @param metadata a track metadata set to be written along with the file.
* After this call the field <code>item_id</code>
- * will contain the new track ID.
+ * will contain the new track ID. Other fields such
+ * as the filename may also change during this operation
+ * due to device restrictions, so do not rely on the
+ * contents of this struct to be preserved in any way.
* @param callback a progress indicator function or NULL to ignore.
* @param data a user-defined pointer that is passed along to
* the <code>progress</code> function in order to
@@ -3819,7 +3846,10 @@
* @param path the filename of a local file which will be sent.
* @param filedata a file strtuct to pass in info about the file.
* After this call the field <code>item_id</code>
- * will contain the new file ID.
+ * will contain the new file ID. Other fields such
+ * as the filename may also change during this operation
+ * due to device restrictions, so do not rely on the
+ * contents of this struct to be preserved in any way.
* @param callback a progress indicator function or NULL to ignore.
* @param data a user-defined pointer that is passed along to
* the <code>progress</code> function in order to
@@ -3893,7 +3923,10 @@
* @param fd the filedescriptor for a local file which will be sent.
* @param filedata a file strtuct to pass in info about the file.
* After this call the field <code>item_id</code>
- * will contain the new track ID.
+ * will contain the new track ID. Other fields such
+ * as the filename may also change during this operation
+ * due to device restrictions, so do not rely on the
+ * contents of this struct to be preserved in any way.
* @param callback a progress indicator function or NULL to ignore.
* @param data a user-defined pointer that is passed along to
* the <code>progress</code> function in order to
@@ -4597,11 +4630,18 @@
}
/**
- * This function deletes a single file, track, playlist or
- * any other object off the MTP device,
- * identified by an object ID.
- * @param device a pointer to the device to delete the file or track from.
- * @param item_id the item to delete.
+ * This function deletes a single file, track, playlist, folder or
+ * any other object off the MTP device, identified by the object ID.
+ *
+ * If you delete a folder, there is no guarantee that the device will
+ * really delete all the files that were in that folder, rather it is
+ * expected that they will not be deleted, and will turn up in object
+ * listings with parent set to a non-existant object ID. The safe way
+ * to do this is to recursively delete all files (and folders) contained
+ * in the folder, then the folder itself.
+ *
+ * @param device a pointer to the device to delete the object from.
+ * @param object_id the object to delete.
* @return 0 on success, any other value means failure.
*/
int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *device,
@@ -4620,6 +4660,107 @@
}
/**
+ * This function renames a single file, track, playlist, folder or
+ * any other object on the MTP device, identified by an object ID.
+ * This simply means that the PTP_OPC_ObjectFileName property
+ * is updated, if this is supported by the device.
+ *
+ * @param device a pointer to the device that contains the the file,
+ * track, foler, playlist or other object to set the filename for.
+ * @param object_id the ID of the object to rename.
+ * @param newname the new filename for this object. You MUST assume that
+ * this string can be modified by the call to this function, since
+ * some devices have restrictions as to which filenames may be
+ * used on them.
+ * @return 0 on success, any other value means failure.
+ */
+int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *device,
+ uint32_t object_id, char *newname)
+{
+ PTPParams *params = (PTPParams *) device->params;
+ PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
+ LIBMTP_file_t *file;
+ uint16_t ptp_type;
+ PTPObjectPropDesc opd;
+ uint16_t ret;
+
+ // Get metadata for this object.
+ file = LIBMTP_Get_Filemetadata(device, object_id);
+ if (file == NULL) {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Object_Filename(): "
+ "could not get file metadata for target object.");
+ return -1;
+ }
+ ptp_type = map_libmtp_type_to_ptp_type(file->filetype);
+ LIBMTP_destroy_file_t(file);
+
+ // See if we can modify the filename on this kind of files.
+ ret = ptp_mtp_getobjectpropdesc(params, PTP_OPC_ObjectFileName, ptp_type, &opd);
+ if (ret != PTP_RC_OK) {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Object_Filename(): "
+ "could not get property description.");
+ return -1;
+ }
+
+ if (!opd.GetSet) {
+ ptp_free_objectpropdesc(&opd);
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Object_Filename(): "
+ "property is not settable.");
+ // TODO: we COULD actually upload/download the object here, if we feel
+ // like wasting time for the user.
+ return -1;
+ }
+
+ if (ptp_usb->device_flags & DEVICE_FLAG_ONLY_7BIT_FILENAMES) {
+ strip_7bit_from_utf8(newname);
+ }
+
+ if (ptp_operation_issupported(params, PTP_OC_MTP_SetObjPropList) &&
+ !(ptp_usb->device_flags & DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST)) {
+ MTPProperties *props = NULL;
+ MTPProperties *prop = NULL;
+ int nrofprops = 0;
+
+ prop = ptp_get_new_object_prop_entry(&props, &nrofprops);
+ prop->ObjectHandle = object_id;
+ prop->property = PTP_OPC_ObjectFileName;
+ prop->datatype = PTP_DTC_STR;
+ prop->propval.str = strdup(newname);
+
+ ret = ptp_mtp_setobjectproplist(params, props, nrofprops);
+
+ ptp_destroy_object_prop_list(props, nrofprops);
+
+ if (ret != PTP_RC_OK) {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Oject_Filename(): "
+ "could not set object property list.");
+ ptp_free_objectpropdesc(&opd);
+ return -1;
+ }
+ } else if (ptp_operation_issupported(params, PTP_OC_MTP_SetObjectPropValue)) {
+ ret = set_object_string(device, object_id, PTP_OPC_ObjectFileName, newname);
+ if (ret != 0) {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Oject_Filename(): "
+ "could not set object filename.");
+ ptp_free_objectpropdesc(&opd);
+ return -1;
+ }
+ } else {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Oject_Filename(): "
+ "Your device doesn't seem to support any known way of setting metadata.");
+ ptp_free_objectpropdesc(&opd);
+ return -1;
+ }
+
+ ptp_free_objectpropdesc(&opd);
+
+ // update cached object properties if metadata cache exists
+ update_metadata_cache(device, object_id);
+
+ return 0;
+}
+
+/**
* Helper function. This indicates if a track exists on the device
* @param device a pointer to the device to get the track from.
* @param id the track ID of the track to retrieve.
@@ -5818,7 +5959,7 @@
* playlists, but in theory any filetype could support representative
* samples.
* @param device a pointer to the device which is to be examined.
- * @param the filetype to examine, and return the representative sample
+ * @param filetype the fileype to examine, and return the representative sample
* properties for.
* @param sample this will contain a new sample type with the fields
* filled in with suitable default values. For example, the
@@ -5940,10 +6081,9 @@
* TODO: there must be a way to find the max size for an ObjectPropertyValue.
* @param device a pointer to the device which the object is on.
* @param id unique id of the object to set artwork for.
- * @param data pointer to an array of uint8_t containing the representative
- * sample data.
- * @param size number of bytes in the sample.
+ * @param 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()
* @see LIBMTP_Create_New_Album()
*/
@@ -6041,6 +6181,91 @@
}
/**
+ * This routine gets representative sample data for an object.
+ * This uses the RepresentativeSampleData property of the album,
+ * 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
+ * @return 0 on success, any other value means failure.
+ * @see LIBMTP_Send_Representative_Sample()
+ * @see LIBMTP_Get_Representative_Sample_Format()
+ * @see LIBMTP_Create_New_Album()
+ */
+int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *device,
+ uint32_t const id,
+ LIBMTP_filesampledata_t *sampledata)
+{
+ uint16_t ret;
+ PTPParams *params = (PTPParams *) device->params;
+ PTPPropertyValue propval;
+ PTPObjectInfo *oi;
+ uint32_t i;
+ uint16_t *props = NULL;
+ uint32_t propcnt = 0;
+ int supported = 0;
+
+ // get the file format for the object we're going to send representative data for
+ oi = NULL;
+ for (i = 0; i < params->handles.n; i++) {
+ if (params->handles.Handler[i] == id) {
+ oi = ¶ms->objectinfo[i];
+ break;
+ }
+ }
+
+ if (oi == NULL) {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_Representative_Sample(): could not get object info.");
+ return -1;
+ }
+
+ // check that we can store representative sample data for this object format
+ ret = ptp_mtp_getobjectpropssupported(params, oi->ObjectFormat, &propcnt, &props);
+ if (ret != PTP_RC_OK) {
+ add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample(): could not get object properties.");
+ return -1;
+ }
+
+ for (i = 0; i < propcnt; i++) {
+ if (props[i] == PTP_OPC_RepresentativeSampleData) {
+ supported = 1;
+ break;
+ }
+ }
+ if (!supported) {
+ free(props);
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_Representative_Sample(): object type doesn't support RepresentativeSampleData.");
+ return -1;
+ }
+ free(props);
+
+ // Get the data
+ ret = ptp_mtp_getobjectpropvalue(params,id,PTP_OPC_RepresentativeSampleData,
+ &propval,PTP_DTC_AUINT8);
+ if (ret != PTP_RC_OK) {
+ add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample(): could not get sample data.");
+ return -1;
+ }
+
+ // Store it
+ sampledata->size = propval.a.count;
+ sampledata->data = malloc(sizeof(PTPPropertyValue) * propval.a.count);
+ for (i = 0; i < propval.a.count; i++) {
+ sampledata->data[i] = propval.a.v[i].u8;
+ }
+ free(propval.a.v);
+
+ // Get the other properties
+ sampledata->width = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleWidth, 0);
+ sampledata->height = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleHeight, 0);
+ sampledata->duration = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleDuration, 0);
+ sampledata->filetype = map_ptp_type_to_libmtp_type(
+ get_u16_from_object(device, id, PTP_OPC_RepresentativeSampleFormat, LIBMTP_FILETYPE_UNKNOWN));
+
+ return 0;
+}
+
+/**
* This routine updates an album based on the metadata
* supplied. If the <code>tracks</code> field of the metadata
* contains a track listing, these tracks will be added to the
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/libmtp.h new/libmtp-0.2.6/src/libmtp.h
--- old/libmtp-0.2.5/src/libmtp.h 2008-01-09 08:18:28.000000000 +0100
+++ new/libmtp-0.2.6/src/libmtp.h 2008-03-02 21:48:58.000000000 +0100
@@ -3,8 +3,9 @@
* Interface to the Media Transfer Protocol library.
*
* Copyright (C) 2005-2007 Linus Walleij
- * Copyright (C) 2005-2007 Richard A. Low
- * Copyright (C) 2007 Ted Bullock
+ * Copyright (C) 2005-2008 Richard A. Low
+ * Copyright (C) 2007 Ted Bullock
+ * Copyright (C) 2008 Florent Mertens
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -28,8 +29,8 @@
#ifndef LIBMTP_H_INCLUSION_GUARD
#define LIBMTP_H_INCLUSION_GUARD
-#define LIBMTP_VERSION 0.2.5
-#define LIBMTP_VERSION_STRING "0.2.5"
+#define LIBMTP_VERSION 0.2.6
+#define LIBMTP_VERSION_STRING "0.2.6"
/* This handles MSVC pecularities */
#ifdef _MSC_VER
@@ -357,6 +358,7 @@
void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*);
void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*);
int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*);
+char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*);
char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*);
char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*);
char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*);
@@ -411,6 +413,8 @@
LIBMTP_filesampledata_t **);
int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
LIBMTP_filesampledata_t *);
+int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
+ LIBMTP_filesampledata_t *);
/**
* @}
@@ -483,6 +487,7 @@
* @{
*/
int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t);
+int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *);
/** @} */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/libmtp.h.in new/libmtp-0.2.6/src/libmtp.h.in
--- old/libmtp-0.2.5/src/libmtp.h.in 2007-10-25 10:39:14.000000000 +0200
+++ new/libmtp-0.2.6/src/libmtp.h.in 2008-02-24 10:54:50.000000000 +0100
@@ -3,8 +3,9 @@
* Interface to the Media Transfer Protocol library.
*
* Copyright (C) 2005-2007 Linus Walleij
- * Copyright (C) 2005-2007 Richard A. Low
- * Copyright (C) 2007 Ted Bullock
+ * Copyright (C) 2005-2008 Richard A. Low
+ * Copyright (C) 2007 Ted Bullock
+ * Copyright (C) 2008 Florent Mertens
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -357,6 +358,7 @@
void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*);
void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*);
int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*);
+char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*);
char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*);
char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*);
char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*);
@@ -411,6 +413,8 @@
LIBMTP_filesampledata_t **);
int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
LIBMTP_filesampledata_t *);
+int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
+ LIBMTP_filesampledata_t *);
/**
* @}
@@ -483,6 +487,7 @@
* @{
*/
int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t);
+int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *);
/** @} */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/libusb-glue.c new/libmtp-0.2.6/src/libusb-glue.c
--- old/libmtp-0.2.5/src/libusb-glue.c 2007-11-22 21:43:11.000000000 +0100
+++ new/libmtp-0.2.6/src/libusb-glue.c 2008-03-02 21:47:03.000000000 +0100
@@ -3,7 +3,7 @@
* Low-level USB interface glue towards libusb.
*
* Copyright (C) 2005-2007 Richard A. Low
- * Copyright (C) 2005-2007 Linus Walleij
+ * Copyright (C) 2005-2008 Linus Walleij
* Copyright (C) 2006-2007 Marcus Meissner
* Copyright (C) 2007 Ted Bullock
*
@@ -43,7 +43,7 @@
#include "ptp-pack.c"
/* To enable debug prints, switch on this */
-//#define ENABLE_USB_BULK_DEBUG
+#define ENABLE_USB_BULK_DEBUG
/* this must not be too short - the original 4000 was not long
enough for big file transfers. I imagine the player spends a
@@ -534,7 +534,7 @@
while (curread < size) {
#ifdef ENABLE_USB_BULK_DEBUG
- printf("Remaining size to read: 0x%04x bytes\n", size - curread);
+ printf("Remaining size to read: 0x%04lx bytes\n", size - curread);
#endif
// check equal to condition here
if (size - curread < CONTEXT_BLOCK_SIZE)
@@ -559,7 +559,7 @@
(unsigned int) toread, (unsigned int) (size-curread));
#ifdef ENABLE_USB_BULK_DEBUG
- printf("Reading in 0x%04x bytes\n", toread);
+ printf("Reading in 0x%04lx bytes\n", toread);
#endif
result = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, (char*)bytes, toread, USB_TIMEOUT);
#ifdef ENABLE_USB_BULK_DEBUG
@@ -824,7 +824,12 @@
PTPUSBBulkContainer usbreq;
PTPDataHandler memhandler;
unsigned long written, towrite;
+#ifdef ENABLE_USB_BULK_DEBUG
+ char txt[256];
+ (void) ptp_render_opcode (params, req->Code, sizeof(txt), txt);
+ printf("REQUEST: 0x%04x, %s\n", req->Code, txt);
+#endif
/* build appropriate USB container */
usbreq.length=htod32(PTP_USB_BULK_REQ_LEN-
(sizeof(uint32_t)*(5-req->Nparam)));
@@ -870,6 +875,9 @@
uint32_t bytes_left_to_transfer;
PTPDataHandler memhandler;
+#ifdef ENABLE_USB_BULK_DEBUG
+ printf("SEND DATA PHASE\n");
+#endif
/* build appropriate USB container */
usbdata.length = htod32(PTP_USB_BULK_HDR_LEN+size);
usbdata.type = htod16(PTP_USB_CONTAINER_DATA);
@@ -955,6 +963,9 @@
unsigned long written;
PTP_USB *ptp_usb = (PTP_USB *) params->data;
+#ifdef ENABLE_USB_BULK_DEBUG
+ printf("GET DATA PHASE\n");
+#endif
memset(&usbdata,0,sizeof(usbdata));
do {
unsigned long len, rlen;
@@ -1108,10 +1119,24 @@
PTPUSBBulkContainer usbresp;
PTP_USB *ptp_usb = (PTP_USB *)(params->data);
+#ifdef ENABLE_USB_BULK_DEBUG
+ printf("RESPONSE: ");
+#endif
memset(&usbresp,0,sizeof(usbresp));
/* read response, it should never be longer than sizeof(usbresp) */
ret = ptp_usb_getpacket(params, &usbresp, &rlen);
+ // Fix for bevahiour reported by Scott Snyder on Samsung YP-U3. The player
+ // sends a packet containing just zeroes of length 2 (up to 4 has been seen too)
+ // after a NULL packet when it should send the response. This code ignores
+ // such illegal packets.
+ while (ret==PTP_RC_OK && rlenCode) {
ret = dtoh16(usbresp.code);
}
+#ifdef ENABLE_USB_BULK_DEBUG
+ printf("%04x\n", ret);
+#endif
if (ret!=PTP_RC_OK) {
/* ptp_error (params,
"PTP: request code 0x%04x getting resp error 0x%04x",
@@ -1134,7 +1162,8 @@
if (ptp_usb->device_flags & DEVICE_FLAG_IGNORE_HEADER_ERRORS) {
if (resp->Transaction_ID != params->transaction_id-1) {
ptp_debug (params, "ptp_usb_getresp: detected a broken "
- "PTP header, transaction ID insane, expect problems! (But continuing)");
+ "PTP header, transaction ID insane, expect "
+ "problems! (But continuing)");
// Repair the header, so it won't wreak more havoc.
resp->Transaction_ID = params->transaction_id-1;
}
@@ -1344,7 +1373,16 @@
// Commented out since it was confusing some
// devices to do these things.
if (!(ptp_usb->device_flags & DEVICE_FLAG_NO_RELEASE_INTERFACE)) {
- // Clear any stalled endpoints
+ /*
+ * Clear any stalled endpoints
+ * On misbehaving devices designed for Windows/Mac, quote from:
+ * http://www2.one-eyed-alien.net/~mdharm/linux-usb/target_offenses.txt
+ * Device does Bad Things(tm) when it gets a GET_STATUS after CLEAR_HALT
+ * (...) Windows, when clearing a stall, only sends the CLEAR_HALT command,
+ * and presumes that the stall has cleared. Some devices actually choke
+ * if the CLEAR_HALT is followed by a GET_STATUS (used to determine if the
+ * STALL is persistant or not).
+ */
clear_stall(ptp_usb);
// Clear halts on any endpoints
clear_halt(ptp_usb);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/Makefile.am new/libmtp-0.2.6/src/Makefile.am
--- old/libmtp-0.2.5/src/Makefile.am 2008-01-09 08:17:47.000000000 +0100
+++ new/libmtp-0.2.6/src/Makefile.am 2008-03-02 21:47:03.000000000 +0100
@@ -28,9 +28,9 @@
# increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
# REVISION is set to 0, otherwise REVISION is incremented.
# ---------------------------------------------------------------------------
-CURRENT=7
-AGE=0
-REVISION=2
+CURRENT=8
+AGE=1
+REVISION=0
SOVERSION=$(CURRENT):$(REVISION):$(AGE)
if COMPILE_MINGW32
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/Makefile.in new/libmtp-0.2.6/src/Makefile.in
--- old/libmtp-0.2.5/src/Makefile.in 2008-01-09 08:18:03.000000000 +0100
+++ new/libmtp-0.2.6/src/Makefile.in 2008-03-02 21:48:02.000000000 +0100
@@ -224,9 +224,9 @@
# increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
# REVISION is set to 0, otherwise REVISION is incremented.
# ---------------------------------------------------------------------------
-CURRENT = 7
-AGE = 0
-REVISION = 2
+CURRENT = 8
+AGE = 1
+REVISION = 0
SOVERSION = $(CURRENT):$(REVISION):$(AGE)
@COMPILE_MINGW32_TRUE@noinst_DATA = libmtp.lib
@COMPILE_MINGW32_TRUE@W32LF = -export-dynamic -no-undefined -export-symbols libmtp.sym
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/music-players.h new/libmtp-0.2.6/src/music-players.h
--- old/libmtp-0.2.5/src/music-players.h 2008-01-09 08:17:48.000000000 +0100
+++ new/libmtp-0.2.6/src/music-players.h 2008-03-02 21:47:03.000000000 +0100
@@ -3,7 +3,7 @@
* List of music players as USB ids.
*
* Copyright (C) 2005-2007 Richard A. Low
- * Copyright (C) 2005-2007 Linus Walleij
+ * Copyright (C) 2005-2008 Linus Walleij
* Copyright (C) 2006-2007 Marcus Meissner
* Copyright (C) 2007 Ted Bullock
*
@@ -62,10 +62,9 @@
// Reported by Darel on the XNJB forums
{ "Creative", 0x041e, "ZEN V Plus", 0x4152, DEVICE_FLAG_NONE },
{ "Creative", 0x041e, "ZEN Vision W", 0x4153, DEVICE_FLAG_NONE },
- // Reported by Mat Hunt
- { "Creative", 0x041e, "ZEN 8GB", 0x4155, DEVICE_FLAG_NONE },
+ // Don't add 0x4155: this is a Zen Stone device which is not MTP
// Reported by Paul Kurczaba
- { "Creative", 0x041e, "ZEN 8GB 2nd id", 0x4157, DEVICE_FLAG_IGNORE_HEADER_ERRORS },
+ { "Creative", 0x041e, "ZEN 8GB", 0x4157, DEVICE_FLAG_IGNORE_HEADER_ERRORS },
// Reported by Ringofan
{ "Creative", 0x041e, "ZEN V 2GB", 0x4158, DEVICE_FLAG_NONE },
@@ -112,12 +111,16 @@
// From XNJB user
{ "Samsung", 0x04e8, "YP-P2", 0x5083, DEVICE_FLAG_NO_ZERO_READS },
// From Paul Clinch
- { "Samsung", 0x04e8, "YP-T10", 0x508a, DEVICE_FLAG_OGG_IS_UNKNOWN },
+ { "Samsung", 0x04e8, "YP-T10", 0x508a, DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST },
// From a rouge .INF file,
// this device ID seems to have been recycled for:
// the Samsung SGH-A707 Cingular cellphone
// the Samsung L760-V cellphone
{ "Samsung", 0x04e8, "YH-999 Portable Media Center/SGH-A707/SGH-L760V", 0x5a0f, DEVICE_FLAG_NONE },
+ // From Santi Béjar - not sure this is MTP...
+ // { "Samsung", 0x04e8, "Z170 Mobile Phone", 0x6601, DEVICE_FLAG_UNLOAD_DRIVER },
+ // From Santi Béjar - not sure this is MTP...
+ // { "Samsung", 0x04e8, "E250 Mobile Phone", 0x663e, DEVICE_FLAG_UNLOAD_DRIVER },
// From Lionel Bouton
{ "Samsung", 0x04e8, "X830 Mobile Phone", 0x6702, DEVICE_FLAG_NONE },
// From James
@@ -145,7 +148,7 @@
// from discussion forum
{ "Philips", 0x0471, "HDD085/00 or HDD082/17", 0x014d, DEVICE_FLAG_NONE },
// from XNJB forum
- { "Philips", 0x0471, "GoGear SA9200", 0x014f, DEVICE_FLAG_NONE },
+ { "Philips", 0x0471, "GoGear SA9200", 0x014f, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL },
// From John Coppens
{ "Philips", 0x0471, "SA1115/55", 0x0164, DEVICE_FLAG_NONE },
// From Gerhard Mekenkamp
@@ -311,8 +314,11 @@
{ "Toshiba", 0x0930, "Gigabeat V30", 0x0014, DEVICE_FLAG_NONE },
// Reported by Michael Davis
{ "Toshiba", 0x0930, "Gigabeat U", 0x0016, DEVICE_FLAG_NONE },
+ // Reported by Devon Jacobs
+ { "Toshiba", 0x0930, "Gigabeat MEU202", 0x0018, DEVICE_FLAG_NO_RELEASE_INTERFACE },
// Reported by Rolf
{ "Toshiba", 0x0930, "Gigabeat T", 0x0019, DEVICE_FLAG_NONE },
+
/*
* Archos
@@ -326,6 +332,8 @@
{ "Archos", 0x0e79, "XS202 (MTP mode)", 0x1208, DEVICE_FLAG_NONE },
// Reported by gudul1@users.sourceforge.net
{ "Archos", 0x0e79, "104 (MTP mode)", 0x120a, DEVICE_FLAG_NONE },
+ // Reported by anonymous Sourceforge user.
+ { "Archos", 0x0e79, "404 (MTP mode)", 0x1301, DEVICE_FLAG_UNLOAD_DRIVER },
// Reported by Etienne Chauchot
{ "Archos", 0x0e79, "504 (MTP mode)", 0x1307, DEVICE_FLAG_UNLOAD_DRIVER },
// Reported by Kay McCormick
@@ -363,9 +371,14 @@
/*
* Nokia
+ * Please verify the low device IDs here, I suspect these might be for
+ * things like USB storage or modem mode actually, whereas the higher
+ * range (0x04nn) could be for MTP.
*/
// From: DoomHammer
{ "Nokia", 0x0421, "3110c Mobile Phone", 0x005f, DEVICE_FLAG_NONE },
+ // From: robin (AT) headbank D0Tco DOTuk
+ { "Nokia", 0x0421, "N95 Mobile Phone 8GB", 0x006e, DEVICE_FLAG_NONE },
// From: Mitchell Hicks
{ "Nokia", 0x0421, "5300 Mobile Phone", 0x04ba, DEVICE_FLAG_NONE },
// From Christian Arnold
@@ -389,10 +402,13 @@
*/
// From kiki
{ "Thomson", 0x069b, "EM28 Series", 0x0774, DEVICE_FLAG_NONE },
- { "Thomson / RCA", 0x069b, "Opal / Lyrca MC4002", 0x0777, DEVICE_FLAG_NONE },
+ { "Thomson / RCA", 0x069b, "Opal / Lyra MC4002", 0x0777, DEVICE_FLAG_NONE },
+ { "Thomson", 0x069b, "RCA H106", 0x301a, DEVICE_FLAG_UNLOAD_DRIVER },
// From Svenna
// Not confirmed to be MTP.
{ "Thomson", 0x069b, "scenium E308", 0x3028, DEVICE_FLAG_NONE },
+ // From XNJB user
+ { "Thomson / RCA", 0x069b, "Lyra HC308A", 0x3035, DEVICE_FLAG_NONE },
/*
* NTT DoCoMo
@@ -421,10 +437,12 @@
DEVICE_FLAG_UNLOAD_DRIVER },
/*
- * Disney (have had no reports of this actually working.)
+ * Disney/Tevion (have had no reports of these actually working.)
*/
// Reported by XNJB user
{ "Disney", 0x0aa6, "MixMax", 0x6021, DEVICE_FLAG_NONE },
+ // Reported by anonymous Sourceforge user
+ { "Tevion", 0x0aa6, "MD 81488", 0x3011, DEVICE_FLAG_NONE },
/*
* Cowon Systems, Inc.
@@ -460,7 +478,7 @@
* reported to see a pattern here.
*/
// Reported by Alessandro Radaelli >alessandro.radaelli@aruba.it>
- { "Sony", 0x054c, "Walkman NWZ-A815", 0x0325, DEVICE_FLAG_UNLOAD_DRIVER },
+ { "Sony", 0x054c, "Walkman NWZ-A815/NWZ-A818", 0x0325, DEVICE_FLAG_UNLOAD_DRIVER },
// Reported by anonymous Sourceforge user.
{ "Sony", 0x054c, "Walkman NWZ-S516", 0x0326, DEVICE_FLAG_UNLOAD_DRIVER },
// Reported by Endre Oma
@@ -492,6 +510,13 @@
{ "Kenwood", 0x0b28, "Media Keg HD10GB7 Sport Player", 0x100c, DEVICE_FLAG_UNLOAD_DRIVER},
/*
+ * Micro-Star International (MSI)
+ */
+ // Reported by anonymous sourceforge user.
+ { "Micro-Star International", 0x0db0, "P610/Model MS-5557", 0x5572, DEVICE_FLAG_NONE },
+
+
+ /*
* Other strange stuff.
*/
{ "Isabella", 0x0b20, "Her Prototype", 0xddee, DEVICE_FLAG_NONE }
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/ptp.c new/libmtp-0.2.6/src/ptp.c
--- old/libmtp-0.2.5/src/ptp.c 2007-11-07 17:19:31.000000000 +0100
+++ new/libmtp-0.2.6/src/ptp.c 2008-03-02 21:47:04.000000000 +0100
@@ -2804,13 +2804,23 @@
PTPContainer ptp;
uint16_t ret;
unsigned char* dpv=NULL;
+ unsigned int dpvlen = 0;
PTP_CNT_INIT(ptp);
ptp.Code=PTP_OC_MTP_GetObjectReferences;
ptp.Param1=handle;
ptp.Nparam=1;
- ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, NULL);
- if (ret == PTP_RC_OK) *arraylen = ptp_unpack_uint32_t_array(params, dpv, 0, ohArray);
+ ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, &dpvlen);
+ if (ret == PTP_RC_OK) {
+ /* Sandisk Sansa skips the DATA phase, but returns OK as response.
+ * this will gives us a NULL here. Handle it. -Marcus */
+ if ((dpv == NULL) || (dpvlen == 0)) {
+ *arraylen = 0;
+ *ohArray = NULL;
+ } else {
+ *arraylen = ptp_unpack_uint32_t_array(params, dpv, 0, ohArray);
+ }
+ }
free(dpv);
return ret;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libmtp-0.2.5/src/ptp.h new/libmtp-0.2.6/src/ptp.h
--- old/libmtp-0.2.5/src/ptp.h 2007-11-07 17:19:31.000000000 +0100
+++ new/libmtp-0.2.6/src/ptp.h 2008-03-02 21:47:04.000000000 +0100
@@ -62,7 +62,7 @@
* and fixed the bugs that made this necessary and it can be 512 again.
*/
#define PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE 512
-#define PTP_USB_BULK_HS_MAX_PACKET_LEN_READ 512
+#define PTP_USB_BULK_HS_MAX_PACKET_LEN_READ 512
#define PTP_USB_BULK_HDR_LEN (2*sizeof(uint32_t)+2*sizeof(uint16_t))
#define PTP_USB_BULK_PAYLOAD_LEN_WRITE (PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE-PTP_USB_BULK_HDR_LEN)
#define PTP_USB_BULK_PAYLOAD_LEN_READ (PTP_USB_BULK_HS_MAX_PACKET_LEN_READ-PTP_USB_BULK_HDR_LEN)
@@ -1065,6 +1065,8 @@
#define PTP_DPC_CANON_FocalLengthWide 0xD027
#define PTP_DPC_CANON_FocalLengthDenominator 0xD028
#define PTP_DPC_CANON_CaptureTransferMode 0xD029
+#define CANON_TRANSFER_MEMORY 3
+#define CANON_TRANSFER_CARD 9
#define PTP_DPC_CANON_Zoom 0xD02A
#define PTP_DPC_CANON_NamePrefix 0xD02B
#define PTP_DPC_CANON_SizeQualityMode 0xD02C
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org