scudre / alarm-central-station-receiver

Python daemon for receiving events from a home alarm system via Contact ID protocol
Apache License 2.0
36 stars 10 forks source link

Check if /dev/usr/hiddevN exists before opening #15

Closed scudre closed 6 years ago

scudre commented 6 years ago

tigerjet_init.py searches through all of the /dev/usb/hiddevN files for the magicJack. However, this is being done by blindly attempting to open the first 10 hiddevN devices. If any /dev/usb/hiddevN files are missing, an exception is being thrown:

Traceback (most recent call last): File "/usr/local/bin/alarmd", line 11, in load_entry_point('alarm-central-station-receiver==0.0.8', 'console_scripts', 'alarmd')() File "/usr/local/lib/python2.7/dist-packages/alarm_central_station_receiver-0.0.8-py2.7-linux-armv7l.egg/alarm_central_station_receiver/main.py", line 216, in main initialize(args.config_path) File "/usr/local/lib/python2.7/dist-packages/alarm_central_station_receiver-0.0.8-py2.7-linux-armv7l.egg/alarm_central_station_receiver/main.py", line 182, in initialize tigerjet.initialize() File "/usr/local/lib/python2.7/dist-packages/alarm_central_station_receiver-0.0.8-py2.7-linux-armv7l.egg/alarm_central_station_receiver/tigerjet/tigerjet_init.py", line 20, in initialize with open('/dev/usb/hiddev%d' % id, 'rb') as fd: IOError: [Errno 2] No such file or directory: '/dev/usb/hiddev0'