friedrith / node-wifi

📶 NodeJS tool to manage wifi (connections, scans)
MIT License
397 stars 161 forks source link

Fix error when scanning on raspberry or ASUS Tinker Board issue #40 #41

Closed cedricATBQ closed 5 years ago

cedricATBQ commented 6 years ago

On some device like raspberry (raspbian) or ASUS Tinker Board (TinkerOS based on debian) we experienced issues because the list wifi command with nmcli return the interface with the result of the scan like: $ nmcli --terse --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list ifname wlan0 wlan0 yes:NETWORK_1:D4\:6E\:0E\:8E\:66\:EC:Infra:3:2422 MHz:78:WPA2:(none):pair_ccmp group_ccmp psk no:NETWORK_2:DA\:0F\:99\:70\:C4\:C2:Infra:6:2437 MHz:77:WPA2:(none):pair_ccmp group_ccmp psk no:NETWORK_3:40\:C7\:29\:D1\:BC\:A0:Infra:11:2462 MHz:50:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk no:NETWORK_4\:C7\:29\:D5\:03\:08:Infra:1:2412 MHz:47:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk To prevent exeption on missing fields (cannot call .replace of undefined) I just exclude bad lines (not enough fields.

Other fix : linux-connect error. Only tested on ASUS Tinker Board, nmcli command for connection return an error in the stdout and not in the stderr. It means that the error object is never filled. To fix this issue I test if the stdout contains "Error: ", if yes I create a new Error object.

friedrith commented 6 years ago

Sorry for the delay this PL seems almost perfect ;) Could you please change it for the dev branch and not the master branch? And don't increase the version number in the package.json file. I will increase it myself just before publishing with several corrections in the same time.

cedricATBQ commented 6 years ago

I just changed the branch from master to dev for the destination.

manast commented 5 years ago

@friedrith anything else that needs to be done before this can be merged?

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.