From 64ce890d446abcc8d491ae62ea647fc3fa9ee8a8 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Wed, 29 May 2024 23:04:42 +0300 Subject: [PATCH] [~] Refactor --- dotfiles/.local/bin/commands | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/dotfiles/.local/bin/commands b/dotfiles/.local/bin/commands index afc5a57..d6cd208 100755 --- a/dotfiles/.local/bin/commands +++ b/dotfiles/.local/bin/commands @@ -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)