Pre-configure WiFi connection from Windows

I’m setting up a RPi 2 for a friend.

They are not technically savvy so I’m trying to make this as painless as possible for them to setup since I’m mailing this to them.

I was hoping to pre-configure their WiFi connection so the RPi will boot and connect automatically.
Then they can use their phone to control the RPi via the Kodi Remote app.

Is it possible to do this?
When I did the OSMC install I put their WiFi credentials in but idk if that is being saved anywhere for use later.

Any help would be greatly appreciated.

Thanks!

Yes, you can do this using the preseeding options in the Windows installer.

These are used on the first boot if the network and appropriate WiFi adapter is present. The Pi 2 doesn’t have built in WiFi so make sure they have an adapter that works.

Thank you Sam.

To clarify:
When you say “first boot” are you referring to first boot ever into OSMC setup or when the RPi boots and is searching for a SSID?

These are the steps I’ve taken so far:

-I added their WiFi info in the installer
-Plugged in the WiFi adapter then booted the RPi
-Connected to my WiFi to finish all the other setup tasks I needed

Now when I send it off to them and they boot, it will find their SSID?

No. It’s only for first boot.
You could create a ConnMan connection however.

/var/lib/connman/wifi.service

[service_wifi]
Type = wifi
Name = SSIDName
Passphrase = secret
IPv4 = 192.168.2.2/255.255.255.0/192.168.2.1

That’s what I was afraid of

Excellent, thank you Sam!
I’m assuming I need to SSH into the RPi and install ConnMan?

ConnMan is already installed and is the default, supported connection manager. You just need to make the appropriate file with the necessary details.

Sam

Fantastic news, Thank you Sam!

So with that said I ejected the SD card and opened it on my Windows machine.
Then I created the directory structure you showed (/var/lib/connman/) in the SD root.
Next, using notepad made the wifi.service file with the contents you provided.

Will that do the trick?

No, the file need to be in (/var/lib/connman/)

That folder is on the ext4 partition that is not reachable from Windows. So if you want to do that you would need to connect to the booted Pi via ssh.

BTW, are you aware that you can connect to WiFi via MyOSMC which doesn’t really require to be tech savvy

Ok since I didn’t see it in root I assumed it needed to be made.

Got ya I will proceed that way, thank you @fzinken !

Yes I am aware but the problem is they don’t have any keyboards or mice laying around (assume zero tech savvy) to interface with the RPi once it boots up so I was hoping to have all the settings done so all they have to do is discover the device over the network via the Kodi Remote app, which I can walk them through over the phone.

Not that there’s anything wrong with manually adding iit ahead of time, but I just wanted to chime in and say there should not be an issue with enabling wifi via My OSMC with a Kodi phone app. I just checked it right now with the official Kodi remote on iOS and I was able to navigate to enable wireless, choose my ssid, and when I told it to connect it popped up the virtual keyboard on my phone to enter the passphrase which transmitted that input to Kodi. No problems at all.

Well the slight issue is the Kodi App would not be able to connect if you are not connected to the Wifi in the new place :wink:

So only trick there could be:

  1. He configured the same SSID/Password on his router when doing the setup (easiest approach)
  2. They use a Hotspot with his SSID/Password for the connection with Kodi App to then reconfigure to their Wifi.
2 Likes

2 Likes

Yeah that IS the easiest😆
I have a triband router, I could have set one SSID to mimic theirs!

Won’t work, unless you change your routers MAC to match.

Do you mean Connman stores the Router MAC in his configuration? I doubt it because than roaming would not work.

It stores it as part of the service name which is why he needs to use a provisioning profile instead.

Well good thing I didn’t go that far!

I’ve finally made some time to get back to this project. I’ll SSH in and make the file as discussed.

Thanks!

No worries the method with the temporary SSID I discribed should work @sam_nazarko most likely mixed up topics.

1 Like