From: Luciano Coelho <luciano.coelho@xxxxxxxxx> Modify the sched_scan_start class so that the caller can pass a list of matches to be used in the scheduled scan request. Signed-off-by: Luciano Coelho <luciano.coelho@xxxxxxxxx> --- lib/scan.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/scan.py b/lib/scan.py index bfaf3d2..b55d148 100644 --- a/lib/scan.py +++ b/lib/scan.py @@ -192,10 +192,34 @@ 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 + self._matches = None def set_interval(self, interval): self._interval = interval + def add_matches(self, matches): + self._matches = matches + + def _add_matches_attrs(self): + if self._matches: + i = 0 + + matchset = nl.nla_nest_start(self._nl_msg._msg, nl80211.ATTR_SCHED_SCAN_MATCH) + for match in self._matches: + nest = nl.nla_nest_start(self._nl_msg._msg, i) + if 'ssid' in match: + nl.nla_put(self._nl_msg._msg, nl80211.SCHED_SCAN_MATCH_ATTR_SSID, match['ssid']) + i += 1 + nl.nla_nest_end(self._nl_msg._msg, nest) + + nl.nla_nest_end(self._nl_msg._msg, matchset) + + def send(self): + self._prepare_cmd() + self._add_scan_attrs() + self._add_matches_attrs() + self._send_and_wait() + def handle(self, msg, arg): genlh = genl.genlmsg_hdr(nl.nlmsg_hdr(msg)) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html