summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-01-24libusbgx: packaging: Add missing uac2 header to devel packagetizen_5.5.m2_releasesubmit/tizen_5.5_wearable_hotfix/20201026.184307submit/tizen_5.5_mobile_hotfix/20201026.185107submit/tizen_5.5/20191031.000007submit/tizen_5.0/20181101.000007submit/tizen/20180124.125848accepted/tizen/unified/20180124.154305accepted/tizen/5.5/unified/wearable/hotfix/20201027.100104accepted/tizen/5.5/unified/mobile/hotfix/20201027.073746accepted/tizen/5.5/unified/20191031.011043accepted/tizen/5.0/unified/20181102.030005tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5_mobile_hotfixtizen_5.5tizen_5.0accepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified_mobile_hotfixaccepted/tizen_5.5_unifiedaccepted/tizen_5.0_unifiedKrzysztof Opasiak1-0/+1
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2018-01-17libusbgx: examples: Make show-gadgets aware of uac2 functionsubmit/tizen/20180124.124543Krzysztof Opasiak1-0/+15
Allow user to show values of uac2 attributes instead of dummy "UNKNOWN" string. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2018-01-17libusbgx: examples: Add UAC2 function exampleJohn Keeping3-1/+119
Show how to create a USB Audio Class 2 gadget. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2018-01-17libusbgx: Add support for UAC2 functionJohn Keeping6-2/+470
This is the USB Audio Class 2 function that creates an ALSA audio device exposed as a USB gadget function. Signed-off-by: John Keeping <john@metanate.com> [Set import/export callbacks to correct values, adjust convention of set_attr(), fix union cast in c++] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com
2017-12-12libusbgx: fix: Disallow creating function with empty instance nameKrzysztof Opasiak1-1/+1
USB function should have both type and instance name. Mistakenly it was possible to create function with empty instance name. This may lead to situations like FunctionFS device name identified by "" or some misleading debug messages from TCM like: tcm: Activating Additionaly trying to execute usbg_init() after creating such a function fails with -3 USBG_ERROR_INVALID_PARAM because it checks if instance name is not empty. To avoid this let's add a check in usbg_create_function() that instance name should have at least one character. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: tests: fix: Make our tests os_desc awareKrzysztof Opasiak1-1/+4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: examples: Add rndis with OS descriptors support exampleKrzysztof Opasiak3-1/+155
Add a program which shows how to use OS descriptors support based on RNDIS example. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: fix: Correct typo in usbg_rm_file() funciton nameKrzysztof Opasiak3-4/+4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: Make usbg_rm_config() aware of OS descriptorsKrzysztof Opasiak1-2/+10
Since we added support for OS descriptors we allowed user to create a link in gadget's os_desc directory to choose one of available configurations. This link prevents config from being removed. This makes our rm funcitons stop working with the recursive option. To fix this, let's make them OS desc aware and remove this link before trying to remove configuration if recurse option is set. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: Add support for OS Descriptor configuration bindingsStefan Agner4-0/+228
OS Descriptors require an association to a single configuration. This allows to use a specific configuration for hosts supporting OS Descriptors. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Allow to also remove os desc binding] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: Add config support for function OS DescriptorsStefan Agner1-0/+179
This adds support for OS Descriptors available on function level, called "Feature Descriptors". Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Use a little bit different convention] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: Add function level OS Descriptor supportStefan Agner2-0/+109
This adds support for OS Descriptors available on function level, called "Feature Descriptors". Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Fix mem leak in error path, allow multiple ifaces per funciton] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: Add interface name for Feature DescriptorsStefan Agner2-0/+9
This adds interface name required for "Feature Descriptors". If specified, we can assume that a Feature Descriptor with the interface name of the specified string is understood by the kernel (e.g. interface.rndis). Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Allow multiple os_desc ifaces per funciton] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: Add libconfig support for OS DescriptorsStefan Agner1-0/+124
Add configuration support for OS Descriptors. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Move import to the right place, don't strdup() during import] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-12libusbgx: Add OS Descriptors supportStefan Agner3-0/+157
This adds OS Descriptors support on Gadget level. It allows to enable OS Descriptors support as well as to define the OS String proper. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Remove unused variable] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-12-11libusbgx: Do not write null terminator when using usbg_write_string()Stefan Agner1-1/+1
The helper usbg_write_string() adds one to the length of the provided string. This leads to usbg_write_buf() writting also a null terminator to the kernel which is not necessary/wrong. Provide usbg_write_buf the real string length. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Add missing () to function names in commit msg] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-11-24libusbgx: fix usbg_free_gadget_strs when passing NULLStefan Agner1-1/+1
Do not dereference g_strs if we pass NULL to usbg_free_gadget_strs. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-11-20libusbgx: fix: Install mising hid function headerKrzysztof Opasiak2-1/+2
Reported-by: Matthias Wieloch vel Saiberion (guthub.com) Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-11-20libusbgx: fix: Check fclose() return codeKrzysztof Opasiak1-7/+11
According to man fclose: "The fclose() function may also fail and set errno for any of the errors specified for the routines close(2), write(2) or fflush(3)." So if libc decides to cache our write till closing fd we may miss the error if we ignore value returned from fclose(). This fixes issue #12 (github). Reported-by: Noralf Trønnes <noralf@tronnes.org> Suggested-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-04-19libusbgx: fix: remove unused variabletizen_4.0.m2_releasetizen_4.0.m1_releasetizen_4.0.IoT.p2_releasetizen_4.0.IoT.p1_releasesubmit/tizen_4.0/20170828.100006submit/tizen_4.0/20170811.094300submit/tizen/20170421.113907accepted/tizen/4.0/unified/20170828.222727accepted/tizen/4.0/unified/20170816.013259upstreamtizen_4.0sandbox/kopasiak/upgrade_to_libusbgx_v0.1.0accepted/tizen_4.0_unifiedKrzysztof Opasiak1-1/+0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-03-03libusbgx: Fix meaning of HAS_LIBCONFIG and HAS_GADGET_SCHEMESKrzysztof Opasiak10-24/+32
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>
2017-03-03libusbgx: Fix compilation without libconfigKrzysztof Opasiak7-216/+296
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>
2017-03-03libusbgx: examples: Add example how to create gadget with HID functionKrzysztof Opasiak3-1/+155
Let's add some simple example how to create a gadget which includes HID function. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-03-03libusbgx: examples: Allow show-gadgets to print HID function attrsKrzysztof Opasiak1-1/+19
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>
2017-03-03libusbgx: Add support for HID functionKrzysztof Opasiak5-1/+653
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>
2017-03-03libusbgx: common: Allow to export int attribute in hex formatKrzysztof Opasiak2-0/+22
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>
2017-03-03libsubgx: common: Allow to export dev_t attribute using libconfigKrzysztof Opasiak2-0/+27
Add a helper to export dev_t attributes to gadget schemes using libconfig syntax. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-03-03libusbgx: common: Add function for reading dev_t from ConfigFSKrzysztof Opasiak2-0/+24
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>
2017-03-03libusbgx: common: Use fread() instead of fgets()Krzysztof Opasiak3-40/+38
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>
2017-03-03libusbgx: common: Use fwrite() instead of fputs()Krzysztof Opasiak4-45/+73
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>
2017-03-03libusbgx: examples: Print strings in all available languagesKrzysztof Opasiak1-13/+48
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>
2017-03-03libusbgx: Simplify strings handling in libconfig schemesKrzysztof Opasiak1-74/+27
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>
2017-03-03libusbgx: Add usbg_get_config_str_langs()Krzysztof Opasiak2-0/+13
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>
2017-03-03libusbgx: Add usbg_get_gadget_strs_langs()Krzysztof Opasiak2-0/+64
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>
2017-03-03libusbgx: Get rid of static buffers from usbg_config_strsKrzysztof Opasiak3-9/+9
Remove static buffers which limits strings length from usbg_config_strs. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-03-02libusbgx: Add usbg_free_config_strs()Krzysztof Opasiak4-0/+16
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>
2017-03-02libusbgx: Get rid of static buffers from usbg_gadget_strsKrzysztof Opasiak4-28/+55
Remove static buffers which limits strings length from usbg_gadget_strs. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-03-02libusbgx: common: Fix usbg_read_string_alloc() to read long strings correctlyKrzysztof Opasiak1-1/+4
Use usbg_read_string_limited() directly to avoid length limit hidden in usbg_read_string(). Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2017-03-02libusbgx: Add usbg_free_gadget_strs()Krzysztof Opasiak4-0/+14
This is a first step to get rid of static buffers in usbg_gadget_strs. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2016-12-14libusbgx: Keep gadget strs in the same order as in device descKrzysztof Opasiak5-23/+22
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>
2016-12-14libusbgx: Use string name similar to USB specKrzysztof Opasiak10-42/+42
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>
2016-12-14libusbgx: tests: Fix indent and line lengthKrzysztof Opasiak3-60/+108
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>
2016-12-14libusbgx: Remove typedefs for public structuresKrzysztof Opasiak12-112/+137
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>
2016-12-13libusbgx: Use suitable prefix for usbg_function_type enumKrzysztof Opasiak9-116/+116
Let's use USBG_ prefix for usbg_function_type enum values to avoid users confusion. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2016-12-13libusbgx: Use suitable prefix for usbg_gadget_str enumKrzysztof Opasiak2-9/+9
Let's use USBG_ prefix for usbg_gadget_str enum values to avoid users confusion. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2016-12-13libusbgx: Use suitable prefix for usbg_gadget_attr enumKrzysztof Opasiak3-24/+24
Let's use USBG_ prefix for usbg_gadget_attr enum values to avoid users confusion Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2016-12-06libusbgx: Move internal defines to a suitable hederKrzysztof Opasiak2-3/+4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2016-12-06libusbgx: fix: Add missing include in usb_common.cFabian Vogt1-0/+1
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>
2016-12-06libusbgx: Add missing cpp guardsKrzysztof Opasiak8-2/+68
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2016-10-05Remove redundant assignmentsKrzysztof Opasiak3-4/+4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>