Skip to content

Commit

Permalink
Log warning when the method is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
kenelin committed Jul 20, 2018
1 parent 4158061 commit 3deed0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/Htc.Vita.Core/IO/UsbManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,14 @@ private static string GetHidDeviceSerialNumberInWindows(string devicePath)
else
{
var win32Error = Marshal.GetLastWin32Error();
Logger.GetInstance(typeof(UsbManager)).Error("Can not get USB HID serial number, error code: " + win32Error);
if (win32Error == (int) Windows.Error.NotSupported)
{
Logger.GetInstance(typeof(UsbManager)).Warn("The device \"" + devicePath + "\" does not support to get serial number");
}
else
{
Logger.GetInstance(typeof(UsbManager)).Error("Can not get USB HID serial number, error code: " + win32Error);
}
}
Windows.CloseHandle(deviceHandle);
return result;
Expand Down
1 change: 1 addition & 0 deletions source/Htc.Vita.Core/Interop/Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ internal static partial class Windows

internal enum Error
{
/* ERROR_NOT_SUPPORTED (50, 0x32) */ NotSupported = 0x32,
/* ERROR_INSUFFICIENT_BUFFER (122, 0x7a) */ InsufficientBuffer = 0x7a,
/* ERROR_INVALID_NAME (123, 0x7b) */ InvalidName = 0x7b,
/* ERROR_NO_MORE_ITEMS (259, 0x103) */ NoMoreItems = 0x103,
Expand Down

0 comments on commit 3deed0e

Please sign in to comment.