Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set wifi to Android Things without an ethernet cable or adb [closed]

I'm interested in knowing how to set the first wifi on android things (not android phone) without access to a network cable, for a fresh install.

There certainly must be a way to put the information in the SD card right after copying the OS image. If that can't be done directly, worst case scenario I would expect it should be possible to write a script and copy it somewhere into some of the partitions and have it automatically run at boot (which can be handy for other things). Unless the image is signed?

I would also be ok by writing an app that could be copied to SD card before first boot that would be auto-installed and do that thing for me. I would know how to write the app, but so far I don't know how to do the copy/autoinstall/autorun thing.

I would also be ok having one device connect to network and configure wifi, then clone its SD card into another one.

What really gets in my way is having to get a network cable every time I prepare a new SD card.

like image 701
Fabio Avatar asked Jan 18 '17 23:01

Fabio


2 Answers

You should be able to add your wifi configuration at the end of /data/misc/wifi/wpa_supplicant.conf.

network={
    ssid="SSID"
    key_mgmt=WPA-PSK
    psk="PASSPHRASE"
}

This should be located on the data (ext4) partition of the sdcard (for me /dev/sdb15)

like image 91
proppy Avatar answered Jan 01 '23 18:01

proppy


You can use:

adb connect Android.local

to connect to Android Things PC (Raspberry PI3) and then just set up your WiFi like described in Android Things tutorial:

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

https://developer.android.com/things/hardware/raspberrypi.html

like image 28
Mat Avatar answered Jan 01 '23 18:01

Mat