2019-04-07 14:09:47 +00:00
|
|
|
local device = _G.device
|
|
|
|
local kernel = _G.kernel
|
|
|
|
|
|
|
|
local function register(v)
|
2019-06-18 19:19:24 +00:00
|
|
|
if v and v.isWireless and v.isAccessPoint and v.getNamesRemote then
|
|
|
|
v._children = { }
|
|
|
|
for _, name in pairs(v.getNamesRemote()) do
|
|
|
|
local dev = v.getMethodsRemote(name)
|
|
|
|
if dev then
|
|
|
|
dev.name = name
|
2019-07-28 01:07:34 +00:00
|
|
|
dev.side = v.side
|
2019-06-18 19:19:24 +00:00
|
|
|
dev.type = v.getTypeRemote(name)
|
|
|
|
device[name] = dev
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-04-07 14:09:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
for _,v in pairs(device) do
|
2019-06-18 19:19:24 +00:00
|
|
|
register(v)
|
2019-04-07 14:09:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- register oc devices as peripherals
|
|
|
|
kernel.hook('device_attach', function(_, eventData)
|
2019-07-16 02:08:30 +00:00
|
|
|
register(device[eventData[1]])
|
2019-04-07 14:09:47 +00:00
|
|
|
end)
|