From a151aa1e363988179e9e31098def398cbd5fc8bb Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sun, 17 Jan 2021 21:03:11 -0800 Subject: [PATCH 1/4] small updates --- Properties/AssemblyInfo.cs | 4 ++-- winhiddump.csproj | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 4b4a014..19d53dc 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("hiddump0")] +[assembly: AssemblyTitle("winhiddump")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("hiddump0")] +[assembly: AssemblyProduct("winhiddump")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/winhiddump.csproj b/winhiddump.csproj index 336cd76..2605ec1 100644 --- a/winhiddump.csproj +++ b/winhiddump.csproj @@ -79,7 +79,6 @@ - From 021695b4e4d698890b7b051ebafd90d6cd391458 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sun, 17 Jan 2021 21:27:13 -0800 Subject: [PATCH 2/4] cleanup --- Program.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Program.cs b/Program.cs index 4fe3c0d..ae2dd08 100644 --- a/Program.cs +++ b/Program.cs @@ -12,12 +12,11 @@ class Program static void Main(string[] args) { - // The code provided will print ‘Hello World’ to the console. - // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. - Console.WriteLine("Hello World Tod!"); + Console.WriteLine("WinHIDdump:"); + Console.WriteLine("[{0}]", string.Join(", ", args)); string vidpid = GetArgument(args, "--vidpid"); - Console.WriteLine("Got vidpid: " + vidpid); +// Console.WriteLine("Got vidpid: " + vidpid); var list = DeviceList.Local; foreach (var hidDevice in list.GetHidDevices()) @@ -27,9 +26,8 @@ static void Main(string[] args) Console.WriteLine("Report Descriptor:"); Console.WriteLine(" {0} ({1} bytes)", string.Join(" ", rawReportDescriptor.Select(d => d.ToString("X2"))), rawReportDescriptor.Length); } +// Console.WriteLine("Press any key to exit"); // Console.ReadKey(); - - // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! } } } From 8e8474a1516dfdef2a3cfc8ab20e65a221a6ab2d Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sun, 17 Jan 2021 21:37:09 -0800 Subject: [PATCH 3/4] small cleanup --- Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Program.cs b/Program.cs index ae2dd08..3d99d8f 100644 --- a/Program.cs +++ b/Program.cs @@ -13,7 +13,6 @@ class Program static void Main(string[] args) { Console.WriteLine("WinHIDdump:"); - Console.WriteLine("[{0}]", string.Join(", ", args)); string vidpid = GetArgument(args, "--vidpid"); // Console.WriteLine("Got vidpid: " + vidpid); From 3526a6289d08870cf9087f3e3e23d6cc29cb0e4b Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Mon, 18 Jan 2021 22:33:45 -0800 Subject: [PATCH 4/4] fix descriptor output --- Program.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Program.cs b/Program.cs index 3d99d8f..198890e 100644 --- a/Program.cs +++ b/Program.cs @@ -18,12 +18,20 @@ static void Main(string[] args) // Console.WriteLine("Got vidpid: " + vidpid); var list = DeviceList.Local; - foreach (var hidDevice in list.GetHidDevices()) + foreach (var dev in list.GetHidDevices()) { - Console.WriteLine(hidDevice.ToString() + " @ " + hidDevice.DevicePath); - byte[] rawReportDescriptor = hidDevice.GetRawReportDescriptor(); - Console.WriteLine("Report Descriptor:"); - Console.WriteLine(" {0} ({1} bytes)", string.Join(" ", rawReportDescriptor.Select(d => d.ToString("X2"))), rawReportDescriptor.Length); + Console.Write(string.Format("{0:X4}:{1:X4}: {2} - {3}\nPATH:{4}\n", + dev.VendorID, dev.ProductID, dev.GetManufacturer(), dev.GetProductName(), dev.DevicePath)); +// Console.WriteLine(dev.ToString() + " @ " + dev.DevicePath); + byte[] rawReportDescriptor = dev.GetRawReportDescriptor(); + Console.Write("DESCRIPTOR:\n "); + for( int i=0; i< rawReportDescriptor.Length; i++) + { + Console.Write(rawReportDescriptor[i].ToString("X2") + " "); + Console.Write((i % 16 == 15) ? "\n " : " "); + } + Console.WriteLine("\n ({0} bytes)", rawReportDescriptor.Length); +// Console.WriteLine(" {0} ({1} bytes)", string.Join(" ", rawReportDescriptor.Select(d => d.ToString("X2"))), rawReportDescriptor.Length); } // Console.WriteLine("Press any key to exit"); // Console.ReadKey();