1
0
Fork 0
mirror of https://github.com/linux-usb-gadgets/libusbgx.git synced 2025-07-12 22:59:43 +03:00
Commit graph

439 commits

Author SHA1 Message Date
Michael Grzeschik
dbedf16f80
Merge pull request #99 from mgrzeschik/release/0.3.0
libusbgx: Release libusbgx version 0.3.0
2024-09-27 16:01:22 +02:00
Michael Grzeschik
e120b4d5e3 libusbgx: Release libusbgx version 0.3.0
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
2024-09-25 01:10:50 +02:00
Michael Grzeschik
fe39790ccd
Merge pull request #95 from mgrzeschik/feature/meson
Use meson build system
2024-09-25 00:55:19 +02:00
Andri Yngvason
2a3a4bacfc libusbgx: Add meson build system 2024-09-25 00:41:03 +02:00
Michael Grzeschik
2e374d50aa
Merge pull request #98 from mgrzeschik/bugfix/functions-buildwarnings
Bugfix/functions buildwarnings
2024-09-25 00:36:09 +02:00
Michael Grzeschik
8664b79d12 include: function: net: Fix narrowing integer conversions
This fixes the following compilation error/warning:

In file included from ../tests/header_checker.cpp:6:
../include/usbg/function/net.h: In function ‘int usbg_f_net_set_subclass(usbg_f_net*, unsigned int)’:
../include/usbg/function/net.h:278:67: error: narrowing conversion of ‘subclass’ from ‘unsigned int’ to ‘int’ [-Werror=narrowing]
  278 |                                        USBG_F_NET_INT_TO_ATTR_VAL(subclass));
      |                                                                   ^~~~~~~~
../include/usbg/usbg.h:61:34: note: in definition of macro ‘USBG_TO_UNION’
   61 |         ((union UNAME){ .FIELD = WHAT, })
      |                                  ^~~~
../include/usbg/function/net.h:278:40: note: in expansion of macro ‘USBG_F_NET_INT_TO_ATTR_VAL’
  278 |                                        USBG_F_NET_INT_TO_ATTR_VAL(subclass));
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
../include/usbg/function/net.h: In function ‘int usbg_f_net_set_protocol(usbg_f_net*, unsigned int)’:
../include/usbg/function/net.h:302:67: error: narrowing conversion of ‘protocol’ from ‘unsigned int’ to ‘int’ [-Werror=narrowing]
  302 |                                        USBG_F_NET_INT_TO_ATTR_VAL(protocol));
      |                                                                   ^~~~~~~~
../include/usbg/usbg.h:61:34: note: in definition of macro ‘USBG_TO_UNION’
   61 |         ((union UNAME){ .FIELD = WHAT, })
      |                                  ^~~~
../include/usbg/function/net.h:302:40: note: in expansion of macro ‘USBG_F_NET_INT_TO_ATTR_VAL’
  302 |                                        USBG_F_NET_INT_TO_ATTR_VAL(protocol));
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

In the kernel qmult is also from type unsigned int which alignes with
the rest of this struct and resolves the above compile issue.
2024-09-25 00:34:00 +02:00
Michael Grzeschik
bad649b200 function: ms: fix compile warning for out of bounds in ms.c
FAILED: libusbgx.so.2.0.0.p/src_function_ms.c.o
aarch64-v8a-linux-gnu-gcc -Ilibusbgx.so.2.0.0.p -I. -I../../../../../../../../../../../../r/libusbgx -I../../../../../../../../../../../../r/libusbgx/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O2 -g -D_GNU_SOURCE -fPIC -DHAS_GADGET_SCHEMES -MD -MQ libusbgx.so.2.0.0.p/src_function_ms.c.o -MF libusbgx.so.2.0.0.p/src_function_ms.c.o.d -o libusbgx.so.2.0.0.p/src_function_ms.c.o -c ../../../../../../../../../../../../r/libusbgx/src/function/ms.c
In file included from /opt/OSELAS.Toolchain-2023.07.1/aarch64-v8a-linux-gnu/gcc-13.2.1-clang-16.0.6-glibc-2.37-binutils-2.40-kernel-6.3.6-sanitized/sysroot-aarch64-v8a-linux-gnu/usr/include/string.h:535,
                from ../../../../../../../../../../../../r/libusbgx/include/usbg/usbg_internal.h:17,
		from ../../../../../../../../../../../../r/libusbgx/src/function/ms.c:14:
In function 'memset',
		inlined from 'ms_alloc_inst' at ../../../../../../../../../../../../r/libusbgx/src/function/ms.c:169:2,
		inlined from 'ms_alloc_inst' at ../../../../../../../../../../../../r/libusbgx/src/function/ms.c:154:12:
/opt/OSELAS.Toolchain-2023.07.1/aarch64-v8a-linux-gnu/gcc-13.2.1-clang-16.0.6-glibc-2.37-binutils-2.40-kernel-6.3.6-sanitized/sysroot-aarch64-v8a-linux-gnu/usr/include/bits/string_fortified.h:59:10: error: '__builtin_memset' offset [0, 15] is out of the bounds [0, 0] [-Werror=array-bounds=]
   59 |   return __builtin___memset_chk (__dest, __ch, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-09-25 00:33:57 +02:00
Michael Grzeschik
bf2bc2310c
Merge pull request #97 from mgrzeschik/cleanups
Fixes for some of the compile warnings (-Wall -pedantic).
2024-09-24 23:44:02 +02:00
folkert van heusden
06b1bbdbc5 Fixes for some of the compile warnings (-Wall -pedantic). 2024-09-24 23:35:02 +02:00
Michael Grzeschik
a42d507246
Merge pull request #96 from mgrzeschik/feature/uvc-rates
Feature to set bitrates and framebuffersize from configfs
2024-09-24 23:32:36 +02:00
Michael Grzeschik
c58b2c0f74 uvc: also set dwMinBitRate, dwMaxBitRate and dwDefaultFrameInterval on set_frame 2024-09-24 23:29:46 +02:00
Michael Grzeschik
c375c18fc3 uvc: really use dwMaxVideoFrameBufferSize on uvc_set_frame 2024-09-24 23:29:01 +02:00
Michael Grzeschik
f62ab13295
Merge pull request #73 from liuming50/Add-interface-name-for-NCM-Feature-Descriptors
libusbgx: Add interface name for NCM Feature Descriptors
2024-09-24 22:40:12 +02:00
Michael Grzeschik
ce2f18148b
Merge pull request #94 from mgrzeschik/bugfix/uac2
function: uac2: Align struct members to 4 bytes
2024-09-24 22:35:26 +02:00
Andri Yngvason
c525e3e583 function: uac2: Align struct members to 4 bytes
These are accessed in a way that can otherwise cause values to bleed
between members.

I suspect that this library may be completely broken on big-endian.
2024-09-24 22:32:44 +02:00
Michael Grzeschik
22769abfd3
Merge pull request #93 from mgrzeschik/bugfix/generic
bugfix/generic
2024-09-24 22:27:34 +02:00
Andri Yngvason
b93da70a34 tests: Mark possibly unused functions as such
This fixes compilation warnings
2024-09-24 22:14:19 +02:00
Andri Yngvason
9b83e77ebb usbg_common: Don't write NULL-string 2024-09-24 22:13:55 +02:00
Michael Grzeschik
67e867e626
Merge pull request #91 from mgrzeschik/usb9pfs
function: add support for usb9pfs
2024-09-24 21:42:11 +02:00
Michael Grzeschik
30784e3519 function: add support for usb9pfs 2024-09-24 21:32:50 +02:00
Andri Yngvason
69207305eb examples: Fix always-true condition
The intent here was probably to dereference rather than to take the
address.
2024-09-13 00:49:35 +02:00
Michael Grzeschik
89d3f448b9
Merge pull request #92 from mgrzeschik/bugfix/uvc
bugfix/uvc
2024-09-13 00:33:04 +02:00
Michael Grzeschik
f0d1aa8ec3 uvc: fix nop function for usbg_set_config_node_guid
When usbg_internal_none is used the function define
was missing, fix that.
2024-09-13 00:24:20 +02:00
Michael Grzeschik
a97ec34990
Merge pull request #85 from mgrzeschik/uvc-controls
uvc: add more controls
2024-08-30 09:46:18 +02:00
Michael Grzeschik
3642d9c7a4 uvc: add more controls
When using uncompressed video formats other then the default
YUYV, the user of the uvc gadget needs to set the proper GUID
format. Together with that GUID format it is needed to set
an corresponding BitsPerPixel value. This patch is adding
support to set the values via libusbgx/gadget-tool.
2024-08-29 21:33:08 +02:00
Michael Grzeschik
48b96808ca uvc: fix property interlace flags 2024-08-26 11:03:33 +02:00
Paul Wise
a5bfa81017
Merge pull request #87 from NekoCWD/master
Add inquiry_string to LUN attributes
2024-02-27 12:07:16 +08:00
06c15936c8 Add inquiry_string to LUN attributes
Signed-off-by: NekoCWD <nekodevelopper@gmail.com>
2024-02-23 00:20:50 +03:00
Michael Grzeschik
ec0b01c03f
Merge pull request #83 from mgrzeschik/uac2-controls
uac2: add additional configuration controls
2023-12-11 02:06:56 +01:00
Michael Grzeschik
cbf17506fa uac2: add additional configuration controls
This patch adds the possibility to set additional configuration
parameters in configfs for uac2.

It adds the controls:

{c,p}_volume_present		capture/playback volume control enable
{c,p}_mute_present		capture/playback mute control enable
{c,p}_volume_min		capture/playback volume control min value (in 1/256 dB)
{c,p}_volume_max		capture/playback volume control max value (in 1/256 dB)
{c,p}_volume_res		capture/playback volume control resolution (in 1/256 dB)
{c,p}_hs_bint			capture/playback bInterval for HS/SS (1-4: fixed, 0: auto)
c_sync				capture synchronization type (async/adaptive)
req_number			the number of pre-allocated requests for both capture and playback
fb_max				maximum extra bandwidth in async mode

(from kernel:Documentation/ABI/testing/configfs-usb-gadget-uac2)
2023-11-28 00:33:39 +01:00
Sahaj Sarup
81d7c058ba
load libcomposite kernel module 2023-10-18 17:07:55 +05:30
Jeffrey Chan
caad244370 Fix: Memory leak config label 2023-10-02 10:16:11 +02:00
Manuel Traut
51abbfdf07
Automake: fix distclean of tests
If built with tests disabled make distclean fails.

make distclean considers all DIST_SUBDIRS for cleaning.
Therefore the Makefile in all listed directories need
to be created.

Signed-off-by: Manuel Traut <manut@mecka.net>
2023-08-28 15:27:59 +02:00
Niall Leonard
3cc5af771c
Added printer function header to installed headers
Fixes: commit 97b64779a4
2023-07-29 09:11:21 +08:00
Niall Leonard
adc45af4fb
Added missing extern C closing brace
Fixes: commit 97b64779a4
2023-07-29 09:10:21 +08:00
Sabine-Schnabeltier
721e3a1cbd
correct attribute import / export
The attribute import / export functions for MIDI_DEC_ATTR attributes was using the string get / set functions instead of the integer functions.
2023-02-13 20:14:05 -06:00
Ming Liu
4f3f2ad08e libusbgx: Add interface name for NCM Feature Descriptors
In commit: abf422bffc
[
Author: Stefan Agner <stefan.agner@toradex.com>
Date:   Tue Jan 24 14:22:25 2017 -0800

    libusbgx: Add interface name for Feature Descriptors

    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).
]

it only added Feature Descriptors for RNDIS, NCM also needs that, or
else it could not be recognized by Windows systems.

Add Feature Descriptors interface name for NCM.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
2022-12-11 16:06:08 +01:00
Paul Wise
bbdaad24fc
Document the license of the library and examples
Fixes: https://github.com/linux-usb-gadgets/libusbgx/issues/70
2022-12-07 09:09:27 +08:00
Paul Wise
36e71e1e1e
Rename the net class variables to class_
Using C++ keywords like "class" as variable names causes
build failures when libusbgx is used in C++ projects.

Reported-by: Thomas Moeller (@moether)
Reported-in: https://github.com/linux-usb-gadgets/libusbgx/issues/65#issuecomment-1296790932
Fixes: commit 4ca4a7699b
Fixes: commit efdd7a657c
2022-11-01 10:47:52 +08:00
Fernando Ginez
efdd7a657c tests: update test code with new net attributes
Added the new attributes: class, subclass and protocol to all test
routines involving this function attributes.
2022-09-12 16:26:08 -03:00
Fernando Ginez
4ca4a7699b net: adds class, subclass and protocol attributes
This commit allows the library user to change class, subclass and
protocol values inside net derivated functions. This is needed by
Windows 10 users using RNDIS function with the native driver.
2022-09-12 16:24:02 -03:00
Michael Grzeschik
b1c8586648
Merge pull request #64 from mgrzeschik/master
improve uvc with import/export of config parameters
2022-09-08 20:20:06 +02:00
Michael Grzeschik
8b91dbb3da uvc: add isoc parameter settings
The functions config parameters like maxburst, maxpacket, interval
and function_name are possible to be set by scheme file
as well. This patch adds support to import and export
these variables.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
2022-07-11 10:11:15 +02:00
Michael Grzeschik
50fe6a79bc uvc: fix init_formats function
The return value of scandir is used in init_frames to iterate over
the elements. The iteration is done over nmb not ret. So this patch
is fixing this to fill the right variable.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
2022-07-11 10:10:55 +02:00
Michael Grzeschik
afec0d6e71 uvc: fix exporting attrs with layouts missing a format
When the one of the supported formats is missing in the
configfs layout, currently the export function will run
into an error. We fix it by just passing 0 if the format
is missing to keep on parsing.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
2022-07-06 00:37:02 +02:00
Michael Grzeschik
0607844246
Merge pull request #63 from mgrzeschik/uvc-fix
uvc: fix unsigned nmb to int
2021-10-31 18:36:27 +01:00
Michael Grzeschik
20d7fe2bb9 uvc: fix unsigned nmb to int
Since snprintf returns int not unsigned we change the type of nmb.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
2021-10-28 11:19:26 +02:00
Michael Grzeschik
ed1fb6d12c
Merge pull request #62 from linux-usb-gadgets/uvc-fix
uvc: fix return check on scandir
2021-10-28 10:25:34 +02:00
Michael Grzeschik
157cbd83c6 uvc: fix return check on scandir
The function init_frames is falsely checking for the negative
result from scandir on an unsigned variable. This will never
be true.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
2021-10-28 00:39:50 +02:00
Michael Grzeschik
741230bc4b
Merge pull request #61 from linux-usb-gadgets/uvc-libconfig-import-export-support
Uvc libconfig import export support
2021-10-26 14:09:50 +02:00