Skip to content

Commit

Permalink
Merge pull request #7 from imro2/2
Browse files Browse the repository at this point in the history
Don't bail on exception
  • Loading branch information
todbot authored Sep 27, 2022
2 parents 951d1c4 + 29f3d3a commit 7c13fec
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ static void Main(string[] args)
continue;
}

string manufacturer = "(unnamed manufacturer)";
try { manufacturer = dev.GetManufacturer(); } catch { }

string productName = "(unnamed product)";
try { productName = dev.GetProductName(); } catch { }

Console.Write(string.Format("{0:X4}:{1:X4}: {2} - {3}\nPATH:{4}\n",
dev.VendorID, dev.ProductID, dev.GetManufacturer(), dev.GetProductName(), dev.DevicePath));
byte[] rawReportDescriptor = dev.GetRawReportDescriptor();
dev.VendorID, dev.ProductID, manufacturer, productName, dev.DevicePath));
byte[] rawReportDescriptor = new byte[] { };
try
{
rawReportDescriptor = dev.GetRawReportDescriptor();
} catch (Exception e){
Console.Write("Unable to parse HID Report: {0}", e);
}
Console.Write("DESCRIPTOR:\n ");
for( int i=0; i< rawReportDescriptor.Length; i++)
{
Expand Down

0 comments on commit 7c13fec

Please sign in to comment.