platform_system_core/libusbhost
Andrew Chant 3af9e40c66 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
2017-11-07 18:15:49 -08:00
..
include/usbhost Merge "usblib: Wrap USBDEVFS_REAPURBNDELAY ioctl" 2016-10-27 16:15:12 +00:00
Android.bp Mark the modules as VNDK in Android.bp 2017-09-14 08:35:16 +00:00
usbhost.c usblib: fix race & delay waiting for perms on open 2017-11-07 18:15:49 -08:00