diff options
author | Marcel Ritter <unrzl1@linux.rrze.uni-erlangen.de> | 2008-12-15 15:41:18 +0100 |
---|---|---|
committer | Marcel Ritter <unrzl1@linux.rrze.uni-erlangen.de> | 2008-12-15 15:41:18 +0100 |
commit | c70f91446e978a8ea113b00de33d8d862d5d0d58 (patch) | |
tree | e11225c39ff5eede36bfb1180b1f6b54c39c6ee7 /com32/lua/test/pci.lua | |
parent | f06f55139583f1d0022e78805df6d23fa72ae7d0 (diff) | |
download | syslinux-c70f91446e978a8ea113b00de33d8d862d5d0d58.tar.gz |
COM32: lua - basic pci functions implemented
Diffstat (limited to 'com32/lua/test/pci.lua')
-rw-r--r-- | com32/lua/test/pci.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/com32/lua/test/pci.lua b/com32/lua/test/pci.lua new file mode 100644 index 00000000..8d7f7d42 --- /dev/null +++ b/com32/lua/test/pci.lua @@ -0,0 +1,34 @@ +-- get nice output +printf = function(s,...) + return io.write(s:format(...)) + end + +-- get device info +pciinfo = pci.getinfo() + +-- get plain text device description +pciids = pci.getidlist("/pci.ids") + +-- list all pci busses +for dind,device in pairs(pciinfo) do + + -- search for device description + search = string.format("%04x%04x", device['vendor'], device['product']) + + printf(" %04x:%04x:%04x:%04x = ", device['vendor'], device['product'], + device['sub_vendor'], device['sub_product']) + + if ( pciids[search] ) then + printf("%s\n", pciids[search]) + else + printf("Unknown\n") + end +end + +-- print(pciids["8086"]) +-- print(pciids["10543009"]) +-- print(pciids["00700003"]) +-- print(pciids["0070e817"]) +-- print(pciids["1002437a1002437a"]) + + |