Apologies for the kinda-double post, but the problem I initially described in "[OC 1.3] Inconsistent autorun.lua" seems to be something else entirely---which I only realized after several walls of text
Hardware: One computer, containing 3x GPU and 1x Hard Drive, linked by Cable to 3x Screens:
the "Terminal" --- a simple 1x1 with a keyboard
two "Displays" --- each is a large multiblock screen on the far side of the room
Software: An autorun.lua file on the hard drive attempts to:
mount the hard drive,
set a specific GPU to be the primary GPU, then
bind the primary GPU to the "Terminal" screen
Here's the full autorun.lua file (with a debug function edited out; "db(<string>)" simply logs the message to a debug file):
local primaryGPUAddr = "3f5"
local primaryScreenAddr = "1a1"
local fs = require("filesystem")
local component = require("component")
-- 1) MOUNT HARD DRIVE & VERIFY SUCCESS
local address = ...
local hdCheck, hdError = fs.mount(address, "/main")
if hdCheck then
db("1) Mounted hard drive under '/main'")
else
db("1) Hard Drive did NOT mount: " .. tostring(hdError))
end
-- 2) SET PRIMARY GPU
-- (a) Checks address of randomly-chosen primary GPU:
if component.isAvailable("gpu") then
db("2(a) Primary GPU exists at Boot: " .. tostring(component.gpu.address))
end
-- ( Change primary GPU:
primaryGPUAddr = component.get(primaryGPUAddr) -- resolve full GPU address
db("2( Setting Primary GPU to: " .. tostring(primaryGPUAddr))
component.setPrimary("gpu",primaryGPUAddr)
-- (c) Check again whether primary GPU exists:
if component.isAvailable("gpu") then
db("2(c) Primary GPU successfully changed: " .. tostring(component.gpu.address))
else
db("2(c) No Primary GPU!")
db("... GPU Address = (" .. tostring(component.gpu.address) .. ")")
end
-- 3) BIND PRIMARY GPU TO "TERMINAL" SCREEN:
primaryScreenAddr = component.get(primaryScreenAddr) -- resolve full screen address
local gpu = component.gpu
db("3) Attempting Screen Bind: " .. tostring(gpu.bind(primaryScreenAddr)))
Debug Output:
IF the boot sequence happens to randomly select the same GPU I want as my primary, everything works fine, and by debug output looks like this:
1) Mounted hard drive under '/main'
2(a) Primary GPU exists at Boot: 3f5359d7-b4a9-442b-a17d-26cef3db1e48
2( Setting Primary GPU to: 3f5359d7-b4a9-442b-a17d-26cef3db1e48
2(c) Primary GPU successfully changed: 3f5359d7-b4a9-442b-a17d-26cef3db1e48
3) Attempting Screen Bind: true
(note the address at 2(a) is the same as the desired primary GPU)
However, if the boot sequence picks one of the other two GPUs, "component.setPrimary()" apparently removes the primary GPU instead of changing it, and I get the following debug output:
1) Mounted hard drive under '/main'
2(a) Primary GPU exists at Boot: 3bdd83ae-1559-42b4-98dd-09cb46a8fb16
2( Setting Primary GPU to: 3f5359d7-b4a9-442b-a17d-26cef3db1e48
2(c) No Primary GPU!
Additionally, the following error shows up in /tmp/event.log:
boot/03 component.lua:51: no primary 'gpu' available
(I assume this error exits the code, preventing more debug messages, when I first try the "component.gpu.address" immediately after the "No Primary GPU" debug message.)
Any idea what's going on? The fact that everything works if the desired GPU is randomly chosen at boot, suggests that the code is working, and that something is fishy with component.setPrimary().
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.
Apologies for the kinda-double post, but the problem I initially described in "[OC 1.3] Inconsistent autorun.lua" seems to be something else entirely---which I only realized after several walls of text
Hardware: One computer, containing 3x GPU and 1x Hard Drive, linked by Cable to 3x Screens:
Software: An autorun.lua file on the hard drive attempts to:
Here's the full autorun.lua file (with a debug function edited out; "db(<string>)" simply logs the message to a debug file):
Debug Output:
IF the boot sequence happens to randomly select the same GPU I want as my primary, everything works fine, and by debug output looks like this:
(note the address at 2(a) is the same as the desired primary GPU)
However, if the boot sequence picks one of the other two GPUs, "component.setPrimary()" apparently removes the primary GPU instead of changing it, and I get the following debug output:
Additionally, the following error shows up in /tmp/event.log:
(I assume this error exits the code, preventing more debug messages, when I first try the "component.gpu.address" immediately after the "No Primary GPU" debug message.)
Any idea what's going on? The fact that everything works if the desired GPU is randomly chosen at boot, suggests that the code is working, and that something is fishy with component.setPrimary().
Link to post
Share on other sites