I have made the following changes intended for : CE:MW:Shared / buteo-mtp
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/7793 Thank You, aard [This message was auto-generated] --- Request # 7793: Messages from BOSS: State: review at 2013-02-01T13:22:14 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:aard:branches:CE:MW:Shared / buteo-mtp -> CE:MW:Shared / buteo-mtp changes files: -------------- --- buteo-mtp.changes +++ buteo-mtp.changes @@ -0,0 +1,3 @@ +* Fri Feb 01 2013 Bernd Wachter <[email protected]> - 0.0.43 +- Add device icon support + old: ---- buteo-mtp-0.0.42.tar.gz new: ---- buteo-mtp-0.0.43.tar.gz spec files: ----------- --- buteo-mtp.spec +++ buteo-mtp.spec @@ -1,5 +1,5 @@ Name: buteo-mtp -Version: 0.0.42 +Version: 0.0.43 Release: 1 Summary: MTP library Group: System/Libraries @@ -10,7 +10,7 @@ BuildRequires: pkgconfig(qttracker) BuildRequires: pkgconfig(synccommon) BuildRequires: pkgconfig(QtSystemInfo) - +Requires: mtp-vendor-configuration # buteo-mtp can use org.freedesktop.thumbnails.Thumbnailer1 to create # thumbnails on request; at least Windows 8 requires thumbnails to be # generated on the device. @@ -25,11 +25,28 @@ %{_bindir}/buteo-mtp %{_libdir}/*.so.* %{_libdir}/mtp/*.so -%{_datadir}/mtp/*.xml %{_libdir}/mtp/mtp_service %{_libdir}/mtp/start-mtp.sh +%package sample-vendor-configuration +Summary: Vendor configuration example for MTP +Group: System/Libraries +Provides: mtp-vendor-configuration + +%description sample-vendor-configuration +%{summary}. + +# TODO: the deviceinfo xml here should only contain things like model, +# vendor, ... -- the supported datatypes are tied in tighly with +# the mtp daemon currently, and therefore can't be changed that +# easily +%files sample-vendor-configuration +%defattr(-,root,root,-) +%{_datadir}/mtp/*.xml +%{_datadir}/mtp/*.ico + + %package devel Summary: Development files for %{name} Group: Development/Libraries other changes: -------------- ++++++ buteo-mtp-0.0.42.tar.gz -> buteo-mtp-0.0.43.tar.gz --- mts/common/mtptypes.h +++ mts/common/mtptypes.h @@ -193,7 +193,7 @@ #define MTP_EV_StorageInfoChanged 0x400C #define MTP_EV_CaptureComplete 0x400D #define MTP_EV_UnreportedStatus 0x400E -#define MTP_EV_ObjectPropChanged 0xC801 +#define MTP_EV_ObjectPropChanged 0xC801 #define MTP_EV_ObjectPropDescChanged 0xC802 typedef quint16 MTPEventCode; @@ -293,6 +293,7 @@ #define MTP_DEV_PROPERTY_Device_Friendly_Name 0xD402 #define MTP_DEV_PROPERTY_Volume 0xD403 #define MTP_DEV_PROPERTY_Supported_Formats_Ordered 0xD404 +#define MTP_DEV_PROPERTY_DeviceIcon 0xD405 #define MTP_DEV_PROPERTY_Perceived_Device_Type 0xD407 typedef quint16 MTPDevPropertyCode; Binary files mts/device.ico added --- mts/deviceinfo.xml +++ mts/deviceinfo.xml @@ -51,7 +51,7 @@ <OpCode>0x1007</OpCode><!--GetObjectHandles--> <OpCode>0x1008</OpCode><!--GetObjectInfo--> <OpCode>0x1009</OpCode><!--GetObject--> - <!--<OpCode>0x100A</OpCode>GetThumb--> + <OpCode>0x100A</OpCode><!--GetThumb--> <OpCode>0x100B</OpCode><!--DeleteObject--> <OpCode>0x100C</OpCode><!--SendObjectInfo--> <OpCode>0x100D</OpCode><!--SendObject--> @@ -106,10 +106,12 @@ <DevPropCode>0XD407</DevPropCode> <DevPropValue>0x00000003</DevPropValue> </DevProp> - <DevProp><!-- Volume --> - <DevPropCode>0xD403</DevPropCode> - </DevProp> - + <DevProp><!-- Device Icon --> + <DevPropCode>0xD405</DevPropCode> + </DevProp> + <!--DevProp>Volume + <DevPropCode>0xD403</DevPropCode> + </DevProp--> </DevPropsSupported> <SupportedFormats> --- mts/mts.pro +++ mts/mts.pro @@ -92,7 +92,7 @@ INSTALLS += headers data.path = /usr/share/mtp -data.files = deviceInfo.xml +data.files = deviceInfo.xml device.ico INSTALLS += data --- mts/platform/deviceinfo/deviceinfo.cpp +++ mts/platform/deviceinfo/deviceinfo.cpp @@ -45,6 +45,7 @@ #define COPYRIGHTINFO_DEFAULT "Do Not Copy" #define SYNCPARTNER_DEFAULT "Nemo" #define DEVFRNDNAME_DEFAULT "Friendly" +#define DEVICON_DEFAULT "/usr/share/mtp/device.ico" #define STDVER_DEFAULT 100 #define VENDOREXTN_DEFAULT 0x00000006 #define DEVTYPE_DEFAULT 0x00000003 @@ -219,6 +220,7 @@ m_copyrightInfo(COPYRIGHTINFO_DEFAULT), m_syncPartner(SYNCPARTNER_DEFAULT), m_deviceFriendlyName(DEVFRNDNAME_DEFAULT), + m_deviceIconPath(DEVICON_DEFAULT), m_standardVersion(STDVER_DEFAULT), m_vendorExtension(VENDOREXTN_DEFAULT), m_mtpVersion(MTPVER_DEFAULT), @@ -352,6 +354,27 @@ } /******************************************* + * const QVector<quint8> DeviceInfo::deviceIcon + ******************************************/ +const QVector<quint8> DeviceInfo::deviceIcon() +{ + QFile file(m_deviceIconPath); + QVector<quint8> icondata; + + if (!file.open(QIODevice::ReadOnly)) return icondata; + + QDataStream in(&file); + int read = 0; + while (!in.atEnd()) { + quint8 q; + in >> q; + icondata.append(q); + read ++; + } + return icondata; +} + +/******************************************* * const quint16& DeviceInfo::standardVersion ******************************************/ const quint16& DeviceInfo::standardVersion() const --- mts/platform/deviceinfo/deviceinfo.h +++ mts/platform/deviceinfo/deviceinfo.h @@ -96,6 +96,10 @@ /// \return the device friendly name. virtual const QString& deviceFriendlyName( bool current = true ); + /// Gets the device icon for this device. + /// \return the device icon data as a vector. + virtual const QVector<quint8> deviceIcon(); + /// Gets the PTP version this device can support. /// \return the PTP version supported. virtual const quint16& standardVersion() const; @@ -284,6 +288,7 @@ QString m_copyrightInfo; ///< Device copyright info. QString m_syncPartner; ///< This device's sync partner. QString m_deviceFriendlyName; ///< The device's friendly name. + QString m_deviceIconPath; ///< The device's icon path. quint16 m_standardVersion; ///< The PTP version supported. quint32 m_vendorExtension; ///< MTP vendor extension id. quint16 m_mtpVersion; ///< The MTP version supported. --- mts/platform/deviceinfo/unittests/deviceinfoprovider_test.cpp +++ mts/platform/deviceinfo/unittests/deviceinfoprovider_test.cpp @@ -409,4 +409,12 @@ QVERIFY(QDir(QDir::homePath()).exists()); } +void DeviceInfoProvider_Test::testGetDeviceIcon() +{ + int s = m_Provider->deviceIcon().size(); + if(s <= 0) { + QFAIL("Empty Device Icon"); + } +} + QTEST_APPLESS_MAIN(DeviceInfoProvider_Test); --- mts/platform/deviceinfo/unittests/deviceinfoprovider_test.h +++ mts/platform/deviceinfo/unittests/deviceinfoprovider_test.h @@ -92,6 +92,7 @@ void testGetVideoMaxKFD(); void testGetSupportedAudioCodecs(); void testGetDeviceInfoXmlPath(); + void testGetDeviceIcon(); private: DeviceInfoProvider* m_Provider; QDomDocument* m_xmlDoc; --- mts/protocol/propertypod.cpp +++ mts/protocol/propertypod.cpp @@ -429,17 +429,26 @@ MTP_FORM_FLAG_NONE, QVariant() }, { + MTP_DEV_PROPERTY_DeviceIcon, + static_cast<MTPDataType>(MTP_DATA_TYPE_AUINT8), false, + QVariant(), QVariant(), + MTP_FORM_FLAG_NONE, QVariant() + }, + { MTP_DEV_PROPERTY_Perceived_Device_Type, static_cast<MTPDataType>(MTP_DATA_TYPE_UINT32), false, QVariant(), QVariant(), MTP_FORM_FLAG_NONE, QVariant() - }, + } + #if 0 + , { MTP_DEV_PROPERTY_Volume, static_cast<MTPDataType>(MTP_DATA_TYPE_INT32), true, QVariant(0), QVariant(), MTP_FORM_FLAG_RANGE, QVariant() } + #endif }; PropertyPod::PropertyPod(DeviceInfo* devInfoProvider, MTPExtensionManager* extManager) : m_provider(devInfoProvider), m_extManager(extManager) @@ -600,6 +609,11 @@ (*propDesc)->currentValue = QVariant::fromValue(QString(m_provider->syncPartner())); } break; + case MTP_DEV_PROPERTY_DeviceIcon: + { + (*propDesc)->currentValue = QVariant::fromValue(QVector<quint8>(m_provider->deviceIcon())); + } + break; case MTP_DEV_PROPERTY_Perceived_Device_Type: { (*propDesc)->currentValue = QVariant(m_provider->deviceType()); --- mts/protocol/unittests/mtpresponder_test.cpp +++ mts/protocol/unittests/mtpresponder_test.cpp @@ -511,6 +511,10 @@ copyAndSendContainer(reqContainer); QCOMPARE( m_responseCode, (MTPResponseCode)MTP_RESP_OK ); + reqContainer = new MTPTxContainer(MTP_CONTAINER_TYPE_COMMAND, MTP_OP_GetDevicePropDesc, nextTransactionId(), sizeof(quint32)); + *reqContainer << (quint32)MTP_DEV_PROPERTY_DeviceIcon; + copyAndSendContainer(reqContainer); + QCOMPARE( m_responseCode, (MTPResponseCode)MTP_RESP_OK ); } void MTPResponder_test::testGetDevicePropValue() @@ -531,7 +535,11 @@ *reqContainer << (quint32)MTP_DEV_PROPERTY_Perceived_Device_Type; copyAndSendContainer(reqContainer); QCOMPARE( m_responseCode, (MTPResponseCode)MTP_RESP_OK ); - + + reqContainer = new MTPTxContainer(MTP_CONTAINER_TYPE_COMMAND, MTP_OP_GetDevicePropValue, nextTransactionId(), sizeof(quint32)); + *reqContainer << (quint32)MTP_DEV_PROPERTY_DeviceIcon; + copyAndSendContainer(reqContainer); + QCOMPARE( m_responseCode, (MTPResponseCode)MTP_RESP_OK ); } void MTPResponder_test::testSetDevicePropValue() --- rpm/buteo-mtp.changes +++ rpm/buteo-mtp.changes @@ -1,3 +1,6 @@ +* Fri Feb 01 2013 Bernd Wachter <[email protected]> - 0.0.43 +- Add device icon support + * Wed Jan 30 2013 Bernd Wachter <[email protected]> - 0.0.42 - Fix stalling issue --- rpm/buteo-mtp.spec +++ rpm/buteo-mtp.spec @@ -1,5 +1,5 @@ Name: buteo-mtp -Version: 0.0.42 +Version: 0.0.43 Release: 1 Summary: MTP library Group: System/Libraries @@ -10,7 +10,7 @@ BuildRequires: pkgconfig(qttracker) BuildRequires: pkgconfig(synccommon) BuildRequires: pkgconfig(QtSystemInfo) - +Requires: mtp-vendor-configuration # buteo-mtp can use org.freedesktop.thumbnails.Thumbnailer1 to create # thumbnails on request; at least Windows 8 requires thumbnails to be # generated on the device. @@ -25,11 +25,28 @@ %{_bindir}/buteo-mtp %{_libdir}/*.so.* %{_libdir}/mtp/*.so -%{_datadir}/mtp/*.xml %{_libdir}/mtp/mtp_service %{_libdir}/mtp/start-mtp.sh +%package sample-vendor-configuration +Summary: Vendor configuration example for MTP +Group: System/Libraries +Provides: mtp-vendor-configuration + +%description sample-vendor-configuration +%{summary}. + +# TODO: the deviceinfo xml here should only contain things like model, +# vendor, ... -- the supported datatypes are tied in tighly with +# the mtp daemon currently, and therefore can't be changed that +# easily +%files sample-vendor-configuration +%defattr(-,root,root,-) +%{_datadir}/mtp/*.xml +%{_datadir}/mtp/*.ico + + %package devel Summary: Development files for %{name} Group: Development/Libraries
