transition to kernel
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user