Krzysztof Opasiak [Tue, 6 Dec 2016 13:20:57 +0000 (14:20 +0100)]
libusbgx: Move internal defines to a suitable heder
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Fabian Vogt [Fri, 2 Dec 2016 11:08:14 +0000 (12:08 +0100)]
libusbgx: fix: Add missing include in usb_common.c
snprintf is used multiple times in usb_common.c,
but it did not include stdio.h before.
Signed-off-by: Fabian Vogt <fvogt@suse.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 6 Dec 2016 11:20:54 +0000 (12:20 +0100)]
libusbgx: Add missing cpp guards
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Wed, 5 Oct 2016 20:12:11 +0000 (22:12 +0200)]
Remove redundant assignments
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
taeyoung [Wed, 31 Aug 2016 09:11:58 +0000 (18:11 +0900)]
license: move COPYING file to the example package
- COPYING file is for the GPL-2.0.
- Library is under LGPL-2.1 and the example apps are under GPL-2.0.
Thus COPYING is moved to the example package
Change-Id: I03810ef8adec37f6d1d943e9d1994cb4e765d315
Signed-off-by: taeyoung <ty317.kim@samsung.com>
[Ported from review.tizen.org]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
John Keeping [Tue, 12 Jul 2016 12:26:47 +0000 (13:26 +0100)]
libusbgx: Allow building without examples
When just using the library, the examples are not needed, so provide a
way to avoid building and installing them.
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Nicolas Saenz Julienne [Tue, 23 Feb 2016 23:14:25 +0000 (23:14 +0000)]
libusbgx: fix INSERT_TAILQ_STRING_ORDER
If inserting a node in the middle of a list that's long enough (> 3) the macro
will add the node in the right spot and then step on the rest of entries until
the end.
Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 26 Jan 2016 10:13:48 +0000 (11:13 +0100)]
libusbgx: loopback: Fix loopback function name
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 25 Jan 2016 18:58:34 +0000 (19:58 +0100)]
libusbgx: Fix pkgconfig to link correct library
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 25 Jan 2016 15:37:35 +0000 (16:37 +0100)]
libusbgx: ms: fix: Use correct variable to check function result
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 25 Jan 2016 15:37:00 +0000 (16:37 +0100)]
libusbgx: fix: Add missing includes
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 25 Jan 2016 15:36:11 +0000 (16:36 +0100)]
libusbgx: Remove unused out label in usbg_set_function_attrs()
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 25 Jan 2016 15:35:26 +0000 (16:35 +0100)]
libusbgx: Make usbg_cleanup_function() return void
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 25 Jan 2016 15:22:55 +0000 (16:22 +0100)]
libusbgx: Remove unused out label
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 25 Jan 2016 15:18:17 +0000 (16:18 +0100)]
libusbgx: net: Fix ether addr importing
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Wed, 23 Dec 2015 10:42:21 +0000 (11:42 +0100)]
libusbgx: fix: Install also function-specific headers
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 23:39:11 +0000 (00:39 +0100)]
libusbgx: Release libusbgx version 0.1.0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 23:31:52 +0000 (00:31 +0100)]
libusbgx: Add suitable copyrights
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 16:22:17 +0000 (17:22 +0100)]
libusbgx: Use rmdir() instead of unlink() for directories
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 14:06:06 +0000 (15:06 +0100)]
libusbgx: tests: Update tests to use *_s() functions
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 14:05:51 +0000 (15:05 +0100)]
libusbgx: Replace *_cpy_*() functions with *_s() convention
Instead of having _cpy_ and _len function for getting
each string value let's use *_s() which behave like snprintf()
family.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 13:05:49 +0000 (14:05 +0100)]
libusbgx: Refactor the core code to be more readable
Let's use more kernel-like convention to make gadget
code more readable.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 21 Dec 2015 22:43:57 +0000 (23:43 +0100)]
libusbgx: tests: Port all tests to new API
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 23:04:29 +0000 (00:04 +0100)]
libusbgx: examples: Port all examples to new API
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 21 Dec 2015 21:51:53 +0000 (22:51 +0100)]
libusbgx: Switch to a new function API
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 22:22:47 +0000 (23:22 +0100)]
libusbgx: ms: Add implementation of function specific API
Implement all function-specific functions from header file
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Thu, 10 Dec 2015 21:43:38 +0000 (22:43 +0100)]
libusbgx: tests: Update tests to read params in correct orders
Oreder of rading parameters from ConfigFS by net function has
changed, so let's update also related tests cases.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:47:05 +0000 (22:47 +0100)]
libusbgx: net: Add implementation of function specific API
Implement all function-specific functions from header file
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:45:59 +0000 (22:45 +0100)]
libusbgx: midi: Add implementation of function specific API
Implement all function-specific functions from header file
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:44:17 +0000 (22:44 +0100)]
libusbgx: loopback: Add implementation of function specific API
Implement all function-specific functions from header file
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:43:10 +0000 (22:43 +0100)]
libusbgx: serial: Add implementation of function specific API
Implement all function-specific functions from header file
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:42:12 +0000 (22:42 +0100)]
libusbgx: phonet: Add implementation of function specific API
Implement all function-specific functions from header file
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:41:37 +0000 (22:41 +0100)]
libusbgx: ffs: Add implementation of function specific API
Implement all function-specific functions from header file
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 22:13:44 +0000 (23:13 +0100)]
libusbgx: common: Add alloc_inst() and free_inst() callbacks
Those callback can be used by specific function type to allocate
and then free more memory than in raw usbg_function structure.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Mon, 21 Dec 2015 20:43:15 +0000 (21:43 +0100)]
libusbgx: common: Add helper for getting and setting bool values
Add helper functions which allows to get and set bool values
from both configfs and libconfig files.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:47:14 +0000 (22:47 +0100)]
libusbgx: common: Add helper for getting and setting ether addr
Add helper functions which allows to get and set ether addr
from both configfs and libconfig files.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 22:36:59 +0000 (23:36 +0100)]
libusbgx: common: Add helper for getting and setting string values
Add helper functions which allows to get and set string values
from both configfs and libconfig files.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 22:36:48 +0000 (23:36 +0100)]
libusbgx: common: Add helper for getting and setting dec values
Add helper functions which allows to get and set int values
from both configfs and libconfig files.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Wed, 9 Dec 2015 21:16:05 +0000 (22:16 +0100)]
libusbgx: common: Add functions for reading string with limited length
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 11:29:13 +0000 (12:29 +0100)]
libusbgx: ms: Define new API for mass storage function
As mass storage support has been separated form main
library file we may now define function-specific
API for better support of this function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 22:00:04 +0000 (23:00 +0100)]
libusbgx: serial: Define new API for serial functions
As serial functions support has been separated form main
library file we may now define function-specific
API for better support of this function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:59:56 +0000 (22:59 +0100)]
libusbgx: phonet: Define new API for phonet function
As phonet support has been separated form main
library file we may now define function-specific
API for better support of this function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:59:50 +0000 (22:59 +0100)]
libusbgx: net: Define new API for net functions
As net functions support has been separated form main
library file we may now define function-specific
API for better support of this function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:59:44 +0000 (22:59 +0100)]
libusbgx: midi: Define new API for midi function
As midi support has been separated form main
library file we may now define function-specific
API for better support of this function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:59:38 +0000 (22:59 +0100)]
libusbgx: loopback: Define new API for loopback function
As loopback support has been separated form main
library file we may now define function-specific
API for better support of this function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:59:28 +0000 (22:59 +0100)]
libusbgx: ffs: Define new API for functionfs function
As functionfs support has been separated form main
library file we may now define function-specific
API for better support of this function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 23:17:25 +0000 (00:17 +0100)]
libusbgx: Add internal API for defining function types
Adding support for a new function type was quite complicated.
Moreover the main library source fail was growing realy fast.
As a solution introduce internal OO API for defining function.
Thanks to this support for each function may be placed in
a separate file.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:29:32 +0000 (22:29 +0100)]
libusbgx: Move some common functions to a separate file
Main library file is definitely too big so let's move
some common functions into a separate file.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 21:27:43 +0000 (22:27 +0100)]
libusbgx: Move error-ralted functions to a separate file
Main library file is definitely too big so let's move
some error-related functions into a separate file.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Krzysztof Opasiak [Tue, 22 Dec 2015 23:17:08 +0000 (00:17 +0100)]
libusbgx: packaging: Add packaging for generating rpm package.
Change-Id: I69eb6b752e35e0a718cce06b1634ece376c2bcb4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>