Nightview various documentation

SBIG library notes

Before installation of Nightview, you need to install of a camera manufacturer library and to setup an udev rule. There are my notices how to do it for SBIG's Universal library.

There is a really simple way how to install all necessary stuff. The directory libsbig/ of the install directory contains scripts and The instalation can be done by executing of commands (# means a comment):

bash$ # install and setup "fxload" and "libusb" for your distribution
bash$ cd $DESTDIR/libsbig
bash$ ./

The installation script detects some information about your system, gets an appropriate tarball from distribution site to /tmp, unpack it and copy required files to its final destinations. All installed files, by this way, can be removed from your system by the command:


If the installation has been sucesfull, go to installation page. If the process is unsuccesfull, you need to try it by hand as is described in rest of the section.

The manual way to install SBIG's library and to activate of udev system is specified by the steps:

  1. Get it:
  2. untar, read all READMEs (but does not follow instructions!)
  3. install libusb and fxload from your distribution package set, check presence of the line in /etc/fstab:
    usbfs /proc/bus/usb/ usbfs defaults 0 0
    (if the line is missing, simply create it by copying of the line above)
  4. copy only these files:
     sbigudrv.h             -> /usr/local/include
     libsbigudrv-*.a        -> /usr/local/lib
     libsbigudrv-*.so       -> /usr/local/lib
     sbigfcam.hex           -> /lib/firmware
     sbiglcam.hex           -> /lib/firmware
     sbigucam.hex           -> /lib/firmware
     stfga.bin              -> /lib/firmware -> /lib/firmware
     10-sbig.rules          -> /etc/udev/rules.d
     50-usb-serial.rules    -> /etc/udev/rules.d
  5. Link this:
    /usr/local/lib/libsbigudrv-*.a    -> libsbigudrv.a
    /usr/local/lib/libsbigudrv-*.so   ->
  6. read and follow instructions in udev subdirectory of the nightview
  7. Run ldconfig to update system-wide library database:

This instructions works for 2.6.x Linux kernels above 2.6.13 (for 2.4.x kernels use hot-plug, for 2.6.x < 2.6.13 needs to be modified scripts in udev directory).

Follow instructions for udev setup.


The and nightview.rules presented in udev directory of distribution tarball are configuration files for udev. They are designed to run fxloader to load of SBIG's firmware to your camera immediately after connection of it to your computer (or folowing of the camera switch on). The uploading is proceeded by two phases. During the first phase (it immediately follows connection), the camera create a "passive" device. If the passive device is created, it invokes the phase two by uploading of camera's firmware. If the firmware is completely uploaded, the camera's fan and its LED are on.

On Debian linux, copy the script nightview.rules to the directory /etc/udev/rules.d and script to /lib/udev/devices (this is normally done by install script):

prompt# cp nightview.rules /etc/udev/rules.d/
prompt# cp /lib/udev/devices/

(both destinations can be little bit different on various linux distributions). The path to SBIG's firmware files is hard-coded in nightview.rulez file (/lib/firmware/*.hex) so the firmware files need to be installed on appropriate place. The nightview.rules file may be useful to rename on some different name, for example z90_nightview.rules (but it is important to add .rules suffix to the new file).

The file is run when the camera is connected. It is ideal point to run the nightviewd daemon together with additional settings by runnig of the script. The end of the file contains possible commands to be used at start-up time. For example, the camera connection night_power and the temperature regulation setup.

If you have some troubles, uncomment logger's records included in script /lib/udev/devices/ and consult your log files.

Http daemon

The CCD camera or telescope are controlled throughout two daemons. If you are observing on same computer as your telescope or camera is connected, the http daemon is unnecessary. In case of, you have your camera controlled by two different computers or your are observing on some remote computer, you need to start a http daemon as a proxy server to route requests from your clients to daemons and vice versa. The daemon can be an arbitrary http daemon like Apache, boa, lighthttp and the redirection if provided by a CGI script. Moreover, Nightview package provides its own http server. It has some advantage over other ones. It is faster, smaller, has no configuration files and it no need auxiliary disk space.

The nighthttpd daemon listens on a network port. It provides a simple html page for test purposes only and it is waiting for an useful data via GET method of html protocol. If it get some data, it recognize its destination to a telescope or a camera and it opens a socket to relevant device by similar way as local clients. When daemon got an answer from the daemon, it redirect it back to remote client.

The nighthttpd can be started from a start-up system script by this way:

nighthttpd -chroot -u www-data

If you want authenticate clients, use directive AuthKey in configuration file. The use of the authentication depends on your network's environment. If you have a small private network with a few computers owned itself, it is useless for you. It is recommended for use on large networks, when you want avoid forbidden persons connect or when you are connected over Internet. When your are working in enemy environment, it is highly recommended to use SSL encryption for your data. The nightview doesn't support (and will not be never) SSL native, but you can use SSL tunnel to do it.

For completeness. The installation tarball contains directory cgi-bin with CGI scripts for boa and thttpd server. Both are obsoleted by nighthttpd daemon. If you want experiments with its, use nightview-cgi script and create configuration for your http daemon. It is highly recommended to play with a small, fast daemon which is using of the select system call to support of different clients.

System start-up scripts

The CCD camera connected via USB cable invoke start of nighviewd via udev mechanism. Both remaining daemons need to be started by hand or by system start-up script. The start scripts to provide it are and It can be found together with in system install directorty (/usr/local/sbin). Both scripts are only a wrapers around the executables and provides suitable environment or possibility to run additional self-made utilities. You can call its from your standard place at system start-up (/etc/init.d/, /etc/rc.d/, ..).

cFITSIO building

I strongly recommends to install of cFITSIO as a shared library. They can be easy done by the sequence of commands:

tar zxf cfitsioXXXX.tar.gz
cd cfitsio
./configure --prefix=/usr/local CFLAGS=-O
make shared     # shared is important
make install

The only difference to standard sequence is presence of the switch shared for make. Make will create a shared library (usually .so or .dylib) and you can benefit from smaller executable files, less memory consuming etc. The use of a static or a shared cFITSIO library version has no effect on the functionality itself.

hm hm..

* popsat pouziti montaze 40ky, montaz + focus

Last modification: 2009-01-22 16:06:15

Copyright © 2001-8, F. Hroch, Institute of Theoretical Physics and Astrophysics, Masaryk University, Brno, Czech Republic