Skip to content

Instantly share code, notes, and snippets.

@hgn
Created April 2, 2015 20:31
Show Gist options
  • Save hgn/485f6c5c1b5ac69719db to your computer and use it in GitHub Desktop.
Save hgn/485f6c5c1b5ac69719db to your computer and use it in GitHub Desktop.
OpenWRT New Client Signal Generator for Arduino LED
#!/usr/bin/perl
# Nexus 4
$db{'10:68:ff:ff:ff:ff'} = 0;
# Nexus 5
$db{'c4:43:ff:ff:ff:ff'} = 0;
sub worker {
$scan=`(iw dev wlan1 station dump; iw dev wlan0 station dump) | grep Station`;
foreach $key (keys(%db)) {
if (index($scan, $key) != -1) {
print "found " . $key . "\n";
if (not $db{$key}) {
print "new key\n";
system("curl http://led.local/arduino/signal/alarm");
$db{$key} = 1;
}
} else {
$db{$key} = 0;
}
}
}
while (1) {
worker();
sleep(5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment