On Mon, Sep 7, 2020 at 6:29 PM Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > > Hi, > > > We're trying to move away from ifconfig/iwconfig and switch to use > > ip/iw on our embedded systems. It works good, but we can't really adapt > > our current tools (mostly Python wrappers). iw -h specially says not to > > screenscrape, but we don't really have an alternative, do we? > > Yeah, we _have_ changed the output format sometimes ... I suppose the > only reason iwconfig hasn't is that it's not been changed in 15 years or > so ;-) > > There is a pynl80211 library, but it's not complete and maintained. If > you only need some bits though it might be worthwhile to just do that > internally. Python has supported netlink sockets for some time, IIRC. FYI, We have open-sourced our internal library which takes care of abstracting Netlink attributes, just need to define commands and event messages in JSON, https://github.com/bluwireless/py-genl. The initial port of all messages might be an effort but extending it would be easy. > > > Would it be possible to split iw into a shared library + binary? Then > > it'd be at least possible to create wrappers. Another idea would be to > > have a mode for iw to output json, like 'ip' does. > > I actually played with this at some point, but then wanted to sort of > use json internally so it's not maintained separately and we go through > that ... but the message structure and our intermediate printing makes > that actually quite difficult. > > johannes