Git Product home page Git Product logo

nerves_interim_wifi's Introduction

Nerves.InterimWiFi

Build Status Hex version

Connect to WiFi networks on Nerves platforms.

Installation

  1. Add nerves_interim_wifi to your list of dependencies in mix.exs:

    def deps do
      [{:nerves_interim_wifi, "~> 0.2.0"}]
    end
  2. Ensure nerves_interim_wifi is started before your application:

def application do
  [applications: [:nerves_interim_wifi]]
end
  1. Set the regulatory domain in your config.exs. This should be set to the ISO 3166-1 alpha-2 country code where the device is running. If your device ships to more than one country, see Nerves.InterimWiFi.set_regulatory_domain\1.
    • if unset, the default regulatory domain is the world domain, "00"
    config :nerves_interim_wifi,
      regulatory_domain: "US"

Setup

Before WiFi will work, you will need to load any modules for your device if they aren't loaded already. Here's an example for Raspberry Pi 0 and Rasbperry Pi 3

{_, 0} = System.cmd("modprobe", ["brcmfmac"])

Scanning

You can scan by running:

iex> {:ok, _pid} = Nerves.InterimWiFi.setup "wlan0"
iex> Nerves.InterimWiFi.scan "wlan0"
[%{age: 42, beacon_int: 100, bssid: "00:1f:90:db:45:54", capabilities: 1073,
   flags: "[WEP][ESS]", freq: 2462, id: 8,
   ie: "00053153555434010882848b0c1296182403010b07",
   level: -83, noise: 0, qual: 0, ssid: "1SUT4", tsf: 580579066269},
 %{age: 109, beacon_int: 100, bssid: "00:18:39:7a:23:e8", capabilities: 1041,
   flags: "[WEP][ESS]", freq: 2412, id: 5,
   ie: "00076c696e6b737973010882848b962430486c0301",
   level: -86, noise: 0, qual: 0, ssid: "linksys", tsf: 464957892243},
 %{age: 42, beacon_int: 100, bssid: "1c:7e:e5:32:d1:f8", capabilities: 1041,
   flags: "[WPA2-PSK-CCMP][ESS]", freq: 2412, id: 0,
   ie: "000768756e6c657468010882848b960c1218240301",
   level: -43, noise: 0, qual: 0, ssid: "dlink", tsf: 580587711245}]

Running

Setup your WiFi connection by running:

Nerves.InterimWiFi.setup "wlan0", ssid: "my_accesspoint_name", key_mgmt: :"WPA-PSK", psk: "secret"

If your WiFi network does not use a secret key, specify the key_mgmt to be :NONE. Currently, wireless configuration passes almost unaltered to wpa_supplicant.ex, so see that project for more configuration options.

Limitations

Currently, only IPv4 is supported, and IP addresses can only be assigned via DHCP. The library is incredibly verbose in its logging to help debug issues on new platforms in prep for a first release. This will change. The library is mostly interim in its structure. Please consider submitting PRs and helping make this work reliably across embedded devices.

nerves_interim_wifi's People

Contributors

fhunleth avatar mobileoverlord avatar connorrigby avatar entone avatar electricshaman avatar

Watchers

Amos King avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.