[~] 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, default=None,
type=str, type=str,
) )
parser.add_option(
'--channel',
dest='channel',
default=None,
type=int,
)
parser.add_option( parser.add_option(
'--ap-name', '--ap-name',
dest='ap_name', dest='ap_name',
@ -2891,18 +2897,22 @@ def share_wifi(argv):
on_interrupt, 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: while True:
try: try:
if hostapd is None: if hostapd is None:
print('\n%s, start new' % last_timestamp) print('\n%s, start new' % last_timestamp)
hostapd = subprocess.Popen([ hostapd = subprocess.Popen(hostapd_args)
'create_ap',
'--hostapd-timestamps',
options.to_wifi,
options.from_eth,
options.ap_name,
pw,
])
else: else:
if restart: if restart:
print('\n%s, shutdown current' % last_timestamp) print('\n%s, shutdown current' % last_timestamp)