batteries enimeration issue (windows) wip
This commit is contained in:
parent
3b0eae7462
commit
66b37b7a3c
@ -42,6 +42,9 @@ function parseBluetoothType(str) {
|
|||||||
if (str.indexOf('trackpad') >= 0) {
|
if (str.indexOf('trackpad') >= 0) {
|
||||||
result = 'Trackpad';
|
result = 'Trackpad';
|
||||||
}
|
}
|
||||||
|
if (str.indexOf('audio') >= 0) {
|
||||||
|
result = 'Audio';
|
||||||
|
}
|
||||||
if (str.indexOf('speaker') >= 0) {
|
if (str.indexOf('speaker') >= 0) {
|
||||||
result = 'Speaker';
|
result = 'Speaker';
|
||||||
}
|
}
|
||||||
@ -273,11 +276,15 @@ function bluetoothDevices(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_windows) {
|
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) {
|
if (!error) {
|
||||||
const parts = stdout.toString().split(/\n\s*\n/);
|
const parts = stdout.toString().split(/\n\s*\n/);
|
||||||
parts.forEach((part) => {
|
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')));
|
result.push(parseWindowsBluetooth(part.split('\n')));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user