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
This commit is contained in:
parent
d4e9f2ef93
commit
8db1624323
|
@ -33,6 +33,7 @@ PKG_PROG_PKG_CONFIG([0.20])
|
||||||
PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
|
PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
|
||||||
|
|
||||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.1.120)
|
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.1.120)
|
||||||
|
PKG_CHECK_MODULES(LIBOSMOUSB, libosmousb)
|
||||||
PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.21)
|
PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.21)
|
||||||
|
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
LIBVERSION=0:0:0
|
LIBVERSION=0:0:0
|
||||||
|
|
||||||
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
|
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
|
lib_LTLIBRARIES = libosmo-e1d.la
|
||||||
|
|
||||||
|
@ -35,4 +35,4 @@ osmo_e1d_SOURCES = \
|
||||||
usb.c \
|
usb.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
osmo_e1d_LDADD = $(LIBOSMOCORE_LIBS) $(LIBUSB_LIBS) libosmo-e1d.la
|
osmo_e1d_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOUSB_LIBS) $(LIBUSB_LIBS) libosmo-e1d.la
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
extern struct osmo_e1dp_server_handler e1d_ctl_handlers[];
|
extern struct osmo_e1dp_server_handler e1d_ctl_handlers[];
|
||||||
extern int e1_usb_probe(struct e1_daemon *e1d);
|
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 */
|
/* main loop */
|
||||||
while (!g_shutdown) {
|
while (!g_shutdown) {
|
||||||
osmo_select_main(1);
|
osmo_select_main(0);
|
||||||
e1_usb_poll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
|
15
src/usb.c
15
src/usb.c
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include <osmocom/core/isdnhdlc.h>
|
#include <osmocom/core/isdnhdlc.h>
|
||||||
#include <osmocom/core/utils.h>
|
#include <osmocom/core/utils.h>
|
||||||
|
#include <osmocom/usb/libusb.h>
|
||||||
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
|
||||||
|
@ -572,7 +573,7 @@ e1_usb_probe(struct e1_daemon *e1d)
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!g_usb) {
|
if (!g_usb) {
|
||||||
ret = libusb_init(&g_usb);
|
ret = osmo_libusb_init(&g_usb);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOGP(DE1D, LOGL_ERROR, "Failed to initialize libusb\n");
|
LOGP(DE1D, LOGL_ERROR, "Failed to initialize libusb\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -602,15 +603,3 @@ e1_usb_probe(struct e1_daemon *e1d)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
e1_usb_poll(void)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
rv = libusb_handle_events(g_usb);
|
|
||||||
if (rv != LIBUSB_SUCCESS)
|
|
||||||
return -EIO;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue