History log of /frameworks/av/media/mtp/MtpFfsHandle.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5410756e75fb7567540f13d3813f42f4ac3838a0 15-May-2017 Jerry Zhang <zhangjerry@google.com> Fix file transfer corner cases.

Fix zero packet read/write in corner cases
with initial read/writes. This affects transfers
of 16372 bytes to the device and transfers of
1012 bytes (or packet size - 12) from the device.

Test: Transfer various length files
Bug: 37175601
Change-Id: Ic1281e8757d1a33d78c66d2c57319b5ee38d6a46
/frameworks/av/media/mtp/MtpFfsHandle.cpp
c9cbf9870c28d5c65e7363db5291a4b89e1a8e8d 15-Apr-2017 Jerry Zhang <zhangjerry@google.com> Fix zero length packet handling

Ensure that a zero length packet is properly sent
/ received when handling data that is a multiple of the
endpoint size.

This fixes an issue where files whose size is a multiple
of the endpoint size would hang during transfer.

Bug: 37175601
Test: check successful file transfer.
Change-Id: Iaf3cea18422234d65b59f5961ef9fb3f3ee2049a
/frameworks/av/media/mtp/MtpFfsHandle.cpp
7063c936e50326883e672837036381f77080c2f3 05-Apr-2017 Jerry Zhang <zhangjerry@google.com> Wait for threads to finish before returning.

Prevents the thread struct from being deallocated
before the thread has finished.

Bug: 35152606
Test: Transfer files in both directions, verify behavior when
interrupted

Change-Id: Ic247072234977709711366636e6a39031fbc125a
/frameworks/av/media/mtp/MtpFfsHandle.cpp
0475d911fcc1e6e1b4f49626f59a0a07038590fa 03-Apr-2017 Jerry Zhang <zhangjerry@google.com> Add timeout to lock in MtpServer configure

In situations where MtpServer is in a bad state, this will prevent
the configure call from blocking indefinitely, which will prevent
a few visible problems and allow the state to recover on the next
config change.

Bug: 34873000
Test: Connect to AA test sled
Change-Id: I5daf9cfcec69c967bde6bf3f6fd90e1c434e18bb
/frameworks/av/media/mtp/MtpFfsHandle.cpp
2a14168f59bf5ad6e0cddb28c23f3e7fef75ac89 13-Feb-2017 Jerry Zhang <zhangjerry@google.com> Raise MTP max burst values.

Slightly increases transfer speeds on USB 3.0 connections.

Test: Transfer files
Change-Id: I25fb0a37fa92063356c4a2a0e0ba7f011b6b0527
/frameworks/av/media/mtp/MtpFfsHandle.cpp
746f8acd98c474be1c8b32df570667fda219bb10 22-Feb-2017 Yunlian Jiang <yunlian@google.com> fix uninitialized warning.

This fixes warning: The left operand of '%' is a garbage value.

Bug: None.
Test: The warning is gone.
Change-Id: I191e5bfd9d5f5136afcc2b5d8277c44b7d223998
/frameworks/av/media/mtp/MtpFfsHandle.cpp
94b13227f4c77bb303d7d004d889f6bf6a65f64c 09-Feb-2017 Jerry Zhang <zhangjerry@google.com> Increase EP_ALLOC ioctl number.

This prevents conflict with future upstream ioctls.

Test: Perform a file transfer.
Change-Id: If7313a048f528dfa57ef2fe52932ed664ad6f234
/frameworks/av/media/mtp/MtpFfsHandle.cpp
b4f54266042f0553b41409a3d1f0542b684c2129 03-Feb-2017 Jerry Zhang <zhangjerry@google.com> Retry allocations in case of ENODEV

Unlike the read() and write() calls, the ioctl() call
does not wait for endpoints to be enabled, which is
problematic if ioctls() are the first calls on the
usb connection, since they may be called before the
endpoints are set up. We'll have to retry if this
causes them to fail.

Bug: 34822471
Test: Change configs to mtp and ptp
Change-Id: I89610b9614c33f0b22535cc68cd0c9b502cb55c9
/frameworks/av/media/mtp/MtpFfsHandle.cpp
4418030f45cca8cad25051f49b142988fb635037 04-Feb-2017 Jerry Zhang <zhangjerry@google.com> Fix GetPartialObject on FFS

Linux apps use GetPartialObject to access
MTP files directly. Fix file offset handling
as well as lengths shorter than packet size.

Bug: 34822471
Test: Attach photos in Gmail, open directly from device
Change-Id: I9986cd8c70ed261f07e8f96a72e53b87341dd93f
/frameworks/av/media/mtp/MtpFfsHandle.cpp
cc9d0fdd302cf997607055e0a8b5559509cba766 27-Jan-2017 Jerry Zhang <zhangjerry@google.com> Make Mtp FFS allocations per session rather than per file

Workloads that send a large number of small files could
repeatedly allocate and free the buffer, causing fragmentation
and eventually running out of allocable memory. Instead
have the allocation be once per MTP session, and retry
with smaller buffers if it fails initially.

Bug: 34741015
Bug: 34822471
Test: Transfer files via MTP
Change-Id: I775376076d3a0c26765b211100830ea0c08450ef
/frameworks/av/media/mtp/MtpFfsHandle.cpp
e9d94421825dd90f0036d0dbde59b1f00f85f23b 18-Jan-2017 Jerry Zhang <zhangjerry@google.com> Keep ScopedEndpointBufferAlloc in variables

This way they don't immediately destruct. Also
up the logging for an allocation failure and use
posix_madvise to possibly improve memory performance.

Test: Transfer files and verify that allocs are scoped properly
Bug: 30976142
Change-Id: If8d2c03cefcc98a83bbb57618c35337529437f73
/frameworks/av/media/mtp/MtpFfsHandle.cpp
6a7905217bc840eae38125bb9ebced994b21442b 12-Jan-2017 Jerry Zhang <zhangjerry@google.com> Re-add MTP interface string

The string is used in some hosts like Mac to
check for MTP devices.

Test: Connect device
Bug: 30976142
Change-Id: Iac616997dc8afd0bdf03de0d13dee7baa6483904
/frameworks/av/media/mtp/MtpFfsHandle.cpp
5a804b923e2faa4bf9f02b238b94abceb3b6d0fa 16-Dec-2016 Jerry Zhang <zhangjerry@google.com> Use FUNCTIONFS_ENDPOINT_ALLOC_BUFFER ioctl to improve performance.

The ioctl preallocates kernel buffers for the read/write syscalls,
reducing memory fragmentation and allowing for larger buffers,
as well as removing the kmalloc overhead.

Test: Manual
Change-Id: I9f5fef1b1625c1a2cda374541d8042f7e0ba78f5
/frameworks/av/media/mtp/MtpFfsHandle.cpp
487be61fb0a38873aec1d12da92437fba5e728f2 24-Oct-2016 Jerry Zhang <zhangjerry@google.com> Refactored Mtp driver interface into multiple classes.

Added new interface for FunctionFS. This allows most of
the driver code to exist in userspace. The driver will
automatically use FunctionFS if it is enabled for that
device, otherwise it will default to the kernel driver.

The intention is to eventually deprecate the kernel driver.

Bug: 30976142
Change-Id: I36b8d16ca254fddd995b3ea1bd3d37b0ff4a28f7
Test: New automated tests for MtpFfsHandle, AsyncIO.
Manual testing on each device.
/frameworks/av/media/mtp/MtpFfsHandle.cpp