adb: cleanup some portions of client usb interfaces
Cleanup to remove open coded functions. Test: build Bug: 63736262 Bug: 38446744 Bug: 66912053 Change-Id: I3e6e5a22542934837b6a03523987141dc2776d48
This commit is contained in:
parent
0a78cc1b76
commit
8f3b8873b0
|
@ -253,7 +253,7 @@ static void find_usb_device(const std::string& base,
|
|||
continue;
|
||||
}
|
||||
/* aproto 01 needs 0 termination */
|
||||
if (interface->bInterfaceProtocol == 0x01) {
|
||||
if (interface->bInterfaceProtocol == ADB_PROTOCOL) {
|
||||
max_packet_size = ep1->wMaxPacketSize;
|
||||
zero_mask = ep1->wMaxPacketSize - 1;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ AndroidInterfaceAdded(io_iterator_t iterator)
|
|||
kr = (*iface)->GetInterfaceClass(iface, &if_class);
|
||||
kr = (*iface)->GetInterfaceSubClass(iface, &subclass);
|
||||
kr = (*iface)->GetInterfaceProtocol(iface, &protocol);
|
||||
if(if_class != ADB_CLASS || subclass != ADB_SUBCLASS || protocol != ADB_PROTOCOL) {
|
||||
if (!is_adb_interface(if_class, subclass, protocol)) {
|
||||
// Ignore non-ADB devices.
|
||||
LOG(DEBUG) << "Ignoring interface with incorrect class/subclass/protocol - " << if_class
|
||||
<< ", " << subclass << ", " << protocol;
|
||||
|
|
|
@ -531,25 +531,23 @@ int recognized_device(usb_handle* handle) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (is_adb_interface(interf_desc.bInterfaceClass, interf_desc.bInterfaceSubClass,
|
||||
interf_desc.bInterfaceProtocol)) {
|
||||
if (interf_desc.bInterfaceProtocol == 0x01) {
|
||||
AdbEndpointInformation endpoint_info;
|
||||
// assuming zero is a valid bulk endpoint ID
|
||||
if (AdbGetEndpointInformation(handle->adb_interface, 0, &endpoint_info)) {
|
||||
handle->max_packet_size = endpoint_info.max_packet_size;
|
||||
handle->zero_mask = endpoint_info.max_packet_size - 1;
|
||||
D("device zero_mask: 0x%x", handle->zero_mask);
|
||||
} else {
|
||||
D("AdbGetEndpointInformation failed: %s",
|
||||
android::base::SystemErrorCodeToString(GetLastError()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
if (!is_adb_interface(interf_desc.bInterfaceClass, interf_desc.bInterfaceSubClass,
|
||||
interf_desc.bInterfaceProtocol)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
AdbEndpointInformation endpoint_info;
|
||||
// assuming zero is a valid bulk endpoint ID
|
||||
if (AdbGetEndpointInformation(handle->adb_interface, 0, &endpoint_info)) {
|
||||
handle->max_packet_size = endpoint_info.max_packet_size;
|
||||
handle->zero_mask = endpoint_info.max_packet_size - 1;
|
||||
D("device zero_mask: 0x%x", handle->zero_mask);
|
||||
} else {
|
||||
D("AdbGetEndpointInformation failed: %s",
|
||||
android::base::SystemErrorCodeToString(GetLastError()).c_str());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void find_devices() {
|
||||
|
|
Loading…
Reference in New Issue