Loading media/mtp/MtpDevice.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,32 @@ MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { return NULL; } bool MtpDevice::setDevicePropValueStr(MtpProperty* property) { if (property == nullptr) return false; std::lock_guard<std::mutex> lg(mMutex); if (property->getDataType() != MTP_TYPE_STR) { return false; } mRequest.reset(); mRequest.setParameter(1, property->getPropertyCode()); mData.reset(); mData.putString(property->getCurrentValue().str); if (sendRequest(MTP_OPERATION_SET_DEVICE_PROP_VALUE) && sendData()) { MtpResponseCode ret = readResponse(); if (ret != MTP_RESPONSE_OK) { ALOGW("%s: Response=0x%04X\n", __func__, ret); return false; } } return true; } MtpProperty* MtpDevice::getObjectPropDesc(MtpObjectProperty code, MtpObjectFormat format) { std::lock_guard<std::mutex> lg(mMutex); Loading media/mtp/MtpDevice.h +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ public: MtpObjectPropertyList* getObjectPropsSupported(MtpObjectFormat format); MtpProperty* getDevicePropDesc(MtpDeviceProperty code); bool setDevicePropValueStr(MtpProperty* property); MtpProperty* getObjectPropDesc(MtpObjectProperty code, MtpObjectFormat format); // Reads value of |property| for |handle|. Returns true on success. Loading media/mtp/MtpPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ int MtpPacket::transfer(struct usb_request* request) { request->endpoint, request->buffer, request->buffer_length, 1000); 5000); request->actual_length = result; return result; } Loading media/mtp/MtpProperty.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,16 @@ void MtpProperty::setCurrentValue(const uint16_t* string) { mCurrentValue.str = NULL; } void MtpProperty::setCurrentValue(const char* string) { free(mCurrentValue.str); if (string) { MtpStringBuffer buffer(string); mCurrentValue.str = strdup(buffer); } else mCurrentValue.str = NULL; } void MtpProperty::setCurrentValue(MtpDataPacket& packet) { free(mCurrentValue.str); mCurrentValue.str = NULL; Loading media/mtp/MtpProperty.h +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public: void setDefaultValue(const uint16_t* string); void setCurrentValue(const uint16_t* string); void setCurrentValue(const char* string); void setCurrentValue(MtpDataPacket& packet); const MtpPropertyValue& getCurrentValue() { return mCurrentValue; } Loading Loading
media/mtp/MtpDevice.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,32 @@ MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { return NULL; } bool MtpDevice::setDevicePropValueStr(MtpProperty* property) { if (property == nullptr) return false; std::lock_guard<std::mutex> lg(mMutex); if (property->getDataType() != MTP_TYPE_STR) { return false; } mRequest.reset(); mRequest.setParameter(1, property->getPropertyCode()); mData.reset(); mData.putString(property->getCurrentValue().str); if (sendRequest(MTP_OPERATION_SET_DEVICE_PROP_VALUE) && sendData()) { MtpResponseCode ret = readResponse(); if (ret != MTP_RESPONSE_OK) { ALOGW("%s: Response=0x%04X\n", __func__, ret); return false; } } return true; } MtpProperty* MtpDevice::getObjectPropDesc(MtpObjectProperty code, MtpObjectFormat format) { std::lock_guard<std::mutex> lg(mMutex); Loading
media/mtp/MtpDevice.h +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ public: MtpObjectPropertyList* getObjectPropsSupported(MtpObjectFormat format); MtpProperty* getDevicePropDesc(MtpDeviceProperty code); bool setDevicePropValueStr(MtpProperty* property); MtpProperty* getObjectPropDesc(MtpObjectProperty code, MtpObjectFormat format); // Reads value of |property| for |handle|. Returns true on success. Loading
media/mtp/MtpPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ int MtpPacket::transfer(struct usb_request* request) { request->endpoint, request->buffer, request->buffer_length, 1000); 5000); request->actual_length = result; return result; } Loading
media/mtp/MtpProperty.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,16 @@ void MtpProperty::setCurrentValue(const uint16_t* string) { mCurrentValue.str = NULL; } void MtpProperty::setCurrentValue(const char* string) { free(mCurrentValue.str); if (string) { MtpStringBuffer buffer(string); mCurrentValue.str = strdup(buffer); } else mCurrentValue.str = NULL; } void MtpProperty::setCurrentValue(MtpDataPacket& packet) { free(mCurrentValue.str); mCurrentValue.str = NULL; Loading
media/mtp/MtpProperty.h +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public: void setDefaultValue(const uint16_t* string); void setCurrentValue(const uint16_t* string); void setCurrentValue(const char* string); void setCurrentValue(MtpDataPacket& packet); const MtpPropertyValue& getCurrentValue() { return mCurrentValue; } Loading