summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguoqiang.liu <guoqiang.liu@archermind.com>2013-10-22 16:56:25 +0800
committerguoqiang.liu <guoqiang.liu@archermind.com>2013-10-22 17:13:07 +0800
commit81dd4b2d54238bba5e7e90619831eebbd1873719 (patch)
treee1cbc595d7e85c8f996d99dcf19e1f4bbb022436
parent4601ced098c9dab21792d6b8d523e2f514bbc8e1 (diff)
downloadsystem-plugin-ia-generic-81dd4b2d54238bba5e7e90619831eebbd1873719.tar.gz
system-plugin-ia-generic-81dd4b2d54238bba5e7e90619831eebbd1873719.tar.bz2
system-plugin-ia-generic-81dd4b2d54238bba5e7e90619831eebbd1873719.zip
Add tool to modify wlan mac address
There is a bug that all the devicees share the same mac address, here add a scripts to modify the mac address different when device first boot
-rwxr-xr-xetc/rc.d/rc.firstboot2
-rw-r--r--packaging/system-plugin-ia-generic.spec1
-rwxr-xr-xusr/bin/wlan_prov.pl31
3 files changed, 33 insertions, 1 deletions
diff --git a/etc/rc.d/rc.firstboot b/etc/rc.d/rc.firstboot
index 1c83e6b..9959c94 100755
--- a/etc/rc.d/rc.firstboot
+++ b/etc/rc.d/rc.firstboot
@@ -33,7 +33,7 @@ chown root:soundpath /opt/etc/sound/default.conf
chown -R root:soundpath /opt/etc/sound/default
# Generate new wifi mac address
-/usr/sbin/wlan_prov
+/usr/bin/wlan_prov.pl
if [ -e /opt/system/csc/.factoryreset ]; then
rm -f /opt/system/csc/.factoryreset
diff --git a/packaging/system-plugin-ia-generic.spec b/packaging/system-plugin-ia-generic.spec
index 1bf6fab..487573a 100644
--- a/packaging/system-plugin-ia-generic.spec
+++ b/packaging/system-plugin-ia-generic.spec
@@ -81,6 +81,7 @@ systemctl daemon-reload
/etc/rc.d/rc.sysinit
/etc/rc.d/rc.*
/usr/bin/wlan.sh
+/usr/bin/wlan_prov.pl
/usr/lib/systemd/system/firstboot.service
/usr/lib/systemd/system/sysinit.target.wants/firstboot.service
%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh
diff --git a/usr/bin/wlan_prov.pl b/usr/bin/wlan_prov.pl
new file mode 100755
index 0000000..f1cbf5a
--- /dev/null
+++ b/usr/bin/wlan_prov.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $mac = "00:90:4c:c5:12:38";
+my $bcmdhd_file = "lib/firmware/bcmdhd.cal";
+my $tmp_file = $bcmdhd_file."tmp";
+my $modify = 0;
+
+open IN, $bcmdhd_file or die "Can't open file: $!";
+open OUT, ">", $tmp_file or die "Can't open file: $!";
+while(<IN>) {
+ if ($_ =~/$mac/) {
+ my $postfix = sprintf("%02x:%02x:%02x", int(rand(256)),
+ int(rand(256)),
+ int(rand(256)));
+ $_ =~ s/c5:12:38/$postfix/i;
+ $modify = 1;
+ }
+
+ print OUT $_;
+}
+
+close(IN);
+close(OUT);
+
+if ($modify) {
+ rename($tmp_file, $bcmdhd_file) || die "rename failed: $!";
+}
+
+unlink $tmp_file