# Name:      51-sbig.rules 
# Version:   1.5
# Author:    Jan Soldan soldan@sunstel.asu.cas.cz

# Description: This script defines the udev rules for SBIG USB CCD cameras.

# Note:
#
# File locations for all distributions of Linux kernels 2.6:
# ============================================================
# 1) /usr/local/lib/libsbigudrv.so
# 2) All *.hex and *.bin files in: /lib/firmware 
#
# For ST-402 family cameras (SBIG ST-402/1603/3200):
# ============================================================
# The stfga.bin file was moved to /dev/firmware directory. 
# If not there, the ST-402 family cams. will not work properly,
# there may be a lot of RX_TIMEOUT errors during the CCD
# chip readout. 
# You have to hear a sound of several shutter clicks when you 
# establish link to the camera for the _first_ time. If not, 
# the stfga.bin gate array was not uploaded!
#
#================================
# 1. Pre-renumeration device IDs:
#================================

# SBIG ST-7/8/9/10/2K cameras
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="0d97", ATTRS{idProduct}=="0001", \
SYMLINK+="sbig_$env{BUSNUM}_$env{DEVNUM}", RUN+="/sbin/fxload -I /lib/firmware/sbigucam.hex -D $env{DEVLINKS}"

# SBIG ST-L cameras
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="0d97", ATTRS{idProduct}=="0002", \
SYMLINK+="sbig_$env{BUSNUM}_$env{DEVNUM}", RUN+="/sbin/fxload -I /lib/firmware/sbiglcam.hex -D $env{DEVLINKS}"

# SBIG ST-402/1603/3200 cameras
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="0d97", ATTRS{idProduct}=="0003", \
SYMLINK+="sbig_$env{BUSNUM}_$env{DEVNUM}", RUN+="/sbin/fxload -I /lib/firmware/sbigfcam.hex -D $env{DEVLINKS} -t fx2"

#=================================
# 2. Post-renumeration device IDs:
#=================================
ACTION=="add", BUS=="usb", ATTRS{idVendor}=="0d97", ATTRS{idProduct}=="0101", MODE="0666" 

# STX and ST-i cameras
ACTION=="add", BUS=="usb", ATTRS{idVendor}=="0d97", ATTRS{idProduct}=="0102", MODE="0666"
