Skip to content

Commit

Permalink
Exclude 980 Pro from samsung NVMe protocol (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbabcock committed Jun 15, 2022
1 parent 4b0bf58 commit 7ab8fbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions LibreHardwareMonitorLib/Hardware/Storage/NVMeSamsung.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public bool IdentifyController(SafeHandle hDevice, out Kernel32.NVME_IDENTIFY_CO
Marshal.StructureToPtr(buffers, buffer, false);

validTransfer = Kernel32.DeviceIoControl(hDevice, Kernel32.IOCTL.IOCTL_SCSI_PASS_THROUGH, buffer, length, buffer, length, out _, IntPtr.Zero);
if (validTransfer)
if (validTransfer && buffers.DataBuf.Any(x => x != 0))
{
IntPtr offset = Marshal.OffsetOf<Kernel32.SCSI_PASS_THROUGH_WITH_BUFFERS>(nameof(Kernel32.SCSI_PASS_THROUGH_WITH_BUFFERS.DataBuf));
IntPtr newPtr = IntPtr.Add(buffer, offset.ToInt32());
Expand Down Expand Up @@ -240,7 +240,7 @@ public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
{
var result = Marshal.PtrToStructure<Kernel32.SCSI_PASS_THROUGH_WITH_BUFFERS>(buffer);

if (result.DataBuf.Sum(x => (long)x) == 0)
if (result.DataBuf.All(x => x == 0))
{
handle.Close();
handle = null;
Expand Down
6 changes: 5 additions & 1 deletion LibreHardwareMonitorLib/Hardware/Storage/NVMeSmart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ internal NVMeSmart(StorageInfo storageInfo)
_handle = NVMeSamsung.IdentifyDevice(storageInfo);
if (_handle != null)
{
NVMeDrive = new NVMeSamsung();
NVMeDrive = new NVMeSamsung();
if (!NVMeDrive.IdentifyController(_handle, out _))
{
NVMeDrive = null;
}
}
}

Expand Down

0 comments on commit 7ab8fbb

Please sign in to comment.