gadgetd: add DEBUG macro

Change-Id: I240926691cff94d58ae0044af93ab8b5f5622ef9
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
common: Simplify logging macros

Signed-off-by: Karol Lewandowski <lmctlx@gmail.com>

Rebased onto current HEAD.

Change-Id: I2fe59ec9cd183714fd2589be7b4603d11fd1b01d
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
packaging: Update packaging due to new files being installed

Change-Id: I2fe59ec9cd183714fd2589be8b4603d11fd1b01d
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
common: Move non-glib macros to common.h

Change-Id: I765b2c5b6f6b787d425b8e70153ed6040e48afbc
Signed-off-by: Karol Lewandowski <lmctlx@gmail.com>
common: Add cleanup variable attrs

_cleanup_* macros make it easy to declare variables with corresponding
cleanup functions to be called when given variable goes out of scope.

This patch also provides _cleanup_free_ function which automatically
calls free() and _cleanup_g_free_ which calls g_free().

  {
    _cleanup_free_ char *p = NULL;

    p = malloc(42);
    ...

    if (!foo)
       return FALSE;

    ...

    return TRUE;
  }
    /* free(p) is automatically called at this point */

Note: it's very important to initialize variable to NULL when
_cleanup_free_ is being used.

Change-Id: I6b10a108af284819de08921115b8b4d1013f4b47
Signed-off-by: Karol Lewandowski <lmctlx@gmail.com>
common: Add missing include guards and normalize their names

Redundant includes were dropped too.

Change-Id: I7f7f8bded4f002c17c3449a3fc475bf00e7d0004
Signed-off-by: Karol Lewandowski <lmctlx@gmail.com>
common: change LINENO to __LINE__ macro in DEBUG

Change-Id: I47724c7579a3a7dd626c9706d1907423e1cf151b
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
gadgetd: add create gadget handler

Change-Id: I873827a57a4ea09891f9e6dee9fcea0280e72597
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
gadgetd: add gadget gdbus object

Change-Id: I2efb9756e21c0d0bb494885be6a8d342b6001e4d
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
gadget object: add strings interface for gadget object

add strings interface to gadget object that allow
to change strings propertioes by dbus

Change-Id: Iff352a646ba8ed8ac84d82ca5234b2e5333a0469
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
Signed-off by: Krzysztof Opasiak <k.opasiak@samsung.com>
manager: Simplify descriptors and strings handling

Change-Id: I996959c02c5fa1b6e31e46bf2c2a7aa4c5c9b92e
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
manager: Don't return true when kernel didn't accept new strings or descriptors

Change-Id: I4677031cbe40e173084fbe74c34d79119062b95b
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
gadget object: add descriptors interface for gadget object

add descriptors interface to gadget object that
expose descriptors as properties on
"org.usb.device.Gadget.Descriptors" interface on d-bus

Change-Id: Ice3ab4a517b18fea7ce6b4f6307fbae10a74cff7
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
gadget object: add function manager interface

add gadget function manager interface for gadget dbus
object that allow to create functions

Change-Id: I78a9d76c7db6a0f87362058532b210e2f2ce1e0a
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
manager: Ensure that at least one string is set when creating gadget

Kernel driver provides set of strings (manufacturer, serial,
product) to USB host only if at least one of them has been
set. In gadgetd we follow the most popular convention that
each USB device should provide strings in English (US).

If user didn't provide value for any of strings we create
empty one. This is information for driver that this gadget
provides strings in English and all three are empty.

Change-Id: I992dc38cebe37b34431b40d91e9f24a41062daf7
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Drop trailing newline from logs

INFO, ERROR and DEBUG macros always append \n so there is no need
to do this explicitly.

Change-Id: I2bb1cdf6da0f3b20965515003b8772ad0b1c2d5b
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
function manager: add create function handler

Change-Id: I393ebb446851413a68b4c6102f631278357d9ba7
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
gadgetd: add ConfigManager interface to XML

Change-Id: I945527916b32e1a0d2256008bb614637f869ff5e
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
function manager: add function manager dbus object

Change-Id: I582be7fedc97d4710d33ee7f8a5da8827e6bf70f
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
common: move get_iface to gadgetd common

Change-Id: I3832ead40e6788009aa21333a9508939d86e0d41
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>