usblib: fix race & delay waiting for perms on open
in usb_device_open, if permission is denied for a USB
device node, the current code retries read-only, then sleeps
for a second before retrying.
If the permission was changed to +rw between the two file opens,
the device could be inadvertently opened read-only.
Also, change the polling interval to 100ms. 1s is a long wait
for a function on the critical path of a user interaction.
Bug: 68337205
Bug: 68782236
Test: with debug messages enabled, connected & disconnected
a USB audio headset. Saw the writeable file descriptor
returned.
Change-Id: I06048cc2c09bf6ed1abada5d12b5559be768fbaf
1 file changed