Name

ibgetconf — Get configuration of boards and devices from gpib.conf

Synopsis

#include <gpib/ib.h>
int ibgetconf(dev_array[]); 
struct dev_entry * dev_array[];
 

Description

The *dev_array[] parameter is pointer that receives the returned array of struct dev_entry items. For each interface and device configured in the gpib.conf configuration file, the dev_array[].type field is set to to 0 for a device, 1 for an interface that is not system controller and 2 for an interface that is configured as system controller. The corresponding dev_array[].name field is set to the string of the name of the interface or device and the other fields to their corresponding values. All the device entries following an interface entry belong the that interface, i.e. they refer to the minor of the immediately preceding interface entry. The interface entries are set in the order of appearance in gpib.conf.

Return value

The number of entries set in dev_array is returned. If a parsing error occurs -1 is returned and iberr and ibcnt are set accordingly.

Example program

#include <stdio.h>
#include <gpib/ib.h>

int main() {
  int i,n;
  struct dev_entry *dev_arr;
  n = ibgetconf(&dev_arr);
  printf("got %i entries\n",n);
  for (i=0; i<n; i++) {
  printf("minor %i type %i name %s pad %d sad %d\n",
         dev_arr[i].minor, dev_arr[i].type, dev_arr[i].name,
         dev_arr[i].pad, dev_arr[i].sad);
  }
}