Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No WiFi networks found #10

Open
tomaskaminskas opened this issue Oct 1, 2015 · 3 comments
Open

No WiFi networks found #10

tomaskaminskas opened this issue Oct 1, 2015 · 3 comments

Comments

@tomaskaminskas
Copy link

I have successfully installed raspberry-wifi-conf on RPi with raspbian-jessie according to manual, started node with server.js, AP is started, I connect to AP go to 192.168.44.1:88, and no WiFi networks are found, I click Rescan, see on node.js console that rescan wifi was requested, but nothing happens, where should I search for the problem?

@sabhiram
Copy link
Owner

sabhiram commented Oct 5, 2015

I would try and narrow down this issue to see if the server actually gets the request to scan for networks. See this file: https://github.com/sabhiram/raspberry-wifi-conf/blob/master/app/api.js#L45

That is the API endpoint in the server which triggers an "iwlist scan" (see here: https://github.com/sabhiram/raspberry-wifi-conf/blob/master/app/iwlist.js#L22).

However, it might be a couple of other issues:

  1. You might need to run as sudo for iwlist scan to work - are you running the service as sudo?
  2. I noticed another thread online which might speak of a similar issue (see this: http://raspberrypi.stackexchange.com/questions/23125/raspbian-linux-no-wifi-scan-results-from-iwlist-wlan0-scan)

Hope this helps. I am super swamped at my new company and have 0 time to repro and debug this. Please let me know if this worked for you! I appreciate you taking the time to open this issue and help out!

@panikpanther
Copy link

Might have the following reason:
Some wifi-adapter do not support scanning via "iwlist scan" if in ap-mode.
Right now, i try to refactor the code to use "iw dev wlan0 scan ap-force" instead.
I update this post if i have success.

EDIT:
Instead of refactoring the code i decided to do it 'the easy way':
Like mentioned before, I call iw instead of of iwlist and parse the output, so it looks like the iwlist output.
(using Debian with gawk installed)

Replace the following line in iwlist.js
javascript exec("iwlist scan", function(error, stdout, stderr) {
with
javascript exec("sudo iw dev wlan0 scan ap-force | gawk -f parseIW.awk", function(error, stdout, stderr) {

and place the following script in your project folder:

#############################################################################
#   parseIW.awk
#   
#   Description:
#    Get the result of 'iw .. scan' and output it in 'iwlist scan' style
#   
#   Usage:
#    sudo iw dev wlan0 scan ap-force | gawk -f parseIW.awk
#
#   Note:
#    - Unlike iwlist, iw is called for a specific adapter. 
#      For me it's ok, since most of the code assumes there is a adapter called 'wlan0'
#    - Quality indicator is not given with iw, and is set to 'not available'
#      (no problem if you remove it, since it's not used in the module)
#    - And of course, all the leading spaces in output are not necessary ;)
##############################################################################

$1 == "BSS" {
    macadr = $2
    cells[macadr]["macaddress"] = $2
    cells[macadr]["enc"] = "off"
}
$1 == "SSID:" {
    cells[macadr]["ssid"] = $2
}
$1 == "signal:" {
    cells[macadr]["signal_level"] = $2 " " $3
}
$1 == "WPA:" {
    cells[macadr]["enc"] = "on"
}
$1 == "WEP:" {
    cells[macadr]["enc"] = "on"
}

END {
    i = 1
    printf "myadapter     Scan completed :\n"
    for (c in cells) {
        printf "Cell %02d - Address: %s\n", i, substr(cells[c]["macaddress"], 1,17)
        printf "          Quality=%s\n", "not available"
        printf "          Signal level=%s\n", cells[c]["signal_level"]
        printf "          Encryption key:%s\n", cells[c]["enc"]
        printf "          ESSID:\"%s\"\n", cells[c]["ssid"]
        i++
    }
}

@sabhiram
Copy link
Owner

Thanks for the update! I think the hardest part would be to correctly figure out which type of adapter supports what type of scan. That is a bit too involved for me at the moment as I am super swamped with work.

I will look into this when I get some time.

marko8904 added a commit to marko8904/raspberry-wifi-conf that referenced this issue Mar 6, 2016
…askaminskas in issue sabhiram#10: sabhiram#10 ).

- adding the awk script which converts iw dev wlan0 scan ap-force into iwlist scan style output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants