1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-22 23:22:25 +02:00

libatrf: new function usb_rescan to force next open_usb to scan tree again

- tools/include/usbopen.h (usb_rescan), tools/lib/usbopen.c (initialized,
  initialize, usb_rescan): usb_rescan forces a re-initialization of
  libusb and a new scan of the USB device tree
This commit is contained in:
Werner Almesberger 2011-05-11 03:22:53 -03:00
parent 6fc212848a
commit 3deac4165e
2 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,7 @@
usb_dev_handle *open_usb(uint16_t default_vendor, uint16_t default_product);
void usb_rescan(void);
void parse_usb_id(const char *id);
void restrict_usb_path(const char *path);
void usb_unrestrict(void);

View File

@ -29,11 +29,11 @@
static uint16_t vendor = 0;
static uint16_t product = 0;
static const struct usb_device *restricted_path = NULL;
static int initialized = 0;
static void initialize(void)
{
static int initialized = 0;
if (initialized)
return;
@ -45,6 +45,12 @@ static void initialize(void)
}
void usb_rescan(void)
{
initialized = 0;
}
usb_dev_handle *open_usb(uint16_t default_vendor, uint16_t default_product)
{
const struct usb_bus *bus;