Loading media/mtp/MtpServer.cpp +13 −16 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,6 @@ #include <android-base/properties.h> #include <android-base/properties.h> #include <chrono> #include <chrono> #include <cutils/properties.h> #include <dirent.h> #include <dirent.h> #include <errno.h> #include <errno.h> #include <fcntl.h> #include <fcntl.h> Loading Loading @@ -96,12 +95,20 @@ static const MtpEventCode kSupportedEventCodes[] = { }; }; MtpServer::MtpServer(MtpDatabase* database, bool ptp, MtpServer::MtpServer(MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm) int fileGroup, int filePerm, int directoryPerm, const MtpString& deviceInfoManufacturer, const MtpString& deviceInfoModel, const MtpString& deviceInfoDeviceVersion, const MtpString& deviceInfoSerialNumber) : mDatabase(database), : mDatabase(database), mPtp(ptp), mPtp(ptp), mFileGroup(fileGroup), mFileGroup(fileGroup), mFilePermission(filePerm), mFilePermission(filePerm), mDirectoryPermission(directoryPerm), mDirectoryPermission(directoryPerm), mDeviceInfoManufacturer(deviceInfoManufacturer), mDeviceInfoModel(deviceInfoModel), mDeviceInfoDeviceVersion(deviceInfoDeviceVersion), mDeviceInfoSerialNumber(deviceInfoSerialNumber), mSessionID(0), mSessionID(0), mSessionOpen(false), mSessionOpen(false), mSendObjectHandle(kInvalidObjectHandle), mSendObjectHandle(kInvalidObjectHandle), Loading Loading @@ -451,7 +458,6 @@ bool MtpServer::handleRequest() { MtpResponseCode MtpServer::doGetDeviceInfo() { MtpResponseCode MtpServer::doGetDeviceInfo() { MtpStringBuffer string; MtpStringBuffer string; char prop_value[PROPERTY_VALUE_MAX]; MtpObjectFormatList* playbackFormats = mDatabase->getSupportedPlaybackFormats(); MtpObjectFormatList* playbackFormats = mDatabase->getSupportedPlaybackFormats(); MtpObjectFormatList* captureFormats = mDatabase->getSupportedCaptureFormats(); MtpObjectFormatList* captureFormats = mDatabase->getSupportedCaptureFormats(); Loading Loading @@ -483,19 +489,10 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { mData.putAUInt16(captureFormats); // Capture Formats mData.putAUInt16(captureFormats); // Capture Formats mData.putAUInt16(playbackFormats); // Playback Formats mData.putAUInt16(playbackFormats); // Playback Formats property_get("ro.product.manufacturer", prop_value, "unknown manufacturer"); mData.putString(mDeviceInfoManufacturer); // Manufacturer string.set(prop_value); mData.putString(mDeviceInfoModel); // Model mData.putString(string); // Manufacturer mData.putString(mDeviceInfoDeviceVersion); // Device Version mData.putString(mDeviceInfoSerialNumber); // Serial Number property_get("ro.product.model", prop_value, "MTP Device"); string.set(prop_value); mData.putString(string); // Model string.set("1.0"); mData.putString(string); // Device Version property_get("ro.serialno", prop_value, "????????"); string.set(prop_value); mData.putString(string); // Serial Number delete playbackFormats; delete playbackFormats; delete captureFormats; delete captureFormats; Loading media/mtp/MtpServer.h +14 −1 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,15 @@ private: int mFilePermission; int mFilePermission; int mDirectoryPermission; int mDirectoryPermission; // Manufacturer to report in DeviceInfo MtpString mDeviceInfoManufacturer; // Model to report in DeviceInfo MtpString mDeviceInfoModel; // Device version to report in DeviceInfo MtpString mDeviceInfoDeviceVersion; // Serial number to report in DeviceInfo MtpString mDeviceInfoSerialNumber; // current session ID // current session ID MtpSessionID mSessionID; MtpSessionID mSessionID; // true if we have an open session and mSessionID is valid // true if we have an open session and mSessionID is valid Loading Loading @@ -95,7 +104,11 @@ private: public: public: MtpServer(MtpDatabase* database, bool ptp, MtpServer(MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm); int fileGroup, int filePerm, int directoryPerm, const MtpString& deviceInfoManufacturer, const MtpString& deviceInfoModel, const MtpString& deviceInfoDeviceVersion, const MtpString& deviceInfoSerialNumber); virtual ~MtpServer(); virtual ~MtpServer(); MtpStorage* getStorage(MtpStorageID id); MtpStorage* getStorage(MtpStorageID id); Loading Loading
media/mtp/MtpServer.cpp +13 −16 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,6 @@ #include <android-base/properties.h> #include <android-base/properties.h> #include <chrono> #include <chrono> #include <cutils/properties.h> #include <dirent.h> #include <dirent.h> #include <errno.h> #include <errno.h> #include <fcntl.h> #include <fcntl.h> Loading Loading @@ -96,12 +95,20 @@ static const MtpEventCode kSupportedEventCodes[] = { }; }; MtpServer::MtpServer(MtpDatabase* database, bool ptp, MtpServer::MtpServer(MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm) int fileGroup, int filePerm, int directoryPerm, const MtpString& deviceInfoManufacturer, const MtpString& deviceInfoModel, const MtpString& deviceInfoDeviceVersion, const MtpString& deviceInfoSerialNumber) : mDatabase(database), : mDatabase(database), mPtp(ptp), mPtp(ptp), mFileGroup(fileGroup), mFileGroup(fileGroup), mFilePermission(filePerm), mFilePermission(filePerm), mDirectoryPermission(directoryPerm), mDirectoryPermission(directoryPerm), mDeviceInfoManufacturer(deviceInfoManufacturer), mDeviceInfoModel(deviceInfoModel), mDeviceInfoDeviceVersion(deviceInfoDeviceVersion), mDeviceInfoSerialNumber(deviceInfoSerialNumber), mSessionID(0), mSessionID(0), mSessionOpen(false), mSessionOpen(false), mSendObjectHandle(kInvalidObjectHandle), mSendObjectHandle(kInvalidObjectHandle), Loading Loading @@ -451,7 +458,6 @@ bool MtpServer::handleRequest() { MtpResponseCode MtpServer::doGetDeviceInfo() { MtpResponseCode MtpServer::doGetDeviceInfo() { MtpStringBuffer string; MtpStringBuffer string; char prop_value[PROPERTY_VALUE_MAX]; MtpObjectFormatList* playbackFormats = mDatabase->getSupportedPlaybackFormats(); MtpObjectFormatList* playbackFormats = mDatabase->getSupportedPlaybackFormats(); MtpObjectFormatList* captureFormats = mDatabase->getSupportedCaptureFormats(); MtpObjectFormatList* captureFormats = mDatabase->getSupportedCaptureFormats(); Loading Loading @@ -483,19 +489,10 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { mData.putAUInt16(captureFormats); // Capture Formats mData.putAUInt16(captureFormats); // Capture Formats mData.putAUInt16(playbackFormats); // Playback Formats mData.putAUInt16(playbackFormats); // Playback Formats property_get("ro.product.manufacturer", prop_value, "unknown manufacturer"); mData.putString(mDeviceInfoManufacturer); // Manufacturer string.set(prop_value); mData.putString(mDeviceInfoModel); // Model mData.putString(string); // Manufacturer mData.putString(mDeviceInfoDeviceVersion); // Device Version mData.putString(mDeviceInfoSerialNumber); // Serial Number property_get("ro.product.model", prop_value, "MTP Device"); string.set(prop_value); mData.putString(string); // Model string.set("1.0"); mData.putString(string); // Device Version property_get("ro.serialno", prop_value, "????????"); string.set(prop_value); mData.putString(string); // Serial Number delete playbackFormats; delete playbackFormats; delete captureFormats; delete captureFormats; Loading
media/mtp/MtpServer.h +14 −1 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,15 @@ private: int mFilePermission; int mFilePermission; int mDirectoryPermission; int mDirectoryPermission; // Manufacturer to report in DeviceInfo MtpString mDeviceInfoManufacturer; // Model to report in DeviceInfo MtpString mDeviceInfoModel; // Device version to report in DeviceInfo MtpString mDeviceInfoDeviceVersion; // Serial number to report in DeviceInfo MtpString mDeviceInfoSerialNumber; // current session ID // current session ID MtpSessionID mSessionID; MtpSessionID mSessionID; // true if we have an open session and mSessionID is valid // true if we have an open session and mSessionID is valid Loading Loading @@ -95,7 +104,11 @@ private: public: public: MtpServer(MtpDatabase* database, bool ptp, MtpServer(MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm); int fileGroup, int filePerm, int directoryPerm, const MtpString& deviceInfoManufacturer, const MtpString& deviceInfoModel, const MtpString& deviceInfoDeviceVersion, const MtpString& deviceInfoSerialNumber); virtual ~MtpServer(); virtual ~MtpServer(); MtpStorage* getStorage(MtpStorageID id); MtpStorage* getStorage(MtpStorageID id); Loading