raspberry wifi fix (wip)
This commit is contained in:
parent
26d49b0e25
commit
afd105319c
10
lib/wifi.js
10
lib/wifi.js
@ -115,8 +115,8 @@ function wifiFrequencyFromChannel(channel) {
|
||||
function getWifiNetworkAlt(iface) {
|
||||
const result = [];
|
||||
try {
|
||||
let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan; unset LC_ALL`).toString().split(' Cell ');
|
||||
if (iwlistParts[0].indexOf('resource busy')) { return -1; }
|
||||
let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`).toString().split(' Cell ');
|
||||
if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; }
|
||||
if (iwlistParts.length > 1) {
|
||||
iwlistParts.shift();
|
||||
for (let i = 0; i < iwlistParts.length; i++) {
|
||||
@ -211,7 +211,7 @@ function wifiNetworks(callback) {
|
||||
const rsnFlags = util.getValue(lines, 'RSN-FLAGS').replace('(', '').replace(')', '');
|
||||
result.push({
|
||||
ssid: util.getValue(lines, 'SSID'),
|
||||
bssid: util.getValue(lines, 'BSSID'),
|
||||
bssid: util.getValue(lines, 'BSSID').toLowerCase(),
|
||||
mode: util.getValue(lines, 'MODE'),
|
||||
channel: channel ? parseInt(channel, 10) : null,
|
||||
frequency: frequency ? parseInt(frequency, 10) : null,
|
||||
@ -291,7 +291,7 @@ function wifiNetworks(callback) {
|
||||
wpaFlags = Array.from(new Set(wpaFlags));
|
||||
result.push({
|
||||
ssid: line.substring(parsedhead[0].from, parsedhead[0].to).trim(),
|
||||
bssid: line.substring(parsedhead[1].from, parsedhead[1].to).trim(),
|
||||
bssid: line.substring(parsedhead[1].from, parsedhead[1].to).trim().toLowerCase(),
|
||||
mode: '',
|
||||
channel,
|
||||
frequency: wifiFrequencyFromChannel(channel),
|
||||
@ -322,7 +322,7 @@ function wifiNetworks(callback) {
|
||||
if (lines && lines.length >= 8 && lines[0].indexOf(':') >= 0) {
|
||||
let bssid = lines[4].split(':');
|
||||
bssid.shift();
|
||||
bssid = bssid.join(':').trim();
|
||||
bssid = bssid.join(':').trim().toLowerCase();
|
||||
const channel = lines[7].split(':').pop().trim();
|
||||
const quality = lines[5].split(':').pop().trim();
|
||||
result.push({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user