Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
We have two configure options related to libconfig:
1) --disable-gadget-schemes
2) --without-libconfig
Option #1 means that libusbgx itself should be compiled without gadget
schemes support. Option #2 means that everything what requires
libconfig should be turned off. So option #2 is wider than #1 as
libconfig us used also in our testing program.
To fix this meaning let's use HAS_GADGET_SCHEMES inside library source
code to determine if we should use libconfig or not and HAS_LIBCONFIG
inside our tests source code.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
After refactorization we lost ability to build libusbgx
without libconfig. Let's restore this.
Basic concept is that the whole code related to libconfig usage
should be under #ifdef or compiled only if libconfig support
is enabled.
To prevent future problems of that kind, let's create a header
which is included when compiling without libconfig. Inside it we
like:
struct s {
.import = usbg_get_config_node_int,
.export = usbg_set_config_node_int,
};
are still valid, but all tries to call this functions directly end up
in compilation error. This helps us identify all pieces of code
which should be placed under suitable #ifdef.
Based on initial pull request "Compilation fixes. #4" by:
Bent Bisballe Nyeng (github: aasimon) <deva@aasimon.org>
Reported-by: Bent Bisballe Nyeng (github: aasimon) <deva@aasimon.org>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Let's add some simple example how to create a gadget which includes
HID function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
As libusbgx now supports also HID function so we may print its
attributes in our show-gadgets example. This may also be used
as example of getting HID attributes using generic functions.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
HID function has been ported to ConfigFS interface quite long
time ago so let's add support for it also in libusbgx.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add a helper to export int attributes in hex format.
Now each function may decide which format should be used
(decimal or hex).
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add a helper to export dev_t attributes to gadget schemes using
libconfig syntax.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
As some of kernel functions expose details about device node
which is assigned to this instance in form:
<major>:<minor>
Let's add a convenient helper which will read those values
form file and convert them to dev_t.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Reading binary data using fgets() may not be a good idea due
to \0 byte in the middle of data. Let's fix this by using fread()
instead of fgets().
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Using fputs() for writing binary data is not a good idea as \0
byte can be in the middle of our data. Let's just use fwrite()
instead.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Instead of printing strings only in US_EN let's make a use of
our new function and print all available strings.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Make use of usbg_get_gadget_strs_langs() and
usbg_get_config_strs_langs() in libconfig schemes instead of
direct listing content of directory using scandir().
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add a function which allows to get the list of languages
in which config strings are currently available.
Thanks to this function now we may iterate through all strings
languages available in particular config and print their values.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add a function which allows to get the list of languages
in which gadget strings are currently available.
Thanks to this function now we may iterate through all strings
languages available in particular gadget and print their values
for each language.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Remove static buffers which limits strings length from
usbg_config_strs.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
This is a first step to get rid of static buffers from usbg_config_strs.
This function should be called to release memory allocated for
configuration string.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Remove static buffers which limits strings length from usbg_gadget_strs.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Use usbg_read_string_limited() directly to avoid length limit
hidden in usbg_read_string().
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
This is a first step to get rid of static buffers in usbg_gadget_strs.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Let's keep gadget strings in the same order as they appear
in USB device descriptor to avoid mistakes during structure
initialization.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
str_ser, str_prd and str_mnf are a little bit weird names
so let's replace them with names defined by USB spec.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Let's keep our lines not longer than 80 characters
and fix also indentation for function params.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Let's remove typedefs from public structures to clearly
indicate users which structures can be accessed and which
should be used only as handles.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Let's use USBG_ prefix for usbg_function_type enum values
to avoid users confusion.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Let's use USBG_ prefix for usbg_gadget_str enum values
to avoid users confusion.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Let's use USBG_ prefix for usbg_gadget_attr enum values
to avoid users confusion
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
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>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
- 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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
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>
|
|
Let's use more kernel-like convention to make gadget
code more readable.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|