Flash the Chrome EC lightbar when pf blocks a packet
1## pflightbar
2A little utility for OpenBSD on the Chromebook Pixel to flash the lightbar red when
3pf blocks a packet.
4([Demo](https://twitter.com/jcs/status/784821967258017794))
5
6### Usage
7Make sure the `pflog0` device exists (usually created by `/etc/rc.d/pflogd`) and that blocked
8traffic is sent to it via a `pf` rule:
9
10 block return log
11
12Then just run `pflightbar &` as root.
13It will initialize the `pcap` device, open `/dev/chromeec`, `chroot` to `/var/empty`
14and then drop privileges to `nobody`.
15
16`pflightbar` will load some "lightbyte" byte code into the lightbar's `program` sequence
17to flash red through a full ramp up and back down.
18This is used to minimize communication with the EC when flashing, rather than having to
19send the full RGB and dim sequences every time.
20
21When a blocked packet is sent to `pflog0`, `pflightbar` will see it and tell the lightbar
22to run the `program` sequence to flash red, and then return to its normal (`S0`) sequence.