Template for adding access point capability

jb6113 8252794827 after reviewing the code and README I wanted to make some adjustments 2 년 전
turn-it-off-and-on-again 645ca6c115 LED mirroring will seem to sync better now, not tested, but probably 2 년 전
80-usb-wifi-ap-udev.rules a9dbf88da2 hostapd now uses "wireless_wifi" interface instead of default sys named network interfaces 2 년 전
README.md 8252794827 after reviewing the code and README I wanted to make some adjustments 2 년 전
ar9271-blinker.service adf35de232 host side software to blink the led on the 802.11n usb adapter 2 년 전
ar9271-blinker@.service 840fdc69be add some more notes 2 년 전
hostapd.conf a9dbf88da2 hostapd now uses "wireless_wifi" interface instead of default sys named network interfaces 2 년 전
hostapd.service a9dbf88da2 hostapd now uses "wireless_wifi" interface instead of default sys named network interfaces 2 년 전
led-blinker.c 8252794827 after reviewing the code and README I wanted to make some adjustments 2 년 전

README.md

template for adding wireless access points using USB WiFi adapters

For debian variants, install required packages, apt install hostapd wpasupplicant wireless-tools iw bridge-utils firmware-atheros. In this example closed source firmware for Qualcomm Atheros hardware is used. Add a bridge to combine the ethernet and wireless apapters, edit /etc/network/interfaces.

For the access point controller software, use hostapd. Enable the DAEMON_CONF directive in /etc/default/hostapd. Edit configuration file and copy to destination, eg: /etc/hostapd/hostapd.conf.

Closed source firmware is usually trash, Qualcomm is not an exception, they think that their garbave is made of gold. It is not. Adding a udev rule makes it reasonable for a user to reset broken Qualcomm firmware. Make sure to edit the udev rule before placing it, cp 80-usb-wifi-ap-udev.rules /etc/udev/rules.d/.. Reload udev rules, sudo udevadm control --reload-rules.

Get hostapd up and running.

cp hostapd.service /lib/systemd/system/.
systemctl unmask hostapd
systemctl enable hostapd
reboot

hardware reset: turn-it-off-and-on-again

program runs on atmega328p and uses a relay to cut power to the entire 802.11n usb adapter. This causes the onboard ar9271 to powerdown and reset. this process is started anytime the led on the 802.11n usb adapter stops blinking for more than a second. the reset may occur up to once every three minutes.

the following systemd host side processes need to be setup to work with the hardware reset, alternatively the hardware reset will blindly reset the hardware once every three minutes.

led-blinker.c

prevent the hardware reset from the host using a program to blink the led once per second

manually blink the ar9271 led once per second:

echo none |sudo tee /sys/class/leds/ath9k_htc-phy*/trigger
echo 1 |sudo tee /sys/class/leds/ath9k_htc-phy2/brightness
# wait a second
echo 0 |sudo tee /sys/class/leds/ath9k_htc-phy2/brightness
# repeat as necessary ...

programatic blinking: compile with gcc led-blinker.c and copy the executable to /usr/sbin/blinker

systemd

sudo cp ar9271-blinker.service /etc/systemd/system/
sudo cp ar9271-blinker@.service /etc/systemd/system/
sudo cp 80-usb-wifi-ap-udev.rules /etc/udev/rules.d/
sudo udevadm control --reload
sudo systemctl enable ar9271-blinker

it not working when changing the wireless interface, or on a new setup

There was an annoying feature in hostapd.service where the bind-to directive uses a fixed interface name. For running this project on multiple systems we run into a problem with needing to customize each system with the network device name. We work around this by using udev to name the device something special, wireless_wifi and then modify configuration files to use the fixed name. There are several components under systemd that use this name, using hyphens for example is not going to work in the device name. I think kernel naming rules apply. The name we picked is okay, udev rule applies the name when a matching manufacturer's Ethernet Media Access Controller matches.