[podsleuth] 2009-06-30 Gabriel Burt <gabriel burt gmail com>



commit 8c17bbb6e3fa9bd39c4c43c0e28a30a6795a189c
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Jun 30 20:02:11 2009 -0500

    2009-06-30  Gabriel Burt  <gabriel burt gmail com>
    
    	* src/PodSleuth/PodSleuth/Device.cs: Patch from Nicolas Cortot to get some
    	3rd gen iPods working again (BGO #486661).  Modified by myself to be a
    	little more defensive/certain of not breaking currently-working models.

 ChangeLog                         |    6 ++++++
 src/PodSleuth/PodSleuth/Device.cs |   33 +++++++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 766dabf..a6405aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-30  Gabriel Burt  <gabriel burt gmail com>
+
+	* src/PodSleuth/PodSleuth/Device.cs: Patch from Nicolas Cortot to get some
+	3rd gen iPods working again (BGO #486661).  Modified by myself to be a
+	little more defensive/certain of not breaking currently-working models.
+
 2009-01-20  Aaron Bockover  <abock gnome org>
 
 	Released 0.6.4
diff --git a/src/PodSleuth/PodSleuth/Device.cs b/src/PodSleuth/PodSleuth/Device.cs
index 49a3baf..1001e60 100644
--- a/src/PodSleuth/PodSleuth/Device.cs
+++ b/src/PodSleuth/PodSleuth/Device.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Text;
+using System.IO;
 using System.Collections.Generic;
 
 using PodSleuth.ModelData;
@@ -44,7 +45,9 @@ namespace PodSleuth
 
             builder.Append ("[SysInfo]");
             builder.AppendLine ();
-            builder.Append (sysinfo);
+            if (sysinfo != null) {
+                builder.Append (sysinfo);
+            }
             builder.AppendLine ();
 
             builder.Append ("[Model]");
@@ -82,7 +85,12 @@ namespace PodSleuth
             try {
                 sysinfo = new SysInfo(paths.SysInfoFile);
             } catch {
-                sysinfo = null;
+                try {
+                    sysinfo = new SysInfo(Path.Combine (mount_point, paths.SysInfoFile.Substring (1)));
+                } catch {
+                    Console.WriteLine("** Could not read iPod SysInfo file **");
+                    sysinfo = null;
+                }
             }
         }
         
@@ -115,6 +123,27 @@ namespace PodSleuth
             } catch(Exception e) {
                 Console.WriteLine("** Could not read iPod property list from SCSI code page **");
                 Console.WriteLine(e);
+                plist_dict = null;
+
+                if (sysinfo == null) {
+                    Console.WriteLine("** Could not read iPod properties **");
+                } else {
+                    // Fallback to get 3rd gen iPods working, see http://bugzilla.gnome.org/show_bug.cgi?id=520516
+                    Console.WriteLine("** Reading properties from SysInfo **");
+
+                    try {
+                        string version = sysinfo["visibleBuildID"];
+                        firmware_version = version.Substring(3, 1) + '.' + version.Substring(4, 1);
+                        if (version.Substring(5, 1) != "0") {
+                            firmware_version = firmware_version + '.' + version.Substring(5, 1);
+                        }
+
+                        string fwid = sysinfo["FirewireGuid"].Substring(2, 8);
+                        firewire_id = "000A2700" + fwid;
+                    } catch {}
+                }
+
+                return;
             }
             
             if(ReadPlistBool("PodcastsSupported")) {



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