Commit Graph

8 Commits

Author SHA1 Message Date
Harald Welte 3edd70c1f1 usb: Add osmo_libusb_find_open_claim() all-in-one API
This function offers the highest level of API among all libosmousb
helper functions. It is intended as a one-stop shop for everything
related to grabbing an interface.

Change-Id: I748ded6cc7b73a73625588bd7a34a017a905b6bf
2020-05-12 05:43:21 +00:00
Vadim Yanitskiy 775a6b0ddd osmo_libusb: check return value of osmo_fd_register()
Most likely, we should not assert() here, but let's at least log
an error message in case if osmo_fd_register() fails.

Change-Id: Ia20755ec12ee9fb0eba8322551642a96e68e1570
Related: CID#206572
2020-02-09 04:27:50 +07:00
Vadim Yanitskiy 685f7c375f usb/Makefile.am: fix copy-pasted library name: s/libosmosim/libosmousb/
src/usb/Makefile.am:16: warning: variable 'libosmosim_la_LIBADD' is defined but no program or
src/usb/Makefile.am:16: library has 'libosmosim_la' as canonical name (possible typo)
src/usb/Makefile.am:15: warning: variable 'libosmosim_la_LDFLAGS' is defined but no program or
src/usb/Makefile.am:15: library has 'libosmosim_la' as canonical name (possible typo)

Change-Id: I062ea640a75f4521818ba71d5ffea2d08bf3052a
2020-01-21 18:27:01 +07:00
Harald Welte e51cbe4cc7 osmo_libusb: Check return of libusb_get_string_descriptor_ascii()
Change-Id: Ifc0133737627a8277635f8f3662b3f6e922be149
Closes: CID#207713
2020-01-18 21:50:47 +01:00
Harald Welte c45787bf5c usb: Add osmo_libusb_find_matching_dev_{path,serial}
Thise two helper functions allow the user application to find
a unique match among the existing USB devices, using either a user-
provided iSerial string, or a user-provided physical USB path.

Change-Id: I8ff3fb3e1a77e10cb313473480ce5e7673749a93
2020-01-12 11:52:09 +01:00
Harald Welte 424eac8b6a usb: Use OSMO_STRLCPY where appropriate
Change-Id: I6b2a90fd8f4b042a1e38dbf8e99414a94a290375
2020-01-06 18:12:14 +01:00
Harald Welte d462e3fa7b usb: Import a variety of libusb utility functions from simtrace
Those functions were originally developed as part of simtrace; let's
import them to libosmousb as they are truly generic.

Change-Id: I2c18b938e4e1ea5b8a521a386f00db3a7389e47a
Related: OS#4299
2019-12-16 00:17:27 +01:00
Harald Welte da432cdc35 libosmocore libusb integration
Osmocom applications typically use libosmocore select.[ch] event loop
code as their main event dispatch mechanism.  When they want to deal
with libusb in a non-blocking/asynchronous way, they need to integrate
libusb into that select().

The new libosmousb is doing exactly that: Providing a shared utility
library for Osmocom programs that wish to use libusb.  This is useful
for example in simtrace2 host utilitie as well as osmo-e1d.

Change-Id: I656a1a38cbb5b1f3a9145d2869d3b4d0adefcae3
Closes: OS#4299
2019-12-16 00:17:27 +01:00