banshee r3015 - in branches/banshee/stable: . src/Dap/Banshee.Dap.Mtp



Author: alanmc
Date: Wed Jan 23 01:35:46 2008
New Revision: 3015
URL: http://svn.gnome.org/viewvc/banshee?rev=3015&view=rev

Log:
* src/Dap/Banshee.Dap.Mtp/MtpDap.cs, ChangeLog: To decide if a device
  is an MTP device, check for either portable_audio_player.type ==
  'mtp' or usb.interface.description == 'Mtp Interface'.

Modified:
   branches/banshee/stable/ChangeLog
   branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs

Modified: branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs
==============================================================================
--- branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs	(original)
+++ branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs	Wed Jan 23 01:35:46 2008
@@ -94,25 +94,24 @@
 		public override InitializeResult Initialize (Hal.Device halDevice)
 		{
 			HalDevice = halDevice;
-			if (!halDevice.PropertyExists ("usb.vendor_id")) {
-				LogCore.Instance.PushDebug ("Missing Properties", "Cannot find usb.vendor_id");
-			}
-			if (!halDevice.PropertyExists ("usb.product_id")) {
-				LogCore.Instance.PushDebug ("Missing Properties", "Cannot find usb.product_id");
-			}
-			if (!halDevice.PropertyExists ("portable_audio_player.type")) {
-				LogCore.Instance.PushDebug ("Missing Properties", "Cannot find portable_audio_player.type. Attempting to continue...");
-			}
-			
+			//if (!halDevice.PropertyExists ("usb.vendor_id")) {
+			//LogCore.Instance.PushDebug ("Missing Properties", "Cannot find usb.vendor_id");
+			//}
+			//if (!halDevice.PropertyExists ("usb.product_id")) {
+			//LogCore.Instance.PushDebug ("Missing Properties", "Cannot find usb.product_id");
+			//}
 			short product_id = 0;// (short) halDevice.GetPropertyInteger ("usb.product_id");
 			short vendor_id  = 0;// (short) halDevice.GetPropertyInteger ("usb.vendor_id");
-			string type = halDevice.PropertyExists ("portable_audio_player.type") ? halDevice.GetPropertyString ("portable_audio_player.type") : "mtp";
-			string name = halDevice.PropertyExists ("usb_device.product") ? halDevice.GetPropertyString ("usb_device.product") : "Mtp Device";
 			int deviceNumber = 0;//halDevice.GetPropertyInteger ("usb.linux.device_number");
-			int busNumber = 0;//halDevice.GetPropertyInteger ("usb.bus_number");
-
-			if (type != "mtp") {			
-				LogCore.Instance.PushDebug ("MTP: Unsupported Device", "The device's portable_audio_player.type IS NOT mtp");
+			int busNumber = 0;   //halDevice.GetPropertyInteger ("usb.bus_number");
+			
+			// Pull out the properties we use for checking if the device is an MTP device or not
+			string type = halDevice.PropertyExists ("portable_audio_player.type") ? halDevice.GetPropertyString ("portable_audio_player.type") : "??";
+			string description = halDevice.PropertyExists("usb.interface.description") ? halDevice.GetPropertyString("usb.interface.description") : "??";
+			string name = halDevice.PropertyExists ("usb_device.product") ? halDevice.GetPropertyString ("usb_device.product") : "Mtp Device";
+			
+			if (type != "mtp" && description != "MTP Interface") {			
+				LogCore.Instance.PushDebug ("MTP: Unsupported Device", string.Format("Type: {0}, Description: {1}", type, description));
 				return InitializeResult.Invalid;
 			}
 			
@@ -130,9 +129,7 @@
                     String.Format (message, Environment.NewLine, ex.InnerException.Message)
                 );
 				return InitializeResult.Invalid;
-			} catch (LibMtpException ex) {
-
-            } catch (Exception ex) {
+			} catch (Exception ex) {
 				ShowGeneralExceptionDialog (ex);
 				return InitializeResult.Invalid;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]