#! /usr/bin/python
# Name:    sbig_dev_permission.py
# Version: 1.1
# Authors:
# Jan Soldan (astrosoft@email.cz)
# Matt Longmire (matto@sbig.com)
# History:
# 2006-08-20 - the version 1.0 released. (JS)
# 2011-07-28 - fixed some bugs for Fedora 8 (ML)
#=========================================================================
import sys, os
param	   = sys.argv[1]
dot_pos	 = param.find(".")
us_pos   = param.find("_")
bus_num	 = int(param[len("usbdev"):dot_pos])
dev_num	 = int(param[dot_pos + 1:us_pos])
dev_node = "/dev/bus/usb/%03d/%03d" % (bus_num, dev_num)
os.chmod(dev_node, 0666)
#=========================================================================
