Merge "Fix exceptions causing HTC dongle (and JBL headset) to fail connection logic." into oc-dr1-dev
This commit is contained in:
@@ -123,21 +123,27 @@ public class UsbDescriptorParser {
|
|||||||
|
|
||||||
ByteStream stream = new ByteStream(descriptors);
|
ByteStream stream = new ByteStream(descriptors);
|
||||||
while (stream.available() > 0) {
|
while (stream.available() > 0) {
|
||||||
UsbDescriptor descriptor = allocDescriptor(stream);
|
UsbDescriptor descriptor = null;
|
||||||
|
try {
|
||||||
|
descriptor = allocDescriptor(stream);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.e(TAG, "Exception allocating USB descriptor.", ex);
|
||||||
|
}
|
||||||
|
|
||||||
if (descriptor != null) {
|
if (descriptor != null) {
|
||||||
// Parse
|
// Parse
|
||||||
try {
|
try {
|
||||||
descriptor.parseRawDescriptors(stream);
|
descriptor.parseRawDescriptors(stream);
|
||||||
|
|
||||||
|
// Its OK to add the invalid descriptor as the postParse()
|
||||||
|
// routine will mark it as invalid.
|
||||||
|
mDescriptors.add(descriptor);
|
||||||
|
|
||||||
|
// Clean up
|
||||||
|
descriptor.postParse(stream);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.e(TAG, "Exception parsing USB descriptors.", ex);
|
Log.e(TAG, "Exception parsing USB descriptors.", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Its OK to add the invalid descriptor as the postParse()
|
|
||||||
// routine will mark it as invalid.
|
|
||||||
mDescriptors.add(descriptor);
|
|
||||||
|
|
||||||
// Clean up
|
|
||||||
descriptor.postParse(stream);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user