Using libpci for reading PCI vendor/device/etc

Dan Nicholson dbn.lists at gmail.com
Thu Jun 21 13:07:04 PDT 2007


On 6/21/07, Danny Kukawka <danny.kukawka at web.de> wrote:
> On Donnerstag, 21. Juni 2007, Bill Nottingham wrote:
> > Also, as written, the patch will cause hald to *exit* on a parse error
> > of pci.ids. (libpci calls exit() by default on errors)
>
> This is a absolute no-go for HAL.

I believe you can override the error member of the pci_access struct
to do what you want and it won't exit on you. In Mike's patch, it
does:

        pacc = pci_alloc();
        pci_init(pacc);

So, you'd just have to set pacc->error to something more sensible for
hal. The default is this:

static void
pci_generic_error(char *msg, ...)
{
  va_list args;

  va_start(args, msg);
  fputs("pcilib: ", stderr);
  vfprintf(stderr, msg, args);
  fputc('\n', stderr);
  exit(1);


--
Dan


More information about the hal mailing list