changeset 470:5da49dd0da64

MAC address calculation helper.
author Aleksandr Rybalko <ray@ddteam.net>
date Mon, 24 Sep 2012 14:22:05 +0300
parents e895670bc057
children a581dc308cff
files profiles/lua_web_ui/files/etc/www/lib/macaddr.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/profiles/lua_web_ui/files/etc/www/lib/macaddr.lua	Mon Sep 24 14:22:05 2012 +0300
@@ -0,0 +1,13 @@
+function tohex(pref, ar, f, t)
+        x = 0;
+        for i=f,t do
+    		x = x * 0x100; x = x + ar:byte(i);
+    	end
+    	io.write(string.format(pref .. '=0x%06x\n', x));
+end
+
+ar = io.read("*all");
+tohex('VENDOR', ar, 1, 3);
+tohex('DEVICE', ar, 4, 6);
+
+