Sitemap
Ted James

Ted James

The world is my office, and every destination is my inspiration

Member-only story

Setting wifi ssid with a space in it

1 min readMay 8, 2024

I am trying to setup the wifi on my android things raspberry pi following href=”https://developer.android.com/things/hardware/raspberrypi.html#connecting_wi-fi" rel=”nofollow noreferrer”>the documentation.

My Ssid contains a space in the name let’s say “my ssid”.

I tried to put quotes around it like this:

$ adb shell am startservice \
-n com.google.wifisetup/.WifiSetupService \
-a WifiSetupService.Connect \
-e ssid "my ssid" \
-e passphrase secretpassword

When looking at the logcat for the wifi connection I see:

WifiNetworkHistory: saving network history: "my"NONE gw: null Network Selection-status: NETWORK_SELECTION_ENABLED ephemeral=false choice:null link:0 status:2 nid:0 hasEverConnected: false
WifiConfigurator: Wifi failed to connect in 30000 ms

How can I set my wifi correctly?

Solution

To enter characters like “(double quotes),*(asterisk), (space), we need to use escape sequences( i.e a backslash before the character) to tell the compiler to read the character as a part of the string instead of a command (for example double quotes is usually interpreted as the start/end of a string, to interpret it as a character in the string we use \”).

The solution

$ adb shell am startservice \
-n com.google.wifisetup/.WifiSetupService \
-a WifiSetupService.Connect \
-e ssid "my\ ssid" \
-e passphrase secretpassword

Answered By — Shankara Narayana

Answer Checked By — Willingham (FixIt Volunteer)

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

--

--

Ted James
Ted James

Written by Ted James

The world is my office, and every destination is my inspiration