Commit 1a94388a authored by Philippe De Swert's avatar Philippe De Swert

pre-eliminary udev work

git-svn-id: db81c003-b5ea-0310-aa99-ed7f6e1db739
cd $(top_srcdir)/docs && $(MAKE) && cd ..
.PHONY: doc
deb: dist
-mkdir $(top_builddir)/debian-build
cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot
-rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION)
set -x
libtoolize --automake --copy
automake --add-missing --foreign --copy
AC_INIT([usb_moded], [0.33])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
test_gcc_flag() {
AC_LANG_CONFTEST([int main() {}])
$CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
rm -f conftest.o
return $ret
# If using GCC specify some additional parameters
if test "x$GCC" = "xyes" ; then
# We use gnu99 instead of c99 because many have interpreted the standard
# in a way that int64_t isn't defined on non-64 bit platforms.
DESIRED_FLAGS="-std=gnu99 -Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wmissing-noreturn -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter"
for flag in $DESIRED_FLAGS ; do
AC_MSG_CHECKING([whether $CC accepts $flag])
if test_gcc_flag $flag ; then
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[Enable debug @<:@default=false@:>@]),
[case "${enableval}" in
yes) debug=true ; CFLAGS="-ggdb -O0 -DDEBUG -DOSSOLOG_STDERR $CFLAGS" ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
AC_ARG_ENABLE([nokia], AS_HELP_STRING([--enable-nokia], [Enable Nokia extra's @<:@default=false@:>@]),
[case "${enableval}" in
yes) nokia=true ; CFLAGS="-DNOKIA $CFLAGS" ;;
no) nokia=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-nokia]) ;;
AM_CONDITIONAL([NOKIA], [test x$nokia = xtrue])
AC_ARG_ENABLE([app_sync], AS_HELP_STRING([--enable-app-sync], [Enable application syncing @<:@default=false@:>@]),
[case "${enableval}" in
yes) app_sync=true ; CFLAGS="-DAPP_SYNC $CFLAGS" ;;
no) app_sync=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-app_sync]) ;;
AM_CONDITIONAL([APP_SYNC], [test x$app_sync = xtrue])
glib-2.0 >= 2.2.0
dbus-1 >= 1.2.1
dbus-glib-1 >= 0.78
gobject-2.0 >= 2.16.6
gconf-2.0 >= 2.16.0
echo "
Compiler: ${CC}
Debug enabled: ${debug}
dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.mode_request
dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.set_mode string:'ovi_suite'
dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.set_config string:'ovi_suite'
dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.set_mode string:'mass_storage'
security extra:
aegis-exec -a usb-moded::USBControl
Replaces ke-recv
-- Philippe De Swert <> Tue, 09 Mar 2010 11:28:10 +0200
interface: usb_moded
type: dbus
scope: Internal
state: unstable
dev-pkg: usb-moded-dev
usb-moded (0.33) unstable; urgency=low
* More security guesswork. Hopefully the doxygen tags are
correct now. Fixes: NB#231818
-- Philippe De Swert <> Thu, 17 Mar 2011 12:48:49 +0200
usb-moded (0.32) unstable; urgency=low
* Coverity fixes. Fixes: NB#235405
* Make charging fallback timeout shorter. Fixes: NB#234094
-- Philippe De Swert <> Thu, 10 Mar 2011 16:08:58 +0200
usb-moded (0.31) unstable; urgency=low
* Fix appearance of drive even if umounting fails. Fixes: NB#229105
* Mode setting and clean-up seperated from module loading.
* Fix dev package dependencies. Fixes: NB#232170
* Add credential tags to header file. Fixes: NB#231818
-- Philippe De Swert <> Mon, 28 Feb 2011 14:21:58 +0200
usb-moded (0.30) unstable; urgency=low
* signal re-mounting error, and mount fallback. Fixes: NB#207408
-- Philippe De Swert <> Fri, 11 Feb 2011 16:14:24 +0200
usb-moded (0.29) unstable; urgency=low
* Don't build docs when NODOCS is specified in the Debian build options. Fixes: NB#226245
Patch supplied by Yakubenko Sergey
* Listen to DSME shutdown signal to disconnect the current mode for ACT_DEAD. Fixes: NB#209842
* Updated doxygen config to remove errors.
-- Philippe De Swert <> Thu, 10 Feb 2011 12:11:04 +0200
usb-moded (0.28) unstable; urgency=low
* Make sure filesystem is remounted before sending disconnect signal
* Send pre-unmount signal. Fixes: NB#187735
-- Philippe De Swert <> Tue, 25 Jan 2011 14:51:33 +0200
usb-moded (0.27) unstable; urgency=low
* Do not error out in case the filesystem is still unmounted. Fixes: NB#218025
-- Philippe De Swert <> Wed, 12 Jan 2011 13:57:44 +0200
usb-moded (0.26) unstable; urgency=low
* Improve robustness of appsync file parsing. Fixes: NB#209600
* Make sure we do not exit when session dbus dies. Fixes: NB#210575
-- Philippe De Swert <> Fri, 10 Dec 2010 16:05:16 +0200
usb-moded (0.25) unstable; urgency=low
* Silence output of system() calls when not in debug mode
* Improve program killer to avoid unnecessary work
* Increase debouncing timeout. Fixes: NB#193301
-- Philippe De Swert <> Mon, 29 Nov 2010 16:34:23 +0200
usb-moded (0.24) unstable; urgency=low
* Send error signals when something goes wrong. Fixes: NB#197206
* Delay module unloading. To avoid unload/reload on fast disconnect/reconnect. Fixes: NB#193301
-- Philippe De Swert <> Tue, 16 Nov 2010 12:31:20 +0200
usb-moded (0.23) unstable; urgency=low
* Correct nsu mode detection by not using /proc/bootreason. Fixes: NB#193559
-- Philippe De Swert <> Thu, 11 Nov 2010 17:16:07 +0200
usb-moded (0.22) unstable; urgency=low
* Check for nsu mode and then do nothing until cable gets unplugged/replugged
* Update connect mode for g_nokia
* Sync after mtp mode disconnection as suggested by Bityutskiy Artem.
-- Philippe De Swert <> Mon, 18 Oct 2010 15:42:15 +0300
usb-moded (0.21) unstable; urgency=low
* Do not unload mass_storage when going into charging mode. Avoids USB cert issues
when the devicelock is not functioning or replying. Fixes: NB#196588
-- Philippe De Swert <> Fri, 08 Oct 2010 12:55:27 +0300
usb-moded (0.20) unstable; urgency=low
* Do not try to mount fs if it is not unmounted
* Clean up dirty devicelock fix
-- Philippe De Swert <> Wed, 29 Sep 2010 12:14:55 +0300
usb-moded (0.19) unstable; urgency=low
* Implement CR for app sync.
* Log everything with logging functions and remove fprintf
* Fix logic error in mount/umount. Fixes: NB#178489
-- Philippe De Swert <> Mon, 20 Sep 2010 16:32:07 +0300
usb-moded (0.18) unstable; urgency=low
* Add fua handling. Fixes: NB#187000
* Remove static options for g_file_storage that belong in /etc/modprobe.d
* Add a check in connection routine to only select a mode if the connection status is false
* Remove non necessary and non standard desktop ready signals and fix the mode broadcasting signals
-- Philippe De Swert <> Tue, 07 Sep 2010 13:30:41 +0300
usb-moded (0.17) unstable; urgency=low
* Improve charger detection to avoid showing connection dialog when
using wall charger. Fixes: NB#169825
* Get rid of HAL completely to increase MeeGo support while at it
* Include autotools in build-dependencies. Fixes: NB#187685
-- Tuomo Tanskanen <> Mon, 30 Aug 2010 10:26:44 +0300
usb-moded (0.16) unstable; urgency=low
* Add aegis manifest. Fixes: NB#182124
* Add g_ether/windows_network mode for mad development
* Fix most superfluous linking
-- Philippe De Swert <> Tue, 10 Aug 2010 11:01:11 +0300
usb-moded (0.15) unstable; urgency=low
* If mode change is requested, do not change mode if requested mode is already active. Fixes: NB#181153
* Check if devicelock is unlocked and initiate connection if the cable has been inserted previously
-- Philippe De Swert <> Thu, 22 Jul 2010 17:29:57 +0300
usb-moded (0.14) unstable; urgency=low
* Route -n does not always return default... Fixes: NB#175249
-- Philippe De Swert <> Mon, 21 Jun 2010 14:21:14 +0300
usb-moded (0.13) unstable; urgency=low
* Only activate usb network if no other network is up.
* use GConf schema instead of gconftool-2 in postinst. Fixes: NB#174536
-- Philippe De Swert <> Mon, 14 Jun 2010 16:13:17 +0300
usb-moded (0.12) unstable; urgency=low
* Improved killer. Does not ignore mtp and gc interfaces and tries to be
less agressive with sigterm before sigkill.
-- Philippe De Swert <> Mon, 07 Jun 2010 11:28:33 +0300
usb-moded (0.11) unstable; urgency=low
* Add removable=1 flag to the mass-storage profile. Fixes: NB#159847
-- Philippe De Swert <> Tue, 01 Jun 2010 14:40:21 +0300
usb-moded (0.10) unstable; urgency=low
* Make devicelock and act_dead stuff Nokia specific.
* Add lsof dependency
-- Philippe De Swert <> Fri, 28 May 2010 16:36:17 +0300
usb-moded (0.9) unstable; urgency=low
* Add devicelock support. Implemented: SWP#MaSSW-1743
* Send data in use signal when mass storage is chosen.
* Do not export anything in act_dead mode.
-- Philippe De Swert <> Tue, 25 May 2010 15:37:32 +0300
usb-moded (0.8-1) unstable; urgency=low
* Added use_mtp=1 parameter to loading of g_nokia as TEMPORARY workaround
(Fixes: NB#170537)
-- Pekka Lundstrom <> Wed, 26 May 2010 13:26:45 +0300
usb-moded (0.8) unstable; urgency=low
* Tweak dbus security policy to let users invoke the query and set_mode methods
Fixes: NB#169901
* clean-up some lintian warnings.
* add preparations for devicelock support
-- Philippe De Swert <> Mon, 24 May 2010 11:52:51 +0300
usb-moded (0.7) unstable; urgency=low
* Introduce killer for unstable programs that block module unloading.
-- Philippe De Swert <> Tue, 11 May 2010 12:50:19 +0300
usb-moded (0.6) unstable; urgency=low
* Make usb mass storage work
* Bring up usb network interface
* Charging mode loads g_file_storage without exporting fs
* Switching modes works if nobody claims the interfaces so modules can be unloaded
-- Philippe De Swert <> Sat, 08 May 2010 14:24:47 +0300
usb-moded (0.5) unstable; urgency=low
* Make sure that the charging fallback does not override the chosen mode.
* Fix some lintian warnings.
* Improve g_file_storage loading and add mount point config file.
-- Philippe De Swert <> Fri, 30 Apr 2010 15:58:50 +0300
usb-moded (0.4) unstable; urgency=low
* Split the logging functions to their own files
* Add documentation with doxygen
-- Philippe De Swert <> Wed, 28 Apr 2010 20:56:34 +0300
usb-moded (0.3) unstable; urgency=low
* Usb-moded start before HAL d-bus interface is ready. Thanks to Simo Piiroinen. Fixes: NB#165616
* Add postinstall script so gconf is set up correctly
-- Philippe De Swert <> Tue, 27 Apr 2010 13:14:44 +0300
usb-moded (0.2) unstable; urgency=low
* Add introspective dbus support for QDBusInterface (thanks to David Kedves)
* Make dbus conf a bit more permissive
* pre-eliminary module loading/unloading
* add ability to set gconf key (new method call).
* fix wrong path in .pc file. Fixes: NB#165780
-- Philippe De Swert <> Mon, 26 Apr 2010 19:12:58 +0300
usb-moded (0.1-1) unstable; urgency=low
* Initial release
Fixes: NB#156765, NB#159816
-- Philippe De Swert <> Tue, 09 Mar 2010 11:28:10 +0200
Source: usb-moded
Section: misc
Priority: optional
Maintainer: Philippe De Swert <>
Build-Depends: debhelper (>= 5), autoconf, automake, libdbus-1-dev, libdbus-glib-1-dev, libglib2.0-dev, libgconf2-dev, doxygen, aegis-builder
Standards-Version: 3.8.0
Package: usb-moded
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, lsof
Description: usb_moded - USB mode controller
Usb_moded is a daemon to control the USB states. For this
it loads unloads the relevant usb gadget modules, keeps track
of the filesystem(s) and notifies about changes on the DBUS
system bus.
Package: usb-moded-doc
Section: doc
Architecture: any
Depends: usb-moded (= ${binary:Version}), ${misc:Depends}
Description: usb_moded - USB mode controller - documentation
Usb_moded is a daemon to control the USB states. For this
it loads unloads the relevant usb gadget modules, keeps track
of the filesystem(s) and notifies about changes on the DBUS
system bus.
=== This package contains the documentation ===
Package: usb-moded-dbg
Section: debug
Architecture: any
Depends: usb-moded (= ${binary:Version}), ${misc:Depends}
Priority: extra
Description: usb_moded - USB mode controller - Debug symbols
Usb_moded is a daemon to control the USB states. For this
it loads unloads the relevant usb gadget modules, keeps track
of the filesystem(s) and notifies about changes on the DBUS
system bus.
=== This package contains the debug symbols ===
Package: usb-moded-dev
Architecture: any
Depends: ${misc:Depends}, libdbus-1-dev
Description: usb_moded - USB mode controller - development files
Usb_moded is a daemon to control the USB states. For this
it loads unloads the relevant usb gadget modules, keeps track
of the filesystem(s) and notifies about changes on the DBUS
system bus.
=== This package contains the files needed to program for usb_moded ===
This package was debianized by Philippe De Swert <> on
Tue, 09 Mar 2010 11:28:10 +0200.
Author: Philippe De Swert
<Copyright © 2010 Nokia Oyj>
The Debian packaging is Copyright © 2010, Philippe De Swert <> and
is licensed under the LGPL, see `/usr/share/common-licenses/LGPL'.
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH USB-MODED SECTION "March 9, 2010"
.\" Please adjust this date whenever revising the manpage.
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
usb_moded \- USB mode controlling daemon
.B usb_moded
.RI [ options ] " files" ...
.B bar
.RI [ options ] " files" ...
This manual page documents briefly the
.B usb-moded
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBusb-moded\fP is a program that controls the loading and unloading of usb gadget modules and
keeps track of the USB state the device is in.
These programs follow the usual GNU command line syntax, with long
options starting with two dashes (`-').
A summary of options is included below.
For a complete description, see the Info files.
.B \-h, \-\-help
Show summary of options.
.B \-d, \-\-daemonflag
run as a daemon
.B \-s, \-\-force-syslog
log to syslog
.B \-T, \-\-force-stderr
log to stderr even when daemonized
.B \-D, \-\-debug
turn on debug printing
.B \-h, \-\-help
display this help and exit
.B \-v, \-\-version
Show version of program.
usb-moded was written by <>.
(c) Copyrigh Nokia, 2010
This manual page was written by Philippe De Swert <>
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS)))
configure: configure-stamp
# Add here commands to configure the package.
if [ ! -x configure ]; then ./; fi
./configure --prefix=/usr --enable-nokia --enable-app-sync
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
# Add here commands to compile the package.
ifneq (0,$(MAKE_DOCS))
$(MAKE) doc
#docbook-to-man debian/usb-moded.sgml > usb-moded.1
touch $@
rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
[ ! -f Makefile ] || $(MAKE) clean
install: build
dh_clean -k
# Add here commands to install the package into debian/usb-moded.
$(MAKE) DESTDIR=$(CURDIR)/debian/usb-moded install
#mkdir -p $(CURDIR)/debian/usb-moded/etc/dbus-1/system.d/
#install -m 644 $(CURDIR)/debian/usb_moded.conf $(CURDIR)/debian/usb-moded/etc/dbus-1/system.d/usb_moded.conf
mkdir -p $(CURDIR)/debian/usb-moded-dev/usr/include/usb-moded/
install -m 644 $(CURDIR)/src/usb_moded-dbus.h $(CURDIR)/debian/usb-moded-dev/usr/include/usb-moded/usb_moded-dbus.h
install -m 644 $(CURDIR)/src/usb_moded-modes.h $(CURDIR)/debian/usb-moded-dev/usr/include/usb-moded/usb_moded-modes.h
install -m 644 $(CURDIR)/src/usb_moded-appsync-dbus.h $(CURDIR)/debian/usb-moded-dev/usr/include/usb-moded/usb_moded-appsync-dbus.h
mkdir -p $(CURDIR)/debian/usb-moded-dev/usr/lib/pkgconfig
install -m 644 $(CURDIR)/usb_moded.pc $(CURDIR)/debian/usb-moded-dev/usr/lib/pkgconfig/usb_moded.pc
ifneq (0,$(MAKE_DOCS))
mkdir -p $(CURDIR)/debian/usb-moded-doc/usr/share/doc/usb-moded/html/
cp $(CURDIR)/docs/html/* $(CURDIR)/debian/usb-moded-doc/usr/share/doc/usb-moded/html/
mkdir -p $(CURDIR)/debian/usb-moded/etc/usb-moded
install -m 644 $(CURDIR)/usb-moded.ini $(CURDIR)/debian/usb-moded/etc/usb-moded/usb-moded.ini
mkdir -p $(CURDIR)/debian/usb-moded/etc/gconf/schemas
install -m 644 $(CURDIR)/debian/usb-moded.schemas $(CURDIR)/debian/usb-moded/etc/gconf/schemas/usb-moded.schemas
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
# dh_installexamples
# dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_strip --dbg-package=usb-moded-dbg
# dh_perl
# dh_makeshlibs
aegis-deb-add -control debian/usb-moded/DEBIAN/control .. debian/usb-moded.aegis=_aegis
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
Document: usb-moded
Title: Debian usb-moded Manual
Author: Philippe De Swert
Abstract: Contains the documentation for the developers in html format
Section: System/Administration
Format: HTML
Index: /usr/share/doc/usb-moded/html/index.html
Files: /usr/share/doc/usb-moded/html/*.html
<credential name="usb-moded-dbus-bind" />
<credential name="USBControl" />
<dbus name="com.meego.usb_moded" own="usb-moded-dbus-bind" bus="system">
<node name="/">
<interface name="com.meego.usb_moded">
<method name="mode_request">
<annotation name="com.maemo.Aegis" value=""/>
<interface name="com.meego.usb_moded">
<method name="set_mode">
<annotation name="com.maemo.Aegis" value="USBControl"/>
<interface name="com.meego.usb_moded">
<method name="set_config">
<annotation name="com.maemo.Aegis" value="USBControl"/>
<credential name="usb-moded-dbus-bind" />
<credential name="CAP::sys_admin" />
<credential name="CAP::sys_module" />
<credential name="CAP::net_admin" />
<credential name="CAP::sys_ptrace" />
<credential name="CAP::kill" />
<for path="/usr/sbin/usb_moded" />
<?xml version="1.0"?>
<locale name="C">
<short>Default mode to set for usb_moded</short>
<long>This key contains the default mode usb_moded will set if usb is connected.</long>
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
<policy user="root">
<allow own="com.meego.usb_moded"/>
<allow send_destination="com.meego.usb_moded"
<policy user="user">
<allow send_destination="com.meego.usb_moded"
send_interface="com.meego.usb_moded" send_member="set_mode"/>
<allow send_destination="com.meego.usb_moded"
send_interface="com.meego.usb_moded" send_member="mode_request"/>
<policy context="default">
<deny own="com.meego.usb_moded"/>
# tells make to run html-local when the user asks for 'all'.
all: doc
rm -rf html/
doxygen usb_moded-doxygen.conf
-rm -rf html/
This diff is collapsed.
sbin_PROGRAMS = usb_moded
usb_moded_CPPFLAGS = \
usb_moded_LDFLAGS = \