Change in osmo-e1d[master]: port to new libosmousb

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

tnt gerrit-no-reply at lists.osmocom.org
Sat May 9 10:02:44 UTC 2020


tnt has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/16645 )

Change subject: port to new libosmousb
......................................................................

port to new libosmousb

libosmousb, recently introduced to libosmocore.git, is taking care
of main loop integration of libusb into osmo_select_main().  This
means we don't need to do any polling here anymore.

Change-Id: I3f3b61dfa217d6ef8c17970b2cf1cc627bb13bbe
---
M configure.ac
M src/Makefile.am
M src/osmo-e1d.c
M src/usb.c
4 files changed, 6 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  tnt: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/configure.ac b/configure.ac
index 91d34e8..c0508eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,7 @@
 PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
 
 PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.1.120)
+PKG_CHECK_MODULES(LIBOSMOUSB, libosmousb)
 PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.21)
 
 AC_CONFIG_MACRO_DIR([m4])
diff --git a/src/Makefile.am b/src/Makefile.am
index fd9ec35..2890554 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,7 @@
 LIBVERSION=0:0:0
 
 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
-AM_CFLAGS=-Wall -Wno-unused-result $(LIBOSMOCORE_CFLAGS) $(LIBUSB_CFLAGS)
+AM_CFLAGS=-Wall -Wno-unused-result $(LIBOSMOCORE_CFLAGS) $(LIBOSMOUSB_LIBS) $(LIBUSB_CFLAGS)
 
 lib_LTLIBRARIES = libosmo-e1d.la
 
@@ -35,4 +35,4 @@
 	usb.c \
 	$(NULL)
 
-osmo_e1d_LDADD = $(LIBOSMOCORE_LIBS) $(LIBUSB_LIBS) libosmo-e1d.la
+osmo_e1d_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOUSB_LIBS) $(LIBUSB_LIBS) libosmo-e1d.la
diff --git a/src/osmo-e1d.c b/src/osmo-e1d.c
index fa3fc6c..92d98d3 100644
--- a/src/osmo-e1d.c
+++ b/src/osmo-e1d.c
@@ -42,7 +42,6 @@
 
 extern struct osmo_e1dp_server_handler e1d_ctl_handlers[];
 extern int e1_usb_probe(struct e1_daemon *e1d);
-extern int e1_usb_poll(void);
 
 
 
@@ -122,8 +121,7 @@
 
 	/* main loop */
 	while (!g_shutdown) {
-		osmo_select_main(1);
-		e1_usb_poll();
+		osmo_select_main(0);
 	}
 
 	/* cleanup */
diff --git a/src/usb.c b/src/usb.c
index 18e3053..19855f8 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -30,6 +30,7 @@
 
 #include <osmocom/core/isdnhdlc.h>
 #include <osmocom/core/utils.h>
+#include <osmocom/usb/libusb.h>
 
 #include <libusb.h>
 
@@ -572,7 +573,7 @@
 	int i, ret;
 
 	if (!g_usb) {
-		ret = libusb_init(&g_usb);
+		ret = osmo_libusb_init(&g_usb);
 		if (ret) {
 			LOGP(DE1D, LOGL_ERROR, "Failed to initialize libusb\n");
 			return -EIO;
@@ -602,15 +603,3 @@
 
 	return 0;
 }
-
-int
-e1_usb_poll(void)
-{
-	int rv;
-
-	rv = libusb_handle_events(g_usb);
-	if (rv != LIBUSB_SUCCESS)
-		return -EIO;
-
-	return 0;
-}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/16645
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I3f3b61dfa217d6ef8c17970b2cf1cc627bb13bbe
Gerrit-Change-Number: 16645
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Assignee: tnt <tnt at 246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200509/7af135dd/attachment.htm>


More information about the gerrit-log mailing list