diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-08 14:30:41 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-12 13:49:54 +0200 |
commit | ab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch) | |
tree | 498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/third_party/libmtp/examples | |
parent | 4ce69f7403811819800e7c5ae1318b2647e778d1 (diff) |
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/libmtp/examples')
30 files changed, 0 insertions, 4131 deletions
diff --git a/chromium/third_party/libmtp/examples/Makefile.am b/chromium/third_party/libmtp/examples/Makefile.am deleted file mode 100644 index 0bac1b324fc..00000000000 --- a/chromium/third_party/libmtp/examples/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -bin_PROGRAMS=mtp-connect mtp-detect mtp-tracks mtp-files \ - mtp-folders mtp-trexist \ - mtp-format mtp-albumart mtp-albums mtp-emptyfolders \ - mtp-thumb mtp-reset mtp-filetree - -mtp_connect_SOURCES=connect.c connect.h delfile.c getfile.c newfolder.c \ - sendfile.c sendtr.c pathutils.c pathutils.h \ - util.c util.h common.h -mtp_detect_SOURCES=detect.c util.c util.h common.h -mtp_tracks_SOURCES=tracks.c util.c util.h common.h -mtp_files_SOURCES=files.c util.c util.h common.h -mtp_folders_SOURCES=folders.c util.c util.h common.h -mtp_trexist_SOURCES=trexist.c util.c util.h common.h -mtp_format_SOURCES=format.c util.c util.h common.h -mtp_albumart_SOURCES=albumart.c util.c util.h common.h -mtp_albums_SOURCES=albums.c util.c util.h common.h -mtp_emptyfolders_SOURCES=emptyfolders.c util.c util.h common.h -mtp_thumb_SOURCES=thumb.c util.c util.h common.h -mtp_reset_SOURCES=reset.c util.c util.h common.h -mtp_filetree_SOURCES=filetree.c util.c util.h common.h - -AM_CPPFLAGS=-I$(top_builddir)/src -LDADD=../src/libmtp.la -EXTRA_DIST=evolution-sync.sh - -install-exec-hook: - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-delfile$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-getfile$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-newfolder$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendfile$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendtr$(EXEEXT) diff --git a/chromium/third_party/libmtp/examples/Makefile.in b/chromium/third_party/libmtp/examples/Makefile.in deleted file mode 100644 index d1b2fcd87be..00000000000 --- a/chromium/third_party/libmtp/examples/Makefile.in +++ /dev/null @@ -1,680 +0,0 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -bin_PROGRAMS = mtp-connect$(EXEEXT) mtp-detect$(EXEEXT) \ - mtp-tracks$(EXEEXT) mtp-files$(EXEEXT) mtp-folders$(EXEEXT) \ - mtp-trexist$(EXEEXT) \ - mtp-format$(EXEEXT) \ - mtp-albumart$(EXEEXT) mtp-albums$(EXEEXT) \ - mtp-emptyfolders$(EXEEXT) \ - mtp-thumb$(EXEEXT) mtp-reset$(EXEEXT) mtp-filetree$(EXEEXT) -subdir = examples -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/byteorder.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am_mtp_albumart_OBJECTS = albumart.$(OBJEXT) util.$(OBJEXT) -mtp_albumart_OBJECTS = $(am_mtp_albumart_OBJECTS) -mtp_albumart_LDADD = $(LDADD) -mtp_albumart_DEPENDENCIES = ../src/libmtp.la -am_mtp_albums_OBJECTS = albums.$(OBJEXT) util.$(OBJEXT) -mtp_albums_OBJECTS = $(am_mtp_albums_OBJECTS) -mtp_albums_LDADD = $(LDADD) -mtp_albums_DEPENDENCIES = ../src/libmtp.la -am_mtp_connect_OBJECTS = connect.$(OBJEXT) delfile.$(OBJEXT) \ - getfile.$(OBJEXT) newfolder.$(OBJEXT) sendfile.$(OBJEXT) \ - sendtr.$(OBJEXT) pathutils.$(OBJEXT) util.$(OBJEXT) -mtp_connect_OBJECTS = $(am_mtp_connect_OBJECTS) -mtp_connect_LDADD = $(LDADD) -mtp_connect_DEPENDENCIES = ../src/libmtp.la -am_mtp_detect_OBJECTS = detect.$(OBJEXT) util.$(OBJEXT) -mtp_detect_OBJECTS = $(am_mtp_detect_OBJECTS) -mtp_detect_LDADD = $(LDADD) -mtp_detect_DEPENDENCIES = ../src/libmtp.la -am_mtp_emptyfolders_OBJECTS = emptyfolders.$(OBJEXT) util.$(OBJEXT) -mtp_emptyfolders_OBJECTS = $(am_mtp_emptyfolders_OBJECTS) -mtp_emptyfolders_LDADD = $(LDADD) -mtp_emptyfolders_DEPENDENCIES = ../src/libmtp.la -am_mtp_files_OBJECTS = files.$(OBJEXT) util.$(OBJEXT) -mtp_files_OBJECTS = $(am_mtp_files_OBJECTS) -mtp_files_LDADD = $(LDADD) -mtp_files_DEPENDENCIES = ../src/libmtp.la -am_mtp_filetree_OBJECTS = filetree.$(OBJEXT) util.$(OBJEXT) -mtp_filetree_OBJECTS = $(am_mtp_filetree_OBJECTS) -mtp_filetree_LDADD = $(LDADD) -mtp_filetree_DEPENDENCIES = ../src/libmtp.la -am_mtp_folders_OBJECTS = folders.$(OBJEXT) util.$(OBJEXT) -mtp_folders_OBJECTS = $(am_mtp_folders_OBJECTS) -mtp_folders_LDADD = $(LDADD) -mtp_folders_DEPENDENCIES = ../src/libmtp.la -am_mtp_format_OBJECTS = format.$(OBJEXT) util.$(OBJEXT) -mtp_format_OBJECTS = $(am_mtp_format_OBJECTS) -mtp_format_LDADD = $(LDADD) -mtp_format_DEPENDENCIES = ../src/libmtp.la -am_mtp_reset_OBJECTS = reset.$(OBJEXT) util.$(OBJEXT) -mtp_reset_OBJECTS = $(am_mtp_reset_OBJECTS) -mtp_reset_LDADD = $(LDADD) -mtp_reset_DEPENDENCIES = ../src/libmtp.la -am_mtp_thumb_OBJECTS = thumb.$(OBJEXT) util.$(OBJEXT) -mtp_thumb_OBJECTS = $(am_mtp_thumb_OBJECTS) -mtp_thumb_LDADD = $(LDADD) -mtp_thumb_DEPENDENCIES = ../src/libmtp.la -am_mtp_tracks_OBJECTS = tracks.$(OBJEXT) util.$(OBJEXT) -mtp_tracks_OBJECTS = $(am_mtp_tracks_OBJECTS) -mtp_tracks_LDADD = $(LDADD) -mtp_tracks_DEPENDENCIES = ../src/libmtp.la -am_mtp_trexist_OBJECTS = trexist.$(OBJEXT) util.$(OBJEXT) -mtp_trexist_OBJECTS = $(am_mtp_trexist_OBJECTS) -mtp_trexist_LDADD = $(LDADD) -mtp_trexist_DEPENDENCIES = ../src/libmtp.la -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(mtp_albumart_SOURCES) $(mtp_albums_SOURCES) \ - $(mtp_connect_SOURCES) $(mtp_detect_SOURCES) \ - $(mtp_emptyfolders_SOURCES) $(mtp_files_SOURCES) \ - $(mtp_filetree_SOURCES) $(mtp_folders_SOURCES) \ - $(mtp_format_SOURCES) \ - $(mtp_reset_SOURCES) $(mtp_thumb_SOURCES) \ - $(mtp_tracks_SOURCES) $(mtp_trexist_SOURCES) -DIST_SOURCES = $(mtp_albumart_SOURCES) $(mtp_albums_SOURCES) \ - $(mtp_connect_SOURCES) $(mtp_detect_SOURCES) \ - $(mtp_emptyfolders_SOURCES) $(mtp_files_SOURCES) \ - $(mtp_filetree_SOURCES) $(mtp_folders_SOURCES) \ - $(mtp_format_SOURCES) \ - $(mtp_reset_SOURCES) $(mtp_thumb_SOURCES) \ - $(mtp_tracks_SOURCES) $(mtp_trexist_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_DOXYGEN = @HAVE_DOXYGEN@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LIBS = @LIBUSB_LIBS@ -LIBUSB_REQUIRES = @LIBUSB_REQUIRES@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OSFLAGS = @OSFLAGS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -UDEV = @UDEV@ -UDEV_GROUP = @UDEV_GROUP@ -UDEV_MODE = @UDEV_MODE@ -UDEV_RULES = @UDEV_RULES@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -effective_target = @effective_target@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -ms_lib_exe = @ms_lib_exe@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -mtp_connect_SOURCES = connect.c connect.h delfile.c getfile.c newfolder.c \ - sendfile.c sendtr.c pathutils.c pathutils.h \ - util.c util.h common.h - -mtp_detect_SOURCES = detect.c util.c util.h common.h -mtp_tracks_SOURCES = tracks.c util.c util.h common.h -mtp_files_SOURCES = files.c util.c util.h common.h -mtp_folders_SOURCES = folders.c util.c util.h common.h -mtp_trexist_SOURCES = trexist.c util.c util.h common.h -mtp_format_SOURCES = format.c util.c util.h common.h -mtp_albumart_SOURCES = albumart.c util.c util.h common.h -mtp_albums_SOURCES = albums.c util.c util.h common.h -mtp_emptyfolders_SOURCES = emptyfolders.c util.c util.h common.h -mtp_thumb_SOURCES = thumb.c util.c util.h common.h -mtp_reset_SOURCES = reset.c util.c util.h common.h -mtp_filetree_SOURCES = filetree.c util.c util.h common.h -AM_CPPFLAGS = -I$(top_builddir)/src -LDADD = ../src/libmtp.la -EXTRA_DIST = evolution-sync.sh -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign examples/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -mtp-albumart$(EXEEXT): $(mtp_albumart_OBJECTS) $(mtp_albumart_DEPENDENCIES) $(EXTRA_mtp_albumart_DEPENDENCIES) - @rm -f mtp-albumart$(EXEEXT) - $(LINK) $(mtp_albumart_OBJECTS) $(mtp_albumart_LDADD) $(LIBS) -mtp-albums$(EXEEXT): $(mtp_albums_OBJECTS) $(mtp_albums_DEPENDENCIES) $(EXTRA_mtp_albums_DEPENDENCIES) - @rm -f mtp-albums$(EXEEXT) - $(LINK) $(mtp_albums_OBJECTS) $(mtp_albums_LDADD) $(LIBS) -mtp-connect$(EXEEXT): $(mtp_connect_OBJECTS) $(mtp_connect_DEPENDENCIES) $(EXTRA_mtp_connect_DEPENDENCIES) - @rm -f mtp-connect$(EXEEXT) - $(LINK) $(mtp_connect_OBJECTS) $(mtp_connect_LDADD) $(LIBS) -mtp-detect$(EXEEXT): $(mtp_detect_OBJECTS) $(mtp_detect_DEPENDENCIES) $(EXTRA_mtp_detect_DEPENDENCIES) - @rm -f mtp-detect$(EXEEXT) - $(LINK) $(mtp_detect_OBJECTS) $(mtp_detect_LDADD) $(LIBS) -mtp-emptyfolders$(EXEEXT): $(mtp_emptyfolders_OBJECTS) $(mtp_emptyfolders_DEPENDENCIES) $(EXTRA_mtp_emptyfolders_DEPENDENCIES) - @rm -f mtp-emptyfolders$(EXEEXT) - $(LINK) $(mtp_emptyfolders_OBJECTS) $(mtp_emptyfolders_LDADD) $(LIBS) -mtp-files$(EXEEXT): $(mtp_files_OBJECTS) $(mtp_files_DEPENDENCIES) $(EXTRA_mtp_files_DEPENDENCIES) - @rm -f mtp-files$(EXEEXT) - $(LINK) $(mtp_files_OBJECTS) $(mtp_files_LDADD) $(LIBS) -mtp-filetree$(EXEEXT): $(mtp_filetree_OBJECTS) $(mtp_filetree_DEPENDENCIES) $(EXTRA_mtp_filetree_DEPENDENCIES) - @rm -f mtp-filetree$(EXEEXT) - $(LINK) $(mtp_filetree_OBJECTS) $(mtp_filetree_LDADD) $(LIBS) -mtp-folders$(EXEEXT): $(mtp_folders_OBJECTS) $(mtp_folders_DEPENDENCIES) $(EXTRA_mtp_folders_DEPENDENCIES) - @rm -f mtp-folders$(EXEEXT) - $(LINK) $(mtp_folders_OBJECTS) $(mtp_folders_LDADD) $(LIBS) -mtp-format$(EXEEXT): $(mtp_format_OBJECTS) $(mtp_format_DEPENDENCIES) $(EXTRA_mtp_format_DEPENDENCIES) - @rm -f mtp-format$(EXEEXT) - $(LINK) $(mtp_format_OBJECTS) $(mtp_format_LDADD) $(LIBS) -mtp-reset$(EXEEXT): $(mtp_reset_OBJECTS) $(mtp_reset_DEPENDENCIES) $(EXTRA_mtp_reset_DEPENDENCIES) - @rm -f mtp-reset$(EXEEXT) - $(LINK) $(mtp_reset_OBJECTS) $(mtp_reset_LDADD) $(LIBS) -mtp-thumb$(EXEEXT): $(mtp_thumb_OBJECTS) $(mtp_thumb_DEPENDENCIES) $(EXTRA_mtp_thumb_DEPENDENCIES) - @rm -f mtp-thumb$(EXEEXT) - $(LINK) $(mtp_thumb_OBJECTS) $(mtp_thumb_LDADD) $(LIBS) -mtp-tracks$(EXEEXT): $(mtp_tracks_OBJECTS) $(mtp_tracks_DEPENDENCIES) $(EXTRA_mtp_tracks_DEPENDENCIES) - @rm -f mtp-tracks$(EXEEXT) - $(LINK) $(mtp_tracks_OBJECTS) $(mtp_tracks_LDADD) $(LIBS) -mtp-trexist$(EXEEXT): $(mtp_trexist_OBJECTS) $(mtp_trexist_DEPENDENCIES) $(EXTRA_mtp_trexist_DEPENDENCIES) - @rm -f mtp-trexist$(EXEEXT) - $(LINK) $(mtp_trexist_OBJECTS) $(mtp_trexist_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/albumart.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/albums.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delfile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/detect.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emptyfolders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/files.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filetree.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/folders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getfile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newfolder.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pathutils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendfile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendtr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thumb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tracks.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trexist.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-exec-hook -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: install-am install-exec-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-exec-hook \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS - - -install-exec-hook: - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-delfile$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-getfile$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-newfolder$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendfile$(EXEEXT) - ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendtr$(EXEEXT) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/chromium/third_party/libmtp/examples/albumart.c b/chromium/third_party/libmtp/examples/albumart.c deleted file mode 100644 index c98b305086d..00000000000 --- a/chromium/third_party/libmtp/examples/albumart.c +++ /dev/null @@ -1,171 +0,0 @@ -/** - * \file albumart.c - * Example program to send album art. - * - * Copyright (C) 2006 Andy Kelk <andy@mopoke.co.uk> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "config.h" -#include "common.h" -#include "string.h" -#include <stdlib.h> -#include <limits.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/stat.h> -#include <sys/types.h> -#ifdef HAVE_SYS_UIO_H -#include <sys/uio.h> -#endif - -static void usage(void) { - printf("Usage: albumart -d -i <fileid/trackid> -n <albumname> -s <storage_id> -p <parent_id> <imagefile>\n"); - exit(0); -} - -int main (int argc, char **argv) { - int opt; - extern int optind; - extern char *optarg; - LIBMTP_mtpdevice_t *device = NULL; - int idcount = 0; - int fd; - uint32_t *ids = NULL; - uint32_t *tmp = NULL; - uint64_t filesize; - char *imagedata = NULL; - char *albumname = NULL; - char *path = NULL; - char *rest; - struct stat statbuff; - uint32_t storageid = 0; - uint32_t parentid = 0; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - while ( (opt = getopt(argc, argv, "dhn:i:s:p:")) != -1 ) { - switch (opt) { - case 'h': - usage(); - case 'd': - LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); - break; - case 'i': - idcount++; - if ((tmp = realloc(ids, sizeof(uint32_t) * (idcount))) == NULL) { - printf("realloc failed\n"); - return 1; - } - ids = tmp; - ids[(idcount-1)] = strtoul(optarg, &rest, 0); - break; - case 'n': - albumname = strdup(optarg); - break; - case 's': - storageid = (uint32_t) strtoul(optarg, NULL, 0); - break; - case 'p': - parentid = (uint32_t) strtoul(optarg, NULL, 0); - break; - default: - usage(); - } - } - argc -= optind; - argv += optind; - - if ( argc != 1 ) { - printf("You need to pass a filename.\n"); - usage(); - } - - if ( albumname == NULL) { - printf("You need to supply an album name.\n"); - usage(); - } - - if (idcount == 0) { - printf("You need to supply one or more track IDs\n"); - usage(); - } - - path = argv[0]; - - if ( stat(path, &statbuff) == -1 ) { - fprintf(stderr, "%s: ", path); - perror("stat"); - exit(1); - } - filesize = (uint64_t) statbuff.st_size; - imagedata = malloc(filesize * sizeof(uint8_t)); - -#ifdef __WIN32__ - if ( (fd = open(path, O_RDONLY|O_BINARY) == -1) ) { -#else - if ( (fd = open(path, O_RDONLY)) == -1) { -#endif - printf("Couldn't open image file %s (%s)\n",path,strerror(errno)); - return 1; - } - else { - read(fd, imagedata, filesize); - close(fd); - } - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - return 0; - } - - LIBMTP_filesampledata_t *albumart = LIBMTP_new_filesampledata_t(); - albumart->data = imagedata; - albumart->size = filesize; - albumart->filetype = LIBMTP_FILETYPE_JPEG; - - LIBMTP_album_t *album = LIBMTP_new_album_t(); - album->name = albumname; - album->no_tracks = idcount; - album->tracks = ids; - album->parent_id = parentid; - album->storage_id = storageid; - int ret = LIBMTP_Create_New_Album(device,album); - if (ret == 0) { - ret = LIBMTP_Send_Representative_Sample(device,album->album_id, albumart); - if (ret != 0) { - printf("Couldn't send album art\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - } - else { - printf("Couldn't create album object\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - - LIBMTP_destroy_filesampledata_t(albumart); - LIBMTP_destroy_album_t(album); - - LIBMTP_Release_Device(device); - printf("OK.\n"); - return 0; -} - diff --git a/chromium/third_party/libmtp/examples/albums.c b/chromium/third_party/libmtp/examples/albums.c deleted file mode 100644 index 49054670e27..00000000000 --- a/chromium/third_party/libmtp/examples/albums.c +++ /dev/null @@ -1,114 +0,0 @@ -/** - * \file albums.c - * Example program that lists the albums on the device. - * - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> - -static void dump_albuminfo(LIBMTP_album_t *album) -{ - printf("Album ID: %d\n",album->album_id); - printf(" Parent ID: %d\n",album->parent_id); - printf(" Name: %s\n",album->name); - printf(" Artist: %s\n", album->artist); - printf(" Composer: %s\n", album->composer); - printf(" Genre: %s\n", album->genre); - printf(" Tracks: %d\n\n",album->no_tracks); -} - -int main (int argc, char *argv[]) { - LIBMTP_mtpdevice_t *device_list, *device; - - int opt; - extern int optind; - extern char *optarg; - - while ((opt = getopt(argc, argv, "d")) != -1 ) { - switch (opt) { - case 'd': - LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); - break; - } - } - - argc -= optind; - argv += optind; - - LIBMTP_Init(); - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - switch(LIBMTP_Get_Connected_Devices(&device_list)) - { - case LIBMTP_ERROR_NO_DEVICE_ATTACHED: - fprintf(stdout, "mtp-albums: No Devices have been found\n"); - return 0; - case LIBMTP_ERROR_CONNECTING: - fprintf(stderr, "mtp-albums: There has been an error connecting. Exit\n"); - return 1; - case LIBMTP_ERROR_MEMORY_ALLOCATION: - fprintf(stderr, "mtp-albums: Memory Allocation Error. Exit\n"); - return 1; - - /* Unknown general errors - This should never execute */ - case LIBMTP_ERROR_GENERAL: - default: - fprintf(stderr, "mtp-albums: Unknown error, please report " - "this to the libmtp developers\n"); - return 1; - - /* Successfully connected at least one device, so continue */ - case LIBMTP_ERROR_NONE: - fprintf(stdout, "mtp-albums: Successfully connected\n"); - fflush(stdout); - } - - /* iterate through connected MTP devices */ - for(device = device_list; device != NULL; device = device->next) - { - char *friendlyname; - LIBMTP_album_t *album_list, *album, *tmp; - - /* Echo the friendly name so we know which device we are working with */ - friendlyname = LIBMTP_Get_Friendlyname(device); - if (friendlyname == NULL) { - printf("Retrieving Albums on Device with name: (NULL)\n"); - } else { - printf("Retrieving Albums on Device with name: %s\n", friendlyname); - free(friendlyname); - } - - album_list = LIBMTP_Get_Album_List(device); - album = album_list; - while(album != NULL) - { - dump_albuminfo(album); - tmp = album; - album = album->next; - LIBMTP_destroy_album_t(tmp); - } - } - - LIBMTP_Release_Device_List(device_list); - printf("OK.\n"); - return 0; -} - diff --git a/chromium/third_party/libmtp/examples/common.h b/chromium/third_party/libmtp/examples/common.h deleted file mode 100644 index b39c44a1d59..00000000000 --- a/chromium/third_party/libmtp/examples/common.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * \file common.h - * These headers are used by absolutely all sample programs. - * Special quirks that apply to all samples go here. - * - * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include <libmtp.h> -#ifndef _MSC_VER -#include <config.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#else -#include <unistd.h> -#endif -#else -// Only if using MSVC... -#include "..\windows\getopt.h" -#endif diff --git a/chromium/third_party/libmtp/examples/connect.c b/chromium/third_party/libmtp/examples/connect.c deleted file mode 100644 index 6acfb8be1f1..00000000000 --- a/chromium/third_party/libmtp/examples/connect.c +++ /dev/null @@ -1,154 +0,0 @@ -/** - * \file connect.c - * Main programs implementing several utilities in one. - * - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * Copyright (C) 2008-2010 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include <stdlib.h> -#include <libgen.h> -#include <getopt.h> -#include <string.h> - -#include "common.h" -#include "util.h" -#include "pathutils.h" -#include "connect.h" - -LIBMTP_folder_t *folders; -LIBMTP_file_t *files; -LIBMTP_mtpdevice_t *device; - -static void -split_arg(char * argument, char ** part1, char ** part2) -{ - char *sepp; - *part1 = NULL; - *part2 = NULL; - - sepp = argument + strcspn(argument, ","); - sepp[0] = '\0'; - *part1 = argument; - *part2 = sepp+1; -} - -static void -usage(void) -{ - printf("Usage: connect <command1> <command2>\n"); - printf("Commands: --delete [filename]\n"); - printf(" --sendfile [source] [destination]\n"); - printf(" --sendtrack [source] [destination]\n"); - printf(" --getfile [source] [destination]\n"); - printf(" --newfolder [foldername]\n"); -} - - -int main (int argc, char **argv) -{ - int ret = 0; - - checklang(); - - LIBMTP_Init(); - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - return 0; - } - files = LIBMTP_Get_Filelisting_With_Callback (device, NULL, NULL); - folders = LIBMTP_Get_Folder_List (device); - - if ((strncmp(basename(argv[0]),"mtp-delfile",11) == 0) || (strncmp(basename(argv[0]),"delfile",7) == 0)) { - ret = delfile_command(argc,argv); - } else if ((strncmp(basename(argv[0]),"mtp-getfile",13) == 0) || (strncmp(basename(argv[0]),"getfile",9) == 0)) { - ret = getfile_command(argc,argv); - } else if ((strncmp(basename(argv[0]),"mtp-newfolder",13) == 0) || (strncmp(basename(argv[0]),"newfolder",9) == 0)) { - ret = newfolder_command(argc,argv); - } else if ((strncmp(basename(argv[0]),"mtp-sendfile",11) == 0) || (strncmp(basename(argv[0]),"sendfile",7) == 0)) { - ret = sendfile_command(argc, argv); - } else if ((strncmp(basename(argv[0]),"mtp-sendtr",10) == 0) || (strncmp(basename(argv[0]),"sendtr",6) == 0)) { - ret = sendtrack_command(argc, argv); - } else { - if ( argc < 2 ) { - usage (); - return 1; - } - - while (1) { - int option_index = 0; - static struct option long_options[] = { - {"delete", 1, 0, 'd'}, - {"sendfile", 1, 0, 'f'}, - {"getfile", 1, 0, 'g'}, - {"newfolder", 1, 0, 'n'}, - {"sendtrack", 1, 0, 't'}, - {0, 0, 0, 0} - }; - - int c = getopt_long (argc, argv, "d:f:g:n:t:", long_options, &option_index); - if (c == -1) - break; - - char *arg1, *arg2; - switch (c) { - case 'd': - printf("Delete %s\n",optarg); - ret = delfile_function(optarg); - break; - - case 'f': - printf("Send file %s\n",optarg); - split_arg(optarg,&arg1,&arg2); - ret = sendfile_function(arg1,arg2); - break; - - case 'g': - printf("Get file %s\n",optarg); - split_arg(optarg,&arg1,&arg2); - ret = getfile_function(arg1,arg2); - break; - - case 'n': - printf("New folder %s\n",optarg); - ret = newfolder_function(optarg); - break; - - case 't': - printf("Send track %s\n",optarg); - split_arg(optarg,&arg1,&arg2); - ret = sendtrack_function(arg1,arg2,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,0); - break; - } - } - - if (optind < argc) { - printf("Unknown options: "); - while (optind < argc) - printf("%s ", argv[optind++]); - printf("\n"); - } - } - - LIBMTP_Release_Device(device); - - return ret; -} diff --git a/chromium/third_party/libmtp/examples/connect.h b/chromium/third_party/libmtp/examples/connect.h deleted file mode 100644 index 5fe2cd3beb7..00000000000 --- a/chromium/third_party/libmtp/examples/connect.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * \file connect.h - * Header file for connect subfunctions - * - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * Copyright (C) 2008-2010 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -int delfile_function(char *); -int delfile_command(int, char **); -void delfile_usage(void); -int sendtrack_function (char *, char *, char *, char *, char *, char *, char *, char *, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t); -int sendtrack_command (int, char **); -void sendtrack_usage(void); -int sendfile_function(char *,char *); -int sendfile_command(int, char **); -void sendfile_usage(void); -int getfile_function(char *,char *); -int getfile_command(int, char **); -void getfile_usage(void); -int newfolder_function(char *); -int newfolder_command(int,char **); -void newfolder_usage(void); diff --git a/chromium/third_party/libmtp/examples/delfile.c b/chromium/third_party/libmtp/examples/delfile.c deleted file mode 100644 index 2ae2509da5c..00000000000 --- a/chromium/third_party/libmtp/examples/delfile.c +++ /dev/null @@ -1,114 +0,0 @@ -/** - * \file delfile.c - * Example program to delete a file off the device. - * - * Copyright (C) 2005-2008 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include <stdlib.h> -#include <limits.h> - -#include "common.h" -#include "string.h" -#include "pathutils.h" -#include "connect.h" - -extern LIBMTP_mtpdevice_t *device; -extern LIBMTP_folder_t *folders; -extern LIBMTP_file_t *files; - -void delfile_usage(void) -{ - printf("Usage: delfile [-n] <fileid/trackid> | -f <filename>\n"); -} - -int -delfile_function(char * path) -{ - 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; - ret = LIBMTP_Delete_Object(device, id); - if (ret != 0) { - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - printf("Failed to remove file\n"); - return 1; - } - } - return 0; -} - -int delfile_command(int argc, char **argv) -{ - int FILENAME = 1; - int ITEMID = 2; - int field_type = 0; - int i; - int ret = 0; - - if ( argc > 2 ) { - if (strncmp(argv[1],"-f",2) == 0) { - field_type = FILENAME; - strcpy(argv[1],""); - } else if (strncmp(argv[1],"-n",2) == 0) { - field_type = ITEMID; - strcpy(argv[1],"0"); - } else { - delfile_usage(); - return 0; - } - } else { - delfile_usage(); - return 0; - } - - for (i=1;i<argc;i++) { - uint32_t id; - char *endptr; - - if (field_type == ITEMID) { - // Sanity check song ID - id = strtoul(argv[i], &endptr, 10); - if ( *endptr != 0 ) { - fprintf(stderr, "illegal value %s .. skipping\n", argv[i]); - id = 0; - } - } else { - if (strlen(argv[i]) > 0) { - id = parse_path (argv[i],files,folders); - } else { - id = 0; - } - } - if (id > 0 ) { - printf("Deleting %s\n",argv[i]); - ret = LIBMTP_Delete_Object(device, id); - } - if ( ret != 0 ) { - printf("Failed to delete file:%s\n",argv[i]); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - ret = 1; - } - } - return ret; -} - diff --git a/chromium/third_party/libmtp/examples/detect.c b/chromium/third_party/libmtp/examples/detect.c deleted file mode 100644 index 92e43b8cbeb..00000000000 --- a/chromium/third_party/libmtp/examples/detect.c +++ /dev/null @@ -1,291 +0,0 @@ -/** - * \file detect.c - * Example program to detect a device and list capabilities. - * - * Copyright (C) 2005-2008 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include "util.h" -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#define XML_BUFSIZE 0x10000 - -static void dump_xml_fragment(uint8_t *buf, uint32_t len) -{ - static int endianness = 0; // 0 = LE, 1 = BE - uint32_t bp = 0; - - while (bp < len) { - if (buf[bp+0] == 0xFF && buf[bp+1] == 0xFE) { - endianness = 0; - } else if (buf[bp+0] == 0xFE && buf[bp+1] == 0xff) { - endianness = 1; - } else { - uint16_t tmp; - - if (endianness == 0) { - tmp = buf[bp+1] << 8 | buf[bp+0]; - } else { - tmp = buf[bp+0] << 8 | buf[bp+1]; - } - // Fix this some day, we only print ISO 8859-1 correctly here, - // should atleast support UTF-8. - printf("%c", (uint8_t) tmp); - } - bp += 2; - } - printf("\n"); -} - -int main (int argc, char **argv) -{ - LIBMTP_raw_device_t * rawdevices; - int numrawdevices; - LIBMTP_error_number_t err; - int i; - - int opt; - extern int optind; - extern char *optarg; - - while ((opt = getopt(argc, argv, "d")) != -1 ) { - switch (opt) { - case 'd': - LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); - break; - } - } - - argc -= optind; - argv += optind; - - LIBMTP_Init(); - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - fprintf(stdout, "Listing raw device(s)\n"); - err = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices); - switch(err) { - case LIBMTP_ERROR_NO_DEVICE_ATTACHED: - fprintf(stdout, " No raw devices found.\n"); - return 0; - case LIBMTP_ERROR_CONNECTING: - fprintf(stderr, "Detect: There has been an error connecting. Exiting\n"); - return 1; - case LIBMTP_ERROR_MEMORY_ALLOCATION: - fprintf(stderr, "Detect: Encountered a Memory Allocation Error. Exiting\n"); - return 1; - case LIBMTP_ERROR_NONE: - { - int i; - - fprintf(stdout, " Found %d device(s):\n", numrawdevices); - for (i = 0; i < numrawdevices; i++) { - if (rawdevices[i].device_entry.vendor != NULL || - rawdevices[i].device_entry.product != NULL) { - fprintf(stdout, " %s: %s (%04x:%04x) @ bus %d, dev %d\n", - rawdevices[i].device_entry.vendor, - rawdevices[i].device_entry.product, - rawdevices[i].device_entry.vendor_id, - rawdevices[i].device_entry.product_id, - rawdevices[i].bus_location, - rawdevices[i].devnum); - } else { - fprintf(stdout, " %04x:%04x @ bus %d, dev %d\n", - rawdevices[i].device_entry.vendor_id, - rawdevices[i].device_entry.product_id, - rawdevices[i].bus_location, - rawdevices[i].devnum); - } - } - } - break; - case LIBMTP_ERROR_GENERAL: - default: - fprintf(stderr, "Unknown connection error.\n"); - return 1; - } - - /* Iterate over connected MTP devices */ - fprintf(stdout, "Attempting to connect device(s)\n"); - for (i = 0; i < numrawdevices; i++) { - LIBMTP_mtpdevice_t *device; - LIBMTP_file_t *files; - char *friendlyname; - char *syncpartner; - char *sectime; - char *devcert; - uint16_t *filetypes; - uint16_t filetypes_len; - uint8_t maxbattlevel; - uint8_t currbattlevel; - int ret; - - device = LIBMTP_Open_Raw_Device(&rawdevices[i]); - if (device == NULL) { - fprintf(stderr, "Unable to open raw device %d\n", i); - continue; - } - - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - LIBMTP_Dump_Device_Info(device); - - printf("MTP-specific device properties:\n"); - // The friendly name - friendlyname = LIBMTP_Get_Friendlyname(device); - if (friendlyname == NULL) { - fprintf(stdout, " Friendly name: (NULL)\n"); - } else { - fprintf(stdout, " Friendly name: %s\n", friendlyname); - free(friendlyname); - } - syncpartner = LIBMTP_Get_Syncpartner(device); - if (syncpartner == NULL) { - fprintf(stdout, " Synchronization partner: (NULL)\n"); - } else { - fprintf(stdout, " Synchronization partner: %s\n", syncpartner); - free(syncpartner); - } - - // Some battery info - ret = LIBMTP_Get_Batterylevel(device, &maxbattlevel, &currbattlevel); - if (ret == 0) { - fprintf(stdout, " Battery level %d of %d (%d%%)\n",currbattlevel, maxbattlevel, - (int) ((float) currbattlevel/ (float) maxbattlevel * 100.0)); - } else { - // Silently ignore. Some devices does not support getting the - // battery level. - LIBMTP_Clear_Errorstack(device); - } - - ret = LIBMTP_Get_Supported_Filetypes(device, &filetypes, &filetypes_len); - if (ret == 0) { - uint16_t i; - - printf("libmtp supported (playable) filetypes:\n"); - for (i = 0; i < filetypes_len; i++) { - fprintf(stdout, " %s\n", LIBMTP_Get_Filetype_Description(filetypes[i])); - } - } else { - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - - // Secure time XML fragment - ret = LIBMTP_Get_Secure_Time(device, §ime); - if (ret == 0 && sectime != NULL) { - fprintf(stdout, "\nSecure Time:\n%s\n", sectime); - free(sectime); - } else { - // Silently ignore - there may be devices not supporting secure time. - LIBMTP_Clear_Errorstack(device); - } - - // Device certificate XML fragment -#if 0 - /* - * This code is currently disabled: all devices say that - * they support getting a device certificate but a lot of - * them obviously doesn't, instead they crash when you try - * to obtain it. - */ - ret = LIBMTP_Get_Device_Certificate(device, &devcert); - if (ret == 0 && devcert != NULL) { - fprintf(stdout, "\nDevice Certificate:\n%s\n", devcert); - free(devcert); - } else { - fprintf(stdout, "Unable to acquire device certificate, perhaps this device " - "does not support this\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } -#endif - - // Try to get Media player device info XML file... - files = LIBMTP_Get_Filelisting_With_Callback(device, NULL, NULL); - if (files != NULL) { - LIBMTP_file_t *file, *tmp; - file = files; - while (file != NULL) { - if (!strcmp(file->filename, "WMPInfo.xml") || - !strcmp(file->filename, "WMPinfo.xml") || - !strcmp(file->filename, "default-capabilities.xml")) { - if (file->item_id != 0) { - /* Dump this file */ - FILE *xmltmp = tmpfile(); - int tmpfiledescriptor = fileno(xmltmp); - - if (tmpfiledescriptor != -1) { - int ret = LIBMTP_Get_Track_To_File_Descriptor(device, - file->item_id, - tmpfiledescriptor, - NULL, - NULL); - if (ret == 0) { - uint8_t *buf = NULL; - uint32_t readbytes; - - buf = malloc(XML_BUFSIZE); - if (buf == NULL) { - printf("Could not allocate %08x bytes...\n", XML_BUFSIZE); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - free(rawdevices); - return 1; - } - - lseek(tmpfiledescriptor, 0, SEEK_SET); - readbytes = read(tmpfiledescriptor, (void*) buf, XML_BUFSIZE); - - if (readbytes >= 2 && readbytes < XML_BUFSIZE) { - fprintf(stdout, "\n%s file contents:\n", file->filename); - dump_xml_fragment(buf, readbytes); - } else { - perror("Unable to read file"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - free(buf); - } else { - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - fclose(xmltmp); - } - } - } - tmp = file; - file = file->next; - LIBMTP_destroy_file_t(tmp); - } - } - LIBMTP_Release_Device(device); - } /* End For Loop */ - - free(rawdevices); - - printf("OK.\n"); - - return 0; -} diff --git a/chromium/third_party/libmtp/examples/emptyfolders.c b/chromium/third_party/libmtp/examples/emptyfolders.c deleted file mode 100644 index 9cd7b496ebc..00000000000 --- a/chromium/third_party/libmtp/examples/emptyfolders.c +++ /dev/null @@ -1,112 +0,0 @@ -/** - * \file emptyfolders.c - * Example program that prunes empty folders. - * - * Copyright (C) 2006 Andy Kelk <andy@mopoke.co.uk> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> - -static void prune_empty_folders(LIBMTP_mtpdevice_t *device, LIBMTP_file_t *files, LIBMTP_folder_t *folderlist, int do_delete) -{ - if(folderlist==NULL) - return; - - if(folderlist->child == NULL) { // this *might* be empty - // therefore, check every file for this parent_id - int found = 0; - LIBMTP_file_t *file; - file = files; - while (file != NULL) { - if(file->parent_id == folderlist->folder_id) { // folder has a child - found = 1; - break; - } - file = file->next; - } - - if(found == 0) { // no files claim this as a parent - printf("empty folder %u (%s)\n",folderlist->folder_id,folderlist->name); - if(do_delete) { - if (LIBMTP_Delete_Object(device,folderlist->folder_id) != 0) { - printf("Couldn't delete folder %u\n",folderlist->folder_id); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - } - } - } - - prune_empty_folders(device,files,folderlist->child,do_delete); // recurse down - prune_empty_folders(device,files,folderlist->sibling,do_delete); // recurse along -} - -int main (int argc, char **argv) -{ - // check if we're doing a dummy run - int do_delete = 0; - int opt; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - while ( (opt = getopt(argc, argv, "d")) != -1 ) { - switch (opt) { - case 'd': - do_delete = 1; - break; - default: - break; - } - } - - if(do_delete == 0) { - printf("This is a dummy run. No folders will be deleted.\n"); - printf("To delete folders, use the '-d' option.\n"); - } - - LIBMTP_mtpdevice_t *device; - LIBMTP_folder_t *folders; - LIBMTP_file_t *files; - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - exit (0); - } - - // Get file listing. - files = LIBMTP_Get_Filelisting_With_Callback(device,NULL,NULL); - - // Get folder listing. - folders = LIBMTP_Get_Folder_List(device); - - if(folders == NULL) { - printf("No folders found\n"); - } else { - prune_empty_folders(device,files,folders,do_delete); - } - - LIBMTP_destroy_folder_t(folders); - LIBMTP_destroy_file_t(files); - - LIBMTP_Release_Device(device); - printf("OK.\n"); - exit (0); -} - diff --git a/chromium/third_party/libmtp/examples/evolution-sync.sh b/chromium/third_party/libmtp/examples/evolution-sync.sh deleted file mode 100755 index 0c54a32ea95..00000000000 --- a/chromium/third_party/libmtp/examples/evolution-sync.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2006 Linus Walleij <triad@df.lth.se> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# Example evolution synchronization script by Nicolas Tetreault, -# modified by Linus Walleij. - -# Define target files -SYNC_HOME=$HOME/MTP_device_sync - -# Define tool locations -SENDFILE=`which mtp-sendfile` -# SENDFILE="$HOME/comp-apps/bin/sendfile" -#EADDEXP=`which evolution-addressbook-export` -# This is the location in Fedora Core 5: -EADDEXP="/usr/libexec/evolution/2.6/evolution-addressbook-export" - -# You need to change the name of the files -# that contains the calendar and contacts on your device. -# You can find out by starting Gnomad2, choose the data transfer -# tab, sort by size (it should be small files, extension .ics and .vcf) -# On my Zen Microphoto, the calendar and contacts files are called -# 6651416 with the ics and vcf extensions, respectively. -CALENDAR_FILE="6651416.ics" -CONTACTS_FILE="6651416.vcf" - -# The evolution address book. To list your addressbooks, type: -# evolution-addressbook-export -l -# the output for me: -# "file:///home/nt271/.evolution/addressbook/local/system -# ","Personal",26 -# "file:///home/nt271/.evolution/addressbook/local/1158600180.5386.0@sierra" -# ,"MicroPhoto",24 -# I only want the Microphoto addressbook and the output will be -# $SYNC_HOME/contacts/Evolution_contacts.vcf -EVOLUTION_CONTACTS="file:///home/linus/.evolution/addressbook/local/system" - -# Check for sync dir, create it if needed - -if test -d $SYNC_HOME ; then - echo "$SYNC_HOME exists, OK." -else - echo "$SYNC_HOME must first be created..." - mkdir $SYNC_HOME - # This is a working dir for contact merging, you can put - # in some extra .vcf files here as well if you like. - mkdir $SYNC_HOME/contacts - # Here you can place some extra calendars to be sync:ed, you - # can put in some extra .ics files of any kind here. - mkdir $SYNC_HOME/calendars -fi - -# Check for prerequisites - -if test -f $EADDEXP ; then - echo "evolution-addressbook-export present in $EADDEXP, OK." -else - echo "Cannot locate evolution-addressbook-export!!" - exit 0 -fi - - -# Next line merges all of your tasklist, your personal calendar, -# and then any saved to disk calendar you have placed in -# $SYNC_HOME/calendars - -cat $HOME/.evolution/tasks/local/system/tasks.ics \ - $HOME/.evolution/calendar/local/system/calendar.ics \ - $SYNC_HOME/calendars/*.ics > $SYNC_HOME/$CALENDAR_FILE - -# Use evolution-addressbook-export (installed with Evolution) to -# export your contacts to vcard. - -$EADDEXP --format=vcard \ - --output=$SYNC_HOME/contacts/Evolution_contacts.vcf \ - $EVOLUTION_CONTACTS - -# Repeat for each addressbook you want to upload. - -# The next command will then merge all the contact lists - -cat $SYNC_HOME/contacts/*.vcf > $SYNC_HOME/$CONTACTS_FILE - -# The calendar and contacts files now need to be converted from unix -# to DOS linefeeds (CR+LF instead of just LF) - -unix2dos $SYNC_HOME/$CALENDAR_FILE $SYNC_HOME/$CONTACTS_FILE - -# You can now upload the ics and vcf files to you My Organizer folder -# on your device. Change the path to your sendfile command. -# Sending the vcf file is only supported in CVS version at this time - -$SENDFILE -f "My Organizer" -t ics $SYNC_HOME/$CALENDAR_FILE -$SENDFILE -f "My Organizer" -t vcf $SYNC_HOME/$CONTACTS_FILE - diff --git a/chromium/third_party/libmtp/examples/files.c b/chromium/third_party/libmtp/examples/files.c deleted file mode 100644 index 11b0c0449b8..00000000000 --- a/chromium/third_party/libmtp/examples/files.c +++ /dev/null @@ -1,118 +0,0 @@ -/** - * \file files.c - * Example program that lists all files on a device. - * - * Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> - -static void dump_fileinfo(LIBMTP_file_t *file) -{ - printf("File ID: %u\n", file->item_id); - if (file->filename != NULL) - printf(" Filename: %s\n", file->filename); - - // This is sort of special... - if (file->filesize == (uint32_t) -1) { - printf(" None. (abstract file, size = -1)\n"); - } else { -#ifdef __WIN32__ - printf(" File size %llu (0x%016I64X) bytes\n", file->filesize, file->filesize); -#else - printf(" File size %llu (0x%016llX) bytes\n", - (long long unsigned int) file->filesize, - (long long unsigned int) file->filesize); -#endif - } - printf(" Parent ID: %u\n", file->parent_id); - printf(" Storage ID: 0x%08X\n", file->storage_id); - printf(" Filetype: %s\n", LIBMTP_Get_Filetype_Description(file->filetype)); -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device_list, *device; - LIBMTP_file_t *files; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - LIBMTP_Init(); - - switch(LIBMTP_Get_Connected_Devices(&device_list)) - { - case LIBMTP_ERROR_NO_DEVICE_ATTACHED: - fprintf(stdout, "mtp-files: No Devices have been found\n"); - return 0; - case LIBMTP_ERROR_CONNECTING: - fprintf(stderr, "mtp-files: There has been an error connecting. Exit\n"); - return 1; - case LIBMTP_ERROR_MEMORY_ALLOCATION: - fprintf(stderr, "mtp-files: Memory Allocation Error. Exit\n"); - return 1; - - /* Unknown general errors - This should never execute */ - case LIBMTP_ERROR_GENERAL: - default: - fprintf(stderr, "mtp-files: Unknown error, please report " - "this to the libmtp developers\n"); - return 1; - - /* Successfully connected at least one device, so continue */ - case LIBMTP_ERROR_NONE: - fprintf(stdout, "mtp-files: Successfully connected\n"); - fflush(stdout); - } - - /* iterate through connected MTP devices */ - for(device = device_list; device != NULL; device = device->next) - { - char *friendlyname; - - /* Echo the friendly name so we know which device we are working with */ - friendlyname = LIBMTP_Get_Friendlyname(device); - if (friendlyname == NULL) { - printf("Listing File Information on Device with name: (NULL)\n"); - } else { - printf("Listing File Information on Device with name: %s\n", friendlyname); - free(friendlyname); - } - - /* Get track listing. */ - files = LIBMTP_Get_Filelisting_With_Callback(device, NULL, NULL); - if (files == NULL) { - printf("No files.\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } else { - LIBMTP_file_t *file, *tmp; - file = files; - while (file != NULL) { - dump_fileinfo(file); - tmp = file; - file = file->next; - LIBMTP_destroy_file_t(tmp); - } - } - } - - LIBMTP_Release_Device_List(device_list); - printf("OK.\n"); - exit (0); -} diff --git a/chromium/third_party/libmtp/examples/filetree.c b/chromium/third_party/libmtp/examples/filetree.c deleted file mode 100644 index 6d6ed81905f..00000000000 --- a/chromium/third_party/libmtp/examples/filetree.c +++ /dev/null @@ -1,156 +0,0 @@ -/** - * \file filetree.c - * List all files and folders of all storages recursively - * - * Copyright (C) 2011 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include "util.h" -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> - -/* Clever prototype to be able to recurse */ -void recursive_file_tree(LIBMTP_mtpdevice_t *, - LIBMTP_devicestorage_t *, - uint32_t, - int); - -void recursive_file_tree(LIBMTP_mtpdevice_t *device, - LIBMTP_devicestorage_t *storage, - uint32_t leaf, - int depth) -{ - LIBMTP_file_t *files; - LIBMTP_file_t *file; - - files = LIBMTP_Get_Files_And_Folders(device, - storage->id, - leaf); - if (files == NULL) { - return; - } - - /* Iterate over the filelisting */ - for (file = files; file != NULL; file = file->next) { - int i; - - /* Indent */ - for (i = 0; i < depth; i++) { - printf(" "); - } - printf("%u %s\n", file->item_id, file->filename); - if (file->filetype == LIBMTP_FILETYPE_FOLDER) { - recursive_file_tree(device, storage, file->item_id, depth+2); - } - } -} - -int main (int argc, char **argv) -{ - LIBMTP_raw_device_t * rawdevices; - int numrawdevices; - LIBMTP_error_number_t err; - int i; - - int opt; - extern int optind; - extern char *optarg; - - while ((opt = getopt(argc, argv, "d")) != -1 ) { - switch (opt) { - case 'd': - LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); - break; - } - } - - argc -= optind; - argv += optind; - - LIBMTP_Init(); - - err = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices); - switch(err) { - case LIBMTP_ERROR_NO_DEVICE_ATTACHED: - fprintf(stdout, " No raw devices found.\n"); - return 0; - case LIBMTP_ERROR_CONNECTING: - fprintf(stderr, "Detect: There has been an error connecting. Exiting\n"); - return 1; - case LIBMTP_ERROR_MEMORY_ALLOCATION: - fprintf(stderr, "Detect: Encountered a Memory Allocation Error. Exiting\n"); - return 1; - case LIBMTP_ERROR_NONE: - break; - case LIBMTP_ERROR_GENERAL: - default: - fprintf(stderr, "Unknown connection error.\n"); - return 1; - } - - /* Iterate over connected MTP devices */ - fprintf(stdout, "Attempting to connect device(s)\n"); - for (i = 0; i < numrawdevices; i++) { - LIBMTP_mtpdevice_t *device; - LIBMTP_devicestorage_t *storage; - char *friendlyname; - int ret; - - device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]); - if (device == NULL) { - fprintf(stderr, "Unable to open raw device %d\n", i); - continue; - } - - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - - friendlyname = LIBMTP_Get_Friendlyname(device); - if (friendlyname == NULL) { - printf("Device: (NULL)\n"); - } else { - printf("Device: %s\n", friendlyname); - free(friendlyname); - } - - /* Get all storages for this device */ - ret = LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED); - if (ret != 0) { - perror("LIBMTP_Get_Storage()"); - goto bailout; - } - - /* Loop over storages */ - for (storage = device->storage; storage != 0; storage = storage->next) { - fprintf(stdout, "Storage: %s\n", storage->StorageDescription); - recursive_file_tree(device, storage, 0, 0); - } - - bailout: - LIBMTP_Release_Device(device); - } /* End For Loop */ - - free(rawdevices); - - printf("OK.\n"); - - return 0; -} diff --git a/chromium/third_party/libmtp/examples/folders.c b/chromium/third_party/libmtp/examples/folders.c deleted file mode 100644 index f139343474d..00000000000 --- a/chromium/third_party/libmtp/examples/folders.c +++ /dev/null @@ -1,123 +0,0 @@ -/** - * \file folders.c - * Example program that lists all folders on a device. - * - * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> - -static void dump_folder_list(LIBMTP_folder_t *folderlist, int level) -{ - int i; - if(folderlist==NULL) { - return; - } - - printf("%u\t", folderlist->folder_id); - for(i=0;i<level;i++) printf(" "); - - printf("%s\n", folderlist->name); - - dump_folder_list(folderlist->child, level+1); - dump_folder_list(folderlist->sibling, level); -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device_list, *device; - - LIBMTP_Init(); - printf("Attempting to connect device(s)\n"); - - switch(LIBMTP_Get_Connected_Devices(&device_list)) - { - case LIBMTP_ERROR_NO_DEVICE_ATTACHED: - printf("mtp-folders: no devices found\n"); - return 0; - case LIBMTP_ERROR_CONNECTING: - fprintf(stderr, "mtp-folders: There has been an error connecting. Exit\n"); - return 1; - case LIBMTP_ERROR_MEMORY_ALLOCATION: - fprintf(stderr, "mtp-folders: Memory Allocation Error. Exit\n"); - return 1; - - /* Unknown general errors - This should never execute */ - case LIBMTP_ERROR_GENERAL: - default: - fprintf(stderr, "mtp-folders: Unknown error, please report " - "this to the libmtp developers\n"); - return 1; - - /* Successfully connected at least one device, so continue */ - case LIBMTP_ERROR_NONE: - printf("mtp-folders: Successfully connected\n"); - } - - /* iterate through connected MTP devices */ - for(device = device_list; device != NULL; device = device->next) - { - LIBMTP_devicestorage_t *storage; - char *friendlyname; - int ret; - - /* Echo the friendly name so we know which device we are working with */ - friendlyname = LIBMTP_Get_Friendlyname(device); - if (friendlyname == NULL) { - printf("Friendly name: (NULL)\n"); - } else { - printf("Friendly name: %s\n", friendlyname); - free(friendlyname); - } - - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - - /* Get all storages for this device */ - ret = LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED); - if (ret != 0) { - perror("LIBMTP_Get_Storage()\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - continue; - } - - /* Loop over storages, dump folder for each one */ - for (storage = device->storage; storage != 0; storage = storage->next) { - LIBMTP_folder_t *folders; - - printf("Storage: %s\n", storage->StorageDescription); - folders = LIBMTP_Get_Folder_List_For_Storage(device, storage->id); - - if (folders == NULL) { - fprintf(stdout, "No folders found\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } else { - dump_folder_list(folders,0); - } - LIBMTP_destroy_folder_t(folders); - } - } - - LIBMTP_Release_Device_List(device_list); - printf("OK.\n"); - - return 0; -} diff --git a/chromium/third_party/libmtp/examples/format.c b/chromium/third_party/libmtp/examples/format.c deleted file mode 100644 index 52608a9c3e3..00000000000 --- a/chromium/third_party/libmtp/examples/format.c +++ /dev/null @@ -1,86 +0,0 @@ -/** - * \file format.c - * Example program that formats the device storage. - * - * Copyright (C) 2006-2007 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" - -/** - * Returns 0 if OK (yes), 1 if not OK (no) - */ -static int prompt() -{ - char buff[2]; - - while (1) { - fprintf(stdout, "> "); - if ( fgets(buff, sizeof(buff), stdin) == NULL ) { - if (ferror(stdin)) { - fprintf(stderr, "File error on stdin\n"); - } else { - fprintf(stderr, "EOF on stdin\n"); - } - return 1; - } - if (buff[0] == 'y') { - return 0; - } else if (buff[0] == 'n') { - return 1; - } - } -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device; - int ret; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - return 0; - } - - printf("I will now format your device. This means that\n"); - printf("all content (and licenses) will be lost forever.\n"); - printf("you will not be able to undo this operation.\n"); - printf("Continue? (y/n)\n"); - if (prompt() == 0) { - // This will just format the first storage. - ret = LIBMTP_Format_Storage(device, device->storage); - } else { - printf("Aborted.\n"); - ret = 0; - } - - if ( ret != 0 ) { - printf("Failed to format device.\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - LIBMTP_Release_Device(device); - return 1; - } - - LIBMTP_Release_Device(device); - printf("OK.\n"); - return 0; -} diff --git a/chromium/third_party/libmtp/examples/getfile.c b/chromium/third_party/libmtp/examples/getfile.c deleted file mode 100644 index 4562f871635..00000000000 --- a/chromium/third_party/libmtp/examples/getfile.c +++ /dev/null @@ -1,92 +0,0 @@ -/** - * \file getfile.c - * Example program to retrieve a file off the device. - * - * Copyright (C) 2005-2007 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include <stdlib.h> -#include <limits.h> - -#include "common.h" -#include "pathutils.h" -#include "connect.h" - -extern LIBMTP_folder_t *folders; -extern LIBMTP_file_t *files; -extern LIBMTP_mtpdevice_t *device; - -void getfile_usage (void) -{ - fprintf(stderr, "getfile <fileid/trackid> <filename>\n"); -} - -int -getfile_function(char * from_path,char * to_path) -{ - int id = parse_path (from_path,files,folders); - if (id > 0) { - printf("Getting %s to %s\n",from_path,to_path); - if (LIBMTP_Get_File_To_File(device, id, to_path, progress, NULL) != 0 ) { - printf("\nError getting file from MTP device.\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - return 1; - } - } - return 0; -} - - -int getfile_command(int argc, char **argv) -{ - uint32_t id; - char *endptr; - char *file; - int ret = 0; - - // We need file ID and filename - if ( argc != 3 ) { - getfile_usage(); - return 0; - } - - // Sanity check song ID - id = strtoul(argv[1], &endptr, 10); - if ( *endptr != 0 ) { - fprintf(stderr, "illegal value %s\n", argv[1]); - return 1; - } else if ( ! id ) { - fprintf(stderr, "bad file/track id %u\n", id); - return 1; - } - - // Filename, e.g. "foo.mp3" - file = argv[2]; - printf("Getting file/track %d to local file %s\n", id, file); - - // This function will also work just as well for tracks. - if (LIBMTP_Get_File_To_File(device, id, file, progress, NULL) != 0 ) { - printf("\nError getting file from MTP device.\n"); - ret = 1; - } - // Terminate progress bar. - printf("\n"); - - return ret; -} diff --git a/chromium/third_party/libmtp/examples/getplaylist.c b/chromium/third_party/libmtp/examples/getplaylist.c deleted file mode 100644 index cc9c4cac549..00000000000 --- a/chromium/third_party/libmtp/examples/getplaylist.c +++ /dev/null @@ -1,93 +0,0 @@ -/** - * \file getplaylist.c - * Example program that lists the abstract playlists on the device. - * - * Copyright (C) 2005-2007 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> -#include <limits.h> - -static uint32_t dump_playlist(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t *pl) -{ - uint32_t i; - - printf("Number of items: %u\n", pl->no_tracks); - if(pl->no_tracks > 0) { - for(i=0;i<pl->no_tracks;i++) { - LIBMTP_track_t *track; - - track = LIBMTP_Get_Trackmetadata(device, pl->tracks[i]); - if (track != NULL) { - printf(" %u: %s - %s\n", pl->tracks[i], track->artist, track->title); - LIBMTP_destroy_track_t(track); - } else { - printf(" %u: INVALID TRACK REFERENCE!\n", pl->tracks[i]); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - } - } - return 0; -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device; - LIBMTP_playlist_t *playlist; - uint32_t id; - char *endptr; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - // We need file ID - if ( argc != 2 ) { - fprintf(stderr, "Just a playlist ID is required\n"); - return 1; - } - - // Sanity check playlist ID - id = strtoul(argv[1], &endptr, 10); - if ( *endptr != 0 ) { - fprintf(stderr, "illegal value %s\n", argv[1]); - return 1; - } else if ( ! id ) { - fprintf(stderr, "bad playlist id %u\n", id); - return 1; - } - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices. Connect/replug device and try again.\n"); - exit (0); - } - - playlist = LIBMTP_Get_Playlist(device,id); - - if (playlist != NULL) { - dump_playlist(device,playlist); - } - - LIBMTP_destroy_playlist_t(playlist); - - LIBMTP_Release_Device(device); - printf("OK.\n"); - exit (0); -} - diff --git a/chromium/third_party/libmtp/examples/newfolder.c b/chromium/third_party/libmtp/examples/newfolder.c deleted file mode 100644 index 70ea68411d1..00000000000 --- a/chromium/third_party/libmtp/examples/newfolder.c +++ /dev/null @@ -1,73 +0,0 @@ -/** - * \file newfolder.c - * Example program to create a folder on the device. - * - * Copyright (C) 2006-2009 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include <stdlib.h> -#include <libgen.h> - -#include "common.h" -#include "pathutils.h" -#include "connect.h" - -extern LIBMTP_folder_t *folders; -extern LIBMTP_file_t *files; -extern LIBMTP_mtpdevice_t *device; - -int newfolder_command (int argc, char **argv) -{ - uint32_t newid; - - if(argc != 4) { - printf("Usage: newfolder name <parent> <storage>\n"); - printf(" parent = parent folder or 0 to create the new folder in the root dir\n"); - printf(" storage = storage id or 0 to create the new folder on the primary storage\n"); - return 0; - } - - newid = LIBMTP_Create_Folder(device, argv[1], atol(argv[2]), atol(argv[3])); - if (newid == 0) { - printf("Folder creation failed.\n"); - return 1; - } else { - printf("New folder created with ID: %d\n", newid); - } - return 0; -} - -int -newfolder_function(char * path) -{ - printf("Creating new folder %s\n",path); - char * parent = dirname(path); - char * folder = basename(path); - int id = parse_path (parent,files,folders); - int newid = LIBMTP_Create_Folder(device, folder, id, 0); - if (newid == 0) { - printf("Folder creation failed.\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - return 1; - } else { - printf("New folder created with ID: %d\n", newid); - } - return 0; -} - diff --git a/chromium/third_party/libmtp/examples/newplaylist.c b/chromium/third_party/libmtp/examples/newplaylist.c deleted file mode 100644 index 9f47ae56013..00000000000 --- a/chromium/third_party/libmtp/examples/newplaylist.c +++ /dev/null @@ -1,117 +0,0 @@ -/** - * \file newplaylist.c - * Example program to create a playlist on a device. - * - * Copyright (C) 2006 Robert Reardon <rreardon@monkshatch.vispa.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include "string.h" -#include <stdlib.h> -#include <limits.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> - -static void usage(void) { - printf("Usage: newplaylist -i <fileid/trackid> -n <playlistname> -s <storage_id> -p <parent_id>\n"); - exit(0); -} - -int main (int argc, char **argv) { - int opt; - extern int optind; - extern char *optarg; - LIBMTP_mtpdevice_t *device = NULL; - int idcount = 0; - uint32_t *ids = NULL; - uint32_t *tmp = NULL; - char *playlistname = NULL; - char *rest; - uint32_t storageid = 0; - uint32_t parentid = 0; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - while ( (opt = getopt(argc, argv, "hn:i:s:p:")) != -1 ) { - switch (opt) { - case 'h': - usage(); - case 'i': - idcount++; - if ((tmp = realloc(ids, sizeof(uint32_t) * (idcount))) == NULL) { - printf("realloc failed\n"); - return 1; - } - ids = tmp; - ids[(idcount-1)] = strtoul(optarg, &rest, 0); - break; - case 'n': - playlistname = strdup(optarg); - break; - case 's': - storageid = (uint32_t) strtoul(optarg, NULL, 0); - break; - case 'p': - parentid = (uint32_t) strtoul(optarg, NULL, 0); - break; - default: - usage(); - } - } - argc -= optind; - argv += optind; - - if ( playlistname == NULL) { - printf("You need to supply a playlist name.\n"); - usage(); - } - - if (idcount == 0) { - printf("You need to supply one or more track IDs\n"); - usage(); - } - - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - return 0; - } - - LIBMTP_playlist_t *playlist = LIBMTP_new_playlist_t(); - playlist->name = playlistname; - playlist->no_tracks = idcount; - playlist->tracks = ids; - playlist->parent_id = parentid; - playlist->storage_id = storageid; - int ret = LIBMTP_Create_New_Playlist(device,playlist); - if (ret != 0) { - printf("Couldn't create playlist object\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - else { - printf("Created new playlist: %u\n", playlist->playlist_id); - } - - LIBMTP_Release_Device(device); - printf("OK.\n"); - return 0; -} - diff --git a/chromium/third_party/libmtp/examples/pathutils.c b/chromium/third_party/libmtp/examples/pathutils.c deleted file mode 100644 index 419a54373f2..00000000000 --- a/chromium/third_party/libmtp/examples/pathutils.c +++ /dev/null @@ -1,238 +0,0 @@ -/** - * \file pathutils.c - * - * Copyright (C) 2005-2008 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include "pathutils.h" -#include <stdlib.h> -#include <limits.h> -#include <string.h> -#include <libgen.h> - -/* Find the folder_id of a given path - * Runs by walking through folders structure */ -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; - - if (folder == NULL) { - return ret; - } - - current = malloc (strlen(parent) + strlen(folder->name) + 2); - sprintf(current,"%s/%s",parent,folder->name); - if (strcasecmp (path, current) == 0) { - free (current); - return folder->folder_id; - } - if (strncasecmp (path, current, strlen (current)) == 0) { - ret = lookup_folder_id (folder->child, path, current); - } - free (current); - if (ret != (uint32_t) (-1)) { - return ret; - } - ret = lookup_folder_id (folder->sibling, path, parent); - return ret; -} - -/* Parses a string to find item_id */ -int -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 != '/') { - 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 - 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); - 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) { - free(dirc); - free(basec); - return file->item_id; - } - } - file = file->next; - } - free(dirc); - free(basec); - } else { - return item_id; - } - - return -1; -} - -int progress (const uint64_t sent, const uint64_t total, void const * const data) -{ - int percent = (sent*100)/total; -#ifdef __WIN32__ - printf("Progress: %I64u of %I64u (%d%%)\r", sent, total, percent); -#else - printf("Progress: %llu of %llu (%d%%)\r", sent, total, percent); -#endif - fflush(stdout); - return 0; -} - -/* Find the file type based on extension */ -LIBMTP_filetype_t -find_filetype (const char * filename) -{ - char *ptype; - LIBMTP_filetype_t filetype; - -#ifdef __WIN32__ - ptype = strrchr(filename, '.'); -#else - ptype = rindex(filename,'.'); -#endif - // 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; - } else if (!strcasecmp (ptype, "mp3")) { - filetype = LIBMTP_FILETYPE_MP3; - } else if (!strcasecmp (ptype, "wma")) { - filetype = LIBMTP_FILETYPE_WMA; - } else if (!strcasecmp (ptype, "ogg")) { - filetype = LIBMTP_FILETYPE_OGG; - } else if (!strcasecmp (ptype, "mp4")) { - filetype = LIBMTP_FILETYPE_MP4; - } else if (!strcasecmp (ptype, "wmv")) { - filetype = LIBMTP_FILETYPE_WMV; - } else if (!strcasecmp (ptype, "avi")) { - filetype = LIBMTP_FILETYPE_AVI; - } else if (!strcasecmp (ptype, "mpeg") || !strcasecmp (ptype, "mpg")) { - filetype = LIBMTP_FILETYPE_MPEG; - } else if (!strcasecmp (ptype, "asf")) { - filetype = LIBMTP_FILETYPE_ASF; - } else if (!strcasecmp (ptype, "qt") || !strcasecmp (ptype, "mov")) { - filetype = LIBMTP_FILETYPE_QT; - } else if (!strcasecmp (ptype, "wma")) { - filetype = LIBMTP_FILETYPE_WMA; - } else if (!strcasecmp (ptype, "jpg") || !strcasecmp (ptype, "jpeg")) { - filetype = LIBMTP_FILETYPE_JPEG; - } else if (!strcasecmp (ptype, "jfif")) { - filetype = LIBMTP_FILETYPE_JFIF; - } else if (!strcasecmp (ptype, "tif") || !strcasecmp (ptype, "tiff")) { - filetype = LIBMTP_FILETYPE_TIFF; - } else if (!strcasecmp (ptype, "bmp")) { - filetype = LIBMTP_FILETYPE_BMP; - } else if (!strcasecmp (ptype, "gif")) { - filetype = LIBMTP_FILETYPE_GIF; - } else if (!strcasecmp (ptype, "pic") || !strcasecmp (ptype, "pict")) { - filetype = LIBMTP_FILETYPE_PICT; - } else if (!strcasecmp (ptype, "png")) { - filetype = LIBMTP_FILETYPE_PNG; - } else if (!strcasecmp (ptype, "wmf")) { - filetype = LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT; - } else if (!strcasecmp (ptype, "ics")) { - filetype = LIBMTP_FILETYPE_VCALENDAR2; - } else if (!strcasecmp (ptype, "exe") || !strcasecmp (ptype, "com") || - !strcasecmp (ptype, "bat") || !strcasecmp (ptype, "dll") || - !strcasecmp (ptype, "sys")) { - filetype = LIBMTP_FILETYPE_WINEXEC; - } else if (!strcasecmp (ptype, "aac")) { - filetype = LIBMTP_FILETYPE_AAC; - } else if (!strcasecmp (ptype, "mp2")) { - filetype = LIBMTP_FILETYPE_MP2; - } else if (!strcasecmp (ptype, "flac")) { - filetype = LIBMTP_FILETYPE_FLAC; - } else if (!strcasecmp (ptype, "m4a")) { - filetype = LIBMTP_FILETYPE_M4A; - } else if (!strcasecmp (ptype, "doc")) { - filetype = LIBMTP_FILETYPE_DOC; - } else if (!strcasecmp (ptype, "xml")) { - filetype = LIBMTP_FILETYPE_XML; - } else if (!strcasecmp (ptype, "xls")) { - filetype = LIBMTP_FILETYPE_XLS; - } else if (!strcasecmp (ptype, "ppt")) { - filetype = LIBMTP_FILETYPE_PPT; - } else if (!strcasecmp (ptype, "mht")) { - filetype = LIBMTP_FILETYPE_MHT; - } else if (!strcasecmp (ptype, "jp2")) { - filetype = LIBMTP_FILETYPE_JP2; - } else if (!strcasecmp (ptype, "jpx")) { - filetype = LIBMTP_FILETYPE_JPX; - } else if (!strcasecmp (ptype, "bin")) { - filetype = LIBMTP_FILETYPE_FIRMWARE; - } else if (!strcasecmp (ptype, "vcf")) { - filetype = LIBMTP_FILETYPE_VCARD3; - } else { - /* Tagging as unknown file type */ - filetype = LIBMTP_FILETYPE_UNKNOWN; - } - printf("type: %s, %d\n", ptype, filetype); - return filetype; -} - -/* Function that compensate for missing libgen.h on Windows */ -#ifndef HAVE_LIBGEN_H -static char *basename(char *in) { - char *p; - - if (in == NULL) - return NULL; - p = in + strlen(in) - 1; - while (*p != '\\' && *p != '/' && *p != ':') - { p--; } - return ++p; -} -#endif diff --git a/chromium/third_party/libmtp/examples/pathutils.h b/chromium/third_party/libmtp/examples/pathutils.h deleted file mode 100644 index f40b6d6a68d..00000000000 --- a/chromium/third_party/libmtp/examples/pathutils.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * \file pathutils.h - * - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef PATHUTILS_H_INCLUSION_GUARD -#define PATHUTILS_H_INCLUSION_GUARD -int parse_path (char *, LIBMTP_file_t *, LIBMTP_folder_t *); -LIBMTP_filetype_t find_filetype (const char *); -int progress (const uint64_t, const uint64_t, void const * const); -#ifndef HAVE_LIBGEN_H -char *basename(char *in); -#endif -#endif diff --git a/chromium/third_party/libmtp/examples/playlists.c b/chromium/third_party/libmtp/examples/playlists.c deleted file mode 100644 index 1416c619666..00000000000 --- a/chromium/third_party/libmtp/examples/playlists.c +++ /dev/null @@ -1,82 +0,0 @@ -/** - * \file playlists.c - * Example program to list the playlists on a device. - * - * Copyright (C) 2005-2007 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> - -static void dump_plinfo(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t *pl) -{ - uint32_t i; - - printf("Playlist ID: %d\n", pl->playlist_id); - if (pl->name != NULL) - printf(" Name: %s\n", pl->name); - printf(" Parent ID: %d\n", pl->parent_id); - printf(" Tracks:\n"); - - for (i = 0; i < pl->no_tracks; i++) { - LIBMTP_track_t *track; - - track = LIBMTP_Get_Trackmetadata(device, pl->tracks[i]); - if (track != NULL) { - printf(" %u: %s - %s\n", pl->tracks[i], track->artist, track->title); - LIBMTP_destroy_track_t(track); - } else { - printf(" %u: INVALID TRACK REFERENCE!\n", pl->tracks[i]); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - } -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device; - LIBMTP_playlist_t *playlists; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - exit (0); - } - - // Get playlist listing. - playlists = LIBMTP_Get_Playlist_List(device); - if (playlists == NULL) { - printf("No playlists.\n"); - } else { - LIBMTP_playlist_t *pl, *tmp; - pl = playlists; - while (pl != NULL) { - dump_plinfo(device, pl); - tmp = pl; - pl = pl->next; - LIBMTP_destroy_playlist_t(tmp); - } - } - - LIBMTP_Release_Device(device); - printf("OK.\n"); - exit (0); -} diff --git a/chromium/third_party/libmtp/examples/reset.c b/chromium/third_party/libmtp/examples/reset.c deleted file mode 100644 index f8ef376d389..00000000000 --- a/chromium/third_party/libmtp/examples/reset.c +++ /dev/null @@ -1,85 +0,0 @@ -/** - * \file reset.c - * Example program that resets the device. - * - * Copyright (C) 2007 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" - -/** - * Returns 0 if OK (yes), 1 if not OK (no) - */ -static int prompt() -{ - char buff[2]; - - while (1) { - fprintf(stdout, "> "); - if ( fgets(buff, sizeof(buff), stdin) == NULL ) { - if (ferror(stdin)) { - fprintf(stderr, "File error on stdin\n"); - } else { - fprintf(stderr, "EOF on stdin\n"); - } - return 1; - } - if (buff[0] == 'y') { - return 0; - } else if (buff[0] == 'n') { - return 1; - } - } -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device; - int ret; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - return 0; - } - - printf("I will now reset your device. This means that\n"); - printf("the device may go inactive immediately and may report errors.\n"); - printf("Continue? (y/n)\n"); - if (prompt() == 0) { - ret = LIBMTP_Reset_Device(device); - } else { - printf("Aborted.\n"); - ret = 0; - } - - if ( ret != 0 ) { - printf("Failed to reset device.\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - LIBMTP_Release_Device(device); - return 1; - } - - // It is not possible to release the device after successful reset! - // LIBMTP_Release_Device(device); - printf("OK.\n"); - return 0; -} diff --git a/chromium/third_party/libmtp/examples/sendfile.c b/chromium/third_party/libmtp/examples/sendfile.c deleted file mode 100644 index cafade1d39d..00000000000 --- a/chromium/third_party/libmtp/examples/sendfile.c +++ /dev/null @@ -1,102 +0,0 @@ -/** - * \file sendfile.c - * Example program to send an arbitrary file to a device. - * - * Copyright (C) 2005-2010 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include <stdlib.h> -#include <string.h> -#include <libgen.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include "common.h" -#include "libmtp.h" -#include "pathutils.h" -#include "util.h" -#include "connect.h" - -extern LIBMTP_folder_t *folders; -extern LIBMTP_file_t *files; -extern LIBMTP_mtpdevice_t *device; - -void sendfile_usage(void) -{ - fprintf(stderr, "usage: sendfile <local filename> <remote filename>\n"); -} - -int sendfile_function(char * from_path, char *to_path) -{ - printf("Sending %s to %s\n",from_path,to_path); - char *filename; - uint64_t filesize; - struct stat sb; - LIBMTP_file_t *genfile; - int ret; - uint32_t parent_id = 0; - - if ( stat(from_path, &sb) == -1 ) { - fprintf(stderr, "%s: ", from_path); - perror("stat"); - return 1; - } - - filesize = sb.st_size; - filename = basename(from_path); - parent_id = parse_path (to_path,files,folders); - if (parent_id == -1) { - printf("Parent folder could not be found, skipping\n"); - return 0; - } - - genfile = LIBMTP_new_file_t(); - genfile->filesize = filesize; - genfile->filename = strdup(filename); - genfile->filetype = find_filetype (filename); - genfile->parent_id = parent_id; - genfile->storage_id = 0; - - printf("Sending file...\n"); - ret = LIBMTP_Send_File_From_File(device, from_path, genfile, progress, NULL); - printf("\n"); - if (ret != 0) { - printf("Error sending file.\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - ret = 1; - } else { - printf("New file ID: %d\n", genfile->item_id); - } - - LIBMTP_destroy_file_t(genfile); - - return ret; -} - -int sendfile_command (int argc, char **argv) { - if (argc < 3) { - sendfile_usage(); - return 0; - } - checklang(); - return sendfile_function(argv[1],argv[2]); -} diff --git a/chromium/third_party/libmtp/examples/sendtr.c b/chromium/third_party/libmtp/examples/sendtr.c deleted file mode 100644 index 8c4b1b54d1f..00000000000 --- a/chromium/third_party/libmtp/examples/sendtr.c +++ /dev/null @@ -1,449 +0,0 @@ -/** - * \file sendtr.c - * Example program to send a music track to a device. - * This program is derived from the exact equivalent in libnjb. - * based on Enrique Jorreto Ledesma's work on the original program by - * Shaun Jackman and Linus Walleij. - * - * Copyright (C) 2003-2010 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2003-2005 Shaun Jackman - * Copyright (C) 2003-2005 Enrique Jorrete Ledesma - * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> - * Copyright (C) 2008 Nicolas Pennequin <nicolas.pennequin@free.fr> - * Copyright (C) 2008 Joseph Nahmias <joe@nahmias.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <stdlib.h> -#include <limits.h> -#include <string.h> -#include <libgen.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#ifdef HAVE_LANGINFO_H -#include <langinfo.h> -#endif - -#include "config.h" -#include "common.h" -#include "util.h" -#include "connect.h" -#include "libmtp.h" -#include "pathutils.h" - -extern LIBMTP_folder_t *folders; -extern LIBMTP_file_t *files; -extern LIBMTP_mtpdevice_t *device; - -void sendtrack_usage (void) -{ - fprintf(stderr, "usage: sendtr [ -D debuglvl ] [ -q ]\n"); - fprintf(stderr, "-t <title> -a <artist> -A <Album artist> -w <writer or composer>\n"); - fprintf(stderr, " -l <album> -c <codec> -g <genre> -n <track number> -y <year>\n"); - fprintf(stderr, " -d <duration in seconds> -s <storage_id> <local path> <remote path>\n"); - fprintf(stderr, "(-q means the program will not ask for missing information.)\n"); -} - -static char *prompt (const char *prompt, char *buffer, size_t bufsz, int required) -{ - char *cp, *bp; - - while (1) { - fprintf(stdout, "%s> ", prompt); - if ( fgets(buffer, bufsz, stdin) == NULL ) { - if (ferror(stdin)) { - perror("fgets"); - } else { - fprintf(stderr, "EOF on stdin\n"); - } - return NULL; - } - - cp = strrchr(buffer, '\n'); - if ( cp != NULL ) *cp = '\0'; - - bp = buffer; - while ( bp != cp ) { - if ( *bp != ' ' && *bp != '\t' ) return bp; - bp++; - } - - if (! required) return bp; - } -} - -static int add_track_to_album(LIBMTP_album_t *albuminfo, LIBMTP_track_t *trackmeta) -{ - LIBMTP_album_t *album; - LIBMTP_album_t *album_orig; - LIBMTP_album_t *found_album = NULL; - int ret; - - /* Look for the album */ - album = LIBMTP_Get_Album_List(device); - album_orig = album; - while(album != NULL) { - if ((album->name != NULL && - album->artist != NULL && - !strcmp(album->name, albuminfo->name) && - !strcmp(album->artist, albuminfo->artist)) || - (album->name != NULL && - album->composer != NULL && - !strcmp(album->name, albuminfo->name) && - !strcmp(album->composer, albuminfo->composer))) { - /* Disconnect this album for later use */ - found_album = album; - album = album->next; - found_album->next = NULL; - } else { - album = album->next; - } - } - - if (found_album == NULL) { - printf("Could not find Album. Retrying with only Album name\n"); - album = album_orig; - while(album != NULL) { - if ((album->name != NULL) && - !strcmp(album->name, albuminfo->name) ){ - /* Disconnect this album for later use */ - found_album = album; - album = album->next; - found_album->next = NULL; - } else { - album = album->next; - } - } - } - - 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); - } else { - uint32_t *trackid; - - trackid = (uint32_t *)malloc(sizeof(uint32_t)); - *trackid = trackmeta->item_id; - albuminfo->tracks = trackid; - albuminfo->no_tracks = 1; - albuminfo->storage_id = trackmeta->storage_id; - printf("Album doesn't exist: creating...\n"); - ret = LIBMTP_Create_New_Album(device, albuminfo); - /* albuminfo will be destroyed later by caller */ - } - - /* Delete the earlier retrieved Album list */ - album=album_orig; - while(album!=NULL){ - LIBMTP_album_t *tmp; - - tmp = album; - album = album->next; - LIBMTP_destroy_album_t(tmp); - } - - if (ret != 0) { - printf("Error creating or updating album.\n"); - printf("(This could be due to that your device does not support albums.)\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } else { - printf("success!\n"); - } - return ret; -} - -int sendtrack_function(char * from_path, char * to_path, char *partist, char *palbumartist, char *ptitle, char *pgenre, char *palbum, char *pcomposer, uint16_t tracknum, uint16_t length, uint16_t year, uint32_t storageid, uint16_t quiet) -{ - char *filename, *parent; - char artist[80], albumartist[80], title[80], genre[80], album[80], composer[80]; - char num[80]; - uint64_t filesize; - uint32_t parent_id = 0; - struct stat sb; - 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(strdup(to_path)); - filename = basename(strdup(to_path)); - parent_id = parse_path (parent,files,folders); - if (parent_id == -1) { - printf("Parent folder could not be found, skipping\n"); - return 1; - } - - if (stat(from_path, &sb) == -1) { - fprintf(stderr, "%s: ", from_path); - perror("stat"); - return 1; - } - - if (!S_ISREG(sb.st_mode)) - return 0; - - filesize = sb.st_size; - trackmeta->filetype = find_filetype (from_path); - if (!LIBMTP_FILETYPE_IS_TRACK(trackmeta->filetype)) { - printf("Not a valid track codec: \"%s\"\n", LIBMTP_Get_Filetype_Description(trackmeta->filetype)); - return 1; - } - - if ((ptitle == NULL) && (quiet == 0)) { - if ( (ptitle = prompt("Title", title, 80, 0)) != NULL ) - if (!strlen(ptitle)) ptitle = NULL; - } - - if ((palbum == NULL) && (quiet == 0)) { - if ( (palbum = prompt("Album", album, 80, 0)) != NULL ) - if (!strlen(palbum)) palbum = NULL; - } - - if ((palbumartist == NULL) && (quiet == 0)) { - if ( (palbumartist = prompt("Album artist", albumartist, 80, 0)) != NULL ) - if (!strlen(palbumartist)) palbumartist = NULL; - } - - if ((partist == NULL) && (quiet == 0)) { - if ( (partist = prompt("Artist", artist, 80, 0)) != NULL ) - if (!strlen(partist)) partist = NULL; - } - - if ((pcomposer == NULL) && (quiet == 0)) { - if ( (pcomposer = prompt("Writer or Composer", composer, 80, 0)) != NULL ) - if (!strlen(pcomposer)) pcomposer = NULL; - } - - if ((pgenre == NULL) && (quiet == 0)) { - if ( (pgenre = prompt("Genre", genre, 80, 0)) != NULL ) - if (!strlen(pgenre)) pgenre = NULL; - } - - if ((tracknum == 0) && (quiet == 0)) { - char *pnum; - if ( (pnum = prompt("Track number", num, 80, 0)) == NULL ) - tracknum = 0; - else - tracknum = strtoul(pnum, 0, 10); - } - - if ((year == 0) && (quiet == 0)) { - char *pnum; - if ( (pnum = prompt("Year", num, 80, 0)) == NULL ) - year = 0; - else - year = strtoul(pnum, 0, 10); - } - - if ((length == 0) && (quiet == 0)) { - char *pnum; - if ( (pnum = prompt("Length", num, 80, 0)) == NULL ) - length = 0; - else - length = strtoul(pnum, 0, 10); - } - - printf("Sending track:\n"); - printf("Codec: %s\n", LIBMTP_Get_Filetype_Description(trackmeta->filetype)); - if (ptitle) { - printf("Title: %s\n", ptitle); - trackmeta->title = strdup(ptitle); - } - if (palbum) { - printf("Album: %s\n", palbum); - trackmeta->album = strdup(palbum); - albuminfo->name = strdup(palbum); - } - if (palbumartist) { - printf("Album artist: %s\n", palbumartist); - albuminfo->artist = strdup(palbumartist); - } - if (partist) { - printf("Artist: %s\n", partist); - trackmeta->artist = strdup(partist); - if (palbumartist == NULL) - albuminfo->artist = strdup(partist); - } - if (pcomposer) { - printf("Writer or Composer: %s\n", pcomposer); - trackmeta->composer = strdup(pcomposer); - albuminfo->composer = strdup(pcomposer); - } - if (pgenre) { - printf("Genre: %s\n", pgenre); - trackmeta->genre = strdup(pgenre); - albuminfo->genre = strdup(pgenre); - } - if (year > 0) { - char tmp[80]; - printf("Year: %d\n", year); - snprintf(tmp, sizeof(tmp)-1, "%4d0101T0000.0", year); - tmp[sizeof(tmp)-1] = '\0'; - trackmeta->date = strdup(tmp); - } - if (tracknum > 0) { - printf("Track no: %d\n", tracknum); - trackmeta->tracknumber = tracknum; - } - if (length > 0) { - printf("Length: %d\n", length); - // Multiply by 1000 since this is in milliseconds - trackmeta->duration = length * 1000; - } - // We should always have this - if (filename != NULL) { - trackmeta->filename = strdup(filename); - } - trackmeta->filesize = filesize; - trackmeta->parent_id = parent_id; - { - int rc; - char *desc = NULL; - LIBMTP_devicestorage_t *pds = NULL; - - if (0 != (rc=LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED))) { - perror("LIBMTP_Get_Storage()"); - exit(-1); - } - for (pds = device->storage; pds != NULL; pds = pds->next) { - if (pds->id == storageid) { - desc = strdup(pds->StorageDescription); - break; - } - } - if (NULL != desc) { - printf("Storage ID: %s (%u)\n", desc, storageid); - free(desc); - } else - printf("Storage ID: %u\n", storageid); - trackmeta->storage_id = storageid; - } - - printf("Sending track...\n"); - ret = LIBMTP_Send_Track_From_File(device, from_path, trackmeta, progress, NULL); - printf("\n"); - if (ret != 0) { - printf("Error sending track.\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - ret = 1; - } else { - printf("New track ID: %d\n", trackmeta->item_id); - } - - /* Add here add to album call */ - if (palbum) - ret = add_track_to_album(albuminfo, trackmeta); - - LIBMTP_destroy_album_t(albuminfo); - LIBMTP_destroy_track_t(trackmeta); - - return ret; -} - -int sendtrack_command (int argc, char **argv) { - int opt; - extern int optind; - extern char *optarg; - char *partist = NULL; - char *palbumartist = NULL; - char *pcomposer = NULL; - char *ptitle = NULL; - char *pgenre = NULL; - char *pcodec = NULL; - char *palbum = NULL; - uint16_t tracknum = 0; - uint16_t length = 0; - uint16_t year = 0; - uint16_t quiet = 0; - uint32_t storageid = 0; - while ( (opt = getopt(argc, argv, "qD:t:a:A:w:l:c:g:n:d:y:s:")) != -1 ) { - switch (opt) { - case 't': - ptitle = strdup(optarg); - break; - case 'a': - partist = strdup(optarg); - break; - case 'A': - palbumartist = strdup(optarg); - break; - case 'w': - pcomposer = strdup(optarg); - break; - case 'l': - palbum = strdup(optarg); - break; - case 'c': - pcodec = strdup(optarg); // FIXME: DSM check for MP3, WAV or WMA - break; - case 'g': - pgenre = strdup(optarg); - break; - case 'n': - tracknum = atoi(optarg); - break; - case 's': - storageid = (uint32_t) strtoul(optarg, NULL, 0); - break; - case 'd': - length = atoi(optarg); - break; - case 'y': - year = atoi(optarg); - break; - case 'q': - quiet = 1; - break; - default: - sendtrack_usage(); - } - } - argc -= optind; - argv += optind; - - if ( argc != 2 ) { - printf("You need to pass a filename and destination.\n"); - sendtrack_usage(); - return 0; - } - - checklang(); - - printf("%s,%s,%s,%s,%s,%s,%s,%s,%d%d,%d,%u,%d\n",argv[0],argv[1],partist,palbumartist,ptitle,pgenre,palbum,pcomposer,tracknum, length, year, storageid, quiet); - return sendtrack_function(argv[0],argv[1],partist,palbumartist,ptitle,pgenre,palbum,pcomposer, tracknum, length, year, storageid, quiet); -} diff --git a/chromium/third_party/libmtp/examples/thumb.c b/chromium/third_party/libmtp/examples/thumb.c deleted file mode 100644 index 2718a0c4446..00000000000 --- a/chromium/third_party/libmtp/examples/thumb.c +++ /dev/null @@ -1,131 +0,0 @@ -/** - * \file thumb.c - * Example program to send and associate album art to an entity - * on a device. - * - * Copyright (C) 2006 Robert Reardon <rreardon@monkshatch.vispa.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "config.h" -#include "common.h" -#include "string.h" -#include <fcntl.h> -#include <errno.h> -#include <stdlib.h> -#include <unistd.h> -#include <limits.h> -#include <sys/types.h> -#ifdef HAVE_SYS_UIO_H -#include <sys/uio.h> -#endif -#include <sys/stat.h> - -static void usage(void) { - printf("Usage: thumb -i <fileid/trackid> <imagefile>\n"); - exit(0); -} - -int main (int argc, char **argv) { - int opt; - extern int optind; - extern char *optarg; - LIBMTP_mtpdevice_t *device = NULL; - int fd; - uint32_t id = 0; - uint64_t filesize; - uint8_t *imagedata = NULL; - char *path = NULL; - char *rest; - struct stat statbuff; - int ret; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - while ( (opt = getopt(argc, argv, "hi:")) != -1 ) { - switch (opt) { - case 'h': - usage(); - case 'i': - id = strtoul(optarg, &rest, 0); - break; - default: - usage(); - } - } - argc -= optind; - argv += optind; - - if ( argc != 1 ) { - printf("You need to pass a filename.\n"); - usage(); - } - - path = argv[0]; - - if ( stat(path, &statbuff) == -1 ) { - fprintf(stderr, "%s: ", path); - perror("stat"); - exit(1); - } - filesize = (uint64_t) statbuff.st_size; - imagedata = malloc(filesize * sizeof(uint16_t)); - -#ifdef __WIN32__ - if ( (fd = open(path, O_RDONLY|O_BINARY) == -1) ) { -#else - if ( (fd = open(path, O_RDONLY)) == -1) { -#endif - printf("Couldn't open image file %s (%s)\n",path,strerror(errno)); - return 1; - } - else { - read(fd, imagedata, filesize); - close(fd); - } - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices.\n"); - return 0; - } - - LIBMTP_filesampledata_t *thumb = LIBMTP_new_filesampledata_t(); - - int i; - thumb->data = malloc(sizeof(uint16_t) * filesize); - for (i = 0; i < filesize; i++) { - thumb->data[i] = imagedata[i]; - } - - thumb->size = filesize; - thumb->filetype = LIBMTP_FILETYPE_JPEG; - - ret = LIBMTP_Send_Representative_Sample(device,id,thumb); - if (ret != 0) { - printf("Couldn't send thumbnail\n"); - LIBMTP_Dump_Errorstack(device); - LIBMTP_Clear_Errorstack(device); - } - - free(imagedata); - LIBMTP_destroy_filesampledata_t(thumb); - - LIBMTP_Release_Device(device); - printf("OK.\n"); - return 0; -} diff --git a/chromium/third_party/libmtp/examples/tracks.c b/chromium/third_party/libmtp/examples/tracks.c deleted file mode 100644 index 04aa2e1d5fb..00000000000 --- a/chromium/third_party/libmtp/examples/tracks.c +++ /dev/null @@ -1,147 +0,0 @@ -/** - * \file tracks.c - * Example program to list the tracks on a device. - * - * Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se> - * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> - -static void dump_trackinfo(LIBMTP_track_t *track) -{ - printf("Track ID: %u\n", track->item_id); - if (track->title != NULL) - printf(" Title: %s\n", track->title); - if (track->artist != NULL) - printf(" Artist: %s\n", track->artist); - if (track->genre != NULL) - printf(" Genre: %s\n", track->genre); - if (track->composer != NULL) - printf(" Composer: %s\n", track->composer); - if (track->album != NULL) - printf(" Album: %s\n", track->album); - if (track->date != NULL) - printf(" Date: %s\n", track->date); - if (track->filename != NULL) - printf(" Origfilename: %s\n", track->filename); - printf(" Track number: %d\n", track->tracknumber); - printf(" Duration: %d milliseconds\n", track->duration); -#ifdef __WIN32__ - printf(" File size %I64u bytes\n", track->filesize); -#else - printf(" File size %llu bytes\n", (long long unsigned int) track->filesize); -#endif - printf(" Filetype: %s\n", LIBMTP_Get_Filetype_Description(track->filetype)); - if (track->samplerate != 0) { - printf(" Sample rate: %u Hz\n", track->samplerate); - } - if (track->nochannels != 0) { - printf(" Number of channels: %u\n", track->nochannels); - } - if (track->wavecodec != 0) { - printf(" WAVE fourCC code: 0x%08X\n", track->wavecodec); - } - if (track->bitrate != 0) { - printf(" Bitrate: %u bits/s\n", track->bitrate); - } - if (track->bitratetype != 0) { - if (track->bitratetype == 1) { - printf(" Bitrate type: Constant\n"); - } else if (track->bitratetype == 2) { - printf(" Bitrate type: Variable (VBR)\n"); - } else if (track->bitratetype == 3) { - printf(" Bitrate type: Free\n"); - } else { - printf(" Bitrate type: Unknown/Erroneous value\n"); - } - } - if (track->rating != 0) { - printf(" User rating: %u (out of 100)\n", track->rating); - } - if (track->usecount != 0) { - printf(" Use count: %u times\n", track->usecount); - } -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device_list, *device; - LIBMTP_track_t *tracks; - - LIBMTP_Init(); - fprintf(stdout, "Attempting to connect device(s)\n"); - - switch(LIBMTP_Get_Connected_Devices(&device_list)) - { - case LIBMTP_ERROR_NO_DEVICE_ATTACHED: - fprintf(stdout, "mtp-tracks: No Devices have been found\n"); - return 0; - case LIBMTP_ERROR_CONNECTING: - fprintf(stderr, "mtp-tracks: There has been an error connecting. Exit\n"); - return 1; - case LIBMTP_ERROR_MEMORY_ALLOCATION: - fprintf(stderr, "mtp-tracks: Memory Allocation Error. Exit\n"); - return 1; - - /* Unknown general errors - This should never execute */ - case LIBMTP_ERROR_GENERAL: - default: - fprintf(stderr, "mtp-tracks: Unknown error, please report " - "this to the libmtp developers\n"); - return 1; - - /* Successfully connected at least one device, so continue */ - case LIBMTP_ERROR_NONE: - fprintf(stdout, "mtp-tracks: Successfully connected\n"); - fflush(stdout); - } - - /* iterate through connected MTP devices */ - for(device = device_list; device != NULL; device = device->next) { - char *friendlyname; - - /* Echo the friendly name so we know which device we are working with */ - friendlyname = LIBMTP_Get_Friendlyname(device); - if (friendlyname == NULL) { - printf("Friendly name: (NULL)\n"); - } else { - printf("Friendly name: %s\n", friendlyname); - free(friendlyname); - } - // Get track listing. - tracks = LIBMTP_Get_Tracklisting_With_Callback(device, NULL, NULL); - if (tracks == NULL) { - printf("No tracks.\n"); - } else { - LIBMTP_track_t *track, *tmp; - track = tracks; - while (track != NULL) { - dump_trackinfo(track); - tmp = track; - track = track->next; - LIBMTP_destroy_track_t(tmp); - } - } - } - - LIBMTP_Release_Device_List(device_list); - printf("OK.\n"); - exit (0); -} - diff --git a/chromium/third_party/libmtp/examples/trexist.c b/chromium/third_party/libmtp/examples/trexist.c deleted file mode 100644 index d6159d7f744..00000000000 --- a/chromium/third_party/libmtp/examples/trexist.c +++ /dev/null @@ -1,68 +0,0 @@ -/** - * \file trexist.c - * Example program to check if a certain track exists on the device. - * - * Copyright (C) 2006 The libmtp development team. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "common.h" -#include <stdlib.h> -#include <limits.h> - -static void usage (void) -{ - fprintf(stderr, "trexist <trackid>\n"); -} - -int main (int argc, char **argv) -{ - LIBMTP_mtpdevice_t *device; - uint32_t id; - char *endptr; - - fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - - // We need track ID - if ( argc != 2 ) { - usage(); - return 1; - } - - // Sanity check song ID - id = strtoul(argv[1], &endptr, 10); - if ( *endptr != 0 ) { - fprintf(stderr, "illegal value %s\n", argv[1]); - return 1; - } else if ( ! id ) { - fprintf(stderr, "bad song id %u\n", id); - return 1; - } - - LIBMTP_Init(); - device = LIBMTP_Get_First_Device(); - if (device == NULL) { - printf("No devices. Connect/replug device and try again.\n"); - exit (0); - } - - printf("%s\n", LIBMTP_Track_Exists(device, id) ? "Yes" : "No"); - - LIBMTP_Release_Device(device); - printf("OK.\n"); - exit (0); -} - diff --git a/chromium/third_party/libmtp/examples/util.c b/chromium/third_party/libmtp/examples/util.c deleted file mode 100644 index 4563f7ba974..00000000000 --- a/chromium/third_party/libmtp/examples/util.c +++ /dev/null @@ -1,68 +0,0 @@ -/** - * \file util.c - * A set of common utility functions found - * in all samples. - * - * Copyright (C) 2008 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "config.h" -#include "util.h" -#ifdef HAVE_LANGINFO_H -#include <langinfo.h> -#endif -#ifdef HAVE_LOCALE_H -#include <locale.h> -#endif -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <strings.h> - -void checklang(void) -{ - const char *langsuff = NULL; - const char *lang = getenv("LANG"); - -#ifdef HAVE_LOCALE_H - // Set the locale in accordance with environment - setlocale(LC_ALL, ""); -#endif -#ifdef HAVE_LANGINFO_H - langsuff = nl_langinfo(CODESET); -#else - /* - * Check environment variables $LANG and $LC_CTYPE - * to see if we want to support UTF-8 unicode - */ - if (lang != NULL) { - const char *sep = strrchr(lang, '.'); - if (sep != NULL) { - langsuff = sep + 1; - } else { - langsuff = lang; - } - } -#endif - if (langsuff == NULL) { - printf("Could not determine language suffix for your system. Please check your setup!\n"); - } else if (strcasecmp(langsuff, "UTF-8") && strcasecmp(langsuff, "UTF8")) { - printf("Your system does not appear to have UTF-8 enabled ($LANG=\"%s\")\n", lang); - printf("If you want to have support for diacritics and Unicode characters,\n"); - printf("please switch your locale to an UTF-8 locale, e.g. \"en_US.UTF-8\".\n"); - } -} diff --git a/chromium/third_party/libmtp/examples/util.h b/chromium/third_party/libmtp/examples/util.h deleted file mode 100644 index ca7b65876b9..00000000000 --- a/chromium/third_party/libmtp/examples/util.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * \file util.h - * Header for a set of common utility functions found - * in all samples. - * - * Copyright (C) 2008 Linus Walleij <triad@df.lth.se> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef LIBMTP_EXAMPLES_UTIL_H -#define LIBMTP_EXAMPLES_UTIL_H -void checklang(void); -#endif |