| gclib 339 Communications API for Galil controllers and PLCs |

All Data Structures Files Functions Variables Typedefs Macros Pages
Red Hat 7 & CentOS 7 Linux

## Tested versions

This version of Linux has x64/AMD64 Support Only. Contact Galil if another version is required for an application.

See the installation page for supported versions.

## Installation

On Red Hat, gclib and gcaps are distributed in RPM repositories. The following steps can be performed to install.

### Download Galil's repository information

Point a browser at http://www.galil.com/sw/pub/rhel/7/galilrpm-4-1.noarch.rpm and install the rpm. This installs Galil's RPM repositories and can be done from the terminal with the following.

    $ wget http://www.galil.com/sw/pub/rhel/7/galilrpm-4-1.noarch.rpm
    # rpm -Uvh galilrpm-4-1.noarch.rpm

### Install Packages

#### Install gclib

    # yum install gclib

Approve "Installed size" and "Importing GPG key", if prompted.

#### Install gcaps (optional)

Following Linux's daemon naming conventions, gcaps is called gcapsd on Red Hat. See the gcaps documentation for more information.

    # yum install gcapsd

Verify that the systemd unit is running.

    $ systemctl is-active gcapsd
    active

### Uninstall Packages

If the packages need to be removed from the system, the following commands may be used.

#### Uninstall gclib

    # yum remove gclib

#### Uninstall gcaps

    # yum remove gcaps

## Serial Ports and USB

If access to the serial ports or USB (e.g. DMC-4103) is desired through gclib, the following will provide steps to join the correct access group. If using USB, be sure the controller is powered and the usb is plugged in before beginning.

### Determine group with access

    $ ls -l /dev/ttyUSB* /dev/ttyS*
    crw-rw----. 1 root dialout   4, 64 Mar  3 16:39 /dev/ttyS0
    crw-rw----. 1 root dialout   4, 65 Mar  3 16:39 /dev/ttyS1
    crw-rw----. 1 root dialout   4, 66 Mar  3 16:39 /dev/ttyS2
    crw-rw----. 1 root dialout   4, 67 Mar  3 16:39 /dev/ttyS3
    crw-rw----. 1 root dialout 188,  0 Mar  6 11:08 /dev/ttyUSB0

In the above listing, dialout is the group that needs to be joined. uucp is another common group that may be listed.

### Add the desired username to the group.

    $ sudo gpasswd -a username dialout
    [sudo] password for username:
    Adding user username to group dialout

Log out and back in for change to take effect.

    $ groups
    username wheel dialout

gclib can now connect to serial and usb devices from user username.

## PCI Controllers

If using a Galil PCI controller, the PCI driver must be installed.

### Install prerequisites

    $ sudo yum install kernel-devel-$(uname -r)
    $ sudo yum install kernel-headers-$(uname -r)
    $ sudo yum install gcc

### Extract source and build driver

    $ tar -xf /usr/share/doc/gclib/src/gclib_202_pci.tar.gz
    $ make

### Copy module and add to kernel

    $ sudo cp galilpci.ko /lib/modules/$(uname -r)
    $ sudo depmod
    $ sudo modprobe galilpci

### Add galil group for access to PCI

    $ sudo groupadd -f -K GID_MIN=100 -K GID_MAX=499 galil
    $ sudo cp 90-galilpci.rules /etc/udev/rules.d/
    $ sudo udevadm control --reload-rules
    $ sudo udevadm trigger
    $ sudo usermod -a -G galil username  #exchange "username" with actual user's name

Logout and back in. The PCI hardware is now available for access.

    $ ls -l /dev/galil*
    crw-rw---- 1 root galil 10, 56 Jun  9 11:07 /dev/galilpci0
    $ echo -e "\x12\x16\r" > /dev/galilpci0
    $ cat /dev/galilpci0
    DMC1846 Rev 1.1a
    :

## Documentation

The documentation is left as a tarball to minimize disk usage. The latest release version of the user manual is available at the following link.

- http://www.galil.com/sw/pub/all/doc/gclib/html/

### Offline html

The following allows viewing of the html docs from the installation.

    $ tar -xzf /usr/share/doc/gclib/gclib_132_doc.tar.gz html
    $ firefox html/index.html

### Offline pdf

There may be a pdf shipped in the package. The following allows viewing of the pdf docs from the installation.

    $ tar -xzf /usr/share/doc/gclib/gclib_132_doc.tar.gz  gclib_132.pdf
    $ evince gclib_132.pdf