3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-01-03 10:32:33 +01:00

auto-t: hostapd.py: update Process changes

This commit is contained in:
James Prestwood 2021-08-25 15:17:24 -07:00 committed by Denis Kenzior
parent 7d94aee5b6
commit 665f63ff97

View File

@ -132,18 +132,18 @@ class HostapdCLI(object):
def set_value(self, key, value): def set_value(self, key, value):
cmd = self.cmdline + ['set', key, value] cmd = self.cmdline + ['set', key, value]
ctx.start_process(cmd, wait=True) ctx.start_process(cmd).wait()
def wps_push_button(self): def wps_push_button(self):
ctx.start_process(self.cmdline + ['wps_pbc'], wait=True) ctx.start_process(self.cmdline + ['wps_pbc']).wait()
def wps_pin(self, pin): def wps_pin(self, pin):
cmd = self.cmdline + ['wps_pin', 'any', pin] cmd = self.cmdline + ['wps_pin', 'any', pin]
ctx.start_process(cmd, wait=True) ctx.start_process(cmd).wait()
def deauthenticate(self, client_address): def deauthenticate(self, client_address):
cmd = self.cmdline + ['deauthenticate', client_address] cmd = self.cmdline + ['deauthenticate', client_address]
ctx.start_process(cmd, wait=True) ctx.start_process(cmd).wait()
def eapol_reauth(self, client_address): def eapol_reauth(self, client_address):
cmd = 'IFNAME=' + self.ifname + ' EAPOL_REAUTH ' + client_address cmd = 'IFNAME=' + self.ifname + ' EAPOL_REAUTH ' + client_address
@ -152,12 +152,13 @@ class HostapdCLI(object):
def reload(self): def reload(self):
# Seemingly all three commands needed for the instance to notice # Seemingly all three commands needed for the instance to notice
# interface's address change # interface's address change
ctx.start_process(self.cmdline + ['reload'], wait=True) ctx.start_process(self.cmdline + ['reload']).wait()
ctx.start_process(self.cmdline + ['disable'], wait=True) ctx.start_process(self.cmdline + ['disable']).wait()
ctx.start_process(self.cmdline + ['enable'], wait=True) ctx.start_process(self.cmdline + ['enable']).wait()
def list_sta(self): def list_sta(self):
proc = ctx.start_process(self.cmdline + ['list_sta'], wait=True, need_out=True) proc = ctx.start_process(self.cmdline + ['list_sta'])
proc.wait()
if not proc.out: if not proc.out:
return [] return []
@ -166,7 +167,7 @@ class HostapdCLI(object):
def set_neighbor(self, addr, ssid, nr): def set_neighbor(self, addr, ssid, nr):
cmd = self.cmdline + ['set_neighbor', addr, 'ssid="%s"' % ssid, 'nr=%s' % nr] cmd = self.cmdline + ['set_neighbor', addr, 'ssid="%s"' % ssid, 'nr=%s' % nr]
ctx.start_process(cmd, wait=True) ctx.start_process(cmd).wait()
def send_bss_transition(self, device, nr_list): def send_bss_transition(self, device, nr_list):
# Send a BSS transition to a station (device). nr_list should be an # Send a BSS transition to a station (device). nr_list should be an
@ -189,7 +190,8 @@ class HostapdCLI(object):
(addr, bss_info, op_class, chan_num, phy_num)] (addr, bss_info, op_class, chan_num, phy_num)]
pref += 1 pref += 1
proc = ctx.start_process(cmd, wait=True, need_out=True) proc = ctx.start_process(cmd)
proc.wait()
if 'OK' not in proc.out: if 'OK' not in proc.out:
raise Exception('BSS_TM_REQ failed, is hostapd built with CONFIG_WNM_AP=y?') raise Exception('BSS_TM_REQ failed, is hostapd built with CONFIG_WNM_AP=y?')
@ -199,13 +201,14 @@ class HostapdCLI(object):
Send a RRM Beacon request Send a RRM Beacon request
''' '''
cmd = self.cmdline + ['req_beacon', addr, request] cmd = self.cmdline + ['req_beacon', addr, request]
ctx.start_process(cmd, wait=True) ctx.start_process(cmd).wait()
@property @property
def bssid(self): def bssid(self):
cmd = self.cmdline + ['status'] cmd = self.cmdline + ['status']
status = ctx.start_process(cmd, wait=True, need_out=True).out proc = ctx.start_process(cmd)
status = status.split('\n') proc.wait()
status = proc.out.split('\n')
bssid = [x for x in status if x.startswith('bssid')] bssid = [x for x in status if x.startswith('bssid')]
bssid = bssid[0].split('=') bssid = bssid[0].split('=')
@ -214,8 +217,9 @@ class HostapdCLI(object):
@property @property
def frequency(self): def frequency(self):
cmd = self.cmdline + ['status'] cmd = self.cmdline + ['status']
status = ctx.start_process(cmd, wait=True, need_out=True).out proc = ctx.start_process(cmd)
status = status.split('\n') proc.wait()
status = proc.out.split('\n')
frequency = [x for x in status if x.startswith('freq')][0] frequency = [x for x in status if x.startswith('freq')][0]
frequency = frequency.split('=')[1] frequency = frequency.split('=')[1]