sudo apt-get install tk-dev build-essential texinfo texi2html libcwidget-dev libncurses5-dev libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool mercurial
cd ~
svn checkout svn://svn.code.sf.net/p/linux-gpib/code/trunk linux-gpib-code
cd ~/linux-gpib-code/linux-gpib-kernel
make
sudo make install
cd ~/linux-gpib-code/linux-gpib-user
sudo make install
lsusb | grep GPIB
expected result:
Bus 001 Device 006: ID 3923:709b National Instruments Corp. GPIB-USB-HS
sudo modprobe ni_usb_gpib
sudo ldconfig
lsmod | grep gpib
expected result:
ni_usb_gpib 36864 0
gpib_common 45056 1 ni_usb_gpib
interface {
minor = 0
board_type = "ni_usb_b"
pad = 0
master = yes
}
File location for Ubuntu:
/usr/local/etc/gpib.conf
sudo gpib_config
expected result:
no output, no error
sudo ibtest
- d ENTER,
- address of your instrument ex. 3
- w ENTER.
- type
*IDN?
ENTER, - r ENTER
- 100 ENTER
Expected result:
Example: KEITHLEY INSTRUMENTS INC.,MODEL 2000,0000,A05 /A02
If that works it means that linux-gpib
can talk to the adapter and instrument. Success.
sudo apt-get install python3-dev python3-distutils python3-pip python3-setuptools
cd linux-gpib-code/linux-gpib-user/
cd language/python/
sudo python3 setup.py install
~/testgpib.py
import Gpib
# X is your interface number (usually 0)
# Y is your instrument address (should be configured on the device)
inst = Gpib.Gpib(X,Y)
inst.write("*IDN?")
print(inst.read(100))
python3 ~/testgpib.py
expected result:
Example: KEITHLEY INSTRUMENTS INC.,MODEL 2000,0000,A05 /A02
pip3 install pyvisa
pip3 install pyvisa-py
pip3 install gpib-ctypes
python3 -m visa info
Expected result:
(...)
Backends:
ni:
(not important)
py:
Version: X.X.X
GPIB INSTR: Available via Linux GPIB (b'X.X.X r[XXXX]')
GPIB INTFC: Available via Linux GPIB (b'X.X.X r[XXXXX]')
~/testvisa.py
import pyvisa
resources = pyvisa.ResourceManager('@py')
# X means your instrument address
k2000 = resources.open_resource('GPIB::X::INSTR')
print(k2000.query('*IDN?'))
python3 ~/testvisa.py
expected result:
Example: KEITHLEY INSTRUMENTS INC.,MODEL 2000,0000,A05 /A02
While compiling this instruction I used different sources including:
$ cd ~/linux-gpib-code/linux-gpib-kernel
$ make
make -C /lib/modules/
uname -r
/build V=0 modulesM="/home/integse/linux-gpib-code/linux-gpib-kernel/drivers/gpib"
GPIB_TOP_DIR=/home/integse/linux-gpib-code/linux-gpib-kernel
CONFIG_GPIB_ISA=""
GPIB_CONFIG_PCMCIA="0"
HAVE_DEV_OF_NODE=
GPIB_CONFIG_KERNEL_DEBUG=0
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-35-generic'
ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
$ cd /usr/src/linux-headers-$(uname -r)
/usr/src/linux-headers-6.5.0-35-generic$ sudo make oldconfig
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
configuration written to .config
$ sudo make prepare
SYNC include/config/auto.conf.cmd
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'. Stop.