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

2020-05-09 Thread tnt
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 
 #include 
+#include 

 #include 

@@ -572,7 +573,7 @@
int i, ret;

if (!g_usb) {
-   ret = libusb_init(_usb);
+   ret = osmo_libusb_init(_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 
Gerrit-Assignee: tnt 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Reviewer: tnt 
Gerrit-MessageType: merged


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

2020-05-09 Thread tnt
tnt has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/16645 )

Change subject: port to new libosmousb
..


Patch Set 4: Code-Review+1

Works fine


--
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 
Gerrit-Assignee: tnt 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Reviewer: tnt 
Gerrit-Comment-Date: Sat, 09 May 2020 10:02:40 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2020-05-09 Thread tnt
tnt has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/16645 )

Change subject: port to new libosmousb
..


Patch Set 4:

Looks good, I'll actually make sure it works this morning.


--
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 
Gerrit-Assignee: tnt 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Reviewer: tnt 
Gerrit-Comment-Date: Sat, 09 May 2020 08:44:33 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


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

2020-05-09 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/16645 )

Change subject: port to new libosmousb
..


Patch Set 4:

This change is ready for review.


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Sat, 09 May 2020 07:53:28 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


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

2019-12-17 Thread laforge
laforge has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/45/16645/1

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 
 #include 
+#include 

 #include 

@@ -572,7 +573,7 @@
int i, ret;

if (!g_usb) {
-   ret = libusb_init(_usb);
+   ret = osmo_libusb_init(_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: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange