This commit is contained in:
Adrian Siekierka 2025-06-01 19:46:48 +02:00
parent 49b128ec69
commit 5d35d7f9e1
3 changed files with 25 additions and 6 deletions

View File

@ -1,5 +1,6 @@
## Fixes/improvements
* [#3682] Add error handling to the `flash` OpenOS program
* [#3764] Fix left and right names being swapped in the Rack GUI
* [#3779] Fix `os.sleep(0)` causing `too long without yielding` (Ocawesome101)
* (1.12) [#3774] Fix Jukebox driver (kebufu)

View File

@ -15,6 +15,8 @@ end
local function printRom()
local eeprom = component.eeprom
io.write(eeprom.get())
return nil
end
local function readRom()
@ -37,6 +39,8 @@ local function readRom()
if not options.q then
io.write("All done!\nThe label is '" .. eeprom.getLabel() .. "'.\n")
end
return nil
end
local function writeRom()
@ -60,7 +64,10 @@ local function writeRom()
io.write("Please do NOT power down or restart your computer during this operation!\n")
end
eeprom.set(bios)
local result, reason = eeprom.set(bios)
if reason then
return nil, reason
end
local label = args[2]
if not options.q and not label then
@ -68,7 +75,11 @@ local function writeRom()
label = io.read()
end
if label and #label > 0 then
eeprom.setLabel(label)
local result, reason = eeprom.setLabel(label)
if reason then
return nil, reason
end
if not options.q then
io.write("Set label to '" .. eeprom.getLabel() .. "'.\n")
end
@ -77,12 +88,19 @@ local function writeRom()
if not options.q then
io.write("All done! You can remove the EEPROM and re-insert the previous one now.\n")
end
return nil
end
local result, reason
if options.l then
printRom()
result, reason = printRom()
elseif options.r then
readRom()
result, reason = readRom()
else
writeRom()
result, reason = writeRom()
end
if reason then
io.stderr:write(reason..'\n')
return 1
end

View File

@ -76,7 +76,7 @@ class EEPROM extends prefab.ManagedEnvironment with DeviceInfo {
return result(Unit, "storage is readonly")
}
label = args.optString(0, "EEPROM").trim.take(24)
if (label.length == 0) label = "EEPROM"
if (label.isEmpty) label = "EEPROM"
result(label)
}