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 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>
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>
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>
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>
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>
[Port from libusbg and update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>