gclib  423
Communications API for Galil controllers and PLCs
ubuntu.md
1 # Ubuntu Linux {#ubuntu}
2 
3 
4 ##Tested versions
5 
6 This version of Linux has **x64/AMD64 Support Only**. Contact Galil if another version
7 is required for an application.
8 
9 See the \link installation \endlink page for supported versions.
10 
11 
12 ##Installation
13 ###Install Galil's public certificate
14 
15  $ wget http://www.galil.com/sw/pub/ubuntu/$(lsb_release -r -s)/GALIL-PUB-KEY
16  # apt-key add GALIL-PUB-KEY
17 
18 ###Get Galil's apt sources list
19 
20  # wget http://www.galil.com/sw/pub/ubuntu/$(lsb_release -r -s)/galil.list -O /etc/apt/sources.list.d/galil.list
21  # apt-get update
22 
23 ###Install Package
24 
25 ####Install gclib
26 
27  # apt-get install gclib
28 
29 #### Install gcaps on 16.04 and better (optional)
30 
31 Following Linux's daemon naming conventions, gcaps is called *gcapsd* on Ubuntu.
32 See the \link gcaps \endlink documentation for more information.
33 
34  # apt-get install gcapsd
35 
36 Verify that the systemd unit is running.
37 
38  $ systemctl is-active gcapsd
39  active
40 
41 ###Uninstall Package
42 
43 If the packages need to be removed from the system, the following commands may be used.
44 
45 ####Uninstall gclib
46 
47  # apt-get remove gclib
48 
49 ####Uninstall gcaps
50 
51  # apt-get remove gcapsd
52 
53 ##Serial Ports and USB
54 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.
55 
56 ###Determine group with access
57 
58  $ ls -l /dev/ttyUSB* /dev/ttyS*
59  crw-rw----. 1 root dialout 4, 64 Mar 3 16:39 /dev/ttyS0
60  crw-rw----. 1 root dialout 4, 65 Mar 3 16:39 /dev/ttyS1
61  crw-rw----. 1 root dialout 4, 66 Mar 3 16:39 /dev/ttyS2
62  crw-rw----. 1 root dialout 4, 67 Mar 3 16:39 /dev/ttyS3
63  crw-rw----. 1 root dialout 188, 0 Mar 6 11:08 /dev/ttyUSB0
64 
65 In the above listing, **dialout** is the group that needs to be joined. **uucp** is another common group that may be listed.
66 
67 ###Add the desired *username* to the group.
68 
69  $ sudo gpasswd -a username dialout
70  [sudo] password for username:
71  Adding user username to group dialout
72 
73 Log out and back in for change to take effect.
74 
75  $ groups
76  username wheel dialout
77 
78 gclib can now connect to serial and usb devices from user *username*.
79 
80 ##PCI Controllers
81 If using a Galil PCI controller, the PCI driver must be installed.
82 
83 ###Extract source and build driver
84 
85  $ tar -xf /usr/share/doc/gclib/src/gclib_pci.tar.gz
86  $ make
87 
88 ###Copy module and add to kernel
89 
90  $ sudo cp galilpci.ko /lib/modules/$(uname -r)
91  $ sudo depmod
92  $ sudo modprobe galilpci
93 
94 ###Add galil group for access to PCI
95 
96  $ sudo groupadd -f -K GID_MIN=100 -K GID_MAX=499 galil
97  $ sudo cp 90-galilpci.rules /etc/udev/rules.d/
98  $ sudo udevadm control --reload-rules
99  $ sudo udevadm trigger
100  $ sudo usermod -a -G galil username #exchange "username" with actual user's name
101 
102 Logout and back in. The PCI hardware is now available for access.
103 
104  $ ls -l /dev/galil*
105  crw-rw---- 1 root galil 10, 56 Jun 9 11:07 /dev/galilpci0
106  $ echo -e "\x12\x16\r" > /dev/galilpci0
107  $ cat /dev/galilpci0
108  DMC1846 Rev 1.1a
109  :
110 
111 ##Documentation
112 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.
113 * http://www.galil.com/sw/pub/all/doc/gclib/html/
114 
115 ###Offline html
116 The following allows viewing of the html docs from the installation.
117 
118  $ tar -xzf /usr/share/doc/gclib/gclib_doc.tar.gz html
119  $ firefox html/index.html
120 
121 ###Offline pdf
122 There may be a pdf shipped in the package. The following allows viewing of the pdf docs from the installation.
123 
124  $ tar -xzf /usr/share/doc/gclib/gclib_doc.tar.gz gclib_132.pdf
125  $ evince gclib.pdf