2018-01-14 04:40:53 +00:00
|
|
|
local kernel = _G.kernel
|
2018-01-21 11:09:25 +00:00
|
|
|
local os = _G.os
|
2018-01-14 04:40:53 +00:00
|
|
|
|
2018-01-14 21:44:43 +00:00
|
|
|
_G.network = { }
|
|
|
|
|
|
|
|
local function startNetwork()
|
|
|
|
kernel.run({
|
|
|
|
title = 'Net daemon',
|
|
|
|
path = 'sys/apps/netdaemon.lua',
|
|
|
|
hidden = true,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2018-01-14 04:40:53 +00:00
|
|
|
kernel.hook('device_attach', function(_, eventData)
|
|
|
|
if eventData[1] == 'wireless_modem' then
|
2018-01-14 21:44:43 +00:00
|
|
|
startNetwork()
|
2018-01-14 04:40:53 +00:00
|
|
|
end
|
|
|
|
end)
|
2018-01-14 21:44:43 +00:00
|
|
|
|
|
|
|
if _G.device.wireless_modem then
|
2018-01-21 22:22:59 +00:00
|
|
|
print('waiting for network...')
|
2018-01-14 21:44:43 +00:00
|
|
|
startNetwork()
|
2018-01-21 11:09:25 +00:00
|
|
|
os.pullEvent('network_up')
|
2018-01-14 21:44:43 +00:00
|
|
|
end
|
2018-01-20 12:18:13 +00:00
|
|
|
|