Project

General

Profile

Debugging a Front-end

These steps allow you to debug a front-end from your login on one of the CLX machines.

Step 1, Write your driver

Before you can debug the front-end, you need a driver that has the bare minimum to be usable by the front-end framework. This means the driver doesn't have to be completely finished, but it should support the init/1 and reading/4 callbacks so the framework can successfully use it. The framework uses the application module to find and load the module(s) of your device driver so you'll probably need to install your driver's code in ERL_LIBS each time you make a change:

$ make install

Step 2, Create the configuration script

You should create a minimal config file (e.g. sys.config) which specifies your driver:

[{daq, [{device_list, [{OID, DRIVER_NAME, [DRIVER_ARGUMENTS]}]}]},
 {fah, [{email_to, ["neswold@fnal.gov"]},
        {interval, 720},
        {title, "Test Front-end Report"}]}]}].

A new tool (as of Oct, 2018) is available to create the configuration files: mk_acsysfe. You can use this to build a tarball containing the complete, run-time environment for your test front-end. First run the script with the -c option to generate the configuration files. Once created, sys.config can be edited so the drivers have their correct start-up parameters. Then run the script with the -t option to build the tarball.

Example

A driver, called example, is part of an Erlang application, example-1.0. The application may contain several modules, but one is used to start the driver. Let's assume it is called example_driver. The last assumed requirement is this driver uses HTTP to retrieve its data, so we need the Erlang HTTP client modules to be loaded. They reside in the inets application.

To configure this front-end, we'd use the command line:

$ mk_acsysfe -c -i inets -i example example_driver

This produces two files: frontend.rel

{release,
 {"ACSys/FE", "1.0"},
 {erts, "7.0"},
 [{kernel, "4.0"},
  {stdlib, "2.5"},
  {sasl, "2.5"},
  {os_mon, "2.4"},
  {utillib, "2.0"},
  {clock, "2.1"},
  {fah, "1.2"},
  {drf2, "1.3"},
  {acnet, "2.1"},
  {daq, "1.6"},
  {sync, "1.4"},
  {inets, "6.0"},
  {example, "1.0"}]
}.

and sys.config

[{daq, [{device_list,
         [{16, example_driver, []}]}]},
 {fah, [{email_to, ["neswold@fnal.gov"]},
        {title, "Test Front-end Report"}]}].

At this point, we can edit sys.config to specify the IP address for the device. For instance:

[{daq, [{device_list,
         [{16, example_driver, ["192.168.1.1"]}]}]},
 {fah, [{email_to, ["neswold@fnal.gov"]},
        {title, "Test Front-end Report"}]}].

Now we can build the tarball.

$ mk_acsysfe -t

Extracting the contents of this tarball should yield a completely configured front-end that you can run from your account.

Step 3, Start the Development Front End

Now you should be able to start a front-end in your current directory:

$ erl -config ./sys.config
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.0  (abort with ^G)
1> application:ensure_all_started(daq).