power_control
power_control copied to clipboard
Unable to fetch cpu_info
Thanks for making this! And for the presentation at NervesConf 👍
Not sure what's going on here, but seems like it's likely a quick fix. I'm using 0.2.0 on nerves_system_rpi3 1.17.1 and while I can fetch information about the cpus and the cpu governors, I can't fetch cpu info. Also it's a little confusing because the docs for list_cpus/0 and cpu_info1 use atoms but I'm getting strings back from list_cpus:
iex([email protected])6> PowerControl.list_cpus
{:ok, ["cpu3", "cpu1", "cpu2", "cpu0"]}
iex([email protected])7> PowerControl.cpu_info("cpu0")
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:ok, ["cpu3", "cpu1", "cpu2", "cpu0"]} of type Tuple. This protocol is implemented for the following type(s): Ecto.Adapters.SQL.Stream, Exqlite.Stream, DBConnection.Stream, DBConnection.PrepareStream, Timex.Interval, CircularBuffer, HashSet, Range, Map, Function, List, Stream, Date.Range, HashDict, GenEvent.Stream, MapSet, File.Stream, IO.Stream
(elixir 1.12.3) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.12.3) lib/enum.ex:141: Enumerable.reduce/3
(elixir 1.12.3) lib/enum.ex:1105: Enum.find/3
(power_control 0.2.0) lib/power/cpu.ex:86: PowerControl.CPU.cpu_info/1
iex([email protected])7> PowerControl.cpu_info(:cpu0)
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:ok, ["cpu3", "cpu1", "cpu2", "cpu0"]} of type Tuple. This protocol is implemented for the following type(s): Ecto.Adapters.SQL.Stream, Exqlite.Stream, DBConnection.Stream, DBConnection.PrepareStream, Timex.Interval, CircularBuffer, HashSet, Range, Map, Function, List, Stream, Date.Range, HashDict, GenEvent.Stream, MapSet, File.Stream, IO.Stream
(elixir 1.12.3) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.12.3) lib/enum.ex:141: Enumerable.reduce/3
(elixir 1.12.3) lib/enum.ex:1105: Enum.find/3
(power_control 0.2.0) lib/power/cpu.ex:86: PowerControl.CPU.cpu_info/1