Skip to content

Commit

Permalink
usb() fixed duplicated entries (windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhildebrandt committed Aug 2, 2024
1 parent 6f93a93 commit 3ef84b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ si.cpu()

(last 7 major and minor version releases)

- Version 5.23.0: `usb()` added serial number (linux)
- Version 5.22.0: `wifiConnections()` added signal quality
- Version 5.21.0: `graphics()` added subVendor (linux)
- Version 5.20.0: `mem()` added writeback and dirty (linux)
Expand Down
3 changes: 1 addition & 2 deletions lib/usb.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ function getDarwinUsbType(name) {
return result;
}


function parseDarwinUsb(usb, id) {
const result = {};
result.id = id;
Expand Down Expand Up @@ -258,7 +257,7 @@ function usb(callback) {
const parts = stdout.toString().split(/\n\s*\n/);
for (let i = 0; i < parts.length; i++) {
const usb = parseWindowsUsb(parts[i].split('\n'), i);
if (usb) {
if (usb && result.filter(x => x.deviceId === usb.deviceId).length === 0) {
result.push(usb);
}
}
Expand Down

0 comments on commit 3ef84b0

Please sign in to comment.