Some new functionality.
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 432adde..a0fd764 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,15 +1,16 @@
-bin_PROGRAMS=detect tracks files getfile sendtr delfile hotplug folders newfolder trexist
+bin_PROGRAMS=detect tracks files getfile sendtr delfile hotplug folders newfolder trexist sendfile
 
 detect_SOURCES=detect.c common.h
 tracks_SOURCES=tracks.c common.h
 files_SOURCES=files.c common.h
 getfile_SOURCES=getfile.c common.h
 sendtr_SOURCES=sendtr.c common.h
+sendfile_SOURCES=sendfile.c common.h
 delfile_SOURCES=delfile.c common.h
 hotplug_SOURCES=hotplug.c common.h
 folders_SOURCES=folders.c common.h
-newfolder=newfolder.c common.h
-trexist=trexist.c common.h
+newfolder_SOURCES=newfolder.c common.h
+trexist_SOURCES=trexist.c common.h
 
 AM_CFLAGS=-I$(top_builddir)/src
 LDADD=../src/libmtp.la
diff --git a/examples/files.c b/examples/files.c
index 242bdaf..564f9a0 100644
--- a/examples/files.c
+++ b/examples/files.c
@@ -6,6 +6,7 @@
   if (file->filename != NULL)
     printf("   Filename: %s\n", file->filename);
   printf("   File size %llu bytes\n", file->filesize);
+  printf("   Parent ID: %d\n", file->parent_id);
   printf("   Filetype: %d\n", file->filetype);
 }
 
diff --git a/src/libmtp.c b/src/libmtp.c
index 46894d2..ccf21fa 100644
--- a/src/libmtp.c
+++ b/src/libmtp.c
@@ -13,6 +13,7 @@
 			    LIBMTP_progressfunc_t const * const callback,
 			    void const * const data);
 static int delete_item(LIBMTP_mtpdevice_t *device, uint32_t item_id);
+uint16_t map_mtp_type_to_ptp_type(LIBMTP_filetype_t intype);
 
 // Map this libptp2 single-threaded callback to the LIBMTP callback type
 // extern Progress_Callback* globalCallback;
@@ -172,7 +173,6 @@
 {
   int i;
   PTPParams *params = (PTPParams *) device->params;
-  uint16_t lastgroup = 0x0000U;
     
   /* Print out some verbose information */
   printf("Device info:\n");
@@ -458,6 +458,8 @@
       // Allocate a new file type
       file = LIBMTP_new_file_t();
 
+      file->parent_id = oi.ParentObject;
+      
       switch (oi.ObjectFormat)
 	{
 	case PTP_OFC_WAV:
@@ -514,6 +516,9 @@
 	case PTP_OFC_PNG:
 	  file->filetype = LIBMTP_FILETYPE_PNG;
 	  break;
+	case PTP_OFC_MTP_vCalendar2:
+	  file->filetype = LIBMTP_FILETYPE_CALENDAR;
+	  break;
 	default:
 	  file->filetype = LIBMTP_FILETYPE_UNKNOWN;
 	  // printf("LIBMTP warning: \"%s\" has unknown filetype 0x%04X, association: 0x%04X, association desc: 0x%08X\n", oi.Filename, oi.ObjectFormat, oi.AssociationType, oi.AssociationDesc);
@@ -1018,7 +1023,7 @@
  * @return 0 if the transfer was successful, any other value means 
  *           failure.
  */
-static int send_file_object(LIBMTP_mtpdevice_t *device, 
+int send_file_object(LIBMTP_mtpdevice_t *device, 
 		      int const fd, uint64_t size,
 		      LIBMTP_progressfunc_t const * const callback,
 		      void const * const data)
@@ -1253,6 +1258,131 @@
   return 0;
 }
 
+
+
+/**
+ * Returns the PTP filetype that maps to a certain MTP file type.
+ * @param intype the MTP library interface type
+ * @return the PTP (libgphoto2) interface type
+ */
+uint16_t map_mtp_type_to_ptp_type(LIBMTP_filetype_t intype)
+{
+  switch (intype) {
+  case LIBMTP_FILETYPE_WAV:
+    return PTP_OFC_WAV;
+    break;
+  case LIBMTP_FILETYPE_MP3:
+    return PTP_OFC_MP3;
+    break;
+  case LIBMTP_FILETYPE_WMA:
+    return PTP_OFC_MTP_WMA;
+    break;
+  case LIBMTP_FILETYPE_OGG:
+    return PTP_OFC_MTP_OGG;
+    break;
+  case LIBMTP_FILETYPE_MP4:
+    return PTP_OFC_MTP_MP4;
+    break;
+  case LIBMTP_FILETYPE_UNDEF_AUDIO:
+    return PTP_OFC_MTP_UndefinedAudio;
+    break;
+  case LIBMTP_FILETYPE_WMV:
+    return PTP_OFC_MTP_WMV;
+    break;
+  case LIBMTP_FILETYPE_AVI:
+    return PTP_OFC_AVI;
+    break;
+  case LIBMTP_FILETYPE_MPEG:
+    return PTP_OFC_MPEG;
+    break;
+  case LIBMTP_FILETYPE_ASF:
+    return PTP_OFC_ASF;
+    break;
+  case LIBMTP_FILETYPE_QT:
+    return PTP_OFC_QT;
+    break;
+  case LIBMTP_FILETYPE_UNDEF_VIDEO:
+    return PTP_OFC_MTP_UndefinedVideo;
+    break;
+  case LIBMTP_FILETYPE_JFIF:
+    return PTP_OFC_JFIF; // or should this be PTP_OFC_EXIF_JPEG?
+    break;
+  case LIBMTP_FILETYPE_TIFF:
+    return PTP_OFC_TIFF;
+    break;
+  case LIBMTP_FILETYPE_BMP:
+    return PTP_OFC_BMP;
+    break;
+  case LIBMTP_FILETYPE_GIF:
+    return PTP_OFC_GIF;
+    break;
+  case LIBMTP_FILETYPE_PICT:
+    return PTP_OFC_PICT;
+    break;
+  case LIBMTP_FILETYPE_PNG:
+    return PTP_OFC_PNG;
+    break;
+  case LIBMTP_FILETYPE_CALENDAR:
+    return PTP_OFC_MTP_vCalendar2;
+    break;
+  default:
+    printf("LIBMTP_Send_File_From_File_Descriptor: unknown filetype.\n");
+    return PTP_OFC_Undefined;
+  }
+}
+
+/**
+ * This function sends a generic file from a file descriptor to an
+ * MTP device. A filename and a set of metadata must be
+ * given as input.
+ * @param device a pointer to the device to send the file to.
+ * @param fd the filedescriptor for a local file which will be sent.
+ * @param filedata a file strtuct to pass in info abou the file.
+ *                 After this call the field <code>item_id</code>
+ *                 will contain the new track ID.
+ * @param callback a progress indicator function or NULL to ignore.
+ * @param data a user-defined pointer that is passed along to
+ *             the <code>progress</code> function in order to
+ *             pass along some user defined data to the progress
+ *             updates. If not used, set this to NULL.
+ * @return 0 if the transfer was successful, any other value means 
+ *           failure.
+ * @see LIBMTP_Send_Track_From_File()
+ */
+int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *device, 
+			 int const fd, LIBMTP_file_t * const filedata,
+                         LIBMTP_progressfunc_t const * const callback,
+			 void const * const data, uint32_t parenthandle)
+{
+  uint16_t ret;
+  uint32_t store = 0;
+  int subcall_ret;
+  PTPObjectInfo new_file;
+  PTPParams *params = (PTPParams *) device->params;
+  
+  new_file.Filename = filedata->filename;
+  new_file.ObjectCompressedSize = filedata->filesize;
+  new_file.ObjectFormat = map_mtp_type_to_ptp_type(filedata->filetype);
+
+  // Create the object
+  ret = ptp_sendobjectinfo(params, &store, &parenthandle, &filedata->item_id, &new_file);
+  if (ret != PTP_RC_OK) {
+    ptp_perror(params, ret);
+    printf("LIBMTP_Send_File_From_File_Descriptor: Could not send object info\n");
+    return -1;
+  }
+
+  // Call main function to transfer the track
+  subcall_ret = send_file_object(device, fd, filedata->filesize, callback, data);
+  if (subcall_ret != 0) {
+    printf("LIBMTP_Send_File_From_File_Descriptor: error sending track object\n");
+    (void) delete_item(device, filedata->item_id);
+    return -1;
+  }
+    
+  return 0;
+}
+
 /**
  * This function updates the MTP object metadata on a single file
  * identified by an object ID.
diff --git a/src/libmtp.h.in b/src/libmtp.h.in
index 6b10f67..cbf07e7 100644
--- a/src/libmtp.h.in
+++ b/src/libmtp.h.in
@@ -61,6 +61,7 @@
   LIBMTP_FILETYPE_GIF,
   LIBMTP_FILETYPE_PICT,
   LIBMTP_FILETYPE_PNG,
+  LIBMTP_FILETYPE_CALENDAR,
   LIBMTP_FILETYPE_UNKNOWN
 } LIBMTP_filetype_t;
 typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */
@@ -107,6 +108,7 @@
  */
 struct LIBMTP_file_struct {
   uint32_t item_id; /**< Unique item ID */
+  uint32_t parent_id; /**< ID of parent folder */
   char *filename; /**< Filename of this file */
   uint64_t filesize; /**< Size of file in bytes */
   LIBMTP_filetype_t filetype; /**< Filetype used for the current file */
@@ -199,7 +201,9 @@
 			LIBMTP_progressfunc_t const * const, void const * const);
 int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, 
 			LIBMTP_progressfunc_t const * const, void const * const);
-
+int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, 
+	                LIBMTP_file_t * const, LIBMTP_progressfunc_t const * const,
+			void const * const, uint32_t);
 /**
  * @}
  * @defgroup tracks The track management API.
diff --git a/src/ptp.c b/src/ptp.c
index d7145a5..2dfaa9a 100644
--- a/src/ptp.c
+++ b/src/ptp.c
@@ -2265,17 +2265,17 @@
 		{PTP_DPC_NIKON_D2MaximumShots,			/* 0xD069 */
 		 N_("Max. Shots")},
 		{PTP_DPC_NIKON_D3ExpDelayMode,			/* 0xD06a */
-		 N_("PTP_DPC_NIKON_D3ExpDelayMode")},
+		 "PTP_DPC_NIKON_D3ExpDelayMode"},
 		{PTP_DPC_NIKON_LongExposureNoiseReduction,	/* 0xD06b */
 		 N_("Long Exposure Noise Reduction")},
 		{PTP_DPC_NIKON_FileNumberSequence,		/* 0xD06c */
 		 N_("File Number Sequencing")},
 		{PTP_DPC_NIKON_D6ControlPanelFinderRearControl,	/* 0xD06d */
-		 N_("PTP_DPC_NIKON_D6ControlPanelFinderRearControl")},
+		 "PTP_DPC_NIKON_D6ControlPanelFinderRearControl"},
 		{PTP_DPC_NIKON_ControlPanelFinderViewfinder,	/* 0xD06e */
-		 N_("PTP_DPC_NIKON_ControlPanelFinderViewfinder")},
+		 "PTP_DPC_NIKON_ControlPanelFinderViewfinder"},
 		{PTP_DPC_NIKON_D7Illumination,			/* 0xD06f */
-		 N_("PTP_DPC_NIKON_D7Illumination")},
+		 "PTP_DPC_NIKON_D7Illumination"},
 		{PTP_DPC_NIKON_E1FlashSyncSpeed,		/* 0xD074 */
 		 N_("Flash Sync. Speed")},
 		{PTP_DPC_NIKON_FlashShutterSpeed,		/* 0xD075 */