Occasionally Host PC cannot attach to the Phidget VINT Hub
Posted: Tue Dec 18, 2018 3:15 pm
Hi,
I've noticed that on rare occasions (~1% of the time), the Phidget22 library cannot attach to my Phidget VINT Hub. Attached is the Python Script I run.
IMPORTANT you need to run the script in a loop from bash i.e. so that the library reloads (?) each time
When it fails, it outputs the following error to stdout/stderr
Attached are the debug logs when it works versus when it does not work. The main difference is that when it doesn't work, it uses the Interrupt OUT Endpoint, instead of the Control Endpoint
Thanks,
Tomasz
I've noticed that on rare occasions (~1% of the time), the Phidget22 library cannot attach to my Phidget VINT Hub. Attached is the Python Script I run.
Code: Select all
import time
from Phidget22.Devices.DigitalOutput import DigitalOutput
from Phidget22.PhidgetException import PhidgetException
from Phidget22.Devices.Log import Log
from Phidget22.LogLevel import *
def ErrorEvent(e, eCode, description):
print("Error %i : %s" % (eCode, description))
def main(port1, port2):
ch1 = DigitalOutput()
ch2 = DigitalOutput()
ch1.setOnErrorHandler(ErrorEvent)
ch2.setOnErrorHandler(ErrorEvent)
ch1.setHubPort(port1)
ch2.setHubPort(port2)
ch1.setIsHubPortDevice(1)
ch2.setIsHubPortDevice(1)
try:
# Wait at most 10 seconds to attach the port, returns as soon as the port is found
ch1.openWaitForAttachment(10000)
ch2.openWaitForAttachment(10000)
except PhidgetException as err:
print("Caught exception {0} while attaching to Phidget, retrying once".format(err))
time.sleep(5)
# If openWaitForAttachment() fails, that means we encountered a bug with
# the Phidget USB driver
ch1.openWaitForAttachment(10000)
ch2.openWaitForAttachment(10000)
ch1.setState(1)
print("Success")
return
if __name__=="__main__":
timestamp = time.time()
logfile = "test_" + str(timestamp)
print(timestamp)
Log.enable(LogLevel.PHIDGET_LOG_VERBOSE, logfile)
main(3,4)
Code: Select all
for i in {1..250}; do python3 phidgets_never_attaches.py ; done
Code: Select all
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Error 5 : Local open failed with error: 0x1c - Unexpected Error
Thanks,
Tomasz