Last active
April 9, 2017 20:36
-
-
Save sgk/6596426 to your computer and use it in GitHub Desktop.
Patch Arduino Yun to disable WiFi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Process.h> | |
void setup() { | |
Bridge.begin(); | |
Serial.begin(9600); | |
while (!Serial) | |
; | |
Serial.println("Invoking patch script on Yun."); | |
Process p; | |
p.begin("sh"); | |
p.addParameter("-c"); | |
p.addParameter("wifi down; curl -k https://gist.github.com/sgk/6596426/raw/f1f997beb6036366bb0ebee41ac1c117d575c95f/patch.sh | sh -x"); | |
p.run(); | |
while (p.available() > 0) { | |
char c = p.read(); | |
Serial.print(c); | |
} | |
Serial.println("Patch script done."); | |
digitalWrite(13, HIGH); | |
} | |
void loop() { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Patch start" | |
cat > /etc/rc.local << 'XXX' | |
echo "default-on" > /sys/class/leds/ds:green:wlan/trigger | |
XXX | |
cp /dev/null /sbin/wifi | |
chmod 775 /sbin/wifi | |
cat > /lib/firstboot/20_reset_clear_jffs << 'XXX' | |
#!/bin/sh | |
# Copyright (C) 2006-2010 OpenWrt.org | |
# Copyright (C) 2010 Vertical Communications | |
reset_clear_jffs() { | |
[ "$reset_has_fo" = "true" ] && { | |
cp /etc/rc.local /sbin/wifi /lib/firstboot/20_reset_clear_jffs /tmp | |
rm -rf $jffs/* 2>&- | |
mount -o remount $jffs / 2>&- | |
mkdir $jffs/etc | |
cp /tmp/rc.local $jffs/etc/rc.local | |
mkdir $jffs/sbin | |
cp /tmp/wifi $jffs/sbin/wifi | |
mkdir $jffs/lib | |
mkdir $jffs/firstboot | |
cp /tmp/20_reset_clear_jffs $jffs/lib/firstboot/20_reset_clear_jffs | |
exit 0 | |
} || reset_has_fo=false | |
} | |
boot_hook_add jffs2reset reset_clear_jffs | |
XXX | |
echo "default-on" > /sys/class/leds/ds:green:wlan/trigger | |
echo "Patch done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
que cambios debo hacer a este scritp para poder activar mi wifi
soy inexperto por favor requiero de su ayuda