From: Alexandru Gagniuc Date: Sun, 28 Feb 2016 18:32:19 +0000 (-0800) Subject: scpi/libgpib: Place device in local mode before closing handle X-Git-Tag: libsigrok-0.5.0~534 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=8b0ad3a55977fe90942d761ae4a075399b323f08 scpi/libgpib: Place device in local mode before closing handle Devices connected on a real GPIB bus are placed in remote mode when opening them. libgpib does not automatically place devices back in local mode when closing the handle. It is thus possible to lock out a GPIB device by probing it with libsigrok. This happens on the HP 3457A meter, which does not have a "LOCAL" command, and must be put back in local mode via GPIB handshake. ibloc() takes care of this, and it does it on a per-device basis, such that other devices on the GPIB bus are not affected. --- diff --git a/src/scpi/scpi_libgpib.c b/src/scpi/scpi_libgpib.c index ed499cca..cab72df7 100644 --- a/src/scpi/scpi_libgpib.c +++ b/src/scpi/scpi_libgpib.c @@ -139,6 +139,9 @@ static int scpi_gpib_close(struct sr_scpi_dev_inst *scpi) { struct scpi_gpib *gscpi = scpi->priv; + /* Put device in back local mode to prevent lock-out of front panel. */ + ibloc(gscpi->descriptor); + /* Now it's safe to close the handle. */ ibonl(gscpi->descriptor, 0); return SR_OK;