Date:2011-05-11 08:22:53 (8 years 4 months ago)
Author:Werner Almesberger
Commit:3deac4165ecb6173799893ee259bffff78bd274a
Message: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
Files: tools/include/usbopen.h (1 diff)
tools/lib/usbopen.c (2 diffs)

Change Details

tools/include/usbopen.h
1919
2020
2121usb_dev_handle *open_usb(uint16_t default_vendor, uint16_t default_product);
22void usb_rescan(void);
2223void parse_usb_id(const char *id);
2324void restrict_usb_path(const char *path);
2425void usb_unrestrict(void);
tools/lib/usbopen.c
2929static uint16_t vendor = 0;
3030static uint16_t product = 0;
3131static const struct usb_device *restricted_path = NULL;
32static int initialized = 0;
3233
3334
3435static void initialize(void)
3536{
36    static int initialized = 0;
3737
3838    if (initialized)
3939        return;
...... 
4545}
4646
4747
48void usb_rescan(void)
49{
50    initialized = 0;
51}
52
53
4854usb_dev_handle *open_usb(uint16_t default_vendor, uint16_t default_product)
4955{
5056    const struct usb_bus *bus;

Archive Download the corresponding diff file



interactive