diff --git a/Makefile b/Makefile index 3c5432d..aa09c9e 100644 --- a/Makefile +++ b/Makefile @@ -106,10 +106,23 @@ spirilink-driver: # Configure SpiriLink interface .PHONY: configure-spirilink +.PHONY: configure-spirilink configure-spirilink: - @echo "\nConfiguring SpiriLink interface as spir0..." - # Detect SpiriLink interface by USB ID - spirilink_iface=$(shell ip link show | grep -B 1 "wlx" | head -n 1 | awk -F': ' '{print $$2}'); \ + @echo "Configuring SpiriLink interface as spir0..." + # Load the kernel module for the 8812EU or 8812AU driver + @if [ "$(DRIVER_TYPE)" = "EU" ]; then \ + echo "Loading 8812EU module..."; \ + $(SUDO) modprobe 8812eu; \ + elif [ "$(DRIVER_TYPE)" = "AU" ]; then \ + echo "Loading 8812AU module..."; \ + $(SUDO) modprobe 8812au; \ + else \ + echo "Unknown driver type. Ensure the correct module is loaded manually."; \ + exit 1; \ + fi; + + # Identify the wireless interface name associated with the driver + spirilink_iface=$$(iw dev | awk '$1=="Interface"{print $2}' | head -n 1); \ if [ -z "$$spirilink_iface" ]; then \ echo "Error: SpiriLink interface not detected."; \ exit 1; \ @@ -118,6 +131,8 @@ configure-spirilink: $(SUDO) ip link set $$spirilink_iface down; \ $(SUDO) ip link set $$spirilink_iface name spir0; \ $(SUDO) ip link set spir0 up; + + # Add spir0 to unmanaged devices in NetworkManager @echo "Adding spir0 to unmanaged devices in NetworkManager..." $(SUDO) mkdir -p /etc/NetworkManager $(SUDO) touch /etc/NetworkManager/NetworkManager.conf @@ -128,10 +143,14 @@ configure-spirilink: echo "unmanaged-devices=interface-name:spir0" | $(SUDO) tee -a /etc/NetworkManager/NetworkManager.conf > /dev/null; \ fi $(SUDO) systemctl restart NetworkManager + + # Configure wifibroadcast to use spir0 @echo "Configuring wifibroadcast default interface..." $(SUDO) bash -c 'echo "WFB_NICS=\"spir0\"" > /etc/default/wifibroadcast' + @echo "\nSpiriLink configuration complete." + # Install SpiriLink software .PHONY: spirilink-software spirilink-software: