Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
7533a6af
Commit
7533a6af
authored
May 09, 2015
by
dnc40085
Browse files
Fix for inability to use standard formatted MAC address with
wifi.setmac() also changed wifi.getmac() to use macro
parent
608d5f6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/wifi.c
View file @
7533a6af
...
@@ -219,7 +219,7 @@ static int wifi_getmac( lua_State* L, uint8_t mode )
...
@@ -219,7 +219,7 @@ static int wifi_getmac( lua_State* L, uint8_t mode )
char
temp
[
64
];
char
temp
[
64
];
uint8_t
mac
[
6
];
uint8_t
mac
[
6
];
wifi_get_macaddr
(
mode
,
mac
);
wifi_get_macaddr
(
mode
,
mac
);
c_sprintf
(
temp
,
"%02X-%02X-%02X-%02X-%02X-%02X"
,
mac
[
0
],
mac
[
1
],
mac
[
2
],
mac
[
3
],
mac
[
4
],
mac
[
5
]
);
c_sprintf
(
temp
,
MACSTR
,
MAC2STR
(
mac
)
);
lua_pushstring
(
L
,
temp
);
lua_pushstring
(
L
,
temp
);
return
1
;
return
1
;
}
}
...
@@ -227,11 +227,13 @@ static int wifi_getmac( lua_State* L, uint8_t mode )
...
@@ -227,11 +227,13 @@ static int wifi_getmac( lua_State* L, uint8_t mode )
// Lua: mac = wifi.xx.setmac()
// Lua: mac = wifi.xx.setmac()
static
int
wifi_setmac
(
lua_State
*
L
,
uint8_t
mode
)
static
int
wifi_setmac
(
lua_State
*
L
,
uint8_t
mode
)
{
{
uint8_t
mac
[
6
];
unsigned
len
=
0
;
unsigned
len
=
0
;
const
char
*
mac
=
luaL_checklstring
(
L
,
1
,
&
len
);
const
char
*
mac
addr
=
luaL_checklstring
(
L
,
1
,
&
len
);
if
(
len
!=
6
)
if
(
len
!=
17
)
return
luaL_error
(
L
,
"wrong arg type"
);
return
luaL_error
(
L
,
"wrong arg type"
);
os_str2macaddr
(
mac
,
macaddr
);
lua_pushboolean
(
L
,
wifi_set_macaddr
(
mode
,
(
uint8
*
)
mac
));
lua_pushboolean
(
L
,
wifi_set_macaddr
(
mode
,
(
uint8
*
)
mac
));
return
1
;
return
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment