grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] PCI device enumeration for lua


From: Evan Broder
Subject: Re: [PATCH] PCI device enumeration for lua
Date: Fri, 5 Nov 2010 15:02:32 -0700

On Wed, Oct 27, 2010 at 12:29 PM, Evan Broder <address@hidden> 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

Attachment: grub_lua_enum_pci.diff
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]