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