Lab::Moose::Connection::LinuxGPIB - Connection back end to the LinuxGpib library and kernel drivers.


 use Lab::Moose
 my $instrument = instrument(
     type => 'random_instrument',
     connection_type => 'LinuxGPIB',
     # use primary address '1' and no secondary addressing.
     connection_options => {pad => 1, timeout => 3},


This module provides a connection interface to Linux-GPIB. See Lab::Measurement::Backends for more information on Linux-GPIB and it's Perl backend.



The constructor takes the following attributes. The only required attribute is pad.

pad (or gpib_address for backwards compatibility with Lab::Connection::LinuxGPIB)

Primary address of the device. Required.


Secondary address of the device. Default is 0 (Do not use secondary addressing). Valid values are ( 96 .. 126 ).


Board index as provided in your /etc/gpib.conf. Default is 0.


Connection timeout in seconds. Default is 1. LinuxGPIB provides the following timeout values. The value given to the constructor will be rounded upwards to a valid timeout.

  • 0 (never timeout)

  • 10e-6

  • 30e-6

  • 100e-6

  • 300e-6

  • 1e-3

  • 3e-3

  • 10e-3

  • 30e-3

  • 100e-3

  • 300e-3

  • 1

  • 3

  • 10

  • 30

  • 100

  • 300

  • 1000


All methods croak if they take longer than the timeout.

The 'timeout' argument is always optional. If given, this overrides the connection's timeout attribute.


 my $data = $connection->Read();

Call ibread on the connection. Read an arbitrary amount of data until the 'END' bit is set in ibsta. Croak on read errors.

The read may requires multiple calls to ibrd. In this case, it will still croak if the total time of operation does not exceed the timeout.


 $connection->Write(command => "*CLS");

Takes one mandatory argument 'command'. Write this string to the connection. Croak on write error.



Call device clear (ibclr) on the connection.