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