|
|
@ -148,8 +148,9 @@ function network.send_wol(mac_str, bcast_ip, port) |
|
|
if not network.is_socket_available() then |
|
|
if not network.is_socket_available() then |
|
|
utils.log("Socket module not available, using external wol tool") |
|
|
utils.log("Socket module not available, using external wol tool") |
|
|
local cmd = string.format("wol -i %s -p %d %s", bcast_ip, port, mac_str) |
|
|
local cmd = string.format("wol -i %s -p %d %s", bcast_ip, port, mac_str) |
|
|
local result = os.execute(cmd) |
|
|
local ok, reason, code = os.execute(cmd) |
|
|
return result == 0, result ~= 0 and "wol command failed" or nil |
|
|
return ok and reason == "exit" and code == 0, |
|
|
|
|
|
(not ok or reason ~= "exit" or code ~= 0) and "wol command failed" or nil |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
-- Create IPv4 UDP socket (udp4 if available), bind to IPv4 wildcard to lock AF_INET |
|
|
-- Create IPv4 UDP socket (udp4 if available), bind to IPv4 wildcard to lock AF_INET |
|
|
|