mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-04 23:23:43 +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:
parent
6fc212848a
commit
3deac4165e
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user