[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-05-29 23:04:42 +03:00
parent d80801192a
commit 64ce890d44

@ -2827,6 +2827,12 @@ def share_wifi(argv):
default=None,
type=str,
)
parser.add_option(
'--channel',
dest='channel',
default=None,
type=int,
)
parser.add_option(
'--ap-name',
dest='ap_name',
@ -2891,18 +2897,22 @@ def share_wifi(argv):
on_interrupt,
)
hostapd_args = [
'create_ap',
'--hostapd-timestamps',
options.to_wifi,
options.from_eth,
options.ap_name,
pw,
]
if not options.channel is None:
hostapd_args.extend(['-c', '%d' % option.channell])
while True:
try:
if hostapd is None:
print('\n%s, start new' % last_timestamp)
hostapd = subprocess.Popen([
'create_ap',
'--hostapd-timestamps',
options.to_wifi,
options.from_eth,
options.ap_name,
pw,
])
hostapd = subprocess.Popen(hostapd_args)
else:
if restart:
print('\n%s, shutdown current' % last_timestamp)