Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3189452pxk; Mon, 7 Sep 2020 05:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrzA+6SFULAuaZALDoJktk+MiBBMkadsesT9Jv4itoBw6okxAc3VpVJDcUqHZi/TK3N0zh X-Received: by 2002:a17:906:c289:: with SMTP id r9mr16963642ejz.402.1599483571341; Mon, 07 Sep 2020 05:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599483571; cv=none; d=google.com; s=arc-20160816; b=rLuA33/UaLnJNnfPYLm3OiQMyIxINsUAL9ycpaEzcvH12Dm5Vrw01ZUW4128THcdO8 q2a0vSpvd/awdfoTMiIjCgoM2xSpp9szBvMloU6i+XfRedmX59+lHKkpIHX3WvJPhJP3 xVuexHEms7G16mEzBsqnXWpZVpejHgWIQqCSGi+faangOtBbKz3F75UeyxMZwethAGg4 LKCPlKw9Ooy3fUKs6OtW7waaM0jbQiRC2lfE3uqtvIXn+yUBlxG62iSKokLQhTOqEA0A lsxvKHtUOJbb8VRRZf5fGbk6L6go1Lc0BpjpBtC4+2t8NqFQCjuHxFADwq8mXlYIyzIT eRgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=xZ4sHN6zNCipKsTx4se67XwW14sc3a/Z9oAAJEZJSVs=; b=0PU75/5OepbbGKbEl95dIwjlg69bwZboyw97hdtKrfC73ueMTD13TzfmaW70bB6uD+ 2nmmDCDjsCjfIlebSSFbEUErT66n9va/OBZIOU5yxjSRzGKDLBfzSJT3esnBCHwUkW4n 2VcwnqQ/QwqM5OXZARQ62bLwMc862LXsP/9ZzVYciSQ4ACEHbW7SfoDUwBEE2ga4uNJ/ tEZF03S8kF4uhH03sRUX1LlsRT6ZEybqBVdZ7V6rVSvPZ77eeCROqNeIt1H3G3L5cbQ7 qrfL+8RWzZzu3aZs/gJua0hbGEku4EzqHm7cIXbeFJSQUg/8fFujYOG/R6fNwO3jnXbb /Gpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si9724760edq.395.2020.09.07.05.58.56; Mon, 07 Sep 2020 05:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729397AbgIGM6P (ORCPT + 99 others); Mon, 7 Sep 2020 08:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729318AbgIGM5u (ORCPT ); Mon, 7 Sep 2020 08:57:50 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 399AEC061756 for ; Mon, 7 Sep 2020 05:57:50 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kFGiP-00HPTA-7K; Mon, 07 Sep 2020 14:57:45 +0200 Message-ID: <55e3de67208c2120857102d13a896553fbf223b4.camel@sipsolutions.net> Subject: Re: alternatives to screenscraping iw? From: Johannes Berg To: Paul Cercueil Cc: linux-wireless@vger.kernel.org, od@zcrc.me Date: Mon, 07 Sep 2020 14:57:44 +0200 In-Reply-To: <04HAGQ.ASDIWY4TQH8H3@crapouillou.net> References: <04HAGQ.ASDIWY4TQH8H3@crapouillou.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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. > 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