Author: eandry
Date: Sun Feb  4 02:53:58 2007
New Revision: 116129

Added:
   packages/cooker/libmtp/current/SOURCES/archos.patch
Modified:
   packages/cooker/libmtp/current/SPECS/libmtp.spec

Log:
add patch from sourceforge for various fixes

Added: packages/cooker/libmtp/current/SOURCES/archos.patch
==============================================================================
--- (empty file)
+++ packages/cooker/libmtp/current/SOURCES/archos.patch Sun Feb  4 02:53:58 2007
@@ -0,0 +1,140 @@
+diff -cr libmtp-0.1.3/src/libmtp.c libmtp-0.1.3-archos/src/libmtp.c
+*** libmtp-0.1.3/src/libmtp.c  2007-01-11 22:26:02.000000000 +0100
+--- libmtp-0.1.3-archos/src/libmtp.c   2007-01-29 22:07:59.575614249 +0100
+***************
+*** 1476,1481 ****
+--- 1476,1482 ----
+   *        properities could not be retrieved and -1 means failure.
+   * @see LIBMTP_Get_Filetype_Description()
+   */
++ 
+  int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *device, int const sortby)
+  {
+    uint32_t i = 0;
+***************
+*** 1559,1564 ****
+--- 1560,1592 ----
+    }
+  }
+  
++ /* This function is a wrapper for <code> LIBMTP_Get_Storage </code>
++  * as that is frequently used in the outside world.
++  * However, we put a nice DEPRECATED into everybodys' faces.
++  * */
++ int LIBMTP_Get_Storageinfo(  LIBMTP_mtpdevice_t *mtpdevice,  uint64_t * 
const totalbytes,
++                                                      uint64_t * const 
freebytes,     char ** const storage_description,
++                                                      char ** const 
volume_label)
++ {
++   printf("WARNING: LIBMTP_Get_Storageinfo() is DEPRECATED.\n");
++   printf("WARNING: please update your code to use LIBMTP_Get_Storage() !\n");
++ 
++      int ret;
++      ret = LIBMTP_Get_Storage(mtpdevice, LIBMTP_STORAGE_SORTBY_NOTSORTED);
++      if (ret == 0) {
++              *totalbytes = mtpdevice->storage->MaxCapacity;
++              *freebytes = mtpdevice->storage->FreeSpaceInBytes;
++ 
++         // These are not used right now.
++              *storage_description = NULL;
++              *volume_label = NULL;
++      } else {
++              *totalbytes = 0;
++              *freebytes = 0;
++      }
++      return ret;
++ }
++ 
+  /**
+   * This creates a new file metadata structure and allocates memory
+   * for it. Notice that if you add strings to this structure they
+diff -cr libmtp-0.1.3/src/libmtp.h.in libmtp-0.1.3-archos/src/libmtp.h.in
+*** libmtp-0.1.3/src/libmtp.h.in       2007-01-06 17:50:50.000000000 +0100
+--- libmtp-0.1.3-archos/src/libmtp.h.in        2007-01-29 22:44:14.023047993 
+0100
+***************
+*** 316,322 ****
+  
+  int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
+  int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
+! 
+  
+  /**
+   * @}
+--- 316,326 ----
+  
+  int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
+  int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
+! int LIBMTP_Get_Storageinfo(LIBMTP_mtpdevice_t *,
+!                            uint64_t * const,
+!                            uint64_t * const,
+!                            char ** const storage_description,
+!                            char ** const volume_label);
+  
+  /**
+   * @}
+diff -cr libmtp-0.1.3/src/libusb-glue.c libmtp-0.1.3-archos/src/libusb-glue.c
+*** libmtp-0.1.3/src/libusb-glue.c     2007-01-16 21:36:17.000000000 +0100
+--- libmtp-0.1.3-archos/src/libusb-glue.c      2007-01-29 22:07:59.671599657 
+0100
+***************
+*** 184,189 ****
+--- 184,191 ----
+     */
+    // Reported by [EMAIL PROTECTED]
+    { "Archos 104 (MTP mode)", 0x0e79, 0x120a, DEVICE_FLAG_NONE },
++   // Added by Jan Binder
++   { "Archos XS202 (MTP mode)", 0x0e79, 0x1208, DEVICE_FLAG_NONE },
+  
+    /*
+     * Dunlop (OEM of EGOMAN ltd?) reported by Nanomad
+diff -cr libmtp-0.1.3/src/ptp-pack.c libmtp-0.1.3-archos/src/ptp-pack.c
+*** libmtp-0.1.3/src/ptp-pack.c        2007-01-08 00:08:48.000000000 +0100
+--- libmtp-0.1.3-archos/src/ptp-pack.c 2007-01-29 22:07:59.673599353 +0100
+***************
+*** 109,116 ****
+                       string[i]=dtoh16a(&data[offset+i*2+1]);
+               }
+               /* be paranoid! Add a terminator. :( */
+               string[loclen]=0x0000U;
+!              loclstr[0]='\0';
+               /* loclstr=ucs2_to_utf8(string); */
+               /* Do the conversion.  */
+               nconv = iconv (params->cd_ucs2_to_locale, &stringp, &convlen, 
&locp, &convmax);
+--- 109,123 ----
+                       string[i]=dtoh16a(&data[offset+i*2+1]);
+               }
+               /* be paranoid! Add a terminator. :( */
++              /* be more paranoid: clear loclstr as there were some nasty 
issues*/
++              for(i=0;i<PTP_MAXSTRLEN*3+1;i++) {
++                      loclstr[i] = '\0';
++              }
+               string[loclen]=0x0000U;
+!              /*loclstr[0]='\0'; //Not needed any more as localstr is wiped 
clean
+!               * which certainly is not good practice, but the other 
mechanism seems
+!               * to fail and we dont know how wide our char is
+!               */
+               /* loclstr=ucs2_to_utf8(string); */
+               /* Do the conversion.  */
+               nconv = iconv (params->cd_ucs2_to_locale, &stringp, &convlen, 
&locp, &convmax);
+***************
+*** 606,614 ****
+       /* XXX: other int arrays are unimplemented also */
+       case PTP_DTC_STR: {
+               uint8_t len;
+!              /* XXX: max size */
+               value->str = ptp_unpack_string(params,data,*offset,&len);
+               *offset += len*2+1;
+               if (!value->str)
+                       return 0;
+               break;
+--- 613,622 ----
+       /* XXX: other int arrays are unimplemented also */
+       case PTP_DTC_STR: {
+               uint8_t len;
+!              /* XXX: max size: somewhat fixed now, i guess, quick and dirty 
solution */
+               value->str = ptp_unpack_string(params,data,*offset,&len);
+               *offset += len*2+1;
++              /*printf("[D: %s :%d :%d ]\n", value->str, *offset, len);*/
+               if (!value->str)
+                       return 0;
+               break;
+
+                

Modified: packages/cooker/libmtp/current/SPECS/libmtp.spec
==============================================================================
--- packages/cooker/libmtp/current/SPECS/libmtp.spec    (original)
+++ packages/cooker/libmtp/current/SPECS/libmtp.spec    Sun Feb  4 02:53:58 2007
@@ -1,6 +1,6 @@
 %define        name    libmtp
 %define        version 0.1.3
-%define release %mkrel 2
+%define release %mkrel 3
 %define major  5
 %define        libname %mklibname mtp %major
 
@@ -12,6 +12,7 @@
 License:       LGPL
 URL:           http://libmtp.sourceforge.net/
 Source0:       %{name}-%{version}.tar.bz2
+Patch0:                archos.patch
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 BuildRequires: pkgconfig libusb-devel doxygen
 
@@ -49,6 +50,7 @@
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %configure --enable-hotplugging --disable-static --program-prefix=mtp-

Reply via email to