podsleuth r56 - in trunk: . src/PodSleuth.Hal/PodSleuth.HalFrontend src/PodSleuth/PodSleuth tests
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: podsleuth r56 - in trunk: . src/PodSleuth.Hal/PodSleuth.HalFrontend src/PodSleuth/PodSleuth tests
- Date: Thu, 5 Jun 2008 00:15:58 +0000 (UTC)
Author: abock
Date: Thu Jun 5 00:15:58 2008
New Revision: 56
URL: http://svn.gnome.org/viewvc/podsleuth?rev=56&view=rev
Log:
2008-06-04 Aaron Bockover <abock gnome org>
* src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs: Do not merge
the iPod_Control path if it is unset; fixes a small bug where if the
directory contents are moved out of the way, the model detection fails
to complete
* src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs: Add some property
exists checks to be slightly more robust
* tests/DeviceDump.cs: Added a small device dumper to test the non-HAL
device stuff
* src/PodSleuth/PodSleuth/Device.cs:
* src/PodSleuth/PodSleuth/DevicePaths.cs: Added ToString override to
dump useful information
Added:
trunk/tests/DeviceDump.cs
Modified:
trunk/ChangeLog
trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs
trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs
trunk/src/PodSleuth/PodSleuth/Device.cs
trunk/src/PodSleuth/PodSleuth/DevicePaths.cs
trunk/tests/Makefile.am
Modified: trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs
==============================================================================
--- trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs (original)
+++ trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs Thu Jun 5 00:15:58 2008
@@ -232,8 +232,13 @@
Console.WriteLine(" - Device Class: {0}", volume[HalNamespace + "ipod.model.device_class"]);
if(!volume.GetPropertyBoolean(HalNamespace + "ipod.is_unknown")) {
- Console.WriteLine(" - Generation: {0}", volume.GetPropertyDouble(HalNamespace + "ipod.model.generation"));
- Console.WriteLine(" - Shell Color: {0}", volume[HalNamespace + "ipod.model.shell_color"]);
+ if(volume.PropertyExists(HalNamespace + "ipod.model.generation")) {
+ Console.WriteLine(" - Generation: {0}", volume.GetPropertyDouble(HalNamespace + "ipod.model.generation"));
+ }
+
+ if(volume.PropertyExists("ipod.model.shell_color")) {
+ Console.WriteLine(" - Shell Color: {0}", volume[HalNamespace + "ipod.model.shell_color"]);
+ }
} else {
Console.WriteLine(" - Model information could not be determined");
Console.WriteLine(" Try a `podsleuth --update --rescan` or visit");
Modified: trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs
==============================================================================
--- trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs (original)
+++ trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs Thu Jun 5 00:15:58 2008
@@ -117,9 +117,11 @@
}
}
- hal_device.SetPropertyString(HalNamespace + "ipod.control_path",
- pod_device.Paths.IpodControlDirectory);
-
+ if(!String.IsNullOrEmpty(pod_device.Paths.IpodControlDirectory)) {
+ hal_device.SetPropertyString(HalNamespace + "ipod.control_path",
+ pod_device.Paths.IpodControlDirectory);
+ }
+
hal_device.SetPropertyString(HalNamespace + "ipod.firmware_version",
pod_device.FirmwareVersion);
Modified: trunk/src/PodSleuth/PodSleuth/Device.cs
==============================================================================
--- trunk/src/PodSleuth/PodSleuth/Device.cs (original)
+++ trunk/src/PodSleuth/PodSleuth/Device.cs Thu Jun 5 00:15:58 2008
@@ -1,4 +1,5 @@
using System;
+using System.Text;
using System.Collections.Generic;
using PodSleuth.ModelData;
@@ -32,6 +33,28 @@
this.mount_point = mountPoint;
}
+ public override string ToString ()
+ {
+ StringBuilder builder = new StringBuilder ();
+
+ builder.Append ("[Paths]");
+ builder.AppendLine ();
+ builder.Append (paths);
+ builder.AppendLine ();
+
+ builder.Append ("[SysInfo]");
+ builder.AppendLine ();
+ builder.Append (sysinfo);
+ builder.AppendLine ();
+
+ builder.Append ("[Model]");
+ builder.AppendLine ();
+ builder.Append (model);
+ builder.AppendLine ();
+
+ return builder.ToString ();
+ }
+
public void Load()
{
FindPaths();
Modified: trunk/src/PodSleuth/PodSleuth/DevicePaths.cs
==============================================================================
--- trunk/src/PodSleuth/PodSleuth/DevicePaths.cs (original)
+++ trunk/src/PodSleuth/PodSleuth/DevicePaths.cs Thu Jun 5 00:15:58 2008
@@ -23,6 +23,16 @@
root_directory = mountPoint;
DiscoverPaths();
}
+
+ public override string ToString ()
+ {
+ StringBuilder builder = new StringBuilder ();
+ builder.AppendFormat ("Root Directory: {0}\n", root_directory);
+ builder.AppendFormat ("iPod_Control Directory: {0}\n", ipod_control_directory);
+ builder.AppendFormat ("Device Directory: {0}\n", device_directory);
+ builder.AppendFormat ("SysInfo File: {0}\n", sysinfo_file);
+ return builder.ToString ();
+ }
private void DiscoverPaths()
{
Added: trunk/tests/DeviceDump.cs
==============================================================================
--- (empty file)
+++ trunk/tests/DeviceDump.cs Thu Jun 5 00:15:58 2008
@@ -0,0 +1,16 @@
+using System;
+using PodSleuth;
+
+public static class DeviceDumpTest
+{
+ public static void Main(string [] args)
+ {
+ string device = args[0];
+ string mount = args[1];
+
+ Device ps_device = new Device (device, mount);
+ ps_device.Load ();
+ Console.WriteLine (ps_device);
+ }
+}
+
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Thu Jun 5 00:15:58 2008
@@ -7,9 +7,12 @@
PLIST_DUMP_ASM = plist-dump.exe
PLIST_DUMP_SRC = PlistDump.cs
+DEVICE_DUMP_ASM = device-dump.exe
+DEVICE_DUMP_SRC = DeviceDump.cs
+
REF = $(top_builddir)/src/PodSleuth/PodSleuth.dll
-all: link-ref $(SERIAL_ASM) $(PLIST_ASM) $(PLIST_DUMP_ASM)
+all: link-ref $(SERIAL_ASM) $(PLIST_ASM) $(PLIST_DUMP_ASM) $(DEVICE_DUMP_ASM)
$(SERIAL_ASM): $(SERIAL_SRC)
$(MCS) -out:$@ -r:$(notdir $(REF)) $<
@@ -20,19 +23,24 @@
$(PLIST_DUMP_ASM): $(PLIST_DUMP_SRC)
$(MCS) -out:$@ -r:$(notdir $(REF)) $<
+$(DEVICE_DUMP_ASM): $(DEVICE_DUMP_SRC)
+ $(MCS) -out:$@ -r:$(notdir $(REF)) $<
+
link-ref:
@ln -sf $(REF) $(notdir $(REF))
EXTRA_DIST = \
$(SERIAL_SRC) \
$(PLIST_SRC) \
- $(PLIST_DUMP_SRC)
+ $(PLIST_DUMP_SRC) \
+ $(DEVICE_DUMP_SRC)
CLEANFILES = \
$(notdir $(REF)) \
$(SERIAL_ASM){,.mdb} \
$(PLIST_ASM){,.mdb} \
- $(PLIST_DUMP_ASM){,.mdb}
+ $(PLIST_DUMP_ASM){,.mdb} \
+ $(DEVICE_DUMP_ASM){,.mdb}
MAINTAINERCLEANFILES = \
Makefile \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]