diff --git a/RadeonResetBugFixService/MainHandler.cs b/RadeonResetBugFixService/MainHandler.cs
index 0b3b474..0e0e7cd 100644
--- a/RadeonResetBugFixService/MainHandler.cs
+++ b/RadeonResetBugFixService/MainHandler.cs
@@ -97,5 +97,32 @@
}
}
}
+
+ public void HandleDiagnose(string reason)
+ {
+ using (var fileLogger = new FileLogger(this.LogFilename))
+ {
+ using (ILogger logger = new TaskLoggerWrapper(fileLogger, "Diagnose"))
+ {
+ logger.Log($"Reason: {reason}");
+ try
+ {
+ lock (this.Mutex)
+ {
+ TasksProcessor.ProcessTasks(
+ logger,
+ new ITask[]
+ {
+ new ListDevicesTask(),
+ });
+ }
+ }
+ catch (Exception e)
+ {
+ logger.LogError(e.ToString());
+ }
+ }
+ }
+ }
}
}
diff --git a/RadeonResetBugFixService/Program.cs b/RadeonResetBugFixService/Program.cs
index cb1ed5a..873fee2 100644
--- a/RadeonResetBugFixService/Program.cs
+++ b/RadeonResetBugFixService/Program.cs
@@ -72,6 +72,10 @@
{
DoShutdown();
}
+ else if (command.Equals("diagnose", StringComparison.OrdinalIgnoreCase))
+ {
+ DoDiagnose();
+ }
else
{
ShowHelp();
@@ -92,6 +96,8 @@
Console.WriteLine("\t\tPerforms startup sequence (development command, does not affect services)");
Console.WriteLine($"\t{exeName} shutdown");
Console.WriteLine("\t\tPerforms shutdown sequence (development command, does not affect services)");
+ Console.WriteLine($"\t{exeName} diagnose");
+ Console.WriteLine("\t\tPerforms diagnose (see result file in logs folder)");
}
private static void DoInstall()
@@ -136,5 +142,10 @@
{
new MainHandler().HandleShutdown("Program.DoShutdown");
}
+
+ private static void DoDiagnose()
+ {
+ new MainHandler().HandleDiagnose("Program.DoDiagnose");
+ }
}
}
diff --git a/RadeonResetBugFixService/RadeonResetBugFixService.csproj b/RadeonResetBugFixService/RadeonResetBugFixService.csproj
index b6e6e21..eceb122 100644
--- a/RadeonResetBugFixService/RadeonResetBugFixService.csproj
+++ b/RadeonResetBugFixService/RadeonResetBugFixService.csproj
@@ -89,6 +89,7 @@
+
diff --git a/RadeonResetBugFixService/Tasks/ListDevicesTask.cs b/RadeonResetBugFixService/Tasks/ListDevicesTask.cs
new file mode 100644
index 0000000..fa9c5c4
--- /dev/null
+++ b/RadeonResetBugFixService/Tasks/ListDevicesTask.cs
@@ -0,0 +1,19 @@
+namespace RadeonResetBugFixService.Tasks
+{
+ using System.Linq;
+ using Contracts;
+ using Devices;
+
+ class ListDevicesTask : ITask
+ {
+ string ITask.TaskName => "Listing devices";
+
+ void ITask.Run(ILogger logger)
+ {
+ foreach (var device in DeviceHelper.GetDevices().ToArray())
+ {
+ logger.Log($"Found device {device.Description}: manufacturer='{device.Manufacturer}', service='{device.Service}', class='{device.ClassName}'");
+ }
+ }
+ }
+}