Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Leppänen Larsson committed Jun 29, 2010
0 parents commit 31e5a14
Show file tree
Hide file tree
Showing 86 changed files with 24,395 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README
@@ -0,0 +1,50 @@
This file is meant to contain up-to-date information about
MTP stack & its dependencies

----------------------------------------------

It Contains the following sections

1. Running the stack in device

2. GadgetFS

-----------------------------------------------

1. Running the stack in device
------------------------------

When running the test application in the device

run: source /tmp/session_bus_address.user

Otherwise it will crash.

2. GadgetFS
----------------------------

Here's the full procedure to build the gadgetfs module:
$ apt-get source kernel-source
$ cd kernel-<version>
$ make -C /usr/src/kernel-headers CONFIG_USB_GADGETFS=m M=`pwd`/drivers/usb/gad$

The result is drivers/usb/gadget/gadgetfs.ko

Copy this file to the device to /lib/modules/current/

Type 'depmod -a'

Type 'lsof | grep ttyG may help'
Kill all processes which are displayed.

Then type lsof etc. again.
If there are some processed displayed
rename /lib/modules/current/g_nokia to something else and
kill the process again.

Do 'mkdir dev/gadget'
'rmmod g_nokia'
'rmmod g_file_storage'
'modprobe gadgetfs'
'mount -t gadgetfs none /dev/gadget'

9 changes: 9 additions & 0 deletions libmeegomtp.pro
@@ -0,0 +1,9 @@
TEMPLATE = subdirs

SUBDIRS += mts mtpserver test mts/platform/storage/fsstorageplugin/unittests mts/platform/deviceinfo/unittests mts/platform/storage/fsstorageplugin mts/protocol/unittests

# install additional files for the CI Integration tests
citests.path = /usr/share/libmeegomtp-tests/
citests.files = tests.xml

INSTALLS += citests
35 changes: 35 additions & 0 deletions mtpserver/mtp.xml
@@ -0,0 +1,35 @@
<!-- /*
* This file is part of libmeegomtp package
*
* Copyright (C) 2010 Nokia Corporation. All rights reserved.
*
* Contact: Deepak Kodihalli <deepak.kodihalli@nokia.com>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer. Redistributions in binary form must
* reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nokia Corporation nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ -->

<?xml version="1.0" encoding="UTF-8"?>
<profile name="mtp" type="server" >
<key name="usb_transport" value="true"/>
</profile>
79 changes: 79 additions & 0 deletions mtpserver/mtpserver.cpp
@@ -0,0 +1,79 @@
/*
* This file is part of libmeegomtp package
*
* Copyright (C) 2010 Nokia Corporation. All rights reserved.
*
* Contact: Deepak Kodihalli <deepak.kodihalli@nokia.com>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer. Redistributions in binary form must
* reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nokia Corporation nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

#include <QtDebug>

#include <mts.h>
#include "trace.h"
#include "mtpserver.h"


using namespace meegomtp1dot0;

MtpServer::MtpServer(const QString& aPluginName,
const Profile& aProfile, PluginCbInterface* aCbInterface) : ServerPlugin(aPluginName, aProfile, aCbInterface)
{
MTP_LOG_INFO(__PRETTY_FUNCTION__);
}

MtpServer::~MtpServer()
{
MTP_LOG_INFO(__PRETTY_FUNCTION__);
Mts::destroyInstance();
}

bool MtpServer::init()
{
MTP_LOG_INFO(__PRETTY_FUNCTION__);
return true;
}

bool MtpServer::uninit()
{
MTP_LOG_INFO(__PRETTY_FUNCTION__);
return true;
}

bool MtpServer::startListen()
{
bool ok = Mts::getInstance()->activate();
return ok;
}

void MtpServer::stopListen()
{
Mts::destroyInstance();
}

void MtpServer::connectivityStateChanged( Sync::ConnectivityType /*aType*/, bool /*aState*/ )
{
MTP_LOG_INFO(__PRETTY_FUNCTION__);
}
81 changes: 81 additions & 0 deletions mtpserver/mtpserver.h
@@ -0,0 +1,81 @@
/*
* This file is part of libmeegomtp package
*
* Copyright (C) 2010 Nokia Corporation. All rights reserved.
*
* Contact: Deepak Kodihalli <deepak.kodihalli@nokia.com>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer. Redistributions in binary form must
* reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nokia Corporation nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

#ifndef MTPSERVER_H
#define MTPSERVER_H

#include <libsyncpluginmgr/ServerPlugin.h>

using namespace Buteo;

class MtpServer : public ServerPlugin
{
public:

/// \brief The constructor.
///
/// \param aCBInterface Pointer to interface to which feedback
/// can be given.
/// \param aPluginName Name of the plugin
MtpServer(const QString& aPluginName,
const Profile& aProfile,
PluginCbInterface* aCbInterface);

/// \brief The destructor.
~MtpServer();

/// \brief Plugin initialization function. Called before startListen
bool init();

/// \brief Start listening for sync requests
bool startListen();

/// \brief Plugin de-init function. Called after stopListen
bool uninit();

/// \brief Stops listening for sync requests
void stopListen();

public slots:
void connectivityStateChanged( Sync::ConnectivityType aType, bool aState );
};

extern "C" MtpServer* createPlugin(const QString& aPluginName, const Profile& aPluginProfile, PluginCbInterface *aCbInterface)
{
return new MtpServer(aPluginName, aPluginProfile, aCbInterface);
}

extern "C" void destroyPlugin(ServerPlugin *aServer)
{
delete aServer;
}

#endif
31 changes: 31 additions & 0 deletions mtpserver/mtpserver.pro
@@ -0,0 +1,31 @@
######################################################################
# Automatically generated by qmake (2.01a) Wed Jan 7 15:19:33 2009
######################################################################

TEMPLATE = lib
TARGET = mtp-server
DEPENDPATH += .
INCLUDEPATH += . \
/usr/include/sync \
../mts/ \
../mts/common


CONFIG += plugin debug_and_release
QT -= gui
LIBS += -L../mts/ -lmeegomtp

# Input
HEADERS += mtpserver.h
SOURCES += mtpserver.cpp

#clean
QMAKE_CLEAN += $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)

#install
target.path = /usr/lib/sync/
server.path = /etc/sync/profiles/server
server.files = mtp.xml

INSTALLS += target \
server

0 comments on commit 31e5a14

Please sign in to comment.