add usb hard reset

This commit is contained in:
petrucci4prez 2017-05-30 01:01:30 -04:00
parent dd00c560eb
commit 49cf68ab63
1 changed files with 5 additions and 9 deletions

14
main.py
View File

@ -3,13 +3,12 @@
import os, time, signal, traceback, logging import os, time, signal, traceback, logging
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
from sharedLogging import unmountGluster from sharedLogging import unmountGluster # this should be first program module
from stateMachine import StateMachine
from auxilary import resetUSBDevice
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def printTrace(t):
logger.critical('\n' + t)
def clean(): def clean():
GPIO.cleanup() GPIO.cleanup()
@ -34,10 +33,10 @@ if __name__ == '__main__':
GPIO.setwarnings(False) GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM) GPIO.setmode(GPIO.BCM)
resetUSBDevice('1-1')
from notifier import criticalError from notifier import criticalError
from stateMachine import StateMachine
stateMachine = StateMachine() stateMachine = StateMachine()
# TODO: segfaults are annoying :( # TODO: segfaults are annoying :(
@ -55,10 +54,7 @@ if __name__ == '__main__':
except NameError: except NameError:
pass pass
try: logger.critical(t)
logger.critical(t)
except NameError:
logger.critical(t)
finally: finally:
clean() clean()