platform/upstream/libusbg.git
8 years agolibusbgx: Fix memory leak in usbg_set_function_ms_attrs()
Krzysztof Opasiak [Thu, 19 Nov 2015 10:09:43 +0000 (11:09 +0100)]
libusbgx: Fix memory leak in usbg_set_function_ms_attrs()

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Add support for importing/exporting loopback function
Krzysztof Opasiak [Mon, 21 Sep 2015 18:58:18 +0000 (20:58 +0200)]
libusbgx: Add support for importing/exporting loopback function

Now it is also possible to use loopback function in gadget
schemes.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Add support for loopback function.
Krzysztof Opasiak [Mon, 21 Sep 2015 18:56:02 +0000 (20:56 +0200)]
libusbgx: Add support for loopback function.

Now it is also possible to create and manage loopback
function using libusbgx library.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add missing test cases
Pawel Szewczyk [Thu, 20 Aug 2015 09:18:04 +0000 (11:18 +0200)]
libusbgx: tests: Add missing test cases

Some test functions are not executed at all. This commit fix it.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add tests for gadget strings enum
Pawel Szewczyk [Wed, 19 Aug 2015 11:59:05 +0000 (13:59 +0200)]
libusbgx: tests: Add tests for gadget strings enum

Test recently added functions using usbg_gadget_str enum.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Add enum for gadget strings
Pawel Szewczyk [Mon, 6 Jul 2015 12:12:06 +0000 (14:12 +0200)]
libusbgx: Add enum for gadget strings

This commit provides functionality for gadget strings similar to
existing gadget attributes api. It allows to iterate over gadget
strings and to write cleaner and more flexible code.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Add USBG_ERROR_NOT_EMPTY error code
Pawel Szewczyk [Mon, 6 Jul 2015 11:13:57 +0000 (13:13 +0200)]
libusbgx: Add USBG_ERROR_NOT_EMPTY error code

ENOTEMPTY error is common when removing configfs objects. This commit
adds proper error message and internal usbg error code for this
situation.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add create function test
Pawel Szewczyk [Mon, 25 May 2015 13:11:28 +0000 (15:11 +0200)]
libusbgx: tests: Add create function test

Change-Id: I3a47f0d16b9259f09bb4ea3eeb3734a89af43019
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add getting function attributes tests
Pawel Szewczyk [Mon, 25 May 2015 13:11:24 +0000 (15:11 +0200)]
libusbgx: tests: Add getting function attributes tests

Change-Id: Ia82f5f124e7b57c2694c605ddc942513fc337645
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add assertions for function attributes
Pawel Szewczyk [Thu, 28 May 2015 10:32:50 +0000 (12:32 +0200)]
libusbgx: tests: Add assertions for function attributes

Change-Id: Idfc179ff08a0d23b73ca0f30519bbc73f6556e10
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add creating configuration test
Pawel Szewczyk [Thu, 28 May 2015 10:31:17 +0000 (12:31 +0200)]
libusbgx: tests: Add creating configuration test

Change-Id: I0e5c09b5664f8e15d9ba70e9a5682992341e0884
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add framework setup for creating config
Pawel Szewczyk [Thu, 19 Feb 2015 13:12:30 +0000 (14:12 +0100)]
libusbgx: tests: Add framework setup for creating config

Change-Id: I19b4777e9b61c7dc63c8bb0644de2a63089e6bd3
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Move initialization from for_each functions to tests
Pawel Szewczyk [Tue, 26 May 2015 08:46:49 +0000 (10:46 +0200)]
libusbgx: tests: Move initialization from for_each functions to tests

Instead of passing void **state as argument for for_each_* functions and
initializing state there, we make initialization first and pass initialized
state as argument for them. It looks more natural this way. This also
allows to run these functions multiple times in single test function.

Change-Id: If84bbedf374f1f0ebf70315cea950dcd2e527d18
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Separate safe state initialization from tests
Pawel Szewczyk [Tue, 26 May 2015 08:04:41 +0000 (10:04 +0200)]
libusbgx: tests: Separate safe state initialization from tests

Test functions usually need to initialize usbg state before testing.
However, initialization may fail, causing test to finish immediatelly,
running teardown function.

This commit add function which takes care of state pointer when
initializing.

Change-Id: I797e56ac3cda67e871c6c4fbd2184220b05068f6
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add macros for structures definitions
Pawel Szewczyk [Tue, 5 May 2015 13:23:25 +0000 (15:23 +0200)]
libusbgx: tests: Add macros for structures definitions

To avoid defining the same or similar values multiple times, we can define
data by proper macros.

Change-Id: I8fa5fd02c76f16a1b9d65a33482a6cd1caa16b70
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Separate common code of gadget testing
Pawel Szewczyk [Tue, 5 May 2015 09:49:01 +0000 (11:49 +0200)]
libusbgx: tests: Separate common code of gadget testing

Most gadget tests run the same initialization and loop through all
gadgets, performing single operation on them and checking results.
Common code is now separated to for_each_test_gadget function.

Change-Id: I0a1870487aa0c25153c96e57da5501e1bccb8132
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add wrappers for safe allocation
Pawel Szewczyk [Thu, 30 Apr 2015 11:50:57 +0000 (13:50 +0200)]
libusbgx: tests: Add wrappers for safe allocation

Every allocation here requires checking if it was successful and
storing it on queue to be freed later. Now it can all be done by single
function call.

Change-Id: I06c0099d0b44cb030b6ab8e338ccd58e078a92ac
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Use new version of cmocka
Pawel Szewczyk [Tue, 19 May 2015 09:30:00 +0000 (11:30 +0200)]
libusbgx: tests: Use new version of cmocka

Deprecated functions of cmocka are no longer used.

Change-Id: If8804103492b089cf033a35d055260452553638e
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: schemes: Allow to import midi function
Pawel Szewczyk [Tue, 19 May 2015 10:42:01 +0000 (12:42 +0200)]
libusbgx: schemes: Allow to import midi function

Add support for importing midi function from gadget scheme.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: schemes: Allow to export midi function
Pawel Szewczyk [Tue, 19 May 2015 15:33:49 +0000 (17:33 +0200)]
libusbgx: schemes: Allow to export midi function

Add support for exporting midi function to gadget scheme.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: examples: Use digital format for bMaxPacketSize0
Krzysztof Opasiak [Tue, 19 May 2015 15:26:48 +0000 (17:26 +0200)]
libusbgx: examples: Use digital format for bMaxPacketSize0

bMaxPacketSize0 is maximal size of packet which can be
used for communication with ep0. As most people use digital
format for size, lets use digital format for both
initialization of this member in gadget atributes and for
printing it in show-gadgets.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: examples: Print bcdUSB and bcdDevice as BCD not HEX
Krzysztof Opasiak [Tue, 19 May 2015 14:53:04 +0000 (16:53 +0200)]
libusbgx: examples: Print bcdUSB and bcdDevice as BCD not HEX

bcdUSB and bcdDevice members should be interpreted as BCD.
So let's print them as BCD instea of HEX.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: examples: Print gadget data in the same order as lsusb.
Krzysztof Opasiak [Tue, 19 May 2015 14:31:42 +0000 (16:31 +0200)]
libusbgx: examples: Print gadget data in the same order as lsusb.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: examples: Make examples easier to read
Krzysztof Opasiak [Tue, 19 May 2015 14:15:36 +0000 (16:15 +0200)]
libusbgx: examples: Make examples easier to read

Use the same order of structure initialization in all
examples.

Initialize gadget attributes and strings using:
.member = val,
syntax to make examples easier to read.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Allow to pass NULL as name to usbg_add_config_function()
Krzysztof Opasiak [Tue, 19 May 2015 13:02:15 +0000 (15:02 +0200)]
libusbgx: Allow to pass NULL as name to usbg_add_config_function()

Somtimes we would like to add function to configuration
without any extraordinary name. In that case we can simply
use type.instance as symlink name.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: examples: add example of midi function usage
Pawel Szewczyk [Tue, 19 May 2015 08:48:11 +0000 (10:48 +0200)]
libusbgx: examples: add example of midi function usage

Support for midi function was recently added. This commit adds an example
program which shows how to create midi gadget with this function.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Update show-gadgets example to support MIDI gadgets
Dominic Sacré [Tue, 12 May 2015 08:19:22 +0000 (10:19 +0200)]
libusbgx: Update show-gadgets example to support MIDI gadgets

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Add support for MIDI function
Dominic Sacré [Mon, 11 May 2015 12:45:10 +0000 (14:45 +0200)]
libusbgx: Add support for MIDI function

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Fix usbg_parse_function_midi_attrs() to store qlen value
in qlen member of attrs struct instead of in buflen

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Mark char pointers in usbg_*_attrs as const
Dominic Sacré [Mon, 11 May 2015 16:28:47 +0000 (18:28 +0200)]
libusbgx: Mark char pointers in usbg_*_attrs as const

These attributes are const as far as a library user is concerned.
This change allows attributes to be cleanly initialized from string
literals.

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Fix warnings when compiling with -Wall
Dominic Sacré [Mon, 11 May 2015 15:56:50 +0000 (17:56 +0200)]
libusbgx: Fix warnings when compiling with -Wall

Remove unused variables and duplicate const specifiers.
This makes libusbgx compile cleanly using -Wall with both gcc and clang.

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Format switch statements more consistently
Dominic Sacré [Mon, 11 May 2015 15:49:43 +0000 (17:49 +0200)]
libusbgx: Format switch statements more consistently

Insert blank lines between all cases in switch statements that branch
on attribute types.

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Fix several typos
Dominic Sacré [Mon, 11 May 2015 15:46:07 +0000 (17:46 +0200)]
libusbgx: Fix several typos

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Fix mapping function type into attributes type
Pawel Szewczyk [Tue, 28 Apr 2015 08:51:51 +0000 (10:51 +0200)]
libusbgx: Fix mapping function type into attributes type

Type of ffs function's attribute is not PHONET, but FFS.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: print leading zero for MAC address bytes
Stefan Agner [Fri, 24 Apr 2015 19:27:53 +0000 (21:27 +0200)]
libusbgx: print leading zero for MAC address bytes

The ethernet gadget driver requires the hex formatted MAC address
bytes with leading zero, in other words each byte needs to be two
characters in length (see get_ether_addr in u_ether.c). The libc
implementation ether_ntoa does not print leading zeros. Hence use
our own implementation which provides the format expected by the
kernel.

Signed-off-by: Stefan Agner <stefan@agner.ch>
[Rebased onto current master and update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: schemes: Allow to import mass storage function
Krzysztof Opasiak [Thu, 16 Apr 2015 10:15:31 +0000 (12:15 +0200)]
libusbgx: schemes: Allow to import mass storage function

Allow to import mass storage function from gadget scheme
file. This make mass storage to be fully supported by
libusbgx.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: schemes: Allow to export mass storage function
Krzysztof Opasiak [Tue, 14 Apr 2015 14:41:37 +0000 (16:41 +0200)]
libusbgx: schemes: Allow to export mass storage function

Add support for exporting mass storage function to
gadget scheme.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Add example with mass storage function
Krzysztof Opasiak [Tue, 14 Apr 2015 09:59:01 +0000 (11:59 +0200)]
libusbgx: Add example with mass storage function

Mass storage support has been recently added to libusbgx.
This commit adds an example program which show how to create
gadget with this function.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Update example to show also mass storage function
Krzysztof Opasiak [Tue, 14 Apr 2015 09:57:44 +0000 (11:57 +0200)]
libusbgx: Update example to show also mass storage function

Mass storage functions has been recently added to libusbgx
so update show-gadgets example to show also attributes of
mass storage function.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Add support for mass storage function
Krzysztof Opasiak [Tue, 14 Apr 2015 10:53:54 +0000 (12:53 +0200)]
libusbgx: Add support for mass storage function

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Add rm callback to usbg_function
Krzysztof Opasiak [Tue, 14 Apr 2015 10:26:42 +0000 (12:26 +0200)]
libusbgx: Add rm callback to usbg_function

Some functions requires more complicated rm method
which will remove its sub directories. To avoid complexity
in usbg_rm_function() just add a callback which is called
there.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Add functions for reading/writing bool values
Krzysztof Opasiak [Tue, 14 Apr 2015 10:40:23 +0000 (12:40 +0200)]
libusbgx: Add functions for reading/writing bool values

Some of function attributes on ConfigFS may be simple
boolean values so add common functions for reading
and writing them.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Rework usbg_read_buf() to accept also empty files
Krzysztof Opasiak [Tue, 14 Apr 2015 09:51:12 +0000 (11:51 +0200)]
libusbgx: Rework usbg_read_buf() to accept also empty files

Some of configfs files may be empty. In that case fgets()
returns NULL but we should accept this situation and
treat it as an empty string.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Add offsetof() and container_of() macros
Krzysztof Opasiak [Tue, 14 Apr 2015 09:00:45 +0000 (11:00 +0200)]
libusbgx: Add offsetof() and container_of() macros

Add some macros which are widely used in linux
kernel and may be useful also in this library.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Dereference pointer before switch
Krzysztof Opasiak [Mon, 13 Apr 2015 10:39:21 +0000 (12:39 +0200)]
libusbgx: Dereference pointer before switch

In each case in usbg_cleanup_function() we have
been using f_attrs->attrs. To make this shorter
and more readable add attrs pointer which is
equal to &f_attrs->attrs.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Allow to pass usbg_init() without access to /sys/class/udc
Krzysztof Opasiak [Thu, 16 Apr 2015 10:31:30 +0000 (12:31 +0200)]
libusbgx: Allow to pass usbg_init() without access to /sys/class/udc

We may would like to use this library on machine where
is no udc support (no /sys/class/udc directory) or
where we don't have sufficient rights to read udc
directory.

This commit adds support for such situation. If we are
running on such machine we will be able to pass usbg_init()
function and manage usb gadgets but we won't be able to bind
gadget to udc as we were unable to read their names.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Fix export of phonet attributes
Krzysztof Opasiak [Tue, 14 Apr 2015 12:12:35 +0000 (14:12 +0200)]
libusbgx: Fix export of phonet attributes

ifname is read only attribute so there is no need
to export it but we should return USBG_SUCCESS
value because this function has been succesfully
exported.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: Don't link libusbgx with cmkocka
Pawel Szewczyk [Tue, 14 Apr 2015 09:56:53 +0000 (11:56 +0200)]
libusbgx: Don't link libusbgx with cmkocka

Cmocka is only needed for tests, no need for linking it
with library itself.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Remove static buffers from usbg_f_ffs_attrs
Krzysztof Opasiak [Wed, 18 Mar 2015 13:32:33 +0000 (14:32 +0100)]
libusbgx: Remove static buffers from usbg_f_ffs_attrs

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Philippe De Swert <philippedeswert@gmail.com>
8 years agolibusbgx: Remove static buffers from usbg_f_phonet_attrs
Krzysztof Opasiak [Wed, 18 Mar 2015 12:40:11 +0000 (13:40 +0100)]
libusbgx: Remove static buffers from usbg_f_phonet_attrs

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Philippe De Swert <philippedeswert@gmail.com>
8 years agolibusbgx: Remove static buffers from usbg_f_net_attrs
Krzysztof Opasiak [Wed, 18 Mar 2015 11:39:24 +0000 (12:39 +0100)]
libusbgx: Remove static buffers from usbg_f_net_attrs

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Philippe De Swert <philippedeswert@gmail.com>
8 years agolibusbgx: Introduce usbg_cleanup_function_attrs() function
Krzysztof Opasiak [Wed, 8 Apr 2015 13:07:49 +0000 (15:07 +0200)]
libusbgx: Introduce usbg_cleanup_function_attrs() function

We would like to eliminate static buffers from function
attributes. To achieve this we should ensure that there
is some function which free the memory allocated
in usbg_get_function_attrs()

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Philippe De Swert <philippedeswert@gmail.com>
8 years agolibusbgx: Make a use of usbg_f_attrs_type
Krzysztof Opasiak [Tue, 17 Mar 2015 16:28:36 +0000 (17:28 +0100)]
libusbgx: Make a use of usbg_f_attrs_type

This commit adds usbg_f_attrs_header which allows
to identify which union field is currently in use.
This allows to eliminate all switch() constructions
with list of all functions types for accessing
function attributes. Now, much more readable and
shorter enum with possible attribute types is used.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Philippe De Swert <philippedeswert@gmail.com>
8 years agolibusbgx: Add usbg_f_attrs_type enum
Krzysztof Opasiak [Tue, 17 Mar 2015 16:14:32 +0000 (17:14 +0100)]
libusbgx: Add usbg_f_attrs_type enum

Currently user has to know which functions has
net attrs, which serial etc. There is a few places
where the same switch construction with list of all
function types is used.

This commit introduce enumeration which can be used
to determine set of function attribute instead of
rewriting the same enum once again.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Philippe De Swert <philippedeswert@gmail.com>
8 years agolibusbgx: Pass suitable structure to usbg_parse_function_net_attrs()
Krzysztof Opasiak [Tue, 17 Mar 2015 10:22:14 +0000 (11:22 +0100)]
libusbgx: Pass suitable structure to usbg_parse_function_net_attrs()

This function is desired to parse only net attrs so pass
a pointer to net attrs structure instead of generic
attrs union.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Philippe De Swert <philippedeswert@gmail.com>
8 years agolibusbgx: Update .gitignore for tests directory
Krzysztof Opasiak [Wed, 8 Apr 2015 08:08:39 +0000 (10:08 +0200)]
libusbgx: Update .gitignore for tests directory

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Make *_attrs and *_strs arguments const-correct
Dominic Sacré [Thu, 12 Mar 2015 10:50:03 +0000 (11:50 +0100)]
libusbgx: Make *_attrs and *_strs arguments const-correct

This makes it easier to use libusbgx in clean, idiomatic C++ code.

This patch changes the *_attrs and *_strs arguments only. It does not
make any assumptions regarding the const-ness of other structures
(usbg_gadget etc.), which is something that doesn't come up in typical
use cases.

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
[Add libusbgx: to commit message.]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Add extern "C" linkage specification when using C++
Dominic Sacré [Thu, 12 Mar 2015 09:38:42 +0000 (10:38 +0100)]
libusbgx: Add extern "C" linkage specification when using C++

This allows using libusbg in C++ code, without requiring users to
manually wrap the #include statement.

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
[Add libusbgx: to commit message.]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: Add a .gitignore file
Dominic Sacré [Thu, 12 Mar 2015 09:38:21 +0000 (10:38 +0100)]
libusbgx: Add a .gitignore file

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Add libusbgx: to commit message.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add config attributes getting and setting test
Pawel Szewczyk [Wed, 18 Feb 2015 15:00:44 +0000 (16:00 +0100)]
libusbgx: tests: Add config attributes getting and setting test

Change-Id: I86e5263e11f3794aa1b999f02778dbf6ce32e572
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add simulation of configfs for config attributes
Pawel Szewczyk [Wed, 18 Feb 2015 15:00:47 +0000 (16:00 +0100)]
libusbgx: tests: Add simulation of configfs for config attributes

Config attributes can be get and set using proper pull_* and push_*
functions as setup.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Fix indent.

Change-Id: Ie168aa3f86c0a8f5e919674a816950bc0c5947ab
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add getting and setting config strs test
Pawel Szewczyk [Mon, 2 Mar 2015 13:37:39 +0000 (14:37 +0100)]
libusbgx: tests: Add getting and setting config strs test

Change-Id: I1c7beaf82e1df526dcd01d13c7d7857d4652fdd7
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add simulation of configfs for config strings
Pawel Szewczyk [Mon, 2 Mar 2015 13:33:05 +0000 (14:33 +0100)]
libusbgx: tests: Add simulation of configfs for config strings

Allows config strings to be get from and set on virtual filesystem.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Add more documentation. Add push_config_string() function.

Change-Id: Ie04321cee9ac2a6defe0b01a650a847e1ac0a581
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add getting binding test
Pawel Szewczyk [Wed, 18 Feb 2015 10:51:20 +0000 (11:51 +0100)]
libusbgx: tests: Add getting binding test

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Fix coding style.

Change-Id: I1ae18bc2393067cd0735ab812ec720e900ef3161
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add simulation of configfs for getting bindings
Pawel Szewczyk [Wed, 18 Feb 2015 10:51:34 +0000 (11:51 +0100)]
libusbgx: tests: Add simulation of configfs for getting bindings

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Add asserts for gadget, config and bindings.

Change-Id: If6ce39332101826888c70790f8518876e03f8a44
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Support static binding definition
Krzysztof Opasiak [Fri, 27 Feb 2015 14:42:52 +0000 (15:42 +0100)]
libusbgx: tests: Support static binding definition

Sometimes we would like to define bindings names
other than default one. To achieve this we allocate
bindings only if they has not been allocated earlier.

Change-Id: Ifbad9b1069dd1a41d4a9f87c427c991538a8417f
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: tests: Make a deep copy of date for each test case
Krzysztof Opasiak [Fri, 27 Feb 2015 10:33:09 +0000 (11:33 +0100)]
libusbgx: tests: Make a deep copy of date for each test case

Each test case should use own copy of test_* structures.
To achieve this we do a deep copy of structures which has
not been marked as writable.

Change-Id: I1f1a949059dd1a41d4a9f80ca27c391533a59a7f
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: tests: Add writable attribute to test_* structures
Krzysztof Opasiak [Thu, 26 Feb 2015 16:07:11 +0000 (17:07 +0100)]
libusbgx: tests: Add writable attribute to test_* structures

Reusing the same structures for many tests is wrong for
security reasons. Some of test cases already allocates
own copy of test structures. This commit adds a field
which indicates if given structure has been allocated
for test case or if it is global structure and should
not be changed.

Change-Id: I8a1f9b9059dd1a41d4a9f80c427c991533f7ab9a
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: tests: Initialize test_function when necessary
Krzysztof Opasiak [Fri, 27 Feb 2015 14:40:10 +0000 (15:40 +0100)]
libusbgx: tests: Initialize test_function when necessary

Binding structure may have some uninitialized functions
and we need to initialize it before usage.

Change-Id: I5c6f9d90f9dd1b41d8a9f80cf27cd9153ac79b7b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
8 years agolibusbgx: tests: Add test_binding structure
Pawel Szewczyk [Wed, 25 Feb 2015 08:40:54 +0000 (09:40 +0100)]
libusbgx: tests: Add test_binding structure

Using the same type for binding and function (and assuming that binding
has the same name as its target function) was not an elegant solution.
It is fixed by adding separate structure and use it in test setups.

To save old, convinient way of defining bindings by list of functions,
additional field in test binding is provided and prepare_state generate
bindings based on it.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
s/binded/bound

Change-Id: I8a1f9b9059dd1a41d4a9f80c427c991533a74b7e
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add getting gadget string test
Pawel Szewczyk [Tue, 24 Feb 2015 15:02:06 +0000 (16:02 +0100)]
libusbgx: tests: Add getting gadget string test

Change-Id: I78ab01d1ca8ff5105448d3bbf3982753cdfc01d6
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add simulation of configfs for getting gadget strings
Pawel Szewczyk [Wed, 18 Feb 2015 09:53:49 +0000 (10:53 +0100)]
libusbgx: tests: Add simulation of configfs for getting gadget strings

Allows to test getting gadget strings the same way as setting them.

Change-Id: I3197865955e22d3ec38f7b81f8050e95f24cdaf8
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add setting gadget strs tests
Pawel Szewczyk [Tue, 17 Feb 2015 14:04:31 +0000 (15:04 +0100)]
libusbgx: tests: Add setting gadget strs tests

Change-Id: Ia7975f0a3a2e8e2bc6bff8bcd64430a6e26d1888
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Fix coding style
Krzysztof Opasiak [Wed, 25 Feb 2015 15:16:51 +0000 (16:16 +0100)]
libusbgx: tests: Fix coding style

Change-Id: I1c47e3990bbd4dbfa620fc353a6cd65898dd6a30
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add simulation of configfs for gadget strings setting
Pawel Szewczyk [Tue, 24 Feb 2015 14:17:10 +0000 (15:17 +0100)]
libusbgx: tests: Add simulation of configfs for gadget strings setting

Like in testing setting gadget attributes, virtual filesystem is
prepared for setting gadget strings.

Change-Id: I0e46e3990aad4dbfa520fc333a6ca65898dd6a30
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Stop using gadget attributes strings array directly
Pawel Szewczyk [Tue, 24 Feb 2015 14:17:18 +0000 (15:17 +0100)]
libusbgx: tests: Stop using gadget attributes strings array directly

Instead of using array exported in usbg-internal.h we use function
provided by libusbgx for getting string of gadget attribute

Change-Id: I6430f0de2926177e5f214713778dca16c33a3f40
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Try to iterate over all gadget attributes
Krzysztof Opasiak [Wed, 25 Feb 2015 08:56:39 +0000 (09:56 +0100)]
libusbgx: tests: Try to iterate over all gadget attributes

Change-Id: I0fa869ecf50ead08171ee1da4b7a5326694efbdc
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Test getting strings of gadget attributes
Pawel Szewczyk [Tue, 24 Feb 2015 12:08:11 +0000 (13:08 +0100)]
libusbgx: tests: Test getting strings of gadget attributes

Simply check if valid strings are returned

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Use USBG_GADGET_ATTR_MIN - 1 instead of just -1.

Change-Id: I0f3869eaf50ead08171ee1da4b7a5326694efb2c
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Update guideline changes
Pawel Szewczyk [Mon, 24 Nov 2014 12:14:22 +0000 (13:14 +0100)]
libusbgx: tests: Update guideline changes

Change-Id: I3bc3124c1e0abec017799da84d628bf97b79737f
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add udc tests
Pawel Szewczyk [Mon, 20 Oct 2014 11:18:31 +0000 (13:18 +0200)]
libusbgx: tests: Add udc tests

Change-Id: I9725395ff5a6bac7f4edfdaa4da9bbce3a3186ff
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add states with long strings
Pawel Szewczyk [Wed, 11 Feb 2015 14:22:27 +0000 (15:22 +0100)]
libusbgx: tests: Add states with long strings

Change-Id: I92c185449293fd9426f151687832b3bdb0c57572
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add gadget attrs get/set tests
Pawel Szewczyk [Wed, 11 Feb 2015 15:10:38 +0000 (16:10 +0100)]
libusbgx: tests: Add gadget attrs get/set tests

Change-Id: I5ab4262a5532e07de9e6e919e6dde5dd49da4702
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add simulation of configfs for gadget attrs get/set
Pawel Szewczyk [Thu, 12 Feb 2015 15:01:52 +0000 (16:01 +0100)]
libusbgx: tests: Add simulation of configfs for gadget attrs get/set

Before executing libusbgx functions which get and set gadget attributes,
we must prepare virtual filesystem to behave as expected.
push_* and pull_* functions take arguments similar to usbg functions
which will be called after them, e.g. push_gadget_attrs(g, a)
will prepare for calling usbg_get_gadget_attrs on gadget matching g,
where a is value passed to be read.

Change-Id: I805544dbd35a1a7f8c2e4073f9f4607d9c70bb95
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add getting config tests
Pawel Szewczyk [Tue, 10 Feb 2015 13:25:30 +0000 (14:25 +0100)]
libusbgx: tests: Add getting config tests

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Remove unused variable in for_each_test_config().

Change-Id: I6dd8dc33639dff2d3322c6098a43c69beb8a7ef6
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add getting configfs path test
Pawel Szewczyk [Mon, 17 Nov 2014 12:23:40 +0000 (13:23 +0100)]
libusbgx: tests: Add getting configfs path test

Change-Id: Ia7d368c8749d28235a4209d5a0de90dc6878717b
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add getting functions tests
Pawel Szewczyk [Wed, 11 Feb 2015 09:13:01 +0000 (10:13 +0100)]
libusbgx: tests: Add getting functions tests

Change-Id: I89296562177061559de84aa5332d8dc9347d2e13
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Use cast_to_largest_integral_type()
Krzysztof Opasiak [Wed, 11 Feb 2015 10:43:17 +0000 (11:43 +0100)]
libusbgx: tests: Use cast_to_largest_integral_type()

Direct cast from pointer to integer of different size
causes ugly compiler warning. To avoid this use
dedicated macro from cmocka.

Change-Id: I56f4095dd8f98c8349d02b421f02de1d61e0b2b8
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Make some functions static, some move to header
Pawel Szewczyk [Tue, 10 Feb 2015 14:29:18 +0000 (15:29 +0100)]
libusbgx: tests: Make some functions static, some move to header

init_with_state is also used by functions in usbg-test.c, so was declared
globaly in header. Other functions from test.c is not used outside and
we can make them static.

Change-Id: I56f4095dd8f98c8349d02b421f02de1d61e0b2b7
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add doxygen macros for documenting test cases
Krzysztof Opasiak [Tue, 22 Dec 2015 20:21:27 +0000 (21:21 +0100)]
libusbgx: tests: Add doxygen macros for documenting test cases

Also proceed doxygen config file with autoconf now. Autoconf copy .in file,
substituting found variable values. It allows to specify what documentation
should be build by configure script.

Change-Id: I00cae61aefcc5b6444b0afc0dfe73c5973de34a9
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Rebase and update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Remove unused variables
Krzysztof Opasiak [Mon, 9 Feb 2015 09:29:59 +0000 (10:29 +0100)]
libusbgx: tests: Remove unused variables

Change-Id: I4db3a1d8683867c1e969898882f0589f477ebe4c
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add guarding macros in header
Pawel Szewczyk [Wed, 26 Nov 2014 15:19:15 +0000 (16:19 +0100)]
libusbgx: tests: Add guarding macros in header

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Remove unnecessary newline.

Change-Id: I3db3a1d8683867c1e969898882f0589f477ebe4b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add autotools making description to guideline
Pawel Szewczyk [Fri, 12 Dec 2014 13:36:06 +0000 (14:36 +0100)]
libusbgx: tests: Add autotools making description to guideline

Change-Id: I82b8b5b2f792bf72586d93cc5d6987ad017be618
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Build tests with autotools
Krzysztof Opasiak [Tue, 22 Dec 2015 20:17:18 +0000 (21:17 +0100)]
libusbgx: tests: Build tests with autotools

Change-Id: I1438caf6806d2197bcf20a63b56e33d9243fb2a0
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description and rebase]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add proper path comparing
Pawel Szewczyk [Wed, 7 Jan 2015 15:53:06 +0000 (16:53 +0100)]
libusbgx: tests: Add proper path comparing

Multiple slashes are allowed in paths, so they cannot be compared as
simple strings.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Fix some code style issue. Move expect_path() macro
to heder file.

Change-Id: I613f9335ac665ae0e038b0493c6582a20678bd12
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Fix tests to use correct usbg_state field
Krzysztof Opasiak [Tue, 3 Feb 2015 13:16:42 +0000 (14:16 +0100)]
libusbgx: tests: Fix tests to use correct usbg_state field

Due to recent changes in usbg_state, lets
introduce configfs_path field in state test_state
structure and fill it.

Since now path field should not be filled as it's
filled by prepare_state() function and generates
subsystem path using given configfs path.

Change-Id: I50e606c9f8c5eb478ac48fc453840b9a3efdd117
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Fix tests build
Krzysztof Opasiak [Tue, 3 Feb 2015 13:24:56 +0000 (14:24 +0100)]
libusbgx: tests: Fix tests build

Due to adding configure flags which allows to disable
libconfig dependency introduce a temporary fix which should
be removed when we will build tests with autotools.

Change-Id: I51f606c9f8c5eb478ac48fc453840b9a3efdd117
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Remove negative buffer test
Pawel Szewczyk [Wed, 7 Jan 2015 10:21:56 +0000 (11:21 +0100)]
libusbgx: tests: Remove negative buffer test

Size_t is unsigned and passing -1 as buffer length makes no sense.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Rebase and update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add options parsing to running script
Krzysztof Opasiak [Tue, 22 Dec 2015 20:44:45 +0000 (21:44 +0100)]
libusbgx: tests: Add options parsing to running script

Change-Id: I1658663e8b7f14b5595ef806c5fca03ae10c830d
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add testing guideline
Pawel Szewczyk [Mon, 17 Nov 2014 16:06:34 +0000 (17:06 +0100)]
libusbgx: tests: Add testing guideline

Change-Id: Ia7c2fa66a0bfa024858cde90a52ed05cbd41b12c
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Allow to skip some tests
Krzysztof Opasiak [Fri, 14 Nov 2014 15:14:23 +0000 (16:14 +0100)]
libusbgx: tests: Allow to skip some tests

In some cases we may want to mark some tests as skipped.
Doing this in code requires recompilation after each change.
This patch extends the tests framework and allows to create
configuration file and mark some tests as skipped (for example
using # and comment some test and run them always from the
same binary file.

We use stdin/stdout for reading/writing configuration
because we are wrapping filesystem operations in our
mock framework (usbg-io-wrappers). To keep our mock
framework as simple as we can we use those standard
streams which are forrwarded by framework to original
implementations of those functions.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolibusbgx: tests: Add init and getting gadgets tests
Pawel Szewczyk [Fri, 14 Nov 2014 13:22:54 +0000 (14:22 +0100)]
libusbgx: tests: Add init and getting gadgets tests

Change-Id: I4c872a76bf59b8eaababfdf4bbb1804d4008f8de
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Make two macros (generic and specific) for defining test
cases instead of hardcoding everything in one macro.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>