-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComput…
…ers into OC1.6-MC1.7.10
- Loading branch information
Showing
384 changed files
with
2,223 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package li.cil.oc.api.driver; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Implement this on {@link li.cil.oc.api.network.Environment}s if you wish to | ||
* expose some (typically static) information about the device represented by | ||
* that environment to a {@link li.cil.oc.api.Machine} connected to it. | ||
* <p/> | ||
* You may also implement this on a {@link li.cil.oc.api.machine.MachineHost} | ||
* in which case the <code>Machine</code> will forward that information as | ||
* its own (since <code>MachineHost</code>s usually use the machine's node as | ||
* their own, this avoids a dummy environment used solely for device info). | ||
* <p/> | ||
* This is intended to permit programs to reflect on the hardware they are | ||
* running on, typically for purely informational purposes, but possibly to | ||
* toggle certain hardware specific features. | ||
* <p/> | ||
* For example, graphics cards may expose their timings via this interface, so | ||
* that programs may determine at what speed they can redraw, and optimize | ||
* execution order. | ||
* <p/> | ||
* While the format of the returned table of information is entirely up to you, | ||
* it is recommended to orient yourself on the key values and names that | ||
* <code>lshw</code> uses (http://www.ezix.org/project/wiki/HardwareLiSter), | ||
* where applicable. | ||
*/ | ||
public interface DeviceInfo { | ||
/** | ||
* Compile a list of device information strings as key-value pairs. | ||
* <p/> | ||
* For example, this may list the type of the device, a vendor (for example | ||
* your mod name, or something more creative if you like), specifications | ||
* of the device (speeds, capacities). | ||
* <p/> | ||
* For example, OC's tier one memory module returns the following: | ||
* <table> | ||
* <tr><td>class</td><td>memory</td></tr> | ||
* <tr><td>description</td><td>Memory bank</td></tr> | ||
* <tr><td>vendor</td><td>MightyPirates GmbH & Co. KG</td></tr> | ||
* <tr><td>product</td><td>Multipurpose RAM Type</td></tr> | ||
* <tr><td>clock</td><td>500</td></tr> | ||
* </table> | ||
* | ||
* @return the table of information on this device, or <code>null</code>. | ||
*/ | ||
Map<String, String> getDeviceInfo(); | ||
|
||
/** | ||
* Recommended list of key values for the device info table. | ||
* <p/> | ||
* You are strongly encouraged to at least define <code>class</code>, <code>description</code>, | ||
* <code>vendor</code> and <code>product</code>, to allow a more homogenous experience for the | ||
* end-user reading this information via a script. | ||
* <p/> | ||
* Feel free to be somewhat... flexible with the designated uses of these fields. For example, | ||
* the capacity and size fields have differing meaning depending on the device in OpenComputers | ||
* itself (e.g. they're used for maximum number of characters for graphics cards, width is | ||
* used for bit depth on graphics cards, etc.), just try to stick with what's somewhat logical. | ||
*/ | ||
final class DeviceAttribute { | ||
public static final String Class = "class"; // device's class (see below), e.g. "processor" | ||
public static final String Description = "description"; // human-readable description of the hardware node, e.g. "Ethernet interface" | ||
public static final String Vendor = "vendor"; // vendor/manufacturer of the device, e.g. "Minecorp Inc." | ||
public static final String Product = "product"; // product name of the device, e.g. "ATY Raderps 4200X" | ||
public static final String Version = "version"; // version/release of the device, e.g. "2.1.0" | ||
public static final String Serial = "serial"; // serial number of the device | ||
public static final String Capacity = "capacity"; // maximum capacity reported by the device, e.g. unformatted size of a disk | ||
public static final String Size = "size"; // actual size of the device, e.g. actual usable space on a disk | ||
public static final String Clock = "clock"; // bus clock (in Hz) of the device, e.g. call speed(s) of a component | ||
public static final String Width = "width"; // address width of the device, in the broadest sense | ||
|
||
private DeviceAttribute() { | ||
} | ||
} | ||
|
||
/** | ||
* Recommended list of values for the <code>class</code> attribute (see above). | ||
* <p/> | ||
* Again, feel free to be somewhat creative with those. When in doubt, use <code>generic</code>. | ||
*/ | ||
final class DeviceClass { | ||
public static final String System = "system"; // used to refer to the whole machine, e.g. "Computer", "Server", "Robot" | ||
public static final String Bridge = "bridge"; // internal bus converter, maybe useful for some low-level archs? | ||
public static final String Memory = "memory"; // memory bank that can contain data, executable code, e.g. RAM, EEPROM | ||
public static final String Processor = "processor"; // execution processor, e.g. CPU, cryptography support | ||
public static final String Address = "address"; // memory address range, e.g. video memory (again, low-level archs maybe?) | ||
public static final String Storage = "storage"; // storage controller, e.g. IDE controller (low-level...) | ||
public static final String Disk = "disk"; // random-access storage device, e.g. floppies | ||
public static final String Tape = "tape"; // sequential-access storage device, e.g. cassette tapes | ||
public static final String Bus = "bus"; // device-connecting bus, e.g. USB | ||
public static final String Network = "network"; // network interface, e.g. ethernet, wlan | ||
public static final String Display = "display"; // display adapter, e.g. graphics cards | ||
public static final String Input = "input"; // user input device, e.g. keyboard, mouse | ||
public static final String Printer = "printer"; // printing device, e.g. printer, 3D-printer | ||
public static final String Multimedia = "multimedia"; // audio/video device, e.g. sound cards | ||
public static final String Communication = "communication"; // line communication device, e.g. modem, serial ports | ||
public static final String Power = "power"; // energy source, e.g. battery, power supply | ||
public static final String Volume = "volume"; // disk volume, e.g. file system | ||
public static final String Generic = "generic"; // generic device (used when no other class is suitable) | ||
|
||
private DeviceClass() { | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
54 changes: 27 additions & 27 deletions
54
...mputers/lua/component/data/bin/md5sum.lua → ...ts/opencomputers/loot/data/bin/md5sum.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
local shell = require("shell") | ||
local data = require("data") | ||
|
||
local args = shell.parse(...) | ||
if #args == 0 then | ||
local read = "" | ||
repeat | ||
local current = io.read("*a") | ||
read = read .. current | ||
until current ~= "" | ||
io.write(data.toHex(data.md5(read))) | ||
else | ||
for i = 1, #args do | ||
local read = "" | ||
local file, reason = io.open(shell.resolve(args[i])) | ||
if not file then | ||
io.stderr:write(tostring(reason) .. "\n") | ||
os.exit(false) | ||
end | ||
repeat | ||
local current = file:read("*a") | ||
read = read .. current | ||
until current ~= "" | ||
file:close() | ||
io.write(data.toHex(data.md5(read)) .. "\t".. args[i] .. "\n") | ||
end | ||
end | ||
local shell = require("shell") | ||
local data = require("data") | ||
|
||
local args = shell.parse(...) | ||
if #args == 0 then | ||
local read = "" | ||
repeat | ||
local current = io.read("*a") | ||
read = read .. current | ||
until current ~= "" | ||
io.write(data.toHex(data.md5(read))) | ||
else | ||
for i = 1, #args do | ||
local read = "" | ||
local file, reason = io.open(shell.resolve(args[i])) | ||
if not file then | ||
io.stderr:write(tostring(reason) .. "\n") | ||
os.exit(false) | ||
end | ||
repeat | ||
local current = file:read("*a") | ||
read = read .. current | ||
until current ~= "" | ||
file:close() | ||
io.write(data.toHex(data.md5(read)) .. "\t".. args[i] .. "\n") | ||
end | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
src/main/resources/assets/opencomputers/loot/openos/bin/lshw.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
local computer = require("computer") | ||
local shell = require("shell") | ||
local text = require("text") | ||
|
||
local args, options = shell.parse(...) | ||
|
||
local devices = computer.getDeviceInfo() | ||
local columns = {} | ||
|
||
if not next(options, nil) then | ||
options.t = true | ||
options.d = true | ||
options.p = true | ||
end | ||
if options.t then table.insert(columns, "Class") end | ||
if options.d then table.insert(columns, "Description") end | ||
if options.p then table.insert(columns, "Product") end | ||
if options.v then table.insert(columns, "Vendor") end | ||
if options.c then table.insert(columns, "Capacity") end | ||
if options.w then table.insert(columns, "Width") end | ||
if options.s then table.insert(columns, "Clock") end | ||
|
||
local m = {} | ||
for address, info in pairs(devices) do | ||
for col, name in ipairs(columns) do | ||
m[col] = math.max(m[col] or 1, (info[name:lower()] or ""):len()) | ||
end | ||
end | ||
|
||
io.write(text.padRight("Address", 10)) | ||
for col, name in ipairs(columns) do | ||
io.write(text.padRight(name, m[col] + 2)) | ||
end | ||
io.write("\n") | ||
|
||
for address, info in pairs(devices) do | ||
io.write(text.padRight(address:sub(1, 5).."...", 10)) | ||
for col, name in ipairs(columns) do | ||
io.write(text.padRight(info[name:lower()] or "", m[col] + 2)) | ||
end | ||
io.write("\n") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/opencomputers/loot/openos/boot/10_devfs.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require("filesystem").mount( | ||
setmetatable({ | ||
isReadOnly = function()return false end | ||
}, | ||
{ | ||
__index=function(tbl,key)return require("devfs")[key]end | ||
}), "/dev") |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.