Skip to content

Commit

Permalink
Hopefully WoL is fixed now
Browse files Browse the repository at this point in the history
  • Loading branch information
marioquake committed Feb 21, 2014
1 parent de9c072 commit 6a71cd0
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions XBMC-JSON/XBMC-JSON-FRODO.c4i
Original file line number Diff line number Diff line change
@@ -1184,6 +1184,20 @@ function OnConnectionStatusChanged(idBinding, nPort, strStatus)
C4:NetConnect(6001, tonumber(jsonPort))
end
end

elseif (idBinding == 6003) then
if (strStatus == "ONLINE") then
-- wake on lan support comes from a WOL driver written by
-- a guy named Will from homemation.
dbg("Sending Wake on LAN magic packet")
local MAC = Properties["XBMC MAC Address"]
MAC = MAC:gsub(":", "") -- Remove any colons in the entered MAC addresses
MAC = tohex(MAC) -- Convert to HEX
packet = string.rep(string.char(255), 6) .. string.rep(MAC, 16) -- Build 'magic packet'.
hexdump (packet)
C4:SendToNetwork (6003, 9, packet)
C4:NetDisconnect(6003, 9)
end
end
end

@@ -1195,19 +1209,7 @@ function ReceivedFromProxy(idBinding, strCommand, tParams)
dbg('Got ON Command: ' .. "")

if (Properties["Wake on LAN"] == "Enabled") then

-- wake on lan support comes from a WOL driver written by
-- a guy named Will from homemation.
dbg("Sending Wake on LAN magic packet")
local MAC = Properties["XBMC MAC Address"]
C4:NetConnect(6003, 9, "UDP")
MAC = MAC:gsub(":", "") -- Remove any colons in the entered MAC addresses
MAC = tohex(MAC) -- Convert to HEX
packet = string.rep(string.char(255), 6) .. string.rep(MAC, 16) -- Build 'magic packet'.
hexdump (packet)
C4:SendToNetwork (6003, 9, packet)
-- C4:SendToNetwork (6003, 9, packet)
C4:NetDisconnect(6003, 9)
end
-- TODO: Turn off screensaver
-- TODO: Find current input mode

0 comments on commit 6a71cd0

Please sign in to comment.