lglaf
lglaf copied to clipboard
After detaching kernel driver, the next read operation may fail
When lglaf.py is used for the first time on Linux, it may detach kernel drivers such as cdc_acm
. After this, there is somehow a race condition which could result in a timeout during the first read. Subsequent attempts seem to work fine though.
Maybe adding time.sleep(.1)
could help (haven't tried it though), but the source of the issue is unknown.
This is exactly the issue I emailed you about a few days ago. I remedied the situation in my application by resetting the device after opening it. Since I'm using Java the language is a little different but it can easily be ported to python.
My fix: LibUsb.resetDevice( DeviceHandle );
Also, since my LgLaf is written in Java, I'm guessing anyway, I have to reset the device immediately after reading a response otherwise the next command gets sent but reading the response times out, usually with error 0x80000017.