From 7131f5ae083dc9841a0941bb70884c0451b211ad Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Wed, 31 Jul 2024 05:50:42 +0200 Subject: [PATCH] usb: added serialNumber (linux) --- CHANGELOG.md | 1 + README.md | 2 +- docs/history.html | 5 +++++ docs/index.html | 2 +- docs/usb.html | 2 +- lib/usb.js | 7 ++++++- 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0515750..f263a48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.23.0 | 2024-07-31 | `usb()` added serialNumber (linux) | | 5.22.11 | 2024-06-10 | `osInfo()` added macOS Sequoia | | 5.22.10 | 2024-05-31 | `powerShellStart()` fixed kill issue | | 5.22.9 | 2024-05-13 | `memLayout()` fixed typo manufacturer | diff --git a/README.md b/README.md index 54b48fe..65cb1d4 100644 --- a/README.md +++ b/README.md @@ -545,7 +545,7 @@ Full function reference with examples can be found at [https://systeminformation | | [0].manufacturer | X | | X | X | | manufacturer | | | [0].maxPower | X | | | | | max power | | | [0].default | X | | X | X | | is default printer | -| | [0].serialNumber | | | X | | | serial number | +| | [0].serialNumber | X | | X | | | serial number | #### 11. Printer diff --git a/docs/history.html b/docs/history.html index b951be4..72e12bd 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.23.0 + 2024-07-31 + usb() added serialNumber linux + 5.22.11 2024-06-10 diff --git a/docs/index.html b/docs/index.html index 69e8c25..f384f02 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.22.11
+
New Version: 5.23.0
diff --git a/docs/usb.html b/docs/usb.html index abe2ae8..5223d77 100644 --- a/docs/usb.html +++ b/docs/usb.html @@ -170,7 +170,7 @@ [0].serialNumber - + X X diff --git a/lib/usb.js b/lib/usb.js index 7a8e942..b0ade9a 100644 --- a/lib/usb.js +++ b/lib/usb.js @@ -77,6 +77,11 @@ function parseLinuxUsb(usb) { iManufacturerParts.shift(); const manufacturer = iManufacturerParts.join(' '); + const iSerial = util.getValue(lines, 'iSerial', ' ', true).trim(); + let iSerialParts = iSerial.split(' '); + iSerialParts.shift(); + const serial = iSerialParts.join(' '); + result.id = (idVendor.startsWith('0x') ? idVendor.split(' ')[0].substr(2, 10) : '') + ':' + (idProduct.startsWith('0x') ? idProduct.split(' ')[0].substr(2, 10) : ''); result.name = product; result.type = getLinuxUsbType(usbType, product); @@ -84,7 +89,7 @@ function parseLinuxUsb(usb) { result.vendor = vendor; result.manufacturer = manufacturer; result.maxPower = util.getValue(lines, 'MaxPower', ' ', true); - result.serialNumber = null; + result.serialNumber = serial; return result; }