|
|
@ -161,6 +161,8 @@ def addDevice(options): |
|
|
|
try: |
|
|
|
devices.append(Device(udi)) |
|
|
|
except Exception, ex: |
|
|
|
if options['verbose']: |
|
|
|
print ex |
|
|
|
pass |
|
|
|
|
|
|
|
if len(devices) == 0: |
|
|
@ -219,14 +221,14 @@ def addDevice(options): |
|
|
|
writeConf(options, doc) |
|
|
|
|
|
|
|
def usage(): |
|
|
|
print 'Usage: %s [--help] [--config=path] [--add-user=name | --add-device=name]' % os.path.basename(__file__) |
|
|
|
print 'Usage: %s [--help] [--verbose] [--config=path] [--add-user=name | --add-device=name]' % os.path.basename(__file__) |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
import getopt |
|
|
|
|
|
|
|
try: |
|
|
|
opts, args = getopt.getopt(sys.argv[1:], "hd:nu:c:", |
|
|
|
["help", "add-device=", "add-user=", "config="]) |
|
|
|
opts, args = getopt.getopt(sys.argv[1:], "hvd:nu:c:", |
|
|
|
["help", "verbose", "add-device=", "add-user=", "config="]) |
|
|
|
except getopt.GetoptError: |
|
|
|
usage() |
|
|
|
|
|
|
@ -234,11 +236,13 @@ if len(args) != 0: |
|
|
|
usage() |
|
|
|
|
|
|
|
options = { 'deviceName' : None, 'userName' : None, |
|
|
|
'configFile' : '/etc/pamusb.conf' } |
|
|
|
'configFile' : '/etc/pamusb.conf', 'verbose' : False } |
|
|
|
|
|
|
|
for o, a in opts: |
|
|
|
if o in ("-h", "--help"): |
|
|
|
usage() |
|
|
|
if o in ("-v", "--verbose"): |
|
|
|
options['verbose'] = True |
|
|
|
if o in ("-d", "--add-device"): |
|
|
|
options['deviceName'] = a |
|
|
|
if o in ("-u", "--add-user"): |
|
|
|