Age | Commit message (Collapse) | Author | Files | Lines |
|
This reverts commit d25dbaed77aeb19345d57af73f64989a1d5e6265.
Change-Id: Ic6abcb23180f4b015b41a994b36f78607bd0081c
Signed-off-by: taeyoung <ty317.kim@samsung.com>
|
|
- thread unsafe functions are removed.
- sprintf is changed to snprintf
Change-Id: I129984005ae538496a1135cbc8a191f588a432ff
Signed-off-by: taeyoung <ty317.kim@samsung.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
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>
|
|
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>
Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
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>
Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Mass storage support has been recently added to libusbg.
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>
|
|
Mass storage functions has been recently added to libusbg
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
This example shows how to learn what udcs are available
in system and also how to find out what gadgets are
enabled on them.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Using string as udc identifier provides a lot
of troubles. To be more consistent with rest of
API rework it to start using usbg_udc structure
instead of using char *.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Changes since v1:
Fix show-gadgets example: get attributes before dereferencing them
Reported-by: Philippe De Swert <philippe.deswert@jollamobile.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
The include flag should point to the source directory, not the build
directory.
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Rebased onto kopasiak/master.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add sample C code which shows how to use new functionality
of libusbg - gadget export. This program allows to export
chosen gadget from configfs to a file.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add example which demonstartes two ways of creating ffs
based usb functions.
How to set-up gadget using this example:
1) Run gadget-ffs
2) Mount both instances:
$ mount my_dev_name -t functionfs /path/to/mount/dir1
$ mount my_awesome_dev_name -t functionfs /path/to/mount/dir2
3) Run ffs daemons for both instances:
$ my-ffs-daemon /path/to/mount/dir1
$ my-ffs-daemon /path/to/mount/dir2
4) Enable your gadget:
$ echo "my_udc_name" > /sys/kernel/config/usb_gadget/g1/UDC
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Removing gadget/config/function/binding functionality
has been added to API so add example of how to use it.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Naming convention of Config FS should not be exposed
to user of library. All API functions should use
configuration ID (configuration number) as unique
identificator and configuration label as human
readable description.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
User of library should not use directly function name but
only type of the function and name of instance. Using this
will separate user for naming convention on Config FS.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Examples provided with the library should use returned
error codes and provide information to user.
Remove todo baceuse it has been already done.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Each usbg_set_config_*() may fail so it should have
a return value to notify user about reason of failure.
To be consistent with rest of API usbg_create_config()
should also return error code to notify user about reasons
of failure instead of binary information (NULL or not).
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Each usbg_set_*() may fail so it should have a return value
to notify user about reason of failure.
To be consistent with rest of API usbg_create_function()
should also return error code to notify user about reasons
of failure instead of binary information (NULL or not).
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Functions related to gadget creation should return error codes
instead of pointer.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Assumption that all malloc() and read()/write() finish correctly
is too bold. Errors should be handled and propagated to upper
layers of library and returned to user.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Config strings should not be cached in library.
Removing internal strings structure allowed to add
full support for multilingual strings.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Gadget strings should not be cached in library.
Removing internal strings structure allowed to add
full support for multilingual strings.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
API of library has been changed, so it is necessary
to update examples of library usage.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Switch form struct * to typedef usbg_* to provide convenient
API for user.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of binding structure to avoid direct
access to its fields. Rename it to usbg_binding.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of function structure to avoid direct
access to its fields. Rename it to usbg_function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of config structure to avoid direct
access to its fields. Rename it to usbg_confg.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Remove definition of gadget structure to avoid direct
access to its fields. Rename that structure to usbg_gadget.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of state structure to avoid direct
access to its fields. Rename it to usbg_state.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_get_function_attrs() and usbg_get_function_type()
to aviod direct access to function structure members.
Add usbg_set_function_attrs() to allow set all function\
attributes with one call.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_set_config_attrs() function to allow setting
all attributes with one call. Add also getter for attrs
to avoid direct accessing of configuration fields.
Add usbg_set_config_strs() to be consistent with gadget
API.
Change usbg_create_config() to allow configuration creation
and attribute setting with one call.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Configuration, its attributes and strings are all logically
independent so should be placed in separate structures.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Rename usbg_create_gadget() to usbg_create_vid_pid().
dd usbg_create_gadget() to allow gadget creation
with given attributes and strings. Add usbg_set_gadget_attrs()
which allow to set all attributes with one call. Add
usbg_set_gadget_strs() which allow to set all strings with
one call.
Gadget structure creation and initialization has been moved to
usbg_create_empty_gadget() to avoid copy-paste same code in
usbg_create_gadget_vid_pid() and usbg_create_gadget().
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Gadget strings are not logically part of gadget, so should
be separated.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Rename all gadget attributes to be consistent with usb
standard and libusb. Change also field size and order
to allow direct memcpy from libusb_device_descriptor.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Gadget attributes should be placed in external structure
because they are almost that same as USB device descriptor.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Make use of previously unused variable ret to cleanup
after successful gadget creation.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Update documentation and example source code to reflect use of the
standard /sys/kernel/config mount point for configfs.
Signed-off-by: Matt Porter <mporter@linaro.org>
|
|
Update email address for myself throughout the code.
Signed-off-by: Matt Porter <mporter@linaro.org>
|