migrate to libosmousb

the code we used to have in libusb_util.c has been migrated to
libosmousb, a new part of libosmocore.git.  Let's remove our historic
copy and use the new shared library instead.

Change-Id: Ib588c08f873c4da8f3a02815ee2767674a6a5061
This commit is contained in:
Harald Welte
2019-12-15 20:17:44 +01:00
parent 8591495d74
commit 7f7de1ec1d
10 changed files with 17 additions and 429 deletions

View File

@@ -1,9 +1,9 @@
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSIM_CFLAGS) $(LIBUSB_CFLAGS) $(COVERAGE_FLAGS)
AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSIM_CFLAGS) $(LIBOSMOUSB_CFLAGS) $(LIBUSB_CFLAGS) $(COVERAGE_FLAGS)
AM_LDFLAGS=$(COVERAGE_LDFLAGS)
LDADD= $(top_builddir)/lib/libosmo-simtrace2.la \
$(LIBOSMOCORE_LIBS) $(LIBOSMOSIM_LIBS) $(LIBUSB_LIBS)
$(LIBOSMOCORE_LIBS) $(LIBOSMOSIM_LIBS) $(LIBOSMOUSB_LIBS) $(LIBUSB_LIBS)
bin_PROGRAMS = simtrace2-remsim simtrace2-remsim-usb2udp simtrace2-list simtrace2-sniff

View File

@@ -38,7 +38,7 @@
#include <libusb.h>
#include <osmocom/simtrace2/libusb_util.h>
#include <osmocom/usb/libusb.h>
#include <osmocom/simtrace2/simtrace2_api.h>
#include <osmocom/simtrace2/simtrace_prot.h>
#include <osmocom/simtrace2/apdu_dispatch.h>
@@ -404,7 +404,7 @@ int main(int argc, char **argv)
ifm->addr = addr;
if (path)
osmo_strlcpy(ifm->path, path, sizeof(ifm->path));
transp->usb_devh = usb_open_claim_interface(NULL, ifm);
transp->usb_devh = osmo_libusb_open_claim_interface(NULL, NULL, ifm);
if (!transp->usb_devh) {
fprintf(stderr, "can't open USB device\n");
goto close_exit;
@@ -416,7 +416,7 @@ int main(int argc, char **argv)
goto close_exit;
}
rc = get_usb_ep_addrs(transp->usb_devh, if_num, &transp->usb_ep.out,
rc = osmo_libusb_get_ep_addrs(transp->usb_devh, if_num, &transp->usb_ep.out,
&transp->usb_ep.in, &transp->usb_ep.irq_in);
if (rc < 0) {
fprintf(stderr, "can't obtain EP addrs; rc=%d\n", rc);

View File

@@ -37,7 +37,7 @@
#include <libusb.h>
#include <osmocom/simtrace2/libusb_util.h>
#include <osmocom/usb/libusb.h>
#include <osmocom/simtrace2/simtrace_usb.h>
#include <osmocom/simtrace2/simtrace_prot.h>
@@ -384,7 +384,7 @@ int main(int argc, char **argv)
goto do_exit;
}
struct usb_interface_match ifm_scan[16];
int num_interfaces = usb_match_interfaces(NULL, compatible_dev_ids,
int num_interfaces = osmo_libusb_find_matching_interfaces(NULL, compatible_dev_ids,
USB_CLASS_PROPRIETARY, SIMTRACE_SNIFFER_USB_SUBCLASS, -1, ifm_scan, ARRAY_SIZE(ifm_scan));
if (num_interfaces <= 0) {
perror("No compatible USB devices found");
@@ -473,7 +473,7 @@ int main(int argc, char **argv)
signal(SIGINT, &signal_handler);
do {
_transp.usb_devh = usb_open_claim_interface(NULL, &ifm_selected);
_transp.usb_devh = osmo_libusb_open_claim_interface(NULL, NULL, &ifm_selected);
if (!_transp.usb_devh) {
fprintf(stderr, "can't open USB device\n");
goto close_exit;
@@ -485,8 +485,8 @@ int main(int argc, char **argv)
goto close_exit;
}
rc = get_usb_ep_addrs(_transp.usb_devh, ifm_selected.interface, &_transp.usb_ep.out,
&_transp.usb_ep.in, &_transp.usb_ep.irq_in);
rc = osmo_libusb_get_ep_addrs(_transp.usb_devh, ifm_selected.interface, &_transp.usb_ep.out,
&_transp.usb_ep.in, &_transp.usb_ep.irq_in);
if (rc < 0) {
fprintf(stderr, "can't obtain EP addrs; rc=%d\n", rc);
goto close_exit;

View File

@@ -23,7 +23,7 @@
#include <osmocom/core/utils.h>
#include <osmocom/simtrace2/libusb_util.h>
#include <osmocom/usb/libusb.h>
#include <osmocom/simtrace2/simtrace_usb.h>
static const struct dev_id compatible_dev_ids[] = {
@@ -38,9 +38,9 @@ static int find_devices(void)
struct usb_interface_match ifm[16];
int rc, i, num_interfaces;
/* scan for USB devices matching SIMtrace USB ID with proprietary class */
rc = usb_match_interfaces(NULL, compatible_dev_ids,
USB_CLASS_PROPRIETARY, -1, -1, ifm, ARRAY_SIZE(ifm));
/* scan for USB devices matching SIMtrace USB ID with proprietary class */
rc = osmo_libusb_find_matching_interfaces(NULL, compatible_dev_ids,
USB_CLASS_PROPRIETARY, -1, -1, ifm, ARRAY_SIZE(ifm));
printf("USB matches: %d\n", rc);
if (rc < 0)
return rc;

View File

@@ -35,9 +35,9 @@
#include <libusb.h>
#include <osmocom/usb/libusb.h>
#include <osmocom/simtrace2/simtrace_usb.h>
#include <osmocom/simtrace2/simtrace_prot.h>
#include <osmocom/simtrace2/libusb_util.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/socket.h>
@@ -259,7 +259,7 @@ int main(int argc, char **argv)
g_udp_ofd.cb = ofd_udp_cb;
osmo_sock_init_ofd(&g_udp_ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, local_udp_port + if_num, OSMO_SOCK_F_BIND);
rc = get_usb_ep_addrs(g_devh, if_num, &g_buf_out.ep, &g_buf_in.ep, NULL);
rc = osmo_libusb_get_ep_addrs(g_devh, if_num, &g_buf_out.ep, &g_buf_in.ep, NULL);
if (rc < 0) {
fprintf(stderr, "couldn't find enpdoint addresses; rc=%d\n", rc);
goto close_exit;