From 88aa2a26534098f9b8b69d4d020ae55ad372dc9e Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Sat, 18 Jan 2020 18:18:19 +0100 Subject: [PATCH] MycroftOS: Fix wifi startup with broadcom driver. wpa_supplicant doesn't play nice if runned twice. One with the physical device, secondly with the virtual device. Therefor we only start wpa_supplicant of ap0 only when there is no wlan wpa config file present. --- buildroot-external/package/wifi-ap/wifi-ap.mk | 8 ++++++-- .../package/wifi-ap/wpa_supplicant-ap0.service | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 buildroot-external/package/wifi-ap/wpa_supplicant-ap0.service diff --git a/buildroot-external/package/wifi-ap/wifi-ap.mk b/buildroot-external/package/wifi-ap/wifi-ap.mk index 2f9ea3ff..f2bd9bf0 100644 --- a/buildroot-external/package/wifi-ap/wifi-ap.mk +++ b/buildroot-external/package/wifi-ap/wifi-ap.mk @@ -15,13 +15,17 @@ define WIFI_AP_INSTALL_TARGET_CMDS $(INSTALL) -m 644 -D $(@D)/wpa_supplicant-ap0.conf \ $(TARGET_DIR)/etc/wpa_supplicant/wpa_supplicant-ap0.conf + $(INSTALL) -D -m 644 $(@D)/wpa_supplicant-ap0.service \ + $(TARGET_DIR)/usr/lib/systemd/system/wpa_supplicant-ap0.service mkdir -p $(TARGET_DIR)/etc/systemd/system/sys-subsystem-net-devices-ap0.device.wants - ln -fs ../../../../usr/lib/systemd/system/wpa_supplicant@.service \ - $(TARGET_DIR)/etc/systemd/system/sys-subsystem-net-devices-ap0.device.wants/wpa_supplicant@ap0.service + ln -fs ../../../../usr/lib/systemd/system/wpa_supplicant-ap0.service \ + $(TARGET_DIR)/etc/systemd/system/sys-subsystem-net-devices-ap0.device.wants/wpa_supplicant-ap0.service + $(INSTALL) -D -m 644 $(@D)/wifi-setup.service \ $(TARGET_DIR)/usr/lib/systemd/system/wifi-setup.service ln -fs ../../../../usr/lib/systemd/system/wifi-setup.service \ $(TARGET_DIR)/etc/systemd/system/sys-subsystem-net-devices-ap0.device.wants/wifi-setup.service + $(INSTALL) -D -m 644 $(@D)/dnsmasq.service \ $(TARGET_DIR)/usr/lib/systemd/system/dnsmasq.service ln -fs ../../../../usr/lib/systemd/system/dnsmasq.service \ diff --git a/buildroot-external/package/wifi-ap/wpa_supplicant-ap0.service b/buildroot-external/package/wifi-ap/wpa_supplicant-ap0.service new file mode 100644 index 00000000..1adeefe7 --- /dev/null +++ b/buildroot-external/package/wifi-ap/wpa_supplicant-ap0.service @@ -0,0 +1,18 @@ +[Unit] +Description=WPA supplicant daemon (interface-specific version) +Requires=sys-subsystem-net-devices-ap0.device +After=sys-subsystem-net-devices-ap0.device +Before=network.target +Wants=network.target + +# check existence of configuration file +ConditionPathExists=!/etc/wpa_supplicant/wpa_supplicant-wlan0.conf + +# NetworkManager users will probably want the dbus version instead. + +[Service] +Type=simple +ExecStart=/usr/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-ap0.conf - + +[Install] +WantedBy=sys-subsystem-net-devices-ap0.device