Update for libusb-0.9.1
This commit is contained in:
parent
e1691a29dd
commit
59c62c7d74
4 changed files with 13 additions and 11 deletions
|
@ -18,7 +18,7 @@ AC_SUBST(lt_major)
|
||||||
AC_SUBST(lt_revision)
|
AC_SUBST(lt_revision)
|
||||||
AC_SUBST(lt_age)
|
AC_SUBST(lt_age)
|
||||||
|
|
||||||
PKG_CHECK_MODULES(LIBUSB, [libusb-1.0 = 0.9.0])
|
PKG_CHECK_MODULES(LIBUSB, [libusb-1.0 >= 0.9.1])
|
||||||
AC_SUBST(LIBUSB_CFLAGS)
|
AC_SUBST(LIBUSB_CFLAGS)
|
||||||
AC_SUBST(LIBUSB_LIBS)
|
AC_SUBST(LIBUSB_LIBS)
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "fp_internal.h"
|
#include "fp_internal.h"
|
||||||
|
|
||||||
|
libusb_context *fpi_usb_ctx = NULL;
|
||||||
GSList *opened_devices = NULL;
|
GSList *opened_devices = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,7 +427,7 @@ API_EXPORTED struct fp_dscv_dev **fp_discover_devs(void)
|
||||||
if (registered_drivers == NULL)
|
if (registered_drivers == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
r = libusb_get_device_list(&devs);
|
r = libusb_get_device_list(fpi_usb_ctx, &devs);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
fp_err("couldn't enumerate USB devices, error %d", r);
|
fp_err("couldn't enumerate USB devices, error %d", r);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -786,7 +787,7 @@ API_EXPORTED int fp_init(void)
|
||||||
int r;
|
int r;
|
||||||
fp_dbg("");
|
fp_dbg("");
|
||||||
|
|
||||||
r = libusb_init();
|
r = libusb_init(&fpi_usb_ctx);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -822,6 +823,6 @@ API_EXPORTED void fp_exit(void)
|
||||||
fpi_poll_exit();
|
fpi_poll_exit();
|
||||||
g_slist_free(registered_drivers);
|
g_slist_free(registered_drivers);
|
||||||
registered_drivers = NULL;
|
registered_drivers = NULL;
|
||||||
libusb_exit();
|
libusb_exit(fpi_usb_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,6 +242,7 @@ extern struct fp_img_driver aes4000_driver;
|
||||||
extern struct fp_img_driver fdu2000_driver;
|
extern struct fp_img_driver fdu2000_driver;
|
||||||
extern struct fp_img_driver vcom5s_driver;
|
extern struct fp_img_driver vcom5s_driver;
|
||||||
|
|
||||||
|
extern libusb_context *fpi_usb_ctx;
|
||||||
extern GSList *opened_devices;
|
extern GSList *opened_devices;
|
||||||
|
|
||||||
void fpi_img_driver_setup(struct fp_img_driver *idriver);
|
void fpi_img_driver_setup(struct fp_img_driver *idriver);
|
||||||
|
|
|
@ -228,7 +228,7 @@ API_EXPORTED int fp_handle_events_timeout(struct timeval *timeout)
|
||||||
select_timeout = *timeout;
|
select_timeout = *timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = libusb_handle_events_timeout(&select_timeout);
|
r = libusb_handle_events_timeout(fpi_usb_ctx, &select_timeout);
|
||||||
*timeout = select_timeout;
|
*timeout = select_timeout;
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -263,7 +263,7 @@ API_EXPORTED int fp_get_next_timeout(struct timeval *tv)
|
||||||
int r_libusb;
|
int r_libusb;
|
||||||
|
|
||||||
r_fprint = get_next_timeout_expiry(&fprint_timeout, NULL);
|
r_fprint = get_next_timeout_expiry(&fprint_timeout, NULL);
|
||||||
r_libusb = libusb_get_next_timeout(&libusb_timeout);
|
r_libusb = libusb_get_next_timeout(fpi_usb_ctx, &libusb_timeout);
|
||||||
|
|
||||||
/* if we have no pending timeouts and the same is true for libusb,
|
/* if we have no pending timeouts and the same is true for libusb,
|
||||||
* indicate that we have no pending timouts */
|
* indicate that we have no pending timouts */
|
||||||
|
@ -297,7 +297,7 @@ API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds)
|
||||||
size_t cnt = 0;
|
size_t cnt = 0;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
usbfds = libusb_get_pollfds();
|
usbfds = libusb_get_pollfds(fpi_usb_ctx);
|
||||||
if (!usbfds) {
|
if (!usbfds) {
|
||||||
*pollfds = NULL;
|
*pollfds = NULL;
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -325,13 +325,13 @@ API_EXPORTED void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb,
|
||||||
fd_removed_cb = removed_cb;
|
fd_removed_cb = removed_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_pollfd(int fd, short events)
|
static void add_pollfd(int fd, short events, void *user_data)
|
||||||
{
|
{
|
||||||
if (fd_added_cb)
|
if (fd_added_cb)
|
||||||
fd_added_cb(fd, events);
|
fd_added_cb(fd, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_pollfd(int fd)
|
static void remove_pollfd(int fd, void *user_data)
|
||||||
{
|
{
|
||||||
if (fd_removed_cb)
|
if (fd_removed_cb)
|
||||||
fd_removed_cb(fd);
|
fd_removed_cb(fd);
|
||||||
|
@ -339,7 +339,7 @@ static void remove_pollfd(int fd)
|
||||||
|
|
||||||
void fpi_poll_init(void)
|
void fpi_poll_init(void)
|
||||||
{
|
{
|
||||||
libusb_set_pollfd_notifiers(add_pollfd, remove_pollfd);
|
libusb_set_pollfd_notifiers(fpi_usb_ctx, add_pollfd, remove_pollfd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpi_poll_exit(void)
|
void fpi_poll_exit(void)
|
||||||
|
@ -348,6 +348,6 @@ void fpi_poll_exit(void)
|
||||||
active_timers = NULL;
|
active_timers = NULL;
|
||||||
fd_added_cb = NULL;
|
fd_added_cb = NULL;
|
||||||
fd_removed_cb = NULL;
|
fd_removed_cb = NULL;
|
||||||
libusb_set_pollfd_notifiers(NULL, NULL);
|
libusb_set_pollfd_notifiers(fpi_usb_ctx, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue