From patchwork Tue Mar 17 14:11:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 6032111 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 286A89F54F for ; Tue, 17 Mar 2015 14:12:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70305203FB for ; Tue, 17 Mar 2015 14:12:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D8832034F for ; Tue, 17 Mar 2015 14:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932158AbbCQOMO (ORCPT ); Tue, 17 Mar 2015 10:12:14 -0400 Received: from dedo.coelho.fi ([88.198.205.34]:44727 "EHLO dedo.coelho.fi" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753791AbbCQOMJ (ORCPT ); Tue, 17 Mar 2015 10:12:09 -0400 Received: from a88-113-225-236.elisa-laajakaista.fi ([88.113.225.236] helo=dubbel.amr.corp.intel.com) by dedo.coelho.fi with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.80) (envelope-from ) id 1YXsE4-0004L5-16; Tue, 17 Mar 2015 16:12:08 +0200 From: Luca Coelho To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org Date: Tue, 17 Mar 2015 16:11:48 +0200 Message-Id: <1426601510-8251-3-git-send-email-luca@coelho.fi> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426601510-8251-1-git-send-email-luca@coelho.fi> References: <1426601510-8251-1-git-send-email-luca@coelho.fi> X-SA-Exim-Connect-IP: 88.113.225.236 X-SA-Exim-Mail-From: luca@coelho.fi X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Subject: [PATCH iw v2 2/4] iw: implement scheduled scan X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on dedo.coelho.fi) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luciano Coelho Add sched_start, sched_stop and events parsing for scheduled scan. For now, only passive scans are supported. Signed-off-by: Luciano Coelho --- event.c | 9 +++++++++ info.c | 6 ++++++ scan.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/event.c b/event.c index 71ab7f7..929854b 100644 --- a/event.c +++ b/event.c @@ -359,6 +359,15 @@ static int print_event(struct nl_msg *msg, void *arg) } printf("\n"); break; + case NL80211_CMD_START_SCHED_SCAN: + printf("scheduled scan started\n"); + break; + case NL80211_CMD_SCHED_SCAN_STOPPED: + printf("sched scan stopped\n"); + break; + case NL80211_CMD_SCHED_SCAN_RESULTS: + printf("got scheduled scan results\n"); + break; case NL80211_CMD_REG_CHANGE: printf("regulatory domain change: "); diff --git a/info.c b/info.c index 1df503f..66887e3 100644 --- a/info.c +++ b/info.c @@ -232,6 +232,12 @@ next: if (tb_msg[NL80211_ATTR_MAX_SCAN_IE_LEN]) printf("\tmax scan IEs length: %d bytes\n", nla_get_u16(tb_msg[NL80211_ATTR_MAX_SCAN_IE_LEN])); + if (tb_msg[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS]) + printf("\tmax # sched scan SSIDs: %d\n", + nla_get_u8(tb_msg[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS])); + if (tb_msg[NL80211_ATTR_MAX_MATCH_SETS]) + printf("\tmax # match sets: %d\n", + nla_get_u8(tb_msg[NL80211_ATTR_MAX_MATCH_SETS])); if (tb_msg[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]) { unsigned int frag; diff --git a/scan.c b/scan.c index d1c3bf2..e534fd4 100644 --- a/scan.c +++ b/scan.c @@ -1980,3 +1980,32 @@ COMMAND(scan, trigger, "[freq *] [ies ] [meshid ] NL80211_CMD_TRIGGER_SCAN, 0, CIB_NETDEV, handle_scan, "Trigger a scan on the given frequencies with probing for the given\n" "SSIDs (or wildcard if not given) unless passive scanning is requested."); + + +static int handle_start_sched_scan(struct nl80211_state *state, + struct nl_cb *cb, struct nl_msg *msg, + int argc, char **argv, enum id_input id) +{ + return parse_sched_scan(msg, &argc, &argv); +} + +static int handle_stop_sched_scan(struct nl80211_state *state, struct nl_cb *cb, + struct nl_msg *msg, int argc, char **argv, + enum id_input id) +{ + if (argc != 0) + return 1; + + return 0; +} + +COMMAND(scan, sched_start, + SCHED_SCAN_OPTIONS, + NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan, + "Start a scheduled scan at the specified interval on the given frequencies\n" + "with probing for the given SSIDs (or wildcard if not given) unless passive\n" + "scanning is requested. If matches are specified, only matching results\n" + "will be returned."); +COMMAND(scan, sched_stop, "", + NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan, + "Stop an ongoing scheduled scan.");