aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-12-17 15:18:34 +0100
committerHarald Welte <laforge@osmocom.org>2020-01-06 17:37:07 +0100
commit8db16243235a29fccbac9692bc770f6872d394f3 (patch)
treea1f9ab8391500774ff1a6fdc68f0a65a92a7a6f8
parentd4e9f2ef938b40f067cac9c1ae3b82d422c9266a (diff)
port to new libosmousblaforge/e1-prbs-test
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
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am4
-rw-r--r--src/osmo-e1d.c4
-rw-r--r--src/usb.c15
4 files changed, 6 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index 91d34e8..c0508eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,7 @@ PKG_PROG_PKG_CONFIG([0.20])
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 @@ osmo_e1d_SOURCES = \
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 @@ int main(int argc, char *argv[])
/* 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 @@ e1_usb_probe(struct e1_daemon *e1d)
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 @@ e1_usb_probe(struct e1_daemon *e1d)
return 0;
}
-
-int
-e1_usb_poll(void)
-{
- int rv;
-
- rv = libusb_handle_events(g_usb);
- if (rv != LIBUSB_SUCCESS)
- return -EIO;
-
- return 0;
-}