
The agent said buy a Wi-Fi dongle. I didn't want to wait for shipping
bcm4360-softap turns a Broadcom BCM4360 Wi-Fi card into an open hotspot on Linux. The card runs on Broadcom's closed wl driver, which officially only does client mode: it joins networks, it doesn't host them. With a small driver patch and a Python program, a phone can now join the card like any open network, and a setup page opens by itself.
I needed it for the Buzz Party Box, the console-style PC I'm building for family to play Buzz! with phones as buzzers. The card in it is an ASUS PCE-AC68, and the box runs Arch Linux.
A console you set up from your phone
I wanted the box to feel like a console. Plug it in, and the setup is easy. And I didn't want to need to bring a keyboard everywhere just to type in a Wi-Fi password.
So the box starts its own hotspot. You join it from your phone, a page opens, and you pick the house Wi-Fi from there. That needs the card to act as an access point, and on Linux this one can't.
Then the SSH connection died
I was working on the box over SSH, and the AI agent was poking at the driver. Then the connection just died. The whole PC had frozen: no error, no log. I walked over, held the power button and waited for it to boot.
That happened 2-3 times, maybe more. Each time the agent figured out which step did it, and those became rules in the code.
Two things freeze the whole PC on this card. Sending a beacon or probe response by hand, and switching the live card from ad-hoc back to client mode. Stopping the hotspot means reloading the driver instead (modprobe -r wl && modprobe wl).
1def send(self, fc: int, a1: bytes, a2: bytes, a3: bytes, body: bytes) -> None:2 if (fc & 0xFC) in (0x80, 0x50):3 raise ValueError("beacons and probe responses are never sent by hand (they hang the PC)")4 self.ioctl(BUZZ_TX, struct.pack("<H", fc) + a1 + a2 + a3 + body, True)
Dongle prices in another tab
Between the freezes, the agent kept saying this is not worth it. I even started looking at USB Wi-Fi dongles and prices. But a dongle meant days of shipping, and I didn't want to wait days. I was also in a good flow, so I decided to give it the final push.
Then it worked. I joined the hotspot from my iPhone, and the page popped up by itself. I was proud the stubbornness paid off. It felt pretty good, like I knew I could do it.
An ad-hoc network pretending to be an access point
The agent wrote the code. I understood the idea: fake a hotspot, and let Python do the part the card won't.
The card can run an ad-hoc network, where devices talk to each other directly. The patch changes the beacons the firmware sends out, so phones see a normal access point instead. It also stops the firmware from kicking out phones it doesn't know, and adds two private commands: one to send any Wi-Fi frame, one to read the current beacon. A Python program answers the phones' join requests and passes their traffic through a virtual network device. dnsmasq hands out addresses and answers every web address with the box itself, which is why the page opens on its own.
The firmware functions it needs are hidden inside Broadcom's binary. build-wl.sh checks the binary's SHA-256 first, then uses objcopy on your own copy to make them callable. The original file stays as it is.
Found on the way
A few things from the repo's notes that are useful beyond this hack:
- iPhones doze while they join. Right after joining, an iPhone flips its power-save bit many times a second while it scans other channels. Anything sent while it "sleeps" is lost. Holding those frames until it wakes, like a real access point does, took the page from opening on the third or fourth try after about 40 seconds to opening on the first join in 2-7 seconds.
- The driver has been half broken since Linux 5.15. The kernel started delivering private driver commands to a different hook, and
wlnever got it. So every privatewlcommand silently stopped working. The first part of the patch adds the hook, and it's safe to use on its own. - No 5 GHz DFS channels. In client mode the card never scans channels 52-144. A router that only uses those is invisible to it.
1/* Since 5.15 the kernel sends SIOCDEVPRIVATE to ndo_siocdevprivate, not2 * ndo_do_ioctl, so Broadcom's private wl ioctls never arrived. */3static int4wl_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data, int cmd)5{6 return wl_ioctl(dev, ifr, cmd);7}
Something to work out from
I asked the agent if it knew of anything like this, and it said no. So I thought I might as well put my findings out there. If someone has the same card and the same problem, they have something to work out from.
It's on GitHub as bcm4360-softap, with the patch, the Python code, a small demo with an "It works" page, and the rules that keep the PC from freezing. The patch only fits one exact version of Broadcom's driver binary, and the build script refuses any other.
The hotspot is open on purpose: anyone in range can join and reach whatever is running on the PC. It doesn't route to the internet or the home network. It's meant to be up only while you pick the house Wi-Fi.
Android, if someone needs it
It's only tested with iPhones. The family is all iPhone users, so there's no Android test planned. But if anyone comes along who needs it to work on Android, I'm open to looking into it.