98 Commits

Author SHA1 Message Date
Mike Lockwood
456d8e6e67 MTP: Turn off excessive logging
Change-Id: Ib0dd8cb99efa324d0b4e742bffeb913d6122ace2
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-27 12:38:29 -04:00
Mike Lockwood
bc4cb0bc79 MTP host: Add support for reading files from an MTP device via ParcelFileDescriptor
Also added some support for sending files to the device that hasn't been debugged yet.
Add locking to MtpDevice to prevent it from attempting multiple transactions simultaneously.

Change-Id: I2b995ba0af086cc6920bd6b8c869f540ad78560a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-26 20:40:45 -04:00
Mike Lockwood
f78b26a572 MTP: Don't request thumbnails for folder objects in MtpCursor
Change-Id: I75a0a834ab746bed0a35883539c8dbc104789157
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-26 20:36:32 -04:00
Mike Lockwood
86187098ce MTP: Add hard coded support to recognize a couple MTP music players for testing purposes.
Change-Id: I2d09d78e83d13cfb3edff02372a6fc34b1e4d8b1
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-26 20:33:02 -04:00
Mike Lockwood
30881f68c9 Merge "MTP host fixes:" 2010-07-20 09:06:41 -07:00
Mike Lockwood
3c51d6a9ef MTP host fixes:
Add support for detecting android MTP devices
Fix problem reading data packet with header sent separately from payload.

Change-Id: I07b34af6783ebe2e63a317796ba0c8223df86edf
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-20 12:01:36 -04:00
Andy McFadden
aecf390618 Fix sim-eng build.
The LOCAL_PATH assignment was not available to the new host library
on simulator builds.

Change-Id: I7727f17ecc8f457f92bd6fa9ec13025dd8a56390
2010-07-20 08:18:43 -07:00
Mike Lockwood
108505b30f MTP: Remove race condition in initial device enumeration for host mode.
Change-Id: Iee01aaae3f8cca4234daa289bef6631da4d6c2b6
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-20 09:49:50 -04:00
Mike Lockwood
9bbc2ea9ad MTP: Fix problems reading and writing arrays in property values.
Change-Id: Idd53b63fd32698a3ffc90f174d16ae597b4feb36
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-20 09:49:50 -04:00
Mike Lockwood
bbd9f36efa MTP: add Linux host library for MTP/PTP host support.
Change-Id: Ie2ce60b957ee428a8e8db46a70c5a0ade8445007
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-20 09:49:50 -04:00
Mike Lockwood
dc453d4ee7 MTP: Only send events to host if we have an open session.
Change-Id: I7b2d0c88c2d2ae0490247703d0fb1b862154db92
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-19 14:29:58 -04:00
Mike Lockwood
ff164a7d6f Exclude MTP implementation from simulator build
Change-Id: I93364c74c26ba6e2bf6b08f1bd82802b966c8dfb
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-15 15:27:38 -04:00
Mike Lockwood
9c7fdf521b Remove our copy of the f_mtp.h kernel header, now that it is in bionic.
Change-Id: I2b5e72bf25b3525ace4b919c6e8b6bd6750f6dfa
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-15 13:37:43 -04:00
Mike Lockwood
be125a50b4 MTP: Add support for sending events to the host when objects are added and removed
Change-Id: Ia1d5232b919c644c670ff9ca651eca92b3f9ad42
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-13 20:04:22 -04:00
Mike Lockwood
d815f79766 Integrate host to device file transfer with the media provider.
MTP file transfers happen in two stages.  The SendObjectInfo command sends
some information about the file and reserves an ObjectHandle for the new file.
The file transfer is then performed using the SendObject command.

To support this in the media provider, MtpDatabase.beginSendObject receives
the information from SendObjectInfo and creates an row for it in the MTP objects
table for the new file.  After the file transfer has completed, then
MtpDatabase.endSendObject is called.  In endSendObject, we run the media scanner
on the new file, which will add a row to the images, audio, video
or audio playlist table.

To avoid the media scanner creating a second row for the file in the MTP objects
table, we pass the ObjectHandle created in beginSendObject to the media scanner,
which then passes it to the media provider via the content values when it
performs its insert.

Change-Id: I1ebcc63d6bd4404b0d3a93c703a9d3c097381d3a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-12 14:01:22 -04:00
Mike Lockwood
c5c7853b63 Remove some scafolding and test code that is no longer worth maintaining.
Change-Id: I9ee62d2463d8df1246a84774e8ac7e674778279a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-09 11:07:55 -04:00
Mike Lockwood
d21eac9c70 MTP: Use media provider database to implement MTP device support.
Uses a new "MTP objects" table in the media provider to support basic
enumeration of the external storage file system.
Support for accessing audio, video and image metadata in the existing
media provider tables will be added in a later commit.

The C++ MtpDatabase class is now abstract, to support a proxy subclass that
calls through JNI to the Java MtpDatabase class in the media provider.

Change-Id: I90f0db5f3acc5d35ae78c27a8507edff16d14305
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-08 16:21:09 -04:00
Mike Lockwood
2d6c9e9c4e MTP: remove separate audio table from prototype MTP database
Change-Id: I5e4b49b741a0a3c6ddf5afcbb20a0d7c9515c8ce
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-08 16:02:16 -04:00
Mike Lockwood
dad69277b7 MTP: Fix ownership and file permissions for transferred files and folders
All new files and folders are created with group sdcard_rw
Permissions for new files are 0664 and directories 0775

Change-Id: I6d508231150f687e2e529112fd47f10e30fa594f
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-02 15:19:32 -04:00
Mike Lockwood
8dd2a39bae MTP: Make MtpDatabase class abstract so we can have multiple implementations
Rename existing test database to MtpSqliteDatabase
This is the first step in transitioning to using the media provider database

Change-Id: I5f36c854c6e76a79137c267b000a52ced803776c
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-02 14:14:06 -04:00
Mike Lockwood
d0e1a9f40e MTP: Remove an unnecessary thread from the MtpClient class.
Now a single thread is used for passing USB host events up to MtpClient.

Change-Id: I0e3a277956cb3d1036da122ea10acb03a27844d6
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-01 11:39:42 -04:00
Mike Lockwood
0723394051 Try to fix the simulator build.
Change-Id: I3640e9eba433e711e23af1c6182e38c86c5b60bb
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-30 22:19:24 -04:00
Mike Lockwood
767c5e4be0 MTP: Implement GetObjectPropDesc
Change-Id: I283651257254fc9cd9d93eab4605c5e33d3db93e
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-30 17:02:07 -04:00
Mike Lockwood
98ef64e4a8 MTP: Add MtpServer Java class to wrap MTP device support.
Change-Id: I818c2d3b3f52ad5bb515acc4d3288b2b43e11908
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-30 17:02:07 -04:00
Mike Lockwood
3e6616dd3d MTP: replace printfs with logcat
Change-Id: I2c30921098e2dc049dc5fc1e0a548ead33c363e0
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-30 13:59:32 -04:00
Mike Lockwood
42dbfa51ae MTP: Use a fd instead of a file path in file transfer ioctls.
This restricts the driver to the client's permissions when copying files
to avoid potential security problems.

Change-Id: I9b3151168d334fe4374875804d4ba82bef44db3b
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-22 16:38:01 -04:00
Mike Lockwood
dff6e6e378 mtptest: Add option to specify storage path at the command line.
Change-Id: Iac8a34ffb8177018a9164b3f2f97b2e84c3d8f1c
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-22 16:37:56 -04:00
Mike Lockwood
9eb5ac9cc7 MTP: Use stat.st_mode instead of dirent.d_type to determine file type.
dirent.d_type is not implemented on all file systems.

Change-Id: I50a01fd77a9f976f215e7ff98dd04f0f2611bbce
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-14 23:00:30 -07:00
Mike Lockwood
622ccdc218 MTP device: Read manufacturer name and serial number from system properties.
Change-Id: I8d1ad79f38aaaa50fa8899e6b614096af95fdf39
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-14 17:59:46 -07:00
Mike Lockwood
44cf0a0682 MTP: Fix uninitialized pointer bug.
Change-Id: Ia07ebd48aeb483e66957f5a174992d200494a744
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-14 09:13:11 -07:00
Mike Lockwood
e0a89f611d MTP: Add host support for deleting objects.
For example, deleting pictures on a digital camera.

Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-11 17:47:35 -04:00
Mike Lockwood
dda5686092 MTP: Add support for retrieving thumbnails to MTP content provider.
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-10 16:58:03 -04:00
Mike Lockwood
f724eed566 MTP provider: Add columns for MTP ObjectInfo dataset to the MTP objects table
Signed-off-by: Mike Lockwood <lockwood@android.com>

Change-Id: Ife0563ad1c3b3dbc2461e1a9e784cbb4653b3435
2010-06-10 14:08:29 -04:00
Kenny Root
36a685d70f Include stdlib to fix sim build
Change-Id: I7732461a9351f53f9ddadcfb26485f2e553e056b
2010-06-08 08:38:34 -07:00
Mike Lockwood
90f4873446 MTP: host support for retrieving device property descriptors
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-07 09:34:41 -04:00
Mike Lockwood
b0ccc7ca75 Merge "MTP: Add support for host cancellation of file transfers." 2010-06-04 07:20:16 -07:00
Mike Lockwood
a82d3c550b MTP: Add support for host cancellation of file transfers.
Change-Id: I72df423f8017286e41adae525e6fbcb6b8440687
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-04 09:49:21 -04:00
Doug Kwan
bebfb6aa0c Add missing library to linker command line.
Change-Id: Ia9ddf6e6bb5e72c32372a2f460806b6cbb7ec660
2010-06-03 22:49:34 -07:00
Jing Yu
42006894ed Add missing libraries, in order for gold to work.
gold is more strict than ld. If building A depends on libB directly,
we must specify -lB at link time.

Change-Id: Iac7cec58cbae5e0cbcfc9adab924db6733192d20
2010-06-03 20:53:52 -07:00
Mike Lockwood
755fd61725 Prototype Content Provider support for MTP/PTP devices.
At this point much of the plumbing is in place, but only a few simple queries
are supported.
This is enough to support a proof of concept sample program that navigates
the file hierarchy of a digital camera connected via USB.

Also removed obsolete ptptest host test program.

Change-Id: I17644344b9f0ce1ecc302bc0478c1f3d44a1647f
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-01 22:12:44 -04:00
Mike Lockwood
4f92fffc71 MTP: adjust ptptest app for changes in libusbhost API.
Change-Id: I775e08c851a55d775b532129be11fb19515fbf6e
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-25 08:12:25 -04:00
Mike Lockwood
3743365114 PTP host: Implement getObjectHandles and getObjectInfo commands
Change-Id: I3ff6e52237f400b4e50c534a1f964c80789bfe98
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-19 15:16:38 -04:00
Mike Lockwood
5bae7f615b More work on PTP host support.
Change-Id: Ifbd5bd5efa3cdb750ae1a2aae38181457554d34d
Signed-off-by: Mike Lockwood <mike@spruce.(none)>
2010-05-19 12:38:03 -04:00
Mike Lockwood
d0782678df MTP: More prototyping work:
New media scanner test program
Media scanner now cleans up after files that no longer exist
Separate database table for audio files
Extract metadata from audio files with libstagefright

Change-Id: I2bd0fe877836c741658e72fcfeb89c11be0d9b41
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-18 16:12:38 -04:00
Mike Lockwood
9eff99e9d5 Add -p option to mtptest program to run in PTP mode instead of MTP
Change-Id: Idbd1437756daab8d6141db49b07d4eb0814c9e7e
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-17 10:57:09 -04:00
Mike Lockwood
8d3257a7dc Move MTP code to the android namespace
Change-Id: I5da48038fd5e4cdeefaeba42cdc74eb588b3448d
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-14 10:10:36 -04:00
Mike Lockwood
18ff7b4c37 Exclude mtptest program from simulator builds.
Change-Id: Ia9751a06d7607363e8c16b71f6f3c524833395a0
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-13 16:28:00 -04:00
Mike Lockwood
56118b5b38 Checkpoint work on MTP and PTP investigation.
This change includes work in progress on a C++ library for both host and device
MTP and PTP support.
Currently the makefile builds two test programs:

mtptest - a command line test program that implements a small subset of device side MTP.
Requires a kernel driver that has not been checked in yet.

ptptest - a host tool to test USB host support for detecting and communicating with
digital cameras over PTP.  Runs on Linux host.

Later this will be reformulated as a native library that will be used in the media process.

Change-Id: I81aab279975b600b59d99013ab97f9adf0b58da7
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-13 15:36:47 -04:00