0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 02:53:49 +01:00

ID generation logging

This commit is contained in:
peteruithoven 2015-06-15 10:37:51 +02:00
parent 6a546bcca5
commit 4ca599e962

View File

@ -25,14 +25,14 @@ local deviceName, deviceApi
local cachedApSsid, baseApSsid = nil, nil
function M.getSubstitutedSsid(unformattedSsid)
log:debug("getSubstitutedSsid unformattedSsid:'" .. unformattedSsid .. "' baseApSsid:'" .. (baseApSsid or "nil") .. "' cachedApSsid:'" .. (cachedApSsid or "nil"))
if unformattedSsid == baseApSsid and cachedApSsid ~= nil then return cachedApSsid end
if not unformattedSsid or type(unformattedSsid) ~= 'string' then return nil end
local macTail = M.getMacAddress():sub(7)
log:debug(" macTail:'" .. macTail)
baseApSsid = unformattedSsid
cachedApSsid = unformattedSsid:gsub('%%%%MAC_ADDR_TAIL%%%%', macTail)
return cachedApSsid
end
@ -107,7 +107,9 @@ end
--returns the wireless device's MAC address (as string, without colons)
--(lua numbers on openWrt seem to be 32bit so they cannot represent a MAC address as one number)
function M.getMacAddress()
log:debug("getMacAddress")
local macText = utils.readFile('/sys/class/net/' .. deviceName .. '/address')
log:debug(" macText: '" .. (macText or "nil") .. "'")
local out = ''
-- Hack to prevent failure in case the MAC address could not be obtained.