Skip to content

Instantly share code, notes, and snippets.

@sgk
Last active April 9, 2017 20:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save sgk/6596426 to your computer and use it in GitHub Desktop.
Save sgk/6596426 to your computer and use it in GitHub Desktop.
Patch Arduino Yun to disable WiFi
#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() {
}
#!/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."
@imerdm
Copy link

imerdm commented Aug 9, 2016

que cambios debo hacer a este scritp para poder activar mi wifi
soy inexperto por favor requiero de su ayuda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment