Skip to content

ConnorRigby/elixir-fwup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fwup

CircleCI Hex version

Simple Elixir wrapper around FWUP

Usage

With a file on the filesystem:

iex()> fw = "/path/to/fwup_file.fw"
iex()> [[dev, _size]] = Fwup.devices()
iex()> {:ok, pid} = Fwup.apply(dev, "upgrade", fw)
iex()> flush
iex()> {:fwup, {:progress, 0}}
iex()> {:fwup, {:progress, 100}}
iex()> {:fwup, {:ok, 0, ""}}

With a Elixir File.stream:

iex()> fw = "/path/to/fwup_file.fw"
iex()> [[dev, _size]] = Fwup.devices()
iex()> args = ["-a", "-t", "complete", "-d", dev]
iex()> {:ok, fwup} = Fwup.stream(self(), args)
iex()> File.stream!(fw, [:bytes], 4096)
iex..>  |> Stream.map(fn chunk ->
iex..>    Fwup.send_chunk(fwup, chunk)
iex..>  end)
iex..>  |> Stream.run()
iex()> flush()
{:progress, 0}
{:progress, 1}
# many more
{:progress, 100}
{:ok, 0, ""}

Installation

If available in Hex, the package can be installed by adding fwup to your list of dependencies in mix.exs:

def deps do
  [
    {:fwup, "~> 1.0.1"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/fwup.

About

Wrapper around FWUP for Elixir

Topics

Resources

License

Stars

Watchers

Forks

Contributors