Re: FindLstn doesn't return if no devices found.

dave penkler <[email protected]> Tue, 19 Apr 2022 10:02:26 +0200
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAL=kjP1QsubnteSwe=gcv8-Gp9P=+ateYVkMOhrud8rShorbJA@mail.gmail.com>
Hi Michael,
The following program terminates just fine even with no devices attached on
an agilent_82357b clone.
$ ./fls
ibcnt 0, iberr 0x2
$
cheers,
-Dave
#include <stdint.h>
#include <stdio.h>
#include <gpib/gpib_user.h>
#include <gpib/ib.h>
#define MAX_PRIMARY_DEVICES          30
#define MAX_SECONDARY_DEVICES        10

Addr4882_t deviceList[ MAX_PRIMARY_DEVICES + 1 ] = {5,6,7,NOADDR};
Addr4882_t resultList[ MAX_PRIMARY_DEVICES * MAX_SECONDARY_DEVICES ] = {};

int main() {
  FindLstn( 0, deviceList, resultList, ( MAX_PRIMARY_DEVICES *
MAX_SECONDARY_DEVICES));
  printf("ibcnt %d, iberr 0x%0x\n",ibcnt,iberr);
}

On Sun, 17 Apr 2022 at 02:19, Michael K via Linux-gpib-general <
[email protected]> wrote:

> I'm trying to use FindLstn to query the GPIB.
> When a device is found, things work as expected but if there are no
> devices connected to the controller ( HP 82357b ) FindLstn hangs.
>
> I'm using the latest SVN branch.
>
> Is this correct behavior ?
>
> Michael
>
> #define MAX_PRIMARY_DEVICES               30
> #define MAX_SECONDARY_DEVICES        10
>
> Addr4882_t deviceList[ MAX_PRIMARY_DEVICES + 1 ] = {};
>  Addr4882_t resultList[ MAX_PRIMARY_DEVICES * MAX_SECONDARY_DEVICES ] = {};
>
> GPIBdevice devices[] = {
>         { A4882( ADDR_HP8753C, 0 ),                "HP8753C",        {
> FALSE } },
>         { A4882( ADDR_HP33401A_MULTIMETER, 0 ),    "HP33401A
> Multimeter",    { FALSE } }
> };
>
>
> gint MAX_ENUMERATED_DEVICES = ((sizeof( devices ) / sizeof( GPIBdevice )));
>
>         for( i=0; i < MAX_PRIMARY_DEVICES + 1; i++ ) {
>             if( i < MAX_ENUMERATED_DEVICES )
>                 deviceList[ i ] = devices[i].GPIBaddress;
>             else
>                 deviceList[ i ] = NOADDR;
>         }
>
>         FindLstn( descGPIBcontroller, deviceList, resultList,
> MAX_PRIMARY_DEVICES * MAX_SECONDARY_DEVICES);
>
> // Never gets here unless a device responds
>
>
> _______________________________________________
> Linux-gpib-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
>

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general