On Wed, Oct 27, 2010 at 12:29 PM, Evan Broder <e...@ebroder.net> wrote: > Hi - > This patch adds anew enum_pci(callback) function to the Lua grub > library for enumerating devices on the PCI bus. This is not currently > possible because there's no way to get the output of a command from > grub.run. > > While I think that would be useful to have in the more general case, > in this particular case using the internal grub_pci_iterate function > is better, because it keeps Lua code from having to parse the lengthy > output from the lspci command. > > The callback function passed to enum_pci is called once for each > device found: the bus index, the device index, the function index, the > PCI ID as a single numeric value, and the device class.
Hi again - Having actually tried to work with this patch, I realized that I wanted a little more information passed into the callback function. I also realized that it's rather difficult to do things like separating the vendor and device IDs in Lua, since it lacks bitwise operators. My new patch passes 9 arguments to the callback function: bus index, device index, function index, primary vendor ID, primary device ID, subsystem vendor ID, subsystem device ID, base class, and sub-class. Thanks, - Evan
grub_lua_enum_pci.diff
Description: Binary data
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel