You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RentoryHub.Hardware.Usb is mostly borrowed from Toolshed's lsusb
defmoduleRentoryHub.Hardware.Usbdo@doc"Find out if a USB device is available"defavailable?(id)doEnum.any?(usb_information(),&match_id_in_information(&1,id))enddefpmatch_id_in_information(%{"PRODUCT"=>pid},id),do: to_vidpid(pid)==iddefpmatch_id_in_information(_,_),do: false@doc"Information about all usb devices available"defusb_informationdoPath.wildcard("/sys/bus/usb/devices/*/uevent")|>Enum.map(&File.read!/1)|>Enum.map(&parse_kv_config/1)|>Enum.filter(&(&1["DEVTYPE"]=="usb_device"))enddefpparse_kv_config(contents)docontents|>String.split("\n")|>Enum.flat_map(&parse_kv/1)|>Enum.into(%{})enddefpparse_kv(""),do: []defpparse_kv(<<"#",_rest::binary>>),do: []defpparse_kv(key_equals_value)do[key,value]=String.split(key_equals_value,"=",parts: 2,trim: true)[{key,value}]enddefpto_vidpid(""),do: "?"defpto_vidpid(raw)do# The VIDPID comes in as "vid/pid/somethingelse"[vid_str,pid_str,_]=String.split(raw,"/",trim: true)vid=String.pad_leading(vid_str,4,"0")pid=String.pad_leading(pid_str,4,"0")vid<>":"<>pidendend
RentoryHub.Hardware.UsbDetector polls usb devices and uses some pubsub to notify other parties. This is use to trigger the usb_modeswitch I need for my modem. It could also detect the modem and "enable" ppp afterwards, but currently there's not really an api for vintagenet to enable/disable ppp.
I'm actually wondering if this should be a concern for vintage_net at all. Maybe the device detection part is one thing and vintage_net_lte should just handle a tty file being available or not (or coming/going).
The text was updated successfully, but these errors were encountered:
As requested on the forums: https://elixirforum.com/t/vintagenet-a-new-network-configuration-library-for-nerves/27535/3
What I have right now are a few related modules:
RentoryHub.Hardware.Usb
is mostly borrowed fromToolshed
'slsusb
RentoryHub.Hardware.UsbDetector
polls usb devices and uses some pubsub to notify other parties. This is use to trigger the usb_modeswitch I need for my modem. It could also detect the modem and "enable" ppp afterwards, but currently there's not really an api for vintagenet to enable/disable ppp.I'm actually wondering if this should be a concern for vintage_net at all. Maybe the device detection part is one thing and vintage_net_lte should just handle a tty file being available or not (or coming/going).
The text was updated successfully, but these errors were encountered: