From patchwork Fri Jun 12 14:00:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 6598881 X-Patchwork-Delegate: kvalo@adurom.com 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 9321E9F2F4 for ; Fri, 12 Jun 2015 14:01:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B049B2034A for ; Fri, 12 Jun 2015 14:01:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFE9F2066F for ; Fri, 12 Jun 2015 14:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754671AbbFLOBF (ORCPT ); Fri, 12 Jun 2015 10:01:05 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:59251 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753542AbbFLOBB (ORCPT ); Fri, 12 Jun 2015 10:01:01 -0400 Received: from a88-113-225-236.elisa-laajakaista.fi ([88.113.225.236] helo=localhost.localdomain) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.85) (envelope-from ) id 1Z3PVx-00057K-Vj; Fri, 12 Jun 2015 17:00:58 +0300 From: Luca Coelho To: aspriel@gmail.com Cc: linux-wireless@vger.kernel.org Date: Fri, 12 Jun 2015 17:00:42 +0300 Message-Id: <1434117644-3033-3-git-send-email-luca@coelho.fi> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434117644-3033-1-git-send-email-luca@coelho.fi> References: <1434117644-3033-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 py80211 2/4] py80211: scan: add sched_scan start class X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on farmhouse.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 a class to start scheduled scans. Signed-off-by: Luciano Coelho --- lib/scan.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/scan.py b/lib/scan.py index 5ccae55..bfaf4da 100644 --- a/lib/scan.py +++ b/lib/scan.py @@ -123,6 +123,7 @@ class scan_start_base(scan_cmd_base): self._flags = 0 self._ies = None self._nl_cmd = None + self._interval = None def _add_scan_attrs(self): if self._ssids: @@ -144,6 +145,9 @@ class scan_start_base(scan_cmd_base): if self._ies: nl.nla_put(self._nl_msg._msg, nl80211.ATTR_IE, self._ies) + if self._interval != None: + nl.nla_put_u32(self._nl_msg._msg, nl80211.ATTR_SCHED_SCAN_INTERVAL, self._interval) + def add_ssids(self, ssids): if self._ssids == None: self._ssids = ssids @@ -183,3 +187,19 @@ class scan_request(scan_start_base): if genlh.cmd in [ nl80211.CMD_SCAN_ABORTED, nl80211.CMD_NEW_SCAN_RESULTS ]: self.scan_busy = False return nl.NL_SKIP + +class sched_scan_start(scan_start_base): + def __init__(self, ifidx, level=nl.NL_CB_DEFAULT): + super(sched_scan_start, self).__init__(ifidx, level) + self._nl_cmd = nl80211.CMD_START_SCHED_SCAN + + def set_interval(self, interval): + self._interval = interval + + def handle(self, msg, arg): + genlh = genl.genlmsg_hdr(nl.nlmsg_hdr(msg)) + + # A schedule scan is complete immediately when it gets started + if genlh.cmd in [ nl80211.CMD_START_SCHED_SCAN ]: + self.scan_busy = False + return nl.NL_SKIP