diff options
author | Mike Lockwood <lockwood@android.com> | 2011-06-21 08:27:06 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-06-21 08:27:06 -0400 |
commit | 7d40d42a364f520da853b41956b0a18ed172491b (patch) | |
tree | babec49303223c277a3a511076fe46ab35d3dcaf /media/mtp | |
parent | 422bf6702f4f099e6fd4fab4c26b0deaeb684e9f (diff) | |
download | frameworks_base-7d40d42a364f520da853b41956b0a18ed172491b.zip frameworks_base-7d40d42a364f520da853b41956b0a18ed172491b.tar.gz frameworks_base-7d40d42a364f520da853b41956b0a18ed172491b.tar.bz2 |
MTP: Add support for PTP variant of GetDeviceInfo result.
Change-Id: I09f86fda768b7697665e401adb9516588859bf59
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp')
-rw-r--r-- | media/mtp/MtpServer.cpp | 18 | ||||
-rw-r--r-- | media/mtp/MtpServer.h | 5 |
2 files changed, 19 insertions, 4 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp index 9ec73c4..bc04e8c 100644 --- a/media/mtp/MtpServer.cpp +++ b/media/mtp/MtpServer.cpp @@ -95,10 +95,11 @@ static const MtpEventCode kSupportedEventCodes[] = { MTP_EVENT_STORE_REMOVED, }; -MtpServer::MtpServer(int fd, MtpDatabase* database, +MtpServer::MtpServer(int fd, MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm) : mFD(fd), mDatabase(database), + mPtp(ptp), mFileGroup(fileGroup), mFilePermission(filePerm), mDirectoryPermission(directoryPerm), @@ -426,9 +427,20 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { // fill in device info mData.putUInt16(MTP_STANDARD_VERSION); - mData.putUInt32(6); // MTP Vendor Extension ID + if (mPtp) { + mData.putUInt32(0); + } else { + // MTP Vendor Extension ID + mData.putUInt32(6); + } mData.putUInt16(MTP_STANDARD_VERSION); - string.set("microsoft.com: 1.0; android.com: 1.0;"); + if (mPtp) { + // no extensions + string.set(""); + } else { + // MTP extensions + string.set("microsoft.com: 1.0; android.com: 1.0;"); + } mData.putString(string); // MTP Extensions mData.putUInt16(0); //Functional Mode mData.putAUInt16(kSupportedOperationCodes, diff --git a/media/mtp/MtpServer.h b/media/mtp/MtpServer.h index 859a18e..dfa8258 100644 --- a/media/mtp/MtpServer.h +++ b/media/mtp/MtpServer.h @@ -39,6 +39,9 @@ private: MtpDatabase* mDatabase; + // appear as a PTP device + bool mPtp; + // group to own new files and folders int mFileGroup; // permissions for new files and directories @@ -87,7 +90,7 @@ private: Vector<ObjectEdit*> mObjectEditList; public: - MtpServer(int fd, MtpDatabase* database, + MtpServer(int fd, MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm); virtual ~MtpServer(); |