2

I've been trying to connect to my Raspberry Pi running Android Things to wifi but to no avail.

I've followed this guide to connect to Wifi. I had connected my Pi via ethernet port to get the IP address and then was able to connect via adb connect Android.Local. But when starting the WifiSetupService via the below command

adb shell am startservice \
    -n com.google.wifisetup/.WifiSetupService \
    -a WifiSetupService.Connect \
    -e ssid <Network_SSID> \
    -e passphrase <Network_Passcode>

and then getting the logcat output via adb logcat -d | grep Wifi command, I get the below output:

12-28 17:27:19.761 1133 1133 D WifiSetupService: onStartCommand(Intent { act=WifiSetupService.Connect cmp=com.google.wifisetup/.WifiSetupService (has extras) }) 12-28 17:27:19.761 1133 1133 I WifiConfigurator: Connecting to network with SSID "winterfell" 12-28 17:27:19.764 408 1052 D WifiService: setWifiEnabled: true pid=1133, uid=10023 12-28 17:27:19.771 1133 1360 D WifiConfigurator: Updating existing network 0 12-28 17:27:19.845 408 1361 D WifiNetworkHistory: saving network history: "winterfell"WPA_PSK gw: null Network Selection-status: NETWORK_SELECTION_ENABLED ephemeral=false choice:null link:0 status:2 nid:0 hasEverConnected: false 12-28 17:27:19.845 408 1361 V WifiNetworkHistory: writeKnownNetworkHistory write config "winterfell"WPA_PSK 12-28 17:27:19.883 408 1362 D WifiNetworkHistory: saving network history: "winterfell"WPA_PSK gw: null Network Selection-status: NETWORK_SELECTION_ENABLED ephemeral=false choice:null link:0 status:2 nid:0 hasEverConnected: false 12-28 17:27:19.884 408 1362 V WifiNetworkHistory: writeKnownNetworkHistory write config "winterfell"WPA_PSK 12-28 17:27:19.884 408 457 I WifiConnectivityManager: forceConnectivityScan 12-28 17:27:19.886 408 457 E WifiScanner: listener cannot be found 12-28 17:27:49.884 1133 1360 E WifiConfigurator: Wifi failed to connect in 30000 ms

I don't know where I am missing or why Pi is unable to connect to Wifi. I have verified multiple times that I'm sending the correct passphrase to the shell am command.

Any help will be highly appreciated!

d3m0li5h3r
  • 1,957
  • 17
  • 33
  • Can you paste exactly what you are putting in the terminal? (Of course don't forget change password :)) – Jan Slominski Dec 28 '16 at 18:45
  • like Jan said, show us the actual command, is your SSID "winterfell" or contain spaces? – Blundell Dec 28 '16 at 18:49
  • 2
    @Jan the actual command am typing is `adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid winterfell -e passphrase ActualPassphrase`. I've tried encapsulating ssid and passphrase values in single quotes but to no avail. – d3m0li5h3r Dec 29 '16 at 06:09
  • @Blundell.. yes my ssid is "winterfell" and have commented above the exact command i've entered – d3m0li5h3r Dec 29 '16 at 06:10
  • @Blundell After re-flashing my RPi3 and trying to connect it to my device via hotspot is got connected and then it clicked me that SSID I was entering was "incorrect". I was entering winterfell but it is actually Winterfell. I thought just like usernames, SSIDs must be case insensitive. Guess Today I learned. Thanks! – d3m0li5h3r Dec 29 '16 at 18:26
  • np, want me to write it as an answer so we can close off this question? – Blundell Dec 30 '16 at 08:49
  • @Blundell.. yeah sure.. go ahead! – d3m0li5h3r Dec 30 '16 at 13:54

3 Answers3

4

the ssid for

-e ssid <Network_SSID> \

is case sensitive :-)

Try Winterfell

Blundell
  • 75,855
  • 30
  • 208
  • 233
1

I got the same problem but my solution was different, I had an error when I tried to copy the code to the terminal:

adb shell am startservice \
-n com.google.wifisetup/.WifiSetupService \
enter code here
-a WifiSetupService.Connect \
enter code here
-e ssid Network \
-e passphrase Network_Password 

It is important to add an space after: Network_Password, I mean an the end like:

adb shell am startservice \
-n com.google.wifisetup/.WifiSetupService \
enter code here
-a WifiSetupService.Connect \
enter code here
-e ssid Network \
enter code here
-e passphrase Network_Password" " 

(Without Quotation marks, just a space at the end)

Draken
  • 3,134
  • 13
  • 34
  • 54
0

I think I had similar problem. It might be caused by my previous attempts to log to the same network but with wrong SSID/Password (issue with spaces solved here). First I tried to connect to another network, I used hotspot on my Android phone, with WPA2 and simple SSID/Password without any spaces or strange characters just to be sure. It connected without problems but I still couldn't connect to my target access point. What solved my problem was re-flashing the microSD card and trying to connect again but this time with correct SSID/Password for the first time.

Community
  • 1
  • 1
Jan Slominski
  • 2,968
  • 4
  • 35
  • 61
  • I tried connecting my Android device via Hotspot, I couldn't connect to it as well.. so I just re-flashed everything. Then I connected my device, it got connected but was failing to connect to my Wifi and then it clicked me.. SSID is case sensitive. My SSID is Winterfell and not winterfell that I was trying earlier. RPi3 has finally connected to my Wifi – d3m0li5h3r Dec 29 '16 at 18:24