Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
0001-merge-to-https-github.com-linux-usb-gadgets-libusbgx.patch 390 KiB
Newer Older
Robert Nelson's avatar
Robert Nelson committed
From 856e2ae32fe39ba8116cc3870068b383199c2c73 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Wed, 17 Apr 2024 13:27:55 -0500
Subject: [PATCH] merge: to
 https://github.com/linux-usb-gadgets/libusbgx/commit/a5bfa81017a9b2064bc449cf74f5f9d106445f62

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 .gitignore                             |   16 +-
 DoxygenLayout.xml                      |    1 -
 LibUsbgxConfig.cmake.in                |   24 +
 Makefile.am                            |    4 +-
 README                                 |    5 +
 configure.ac                           |    9 +-
 examples/Makefile.am                   |    6 +-
 examples/gadget-acm-ecm.c              |    1 +
 examples/gadget-import.c               |    1 +
 examples/gadget-ms.c                   |    3 +
 examples/gadget-printer.c              |  117 +
 examples/gadget-uvc.c                  |  182 +
 examples/gadget-vid-pid-remove.c       |   24 +-
 examples/show-gadgets.c                |    2 +
 examples/show-udcs.c                   |    1 +
 include/usbg/function/ms.h             |   36 +
 include/usbg/function/net.h            |   91 +-
 include/usbg/function/printer.h        |   56 +
 include/usbg/function/uac2.h           |   57 +
 include/usbg/function/uvc.h            |  156 +
 include/usbg/usbg.h                    |    2 +
 include/usbg/usbg_internal_libconfig.h |    1 +
 libusbgx.pc.in                         |    2 +-
 m4/.gitignore                          |    2 +
 m4/libtool.m4                          | 8001 ------------------------
 m4/ltoptions.m4                        |  384 --
 m4/ltsugar.m4                          |  123 -
 m4/ltversion.m4                        |   23 -
 m4/lt~obsolete.m4                      |   98 -
 packaging/libusbgx.spec                |    1 +
 src/Makefile.am                        |    4 +-
 src/function/ether.c                   |    3 +
 src/function/hid.c                     |    4 +-
 src/function/midi.c                    |    4 +-
 src/function/ms.c                      |    1 +
 src/function/printer.c                 |   34 +
 src/function/uac2.c                    |   36 +
 src/function/uvc.c                     | 1219 ++++
 src/usbg.c                             |    7 +-
 src/usbg_common.c                      |    2 +
 tests/usbg-test.c                      |   27 +
 41 files changed, 2112 insertions(+), 8658 deletions(-)
 create mode 100644 LibUsbgxConfig.cmake.in
 create mode 100644 examples/gadget-printer.c
 create mode 100644 examples/gadget-uvc.c
 create mode 100644 include/usbg/function/printer.h
 create mode 100644 include/usbg/function/uvc.h
 create mode 100644 m4/.gitignore
 delete mode 100644 m4/libtool.m4
 delete mode 100644 m4/ltoptions.m4
 delete mode 100644 m4/ltsugar.m4
 delete mode 100644 m4/ltversion.m4
 delete mode 100644 m4/lt~obsolete.m4
 create mode 100644 src/function/printer.c
 create mode 100644 src/function/uvc.c

diff --git a/.gitignore b/.gitignore
index 7dfeaed..671c0a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,15 @@
 /examples/*
 !/examples/*.*
-/examples/.deps
-/examples/.libs
-/src/.deps
-/src/.libs
+/examples/.deps/
+/examples/.libs/
+/include/usbg/usbg_version.h
+/src/.deps/
+/src/.libs/
+/src/function/.deps/
+/src/function/.dirstamp
 /tests/*
 !/tests/*.*
-/tests/.deps
+/tests/.deps/
 *.o
 *.lo
 *.la
@@ -26,4 +29,5 @@ Makefile.in
 /missing
 /install-sh
 /doxygen.cfg
-/libusbg.pc
+/libusbgx.pc
+/LibUsbgxConfig.cmake
diff --git a/DoxygenLayout.xml b/DoxygenLayout.xml
index 5b60278..92949fd 100644
--- a/DoxygenLayout.xml
+++ b/DoxygenLayout.xml
@@ -18,7 +18,6 @@
       <tab type="filelist" visible="yes" title="" intro=""/>
       <tab type="globals" visible="yes" title="" intro=""/>
     </tab>
-    <tab type="dirs" visible="yes" title="" intro=""/>
     <tab type="examples" visible="yes" title="" intro=""/>  
   </navindex>
 
diff --git a/LibUsbgxConfig.cmake.in b/LibUsbgxConfig.cmake.in
new file mode 100644
index 0000000..bbef363
--- /dev/null
+++ b/LibUsbgxConfig.cmake.in
@@ -0,0 +1,24 @@
+get_filename_component(LibUsbgx_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+include(CMakeFindDependencyMacro)
+
+# Compute the installation prefix relative to this file.
+get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+if(_IMPORT_PREFIX STREQUAL "/")
+  set(_IMPORT_PREFIX "")
+endif()
+
+set(LibUsbgx_INCLUDE_DIRS "${_IMPORT_PREFIX}/include")
+
+if(NOT TARGET LibUsbgx::LibUsbgx)
+	add_library(LibUsbgx::LibUsbgx SHARED IMPORTED)
+	set_property(TARGET LibUsbgx::LibUsbgx APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+
+	set_target_properties(LibUsbgx::LibUsbgx PROPERTIES 
+		IMPORTED_LOCATION "${_IMPORT_PREFIX}/lib/libusbgx.so"
+		INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include")
+endif()
+
+set(LibUsbgx_LIBRARIES LibUsbgx::LibUsbgx)
diff --git a/Makefile.am b/Makefile.am
index a3cc337..c12628b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,6 +14,8 @@ EXTRA_DIST = doxygen.cfg
 library_includedir=$(includedir)/usbg
 library_include_HEADERS = include/usbg/usbg.h include/usbg/usbg_version.h
 function_includedir=$(includedir)/usbg/function
-function_include_HEADERS = include/usbg/function/ffs.h include/usbg/function/loopback.h include/usbg/function/midi.h include/usbg/function/ms.h include/usbg/function/net.h include/usbg/function/phonet.h include/usbg/function/serial.h include/usbg/function/hid.h include/usbg/function/uac2.h
+function_include_HEADERS = include/usbg/function/ffs.h include/usbg/function/loopback.h include/usbg/function/midi.h include/usbg/function/ms.h include/usbg/function/net.h include/usbg/function/phonet.h include/usbg/function/serial.h include/usbg/function/hid.h include/usbg/function/uac2.h include/usbg/function/uvc.h include/usbg/function/printer.h
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libusbgx.pc
+cmakeconfigdir = $(libdir)/cmake/LibUsbgx
+cmakeconfig_DATA = LibUsbgxConfig.cmake
diff --git a/README b/README
index 08622a3..8f84e3e 100644
--- a/README
+++ b/README
@@ -12,8 +12,13 @@ See the Doxygen docs and examples for complete details on the
 programming API and INSTALL for installation of the library and
 examples.
 
+The library is licensed under the GNU LGPL-2.1 (or later) and
+the examples are licensed under the GNU GPL-2.0 (or later).
+
 To run the examples:
 
+$ modprobe configfs
+$ modprobe libcomposite
 $ mount -t configfs none /sys/kernel/config
 $ gadget-acm-ecm
 $ show-gadgets
diff --git a/configure.ac b/configure.ac
index 5a59b2b..3995556 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,18 +36,23 @@ AS_IF([test "x$with_libconfig" = xyes], [
 			    AC_DEFINE(HAVE_LIBCONFIG_15, 1, [detected libconfig equal to or greater than 1.5]),
 			    AC_DEFINE(HAVE_LIBCONFIG_15, 0, []))
 			  ])
+	libconfig_req="libconfig"
 	CFLAGS="$CFLAGS $LIBCONFIG_CFLAGS"
 	LIBS="$LIBS $LIBCONFIG_LIBS"
 ], [
+	libconfig_req=""
 	enable_gadget_schemes=no
 ])
 
+REQUIRES="$libconfig_req"
+
+AC_SUBST([REQUIRES])
+
 AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes])
 
 AS_IF([test "x$enable_tests" = xyes], [
 	PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0],
 			  AC_DEFINE(HAS_CMOCKA, 1, [detected cmocka]))
-	AC_CONFIG_FILES([tests/Makefile])
 ])
 AM_CONDITIONAL(BUILD_TESTS, [test "x$enable_tests" = xyes])
 
@@ -56,6 +61,6 @@ AS_IF([test "x$enable_gadget_schemes" = xyes],
Loading full blame...