d3m0li5h3r
d3m0li5h3r

Reputation: 1967

Connecting Raspberry Pi running Android Things to wifi

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!

Upvotes: 2

Views: 2599

Answers (3)

Alex Trujillo
Alex Trujillo

Reputation: 75

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)

Upvotes: 1

Blundell
Blundell

Reputation: 76506

the ssid for

-e ssid <Network_SSID> \

is case sensitive :-)

Try Winterfell

Upvotes: 4

Jan Slominski
Jan Slominski

Reputation: 2978

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.

Upvotes: 0

Related Questions