From 66b37b7a3c7141df43697e4f8dc2462498c260e3 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Wed, 31 Dec 2025 13:41:17 +0100 Subject: [PATCH] batteries enimeration issue (windows) wip --- lib/bluetooth.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/bluetooth.js b/lib/bluetooth.js index ee3b974..c6db539 100644 --- a/lib/bluetooth.js +++ b/lib/bluetooth.js @@ -42,6 +42,9 @@ function parseBluetoothType(str) { if (str.indexOf('trackpad') >= 0) { result = 'Trackpad'; } + if (str.indexOf('audio') >= 0) { + result = 'Audio'; + } if (str.indexOf('speaker') >= 0) { result = 'Speaker'; } @@ -273,11 +276,15 @@ function bluetoothDevices(callback) { }); } if (_windows) { - util.powerShell('Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => { + util.powerShell('Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer, Status, Service, CinfigManagerErrorCode, Present | fl').then((stdout, error) => { if (!error) { const parts = stdout.toString().split(/\n\s*\n/); parts.forEach((part) => { - if (util.getValue(part.split('\n'), 'PNPClass', ':') === 'Bluetooth') { + const lines = part.split('\n'); + const service = util.getValue(lines, 'Service', ':'); + const errorCode = util.getValue(lines, 'CinfigManagerErrorCode', ':'); + const pnpClass = util.getValue(lines, 'PNPClass', ':').toLowerCase(); + if (pnpClass === 'Bluetooth' && errorCode === '0' && service === '') { result.push(parseWindowsBluetooth(part.split('\n'))); } });