Loading media/mtp/MtpDevice.cpp +16 −5 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ namespace android { namespace { static constexpr int USB_CONTROL_TRANSFER_TIMEOUT_MS = 200; } // namespace #if 0 static bool isMtpDevice(uint16_t vendor, uint16_t product) { // Sandisk Sansa Fuze Loading Loading @@ -84,15 +90,18 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) { interface->bInterfaceSubClass == 1 && // Still Image Capture interface->bInterfaceProtocol == 1) // Picture Transfer Protocol (PIMA 15470) { char* manufacturerName = usb_device_get_manufacturer_name(device); char* productName = usb_device_get_product_name(device); char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); ALOGD("Found camera: \"%s\" \"%s\"\n", manufacturerName, productName); free(manufacturerName); free(productName); } else if (interface->bInterfaceClass == 0xFF && interface->bInterfaceSubClass == 0xFF && interface->bInterfaceProtocol == 0) { char* interfaceName = usb_device_get_string(device, interface->iInterface); char* interfaceName = usb_device_get_string(device, interface->iInterface, USB_CONTROL_TRANSFER_TIMEOUT_MS); if (!interfaceName) { continue; } else if (strcmp(interfaceName, "MTP")) { Loading @@ -102,8 +111,10 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) { free(interfaceName); // Looks like an android style MTP device char* manufacturerName = usb_device_get_manufacturer_name(device); char* productName = usb_device_get_product_name(device); char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); ALOGD("Found MTP device: \"%s\" \"%s\"\n", manufacturerName, productName); free(manufacturerName); free(productName); Loading Loading
media/mtp/MtpDevice.cpp +16 −5 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ namespace android { namespace { static constexpr int USB_CONTROL_TRANSFER_TIMEOUT_MS = 200; } // namespace #if 0 static bool isMtpDevice(uint16_t vendor, uint16_t product) { // Sandisk Sansa Fuze Loading Loading @@ -84,15 +90,18 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) { interface->bInterfaceSubClass == 1 && // Still Image Capture interface->bInterfaceProtocol == 1) // Picture Transfer Protocol (PIMA 15470) { char* manufacturerName = usb_device_get_manufacturer_name(device); char* productName = usb_device_get_product_name(device); char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); ALOGD("Found camera: \"%s\" \"%s\"\n", manufacturerName, productName); free(manufacturerName); free(productName); } else if (interface->bInterfaceClass == 0xFF && interface->bInterfaceSubClass == 0xFF && interface->bInterfaceProtocol == 0) { char* interfaceName = usb_device_get_string(device, interface->iInterface); char* interfaceName = usb_device_get_string(device, interface->iInterface, USB_CONTROL_TRANSFER_TIMEOUT_MS); if (!interfaceName) { continue; } else if (strcmp(interfaceName, "MTP")) { Loading @@ -102,8 +111,10 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) { free(interfaceName); // Looks like an android style MTP device char* manufacturerName = usb_device_get_manufacturer_name(device); char* productName = usb_device_get_product_name(device); char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); ALOGD("Found MTP device: \"%s\" \"%s\"\n", manufacturerName, productName); free(manufacturerName); free(productName); Loading