Loading media/mtp/MtpClient.cpp +52 −38 Original line number Diff line number Diff line Loading @@ -118,6 +118,21 @@ bool MtpClient::usbDeviceAdded(const char *devname) { { LOGD("Found camera: \"%s\" \"%s\"\n", usb_device_get_manufacturer_name(device), usb_device_get_product_name(device)); } else if (interface->bInterfaceClass == 0xFF && interface->bInterfaceSubClass == 0xFF && interface->bInterfaceProtocol == 0) { char* interfaceName = usb_device_get_string(device, interface->iInterface); if (!interfaceName || strcmp(interfaceName, "MTP")) continue; // Looks like an android style MTP device LOGD("Found MTP device: \"%s\" \"%s\"\n", usb_device_get_manufacturer_name(device), usb_device_get_product_name(device)); } else { // not an MTP or PTP device continue; } // if we got here, then we have a likely MTP or PTP device // interface should be followed by three endpoints struct usb_endpoint_descriptor *ep; Loading Loading @@ -165,7 +180,6 @@ bool MtpClient::usbDeviceAdded(const char *devname) { return mDone; } } } usb_device_close(device); return mDone; Loading media/mtp/MtpDataPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -372,7 +372,7 @@ int MtpDataPacket::writeDataHeader(int fd, uint32_t length) { int MtpDataPacket::read(struct usb_endpoint *ep) { // first read the header int length = transfer(ep, mBuffer, mBufferSize); if (length > MTP_CONTAINER_HEADER_SIZE) { if (length >= MTP_CONTAINER_HEADER_SIZE) { // look at the length field to see if the data spans multiple packets uint32_t totalLength = MtpPacket::getUInt32(MTP_CONTAINER_LENGTH_OFFSET); while (totalLength > length) { Loading Loading
media/mtp/MtpClient.cpp +52 −38 Original line number Diff line number Diff line Loading @@ -118,6 +118,21 @@ bool MtpClient::usbDeviceAdded(const char *devname) { { LOGD("Found camera: \"%s\" \"%s\"\n", usb_device_get_manufacturer_name(device), usb_device_get_product_name(device)); } else if (interface->bInterfaceClass == 0xFF && interface->bInterfaceSubClass == 0xFF && interface->bInterfaceProtocol == 0) { char* interfaceName = usb_device_get_string(device, interface->iInterface); if (!interfaceName || strcmp(interfaceName, "MTP")) continue; // Looks like an android style MTP device LOGD("Found MTP device: \"%s\" \"%s\"\n", usb_device_get_manufacturer_name(device), usb_device_get_product_name(device)); } else { // not an MTP or PTP device continue; } // if we got here, then we have a likely MTP or PTP device // interface should be followed by three endpoints struct usb_endpoint_descriptor *ep; Loading Loading @@ -165,7 +180,6 @@ bool MtpClient::usbDeviceAdded(const char *devname) { return mDone; } } } usb_device_close(device); return mDone; Loading
media/mtp/MtpDataPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -372,7 +372,7 @@ int MtpDataPacket::writeDataHeader(int fd, uint32_t length) { int MtpDataPacket::read(struct usb_endpoint *ep) { // first read the header int length = transfer(ep, mBuffer, mBufferSize); if (length > MTP_CONTAINER_HEADER_SIZE) { if (length >= MTP_CONTAINER_HEADER_SIZE) { // look at the length field to see if the data spans multiple packets uint32_t totalLength = MtpPacket::getUInt32(MTP_CONTAINER_LENGTH_OFFSET); while (totalLength > length) { Loading