back to linux in the lab
λ / usb / gpib / manual #1

Agilent 82357B USB-GPIB on Linux

[ AGILENT 82357B · LINUX-GPIB 4.3.7 · PYVISA ]

Setting up the Agilent/Keysight 82357B under modern Ubuntu and Pop!_OS, verified end-to-end with PyVISA.

A short, verified walkthrough. Tested end-to-end on Pop!_OS 22.04 with the SourceForge 4.3.7 tarball — LED green, /dev/gpib0 present, PyVISA talking to the instrument at GPIB0::22::INSTR.

Keysight 82357B USB-GPIB Interface — white USB cable on the left, GPIB connector on the right, three status LEDs (READY / FAIL / ACCESS) on the device body.
Agilent/Keysight 82357B — USB-to-GPIB bridge. Status LEDs visible: READY (green when firmware loaded), FAIL, ACCESS. See the Keysight product page for the official spec sheet.

What this is for

The Agilent 82357B, later sold as Keysight 82357B, is a USB-to-GPIB adapter. It lets a Linux PC talk to older lab instruments that still use the GPIB connector.

On Linux the adapter needs three things: the linux-gpib driver, a firmware upload via fxload, and a small GPIB configuration file. The steps below keep explanation and terminal commands separate, so you can copy each command block without copying the surrounding text.

Tested environment

  • Pop!_OS 22.04 LTS / Ubuntu 22.04 LTS
  • Kernel 6.x
  • linux-gpib 4.3.7 SourceForge tarball
  • Python 3.10 with PyVISA and PyVISA-py

If you use a newer Ubuntu release, the same idea should still apply, but package names and kernel headers are the first things to check when a build fails.

1. Download the linux-gpib source

Use the 4.3.7 release tarball from SourceForge. The older SVN checkout can lag behind on modern kernels, so the tarball is the safer beginner path.

Terminal · download and enter source folder
wget https://sourceforge.net/projects/linux-gpib/files/linux-gpib/4.3.7/linux-gpib-4.3.7.tar.gz
tar -xzf linux-gpib-4.3.7.tar.gz
cd linux-gpib-4.3.7

What this does: wget downloads the archive, tar unpacks it, and cd moves you into the folder where the build commands must run.

2. Install build tools and compile linux-gpib

The driver has to be built against your currently running kernel. That is why the command installs linux-headers-$(uname -r): it asks Linux for the exact kernel version and installs matching headers.

Terminal · install required packages
sudo apt update
sudo apt install build-essential linux-headers-$(uname -r) fxload texinfo bison flex
Terminal · build and install linux-gpib
./configure
make
sudo make install
sudo ldconfig

Expected result: make finishes without compiler errors, and sudo make install installs the kernel module and userland tools.

3. Load the GPIB kernel modules

Plug in the 82357B adapter, then load the generic GPIB support module and the adapter-specific module.

Terminal · load modules
sudo modprobe gpib_common
sudo modprobe agilent_82357b

Now check whether Linux sees the modules and whether the kernel logged anything useful.

Terminal · check module and kernel log
lsmod | grep gpib
dmesg | tail -20

Expected result: you should see GPIB-related modules in lsmod. The adapter LED should turn green after the firmware is available and the adapter is initialized.

4. Add a udev rule for firmware upload

The adapter needs firmware after it is plugged in. A udev rule tells Linux: when this USB device appears, run fxload and upload the firmware file.

Terminal · open the udev rule file
sudo nano /etc/udev/rules.d/99-gpib.rules

Paste this rule into the file, save it, and close the editor.

File · /etc/udev/rules.d/99-gpib.rules
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0957", ATTR{idProduct}=="0107", RUN+="/sbin/fxload -t fx2 -I /usr/share/usb/agilent_82357b_firmware.hex -D $tempnode"

Reload udev so Linux uses the new rule.

Terminal · reload udev rules
sudo udevadm control --reload-rules
sudo udevadm trigger

If the LED stays dark after reconnecting the adapter, this rule and the firmware path are the first things to check.

5. Create a minimal GPIB configuration

The GPIB config tells linux-gpib which driver to use and what the controller is called. For one 82357B adapter, gpib0 is a simple default name.

Terminal · open the GPIB config
sudo nano /etc/gpib.conf

Paste this minimal configuration into the file.

File · /etc/gpib.conf
interface {
  minor = 0
  board_type = "agilent_82357b"
  name = "gpib0"
  pad = 0
  sad = 0
  timeout = T3s
}

The instrument address is not configured here. You use it later in the PyVISA resource string, for example GPIB0::22::INSTR for an instrument set to address 22.

6. Verify communication with PyVISA

Use a small Python virtual environment so the test does not depend on system-wide Python packages. The command below creates .venv, activates it, and installs PyVISA.

Terminal · prepare Python environment
python3 -m venv .venv
source .venv/bin/activate
python -m pip install pyvisa pyvisa-py

Then run this Python test. Change 22 if your instrument uses a different GPIB address.

Python · list instruments and ask for ID
import pyvisa

rm = pyvisa.ResourceManager('@py')
print(rm.list_resources())

inst = rm.open_resource('GPIB0::22::INSTR')
print(inst.query('*IDN?'))

Expected result: list_resources() shows something like ('GPIB0::22::INSTR',), and *IDN? returns the identification string of the connected instrument.

Common failure points

  • LED stays dark: firmware upload did not run. Check the udev rule, reconnect the adapter, and verify lsusb shows vendor ID 0957.
  • /dev/gpib0 is missing: the kernel module is not loaded or the config is wrong. Run sudo modprobe agilent_82357b again and inspect dmesg.
  • PyVISA finds nothing: check /etc/gpib.conf, instrument address, permissions, and whether the instrument is powered on.
  • Build fails: confirm that linux-headers-$(uname -r) is installed for the exact running kernel.

Sources and notes

  • linux-gpib 4.3.7 release tarball from SourceForge
  • Keysight / Agilent 82357B product documentation
  • Tom Verbeure's 82357B Linux notes, useful as a second reference path
back to linux in the lab more manuals · field notes