======================================================
SBIG Linux Development Kit
(c) 2008 SBIG
======================================================
A. Notes:
======================================================
 * Supported Kernels
   * All Kernels
     * Support USB based cameras through the User Mode
       libusb library
     * Support Ethernet based cameras (STX and PC
       based EthSrv and EthSim2)
   * Kernel 2.6
     * No support for LPT cameras
   * Kernel 2.4
     * Supports LPT camera through a kernel mode driver
       see our web site <www.sbig.com> for source code

 * If you have problems or comments please contact
   Matt Longmire at SBIG <matto@sbig.com>
   Jan Soldan <soldan@sunstel.asu.cas.cz> 

 Version History
 ================
 11/26/08	brought up to date with PC Version 4.60 Build 9
		added directory structure for like-minded files
		libsbigudrv.1.4.60.so - Version 4.60 Build 9
		sbigfcam.hex - Version 2.12 with support for ST-1602 and CFW
		sbiglcam.hex - Version 2.18
		sbigucam.hex - Version 2.42 for ST-7/8... Classic (no Remote Guide Head)
		sbigpcam.hex - Version 2.46 for ST-7/8... Pro with Remote Guide Head
		51-sbig.rules - modified to support ST-7 Classic and Pro
		sbig            "         "
 11/24/05	support for kernels 2.6.13 and above
		(i.e. pure udev) added by Jan Soldan
		(jsoldan@asu.cas.cz). See section H.

 08/09/05	libsbigudrv.so - Version 4.35 build 5B
 		added support for the non-kernel based
		usb driver libusb.  The libusb driver
		works under both kernels 2.4 and 2.6.

 02/22/05	libsbigudrv.so - Version 4.35 build 5
		sbgifcam.hex - Version 1.09
		sbigucam.hex - Version 1.41
		sbiglcam.hex - Version 1.09
======================================================
B. How to unpack SBIG's kernel driver compressed file.
======================================================
tar xzvf LinuxDevKit

The 'sbig' directory is created and contains all files
from the distribution.
======================================================
C. Low level LPT and USB Drivers
======================================================
Our cameras require low-level drivers to be installed
in order to talk to the cameras over the LPT or
USB ports.  As is often the case with Linux drivers
the issue is slightly complicated.

LPT Drivers
===========
At this time we only offer kernel mode LPT drivers
for kernel version 2.4.  As we haven't made a Parallel
port camera in the last several years we simply don't
have the resources to port this driver to kernel 2.6.
To install the kernel-based LPT drivers see the section
below.

USB Drivers
===========
At this time we only support the non-kernel based
(User mode) driver provided by the libusb
library.  To install this USB driver follow the
instructions in Section H below.
======================================================
D. How to install SBIG's Linux kernel-based drivers.
======================================================
su
cd sbig/kernel_2r4_stuff
./load_lpt  for LPT drivers

You may see some warnings, but that's normal:

Warning: loading ./modsbiglpt.o will taint the kernel: no license
Warning: loading ./modsbiglpt.o will taint the kernel: forced load

You can check installed driver.
less /proc/devices
cd /dev
ls -l sbiglpt*
You should see 3 devices named sbiglpt0-2,
each dedicated to one LPT port [0-2]

To remove modules from the memory, run scripts:
./unload_lpt
======================================================
E. How to install the libusb non-kernel based USB driver.
======================================================
1. Use your Linux Software Update tools to istall the
   libusb package and you're done.  If it's not listed
   there then download the current stable version from:
   http://libusb.sourceforge.net/ and follow the steps
   below. Note that the current version as of this note
   is 0.1.12-10
2. Unpack the downloaded tar file using:
   tar xzf xxx
   where xxx is the name of the tar file
3. Go to the unpacked directory
4. Run the configure script:
   CFLAGS=-O2 ./configure
5. Run the make command:
   make
6. Switch to superuser and install the library:
   su
   make install
   In this case, the libusb library will be installed in
   the default place /usr/local/lib
======================================================
F. How to install the shared libraries.
======================================================
su
cd sbig/libraries
cp *.so /usr/local/lib
cd /usr/local/lib
ln -s -f libsbigudrv.x.x.xx.so libsbigudrv.so

Where x.x.xx is the current shared library version

Set environment LD_LIBRARY_PATH variables:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
======================================================
G. How to activate the hotplug for SBIG USB cameras.
======================================================
Check if your distribution contains the fxload app
which uploads the SBIG's firmware into your USB camera.
The file should be located at:

ls /sbin/fxload

If not, visit the following web pages:

http://linux-hotplug.sourceforge.net

select the USB page and download the latest version
of the fxload file into /sbin directory.

Move all SBIG's firmware files *.hex and *.bin to
proper directory based on your Kernel below:

==========
Kernel 2.4
==========
su
cd sbig/firmware_files
cp *.hex /usr/share/usb
cp *.bin /lib/firmware

Check your /etc/hotplug/usb.usermap file and
add exactly the four lines which are in our distribution
of hotplug/sbig.usermap.

If your usb.usermap is empty, simply rename our
sbig.usermap file to usb.usermap and move it
to the /etc/hotplug/ directory.

Change mode of 'sbig' script and copy to the location:
chmod +x sbig 
cp sbig /etc/hotplug/usb/

Run /sbin/depmod -a

If everything is all right, when you turn ON your
USB camera, the firmware should be automatically
uploaded and after 10-15 seconds you should see and 
hear the camera's fan working. If not check the 
usb.usermap file. All the numbers must be in the 
hexadecimal notation, especially for older distributions.
After downloading the firmware, your camera should
be used by your application.
==========

==========
Kernel 2.6
==========
su
cd sbig/firmware_files
cp *.* /lib/firmware
==========
   
======================================================
H. How to install support for pure udev stuff for
   kernels 2.6.13 and above.
======================================================
For linux kernels 2.6.13 and above there is only a pure
udev (deamon) which cares of the dynamically plugged USB devices.
If you have this kernel, you have to follow the next steps,
otherwise your camera will not be automatically detected
by the system.

1. su

2. Check your kernel version:
   uname -r
   If you find kernel >= 2.6.13, follow next steps.

3. Follow previous sections E, F and G. Must be done. 

4. Copy SBIG's rules file:
   cd sbig/kernel_2r6_stuff
   cp 51-sbig.rules /etc/udev/rules.d

5. Copy SBIG's Python script:
   cp sbig_dev_permission.py /etc/hotplug/usb/

6. If you have it on your system, run 'udevstart'
   Note: Run 'udevstart' also whenever you rename or
   change the contents of the 51-sbig.rules file.  

   Now, when you switch your SBIG USB CCD camera, it should be
   automatically detected and prepared for use. If you experience
   some problems, first follow the next steps to see if you have
   proper RW access to your device. 
 
   Example: 
   Our SBIG ST-1603XME CCD camera was connected to the BUS = 1,
   as a DEVICE = 6:

   As 'su' run:
   a) lsusb  - you should see bus/device numbers of your camera.
      > lsusb
      Bus 001 Device 006: ID 0d97:0101 Santa Barbara Instrument Group 
      SBIG Astronomy Camera (with firmware)

   b) Check if device node at: /proc/bus/usb/001/006
      has RW access for all users:
      > ls -al
      -rw-rw-rw-  1 root root 57 2005-11-24 14:38 006

   c) On some systems the 51-sbig.rules file needs to
      be renamed 10-sbig.rules so it gets parsed before
      the standard 50-udev-default.rules file.  If your
      camera won't boot or doesn't have RW access then
      try renaming the rules file and then unplug the
      camera from the USB port and reconnect. If this
      doesn't work please contact:
      Jan Soldan <soldan@sunstel.asu.cas.cz> 
======================================================
I. Making the test application (optional) 
======================================================
Included are in the sbig_class_library directory are
SBIG Camera and Image Class Library source files,
a testmain.cpp and a Makefile that allow you to 
build a simple test application. Run make then run
the test application:

make
./testapp

Documentation for the SBIG Class Library is found
in a PDF file in this directory.
======================================================

