Hello, I am fairly new to OC but have a fair amount of experience coding. I am working on setting up a Server to start familiarizing myself with the addon. I have the server configured, installed in the rack, OS installed, powered up and running no problems. I would like to have a screen/keyboard setup at the server itself, as well as having another setup elsewhere in the world and be able to use them both to interface with the server.
I was hoping to do this using RC and a little service listening for "touch" signals from the monitors to use as the trigger to rebind the GPU/Screen.
I have tried several things and can not get this to work as desired. Here is a code example to try and visualize what I am doing. Is this the best approach? What am I doing wrong?
local event = require("event")
local term = require("term")
local component = require("component")
local gpu1 = component.proxy("gpu1's addy")
local gpu2 = component.proxy("gpu2's addy")
local screen1 = component.proxy("screen1's addy")
local screen2 = component.proxy("screen2's addy")
local function handleEvent(name, address)
if address ~= term.screen() then
if address == screen1.address then
gpu1.bind(screen1.address)
component.setPrimary("gpu",gpu1.address)
elseif address == screen2.address then
gpu2.bind(screen2.address)
component.setPrimary("gpu",gpu2.address)
end
end
end
event.listen("touch",handleEvent)
I have tried to use term.bind() and have not had any luck with it either. Sometimes nothing will happen, sometimes just the gpu will change over but not the keyboard(have tried to setPrimary on the keyboard with no luck).
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hello, I am fairly new to OC but have a fair amount of experience coding. I am working on setting up a Server to start familiarizing myself with the addon. I have the server configured, installed in the rack, OS installed, powered up and running no problems. I would like to have a screen/keyboard setup at the server itself, as well as having another setup elsewhere in the world and be able to use them both to interface with the server.
I was hoping to do this using RC and a little service listening for "touch" signals from the monitors to use as the trigger to rebind the GPU/Screen.
I have tried several things and can not get this to work as desired. Here is a code example to try and visualize what I am doing. Is this the best approach? What am I doing wrong?
I have tried to use term.bind() and have not had any luck with it either. Sometimes nothing will happen, sometimes just the gpu will change over but not the keyboard(have tried to setPrimary on the keyboard with no luck).
Any help would be greatly appreciated.
Link to post
Share on other sites