transition to kernel

This commit is contained in:
kepler155c@gmail.com
2018-01-13 15:17:26 -05:00
parent fc8d44b60d
commit bd37b57780
20 changed files with 336 additions and 223 deletions

View File

@@ -127,6 +127,8 @@ local function getProxy(pi)
error("Timed out attaching peripheral: " .. pi.uri)
end
-- write the uri of the periperal we are requesting...
-- ie. type/monitor
socket:write(pi.path)
local proxy = socket:read(3)
@@ -134,6 +136,10 @@ local function getProxy(pi)
error("Timed out attaching peripheral: " .. pi.uri)
end
if type(proxy) == 'string' then
error(proxy)
end
local methods = proxy.methods
proxy.methods = nil
@@ -166,6 +172,9 @@ local function getProxy(pi)
socket:read()
end)
end
if not socket.connected then
error("Timed out communicating with peripheral: " .. pi.uri)
end
table.insert(queue, {
fn = method,
@@ -222,7 +231,7 @@ end
function Peripheral.lookup(uri)
local pi = parse(uri)
if pi.host then
if pi.host and _G.device.wireless_modem then
return getProxy(pi)
end