mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 10:57:47 +00:00
WIFI-1032 Repair EC420 MAC retrieval from manufacturing data
Signed-off-by: Rick Sommerville <rick.sommerville@netexperience.com>
This commit is contained in:
82
patches/0039-Add-usr-bin-get_tip-script-for-EC420.patch
Normal file
82
patches/0039-Add-usr-bin-get_tip-script-for-EC420.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
From 9e609d64031168c8bcb83b62740153661bee2486 Mon Sep 17 00:00:00 2001
|
||||
From: Rick Sommerville <rick.sommerville@netexperience.com>
|
||||
Date: Sat, 19 Dec 2020 12:07:07 -0500
|
||||
Subject: [PATCH] Add /usr/bin/get_tip script for EC420
|
||||
|
||||
---
|
||||
files/usr/bin/get_tip | 63 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 63 insertions(+)
|
||||
create mode 100755 files/usr/bin/get_tip
|
||||
|
||||
diff --git a/files/usr/bin/get_tip b/files/usr/bin/get_tip
|
||||
new file mode 100755
|
||||
index 0000000000..e736357cdd
|
||||
--- /dev/null
|
||||
+++ b/files/usr/bin/get_tip
|
||||
@@ -0,0 +1,63 @@
|
||||
+#!/bin/sh
|
||||
+#
|
||||
+# Copyright (C) 2020 TP-Link
|
||||
+#
|
||||
+
|
||||
+
|
||||
+# tftp -g -l /usr/sbin/get_tip -r get_tip 192.168.0.100
|
||||
+# chmod a+x /usr/sbin/get_tip
|
||||
+
|
||||
+MFR_PART="product_info"
|
||||
+
|
||||
+# for TIP data
|
||||
+find_mtd_index()
|
||||
+{
|
||||
+ local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
|
||||
+ local INDEX="${PART##mtd}"
|
||||
+ echo ${INDEX}
|
||||
+}
|
||||
+
|
||||
+find_mtd_part()
|
||||
+{
|
||||
+ local INDEX=$(find_mtd_index "$1")
|
||||
+ local PREFIX=/dev/mtdblock
|
||||
+ [ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
|
||||
+ echo "${INDEX:+$PREFIX$INDEX}"
|
||||
+}
|
||||
+
|
||||
+# split manufacturing data to 2 file (deviceID and tipData)
|
||||
+split_tip_data()
|
||||
+{
|
||||
+ local mtd_name="$1"
|
||||
+ local mfr_part=$(find_mtd_part "$mtd_name")
|
||||
+ if [ -z "$mfr_part" ]; then
|
||||
+ echo "partition $mtd_name not found!" >&2
|
||||
+ #[ -e /tmp/tip_data.bin ] && rm /tmp/tip_data.bin
|
||||
+ #return
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ dd if=$mfr_part of=/tmp/tip_data.bin bs=1 skip=40 2>/dev/null
|
||||
+}
|
||||
+
|
||||
+# get_tip PARTITION_NAME KEY_NAME
|
||||
+if [ $# -eq 1 ]; then
|
||||
+ split_tip_data $MFR_PART
|
||||
+ grep "${1}=" /tmp/tip_data.bin | cut -d '=' -f 2
|
||||
+ return
|
||||
+elif [ $# -eq 2 ]; then
|
||||
+ split_tip_data ${1}
|
||||
+ grep "${2}=" /tmp/tip_data.bin | cut -d '=' -f 2
|
||||
+ return
|
||||
+else
|
||||
+ echo "get_tip PARTITION_NAME KEY_NAME or get_tip KEY_NAME"
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Reference in New Issue
Block a user