Michal Demin wrote:
I don't really see the problem.
Between the time you check for a driver and claim there's a window of opportunity for another driver (usbfs or other) to attach. Best just try to claim and on suitable error try to detach, then try to claim again.
If other app is using the device then I will only try to claim. (Which will fail)
False and false. :) If another app is using the device, the kernel driver "usbfs" is active, and you will detach it, kicking the other app out. Then you will claim successfully if the other app does not try to claim again.
If you try to claim without first detaching, the claim will fail.
//Peter