Changeset 1882


Ignore:
Timestamp:
Dec 12, 2016, 6:38:13 PM (8 years ago)
Author:
Silvan Scherrer
Message:

libusb: update trunk to version 1.0.21

Location:
libusb1/trunk
Files:
20 deleted
63 edited
108 copied

Legend:

Unmodified
Added
Removed
  • libusb1/trunk

  • TabularUnified libusb1/trunk/AUTHORS

    r1876 r1882  
    1 Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
    2 Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
    3 Copyright (C) 2008-2013 Nathan Hjelm <hjelmn@users.sourceforge.net>
    4 Copyright (C) 2009-2012 Pete Batard <pete@akeo.ie>
    5 Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
    6 Copyright (C) 2010-2012 Peter Stuge <peter@stuge.se>
    7 Copyright (C) 2011-2012 Hans de Goede <hdegoede@redhat.com>
    8 Copyright (C) 2012 Martin Pieuchot <mpi@openbsd.org>
     1Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
     2Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
     3Copyright © 2010-2012 Peter Stuge <peter@stuge.se>
     4Copyright © 2008-2016 Nathan Hjelm <hjelmn@users.sourceforge.net>
     5Copyright © 2009-2013 Pete Batard <pete@akeo.ie>
     6Copyright © 2009-2013 Ludovic Rousseau <ludovic.rousseau@gmail.com>
     7Copyright © 2010-2012 Michael Plante <michael.plante@gmail.com>
     8Copyright © 2011-2013 Hans de Goede <hdegoede@redhat.com>
     9Copyright © 2012-2013 Martin Pieuchot <mpi@openbsd.org>
     10Copyright © 2012-2013 Toby Gray <toby.gray@realvnc.com>
     11Copyright © 2013-2015 Chris Dickens <christopher.a.dickens@gmail.com>
    912
    1013Other contributors:
     14Akshay Jaggi
    1115Alan Ott
    1216Alan Stern
    1317Alex Vatchenko
     18Andrew Fernandes
     19Anthony Clay
     20Antonio Ospite
    1421Artem Egorkine
    1522Aurelien Jarno
    1623Bastien Nocera
    17 Brian Shirley
     24Bei Zhang
     25Benjamin Dobell
     26Carl Karsten
     27Colin Walters
     28Dave Camarillo
    1829David Engraf
    1930David Moore
     31Davidlohr Bueso
     32Federico Manzan
    2033Felipe Balbi
     34Florian Albrechtskirchinger
     35Francesco Montorsi
     36Francisco Facioni
     37Gaurav Gupta
    2138Graeme Gill
    22 Hans de Goede
     39Gustavo Zacarias
    2340Hans Ulrich Niedermann
    2441Hector Martin
    2542Hoi-Ho Chan
     43Ilya Konstantinov
    2644James Hanko
     45John Sheu
     46Joshua Blake
     47Justin Bischoff
     48Karsten Koenig
    2749Konrad Rzepecki
    28 Ludovic Rousseau
     50Kuangye Guo
     51Lars Kanis
     52Lars Wirzenius
     53Luca Longinotti
     54Marcus Meissner
     55Markus Heidelberg
     56Martin Ettl
    2957Martin Koegler
    30 Martin Pieuchot
    31 Maya Erez
     58Matthias Bolte
    3259Mike Frysinger
    3360Mikhail Gusarov
     61Moritz Fischer
     62ЛарОПМПв ДаМООл
     63Nicholas Corgan
     64Omri Iluz
    3465Orin Eman
     66Paul Fertser
    3567Pekka Nikander
    36 Peter Stuge
    3768Rob Walker
    3869Sean McBride
    3970Sebastian Pipping
    40 Stephan Meyer
     71Simon Haggett
     72Simon Newton
    4173Thomas Röfer
     74Tim Hutt
     75Tim Roberts
     76Tobias Klauser
    4277Toby Peterson
     78Tormod Volden
    4379Trygve LaugstÞl
     80Uri Lublin
    4481Vasily Khoruzhick
     82Vegard Storheil Eriksen
     83Venkatesh Shukla
    4584Vitali Lovich
    4685Xiaofan Chen
     86Zoltán Kovács
     87РПЌаМ ДПМчеМкП
     88parafin
     89xantares
  • TabularUnified libusb1/trunk/ChangeLog

    r1876 r1882  
    1 commit 1753a3a8d3f4c22ba9a63d9517b8cc128d368e48
    2 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    3 Date:   Tue Apr 9 19:13:41 2013 -0600
    4 
    5     Add new example showing USB 3.0 descriptor parsing
    6 
    7 commit 5b0196e926210441d84136e1ea28282d3a75adb0
    8 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    9 Date:   Tue Apr 9 19:01:02 2013 -0600
    10 
    11     Update release notes for 1.0.16 release.
    12 
    13 commit c61f55ff9d47e9049aa639c8a2367b426742ab13
    14 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    15 Date:   Sun Apr 7 23:23:37 2013 -0600
    16 
    17     Fix various typos from the previous release candidate.
    18    
    19     - Use tab compression in libusb.h
    20     - Fix typos in USB 3.0 descriptor parsing.
    21 
    22 commit 652c7085592467946b75f89ec9d00e3d55c6db3a
    23 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    24 Date:   Sun Apr 7 22:29:12 2013 -0600
    25 
    26     on to 1.0.16-rc5
    27 
    28 commit ce7bcf54eee1337cf8d3ed55ad6793d340ab15a3
    29 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    30 Date:   Sun Apr 7 22:26:46 2013 -0600
    31 
    32     Use stdint types instead of u_int_*.
    33    
    34     Fixes an issue created by the USB 3.0 descriptor patch. The patch
    35     used u_int_* instead of the C99 stdint types.
    36 
    37 commit bbc21298c1ff45b8e27097ebe3cd03bf2303af22
    38 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    39 Date:   Sun Apr 7 17:15:24 2013 -0600
    40 
    41     Further doxygen updates
    42 
    43 commit b52e1ec382cfff0f2d553d8fd483773d3637dd93
    44 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    45 Date:   Sun Apr 7 14:21:48 2013 -0600
    46 
    47     Update doxygen documentation for hotplug and USB 3.0 descriptors.
    48 
    49 commit 008dabcf2d9aaa87dbf26c95403c930267547842
    50 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    51 Date:   Sun Apr 7 10:19:18 2013 -0600
    52 
    53     fix rc syntax
    54 
    55 commit 2c88efaf10cdb7b857e9cb942b9ec4d793602170
    56 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    57 Date:   Sun Apr 7 09:35:29 2013 -0600
    58 
    59     darwin: don't need darwin_error_str if ENABLE_LOGGING is not defined
    60 
    61 commit 87432753af97abea8f264e2a3f0de0bf79b99f14
    62 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    63 Date:   Sun Apr 7 09:22:48 2013 -0600
    64 
    65     update AUTHORS
    66 
    67 commit ff6f2b75cd5b23066bb900019358a0d599311f5d
    68 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    69 Date:   Sat Apr 6 22:28:43 2013 -0600
    70 
    71     keep new USB 3.0 descriptor code in line with current libusb style
    72 
    73 commit 022c4bfb939bc376af4c96d52074a39560744750
    74 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    75 Date:   Sat Apr 6 13:16:47 2013 -0600
    76 
    77     now on to rc4
    78 
    79 commit 7c901bb72e8c946fd84baa2b8ee24f67394c9c00
    80 Author: Maya Erez <merez@codeaurora.org>
    81 Date:   Sat Apr 6 12:30:22 2013 -0600
    82 
    83     Add definitions for Endpoint Companion and BOS descriptors.
    84     Add APIs for parsing the Endpoint Companion and BOS descriptors.
    85    
    86     Nathan: Modified the original patch to fit the interface now already
    87     provided by the freebsd implementation of libusb 1.0.
    88 
    89 commit 55c23742dece5bed4f010d0cf44a2dddb8439d45
    90 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    91 Date:   Thu Apr 4 08:51:03 2013 -0600
    92 
    93     darwin: do not try to work around buggy devices with bInterval = 0 on isochronous endpoints
    94 
    95 commit 04c009ab8b4c98b4b03fec8aa72c8e88a9b0946b
    96 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    97 Date:   Wed Apr 3 15:21:39 2013 -0600
    98 
    99     on to 1.0.16rc3
    100 
    101 commit f60fcc4c9910b97b6575648d38255d396cfac883
    102 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    103 Date:   Wed Apr 3 08:37:21 2013 -0600
    104 
    105     Use AM_CPPFLAGS instead of INCLUDES in examples/Makefile.am
    106 
    107 commit fb62de0ab3fadab7bf79363e2be282a0fe0e60f1
    108 Author: Hans de Goede <hdegoede@redhat.com>
    109 Date:   Wed Aug 22 11:47:00 2012 +0100
    110 
    111     Linux: Avoid unnecessary splitting of bulk transfers
    112    
    113     * With the latest kernels it is no longer needed to always split large bulk
    114       transfers into multiple urbs. This patch takes advantage of this by not
    115       splitting when not necessary. Note that the non-split code path is in essence
    116       using the old split code path with an urb count which is always 1.
    117     * This leads to more sane handling of large transfers with recent kernels,
    118       although our splitting code is well tested, not splitting at all still is
    119       a lot better :)
    120     * When used with a recent kernel, this also fixes the problems, on XHCI attached
    121       devices, when a large bulk-in transfer ends with a short read in an urb other
    122       then the last urb.
    123     * For more on this see: http://marc.info/?l=linux-usb&m=133797554910355
    124    
    125     Conflicts:
    126         libusb/os/linux_usbfs.c
    127         libusb/version_nano.h
    128 
    129 commit 7204a06b77b73242403a94eee5227e9e3f874b39
    130 Author: Hans de Goede <hdegoede@redhat.com>
    131 Date:   Wed Aug 22 11:47:00 2012 +0100
    132 
    133     Linux: Add support for the new get_capabilities ioctl
    134    
    135     * There were a few (new) usbdevfs capabilities which libusbx could not
    136       discover in any other way then checking the kernel version.
    137     * However, this presents the following problems:
    138       1) It is just not very pretty
    139       2) Given the tendency of enterprise distros to backport stuff it is not
    140          reliable
    141       3) Some of these features turn out to not work with certain host controllers,
    142          making depending on them based on the kernel version not a good idea
    143     * Therefore a new USBDEVFS_GET_CAPABILITIES ioctl has been added to the kernel
    144       to offer a better way to find out a device's capabilities (technically
    145       the capabilities of the host controller to which the device is attached,
    146       but that does not matter).
    147    
    148     Conflicts:
    149         libusb/os/linux_usbfs.c
    150         libusb/version_nano.h
    151 
    152 commit 50c682386e9d12e7e55805a8da550d8449a9b5c6
    153 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    154 Date:   Tue Apr 2 22:12:47 2013 -0600
    155 
    156     darwin: don't assume an interval of 1
    157 
    158 commit 14e19c7a675ce3b519a3ed84aca4bdb37e99aa4e
    159 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    160 Date:   Thu Feb 14 10:18:27 2013 -0700
    161 
    162     darwin: only send a zero-length packet if the transfer completed successfully
    163 
    164 commit 569cb63680bd28c9e8d1fd7ee8c3de2dcafa80e2
    165 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    166 Date:   Wed Feb 13 15:05:12 2013 -0700
    167 
    168     When compiled with netlink support only use kernel messages. If compiled with udev support and udev is not running return an error on libusb_init.
    169 
    170 commit d5449b017e757e1e47483604201c431e5dfc6868
    171 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    172 Date:   Wed Feb 13 09:36:27 2013 -0700
    173 
    174     linux/netlink: clean up parsing code/cosmetics
    175 
    176 commit 909d4d5a1e38a31509f852777902d3ec1a0c58ab
    177 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    178 Date:   Wed Feb 13 08:11:45 2013 -0700
    179 
    180     linux: update netlink backend to detect udev
    181 
    182 commit 4d62f0d62f9b242bd4bee841b5eac626bb2da7bd
    183 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    184 Date:   Tue Feb 12 19:59:20 2013 -0700
    185 
    186     Use kCFNumberSInt32Type when reading device location from the IO registry
    187 
    188 commit 906d2e63345ca4e8d7500438a76be83c053c70e8
    189 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    190 Date:   Tue Feb 12 07:38:51 2013 -0700
    191 
    192     add support to for netlink
    193 
    194 commit daf3d9b9f31f329f6cbd6d03383ad2cb6a712cc9
    195 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    196 Date:   Mon Feb 11 08:55:55 2013 -0700
    197 
    198     fix bug in hotplug example
    199 
    200 commit 5a49fd335a3e4a9883ebae48195ba4deb123d2d3
    201 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    202 Date:   Sun Feb 10 19:08:53 2013 -0700
    203 
    204     Update hotplug example (and as per suggestion from Xiaofan rename to hotplugtest) and fix typos in hotplug code.
    205 
    206 commit 4f77bb9751acc31d91ba91a51546ab0269add892
    207 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    208 Date:   Sun Feb 10 14:46:38 2013 -0700
    209 
    210     windows: call usbi_sanitize_device to ensure the device descriptor gets cached
    211 
    212 commit 693ae74f4eb05411c9ccc078df971ed26af17a03
    213 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    214 Date:   Sat Feb 9 09:24:05 2013 -0700
    215 
    216     Replace LIBUSB_HOTPLUG_*_ANY with LIBUSB_HOTPLUG_MATCH_ANY.
    217 
    218 commit ab28ea6ce4909a9fdd8f61547122b4a651c3265c
    219 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    220 Date:   Fri Feb 8 20:41:43 2013 -0700
    221 
    222     darwin: add fcntl.h
    223 
    224 commit a4d10c0157b9316927f3cb2b9f23243e1885303f
    225 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    226 Date:   Fri Feb 8 20:39:46 2013 -0700
    227 
    228     Fix usbi_log_v in the case where ctx is NULL (no default context).
    229    
    230     Fixes #147.
    231 
    232 commit db49e905d84fd606e629b39dfe25d47da06e09a4
    233 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    234 Date:   Fri Feb 8 17:19:01 2013 -0700
    235 
    236     On windows do not set the hotplug pipe as non-blocking. I will leave it up the backend maintainers to figure out.
    237 
    238 commit aa54ff14e091e0cca2286def724368e8f6af2e1c
    239 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    240 Date:   Fri Feb 8 00:12:13 2013 -0700
    241 
    242     darwin: add support for the LIBUSB_TRANSFER_ADD_ZERO_PACKET transfer flag.
    243    
    244     References #6.
    245 
    246 commit d7370d4cdbff83f2b218732a74d7ddd9a73a83bd
    247 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    248 Date:   Thu Feb 7 23:35:32 2013 -0700
    249 
    250     Don't set the USBFS_URB_SHORT_NOT_OK flag on the last URB.
    251    
    252     Fixes: #142
    253 
    254 commit 3c3fa2fd657c43e98b6ab3350b007831770d46a6
    255 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    256 Date:   Thu Feb 7 22:32:40 2013 -0700
    257 
    258     update copyrights
    259 
    260 commit b3f88acd3e4aeabc6c09837904994c49d72138bf
    261 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    262 Date:   Thu Feb 7 22:12:47 2013 -0700
    263 
    264     check read/write error codes
    265 
    266 commit cb822d1dcdadf04d126df7474820d685310046e1
    267 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    268 Date:   Thu Feb 7 21:56:30 2013 -0700
    269 
    270     darwin/libusb_reset: reenumerate device if the device descriptor or any configuration descriptor has changed
    271 
    272 commit 532e83ad2a4f1089db2931fb9c36844b7fe27972
    273 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    274 Date:   Fri Feb 8 17:10:24 2013 -0700
    275 
    276     replace removed automake macro AM_CONFIG_HEADER with AC_CONFIG_HEADERS.
    277    
    278     Fixes #159. Thanks to cazfi.
    279 
    280 commit 0f4023998b1927a73c6a5c9ed0cf06234cf6f145
    281 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    282 Date:   Thu Feb 7 20:05:01 2013 -0700
    283 
    284     bump version to 1.0.16rc2
    285 
    286 commit a93814998d1b2981dbbb7ec2e8cbacdc06a3a167
    287 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    288 Date:   Thu Feb 7 20:03:21 2013 -0700
    289 
    290     update hotplug example
    291 
    292 commit a5250f5c6cbf1bd568f2225985bb68b4a8177dbf
    293 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    294 Date:   Thu Feb 7 20:02:52 2013 -0700
    295 
    296     handle hotplug events from libusb_handle_events
    297 
    298 commit 65568b275009184bfd20becc2652eaa22a17d163
    299 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    300 Date:   Mon Feb 4 19:46:45 2013 -0700
    301 
    302     add hotplug support
    303 
    304 commit 78184dd8627959d172ab5672c631f880b911ab63
    305 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    306 Date:   Sun Dec 9 14:24:01 2012 -0700
    307 
    308     update hotplug documentation
    309 
    310 commit 3c3fa057d239e33cffb0e0ad57384faf15b01312
    311 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    312 Date:   Fri Dec 7 19:59:39 2012 -0700
    313 
    314     core: bump to rc1
    315 
    316 commit def5cb569a69ddf082606601490a6ad104bb711f
    317 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    318 Date:   Fri Dec 7 19:57:53 2012 -0700
    319 
    320     darwin: separate the processing of async io and hotplug events.
    321    
    322     This commit adds another thread to the Darwin backend, This thread handles only async IO events enabling the use of blocking IO in a hotplug callback.
    323 
    324 commit 094d73e4a160330e1d3860874054c11841b12f76
    325 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    326 Date:   Fri Dec 7 19:55:21 2012 -0700
    327 
    328     darwin: clean up extraneous includes
    329 
    330 commit 18dd6c3d890292685e3db610a3b1ecd7f21299a3
    331 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    332 Date:   Fri Dec 7 19:54:15 2012 -0700
    333 
    334     hotplug: update api
    335 
    336 commit 33543615dd070edf70da615ca1589046ca159101
    337 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    338 Date:   Fri Dec 7 19:50:33 2012 -0700
    339 
    340     doc: ignore internal hotplug header
    341 
    342 commit a4f43258a6de642754c21891839b763fec91e5b9
    343 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    344 Date:   Fri Dec 7 19:49:47 2012 -0700
    345 
    346     core: add hotplug capability check
    347 
    348 commit 33f7a0bc6555cafab4ea9af890ad72901ebd4e97
    349 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    350 Date:   Fri Nov 30 19:18:33 2012 -0700
    351 
    352     darwin: ensure there is at least one device reference per context
    353 
    354 commit 4aac9a3375ddfd1a001c1bb1e0002fffe53ac443
    355 Author: Nathan Hjelm <hjelmn@cs.unm.edu>
    356 Date:   Fri Nov 30 19:17:43 2012 -0700
    357 
    358     darwin: dpriv->device will never be NULL for a valid device. remove unnecessary code that handled this case
    359 
    360 commit e92dc87455a4533f462643ed5ba29c4f2b0075cc
    361 Author: Nathan Hjelm <hjelmn@me.com>
    362 Date:   Thu Nov 29 16:19:11 2012 -0700
    363 
    364     darwin: allow control messages on devices we can not exclusively open
    365 
    366 commit 4f2c5aadb2742b7a4c8059d08e516b51d713e68f
    367 Author: Nathan Hjelm <hjelmn@me.com>
    368 Date:   Thu Nov 29 16:14:03 2012 -0700
    369 
    370     Add hotplug support to the Linux backend.
    371 
    372 commit a42bae34cb66022891a8aadd54018d03c9c8c71e
    373 Author: Nathan Hjelm <hjelmn@me.com>
    374 Date:   Thu Nov 29 16:13:00 2012 -0700
    375 
    376     Add hotplug support to the Darwin backend.
    377 
    378 commit 01218366248ded97b6e802ea4b183303cc6a10f4
    379 Author: Nathan Hjelm <hjelmn@me.com>
    380 Date:   Thu Nov 29 14:23:26 2012 -0700
    381 
    382     Add hotplug support. Bumping the version to 1.0.15 and change the so version.
    383    
    384     The internal API is changing as follows:
    385      - Adding two new functions. usbi_connect_device, and usbi_disconnect_device. Backends must call these functions to add them to the context's device list at one of two places: initial enumeration (done at init), and on device attach and removal. These functions need to be called once per context.
    386      - Backends that support hotplug should not provide a get_device_list funtion. This function is now deprecated and will likely be removed when all backends support hotplug.
    387    
    388     The external API is changing as follows:
    389      - Several new functions have been added to register for notification of device attach/detach. Callbacks are per context and can be called once or persist for the lifetime of the context.
    390      - Details of the new functionality can      be found in libusb.h
    391 
    392 commit 2574334e8c46b2d86f2c1b920195f917368554ef
    393 Author: Nathan Hjelm <hjelmn@me.com>
    394 Date:   Thu Nov 29 13:53:41 2012 -0700
    395 
    396     cache device descriptors in the core
    397 
    398 commit 30e02dee5840de7c0835fc5a31f2e544b6e45bd5
    399 Author: Nathan Hjelm <hjelmn@me.com>
    400 Date:   Thu Nov 29 13:46:07 2012 -0700
    401 
    402     Fix #150: do not unsuspend Apple devices by checking for idProduct == kIOUSBVendorIDAppleComputer
    403 
    404 commit 319e3a4297986aee16f7a4b6f3d23ef0bdaf7e03
    405 Author: Nathan Hjelm <hjelmn@me.com>
    406 Date:   Sun Sep 30 11:49:01 2012 -0600
    407 
    408     core: Keep a list of contexts (active_contexts_list) created by libusb_init. The list can be used by backends to determine which contexts need notification of device removal (and in the future device arrival). The active_contexts_list is protected from multiple access by the active_contexts_lock.
    409 
    410 commit 251392979d418025e5dcadf515ca1a0b0f4d52e3
    411 Author: Nathan Hjelm <hjelmn@me.com>
    412 Date:   Tue Oct 2 08:07:03 2012 -0600
    413 
    414     darwin: add support for detecting superspeed devices (IOUSBFamily 5.0.0 or newer)
    415 
    416 commit 81827fe1c358ef2b69da14bb52beec36dedce261
    417 Author: Nathan Hjelm <hjelmn@me.com>
    418 Date:   Sun Sep 30 10:22:30 2012 -0600
    419 
    420     clean up tabs
    421 
    422 commit 6960cae5d0860f2060e5b0190d8b58d335317066
    423 Author: Nathan Hjelm <hjelmn@me.com>
    424 Date:   Fri Sep 28 22:13:09 2012 -0600
    425 
    426     darwin: use Release instead of IODestroyPlugInInterface to avoid stopping IOServices associated with a device
    427 
    428 commit 775d8f71cecf5c3fa6f9da717cfbc728a0f8b7c2
    429 Author: Nathan Hjelm <hjelmn@me.com>
    430 Date:   Fri Sep 28 21:18:36 2012 -0600
    431 
    432     darwin: don't bother retrying or unsuspending Apple devices during enumeration
    433 
    434 commit 0394057cb13b1d32d6aa1182b5d82f0f59f7031b
    435 Author: Nathan Hjelm <hjelmn@me.com>
    436 Date:   Fri Sep 28 21:18:08 2012 -0600
    437 
    438     darwin: reduce number of times libusb attempts to retrieve a device descriptor during enumeration
    439 
    440 commit 2b044abace76ba0095ee5dbc71a7dac75e8c8f05
    441 Author: Pete Batard <pete@akeo.ie>
    442 Date:   Wed Aug 22 01:32:10 2012 -0700
    443 
    444     io.c: Handle >= 1 second transfer timeout in libusb_wait_for_event()
    445 
    446 commit 3b821d0a709c6b5b3094a763bb04e48ed0447050
    447 Author: Peter Stuge <peter@stuge.se>
    448 Date:   Wed Aug 22 01:32:10 2012 -0700
    449 
    450     io.c: Handle >= 1 second transfer timeout in libusb_submit_transfer()
    451 
    452 commit b7ed26c7add5528b71a205b4f04c242d3cbeab54
    453 Author: Peter Stuge <peter@stuge.se>
    454 Date:   Sat Aug 4 14:27:55 2012 +0200
    455 
    456     INSTALL_WIN.txt: Correct Windows backend webpage URL
    457 
    458 commit cf60da545c915905869fa4007fcdc5faa75fdcbb
    459 Author: Peter Stuge <peter@stuge.se>
    460 Date:   Sat Aug 4 14:26:43 2012 +0200
    461 
    462     Windows: #include <windows.h> in header files
    463 
    464 commit 36962a408b07920f2fdd61dda6bef0e9e319e7d2
    465 Author: Peter Stuge <peter@stuge.se>
    466 Date:   Sun Jul 29 06:22:45 2012 +0200
    467 
    468     Windows: Remove msvc/inttypes.h
    469    
    470     This file might have been needed for platform abstraction, except that
    471     all code shared among platforms doesn't need the file. Windows code in
    472     particular does not need to use the file.
    473    
    474     The file was used in one single place, where the PRIu64 define has now
    475     been replaced with it's value "I64u".
    476 
    477 commit 455b2d98869826db7276ddb69ce7b73f1acc9f94
    478 Author: Peter Stuge <peter@stuge.se>
    479 Date:   Sat Jul 28 19:17:15 2012 +0200
    480 
    481     libusb.h: Fix #145 libusb_ref_device() and libusb_unref_device() typos
    482 
    483 commit 53e526e21b519300aff9c9579f886cfc107b0a30
    484 Author: Simon Haggett <simon.haggett@realvnc.com>
    485 Date:   Tue Jul 10 16:07:45 2012 +0100
    486 
    487     Windows: Stop leaking event handle when destroying condition variables
    488    
    489     usbi_cond_destroy() must close the handle created by usbi_cond_intwait().
    490 
    491 commit c5194b408286229ce0d94765f963890057d46ee0
    492 Author: Peter Stuge <peter@stuge.se>
    493 Date:   Tue Jul 10 16:54:16 2012 +0200
    494 
    495     io.c: Avoid timerfd race condition between completion and new submit
    496    
    497     An event handler thread working on transfer completion for the last
    498     flying transfer with a timeout can end up racing with a call to
    499     libusb_submit_transfer() from a second thread, so that the timerfd
    500     gets disarmed even though libusb actually again has a transfer with
    501     a timeout.
    502    
    503     By arming or disarming the timerfd during completion strictly
    504     according to remaining flying transfers while also holding the
    505     flying_transfers_lock this change ensures that a new transfer can
    506     not be added to the flying list until the completion code path has
    507     armed/disarmed the timerfd according to the current flying list.
    508    
    509     Hans de Goede describes the race condition situation in
    510     http://sourceforge.net/mailarchive/message.php?msg_id=29520709
    511    
    512     Signed-off-by: Peter Stuge <peter@stuge.se>
    513 
    514 commit 0845ff2aeed9ad009d246ecc2a945f007817ca9a
    515 Author: Peter Stuge <peter@stuge.se>
    516 Date:   Tue Jul 10 06:29:48 2012 +0200
    517 
    518     .gitattributes: Set INSTALL_WIN.txt eol=crlf attribute
    519 
    520 commit cd8e76f0b1f47271c4059cd6c1e67e23f0e247a8
    521 Author: Pete Batard <pete@akeo.ie>
    522 Date:   Thu May 10 16:44:30 2012 +0100
    523 
    524     Windows: Add INSTALL_WIN.txt
    525    
    526     libusbx.git commit 75b1cf81db74357f55cc4d0f596ef19a6a25c5cd
    527    
    528     [stuge: Remove trailing whitespace]
    529 
    530 commit 3bd6db0b8f60143836f5a933f35b15d764fbc7dc
    531 Author: Ludovic Rousseau <ludovic.rousseau@gmail.com>
    532 Date:   Wed May 9 09:13:41 2012 +0200
    533 
    534     examples/Makefile.am: Use the implicit _SOURCES rule
    535    
    536     By default automake looks for a source file foo.c for a foo binary.
    537    
    538     libusbx.git commit 7e52e1e7534ead3f66b13bdcb28ac8587ff47ab0
    539 
    540 commit 1bd831c4e88857bff2f1670c89eda1d04da1cc54
    541 Author: Peter Stuge <peter@stuge.se>
    542 Date:   Tue Jul 10 01:46:38 2012 +0200
    543 
    544     io.c: Only disarm timerfd when no flying transfer has a timeout
    545    
    546     Commit 4630fc22cff8ad3e1afa9b223378c0aabe282b5c made libusb work
    547     correctly when built to use timerfd but run on a kernel without
    548     timerfd support. The commit unfortunately also broke the logic
    549     during transfer completion which decides if the timerfd will be
    550     disarmed or not, and disarm_timerfd() was called even if the
    551     timerfd had already been armed with the next flying transfer
    552     timeout.
    553    
    554     Before the offending commit the timerfd would be disarmed only
    555     when arm_timerfd_for_next_timeout() reported that there was no
    556     flying transfer with a timeout. Let's restore that behavior.
    557    
    558     The bug was spotted through code review both by the author and
    559     by Hans de Goede, but was not squashed until Vincent Pellier
    560     experienced transfers never timing out, and helped confirm
    561     the source of the problem. Many thanks!
    562    
    563     References #73.
    564 
    565 commit ae996af002793005db318689229300ff73549964
    566 Author: Ludovic Rousseau <ludovic.rousseau@gmail.com>
    567 Date:   Tue May 8 20:34:12 2012 +0200
    568 
    569     Darwin: Fix warning: comparison between signed and unsigned
    570    
    571     libusbx.git commit c5c6b0e69a13786e48b2b6254c8e5458dc6716cc
    572 
    573 commit 0f29541c6728c9c2159080267b43e9b4144e9e56
    574 Author: Ludovic Rousseau <ludovic.rousseau@gmail.com>
    575 Date:   Tue May 8 15:53:56 2012 +0200
    576 
    577     Core: Return LIBUSB_ERROR_IO on sync API TRANSFER_ERROR and _CANCELLED
    578    
    579     This is much more appropriate and also fixes gcc -Wswitch-enum warnings.
    580    
    581     libusbx.git commit 30ccbd773bc02d5dfd21e02bfba6d58234f59393
    582 
    583 commit 133092314d539d4c1a37997bb0c4ccfbcacb4677
    584 Author: Ludovic Rousseau <ludovic.rousseau@gmail.com>
    585 Date:   Fri May 4 16:56:00 2012 +0100
    586 
    587     autogen.sh: Correctly pass arguments containing spaces to configure
    588    
    589     libusbx.git commit d20cd4f3573fe74d0ec5a4e1d60c9d291547ace4
    590 
    591 commit 8dc8b977d796b227f59eb5a7b247b38e27748d52
    592 Author: Ludovic Rousseau <ludovic.rousseau@gmail.com>
    593 Date:   Fri May 4 16:56:00 2012 +0100
    594 
    595     autogen.sh: Exit script on first error
    596    
    597     libusbx.git commit c74fe3ab703a28c6d8c3755213e3736c5d1eb35e
    598 
    599 commit d8e35a560dfada578c6f6dea520d7d908b002001
    600 Author: Toby Gray <toby.gray@realvnc.com>
    601 Date:   Thu May 3 11:25:11 2012 +0100
    602 
    603     Windows: Fix deadlock when submitting transfers
    604    
    605     The Windows backend needed to call usbi_fd_notification() from
    606     submit_transfer() because a new event source is added for every WinUSB
    607     transfer. This could cause a deadlock when attempting to lock the event
    608     lock if another thread was processing events on the just-submitted
    609     transfer.
    610    
    611     The deadlock comes about as the thread calling libusb_submit_transfer()
    612     acquires the transfer mutex before trying to acquire the event lock; this
    613     is the other order of lock acquisition from an event thread handling
    614     activity on the just submitted transfer. This could lead to one of two
    615     deadlocks:
    616    
    617     1) If the transfer completes while usbi_fd_notification() is waiting for
    618     the event lock and the callback attempts to resubmit the transfer.
    619    
    620     2) If the transfer timeout is hit while usbi_fd_notification() is waiting
    621     for the event lock then the attempt to cancel the transfer will deadlock.
    622    
    623     This patch fixes both of these deadlocks by having libusb_submit_transfer()
    624     only call usbi_fd_notification() after having released the transfer mutex.
    625    
    626     This deadlock was always present in the Windows code, but temporarily
    627     deleted by mistake in commit 6506013c6d4face34cfec79dd0584e9f528cbc6a
    628     and later restored in commit 325a8416697cf69b9b926ed68720f12b1aedf940.
    629    
    630     libusbx.git commit 1ed09c7b2a5fc27c3cfea21740584879781bff67
    631    
    632     [stuge: Touch up commit message]
    633 
    634 commit b988c3d66e349b4f3c430410a42b6203f4fef80f
    635 Author: Peter Stuge <peter@stuge.se>
    636 Date:   Sun Jun 3 21:28:13 2012 +0200
    637 
    638     Clean up broken whitespace in list_for_each_entry() macros
    639    
    640     Introduced by commit aa77b02da65afb0332b9e6853dae9e4dcda00bfa.
    641 
    642 commit f651b2669c6ab0804d572650d79551bc2b70f525
    643 Author: Peter Stuge <peter@stuge.se>
    644 Date:   Tue May 8 19:50:17 2012 +0200
    645 
    646     examples: Add sam3u_benchmark isochronous example by Harald Welte
    647    
    648     Copied with the author's permission under LGPL-2.1 from
    649     usb-benchmark-project/host/benchmark.c in
    650     git://git.gnumonks.org/sam3u-tests.git commit
    651     74959f7ee88f1597286cd435f312a8ff52c56b7e
    652    
    653     http://git.gnumonks.org/cgi-bin/gitweb.cgi?p=sam3u-tests.git;a=blob;f=usb-benchmark-project/host/benchmark.c;h=74959f7ee88f1597286cd435f312a8ff52c56b7e
    654    
    655     An Atmel SAM3U test firmware is also available in the above repository.
    656 
    657 commit 3a69eff1aaf8e3242937bd7ecc94a60e7aa502cd
    658 Author: Peter Stuge <peter@stuge.se>
    659 Date:   Tue May 8 19:22:31 2012 +0200
    660 
    661     examples: Only check for HAVE_SIGACTION once in Makefile.am
    662 
    663 commit d9dbb433f3f3b9787417e34316604d99cb72b188
    664 Author: Peter Stuge <peter@stuge.se>
    665 Date:   Tue May 8 19:19:28 2012 +0200
    666 
    667     .gitignore: Add examples/ path to the examples
    668 
    669 commit a129732fb45fc424743f26f01c906e4514f11521
    670 Author: Peter Stuge <peter@stuge.se>
    671 Date:   Tue May 8 19:14:40 2012 +0200
    672 
    673     examples: Use a common LDADD for all examples
    674 
    675 commit 325a8416697cf69b9b926ed68720f12b1aedf940
    676 Author: Uri Lublin <uril@redhat.com>
    677 Date:   Tue May 1 16:47:34 2012 +0300
    678 
    679     Windows: Make new transfers correctly notify the event handling thread
    680    
    681     usbi_fd_notification() calls are added back into submit_*_transfer()
    682     so that the event handling thread will be aware of new transfers.
    683    
    684     libusb.git commit 6506013c6d4face34cfec79dd0584e9f528cbc6a from
    685     libusbx.git commit 4cccbed825fe1dc138121640a6497d7d05aac159 removed
    686     these calls during the removal of the DYNAMIC_FDS Windows-specific
    687    
    688     [stuge: Rewrite commit message]
    689 
    690 commit 4674b4d137df2e2e49a1057c947888de8f37d6e8
    691 Author: Ludovic Rousseau <ludovic.rousseau+github@gmail.com>
    692 Date:   Fri Apr 20 22:25:38 2012 +0100
    693 
    694     Linux: Fix warning: comparison between signed and unsigned
    695    
    696     libusbx.git commit 36a7119bf296cecd4e910bef86908fd782224960
    697 
    698 commit ab9cd5a7be637f7b793987971a706b1d11c27ded
    699 Author: Peter Stuge <peter@stuge.se>
    700 Date:   Fri Apr 20 08:10:11 2012 +0200
    701 
    702     libusb-1.0.9
    703 
    704 commit 696400ad83531bcf944c71164a46f9ccb6a33df3
    705 Author: Peter Stuge <peter@stuge.se>
    706 Date:   Fri Apr 20 08:08:34 2012 +0200
    707 
    708     AUTHORS: Update list of contributors
    709 
    710 commit 19f94537ea55586dd85f8d627fcfaa6173069ea1
    711 Author: Peter Stuge <peter@stuge.se>
    712 Date:   Fri Apr 20 06:41:34 2012 +0200
    713 
    714     AUTHORS: Add Martin Pieuchot as copyright holder
    715 
    716 commit 1a1c633d7912a2565f6af0c9294e10a759d40e05
    717 Author: Peter Stuge <peter@stuge.se>
    718 Date:   Fri Apr 20 06:41:12 2012 +0200
    719 
    720     AUTHORS: Add Hans de Goede as copyright holder
    721 
    722 commit 9477f793341d59cc861acb283e6cb03b5730ac91
    723 Author: Peter Stuge <peter@stuge.se>
    724 Date:   Fri Apr 20 06:40:45 2012 +0200
    725 
    726     AUTHORS: Add Peter Stuge as copyright holder
    727 
    728 commit 4b0dfe9770356af3c51103a9b3d63c5f8cc63d8b
    729 Author: Pete Batard <pete@akeo.ie>
    730 Date:   Mon Apr 2 15:47:53 2012 +0100
    731 
    732     AUTHORS: Update Pete Batard's copyright years and email address
    733    
    734     libusbx.git commit f98eaca0985364be00fcfde3fd3884075092a4e9
    735    
    736     [stuge: Remove unrelated changes]
    737 
    738 commit 9f0ea78357b7b1654cb3e7de6ff57f5f378b68f1
    739 Author: Peter Stuge <peter@stuge.se>
    740 Date:   Fri Apr 20 08:35:04 2012 +0200
    741 
    742     AUTHORS: Update Nathan Hjelm's copyright years
    743 
    744 commit 8d38506ebc9fb57a40113e5a7739572a42b826d8
    745 Author: Peter Stuge <peter@stuge.se>
    746 Date:   Fri Apr 20 06:36:08 2012 +0200
    747 
    748     README: Add the BSDs, punctuation, mailinglist link, and remove Daniel
    749 
    750 commit 05cbe2de45806db309343cdf298d8569c55863e5
    751 Author: James Hanko <james.hanko@tridentmicro.com>
    752 Date:   Wed Oct 19 17:32:34 2011 -0700
    753 
    754     Linux: Search for /dev/usbdev<bus>.<device> USB device special files
    755    
    756     If neither the (now deprecated) usbfs filesystem nor udev is available
    757     then libusb searches for device nodes also in /dev where they may be
    758     created if the kernel was built with the option CONFIG_USB_DEVICE_CLASS.
    759     This helps on embedded systems such as Android, and all mdev users.
    760    
    761     Fixes #119.
    762 
    763 commit a806d169e6b5f675289cb9307fcd6b908edd9219
    764 Author: Peter Stuge <peter@stuge.se>
    765 Date:   Fri Apr 20 04:32:47 2012 +0200
    766 
    767     Add a timestamp in log messages
    768    
    769     Fixes #34.
    770 
    771 commit 03f4d40c748506c85f88427dd53afd5c663a2929
    772 Author: Peter Stuge <peter@stuge.se>
    773 Date:   Fri Apr 20 02:24:44 2012 +0200
    774 
    775     Include library version in the very first libusb_init() debug message
    776 
    777 commit 84d5eafd1f24a1c6f77f0c2a2ad40e1fbfdea381
    778 Author: Martin Pieuchot <mpi@openbsd.org>
    779 Date:   Thu Apr 19 13:33:36 2012 +0200
    780 
    781     OpenBSD: Provide libusb_get_device_speed() data
    782    
    783     Because the different speed values used by the libusb and OpenBSD's
    784     usb_device_info structure are compatible, keep the code simple and
    785     just copy the value returned by the USB_GET_DEVICEINFO ioctl() call.
    786    
    787     Fixes #45.
    788 
    789 commit c145ec09732fac2eef53accc07314040d22b64a5
    790 Author: Peter Stuge <peter@stuge.se>
    791 Date:   Fri Apr 20 00:11:01 2012 +0200
    792 
    793     doc/Makefile.am: Remove username from SF web rsync upload command
    794    
    795     Commit c407a2d97b6f8715d3452257a0adac40a20178e6 did it for tarballs.
    796    
    797     libusbx.git commit ca159f15737e9097a4d031c9950f281c42af040a
    798 
    799 commit 6506013c6d4face34cfec79dd0584e9f528cbc6a
    800 Author: Pete Batard <pete@akeo.ie>
    801 Date:   Tue Apr 10 13:30:24 2012 +0100
    802 
    803     Windows: Remove #define compile time options in the backend source code
    804    
    805     * The DYNAMIC_FDS, AUTO_CLAIM and FORCE_INSTANT_TIMEOUTS options
    806       were introduced for development/testing and don't appear to be
    807       used by the Windows backend users => remove them.
    808    
    809     libusbx.git commit 4cccbed825fe1dc138121640a6497d7d05aac159
    810 
    811 commit e291e369b975692dfa1a0f029244af597fa61220
    812 Author: Pete Batard <pete@akeo.ie>
    813 Date:   Tue Apr 10 13:05:37 2012 +0100
    814 
    815     Windows: Warn on one libusb_get_device_list() memory allocation failure
    816    
    817     libusbx.git commit 24d595aa71e7fd0f14d40e933a33f852f7269c8b
    818 
    819 commit 2f40a03ea0552cd8b5ce3d7667b20dc04da061da
    820 Author: Pete Batard <pete@akeo.ie>
    821 Date:   Tue Apr 10 13:05:37 2012 +0100
    822 
    823     Windows: Add textual error name to debug message on auto-release errors
    824    
    825     libusbx.git commit 24d595aa71e7fd0f14d40e933a33f852f7269c8b
    826 
    827 commit 3c7f85a49b42ac36c6d41294858518c554ac4694
    828 Author: Pete Batard <pete@akeo.ie>
    829 Date:   Tue Apr 10 13:05:37 2012 +0100
    830 
    831     Windows: Silence warning about unused function guid_to_string()
    832    
    833     Commit 6b1982b1bd321b55698ce537e64648e8aec85f6f removed the #ifdef
    834     around guid_to_string() but this ended up causing a warning when
    835     the function wasn't being called. Add it back with correct _MSC_VER.
    836    
    837     libusbx.git commit 24d595aa71e7fd0f14d40e933a33f852f7269c8b
    838    
    839     [stuge: Rewrite commit message for libusb.git]
    840 
    841 commit eb55963a6b33799ea76c34f538f21e86f235ea62
    842 Author: Pete Batard <pete@akeo.ie>
    843 Date:   Tue Apr 10 13:05:37 2012 +0100
    844 
    845     Windows: Base DUMMY_HANDLE on LONG_PTR instead of LONG
    846    
    847     libusbx.git commit 24d595aa71e7fd0f14d40e933a33f852f7269c8b
    848 
    849 commit d930865987de523061eca259a7fed11aea626831
    850 Author: Pete Batard <pete@akeo.ie>
    851 Date:   Tue Apr 10 13:05:37 2012 +0100
    852 
    853     Windows: Prefer calloc() over malloc() and cast all allocations
    854    
    855     This silences VS2010 intellisense warnings on memory allocation.
    856    
    857     libusbx.git commit 24d595aa71e7fd0f14d40e933a33f852f7269c8b
    858 
    859 commit df35117ce58b74fa530baaaccc30adaf432398ea
    860 Author: Peter Stuge <peter@stuge.se>
    861 Date:   Thu Apr 19 22:55:44 2012 +0200
    862 
    863     Add libusb_get_version() API function
    864    
    865     Let's see how this will be used. Fixes #53.
    866    
    867     libusbx.git commit 37dfd16c8c2f36c81c86de303072def0dc405e32
    868    
    869     [stuge: Remove unrelated changes]
    870     [stuge: Add struct libusb_version member rc for release candidate suffix]
    871     [stuge: Add struct libusb_version member describe for git describe output]
    872 
    873 commit 29d5f63c5765f36ea65b55c4cd5f36e1f10a4dae
    874 Author: Peter Stuge <peter@stuge.se>
    875 Date:   Thu Apr 19 22:25:07 2012 +0200
    876 
    877     Windows: Rename VS2005 solution and add VS2010 project files
    878    
    879     libusbx.git commit fcad0941e52eb2fd6d57d3327f420db14dfabf0b
    880    
    881     [stuge: Remove xusb references]
    882     [stuge: Add newlines at end of new files]
    883     [stuge: Rename libusb_20??.sln to libusb_vs20??.sln]
    884 
    885 commit b217ec1f904c4382010a3a834a7c58d595b594cf
    886 Author: Pete Batard <pete@akeo.ie>
    887 Date:   Sat Mar 31 22:32:56 2012 +0100
    888 
    889     libusb/Makefile.am: Fix missing DLL .def file from make dist
    890    
    891     libusbx.git commit 10dc1ea9a799b13b7423968130da812aa97289bf
    892    
    893     [stuge: Use EXTRA_DIST in libusb/Makefile.am instead]
    894 
    895 commit 54cb51d8417e0128eb9088bf628db138c9daa2a0
    896 Author: Pete Batard <pete@akeo.ie>
    897 Date:   Sat Mar 31 22:14:47 2012 +0100
    898 
    899     Makefile.am: Fix msvc dir not being included in make dist
    900    
    901     libusbx.git commit a8a80b60a14e3a8269e42dedf34fda66da8e0e50
    902 
    903 commit 38d5ba472c6cb728ec818a0c8d964b632c8a7992
    904 Author: Hans de Goede <hdegoede@redhat.com>
    905 Date:   Fri Mar 30 13:40:32 2012 +0100
    906 
    907     Linux: Don't spam the console with 'device unconfigured' errors
    908    
    909     libusbx.git commit 3c968be61befc47d33562843e5479ff67303b0c4
    910 
    911 commit 93f14087b2e79d71ba1e53c0b9c7da655dd1258e
    912 Author: Nathan Hjelm <hjelmn@me.com>
    913 Date:   Thu Apr 19 05:52:58 2012 -0600
    914 
    915     Darwin: Silence warning: cast from pointer to integer of different size
    916    
    917     As per http://marc.info/?m=133483651109899
    918    
    919     Reported-by: Xiaofan Chen <xiaofanc@gmail.com>
    920 
    921 commit 0efc2086646200d8dee86cbbb1e98136383a05c3
    922 Author: Pete Batard <pete@akeo.ie>
    923 Date:   Thu Mar 29 23:21:25 2012 +0100
    924 
    925     .gitattributes: Add export-ignore for .gitattributs and .gitignore
    926    
    927     This keeps the git files out of archives created by gitweb.
    928    
    929     libusbx.git commit 2250152b251243f75c951533ae7b1139a785cfe6
    930    
    931     [stuge: Removed unrelated whitespace changes]
    932 
    933 commit a7ef55c02f0116b94cb75831e5d90ad258c662f8
    934 Author: Pete Batard <pete@akeo.ie>
    935 Date:   Wed Mar 28 01:02:02 2012 +0100
    936 
    937     Windows: fix Clang warnings about unused assignations
    938    
    939     libusbx.git commit c0e7b289fdb35687b90263b14426319d2b96b132
    940 
    941 commit ac8eed67e1595ee5a069623e48362d8a85dcb252
    942 Author: Pete Batard <pete@akeo.ie>
    943 Date:   Mon Mar 26 23:34:25 2012 +0100
    944 
    945     configure.ac: LT_LANG([Windows Resource]) makes windres check redundant
    946    
    947     libusbx.git commit 4f9fd6a29a712b0e3312983e9ff153e6d7ed0822
    948 
    949 commit 89ce6f7d05dc8ff4a441a01b192d2e20857f6c48
    950 Author: Pete Batard <pete@akeo.ie>
    951 Date:   Tue Mar 27 00:03:07 2012 +0100
    952 
    953     Windows: Bring .vcproj x86_64 output directories in line with x86_32
    954    
    955     libusbx.git commit abdb4437ea1897226076fa706651e350dba1cfd5
    956 
    957 commit 77743c6f5b3cfa2d06dcb32204bc65d8bd4fec80
    958 Author: Hans de Goede <hdegoede@redhat.com>
    959 Date:   Fri Mar 9 11:31:11 2012 +0100
    960 
    961     Linux: Fix a comment in handle_iso_completion()
    962    
    963     Fix the comment at the end of handle_iso_completion, we don't stop on
    964     urbs / isoc packets with less data then requested, which is a good
    965     thing since it is a normal condition for isoc transfers.
    966    
    967     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    968 
    969 commit 5b87c2c7475a8d68270e19336afec0c5a08579ca
    970 Author: Hans de Goede <hdegoede@redhat.com>
    971 Date:   Fri Mar 9 11:31:10 2012 +0100
    972 
    973     Linux: Remove bogus status handling from handle_iso_completion()
    974    
    975     Remove a useless check+set of status because:
    976     1. The check is always true; and
    977     2. The new value is never used
    978    
    979     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    980 
    981 commit e23d8f67eab947e5d41216e0139f0a50d1342ef8
    982 Author: Hans de Goede <hdegoede@redhat.com>
    983 Date:   Fri Mar 9 11:31:09 2012 +0100
    984 
    985     Linux: Translate isoc packet status codes to LIBUSB_TRANSFER_ codes
    986    
    987     During testing of my usbredir code I hit a scenario where my libusb
    988     app was seeing EXDEV as status in the transfer's iso_packet_desc.
    989    
    990     This happened because we didn't translate linux negative errno errors
    991     in each isoc packet's status to LIBUSB_TRANSFER_ status codes! This
    992     patch adds these translations.
    993    
    994     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    995 
    996 commit 7199bc2c9c351b553b6175a588237ee793719281
    997 Author: Hans de Goede <hdegoede@redhat.com>
    998 Date:   Fri Mar 9 11:31:08 2012 +0100
    999 
    1000     Linux: Fix URB return code handling
    1001    
    1002     During testing of my usbredir code I hit a case where EOVERFLOW was not
    1003     handled in handle_control_completion(). Instead of just fixing this one
    1004     case I've audited (and fixed where necessary) all handle_foo_completion()
    1005     functions to know about all errors documented in
    1006     linux/Documentation/usb/error-codes.txt.
    1007    
    1008     Note that for handle_iso_completion() this patch actually removes the
    1009     handling of some codes, since these can never occur on an iso urb (they
    1010     can only occur on the iso packets included in the urb, see the next patch
    1011     in this series). Also, in case an unknown status is encountered on an iso
    1012     urb this patch sets the urb's status to ERROR rather then leaving it at
    1013     completed.
    1014    
    1015     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1016 
    1017 commit 98bc7b8d125c2756deadfc889dcefd4e6f2fcd02
    1018 Author: Hans de Goede <hdegoede@redhat.com>
    1019 Date:   Fri Mar 9 11:31:07 2012 +0100
    1020 
    1021     Don't print an error when libusb_cancel_transfer() fails with NOT_FOUND
    1022    
    1023     As stated in the documentation for libusb_cancel_transfer(),
    1024     LIBUSB_ERROR_NOT_FOUND is an expected return value for
    1025     libusb_cancel_transfer() under certain circumstances, so
    1026     printing an error every time this happens is undesirable.
    1027    
    1028     Even more so because under Linux IOCTL_USBFS_DISCARDURB sets errno
    1029     to EINVAL when the kernel can't not find the urb in the kernel's
    1030     urbs-in-flight list, which means that the urb has already completed
    1031     at the host controller level but it has not necessarily been reaped
    1032     yet. IOW under Linux libusb_cancel_transfer() may yield a result of
    1033     LIBUSB_ERROR_NOT_FOUND *before* the transfer's callback has been
    1034     called! In conclusion there is no way for applications to avoid
    1035     calling libusb_cancel_transfer() on already completed transfers,
    1036     and these errors can and do happen frequently for some USB traffic.
    1037    
    1038     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1039 
    1040 commit 4db8275da59996eb1c22d2e9e9c527fa58b288ad
    1041 Author: Hans de Goede <hdegoede@redhat.com>
    1042 Date:   Fri Mar 9 11:31:06 2012 +0100
    1043 
    1044     Linux: Fix cancel_transfer return value when cancelling a multi-urb transfer
    1045    
    1046     If we fail to cancel the last urb of a multi-urb transfer because it
    1047     has already completed (errno == EINVAL on DISCARD_URB), then the entire
    1048     transfer has already completed, so returning NOT_FOUND is consistent
    1049     with what the documentation for libusb_cancel_transfer() says.
    1050    
    1051     But if we've successfully cancelled the last urb, and then another urb
    1052     fails with errno == EINVAL, this means that we've still cancelled the
    1053     transfer, as it has only *partially* completed.
    1054    
    1055     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1056 
    1057 commit b22253ba9cbd399299b534a8c5e3bbac3f240963
    1058 Author: Peter Stuge <peter@stuge.se>
    1059 Date:   Thu Apr 19 04:05:29 2012 +0200
    1060 
    1061     libusb-1.0.pc: Mention OpenBSD and NetBSD in description
    1062 
    1063 commit 6aa0fc60d94e3123de230d3fbc9196814c0e466e
    1064 Author: Peter Stuge <peter@stuge.se>
    1065 Date:   Mon Apr 16 05:59:44 2012 +0200
    1066 
    1067     io.c: Add debug message with the callback address on completed transfer
    1068 
    1069 commit de41604560a57b2279ac1d0a10b8192a9224d284
    1070 Author: Xiaofan Chen <xiaofanc@gmail.com>
    1071 Date:   Sun Apr 15 11:50:27 2012 +0800
    1072 
    1073     Experimental support for NetBSD using the OpenBSD backend
    1074    
    1075     Signed-off-by: Xiaofan Chen <xiaofanc@gmail.com>
    1076 
    1077 commit 404054cb508881c9bd6bc575b66c4f509046b4af
    1078 Author: Peter Stuge <peter@stuge.se>
    1079 Date:   Thu Apr 19 00:41:45 2012 +0200
    1080 
    1081     configure.ac: Separate per-OS backend selection from per-backend settings
    1082 
    1083 commit 2eba7e4197cf9afa77451186e1a116ee3ae91adc
    1084 Author: Xiaofan Chen <xiaofanc@gmail.com>
    1085 Date:   Sun Apr 15 07:17:18 2012 +0800
    1086 
    1087     Linux: Silence unused variable warnings when without CLOCK_MONOTONIC
    1088    
    1089     Signed-off-by: Xiaofan Chen <xiaofanc@gmail.com>
    1090 
    1091 commit bc790a9c414871cc1d33f1c7686048434a700e45
    1092 Author: Peter Stuge <peter@stuge.se>
    1093 Date:   Sat Apr 7 05:20:36 2012 +0200
    1094 
    1095     examples: Use snprintf() instead of sprintf() in dpfp and dpfp_threaded
    1096    
    1097     The OpenBSD C compiler generates a warning for every use of sprintf()
    1098     and for a good reason. Reported in http://marc.info/?m=133376187514495
    1099    
    1100     Reported-by: Xiaofan Chen <xiaofanc@gmail.com>
    1101 
    1102 commit bffa232dca51bcc41df71c5735fa56370b7509ad
    1103 Author: Peter Stuge <peter@stuge.se>
    1104 Date:   Sat Apr 7 03:55:36 2012 +0200
    1105 
    1106     OpenBSD: Fix warning: 'hpriv' may be used uninitialized
    1107    
    1108     As reported in http://marc.info/?m=133376187514495
    1109    
    1110     The variable would be used uninitialized when the internal list of
    1111     open devices is empty as obsd_handle_events() checks which device
    1112     the event fd belongs to, which can not actually happen, but if it
    1113     ever does happen then we will now return LIBUSB_ERROR_NO_DEVICE.
    1114    
    1115     Reported-by: Xiaofan Chen <xiaofanc@gmail.com>
    1116 
    1117 commit 6b1982b1bd321b55698ce537e64648e8aec85f6f
    1118 Author: Moses McKnight <moses@texband.net>
    1119 Date:   Fri Mar 30 21:53:20 2012 -0500
    1120 
    1121     Windows: Fix build on VC++2003 which doesn't support variadic macros
    1122    
    1123     Change _MSC_VER tests to check for >= 1400 instead of > 1200 because
    1124     Visual C++ did not support variadic macros until VC++2005, as per
    1125     http://msdn.microsoft.com/en-us/library/ms177415%28v=VS.80%29.aspx
    1126    
    1127     Since usbi_dbg() is a function and not a macro with the old MS C
    1128     compilers the functions guid_to_string() and windows_error_str()
    1129     need to be compiled unconditionally, and the compiler should remove
    1130     the dead code when debug logging is disabled on newer compilers.
    1131 
    1132 commit 58ac0355e547080c82d02685a32480b891383d3d
    1133 Author: Peter Stuge <peter@stuge.se>
    1134 Date:   Sat Mar 31 03:44:40 2012 +0200
    1135 
    1136     Windows: Don't use a log function body macro for old MS compilers
    1137    
    1138     The duplication is a lot more straightforward than the previous LOG_BODY
    1139     macro, which also didn't handle the special debug case correctly. The
    1140     duplicated code is fortunately not very long.
    1141 
    1142 commit 76af4c99bd6122c1dd7b58858b669c919d8c8806
    1143 Author: Peter Stuge <peter@stuge.se>
    1144 Date:   Thu Mar 22 01:52:59 2012 +0100
    1145 
    1146     libusbi.h: Add IS_EPIN() IS_EPOUT() IS_XFERIN() and IS_XFEROUT() macros
    1147    
    1148     The macros make backend code a little simpler to read, since the
    1149     transfer and endpoint direction is checked in several places across
    1150     the supported platforms.
    1151 
    1152 commit e3d0a4cb9e2f9872c9fdbb22d7ded169e111fc8f
    1153 Author: Peter Stuge <peter@stuge.se>
    1154 Date:   Wed Feb 22 14:21:54 2012 +0100
    1155 
    1156     Add LIBUSB_TRANSFER_ADD_ZERO_PACKET flag to indicate need for ZLP
    1157    
    1158     Some protocols which use USB require an extra zero length data packet
    1159     to signal end-of-transfer on bulk endpoints, if the last data packet
    1160     is exactly wMaxPacketSize bytes long.
    1161    
    1162     This flag allows applications to inform libusb about this requirement,
    1163     so that libusb can handle the issue transparently.
    1164    
    1165     At the moment the new flag is only supported on Linux, and submitting
    1166     a transfer with the flag set returns an error at submit time on other
    1167     systems. Hopefully implementations will soon follow for other systems.
    1168    
    1169     References #6.
    1170 
    1171 commit 7e0c747cc5ed0a31f38dff5eb5f03d4043b05ada
    1172 Author: Peter Stuge <peter@stuge.se>
    1173 Date:   Sun Feb 19 06:58:16 2012 +0100
    1174 
    1175     libusb.h: Add comma after last value in enums to ease future expansion
    1176 
    1177 commit c20ec7a927c05e0b960269751c26ab2b6e0b39ab
    1178 Author: Peter Stuge <peter@stuge.se>
    1179 Date:   Sun Feb 19 05:39:33 2012 +0100
    1180 
    1181     Linux: Rework bulk continuation check to generic kernel version check
    1182    
    1183     The old check_flag_bulk_continuation() tested for one specific running
    1184     kernel version. The new kernel_version_ge() instead allows to test the
    1185     running kernel version against major, minor and sublevel parameters.
    1186 
    1187 commit cf8f5a7be821099b143fcea8e4ba553daa22818b
    1188 Author: Peter Stuge <peter@stuge.se>
    1189 Date:   Sun Feb 19 05:32:10 2012 +0100
    1190 
    1191     OpenBSD: Correctly catch attempts to do isochronous OUT transfers
    1192    
    1193     LIBUSB_ENDPOINT_OUT is the value of the direction bit, which is 0 for
    1194     OUT transfers, so the previous condition could never evaluate to true.
    1195 
    1196 commit ae8e86cffb81858af5eeddbf2ea1aec6d55f573d
    1197 Author: Peter Stuge <peter@stuge.se>
    1198 Date:   Sun Feb 19 00:42:20 2012 +0100
    1199 
    1200     Darwin: Do not reject devices with product id 0x0000
    1201    
    1202     Fixes #128.
    1203 
    1204 commit 4630fc22cff8ad3e1afa9b223378c0aabe282b5c
    1205 Author: Peter Stuge <peter@stuge.se>
    1206 Date:   Mon Feb 13 16:59:51 2012 +0100
    1207 
    1208     Do not call timerfd functions when timerfd is not being used
    1209    
    1210     When libusb was built with timerfd support but used on a system
    1211     without timerfd support the library would hang indefinitely on
    1212     completion of the first transfer, since timerfd functions were
    1213     being called unconditionally and the error returned when timerfd
    1214     was not being used caused a confused internal state.
    1215    
    1216     Many thanks to Ivo Smits for looking into the issue, proposing
    1217     an initial solution, and helping with testing! Fixes #73.
    1218 
    1219 commit c40f3df1efbb9232b525e5f675746762ca2304b8
    1220 Author: Michael Plante <michael.plante@gmail.com>
    1221 Date:   Sun Feb 12 13:49:35 2012 -0500
    1222 
    1223     Windows: Fix MSVC6 IDE warning on line continuation in libusb-1.0.rc
    1224    
    1225     * libusb\libusb-1.0.rc(21): Could not find the file LIBUSB_RC.
    1226     * only shows up first time after opening workspace.
    1227     * shows up on either build or clean.
    1228     * not actually due to rc.exe, but prior to it.
    1229     * probably an IDE bug.
    1230     * does not show up when running an exported makefile.
    1231    
    1232     Signed-off-by: Michael Plante <michael.plante@gmail.com>
    1233 
    1234 commit 5526841023101bafa280755c3bd19fc44b9c32a0
    1235 Author: Pete Batard <pete@akeo.ie>
    1236 Date:   Sat Jan 7 23:30:23 2012 +0000
    1237 
    1238     Windows: Add Renesas SuperSpeed support for libusb_get_device_speed()
    1239    
    1240     * tests conducted using a Renesas PCIE USB 3.0 controller and driver and
    1241       a mass storage USB 3.0 confirm that USB_NODE_CONNECTION_INFORMATION_EX
    1242       uses (undocumented) value 3 for SuperSpeed
    1243 
    1244 commit 3df437680f8f5406795ec5f32d96612d327b2ca4
    1245 Author: Peter Stuge <peter@stuge.se>
    1246 Date:   Fri Feb 10 18:06:43 2012 +0100
    1247 
    1248     autogen.sh: Try to use libtoolize before trying glibtoolize
    1249    
    1250     This helps on Mac OS X where an old glibtoolize is included in the
    1251     system and newer, manually installed, versions provide libtoolize.
    1252    
    1253     See also http://marc.info/?m=132490560131894
    1254 
    1255 commit 4afbc78fe09bfc3dd7a609e5f82e9272c9e6226d
    1256 Author: Peter Stuge <peter@stuge.se>
    1257 Date:   Wed Feb 8 15:54:21 2012 +0100
    1258 
    1259     Rename the lsusb example program to listdevs
    1260    
    1261     This is intended to reduce confusion with the much more significant
    1262     lsusb utility which is part of the usbutils package.
    1263 
    1264 commit 57ab55159298b7057e0dd9b3854f7fd1550588ed
    1265 Author: Sean McBride <sean@rogue-research.com>
    1266 Date:   Fri Dec 9 13:44:21 2011 -0500
    1267 
    1268     core.c: Fix clang warning about useless store to a variable
    1269 
    1270 commit 32bbbd133e24c24d02646c0f7d1963404d4955f2
    1271 Author: Sean McBride <sean@rogue-research.com>
    1272 Date:   Fri Dec 9 13:43:46 2011 -0500
    1273 
    1274     Darwin: Clarify comments on event thread creation and termination
    1275 
    1276 commit 6cf3285a4e0dfaec0fe53b8eb6a9281e3c5bcb6c
    1277 Author: Sean McBride <sean@rogue-research.com>
    1278 Date:   Fri Dec 9 13:43:46 2011 -0500
    1279 
    1280     Darwin: Fix incorrect mutex protection of libusb_darwin_acfl global
    1281 
    1282 commit 662ced422cf1ffce68753296a81dccf87f3a1c57
    1283 Author: Sean McBride <sean@rogue-research.com>
    1284 Date:   Fri Dec 9 13:43:46 2011 -0500
    1285 
    1286     Darwin: Use retained runloop variable instead of CFRunLoopGetCurrent()
    1287 
    1288 commit 952a9bb6116afc69c4bae4714c2eb0713bf62a6d
    1289 Author: Sean McBride <sean@rogue-research.com>
    1290 Date:   Fri Dec 9 13:37:22 2011 -0500
    1291 
    1292     Darwin: Fix libusb_init() and libusb_exit() refcount race condition
    1293    
    1294     Use OSAtomicIncrement32Barrier() and OSAtomicDecrement32Barrier()
    1295     in darwin_init() and darwin_exit() to be thread safe.
    1296 
    1297 commit 721cc1c19fc8e88c4482ab3d1e8a34fa100c403c
    1298 Author: Sean McBride <sean@rogue-research.com>
    1299 Date:   Fri Dec 9 13:33:28 2011 -0500
    1300 
    1301     threads_posix.c: Fix prototype warning by including threads_posix.h
    1302 
    1303 commit f6ef0fca4b36657c1a0885c18cc4c4afcb4f7339
    1304 Author: Dave Camarillo <dave.camarillo@gmail.com>
    1305 Date:   Fri Sep 23 11:56:58 2011 +0100
    1306 
    1307     Windows: Fix crash during enumeration with >= 64 connected devices
    1308    
    1309     * indexes were outgrowing the unref_list array before realloc,
    1310       resulting in out of bound access and crash.
    1311 
    1312 commit e280760331e8b39ad3530235653644654166b322
    1313 Author: Pete Batard <pbatard@gmail.com>
    1314 Date:   Tue Oct 26 16:31:13 2010 +0100
    1315 
    1316     Windows MSVC6: Remove SetupAPI, AdvAPI32 and OLE32 dependencies
    1317    
    1318     * this ensures that libusb dependent applications only need
    1319       to link with libusb on Windows
    1320     * (copied from Pete's msvc08 mods to msvc6 by Michael)
    1321 
    1322 commit fa66c93253855c9146011a6854d65df6d390039f
    1323 Author: Pete Batard <pbatard@gmail.com>
    1324 Date:   Tue Dec 13 21:18:10 2011 -0500
    1325 
    1326     Windows: Output an error message on calls to libusb_get_pollfds()
    1327    
    1328     Signed-off-by: Michael Plante <michael.plante@gmail.com>
    1329 
    1330 commit 637145ed29ee7c7b13ac45d10cf1f798fc06cbd9
    1331 Author: Pete Batard <pbatard@gmail.com>
    1332 Date:   Thu Jun 3 22:14:20 2010 -0500
    1333 
    1334     io.c: Fix comment since pthreads isn't the only threading libusb uses
    1335 
    1336 commit bb37939ab44a54a054f73e2f381808b12fb9cb33
    1337 Author: Michael Plante <michael.plante@gmail.com>
    1338 Date:   Mon Aug 2 19:59:12 2010 -0500
    1339 
    1340     libusb.h: Cast in libusb_get_string_descriptor() to avoid MSVC6 warning
    1341    
    1342     On MSVC6 bitwise OR promotes to int, causing the warning.
    1343 
    1344 commit ca09754471acba9a22fe8fc09170e5660d1d5c5d
    1345 Author: Michael Plante <michael.plante@gmail.com>
    1346 Date:   Fri Dec 23 16:50:21 2011 -0600
    1347 
    1348     Windows: guid_to_string() is only discarded when macro-usbi_dbg used
    1349    
    1350     * usbi_dbg encloses all references to guid_to_string
    1351     * MinGW/cygwin warn about an unused function, so the #if
    1352       squelches this warning
    1353     * MSVC6 uses a variadic function form of usbi_dbg instead
    1354       of a macro, so the compiler still "sees" guid_to_string
    1355       and it therefore needs to always be defined for MSVC6,
    1356       even if it's only a stub.
    1357     * So we define it if usbi_dbg is used OR if MSVC6 is used.
    1358    
    1359     Signed-off-by: Michael Plante <michael.plante@gmail.com>
    1360 
    1361 commit 8e15adcb0089882d10269ab77d35e193770ab90e
    1362 Author: Pete Batard <pete@akeo.ie>
    1363 Date:   Tue Nov 15 01:11:12 2011 +0000
    1364 
    1365     Windows: Fix undefined datatype 'LONG_PTR' in MSVC6
    1366    
    1367     * issue reported by Elmi
    1368    
    1369     Signed-off-by: Michael Plante <michael.plante@gmail.com>
    1370 
    1371 commit 17ad642cae618cc09c5516612fa3880d4b6b8635
    1372 Author: Pete Batard <pete@akeo.ie>
    1373 Date:   Sun Nov 13 23:10:15 2011 +0000
    1374 
    1375     Windows: Fix for MSVC6 preprocessor not accepting blank parameters
    1376    
    1377     * unlike later iterations of Visual Studio, MSVC6 does not accept
    1378       blank parameters on macro calls [eg. CALL(a, ,b)]
    1379     * blank params were used with the DLL_DECLARE and DLL_LOAD macros
    1380     * issue reported by Elmi
    1381 
    1382 commit c591a7cbf7dbc6fbb4368e65cf58a8cd02582aeb
    1383 Author: Michael Plante <michael.plante@gmail.com>
    1384 Date:   Tue Oct 26 11:39:38 2010 +0100
    1385 
    1386     Windows: Switch MSVC6 .dsp project files from MBCS to Unicode
    1387    
    1388     * MBCS (which is different from UTF-8) only makes sense if
    1389       supporting Windows 95/98, which we don't
    1390     * (try to match Pete's vcproj changes in MSVC6)
    1391 
    1392 commit 536e424fd7d057fc3f20f9939f9de4572e51c815
    1393 Author: Michael Plante <michael.plante@gmail.com>
    1394 Date:   Tue Dec 13 21:39:40 2011 -0500
    1395 
    1396     Windows: Add missing MSVC6 lsusb.dsp project file
    1397    
    1398     Signed-off-by: Michael Plante <michael.plante@gmail.com>
    1399 
    1400 commit c56828857eb7ba6fb4f7701693dbb3fe4e75d5f6
    1401 Author: Martin Pieuchot <mpi@openbsd.org>
    1402 Date:   Mon Jan 30 09:59:30 2012 +0100
    1403 
    1404     OpenBSD backend
    1405 
    1406 commit d2285744c7fa4007bb411be354268209d350b0f2
    1407 Author: Xiaofan Chen <xiaofanc@gmail.com>
    1408 Date:   Fri Jan 13 18:07:34 2012 +0100
    1409 
    1410     configure.ac: Darwin: Move -lobjc from LIBS to PC_LIBS_PRIVATE
    1411    
    1412     Since commit 40327cd134718475f6cec8935b856d4fdff2099c it is neccessary
    1413     to explicitly include -lobjc not only when linking libusb itself, but
    1414     also for programs linking statically against libusb. References #63.
    1415    
    1416     See also http://marc.info/?m=132505900202378
    1417 
    1418 commit 93b0e09d53ed1d177631af9182378492481a790a
    1419 Author: Xiaofan Chen <xiaofanc@gmail.com>
    1420 Date:   Fri Jan 13 13:04:00 2012 +0100
    1421 
    1422     examples: Link only with ../libusb/libusb-1.0.la and not with -lusb-1.0
    1423    
    1424     Previous _LDFLAGS included both the freshly built libusb in ../libusb
    1425     and -lusb-1.0, where libtool would usually resolve the latter to an
    1426     already-installed libusb library in the system. The extra reference
    1427     to a second libusb library resulted in failure to build examples on
    1428     Mac OS X in some cases, and is plain wrong.
    1429    
    1430     See also the thread at http://marc.info/?m=132637593623667
    1431 
    1432 commit cdc5df8f1b206a7c19bc221e8a9a97d5d98deb85
    1433 Author: Peter Stuge <peter@stuge.se>
    1434 Date:   Thu Jan 12 10:34:55 2012 +0100
    1435 
    1436     libusb/Makefile.am: Avoid recursive variables in .rc silent-rule
    1437    
    1438     Not every make supports recursive variable expansion so some automake
    1439     versions complain about non-POSIX variable names ever since commit
    1440     70bec4a9f8ec28d36c731011fa24d37c74ad3523 which added support for
    1441     silent-rules in our rule to compile the Windows .rc file.
    1442    
    1443     This commit removes the recursive variables and instead uses the
    1444     simple and generic GEN message and associated variable.
    1445 
    1446 commit a8e2e7cab278fbfcba91909eaf762cf66da9eda5
    1447 Author: Ludovic Rousseau <ludovic.rousseau+github@gmail.com>
    1448 Date:   Sat Sep 24 18:27:54 2011 +0200
    1449 
    1450     Core: Fix #122 warning: no previous prototype for ‘usbi_log_v’
    1451    
    1452     Declare the usbi_log_v() function before using it.
    1453 
    1454 commit e88ecb1e65604c222f82da586bb9e9066d66fbba
    1455 Author: Sean McBride <sean@rogue-research.com>
    1456 Date:   Fri Oct 14 14:40:29 2011 -0400
    1457 
    1458     Darwin: Set a name for the background thread on Mac OS X 10.6 and later
    1459    
    1460     The call to pthread_setname_np() makes it easy to identify the
    1461     background thread in the Xcode debugger and in crash reports.
    1462 
    1463 commit 60bad550dcb31a315a667a6614c52f712c82f45f
    1464 Author: Peter Stuge <peter@stuge.se>
    1465 Date:   Thu Sep 22 21:42:35 2011 +0200
    1466 
    1467     libusb/Makefile.am: Add libusb-1.0.rc dependency on version.h
    1468 
    1469 commit 70bec4a9f8ec28d36c731011fa24d37c74ad3523
    1470 Author: Peter Stuge <peter@stuge.se>
    1471 Date:   Thu Sep 22 21:38:29 2011 +0200
    1472 
    1473     libusb/Makefile.am: Make the libusb-1.0.rc rule support silent-rules
    1474 
    1475 commit fa9b682a638e54a4556ef6bd343ef56d6300a520
    1476 Author: Peter Stuge <peter@stuge.se>
    1477 Date:   Thu Sep 22 21:17:37 2011 +0200
    1478 
    1479     configure.ac: Enable libtool support for Windows Resource language
    1480 
    1481 commit 58c73ddca310f757fc7ca75197bf3d7ca58ce29a
    1482 Author: Sean McBride <sean@rogue-research.com>
    1483 Date:   Mon Sep 19 12:52:44 2011 -0400
    1484 
    1485     descriptor.c: Use size_t for minor 64 bit compliance improvement
    1486    
    1487     Fixes #121.
    1488 
    1489 commit 27ec326a9f1bff4481702b35f39897c65a5db586
    1490 Author: Sean McBride <sean@rogue-research.com>
    1491 Date:   Mon Sep 19 12:42:33 2011 -0400
    1492 
    1493     Darwin: Fix warnings about mismatched signed/unsigned compare
    1494    
    1495     References #121.
    1496 
    1497 commit 59cc79f2c8e5da41fe2c761bf1e1d9cd18ddac81
    1498 Author: Sean McBride <sean@rogue-research.com>
    1499 Date:   Mon Sep 19 12:38:20 2011 -0400
    1500 
    1501     Fix unused variable warnings when without timerfd and/or when on Darwin
    1502    
    1503     References #121.
    1504 
    1505 commit 1cc5b4a9fb984e83681ae5c797fa6b22bc20f809
    1506 Author: Ludovic Rousseau <ludovic.rousseau+github@gmail.com>
    1507 Date:   Fri Sep 16 18:07:56 2011 +0200
    1508 
    1509     Correctly handle LIBUSB_TRANSFER_OVERFLOW in libusb_control_transfer()
    1510    
    1511     sync.c: In function `libusb_control_transfer':
    1512     sync.c:122: warning: enumeration value `LIBUSB_TRANSFER_OVERFLOW' not
    1513     handled in switch
    1514    
    1515     Fixes #120.
    1516 
    1517 commit c55f581f43885f8576d8e2ebf4d46cd7ff3c1030
    1518 Author: Pete Batard <pete@akeo.ie>
    1519 Date:   Mon Sep 19 16:01:37 2011 +0100
    1520 
    1521     Windows: do not set altsetting 0 as part of libusb_release_interface()
    1522    
    1523     * pointed out by Travis Robinson and Xiaofan Chen
    1524     * similar to a change advised by Alan Stern for the Linux kernel:
    1525       http://marc.info/?m=122790204410765
    1526 
    1527 commit efd3fae8f95ef7797ecd4b5731b198f100007d6a
    1528 Author: Pete Batard <pete@akeo.ie>
    1529 Date:   Mon Sep 19 15:45:35 2011 +0100
    1530 
    1531     Windows: fix communication with hubs
    1532    
    1533     * issue reported by René Haunstrup in http://marc.info/?m=130503019227814
    1534 
    1535 commit a8d1eb7963e5811e16e8fb7e157cf3a00d888347
    1536 Author: Pete Batard <pete@akeo.ie>
    1537 Date:   Mon Sep 19 15:41:39 2011 +0100
    1538 
    1539     Windows: add USB 3.0 controller support
    1540    
    1541     * Windows 8, NEC/Renesas, TI, Fresco Logic, Etron, VIA, ASMedia
    1542       (some of which untested!)
    1543     * includes workaround for NEC/Renesas USB 3.0 root hubs
    1544 
    1545 commit 48a19497bdd14325738ac9197d8cf4ebe1daa2d4
    1546 Author: Pete Batard <pete@akeo.ie>
    1547 Date:   Mon Sep 19 15:28:03 2011 +0100
    1548 
    1549     Windows: add static keywords and drop duplicated or unneeded code
    1550 
    1551 commit af407286ba2fd346755297e56e365d84b98090d5
    1552 Author: Pete Batard <pete@akeo.ie>
    1553 Date:   Mon Sep 19 13:59:46 2011 +0100
    1554 
    1555     Windows: fix 'windows_error_str' defined but not used when not logging
    1556 
    1557 commit abc3143ba1989a48f62246c2afb0eb4c3c5f7917
    1558 Author: Peter Stuge <peter@stuge.se>
    1559 Date:   Thu Sep 22 10:19:17 2011 +0200
    1560 
    1561     libusbi.h: Silence unused context variable warnings when not logging
    1562 
    1563 commit 69b71c896a153a307360cf21be67b3b6e1e09a2d
    1564 Author: Pete Batard <pete@akeo.ie>
    1565 Date:   Mon Sep 19 13:06:22 2011 +0100
    1566 
    1567     Windows: copy DLL file regardless of ddk_build.cmd dll argument case
    1568 
    1569 commit fdbac8971212bda3a42feeeaeb92fd8e49c7e904
    1570 Author: Pete Batard <pete@akeo.ie>
    1571 Date:   Sun Sep 18 20:06:45 2011 +0100
    1572 
    1573     Windows: Add uint32_t typedef for old MSC so that DDK can build lsusb
    1574 
    1575 commit c471d55e909d84012f065715703dad454d1fa421
    1576 Author: Vitali Lovich <vlovich@gmail.com>
    1577 Date:   Fri Sep 16 08:53:25 2011 -0600
    1578 
    1579     Darwin: fix port leak in darwin_clock_gettime()
    1580 
    1581 commit 477f3917f8c123e36993f9c0ba8156ca0f16ccfa
    1582 Author: Vitali Lovich <vlovich@gmail.com>
    1583 Date:   Fri Sep 16 08:50:40 2011 -0600
    1584 
    1585     Darwin: remove unnecessary run loop invalidation during libusb_exit()
    1586 
    1587 commit f52094f37ccaff8137f5ce39867d2dba9b0f6bf9
    1588 Author: Vitali Lovich <vlovich@gmail.com>
    1589 Date:   Fri Sep 16 08:49:54 2011 -0600
    1590 
    1591     Darwin: fix port leak during libusb_exit()
    1592 
    1593 commit 8a2f7b5c0520e6099f2c624cd0994c60867c1628
    1594 Author: Vitali Lovich <vlovich@gmail.com>
    1595 Date:   Fri Sep 16 08:48:28 2011 -0600
    1596 
    1597     Darwin: fix potential leak on libusb_claim_interface() error
    1598 
    1599 commit b1ee2ef8d0b67dcc51c15742cb2decb386cffd9b
    1600 Author: Nathan Hjelm <hjelmn@me.com>
    1601 Date:   Fri Sep 16 08:41:01 2011 -0600
    1602 
    1603     Darwin: Fix #117 transfer size 64/32 bit issue for transfer callbacks
    1604    
    1605     The transfer size is now always truncated to 32 bits.
    1606 
    1607 commit c407a2d97b6f8715d3452257a0adac40a20178e6
    1608 Author: Peter Stuge <peter@stuge.se>
    1609 Date:   Thu Sep 15 17:04:43 2011 +0200
    1610 
    1611     Remove username from SF FRS rsync upload command
    1612 
    1613 commit cbc2d7b2de58cf5fb02d9e5a39be0870527f8632
    1614 Author: Peter Stuge <peter@stuge.se>
    1615 Date:   Thu Sep 15 16:48:35 2011 +0200
    1616 
    1617     Support release candidate versions in configure.ac and libusb-1.0.rc
    1618 
    1619 commit 384a528ed7adde935681313dacc5cd79e4be9ea1
    1620 Author: Peter Stuge <peter@stuge.se>
    1621 Date:   Thu Sep 15 16:32:47 2011 +0200
    1622 
    1623     Tidy .gitignore a little
    1624    
    1625     There's no xusb, we need a glob pattern for matching .exe files, and
    1626     fpusb tarballs aren't very common in the libusb source dir.
    1627 
    1628 commit 9ad3643391a7fc6ce97aa77ffaf97d244fd9e613
    1629 Author: Hans de Goede <hdegoede@redhat.com>
    1630 Date:   Wed Sep 14 10:53:48 2011 +0200
    1631 
    1632     Docs: Clarify that libusb_handle_events_timeout() tv param can't be NULL
    1633    
    1634     The example code and API doc for libusb_handle_events_timeout() could be
    1635     interpreted as it being OK to pass a NULL pointer for the tv argument (I
    1636     interpreted it like that when I first started coding for libusb).
    1637    
    1638     This patch changes the docs to make it clear that one must always supply
    1639     a tv struct to libusb_handle_events_timeout.
    1640    
    1641     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1642 
    1643 commit e1c06fb070c1328a3b78c7da8b9e779d466edd97
    1644 Author: Peter Stuge <peter@stuge.se>
    1645 Date:   Wed Sep 14 08:23:43 2011 +0200
    1646 
    1647     Makefile.am: Do not remove ChangeLog on make distclean, fixes #116
    1648    
    1649     [pbatard: Remove it on make maintainer-clean instead]
    1650 
    1651 commit 0c5bf03eb829e51dcf19562fc4f745937235ea51
    1652 Author: Vitali Lovich <vlovich@aliph.com>
    1653 Date:   Wed Sep 14 07:02:06 2011 +0200
    1654 
    1655     Darwin: Reduce race likelihood between cancellation and device disconnect
    1656    
    1657     References #88. The race condition still remains, but this change
    1658     makes it less likely to trigger.
    1659 
    1660 commit 3e6e257f55156c4600f3116a0befba8cee62872a
    1661 Author: Peter Stuge <peter@stuge.se>
    1662 Date:   Wed Sep 14 04:00:33 2011 +0200
    1663 
    1664     Document that libusb_get_device_list() can return any libusb_error code
    1665    
    1666     Fixes #87.
    1667 
    1668 commit 737ba04ea40f19564b445fbb489907529e75edc9
    1669 Author: Pete Batard <pbatard@gmail.com>
    1670 Date:   Thu Jun 16 10:49:13 2011 +0100
    1671 
    1672     Linux: Fix #81 URB double free race condition on device disconnect
    1673    
    1674     A submitted transfer that has just been failed by the kernel could be
    1675     picked up by an event handler to be cleaned up, where freeing of URB
    1676     memory would race with the submit function doing it's own cleanup and
    1677     freeing as a result of the submit failing.
    1678    
    1679     libusb_submit_transfer() always holds itransfer->lock, so the race can
    1680     be avoided by taking that lock also in the cleanup path and checking
    1681     that the URB memory has not already been freed before freeing it there.
    1682    
    1683     As http://libusb.org/ticket/81#comment:14 notes there is still another
    1684     possible, but unlikely, race condition between libusb_submit_transfer()
    1685     and an event handling thread. That will require more work to solve.
    1686    
    1687     [stuge: Add check in cleanup path that URBs have not already been freed]
    1688 
    1689 commit 1b0f758a334d78d3832d17d694ac0c931da36050
    1690 Author: Peter Stuge <peter@stuge.se>
    1691 Date:   Wed Sep 14 03:00:14 2011 +0200
    1692 
    1693     Add libusb_error_name() API function
    1694    
    1695     Until we have i18ned error messages we can at least offer easy
    1696     translation from numeric error code to the error code's name.
    1697    
    1698     [hansg: switch() on enum to get a compiler warning if a case is missing]
    1699     [hansg: Better return value when called with an unknown error code]
    1700     [hansg: Fix DEFAULT_VISIBILITY in definition to compile on all platforms]
    1701 
    1702 commit e16805130a04b2642891e86b8f479e6343ca17da
    1703 Author: Peter Stuge <peter@stuge.se>
    1704 Date:   Wed Sep 14 02:30:18 2011 +0200
    1705 
    1706     Add libusb_has_capability() API function
    1707    
    1708     Since it is currently not planned to change the filename of the libusb
    1709     library between libusb-1.0 versions at least on Windows systems it's
    1710     important to have a capability API.
    1711    
    1712     Currently there exists only one capability; LIBUSB_CAP_HAS_CAPABILITY,
    1713     which tests support for the libusb_has_capability() API.
    1714 
    1715 commit 2dc2fa2a56408e515d25359323b4ea2f1bbec14a
    1716 Author: Sebastian Pipping <sebastian@pipping.org>
    1717 Date:   Tue Sep 13 20:38:26 2011 +0200
    1718 
    1719     Fix typos in introductory documentation
    1720 
    1721 commit 0a828082aeedc6d19b6de4e3b10cc9762352fa7f
    1722 Author: Pekka Nikander <pekka.nikander@senseg.com>
    1723 Date:   Tue Sep 13 18:57:43 2011 +0200
    1724 
    1725     Linux: Add libusb_open() debug and error messages with the device path
    1726    
    1727     Fixes #109.
    1728 
    1729 commit 6583372125d73543fe0db9fdc59850b9c6aa50d9
    1730 Author: Pekka Nikander <pekka.nikander@senseg.com>
    1731 Date:   Tue Sep 13 18:52:36 2011 +0200
    1732 
    1733     Add debug message with libusb_open() error code
    1734    
    1735     References #109.
    1736 
    1737 commit f797ecb3b4e653594f8ebc0c9d9e2ca579062779
    1738 Author: Hans de Goede <hdegoede@redhat.com>
    1739 Date:   Mon Sep 12 18:11:20 2011 +0200
    1740 
    1741     Document libusb_handle_events_completed() and _timeout_completed()
    1742    
    1743     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1744     [stuge: Note that the old racy functions should be avoided by new code]
    1745 
    1746 commit 6696512aade99bb15d6792af90ae329af270eba6
    1747 Author: Graeme Gill <graeme2@argyllcms.com>
    1748 Date:   Sat Sep 10 15:47:05 2011 +0200
    1749 
    1750     Fix #56 race condition causing delayed completion of sync transfers
    1751    
    1752     The sync API had a race where it would check a condition to know if it
    1753     needed to call a libusb_handle_events() function. However, the check
    1754     was done outside of the lock that is held while the condition is set,
    1755     so another thread could completely serve whatever was needed to make
    1756     the condition true between it being checked and the event handler being
    1757     called. This situation would be detected after a libusb-internal timeout
    1758     of 60 seconds, after which the transfer would be completed without
    1759     error, but with significant delay.
    1760    
    1761     Original patch at http://marc.info/?l=libusb-devel&m=127252114815709
    1762    
    1763     Changes by Hans de Goede:
    1764     - Renamed the "race-proof" functions from libusb_handle_events*_check()
    1765       to libusb_handle_events*_completed()
    1766     - Drop r = 0 setting in libusb_handle_events_timeout_completed()
    1767       (to make both completed checking cases identical flow wise)
    1768    
    1769     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1770     [stuge: Simplify libusb_handle_events_timeout() change with a goto]
    1771     [pbatard: Fix _handle_events_timeout() and _completed() definitions]
    1772 
    1773 commit cfee5446cdb2974c1e90c7c379a365c495975aef
    1774 Author: Nathan Hjelm <hjelmn@me.com>
    1775 Date:   Fri Aug 26 23:06:40 2011 -0600
    1776 
    1777     Darwin: Use a condition to signal async thread ready in libusb_init()
    1778 
    1779 commit d1bd234f7e1b1ff4168b8f605e2038e87a0e361f
    1780 Author: Nathan Hjelm <hjelmn@me.com>
    1781 Date:   Thu Jul 21 22:34:12 2011 -0600
    1782 
    1783     Fix #64 use of reserved identifiers throughout libusb
    1784 
    1785 commit a97762a8a121de1ad3deb9e861088b69bb6a155b
    1786 Author: Nathan Hjelm <hjelmn@me.com>
    1787 Date:   Thu Jul 21 22:31:09 2011 -0600
    1788 
    1789     Darwin: fix libusb_get_device_list() and libusb_claim_interface() leaks
    1790 
    1791 commit 8723df191fcedc6161732fd06d12df392c6dea3f
    1792 Author: Nathan Hjelm <hjelmn@me.com>
    1793 Date:   Thu Jul 21 22:28:47 2011 -0600
    1794 
    1795     Darwin: use kIOMasterPortDefault instead of creating a master port
    1796 
    1797 commit 0eb7e43759003610d1afe6148aa6ff4f5859ccb0
    1798 Author: Peter Stuge <peter@stuge.se>
    1799 Date:   Wed Jul 27 03:15:03 2011 +0200
    1800 
    1801     Allow devices with zero configurations to be discovered
    1802    
    1803     At least in Linux, wireless USB devices have zero configurations until
    1804     they have been authorized. This device state can be set for any USB
    1805     device using:
    1806    
    1807     echo 0 > /sys/bus/usb/devices/?-?/authorized
    1808    
    1809     An unauthorized device would previously make usbi_sanitize_device()
    1810     return LIBUSB_ERROR_IO, although there really was no I/O error.
    1811    
    1812     Reported-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
    1813 
    1814 commit 5010c3e80423d13acee6eeb4af974e8a9bcdd006
    1815 Author: Peter Stuge <peter@stuge.se>
    1816 Date:   Wed Jul 27 06:17:48 2011 +0200
    1817 
    1818     Linux: Continue enumeration even if one device returns an error
    1819 
    1820 commit 2bf8848fb5c85ace0f445c0820a0c173cf76bf43
    1821 Author: Hans de Goede <hdegoede@redhat.com>
    1822 Date:   Fri Jun 17 10:19:00 2011 +0200
    1823 
    1824     Linux: Handle single- and two-digit kernel versions like 3.0 and 4
    1825    
    1826     The code has been tested with various version strings.
    1827    
    1828     [stuge: Remove bogus string length check and optimize for newer kernels]
    1829 
    1830 commit 0288bf24f91eca9f433ebad91a7eb6c0e3e29133
    1831 Author: Pete Batard <pbatard@gmail.com>
    1832 Date:   Thu Mar 3 18:35:35 2011 +0000
    1833 
    1834     Windows: Provide libusb_get_device_speed() data
    1835    
    1836     * use (currently superspeed unaware) USB_NODE_CONNECTION_INFORMATION_EX
    1837    
    1838     Fixes #45.
    1839    
    1840     [stuge: Explicitly convert OS device speeds to libusb device speeds]
    1841     [pbatard: Add breaks overlooked when adding explicit conversion]
    1842 
    1843 commit 382b7deaadd7e2f1d08c9e921e460bb3abf130b2
    1844 Author: Trygve LaugstÞl <trygvis@inamo.no>
    1845 Date:   Tue Jul 19 23:20:40 2011 +0200
    1846 
    1847     Darwin: Provide libusb_get_device_speed() data
    1848    
    1849     References #45.
    1850 
    1851 commit 44d6319f57e7e2c77347da228ed032e62716b438
    1852 Author: Hans de Goede <hdegoede@redhat.com>
    1853 Date:   Thu Feb 17 15:06:40 2011 +0100
    1854 
    1855     Linux: Provide libusb_get_device_speed() data from sysfs
    1856    
    1857     References #45.
    1858    
    1859     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1860 
    1861 commit c8c40bcbd22abca922ff31c4ed6a75fd7af78b59
    1862 Author: Hans de Goede <hdegoede@redhat.com>
    1863 Date:   Thu Feb 17 13:17:55 2011 +0100
    1864 
    1865     Add new API function libusb_get_device_speed()
    1866    
    1867     Reworked version of my earlier patch, largely modelled after (if not
    1868     copy and pasted from) Trygve LaugstÞl's <trygvis@inamo.no> similar
    1869     commit 5a6541e0d80fb1f21e2b960bc2337a612f9d74fb in
    1870     git://git.libusb.org/libusb-trygvis.git
    1871     http://git.libusb.org/libusb-trygvis.git
    1872     http://git.libusb.org/?p=libusb-trygvis.git;a=commitdiff;h=5a6541e0d
    1873    
    1874     This patch does not add any OS specific code. The supporting code in
    1875     each backend follows in separate patches. References #45.
    1876    
    1877     Signed-off-By: Hans de Goede <hdegoede@redhat.com>
    1878 
    1879 commit 0db8cba7f2c372f0127c7df9724e5a35e93f2069
    1880 Author: Nathan Hjelm <hjelmn@me.com>
    1881 Date:   Sun Mar 20 00:25:44 2011 -0600
    1882 
    1883     Darwin: Improve device enumeration performance
    1884    
    1885     The device location is saved, and later used whenever iterating over
    1886     devices. Fixes #111 and #112.
    1887    
    1888     [stuge: Formatting fixes and split out libusb_get_device_speed() change]
    1889     [stuge: Combine with patch that uses the saved device location]
    1890 
    1891 commit 511ec4301deb516691e39e3df5b90fe28cb2bb0f
    1892 Author: Hans de Goede <hdegoede@redhat.com>
    1893 Date:   Thu Feb 17 12:49:36 2011 +0100
    1894 
    1895     Linux: Use __read_sysfs_attr() to get busnum and devaddr
    1896    
    1897     Remove code duplication.
    1898    
    1899     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1900 
    1901 commit e05bbc59ca7b896e2b825bde59bf883ac8c09f5c
    1902 Author: Hans de Goede <hdegoede@redhat.com>
    1903 Date:   Thu Feb 17 12:45:10 2011 +0100
    1904 
    1905     Linux: Add __read_sysfs_attr() helper function
    1906    
    1907     On Linux we often need to read (postive) integers from sysfs. This patch
    1908     adds a helper function for this. This is a preparation patch for adding
    1909     a libusb_get_device_speed() function to libusb.
    1910    
    1911     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1912 
    1913 commit 20e26dda0f86dafa3436b152e090b5f3410c8ce4
    1914 Author: Hans de Goede <hdegoede@redhat.com>
    1915 Date:   Tue Feb 8 16:37:18 2011 +0100
    1916 
    1917     Linux: Stop kernel from re-attaching in-kernel driver after reset
    1918    
    1919     When an interface is bound to the usbfs driver (iow claimed), the
    1920     kernel will unbind it, and then after the reset do a device_attach
    1921     on the interface, which will bind the default in kernel driver to
    1922     the interface.
    1923    
    1924     So if an app has detached the in kernel driver, and claimed the
    1925     interface and then does a libusb_reset_device. Things end up with
    1926     the interface no longer being bound to the usbfs driver (so no longer
    1927     claimed) and instead it is bound to the in kernel driver (iow the in
    1928     kernel driver is re-attached).
    1929    
    1930     We can stop this from happening by releasing all claimed interfaces
    1931     before the reset, as the kernel will not do the device attach after
    1932     reset, if no driver was bound to the interface before the reset.
    1933    
    1934     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1935 
    1936 commit 4e294dc9848aab86b31d2fff228cf97e7eadf913
    1937 Author: Hans de Goede <hdegoede@redhat.com>
    1938 Date:   Thu Feb 17 12:35:46 2011 +0100
    1939 
    1940     Core: Use USB_MAXINTERFACES rather then sizeof(claimed_interfaces)
    1941    
    1942     claimed_interfaces is a long and thus its size differs on 32
    1943     versus 64 bits, this patch uses USB_MAXINTERFACES instead of
    1944     sizeof(claimed_interfaces) on interface number range checks
    1945     for consistent behavior independent of the arch.
    1946    
    1947     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1948 
    1949 commit a68f956dd4c29d6ed799f04f07a3346317843999
    1950 Author: Hans de Goede <hdegoede@redhat.com>
    1951 Date:   Wed Feb 9 12:40:35 2011 +0100
    1952 
    1953     Linux: Fix warnings seen when compiling with gcc-4.6
    1954    
    1955     Compiling with gcc-4.6 results in the following warnings:
    1956     os/linux_usbfs.c: In function 'op_get_configuration':
    1957     os/linux_usbfs.c:1144:6: warning: variable 'r' set but not used ...
    1958     os/linux_usbfs.c: In function 'op_handle_events':
    1959     os/linux_usbfs.c:2091:40: warning: 'status' may be used uninitialized ...
    1960     os/linux_usbfs.c:2044:6: note: 'status' was declared here
    1961     dpfp.c: In function 'save_to_file':
    1962     dpfp.c:228:9: warning: variable 'ignore' set but not used ...
    1963     dpfp_threaded.c: In function 'save_to_file':
    1964     dpfp_threaded.c:257:9: warning: variable 'ignore' set but not used ...
    1965    
    1966     This patch fixes these. (The second comes from handle_control_completion()
    1967     which gcc seems to inline into op_handle_events().)
    1968    
    1969     Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    1970     [stuge: Add fixes for dpfp examples and update source references]
    1971 
    1972 commit 209b5ccd827039b933b730e3f29abd0d72d3c6c6
    1973 Author: Vitali Lovich <vlovich@aliph.com>
    1974 Date:   Tue Jun 14 08:51:57 2011 +0200
    1975 
    1976     Darwin: Fix #108 crash when a device is unplugged
    1977 
    1978 commit d3543e9140536a9751811b44f8496489be1e6bb7
    1979 Author: Peter Stuge <peter@stuge.se>
    1980 Date:   Mon Jun 13 22:58:23 2011 +0200
    1981 
    1982     libusb.h: Add missing LIBUSB_CLASS_ codes currently defined by usb.org
    1983    
    1984     LIBUSB_CLASS_PHYSICAL
    1985     LIBUSB_CLASS_SMART_CARD
    1986     LIBUSB_CLASS_CONTENT_SECURITY
    1987     LIBUSB_CLASS_VIDEO
    1988     LIBUSB_CLASS_PERSONAL_HEALTHCARE
    1989     LIBUSB_CLASS_DIAGNOSTIC_DEVICE
    1990    
    1991     Per http://www.usb.org/developers/defined_class
    1992 
    1993 commit 08bc7ffb6a3b65afc6795cd048a890ee8da7d954
    1994 Author: Peter Stuge <peter@stuge.se>
    1995 Date:   Mon Jun 13 22:53:40 2011 +0200
    1996 
    1997     libusb.h: Add LIBUSB_CLASS_IMAGE in addition to LIBUSB_CLASS_PTP
    1998    
    1999     The old LIBUSB_CLASS_PTP name is kept for compatibility. Fixes #106.
    2000 
    2001 commit 3d7938d85a33cd98553c0c898a8dd0490826b077
    2002 Author: Peter Stuge <peter@stuge.se>
    2003 Date:   Mon Jun 13 22:52:48 2011 +0200
    2004 
    2005     libusb.h: Fix LIBUSB_CLASS_PRINTER description typo
    2006    
    2007     References #106.
    2008 
    2009 commit 5d0526af1a922afab02cdbdf4bb7078702759571
    2010 Author: Sean McBride <sean@rogue-research.com>
    2011 Date:   Fri Feb 11 11:28:04 2011 -0500
    2012 
    2013     Darwin: Fix #100 warning cast to pointer from integer of different size
    2014 
    2015 commit bb8854ff5680136e29b57505300f131c2646f258
    2016 Author: Sean McBride <sean@rogue-research.com>
    2017 Date:   Mon Jun 13 22:26:43 2011 +0200
    2018 
    2019     configure.ac: Fix #97 clang warning about -fgnu89-inline
    2020    
    2021     Remove the test that sets the flag since GNU89 inline semantics are not
    2022     required by libusb.
    2023    
    2024     [stuge: Also remove reference to the test result]
    2025 
    2026 commit cb3c2e488f298b78027c9d5fc0bec0e5ba27d761
    2027 Author: Pete Batard <pbatard@gmail.com>
    2028 Date:   Wed Jun 15 01:38:58 2011 +0200
    2029 
    2030     Windows: Make cancel_io() in poll_windows.c static
    2031    
    2032     References #97.
    2033 
    2034 commit 6635dbb4acb5ee556a020e431b15c954edfcbd29
    2035 Author: Peter Stuge <peter@stuge.se>
    2036 Date:   Mon Jun 13 22:21:02 2011 +0200
    2037 
    2038     Windows: Make upperize() in windows_usb.h static
    2039    
    2040     References #97.
    2041 
    2042 commit 9479ce9dae3d0dbe2ce693bd02ccceb018a75fe9
    2043 Author: Vitali Lovich <vlovich@aliph.com>
    2044 Date:   Wed Mar 16 17:33:57 2011 -0700
    2045 
    2046     descriptor.c: Fix buffer read overflow caught by valgrind
    2047    
    2048     In parse_interface() an unexpected descriptor would be parsed without
    2049     validating the descriptor's length.  It is possible for size to be 0 at
    2050     this point, which means that the parsing would read past the end of the
    2051     source buffer.  Fix #83 by checking the length of the remaining buffer
    2052     before parsing.
    2053 
    2054 commit c775c2f43037cd235b65410583179195e25f9c4a
    2055 Author: Vitali Lovich <vlovich@aliph.com>
    2056 Date:   Wed Mar 16 19:51:40 2011 -0700
    2057 
    2058     Clean up in-flight transfers and device handle when closing a device
    2059    
    2060     Any in-flight transfers should properly invalidate their references
    2061     to device handles that are being closed.  Additionally, they should be
    2062     removed from the transfer-in-flight list.  This is done with the events
    2063     lock held to protect against another thread processing the same transfer.
    2064     The events lock is initialized as a recursive mutex, because the device
    2065     close code might itself be called while an event is being handled.
    2066     Fixes #82.
    2067    
    2068     [stuge: Trivial rework to reduce indenting]
    2069 
    2070 commit 74282582cc879f091ad1d847411337bc3fa78a2b
    2071 Author: Vitali Lovich <vlovich@aliph.com>
    2072 Date:   Wed Mar 16 19:43:30 2011 -0700
    2073 
    2074     Add recursive mutexes to threading abstraction
    2075    
    2076     This is necessary for the device close path which needs to attain the
    2077     events lock, but which might itself be called while handling an event.
    2078     The events lock is necessary to properly clean up transfers which might
    2079     still be pointing to the device. References #82.
    2080    
    2081     [stuge: Move usbi_mutex_init_recursive() into threads_posix.c]
    2082     [stuge: Must also #define _XOPEN_SOURCE 500 to be able to build]
    2083     [pbatard: Un-inline usbi_mutex_init_recursive() to make Cygwin happy]
    2084 
    2085 commit 8f1bc0659136faf312dabe8fe67380a798299d33
    2086 Author: Vitali Lovich <vlovich@aliph.com>
    2087 Date:   Wed Mar 16 19:48:35 2011 -0700
    2088 
    2089     Add USBI_TRANSFER_CANCELLING and _DEVICE_DISAPPEARED status flags
    2090    
    2091     The flags are used to indicate if a cancellation has started, and if
    2092     a cancellation has failed because the device is no longer available.
    2093     References #82.
    2094 
    2095 commit 87ba8a9ead4fd9e81ae3c5a894f698779de1f2c2
    2096 Author: Vitali Lovich <vlovich@aliph.com>
    2097 Date:   Wed Mar 16 19:50:04 2011 -0700
    2098 
    2099     Linux: Detect and report that device has gone away while discarding URBs
    2100    
    2101     Return LIBUSB_ERROR_NO_DEVICE if the device is no longer available
    2102     (ENODEV) to discard the urbs. References #82.
    2103 
    2104 commit 2c85c363cddd72b9ab425f05e2ee03e0b1df24f1
    2105 Author: Peter Stuge <peter@stuge.se>
    2106 Date:   Mon Jun 6 02:46:46 2011 +0200
    2107 
    2108     libusbi.h: Add comma after last value in enum usbi_transfer_flags
    2109 
    2110 commit 5d7be3e1337f2444097504931ac0f2f0997b2b05
    2111 Author: Peter Stuge <peter@stuge.se>
    2112 Date:   Sun Jun 5 23:28:07 2011 +0200
    2113 
    2114     threads_posix.h: Whitespace fix
    2115 
    2116 commit 18db4813e844fc6929680afcc9b793abcb06876a
    2117 Author: Peter Stuge <peter@stuge.se>
    2118 Date:   Sun Jun 5 23:21:08 2011 +0200
    2119 
    2120     libusb/Makefile.am: Correct threading files in libusb_1_0_la_SOURCES
    2121 
    2122 commit 5f30c81f66e8dd61f8eae16de548697708f9bd18
    2123 Author: Alan Ott <alan@signal11.us>
    2124 Date:   Thu Jul 21 16:37:48 2011 +0200
    2125 
    2126     Linux: Fix #70 race condition in sysfs_get_device_list()
    2127    
    2128     Change the way libusb chooses between using sysfs and usbfs for information
    2129     about the attached devies.  Using the old method, a race condition could
    2130     occur if a device was unplugged just before (or during) the call to
    2131     libusb_get_device_list(), corrupting the internal sysfs_can_relate_devices
    2132     and sysfs_has_descriptors variables and preventing libusb_get_device_list()
    2133     from working in future calls.
    2134    
    2135     The old method was based on the assumption that if certain sysfs files
    2136     (eg: busnum) could not be opened, that indicated an inadequacy of sysfs
    2137     (ie: the running kernel's sysfs version did not contain those files),
    2138     when in reality those files couldn't be opened because the device had
    2139     been unplugged.
    2140    
    2141     The new method checks the adequacy of sysfs during libusb_init()
    2142     (op_init()) and if a sysfs file cannot be opened, it is now assumed that
    2143     it is because the device has been unplugged, not because sysfs is
    2144     inadequate.
    2145    
    2146     Signed-off-by: Alan Ott <alan@signal11.us>
    2147     [stuge: Include closedir() bugfix posted in ticket by Arne Laansoo]
    2148     [stuge: Remove dead code in sysfs_scan_device() found by Hans de Goede]
    2149 
    2150 commit 40327cd134718475f6cec8935b856d4fdff2099c
    2151 Author: Sean McBride <sean@rogue-research.com>
    2152 Date:   Thu Feb 10 17:11:29 2011 -0500
    2153 
    2154     Darwin: Fix #63 error when apps use Objective-C garbage collection
    2155 
    2156 commit 3ba2fae24886fec89410e5f2295f65363edcc2df
    2157 Author: Sean McBride <sean@rogue-research.com>
    2158 Date:   Fri Feb 5 11:50:34 2010 -0500
    2159 
    2160     Darwin: Fix #28 clang analyzer warning about unbalanced retain/release
    2161 
    2162 commit b67120f047f7eafa15c88c66fa61cef40805ec1f
    2163 Author: Sean McBride <sean@rogue-research.com>
    2164 Date:   Fri Feb 5 11:50:34 2010 -0500
    2165 
    2166     io.c: Fix clang analyzer warning about unused variable
    2167    
    2168     References #28.
    2169 
    2170 commit 51af85d03a098d7d99ea544e8e9535b5476bab33
    2171 Author: Peter Stuge <peter@stuge.se>
    2172 Date:   Tue May 10 10:44:18 2011 +0200
    2173 
    2174     .gitignore: Add m4 subdirectory created by libtool
    2175 
    2176 commit c569e5b3b314538f45d0b3b6f14ce3dbdfee1be9
    2177 Author: Ludovic Rousseau <rousseau@debian.org>
    2178 Date:   Mon Nov 15 14:45:50 2010 +0100
    2179 
    2180     Linux: Do not include useless pthread.h
    2181    
    2182     The code does not use threads so no need to #include <pthread.h>
    2183     Fixes #74.
    2184 
    2185 commit 82af9f9d440ef49015652c699157cf62020f097a
    2186 Author: Pete Batard <pbatard@gmail.com>
    2187 Date:   Tue Mar 8 17:41:05 2011 +0000
    2188 
    2189     Windows: minor code improvements
    2190    
    2191     * mostly warnings from VS2010's Intellisense
    2192 
    2193 commit 7e636dbe06001b9ac68e452a2fdc05e33fbb4e3a
    2194 Author: Pete Batard <pbatard@gmail.com>
    2195 Date:   Tue Mar 8 17:40:39 2011 +0000
    2196 
    2197     Windows: prevent set_configuration request from being sent using WinUSB
    2198    
    2199     * multiple WinUSB set configuration requests can stall a device and
    2200       WinUSB does not support setting of alt configuration in the first place
    2201     * issue reported and investigated by Xiaofan Chen
    2202 
    2203 commit 578c50c99646e5ebbcfbea653524a519b843ebcd
    2204 Author: Graeme Gill <graeme@argyllcms.com>
    2205 Date:   Tue Mar 8 17:39:16 2011 +0000
    2206 
    2207     Windows: fixed default WinUSB timeout and ineffective policy settings
    2208    
    2209     * default WinUSB timeout was 5 seconds, which may be to small.
    2210       PIPE_TRANSFER_TIMEOUT policy is now set to infinite for all EPs.
    2211     * other WinUSB policy settings were called before the endpoints
    2212       had been set. This is now fixed.
    2213 
    2214 commit 25fa63ea1cfe02e784cb62d3b869fd15e62b5b6e
    2215 Author: Pete Batard <pbatard@gmail.com>
    2216 Date:   Tue Mar 8 17:37:40 2011 +0000
    2217 
    2218     Windows: Don't leak pipe fds
    2219    
    2220     use _open() and _close() rather than _open_osfhandle() and CloseHandle()
    2221    
    2222     * use of CloseHandle() prevented the pipe fds from being
    2223       relinquished on libusb_exit()
    2224     * leaked fds could lead to the OS running out of new fds
    2225       and LIBUSB_ERROR_NO_MEM being returned as a result
    2226     * using _open() avoids _open_osfhandle() redef for cygwin
    2227     * issue reported by Stephano Antonelli
    2228 
    2229 commit 3ccd9bddec316ee4b867959fd7f616eb4d410997
    2230 Author: Peter Stuge <peter@stuge.se>
    2231 Date:   Tue May 10 10:05:29 2011 +0200
    2232 
    2233     Windows: enumeration overhaul
    2234    
    2235     * uses multiple passes in a single call
    2236     * uses a hash table, in anticipation for hotplug
    2237     * adds a (dummy) HUB interface for harmonization
    2238     * adds calloc on device struct creation in core
    2239       (to detect and avoid unnecessary double initialization)
    2240 
    2241 commit bb108cbe39802785d10fe025b74ca5ee19734151
    2242 Author: Pete Batard <pbatard@gmail.com>
    2243 Date:   Tue May 10 00:56:18 2011 +0100
    2244 
    2245     Windows: MS project files part 4 - MSVC6 project files
    2246    
    2247     Fixes #57 and #1.
    2248 
    2249 commit 78896ae99b9c2d5672fc93c5bad0f5e8e75c53ea
    2250 Author: Pete Batard <pbatard@gmail.com>
    2251 Date:   Tue May 10 00:53:09 2011 +0100
    2252 
    2253     Windows: MS project files part 3 - VS2005 project files
    2254    
    2255     References #57.
    2256 
    2257 commit 9e5f4277e379a82f5d32e81db1bd0ffaa6637596
    2258 Author: Pete Batard <pbatard@gmail.com>
    2259 Date:   Tue May 10 00:38:49 2011 +0100
    2260 
    2261     Windows: MS project files part 2 - WDK project files
    2262    
    2263     References #57.
    2264 
    2265 commit c1e75431418cdfc10ec963d823fce479cdae6840
    2266 Author: Pete Batard <pbatard@gmail.com>
    2267 Date:   Tue May 10 00:38:12 2011 +0100
    2268 
    2269     Windows: MS project files part 1 - support files & preliminaries
    2270    
    2271     * adds the MSVC support files used by MSVC6, VS2005 and WDK
    2272     * also adds missing defines required by MS compilers in libusb.h
    2273     * also anticipatory sets .gitattributes for CRLF handling
    2274     * also adds manually maintained .def file for import lib generation
    2275    
    2276     References #57.
    2277 
    2278 commit 85a14f43e0ce27cd47f84fdaeacbaa81cebdb886
    2279 Author: Peter Stuge <peter@stuge.se>
    2280 Date:   Mon May 9 08:12:24 2011 +0200
    2281 
    2282     Move library version number from configure.ac to libusb/version.h
    2283    
    2284     This is neccessary to support native MS builds. The Windows resource
    2285     file libusb/libusb-1.0.rc must include the release version, which was
    2286     previously only available after configure had run and had substituted
    2287     the numbers into a generated libusb/libusb-1.0.rc file.
    2288    
    2289     The version atoms are now stored as CPP style #defines in libusb/version.h
    2290     so that the .rc no longer needs to be generated but can simply include the
    2291     header file and access the version information directly.
    2292    
    2293     The m4 macro LU_DEFINE_VERSION_ATOM() was added to configure.ac to get
    2294     version atoms from libusb/version.h for use in AC_INIT(). The macro
    2295     handles C and C++ style comments in version.h, but can easily be made
    2296     to fail by obscuring the file. Please don't do that.
    2297    
    2298     Tested with MinGW using autoconf, and manual compile of libusb-1.0.rc
    2299     using RC.EXE Version 5.2.3690.0 from Visual C++ 2005 Express Edition.
    2300 
    2301 commit 3481f52b014110f6c291e5a15e79ba774dcdfacf
    2302 Author: Peter Stuge <peter@stuge.se>
    2303 Date:   Tue May 10 08:36:32 2011 +0200
    2304 
    2305     Windows: Debug builds create the same .dll file name as non-debug
    2306    
    2307     Thanks to Pete for pointing this out!
    2308 
    2309 commit 9da8cf5c9ed9bd381a77d8170fc0556edbcce4dc
    2310 Author: Pete Batard <pbatard@gmail.com>
    2311 Date:   Tue Mar 8 17:18:48 2011 +0000
    2312 
    2313     Windows: explicit use of ANSI or WideChar calls
    2314    
    2315     * This is in anticipation of adding MSVC project files
    2316       that use Unicode rather than MBCS
    2317 
    2318 commit ae675c1f49dc00b695fce7296903f60998cc28ed
    2319 Author: Pete Batard <pbatard@gmail.com>
    2320 Date:   Tue Mar 8 17:16:23 2011 +0000
    2321 
    2322     Windows: Remove SetupAPI, AdvAPI32 and OLE32 link-time dependencies
    2323    
    2324     * this ensures that libusb dependent applications only need
    2325       to explicitly link against libusb on Windows
    2326    
    2327     The run-time dependency on Cfgmgr32.dll, OLE32.dll and SetupAPI.dll remains.
    2328 
    2329 commit 356e312511e4892977636da52ec497ad2c716032
    2330 Author: Pete Batard <pbatard@gmail.com>
    2331 Date:   Tue Mar 8 17:12:33 2011 +0000
    2332 
    2333     Add .gitattributes to avoid Windows line ending issues with autocrlf
    2334 
    2335 commit 61c120f025f3dee04eeb88159d7c0403a8bf91fe
    2336 Author: Peter Stuge <peter@stuge.se>
    2337 Date:   Sun Feb 27 09:37:54 2011 +0100
    2338 
    2339     Windows: Touch up FileDescription and ProductName resource strings
    2340 
    2341 commit 99b4ddcd893834a4be8b5884037b650e57ba0ba2
    2342 Author: Peter Stuge <peter@stuge.se>
    2343 Date:   Sun Feb 27 07:20:40 2011 +0100
    2344 
    2345     Windows: Remove emulated direct device access via HID API
    2346    
    2347     Either use a library such as HIDAPI to communicate with HID class
    2348     devices, or replace the kernel driver for the device with one that
    2349     offers support for the complete libusb API.
    2350 
    2351 commit 4be84ab49c838d534d3a1b8a64ffa89774984ee7
    2352 Author: Peter Stuge <peter@stuge.se>
    2353 Date:   Sun Feb 27 06:59:15 2011 +0100
    2354 
    2355     Revert libusb_strerror() until we have i18n and l10n
    2356 
    2357 commit 0e177f22fcc69d9aab6fb410e85f3413f478c94c
    2358 Author: Pete Batard <pbatard@gmail.com>
    2359 Date:   Wed Jan 19 14:00:12 2011 +0000
    2360 
    2361     dpfp_threaded: return instead of pthread_exit() to avoid Cygwin warning
    2362 
    2363 commit e65878f21b0a0bb96debcb292dc03ce3c4ebb701
    2364 Author: Pete Batard <pbatard@gmail.com>
    2365 Date:   Wed Jan 19 13:52:08 2011 +0000
    2366 
    2367     Windows: Rename various variables named "index" to avoid shadow warnings
    2368 
    2369 commit 019bf73bb2677dc7720bc8280527316adcbaa506
    2370 Author: Pete Batard <pbatard@gmail.com>
    2371 Date:   Tue Oct 5 12:50:53 2010 +0100
    2372 
    2373     Windows: Fix logic in enumeration of driver name and port number
    2374 
    2375 commit 24494ed5db27737fc607fc35dda722521c9fe4d4
    2376 Author: Pete Batard <pbatard@gmail.com>
    2377 Date:   Tue Oct 5 12:50:13 2010 +0100
    2378 
    2379     Windows: Allow claiming any interface in composite device using WinUSB
    2380    
    2381     Issue reported by Benjamin Dobell, see #48. The call to
    2382     WinUsb_QueryInterfaceSettings() is removed since it doesn't work
    2383     on any other interface but the first (a WinUSB limitation).
    2384    
    2385     This allows the use of WinUSB.sys in lieu of the usbccgp.sys
    2386     "USB Generic Parent" default driver for composite devices.
    2387 
    2388 commit 9c8e6545f2fbb171f81a9451eaf2d09e1fbc13b3
    2389 Author: Pete Batard <pbatard@gmail.com>
    2390 Date:   Tue Oct 5 12:47:15 2010 +0100
    2391 
    2392     Windows: Allow arbitrary bConfigurationValue in config descriptors
    2393    
    2394     Unlike bInterfaceNumber, bConfigurationValue does not have to be
    2395     either sequential or contiguous. The bConfigurationValue is now
    2396     included in debug output. Fixes #48 reported by Benjamin Dobell.
    2397 
    2398 commit dcd002974e511879320233fd5b0600e06bdc5620
    2399 Author: Thomas Röfer <Thomas.Roefer@dfki.de>
    2400 Date:   Fri Nov 19 22:03:11 2010 +0100
    2401 
    2402     Darwin: Schedule isochronous transfers further in the future
    2403    
    2404     This is required to make OpenKinect transfer data at 30 fps. This
    2405     change was originally made by Theo Watson, and Thomas improved on it.
    2406     The commit came via OpenKinect into libusb thanks to Kyle Machulis and
    2407     Hector Martin. Fixes #66.
    2408 
    2409 commit e83fad33dbaf9f37811da6d4cd9d3be554817944
    2410 Author: Thomas Röfer <Thomas.Roefer@dfki.de>
    2411 Date:   Fri Nov 19 22:03:11 2010 +0100
    2412 
    2413     Darwin: Fix #65 memory leak in submit_iso_transfer()
    2414    
    2415     This was also independently fixed by Hoi-Ho Chan, but Thomas caught
    2416     an additional problem with his fix.
    2417    
    2418     This commit came via OpenKinect into libusb thanks to Kyle Machulis
    2419     and Hector Martin.
    2420 
    2421 commit 1a2d21fe42ad5a157651c787e2f500fc162c325b
    2422 Author: Peter Stuge <peter@stuge.se>
    2423 Date:   Sat Feb 26 04:21:05 2011 +0100
    2424 
    2425     configure.ac: Refactor Windows backend settings into one occurence
    2426    
    2427     The Windows backend is used both with MinGW and Cygwin, and since most
    2428     settings are identical they can be set in one place.
    2429 
    2430 commit 717f47621d18de16b87e237f3740299f43e4ca1c
    2431 Author: Peter Stuge <peter@stuge.se>
    2432 Date:   Mon Nov 15 19:58:51 2010 +0100
    2433 
    2434     configure.ac: Rename AM_LDFLAGS to LTLDFLAGS and actually use them
    2435    
    2436     The new variable name tries to clarify that libtool is being used.
    2437     Linker flags must thus always be specified with -Wl.
    2438    
    2439     Factor out the libtool flag -no-undefined from host specific cases.
    2440     The flag is required to build a Windows DLL, but is correct also for
    2441     the other supported systems.
    2442    
    2443     Also, start actually using LTLDFLAGS in libusb/Makefile.am, so that
    2444     libtool will see the options set by configure.
    2445 
    2446 commit 3cbe5736469c1c52049752c137ae11387e9b079d
    2447 Author: Peter Stuge <peter@stuge.se>
    2448 Date:   Sun Nov 21 23:38:46 2010 +0100
    2449 
    2450     configure.ac: Clean up PC_LIBS_PRIVATE and AM_LDFLAGS
    2451    
    2452     Move linker options for when linking the library itself from
    2453     PC_LIBS_PRIVATE into AM_LDFLAGS. PC_LIBS_PRIVATE should only
    2454     contain flags needed to link applications statically against libusb.
    2455     Fixes #72.
    2456 
    2457 commit ef39d1510580b9fcbacf13443fa7a4e553a9a88e
    2458 Author: Peter Stuge <peter@stuge.se>
    2459 Date:   Fri Feb 25 02:33:29 2011 +0100
    2460 
    2461     configure.ac: Call AC_CONFIG_FILES() for each output file
    2462    
    2463     This avoids a problem with Windows line endings.
    2464 
    2465 commit 6e52ea067711e6e7e1b2882757fb61b11b6f8feb
    2466 Author: Peter Stuge <peter@stuge.se>
    2467 Date:   Sun Nov 21 23:37:27 2010 +0100
    2468 
    2469     configure.ac: Whitespace changes and trivial reordering
    2470 
    2471 commit 44b85dabc3f4efe0918a598f981675aa3765cc26
    2472 Author: Peter Stuge <peter@stuge.se>
    2473 Date:   Sun Nov 21 23:10:35 2010 +0100
    2474 
    2475     configure.ac: Quote AC_COMPILE_IFELSE() input
    2476 
    2477 commit 19d5882c398e49a453ff78494db23b7f4d13c37c
    2478 Author: Peter Stuge <peter@stuge.se>
    2479 Date:   Sun Nov 21 23:09:02 2010 +0100
    2480 
    2481     configure.ac: Define booleans to 1 when set, instead of an empty string
    2482    
    2483     This makes the generated config.h look a lot nicer.
    2484 
    2485 commit c24649d796c8b5c97af79a41856422def2e593bc
    2486 Author: Peter Stuge <peter@stuge.se>
    2487 Date:   Sat Oct 30 22:28:59 2010 +0200
    2488 
    2489     configure.ac: Clean up redundancy and fix LIBS on Linux
    2490    
    2491     LIBS, AM_LDFLAGS, OS_ conditionals and THREADS_POSIX had a bit of
    2492     redundancy throughout the file, and on Linux LIBS ended up missing
    2493     the -pthread flag.
    2494 
    2495 commit 0bd4a4dd89ff64b99ab55bfc0c5782502c10c676
    2496 Author: Peter Stuge <peter@stuge.se>
    2497 Date:   Sat Feb 26 04:08:38 2011 +0100
    2498 
    2499     configure.ac: Touch up Darwin and Cygwin OS messages
    2500 
    2501 commit 16cf11a1213272afd616598fa3aba0941e66ec3c
    2502 Author: Peter Stuge <peter@stuge.se>
    2503 Date:   Sat Oct 30 22:13:05 2010 +0200
    2504 
    2505     configure.ac: Do not use -pthread on Darwin
    2506    
    2507     It's not needed because Darwin has POSIX Threads in libc. Fixes #96.
    2508 
    2509 commit a120747d561929682cd0276ea4c13fb22fad8554
    2510 Author: Peter Stuge <peter@stuge.se>
    2511 Date:   Sat Oct 30 22:07:37 2010 +0200
    2512 
    2513     configure.ac: Check for poll.h, and for nfds_t on Darwin
    2514    
    2515     On Linux, assume nfds_t is always available.
    2516    
    2517     On Darwin, fall back to unsigned int when poll() exists but there
    2518     is no nfds_t, such as on Mac OS X before 10.4.
    2519    
    2520     On Windows (both MinGW and Cygwin), always use unsigned int instead
    2521     of nfds_t, and don't check for poll.h because we use our own poll()
    2522     implementation.
    2523 
    2524 commit 21d03d12f92c0d9bd7990861ca0ebf5009f82799
    2525 Author: Nathan Hjelm <hjelmn@me.com>
    2526 Date:   Tue Oct 5 20:08:08 2010 -0600
    2527 
    2528     Darwin: Add support for control requests on endpoints other than 0
    2529    
    2530     Signed-off-by: Nathan Hjelm <hjelmn@me.com>
    2531 
    2532 commit 9bfacd760b40f1137a7835198c6028cbdaddeb18
    2533 Author: Nathan Hjelm <hjelmn@me.com>
    2534 Date:   Tue Oct 5 23:11:50 2010 -0600
    2535 
    2536     Darwin: Add more error checking for libusb_open()
    2537    
    2538     Now also check the CreateDeviceAsyncEventSource() return code for errors.
    2539    
    2540     Signed-off-by: Nathan Hjelm <hjelmn@me.com>
    2541 
    2542 commit 478cd4a30728595fd742aa192d8149ee4216d4bc
    2543 Author: Peter Stuge <peter@stuge.se>
    2544 Date:   Wed Nov 3 21:46:53 2010 +0100
    2545 
    2546     Core: libusb_get_next_timeout() must consider all flying transfers
    2547    
    2548     If transfer->flags indicated that a transfer had a timeout, but no
    2549     timeout was actually set, then libusb_get_next_timeout() would look
    2550     no further for a timeout, ignoring any transfers later in the list
    2551     which had a timeout set.
    2552    
    2553     Since libusb has an internal 60 second timeout this bug could not
    2554     cause complete lockup, but it could cause a 60 second timeout even
    2555     when a transfer was submitted with a shorter timeout.
    2556 
    2557 commit 7802e4a3e38bcefccf96ae510ec2c6b7a959b8b5
    2558 Author: Ludovic Rousseau <rousseau@debian.org>
    2559 Date:   Mon Nov 15 14:55:51 2010 +0100
    2560 
    2561     Linux: Correctly catch read() errors for sysfs config descriptors
    2562    
    2563     read(2) returns ssize_t (signed) and not size_t (unsigned) or int.
    2564    
    2565     Silence "warning: comparison of unsigned expression < 0 is always false"
    2566     and fix #75.
    2567 
    2568 commit 4c7f3c8c3012bddba058afd2abdda792944fcda1
    2569 Author: Peter Stuge <peter@stuge.se>
    2570 Date:   Sun Jan 23 04:01:25 2011 +0100
    2571 
    2572     Linux: Refactor cancellation into one function for all transfer types
    2573 
    2574 commit 011f1f297bc134188fab9960da1b1b9f0bd541aa
    2575 Author: Peter Stuge <peter@stuge.se>
    2576 Date:   Sun Oct 17 08:19:56 2010 +0200
    2577 
    2578     Linux: Refactor discarding of URBs into a function and return all errors
    2579    
    2580     The Linux backend did not always return errors according to the
    2581     libusb_cancel_transfer() documentation.
    2582 
    2583 commit 26246df19cb4d88954a5aa9ed5f6b859e451df85
    2584 Author: Peter Stuge <peter@stuge.se>
    2585 Date:   Sun Jan 23 04:01:01 2011 +0100
    2586 
    2587     Linux: Set private number of URBs also for control transfers
    2588 
    2589 commit 295c9d12e25bc2dbdd8b42bd67a1f7120f0631a1
    2590 Author: Alan Stern <stern@rowland.harvard.edu>
    2591 Date:   Sun Oct 17 06:57:06 2010 +0200
    2592 
    2593     Linux: cancel URBs in reverse order
    2594    
    2595     In a multi-URB transfer, URBs should be cancelled in reverse order of
    2596     submission. This prevents races that might otherwise occur (after URB N
    2597     is cancelled, data may be transferred for URB N+1 before it too can be
    2598     cancelled). Fixes #8.
    2599 
    2600 commit 07df377a5df25e9c1811b554dc00eb8c40e5b995
    2601 Author: Alan Stern <stern@rowland.harvard.edu>
    2602 Date:   Sun Oct 17 04:17:32 2010 +0200
    2603 
    2604     Linux: report correct value for urb->actual_length
    2605    
    2606     Transferred bytes are returned correctly by the kernel for every URB,
    2607     even when an error occurs.  Hence they should always be included in
    2608     the transfer statistics.  The same is true for isochronous packet
    2609     length and status.
    2610    
    2611     [stuge: set itransfer->transferred so data is stored at correct offset]
    2612 
    2613 commit b26db49208c7a6ef0a99645142af21ce80c57c22
    2614 Author: Alan Stern <stern@rowland.harvard.edu>
    2615 Date:   Fri Oct 22 11:13:34 2010 +0200
    2616 
    2617     Linux: improve reporting of URB error status codes
    2618    
    2619     Fix the way overflow errors are handled (they can occur in any
    2620     transaction, not just the last one in a transfer) and add tests
    2621     for other commonly-occuring error statuses.
    2622 
    2623 commit efc29733ad31f81883a7ac51a6cc6cda9ad4feb9
    2624 Author: Alan Stern <stern@rowland.harvard.edu>
    2625 Date:   Tue Oct 5 11:08:40 2010 -0400
    2626 
    2627     Linux: improve detection of BULK_CONTINUATION kernel support
    2628    
    2629     Clarify the comments describing the BULK_CONTINATION flag, and improve
    2630     the subroutine that checks whether the flag is supported by making it
    2631     "future-proof", i.e., by working properly with kernel version numbers
    2632     higher than 2.6.
    2633 
    2634 commit bd267cf92269e0c4cd8eef795b91eefb2c63452e
    2635 Author: Peter Stuge <peter@stuge.se>
    2636 Date:   Mon Nov 22 05:14:00 2010 +0100
    2637 
    2638     README: Update webpage URL and add Peter's email address
    2639 
    2640 commit 845b715675703c5f1bc907f6302ece416c9f112c
    2641 Author: Peter Stuge <peter@stuge.se>
    2642 Date:   Wed Aug 4 07:30:22 2010 +0200
    2643 
    2644     libusb is not just for Linux!
    2645 
    2646 commit 67d9ef7b6877e17f2deec81cd41dc0948f6bed4b
    2647 Author: Nathan Hjelm <hjelmn@me.com>
    2648 Date:   Tue Oct 5 19:48:39 2010 -0600
    2649 
    2650     Remove USBI_OS_HANDLES_TIMEOUT and fix int/isoc timeouts on Darwin
    2651    
    2652     Backends set USBI_TRANSFER_OS_HANDLES_TIMEOUT for transfers instead.
    2653     Darwin only handles timeouts for bulk and control transfers, so the
    2654     backend now sets that flag accordingly, making libusb core handle
    2655     timeouts for interrupt and isochronous transfers. Fixes #31.
    2656    
    2657     Signed-off-by: Nathan Hjelm <hjelmn@me.com>
    2658    
    2659     [stuge: rework libusb_get_next_timeout() and enum usbi_transfer_flags]
    2660     [stuge: fix typo; set USBI_TRANSFER_TIMED_OUT flag correctly]
    2661 
    2662 commit 370922dfbe0964c0b8a0c1974bb1d7b85ac10607
    2663 Author: Peter Stuge <peter@stuge.se>
    2664 Date:   Sun Nov 14 03:14:00 2010 +0100
    2665 
    2666     Silence "warning: suggest braces around empty body in an 'if' statement"
    2667 
    2668 commit 0f85015bdf87f3bca0d86ed87c9b976176640922
    2669 Author: Konrad Rzepecki <hannibal@astral.lodz.pl>
    2670 Date:   Sat Nov 13 14:09:22 2010 +0100
    2671 
    2672     Disallow libusb_get_string_descriptor_ascii() with index 0
    2673    
    2674     String descriptor 0 is the list of supported language IDs in the device,
    2675     which can't have an ASCII representation. Calling the function with
    2676     index 0 is thus not really useful. Fixes #43.
    2677 
    2678 commit 3b41c31d3fa2c1f93649cc5fc0f59acbf3efd5a1
    2679 Author: Ludovic Rousseau <rousseau@debian.org>
    2680 Date:   Fri Mar 19 15:35:14 2010 +0100
    2681 
    2682     Use const for the usbi_parse_descriptor() format string
    2683    
    2684     Constant strings should be "const char *" instead of "char *". Silence
    2685     "discards qualifiers from pointer target type" warnings. Fixes #61.
    2686 
    2687 commit 7f2e9f0776386997d2b4c4c47598ab88e3caeb7a
    2688 Author: Hector Martin <hector@marcansoft.com>
    2689 Date:   Wed Aug 25 03:21:57 2010 +0200
    2690 
    2691     Linux: Fix usbfs/sysfs config descriptor handling on big-endian
    2692    
    2693     usbfs endian-swaps, sysfs doesn't, not the other way around. Fixes #51;
    2694     descriptor endian parsing is backwards using sysfs on big-endian hosts.
    2695     usbfs is untested.
    2696    
    2697     Signed-off-by: Hector Martin <hector@marcansoft.com>
    2698    
    2699     [stuge: checked against Documentation/usb/proc_usb_info.txt]
    2700 
    2701 commit 2aa8984e59cf0f492e7fbebb8924f54f6160cc5e
    2702 Author: Ludovic Rousseau <rousseau@debian.org>
    2703 Date:   Tue Aug 17 20:53:04 2010 +0200
    2704 
    2705     examples: #include <libusb.h> without directory name
    2706    
    2707     The libusb-1.0 directory name belongs in the compile command, e.g.
    2708     via pkg-config --cflags. Fixes #58.
    2709 
    2710 commit 7da756e09fd97efad2b35b5cee0e2b2550aac2cb
    2711 Author: Ludovic Rousseau <rousseau@debian.org>
    2712 Date:   Thu Jun 24 10:14:24 2010 +0200
    2713 
    2714     Add missing argument to libusb_wait_for_event() documentation, fix #55
    2715    
    2716     In the libusb_wait_for_event() sample code in the section "Letting other
    2717     threads do the work for you" the call to libusb_wait_for_event() was not
    2718     updated by commit 1df713d622ab4f0b03aad72d903ac7beb8fb3b90, which added
    2719     the libusb_context *ctx parameter to the function, so the sample code
    2720     was broken until now.
    2721 
    2722 commit 678c242705b29f9cb6cc421b5625a6485ae58047
    2723 Author: Peter Stuge <peter@stuge.se>
    2724 Date:   Sat Oct 16 14:22:30 2010 +0200
    2725 
    2726     examples: Silence warnings about return value of fwrite()
    2727 
    2728 commit 9cd9059bf9baac69a9d6c909f4c1e000592fa260
    2729 Author: Peter Stuge <peter@stuge.se>
    2730 Date:   Sat Oct 16 11:47:14 2010 +0200
    2731 
    2732     Linux: Don't free() URBs prematurely on hardware error; fix #54
    2733    
    2734     When an URB in a multi-URB transfer had an error, handle_bulk_completion()
    2735     would free all URBs and segfault once the next one completed, instead of
    2736     cancelling the remaining URBs and cleaning up as usual.
    2737    
    2738     This is basically the patch from the ticket, plus some restructuring
    2739     for increased readability of the function.
    2740    
    2741     Many thanks to Brian Shirley and National Instruments for finding and
    2742     fixing this!
    2743 
    2744 commit 116d34f608b02f4e14668450b158acf5db726f95
    2745 Author: Pete Batard <pbatard@gmail.com>
    2746 Date:   Tue Oct 5 12:43:41 2010 +0100
    2747 
    2748     Windows: add support for filter drivers
    2749    
    2750     * precedence is driver > upper filter > lower filter, and defined
    2751       in struct driver_lookup lookup from set_device_paths()
    2752 
    2753 commit eb833fcd837e3aac2e497438b14c8612254c28ce
    2754 Author: Pete Batard <pbatard@gmail.com>
    2755 Date:   Tue Oct 5 12:36:49 2010 +0100
    2756 
    2757     Windows: fix errcode shadow warning, and string and DLL_DECLARE fixes
    2758    
    2759     * use FormatMessageA, and overall improvement of windows_error_str()
    2760     * use safe_strlen() always
    2761     * better typing/init default
    2762     * more explicit debug message for devices with no driver
    2763 
    2764 commit 1feadb5f78e1d2cdfd2aaf0011e041c2848bae37
    2765 Author: Pete Batard <pbatard@gmail.com>
    2766 Date:   Tue Oct 5 12:29:32 2010 +0100
    2767 
    2768     Windows: use IOCTLs for HID input, output and feature reports
    2769    
    2770     * fixes feature reports not providing actual read size
    2771       (reported by Axel Rohde http://marc.info/?m=127033070021994)
    2772     * removes the USE_HIDD_FOR_REPORTS macro
    2773     * IOCTL usage inspired from HIDAPI by Alan Ott
    2774 
    2775 commit d7c25451f4075d2a12eb5cbc91ff3de8c0292da0
    2776 Author: Daniel Drake <dan@reactivated.net>
    2777 Date:   Mon Oct 4 20:03:58 2010 +0100
    2778 
    2779     Fix libtool version setting
    2780    
    2781     This was being set too early to take effect.
    2782 
    2783 commit a6fb54e2eef4e393bd06829bc3bdc746ea9d41a6
    2784 Author: Mike Frysinger <vapier@gentoo.org>
    2785 Date:   Mon Oct 4 20:01:07 2010 +0100
    2786 
    2787     Populate the pkg-config Libs.private field
    2788 
    2789 commit a9b4065f048e750b7317f6434406fd528b69bf33
    2790 Author: Mike Frysinger <vapier@gentoo.org>
    2791 Date:   Fri Aug 20 00:09:46 2010 -0400
    2792 
    2793     Linux: fix build failure when CLOCK_MONOTONIC does not exist
    2794    
    2795     This is not available on all platforms.
    2796 
    2797 commit d192c5bd32736fde0080d756de6221287af34891
    2798 Author: Daniel Drake <dan@reactivated.net>
    2799 Date:   Mon Oct 4 18:45:18 2010 +0100
    2800 
    2801     Update libtool version info
    2802    
    2803     With input from various people on the mailing list, update the libtool
    2804     versioning info and start to update this on every release.
    2805    
    2806     The next libusb release will not need a change here. All following ones
    2807     will.
    2808 
    2809 commit e65f69a7ef3de357c867ddaac9598efe407078b6
    2810 Author: Pete Batard <pbatard@gmail.com>
    2811 Date:   Thu Aug 5 16:40:09 2010 +0100
    2812 
    2813     Updated documentation for unsupported Darwin/Windows calls
    2814 
    2815 commit c8bab4e19413d70c515a2eaf747a75b7f66fdc0b
    2816 Author: Pete Batard <pbatard@gmail.com>
    2817 Date:   Sun Sep 19 14:24:25 2010 +0100
    2818 
    2819     Windows: Make libusb_pollfd() return error
    2820    
    2821     Windows does not have numerical file descriptors but does have the
    2822     concept of event sources. Exposing these event sources will require
    2823     some careful thought and design, to be completed later.
    2824 
    2825 commit bd623f70d99fad8b975f8d4ee62ea4b1abf1272f
    2826 Author: Daniel Drake <dan@reactivated.net>
    2827 Date:   Sun Sep 19 14:21:01 2010 +0100
    2828 
    2829     MinGW: Use --add-stdcall-alias linker option
    2830    
    2831     Naming of symbols inside the library is inconsistent on Windows:
    2832     http://wyw.dcweb.cn/stdcall.htm
    2833    
    2834     Use this linker option to add aliases which add compatibility with
    2835     the "MSVC DLL" platform when a DEF file is used. It also better matches
    2836     the appearance of the Windows API itself.
    2837 
    2838 commit 29f9f9e3af3340df6a955881a93caf9d2a6d08d6
    2839 Author: Pete Batard <pbatard@gmail.com>
    2840 Date:   Fri Aug 13 11:59:49 2010 +0100
    2841 
    2842     Introduced calling convention (for Windows)
    2843    
    2844     Under Windows, a variety of compilers and configurations are available,
    2845     meaning that the manner of parameter passing (e.g. registers vs stack)
    2846     can vary.
    2847    
    2848     Match the Windows API calling convention and document this appropriately.
    2849     This calling convention will be used regardless of the configuration of
    2850     the user's development platform.
    2851    
    2852     The only user-level complication is that all functions used as libusb
    2853     callbacks must use the same calling convention as libusb. The
    2854     LIBUSB_CALL macro is provided to make this easy.
    2855    
    2856     Signed-off-by: Michael Plante <michael.plante@gmail.com>
    2857     Signed-off-by: Pete Batard <pbatard@gmail.com>
    2858     [dsd: slight change of strategy, add documentation]
    2859 
    2860 commit be523f1fe7c136c3fca06ae9c96aff44a22482ba
    2861 Author: Pete Batard <pbatard@gmail.com>
    2862 Date:   Fri Aug 6 21:56:04 2010 -0600
    2863 
    2864     Windows: fix string copy in sanitize_path
    2865    
    2866     The NULL byte was not being copied.
    2867 
    2868 commit 7fd36af9f749ce8bf96f89cefd519a9f46825573
    2869 Author: Pete Batard <pbatard@gmail.com>
    2870 Date:   Fri Jul 30 00:30:31 2010 +0100
    2871 
    2872     Windows: DuplicateHandle failure is not a warning
    2873    
    2874     This is because WinUSB handles are not duplicable, and generate a
    2875     lot of these warnings.
    2876 
    2877 commit 33cd2f68b4d500e852e354e5acae3d9a96a8ec26
    2878 Author: Pete Batard <pbatard@gmail.com>
    2879 Date:   Fri Jul 30 00:23:05 2010 +0100
    2880 
    2881     removed trailing whitespaces
    2882 
    2883 commit e47849afe9381c864683220eac9ce7bcf43f7883
    2884 Author: Pete Batard <pbatard@gmail.com>
    2885 Date:   Wed Aug 4 18:18:32 2010 -0600
    2886 
    2887     Windows: Mark interfaces as unused when releasing
    2888    
    2889     Without this important cleanup, the autoclaim code could attempt to
    2890     reuse an unclaimed interface as if it were already claimed.
    2891 
    2892 commit b30ca141a0bdce26e7cfdd91d346e49051532ee7
    2893 Author: Pete Batard <pbatard@gmail.com>
    2894 Date:   Wed Aug 4 18:15:59 2010 -0600
    2895 
    2896     Windows: fix device path string duplication
    2897 
    2898 commit e8d7a89503d5655c4b04da718c6971e25ff48162
    2899 Author: Nathan Hjelm <hjelmn@me.com>
    2900 Date:   Mon Aug 2 21:27:38 2010 -0600
    2901 
    2902     Darwin: Cache device configuration value
    2903    
    2904     Cache device configuration value to bring the Darwin backend more in
    2905     line with the libusb spec. To handle buggy devices GetConfiguration is
    2906     not called unless the device has more than one configuration.
    2907 
    2908 commit fe5d1d2050f715ffa8cbd35a378ac969a1a01584
    2909 Author: Xiaofan Chen <xiaofanc@gmail.com>
    2910 Date:   Fri Jul 30 15:56:43 2010 +0100
    2911 
    2912     Fix inconsistencies between prototypes and definitions
    2913    
    2914     This removes some warnings on cygwin regarding a name clash against
    2915     the standard library "index" function.
    2916 
    2917 commit 3b538c43e11b805a37d93b6283d270d5d5f0d1f5
    2918 Author: Hoi-Ho Chan <hoiho.chan@gmail.com>
    2919 Date:   Tue Jul 27 21:04:17 2010 -0600
    2920 
    2921     Darwin: handle kIOReturnUnderrun
    2922    
    2923     This return code indicates that the device returned a data packet
    2924     less than the max packet size. In libusb backend terms, this is
    2925     a successful transfer.
    2926 
    2927 commit 9a4249f8a104b98a15a7e3ba7ecae9a385ed9027
    2928 Author: Pete Batard <pbatard@gmail.com>
    2929 Date:   Sat Jul 10 17:51:13 2010 -0600
    2930 
    2931     Add Windows support
    2932    
    2933     Via Cygwin/MinGW, libusb now has windows support.
    2934     Thanks to contributors: Michael Plante, Orin Eman, Peter Stuge,
    2935     Stephan Meyer, Xiaofan Chen.
    2936 
    2937 commit d38dd5e3d2a872f7064eea084ddea8c33811dd7d
    2938 Author: Hoi-Ho Chan <hoiho.chan@gmail.com>
    2939 Date:   Sat Jul 24 13:48:00 2010 -0600
    2940 
    2941     Darwin: write iso transfer details into correct packets
    2942 
    2943 commit fbff5b4b665ff2ebc948162617cf7f4f5d2fabeb
    2944 Author: Nathan Hjelm <hjelmn@me.com>
    2945 Date:   Sat Jul 24 13:42:57 2010 -0600
    2946 
    2947     Darwin: fix interface object leak
    2948 
    2949 commit dffc09835d6860ae9b6a62c39af5be346188cb05
    2950 Author: Nathan Hjelm <hjelmn@me.com>
    2951 Date:   Sat Jul 24 13:41:03 2010 -0600
    2952 
    2953     Darwin: clean up some debug messages
    2954 
    2955 commit 946d1abbca397b8e88a1b0b4df176dcc5e3b7348
    2956 Author: Nathan Hjelm <hjelmn@me.com>
    2957 Date:   Sat Jul 24 13:39:16 2010 -0600
    2958 
    2959     Darwin: Don't open devices during scan unless we have to unsuspend
    2960 
    2961 commit 3b6d9ac82e2599cad7817d21e909a42275ddc4c4
    2962 Author: Peter Stuge <peter@stuge.se>
    2963 Date:   Fri Jun 25 08:08:13 2010 +0200
    2964 
    2965     Linux: Handle early complete of multi-URB transfer
    2966 
    2967 commit a516fcb99376686d2d0028e5ac69950c57a55b9e
    2968 Author: Daniel Drake <dan@reactivated.net>
    2969 Date:   Wed Jul 21 17:49:21 2010 -0600
    2970 
    2971     Only compile dpfp examples when sigaction is available
    2972    
    2973     It's not available on MinGW.
    2974 
    2975 commit a1d831ef82e1700f4ebb9df6ca5cef74be757c08
    2976 Author: Aurelien Jarno <aurelien@aurel32.net>
    2977 Date:   Tue May 25 09:32:19 2010 +0200
    2978 
    2979     configure.ac: fix bashisms
    2980 
    2981 commit 7211aba6e290f9805e911959b2a43a4b3ec56d4f
    2982 Author: Daniel Drake <dan@reactivated.net>
    2983 Date:   Fri Jun 25 12:01:58 2010 -0500
    2984 
    2985     Only include sys/time.h on appropriate platforms
    2986    
    2987     This header doesn't exist on windows.
    2988     For libusb, determine at configure-time if the header is available.
    2989     For libusb.h, use gcc predefined macros to only include the header
    2990     on platforms that need it.
    2991 
    2992 commit b33c3cb9651459de1f3d549677cbac67a017a295
    2993 Author: Daniel Drake <dan@reactivated.net>
    2994 Date:   Tue Jun 22 18:45:38 2010 -0500
    2995 
    2996     Linux: Fix log message commit
    2997    
    2998     Forgot to test this.
    2999 
    3000 commit 139648d5723190734a51c1c66ddf41c3e87adf10
    3001 Author: Ludovic Rousseau <rousseau@debian.org>
    3002 Date:   Mon Jun 21 10:19:29 2010 +0200
    3003 
    3004     Only initialize the default context when it is requested
    3005 
    3006 commit 22d61cd0891d8304dfc1a70579cf154fd8e6644a
    3007 Author: Daniel Drake <dan@reactivated.net>
    3008 Date:   Tue Jun 22 18:20:23 2010 -0500
    3009 
    3010     Linux: fix log message that was being unconditionally sent to stderr (#44)
    3011    
    3012     This message was put in place to aid libusb-compat-0.1 users, who
    3013     may run into the change that libusb-0.1 allowed you to usb_open() a
    3014     device that you don't have write access to, but libusb-1.0 does not.
    3015    
    3016     As explained on the ticket this change is dangerous so it should go through
    3017     the usual logging mechanism. I also added a similar regular log message
    3018     to libusb-compat-0.1.
    3019 
    3020 commit 82065a2c5e9d5ad0b2bb28792d12462f2fa150f0
    3021 Author: Ludovic Rousseau <rousseau@debian.org>
    3022 Date:   Thu Jun 10 18:41:27 2010 +0200
    3023 
    3024     Fix 2 documentation typos
    3025 
    3026 commit 351c062aacdde0b0fa7972ee9b7c6b355dcee110
    3027 Author: Ludovic Rousseau <rousseau@debian.org>
    3028 Date:   Wed Apr 21 16:49:33 2010 +0200
    3029 
    3030     add AM_MAINTAINER_MODE
    3031 
    3032 commit a7c056c14867e1cc3ef83682f2706cdbdca7c4ce
    3033 Author: Pete Batard <pbatard@gmail.com>
    3034 Date:   Thu Jun 10 17:00:25 2010 -0500
    3035 
    3036     Factorize event handler interruption code
    3037    
    3038     This will be additionally used by the windows backend which modifies
    3039     the fd set frequently.
    3040 
    3041 commit fc0af8e3f76925ad09e0fbc6d233d500753ee375
    3042 Author: Pete Batard <pbatard@gmail.com>
    3043 Date:   Sat Jun 5 12:14:19 2010 -0500
    3044 
    3045     Abstract low-level event handler operations
    3046    
    3047     The Windows backend uses something other than UNIX file descriptors
    3048     for event handling. Abstract out the operations to allow for this.
    3049 
    3050 commit 64383fb5b55a74b706967836e81cef61e57df86a
    3051 Author: Pete Batard <pbatard@gmail.com>
    3052 Date:   Tue Jun 1 11:38:14 2010 +0100
    3053 
    3054     fixes the possibility of using a broken timercmp on Windows
    3055    
    3056     Microsoft's implementation of timercmp does not work for >= or <=.
    3057 
    3058 commit f6d60a9a8fcf06629812da886e3a5de592624b61
    3059 Author: Pete Batard <pbatard@gmail.com>
    3060 Date:   Mon Feb 1 19:26:13 2010 +0000
    3061 
    3062     Switched to standard int pointer type for windows 64-bit compat
    3063    
    3064     On 64-bit Windows a pointer is 64 bit, but long is still 32 bit for
    3065     backwards compatibility.
    3066     uintptr_t nicely hides this difference and also works on Linux.
    3067    
    3068     [dsd: add appropriate include]
    3069 
    3070 commit a2fa855ce3795e31905b255267874af0603168bc
    3071 Author: Michael Plante <michael.plante@gmail.com>
    3072 Date:   Tue Mar 9 16:39:46 2010 -0600
    3073 
    3074     added doxygen, dpfp, msvc, and xusb stuff to gitignore
    3075 
    3076 commit 845d96a9c30b6f053208ed6b5b5d4ad1655e2026
    3077 Author: Daniel Drake <dan@reactivated.net>
    3078 Date:   Mon May 31 19:56:34 2010 -0500
    3079 
    3080     Add reference counting to default context
    3081    
    3082     Michael Plante pointed out that if 2 users call libusb_init(NULL) within
    3083     a process, we end up creating 2 default contexts, one of which is lost.
    3084    
    3085     Add reference counting so that the default context is reused and
    3086     destroyed only after the last user.
    3087 
    3088 commit 0e77f017fd3d1bdec4aced0429a380d3e434081b
    3089 Author: Daniel Drake <dan@reactivated.net>
    3090 Date:   Thu May 27 19:24:49 2010 -0400
    3091 
    3092     Fix libusb_init() error handling
    3093    
    3094     9996ccaed7 introduced a problem in that mutexes could be destroyed
    3095     in the error handling codepath before they had been created.
    3096     Pointed out by Michael Plante.
    3097 
    3098 commit b03de9d07bf9a6b0c4e6cba9ec06b5271a22e621
    3099 Author: Michael Plante <michael.plante@gmail.com>
    3100 Date:   Mon May 24 11:57:10 2010 -0300
    3101 
    3102     Modify log functions to compile with MSVC6
    3103    
    3104     MSVC6 does not support variadics.
    3105 
    3106 commit aa77b02da65afb0332b9e6853dae9e4dcda00bfa
    3107 Author: Pete Batard <pbatard@gmail.com>
    3108 Date:   Sun Feb 14 19:46:05 2010 -0600
    3109 
    3110     Add type parameter to the list_for_each_entry() and _safe() macros
    3111    
    3112     typeof() is a GCC extension, not supported by target compilers such
    3113     as MSVC.
    3114 
    3115 commit b92b16f437079208c8dfb1dc2380893846a07ee9
    3116 Author: Daniel Drake <dan@reactivated.net>
    3117 Date:   Wed May 19 17:37:29 2010 -0300
    3118 
    3119     Fix a usbi_pollfd leak in error path
    3120    
    3121     I accidently missed this when applying Pete Batard's earlier patch.
    3122     Pointed out by Michael Plante.
    3123 
    3124 commit 8aceb5c99056aaed6e6f2db1b303817e37e9fe8c
    3125 Author: Pete Batard <pbatard@gmail.com>
    3126 Date:   Sun Feb 14 19:47:30 2010 -0600
    3127 
    3128     Rename all interface parameters to usb_interface or interface_number
    3129    
    3130     Remove the use of the ambiguous "interface" where possible without
    3131     breaking the API.
    3132     'interface' is a preprocessor #define already associated with COM on Windows,
    3133     that can cause a conflict as soon as windows.h is included.
    3134    
    3135     There are a few more places where interface is still used, which should
    3136     be changed for libusb-2.0
    3137 
    3138 commit d7031ee8e1c449af23b2674fe18d9fc652c9bd80
    3139 Author: Pete Batard <pbatard@gmail.com>
    3140 Date:   Mon May 17 19:30:27 2010 -0300
    3141 
    3142     Stricter types and casts
    3143 
    3144 commit 9996ccaed740f8fcec4287a478ccaaa573f9865a
    3145 Author: Pete Batard <pbatard@gmail.com>
    3146 Date:   Mon May 17 19:16:54 2010 -0300
    3147 
    3148     Fixes to error handling and exit codepaths
    3149    
    3150     Various locks and things were being leaked/left open when handling
    3151     errors and during deinitialization.
    3152    
    3153     [dsd: small tweaks]
    3154 
    3155 commit 371ca4e440894bd1c845971418aa24c9d3919e63
    3156 Author: Nathan Hjelm <hjelmn@me.com>
    3157 Date:   Thu May 13 19:38:05 2010 -0300
    3158 
    3159     Darwin: Define IO_OBJECT_NULL if not already defined
    3160    
    3161     Needed on Mac OSX 10.3
    3162 
    3163 commit 7ba92cff94bbba19284749c614c26141d3023f37
    3164 Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
    3165 Date:   Fri Jan 29 12:08:52 2010 +0100
    3166 
    3167     libusb_cpu_to_le16: macro->static inline function
    3168    
    3169     The libusb_cpu_to_le16 macro was a ({ ... }) expression, which
    3170     generates the following compiler warning every time it is used,
    3171     (and that is several times for every #include <libusb.h>):
    3172    
    3173     libusb.h:880: warning: ISO C forbids braced-groups within expressions
    3174    
    3175     With this patch, #include <libusb.h> stops generating compiler
    3176     warnings on gcc 4.4.
    3177    
    3178     As libusb.h heavily relies on the use of static inline functions
    3179     those can be relied on to work properly, and there should not be
    3180     any significant difference in the code the compiler generates.
    3181 
    3182 commit 3473ac6c6fab32202d02d87679ebdb24e7d2df98
    3183 Author: Francesco <francesco.montorsi@gmail.com>
    3184 Date:   Tue Mar 9 16:35:35 2010 -0600
    3185 
    3186     Add libusb_strerror() to get short error message in English from enum
    3187    
    3188     [dsd: small tweaks]
    3189 
    3190 commit 5b69f3b7b0610d5f518954792ddc93332a41d292
    3191 Author: Michael Plante <michael.plante@gmail.com>
    3192 Date:   Thu Feb 25 19:39:22 2010 -0600
    3193 
    3194     Fix libusb_device::lock memory leak
    3195 
    3196 commit a636df4ca1b87ed3094a87828c022092a80ba613
    3197 Author: Pete Batard <pbatard@gmail.com>
    3198 Date:   Wed May 12 21:46:31 2010 -0300
    3199 
    3200     Whitespace cleanup
    3201 
    3202 commit 23b5db8b3e353176dfa0635bfb6f0e2658f6e3de
    3203 Author: Peter Stuge <peter@stuge.se>
    3204 Date:   Tue May 11 00:51:43 2010 +0100
    3205 
    3206     Add internal abstraction for POSIX Threads
    3207    
    3208     This prepares for a Windows backend without dependency on pthreads-w32.
    3209    
    3210     pthread_* is renamed to usbi_* and PTHREAD_* to USBI_*.
    3211    
    3212     A usbi_mutex_static_t and usbi_mutex_static_lock() and _unlock() are
    3213     introduced for statically initialized mutexes, since they may be
    3214     implemented using other types when pthreads mutexes aren't used.
    3215    
    3216     Move -pthread from libusb/Makefile.am to host-specific THREAD_CFLAGS in
    3217     configure.ac. This will enable optional use of -lpthread for cygwin.
    3218    
    3219     [dsd: minor tweaks, and roll in a change based on patches from Pete
    3220     Batard to only build dpfp_threaded example when we're using pthreads]
    3221 
    3222 commit a04cbb0095a78aeed3f65aaf06c46069d0ac184a
    3223 Author: Daniel Drake <dan@reactivated.net>
    3224 Date:   Tue May 4 19:01:59 2010 -0300
    3225 
    3226     v1.0.8 release
    3227 
    3228 commit 53b47299531974fa8901b74a163f3c8ebae4eec9
    3229 Author: Daniel Drake <dan@reactivated.net>
    3230 Date:   Thu Apr 22 18:12:51 2010 -0300
    3231 
    3232     Linux: don't set SHORT_NOT_OK on bulk out URBs (#20
    3233    
    3234     Setting this flag is illegal, and the behaviour we're looking for
    3235     is already in place for host-to-device transfers without this flag.
    3236 
    3237 commit 1519828b7ee1fce46d4c51fc097d52e01b8e0bb4
    3238 Author: Daniel Drake <dan@reactivated.net>
    3239 Date:   Tue Apr 20 20:14:09 2010 -0300
    3240 
    3241     Linux: Handle failure to read active configuration during enumeration
    3242 
    3243 commit 45168627cc15aee3875192f34286110dbbd27095
    3244 Author: Nathan Hjelm <hjelmn@me.com>
    3245 Date:   Tue Apr 20 19:43:06 2010 -0300
    3246 
    3247     Darwin: don't reuse cached descriptors during enumeration
    3248    
    3249     Descriptor reuse was causing scans to return invalid information when
    3250     the device at a location has changed.
    3251 
    3252 commit 3af329db6dcbfb96d24867c757f9e125e5b7b0e5
    3253 Author: Daniel Drake <dan@reactivated.net>
    3254 Date:   Mon Apr 19 19:36:55 2010 -0300
    3255 
    3256     v1.0.7 release
    3257 
    3258 commit ceb8cacd6d2a4189de0db2ee46d45217511c69be
    3259 Author: Daniel Drake <dan@reactivated.net>
    3260 Date:   Mon Apr 19 19:31:12 2010 -0300
    3261 
    3262     Document that fd set contents are an internal implementation detail (#36)
    3263 
    3264 commit 9bea500b5747bdeba7c8251d45608558e71a1db5
    3265 Author: Martin Koegler <mkoegler@auto.tuwien.ac.at>
    3266 Date:   Mon Apr 19 19:22:46 2010 -0300
    3267 
    3268     Linux: correct config descriptor endianness fix
    3269    
    3270     The seek_to_next_config codepath deals with both sysfs and usbfs;
    3271     make sure we only convert values in the usbfs path.
    3272 
    3273 commit 02df59a309e813c50b8230de99e69fb4e1814279
    3274 Author: Martin Koegler <mkoegler@auto.tuwien.ac.at>
    3275 Date:   Mon Apr 5 17:11:32 2010 +0200
    3276 
    3277     Linux: Fix endianness handling of usbfs config descriptors (#27)
    3278    
    3279     driver/usb/core/devio.c function usbdev_read translate the follwing files
    3280     to CPU endianess:
    3281    
    3282     le16_to_cpus(&temp_desc.bcdUSB);
    3283     le16_to_cpus(&temp_desc.idVendor);
    3284     le16_to_cpus(&temp_desc.idProduct);
    3285     le16_to_cpus(&temp_desc.bcdDevice);
    3286    
    3287     All other data is passed without any change.
    3288    
    3289     libusb/os/linux_usbfs.c calls usbi_parse_descriptor with host_endian=1
    3290     for config descriptors. According to the kernel code, they must be
    3291     processed with host_endian=0, as they are not translated by the kernel.
    3292    
    3293     Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
    3294 
    3295 commit ec303b01a5d4e51c000a283853af65059fa62285
    3296 Author: Nathan Hjelm <hjelmn@mac.com>
    3297 Date:   Tue Mar 23 16:22:08 2010 -0600
    3298 
    3299     Darwin: fix enumeration of devices with non-consecutive addresses (#23)
    3300 
    3301 commit cd809e2f7cee3874b7ae16b2c482a8b63a90e4a5
    3302 Author: Bastien Nocera <hadess@hadess.net>
    3303 Date:   Mon Mar 8 10:50:51 2010 +0000
    3304 
    3305     Add more interface classes
    3306    
    3307     As used in bluez.
    3308 
    3309 commit 1ce4aa67d849f5cad8a21072dc1c7b42158ce817
    3310 Author: Nathan Hjelm <hjelmn@mac.com>
    3311 Date:   Thu Mar 18 11:32:32 2010 -0600
    3312 
    3313     Darwin: Cleanup async callback code, catch request timeouts
    3314 
    3315 commit 68af9f8d731f700267335941a8214d34ab518cc8
    3316 Author: Nathan Hjelm <hjelmn@mac.com>
    3317 Date:   Thu Mar 18 11:31:46 2010 -0600
    3318 
    3319     Darwin: fix endianness of control setup packet
    3320    
    3321     IOUSBLib expects the control request to be in host byte order.
    3322     Swap the request into host byte order.
    3323 
    3324 commit cfce4d127184f4e4f334976151a0f80594bb5e22
    3325 Author: Nathan Hjelm <hjelmn@mac.com>
    3326 Date:   Mon Feb 15 14:10:08 2010 -0600
    3327 
    3328     Darwin: fix memory leak in process_device
    3329    
    3330     Credit to Mike Colagrosso for finding this bug.
    3331 
    3332 commit 161893cfbefefe315f657677705abe090fc526f2
    3333 Author: Nathan Hjelm <hjelmn@mac.com>
    3334 Date:   Mon Feb 15 14:09:19 2010 -0600
    3335 
    3336     Darwin: use logging functions
    3337    
    3338     Use usbi_warn, usbi_err, and usbi_info instead of _usbi_log.
    3339 
    3340 commit 2a72f38548208044dc3aa62681419d006c35732d
    3341 Author: Nathan Hjelm <hjelmn@mac.com>
    3342 Date:   Mon Feb 15 14:07:44 2010 -0600
    3343 
    3344     Darwin: support multiple calls to libusb_init
    3345    
    3346     Credit to Orin Eman for finding this bug.
    3347 
    3348 commit a4186794d87124503db2f5f51f51ce90bb95daa7
    3349 Author: Daniel Drake <dan@reactivated.net>
    3350 Date:   Sun Nov 22 17:20:53 2009 +0000
    3351 
    3352     v1.0.6 release
    3353 
    3354 commit 8392ff22136fccaf1e15d186157609b8dd127bc5
    3355 Author: Ludovic Rousseau <rousseau@debian.org>
    3356 Date:   Sun Oct 25 10:06:41 2009 +0100
    3357 
    3358     lsusb example: make print_devs() static
    3359    
    3360     lsusb.c:26: warning: no previous prototype for ‘print_devs’
    3361 
    3362 commit 9cc6bfaa15239bb6db1c1570b9beb6df2f848951
    3363 Author: Ludovic Rousseau <rousseau@debian.org>
    3364 Date:   Sun Oct 25 10:05:10 2009 +0100
    3365 
    3366     Darwin: fix warning in darwin_error_str()
    3367    
    3368     os/darwin_usb.c:63: warning: return discards qualifiers from pointer
    3369     target type
    3370 
    3371 commit 4c706d2fb6b2c43b10d72ac5dff51cac4d939f1a
    3372 Author: Nathan Hjelm <hjelmn@mac.com>
    3373 Date:   Sat Nov 21 17:06:43 2009 +0000
    3374 
    3375     Darwin: allow devices to be opened multiple times
    3376    
    3377     Allows libusb applications to access multiple interfaces of the same
    3378     device in the same application.
    3379    
    3380     Also fixes a set alt interface bug.
    3381 
    3382 commit 0232fc559cdacb9561f982dd6d28feb4435b3e4e
    3383 Author: Daniel Drake <dan@reactivated.net>
    3384 Date:   Sat Nov 21 17:01:32 2009 +0000
    3385 
    3386     Increase libusb_handle_events() timeout to 60 seconds
    3387    
    3388     The internal timing seems to be working, this will be a better test of
    3389     it before we make this timeout unlimited.
    3390 
    3391 commit 0bd7ef5d8697973a026c36c15d6276177b4ec4ea
    3392 Author: Daniel Drake <dan@reactivated.net>
    3393 Date:   Sat Nov 21 16:57:25 2009 +0000
    3394 
    3395     Refine timerfd header check (#18)
    3396    
    3397     Require glibc-2.9 for the working timerfd support.
    3398 
    3399 commit 90d8fcab9018b8e6887a7e0592d1e5f692117234
    3400 Author: Daniel Drake <dsd@gentoo.org>
    3401 Date:   Sun Nov 15 12:17:13 2009 +0000
    3402 
    3403     v1.0.5 release
    3404 
    3405 commit 11d591058e3f105b0e90c23bbf58b18de691e690
    3406 Author: Daniel Drake <dsd@gentoo.org>
    3407 Date:   Sat Nov 7 10:43:59 2009 +0000
    3408 
    3409     Update documentation about early completion caveats
    3410 
    3411 commit f796c9528a71aa55326b6f0c9c7c5ec073d2bf92
    3412 Author: Ludovic Rousseau <rousseau@debian.org>
    3413 Date:   Sun Oct 25 09:59:51 2009 +0100
    3414 
    3415     Add libusb_get_max_iso_packet_size() to libusb.h
    3416    
    3417     core.c:777: warning: no previous prototype for 'libusb_get_max_iso_packet_size'
    3418 
    3419 commit 4783008b7e711de9cb31631e60dda995f44068de
    3420 Author: Daniel Drake <dsd@gentoo.org>
    3421 Date:   Wed Oct 28 20:33:49 2009 +0545
    3422 
    3423     Use timerfd for timeout handling
    3424    
    3425     Use a new file descriptor from the timerfd system calls to handle
    3426     timeouts. On supported systems, this means that there is less hassle
    3427     figuring out when the poll() timeout should be, since
    3428     libusb_get_next_timeout() will always return 0 and the timeout events will
    3429     be triggered as regular activity on the file descriptor set.
    3430    
    3431     Add API function libusb_pollfds_handle_timeouts() to detect whether
    3432     you're on a platform with the timing headache, and flesh out the
    3433     surrounding documentation.
    3434 
    3435 commit 9b120c2b3735566533c179aa8ca758fe45899a38
    3436 Author: Daniel Drake <dsd@gentoo.org>
    3437 Date:   Sat Nov 7 10:03:07 2009 +0000
    3438 
    3439     Use AM_SILENT_RULES for building
    3440 
    3441 commit ef6ea6c3ae38e4524f10e16e8cb88177d39c4826
    3442 Author: Daniel Drake <dsd@gentoo.org>
    3443 Date:   Fri Nov 6 21:54:08 2009 +0000
    3444 
    3445     v1.0.4 release
    3446 
    3447 commit 217f57617e0cff0d1bd6d726b243f04c6b179773
    3448 Author: David Moore <dcm@acm.org>
    3449 Date:   Fri Nov 6 21:37:25 2009 +0000
    3450 
    3451     Linux: Add support for the new URB_BULK_CONTINUATION flag
    3452    
    3453     Add support for the new USBDEVFS_URB_BULK_CONTINUATION flag to libusb.
    3454    
    3455     This flag, which is expected to be available in usbfs starting with
    3456     kernel 2.6.32, allows the kernel to cancel multiple URBs upon receipt
    3457     of a short packet.  This capability allows libusb to preserve data
    3458     integrity of large bulk transfers that are split into multiple URBs.
    3459     Without this support, these URBs must be canceled in userspace upon
    3460     receipt of a short packet, a race condition against future transfers
    3461     which might partially fill these canceled URBs.
    3462    
    3463     This patch automatically detects whether a supported kernel is present
    3464     and enables the use of the flag when possible.
    3465    
    3466     [dsd: tweaks to supported kernel detection, and some inline
    3467      documentation of this mechanism]
    3468 
    3469 commit 69830057547396f893f0d7b3125a05d016313b10
    3470 Author: Daniel Drake <dsd@gentoo.org>
    3471 Date:   Wed Oct 28 15:13:22 2009 +0545
    3472 
    3473     Transfer locking
    3474    
    3475     At least on Linux, there were some possible races that could occur if
    3476     a transfer is cancelled from one thread while another thread is handling
    3477     an event for that transfer, or for if a transfer completes while it is
    3478     still being submitted from another thread, etc.
    3479    
    3480     On the global level, transfers could be submitted and cancelled at the
    3481     same time.
    3482    
    3483     Fix those issues with transfer-level locks.
    3484 
    3485 commit 98f1b30d24359cb3185051b8df9ebb663cc10369
    3486 Author: Daniel Drake <dsd@gentoo.org>
    3487 Date:   Mon Sep 14 08:01:24 2009 +0100
    3488 
    3489     Clarify that timeout 0 means unlimited timeout
    3490 
    3491 commit 858684f0dd25921e09565034a88709dbf6f6c61b
    3492 Author: Daniel Drake <dsd@gentoo.org>
    3493 Date:   Fri Sep 11 22:09:12 2009 +0100
    3494 
    3495     Linux: more flexibility with monotonic clock
    3496    
    3497     Some users have reported that CLOCK_MONOTONIC does not work on their
    3498     systems - I suspect it is available on x86 but perhaps not some
    3499     of the more uncommon architectures. We should fall back on
    3500     CLOCK_REALTIME in these cases.
    3501    
    3502     Also, CLOCK_MONOTONIC_RAW seems even more monotonic, so we should use
    3503     that if it is available.
    3504    
    3505     We now test different clock IDs during initialization to find the
    3506     best one that works.
    3507 
    3508 commit fe0d8dce1ed704915d501e7da700440c78144211
    3509 Author: Nathan Hjelm <hjelmn@mac.com>
    3510 Date:   Fri Sep 11 18:00:29 2009 +0100
    3511 
    3512     Darwin: handle overflows
    3513 
    3514 commit f46716f42040986203fa6e873bfdabe1be2900ec
    3515 Author: Daniel Drake <dsd@gentoo.org>
    3516 Date:   Thu Aug 27 21:14:54 2009 +0545
    3517 
    3518     v1.0.3 release
    3519 
    3520 commit 5b489b8b2a5aba7b8b804e5af6d2628735548238
    3521 Author: Toby Peterson <toby@macports.org>
    3522 Date:   Sun Aug 23 10:04:59 2009 +0545
    3523 
    3524     Darwin: 64-bit type fixes
    3525 
    3526 commit ad8ae04d0b52009af0b1180e005f7554d2bbb26c
    3527 Author: Nathan Hjelm <hjelmn@mac.com>
    3528 Date:   Sun Aug 23 10:02:55 2009 +0545
    3529 
    3530     Darwin: fix crash when reading descriptors after close
    3531    
    3532     Fix a crash which occurs if the user does the following sequence on a
    3533     device: open, close, get_configuration_descriptor.
    3534 
    3535 commit 45ae2aecf5512dcff059b2a416534e81c6a00c88
    3536 Author: Daniel Drake <dsd@gentoo.org>
    3537 Date:   Sat Aug 1 13:55:15 2009 +0545
    3538 
    3539     move bug info to bug tracker
    3540    
    3541     Protection needed: http://www.libusb.org/ticket/4
    3542     Losing data: fixed in previous commit
    3543 
    3544 commit 126129e174062c2a27423817a459e5113f777789
    3545 Author: Daniel Drake <dsd@gentoo.org>
    3546 Date:   Thu Jul 9 22:09:04 2009 +0100
    3547 
    3548     Linux: try harder not to lose any data
    3549    
    3550     We would previously lose any data that was present on a cancelled URB.
    3551     Work harder to make sure this doesn't happen.
    3552 
    3553 commit 0334ee642b47dfe1ca9db64b22e7702ea14b3f09
    3554 Author: Daniel Drake <dsd@gentoo.org>
    3555 Date:   Sun Jun 28 19:49:10 2009 +0100
    3556 
    3557     Add libusb_get_max_iso_packet_size()
    3558    
    3559     As pointed out by Dennis Muhlestein, libusb_get_max_packet_size()
    3560     doesn't really do what the documentation might suggest because it
    3561     does not consider the number of transaction opportunities per
    3562     microframe.
    3563    
    3564     Add a new function to do what is useful for isochronous I/O.
    3565 
    3566 commit 615f18e64e96ae4ecc8e43d0de00933059a5209a
    3567 Author: Daniel Drake <dsd@gentoo.org>
    3568 Date:   Sat Jun 20 22:33:21 2009 +0100
    3569 
    3570     Linux: fix sending of zero length bulk packets
    3571    
    3572     Note that there are is a kernel bug preventing this from working
    3573     properly at the moment, even after this fix.
    3574 
    3575 commit 86f79fbf61c2018bdf009c7ebf92b38f3a16fd0c
    3576 Author: Nathan Hjelm <hjelmn@mac.com>
    3577 Date:   Fri Jun 19 22:18:44 2009 +0100
    3578 
    3579     Darwin: Don't cancel transfers on timeout
    3580    
    3581     ...because the OS does this for us.
    3582 
    3583 commit d4bd9ed4de19a9c766f7a23eea8c852cdd61c18f
    3584 Author: Daniel Drake <dsd@gentoo.org>
    3585 Date:   Sun Jun 14 19:23:21 2009 +0100
    3586 
    3587     Don't terminate enums with commas
    3588    
    3589     g++ -pedantic doesn't like this
    3590     Reported by Eberhard Mattes
    3591 
    3592 commit 8be256082eb9bd8e243d89529f742926bb29a21b
    3593 Author: Daniel Drake <dsd@gentoo.org>
    3594 Date:   Sat Jun 13 17:19:07 2009 +0100
    3595 
    3596     v1.0.2 release
    3597 
    3598 commit 060e006e663fd59c281be29b71eb197e02b210e8
    3599 Author: Daniel Drake <dsd@gentoo.org>
    3600 Date:   Wed Jun 10 21:42:05 2009 +0100
    3601 
    3602     Linux: fix config descriptor parsing on big-endian systems
    3603    
    3604     Multi-byte fields in the configuration descriptors that come back from
    3605     usbfs are always in bus endian format.
    3606    
    3607     Thanks to Joe Jezak for help investigating and fixing this.
    3608 
    3609 commit c4a905022f684da9a4a853eb9232a81a53df2652
    3610 Author: Nathan Hjelm <hjelmn@mac.com>
    3611 Date:   Sun Jun 7 22:29:35 2009 +0100
    3612 
    3613     Darwin: improve handling of disconnected devices
    3614 
    3615 commit 6b69f54451762ef590b9c938ab000c07cf9099a3
    3616 Author: Nathan Hjelm <hjelmn@mac.com>
    3617 Date:   Sun Jun 7 22:26:37 2009 +0100
    3618 
    3619     Darwin: fix parsing of config descriptors
    3620    
    3621     This was a confusion between configuration numbers and zero-based
    3622     configuration indexes.
    3623 
    3624 commit 2b3a9ffa776b383cb2dbc3c55e490e32e4c3c22b
    3625 Author: Daniel Drake <dsd@gentoo.org>
    3626 Date:   Sun Jun 7 22:19:53 2009 +0100
    3627 
    3628     Eliminate -Wsign-compare compiler warnings
    3629    
    3630     This was due to an API inconsistency which can be safely worked around.
    3631     Hopefully we'll remember to fix the API next time we come to break
    3632     things.
    3633 
    3634 commit cad5cb55c37137e94e35c74fdabfe42a5cbd229b
    3635 Author: David Moore <dcm@acm.org>
    3636 Date:   Wed May 27 23:15:54 2009 -0700
    3637 
    3638     Make synchronous transfer APIs robust against signal interruption
    3639    
    3640     libusb_control_transfer and libusb_bulk_transfer are designed to be
    3641     synchronous such that control is not returned until the transfer
    3642     definitively succeeds or fails.  That assumption is violated if a signal
    3643     interrupts these functions because there is no way for the application
    3644     to continue waiting for the transfer without resubmitting it.  This
    3645     patch changes these synchronous APIs so they do not abort in the case of
    3646     a signal interruption.
    3647    
    3648     Signed-off-by: David Moore <dcm@acm.org>
    3649 
    3650 commit b501795985a23109f176d296e7b544b4c6354528
    3651 Author: Alex Vatchenko <alex@fabulatech.com>
    3652 Date:   Thu May 28 15:58:50 2009 -0400
    3653 
    3654     pre-gcc-3.4 compatibility
    3655    
    3656     The -fvisibility and -Wno-pointer-sign options are not available on
    3657     old GCC versions.
    3658 
    3659 commit 00bb2805e994887f0a754a825c3ce03d22393386
    3660 Author: Daniel Drake <dsd@gentoo.org>
    3661 Date:   Tue May 26 15:53:26 2009 -0400
    3662 
    3663     Fix memory leak in config descriptor parsing
    3664    
    3665     Pointed out by Martin Koegler.
    3666 
    3667 commit 068ff5b8a83fec0a9a91c80535a25b89a9ae64e8
    3668 Author: Daniel Drake <dsd@gentoo.org>
    3669 Date:   Tue May 12 19:20:51 2009 -0400
    3670 
    3671     Update AUTHORS
    3672 
    3673 commit aa24c04e4043e39674b59ff0d302b2365cd0078f
    3674 Author: Daniel Drake <dsd@gentoo.org>
    3675 Date:   Tue May 12 19:03:37 2009 -0400
    3676 
    3677     v1.0.1 release
    3678 
    3679 commit 44767677447fae4267131f99c591b14117486cac
    3680 Author: Daniel Drake <dsd@gentoo.org>
    3681 Date:   Tue May 12 19:01:44 2009 -0400
    3682 
    3683     Add BUGS file
    3684    
    3685     Probably missed a couple of outstanding issues
    3686 
    3687 commit e0365a6f22e0e7f330ac931df031cf6f17f453d1
    3688 Author: Nathan Hjelm <hjelmn@mac.com>
    3689 Date:   Sun Mar 22 21:13:29 2009 -0400
    3690 
    3691     Darwin: get_config_descriptor bugfixes
    3692 
    3693 commit 5fd0e8478240fece646a58a3c6114001a73be99f
    3694 Author: Daniel Drake <dsd@gentoo.org>
    3695 Date:   Wed Feb 25 12:33:33 2009 -0300
    3696 
    3697     Fix compilation of Darwin backend
    3698    
    3699     My fault. Reported by ihryamzik@gmail.com
    3700 
    3701 commit b49f6bf5c910d0fd694ecf165d7927673707bff9
    3702 Author: Nathan Hjelm <hjelmn@mac.com>
    3703 Date:   Mon Feb 16 21:39:29 2009 -0300
    3704 
    3705     Darwin backend
    3706 
    3707 commit d859158581e9a3250f36cdeeb8ea67cda04053bd
    3708 Author: Nathan Hjelm <hjelmn@mac.com>
    3709 Date:   Mon Feb 16 21:30:49 2009 -0300
    3710 
    3711     Make endianness macros endian-independent
    3712    
    3713     Implementation suggested by David Moore. Needed for proper universal
    3714     code support on Darwin.
    3715 
    3716 commit 9196f58bdc8b9e967261df39865215faa5d39cfa
    3717 Author: Nathan Hjelm <hjelmn@mac.com>
    3718 Date:   Mon Feb 16 21:25:18 2009 -0300
    3719 
    3720     Abstract clock reading into OS layer
    3721    
    3722     This will differ on Linux and Darwin, at least.
    3723    
    3724     [dsd: minor style tweaks]
    3725 
    3726 commit e91207860cac09b3afaafc4c14221b78d585c59a
    3727 Author: Daniel Drake <dsd@gentoo.org>
    3728 Date:   Mon Feb 16 21:20:28 2009 -0300
    3729 
    3730     Fix endianness in device descriptors
    3731    
    3732     Pointed out by Nathan Hjelm.
    3733 
    3734 commit ccf6d3d2f6acf9b9a1cb5e1f1b03f382ae509b17
    3735 Author: Nathan Hjelm <hjelmn@mac.com>
    3736 Date:   Mon Feb 16 21:13:52 2009 -0300
    3737 
    3738     Only link with librt on Linux
    3739    
    3740     [dsd: tweak configure.ac change]
    3741 
    3742 commit 894539931e4b4bd85708fe98b956049243cd6fb0
    3743 Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
    3744 Date:   Mon Jan 26 00:31:48 2009 +0100
    3745 
    3746     API docs: describe libusb_transfer_cb_fn type
    3747    
    3748     Add some text describing the libusb_transfer_cb_fn function type
    3749     with the semantics I have gathered from reading other parts of
    3750     the API docs, referring to the proper section for more details.
    3751    
    3752     [dsd: tweaked the description slightly]
    3753 
    3754 commit abe34a2656f8f9f21e53603796c536585e6233ef
    3755 Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
    3756 Date:   Sun Jan 25 18:21:59 2009 +0100
    3757 
    3758     Make empty array in struct compatible with C99
    3759    
    3760     If the compiler is known to be running in C99 mode,
    3761     use "flexible array members" ("foo[]").
    3762    
    3763     If the compiler is running in any other mode, continue
    3764     using the non-standard but widely common "foo[0]" syntax.
    3765 
    3766 commit 620075c7400764d9bb539b5c02065c45c2e8251e
    3767 Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
    3768 Date:   Sun Jan 25 18:20:45 2009 +0100
    3769 
    3770     Avoid signedness errors in API docs example code
    3771 
    3772 commit c754ae294cfe96ec4738d6641137c9e6c56330c7
    3773 Author: Daniel Drake <dsd@gentoo.org>
    3774 Date:   Sat Jan 17 00:25:40 2009 +0000
    3775 
    3776     Decrement poll() result when internal pipe has been handled
    3777    
    3778     When we receive data on the internal control pipe, we need to correctly
    3779     decrement the number of ready file descriptors before passing on the
    3780     remaining work to the OS implementation.
    3781 
    3782 commit b9ca960f2ba271d2b1a58e22b7c70464d69f6c8a
    3783 Author: David Moore <dcm@acm.org>
    3784 Date:   Sun Jan 11 21:46:17 2009 -0800
    3785 
    3786     Prevent transfer from being submitted twice or improperly canceled
    3787    
    3788     This ensures that tpriv->urbs and tpriv->iso_urbs are always set to NULL
    3789     whenever a transfer is not submitted.  In this way, submit_*_transfer()
    3790     and cancel_*_transfer() can error check to ensure that the transfer is
    3791     in the correct state to be either submitted or canceled, preventing
    3792     potential memory leaks or double frees.
    3793    
    3794     Signed-off-by: David Moore <dcm@acm.org>
    3795 
    3796 commit d2a8ec2da8abcd8f4648ed118da16191011982dd
    3797 Author: David Moore <dcm@acm.org>
    3798 Date:   Wed Jan 7 22:31:09 2009 -0800
    3799 
    3800     Linux: Fix race condition in cancel_bulk_transfer()
    3801    
    3802     This fixes a race condition in cancel_bulk_transfer().  In the old
    3803     version, awaiting_reap and awaiting_discard are incremented in
    3804     cancel_bulk_transfer() and decremented in handle_bulk_completion().
    3805     However, since these events may take place in two different threads,
    3806     these variables may reach zero before all URBs have been canceled,
    3807     triggered spurious callbacks and duplicate frees.
    3808    
    3809     This changes the logic to use a single variable "num_retired" to replace
    3810     both awaiting_reap and awaiting_discard.  num_retired is incremented
    3811     only in handle_bulk_completion() and thus there is no race.  The handler
    3812     will know that all URBs have been canceled when num_retired becomes
    3813     equal to num_urbs.
    3814    
    3815     This change also simplifies a great deal of the logic in both functions
    3816     and is a net reduction in the amount of code.
    3817    
    3818     Note that some variables such as "reap_action" probably need to still be
    3819     protected by a mutex, and this patch does not address that issue.
    3820    
    3821     Signed-off-by: David Moore <dcm@acm.org>
    3822 
    3823 commit 34b9eebe35d8167d43cffb6ad6175f6b2251b572
    3824 Author: Daniel Drake <dsd@gentoo.org>
    3825 Date:   Sat Dec 13 20:06:49 2008 +0000
    3826 
    3827     v1.0.0 release
    3828    
    3829     It's here!
    3830 
    3831 commit b1d636dde418dc8fe6a8f037dea0d800e57c6b94
    3832 Author: Mikhail Gusarov <dottedmag@dottedmag.ent>
    3833 Date:   Wed Dec 10 15:24:05 2008 +0600
    3834 
    3835     EOL-whitespace fixes
    3836    
    3837     Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.ent>
    3838 
    3839 commit 4a9ac382ba5149ae5b3d0962d6a840b5e0dc13aa
    3840 Author: Daniel Drake <dsd@gentoo.org>
    3841 Date:   Tue Dec 9 21:43:37 2008 +0000
    3842 
    3843     Linux: fix reading of active configuration
    3844    
    3845     Shannon Chuang pointed out that we only read 1 byte into an
    3846     uninitialized integer, and then return the whole thing.
    3847 
    3848 commit 81a7310d92461ba7b1d98aeff7c4c007fab07120
    3849 Author: Daniel Drake <dsd@gentoo.org>
    3850 Date:   Tue Dec 9 21:39:11 2008 +0000
    3851 
    3852     Fix double free in descriptor parsing error path
    3853    
    3854     Pointed out by Shannon Chuang.
    3855 
    3856 commit 9b4b53453db56ba9c1d707a645bbe6c7a02a3c81
    3857 Author: Daniel Drake <dsd@gentoo.org>
    3858 Date:   Fri Nov 21 13:28:32 2008 +0000
    3859 
    3860     Improvements to multi-threaded I/O system
    3861    
    3862     Documentation brushed up, and I realised that another function is
    3863     needed for tight event handling loops -- they must be able to check
    3864     if an open/close operation is trying to interrupt it.
    3865 
    3866 commit 0e5b0fcb77a90b8bd95ad23669da472af31ef069
    3867 Author: Daniel Drake <dsd@gentoo.org>
    3868 Date:   Fri Nov 21 11:00:47 2008 +0000
    3869 
    3870     SourceForge website upload system changed
    3871 
    3872 commit a133875e6e2f52eff53ac03f505d59cbdd33e178
    3873 Author: Daniel Drake <dsd@gentoo.org>
    3874 Date:   Fri Nov 21 10:54:57 2008 +0000
    3875 
    3876     v0.9.4 release
    3877 
    3878 commit c32aa662769b676ff3247778664fccc71fc427ec
    3879 Author: Daniel Drake <dsd@gentoo.org>
    3880 Date:   Thu Nov 20 15:31:10 2008 +0000
    3881 
    3882     Pause event handling while opening and closing devices
    3883    
    3884     Ludovic Rousseau found that crashes often occur if you close a device
    3885     while another thread is doing event handling.
    3886    
    3887     Fix this by adding an internal control pipe, which the close routines
    3888     use to interrupt the event handler and obtain the event handling lock,
    3889     ensuring that no other thread is handling events while the device is
    3890     closed. After the close completes, it signals all the event handlers
    3891     to start up again using the usual mechanism.
    3892    
    3893     Also modified libusb_open() to do a similar thing, so that event
    3894     handlers are interrupted in order to realise that a new poll fd has
    3895     appeared.
    3896 
    3897 commit 1d7cf3d0fa8698eae25097cbda1870be90ff6f5e
    3898 Author: Bastien Nocera <hadess@hadess.net>
    3899 Date:   Thu Oct 30 14:35:23 2008 +0000
    3900 
    3901     Add libusb_attach_kernel_driver()
    3902    
    3903     Add support for re-attaching a driver to a device under Linux.
    3904    
    3905     [dsd: fixed handling of return value, and added LIBUSB_ERROR_BUSY case]
    3906 
    3907 commit 914a4e70657c86b5094770aa2d898c978b1cdf41
    3908 Author: Daniel Drake <dsd@gentoo.org>
    3909 Date:   Sun Nov 2 21:45:54 2008 +0000
    3910 
    3911     Linux: handle low-level transfer errors
    3912    
    3913     Handle more URB error status codes, thanks to Lou and Alan Stern.
    3914 
    3915 commit d25b566b3b8febafdda4211de724b4727dd4b7e0
    3916 Author: Aurelien Jarno <aurelien@aurel32.net>
    3917 Date:   Thu Sep 4 13:50:49 2008 +0200
    3918 
    3919     Support for out-of-tree building
    3920    
    3921     Contrary to libusb 0.1, libusb 1.0 does not support out-of-tree building
    3922     for the documentation part. This patch fixes that by using a
    3923     doxygen.cfg.in file, which contains @top_srcdir@ to refer to the
    3924     location of the libusb source code.
    3925 
    3926 commit 8674c67ef78e1cf89db1fa584a4304f7c5ddcc5f
    3927 Author: Daniel Drake <dsd@gentoo.org>
    3928 Date:   Sun Nov 2 15:00:39 2008 +0000
    3929 
    3930     Document the logging style
    3931    
    3932     Suggested by Lou.
    3933 
    3934 commit 94936cbcfe3f02eb65c8b91e29896604316259d8
    3935 Author: Daniel Drake <dsd@gentoo.org>
    3936 Date:   Wed Aug 27 22:44:24 2008 -0500
    3937 
    3938     Async I/O documentation touchups
    3939 
    3940 commit 2f8f1b1a900f5b9828e5e2ff93c2b26a44fd9de2
    3941 Author: Daniel Drake <dsd@gentoo.org>
    3942 Date:   Wed Aug 27 21:23:10 2008 -0500
    3943 
    3944     Doc: fix typo in events lock section
    3945 
    3946 commit 046e681e4ac6b697e40458ee0f5baf3cd8763bb0
    3947 Author: Daniel Drake <dsd@gentoo.org>
    3948 Date:   Sat Aug 23 01:00:21 2008 -0500
    3949 
    3950     v0.9.3 release
    3951 
    3952 commit fec6eaa4eecdf7e0b8299157a5dabef94417f193
    3953 Author: Daniel Drake <dsd@gentoo.org>
    3954 Date:   Sat Aug 23 00:57:44 2008 -0500
    3955 
    3956     Reset internal transfer flags on submit
    3957    
    3958     This fixes a problem pointed out by Lou, where resubmitting a transfer
    3959     that previously timed out never timed out again, as if the timeout had
    3960     been set to 0.
    3961 
    3962 commit 81627bd38900ec9701ab69c141aa51a9abea1f60
    3963 Author: Daniel Drake <dsd@gentoo.org>
    3964 Date:   Sun Aug 10 17:09:48 2008 -0500
    3965 
    3966     Add libusb_get_configuration prototype
    3967    
    3968     Pointed out by Lou
    3969 
    3970 commit 1631eaefcc7cdf7047c6b9225618a9aa1b3d87d1
    3971 Author: Daniel Drake <dsd@gentoo.org>
    3972 Date:   Sat Jul 19 17:51:28 2008 -0500
    3973 
    3974     v0.9.2 release
    3975 
    3976 commit 0d9c40d7f3eee15ada624b5caab2cfb912144fdc
    3977 Author: Daniel Drake <dsd@gentoo.org>
    3978 Date:   Wed Jul 16 09:22:12 2008 -0500
    3979 
    3980     Linux: fix sysfs directory handling
    3981    
    3982     The length of the directory name varies, e.g. when you have nested hubs.
    3983     Use dynamic allocation to be able to deal with any length of name.
    3984 
    3985 commit 66c9847ad54b126ccafd4877292454ab57d0c115
    3986 Author: David Engraf <dogge2k@gmx.de>
    3987 Date:   Wed Jul 16 09:16:38 2008 -0500
    3988 
    3989     Linux: correct usage of MAX_PATH
    3990    
    3991     Thanks to clarification from Artem Egorkine, MAX_PATH already includes
    3992     space for the trailing NULL.
    3993 
    3994 commit 6494f07a6d1b73ce786ae581c4ff691e39e61d19
    3995 Author: Daniel Drake <dsd@gentoo.org>
    3996 Date:   Tue Jul 8 21:15:54 2008 -0500
    3997 
    3998     Linux: fix bulk/iso transfer double-cancellation
    3999    
    4000     Reset counters to 0 so that it's possible to cancel a transfer twice
    4001     without breaking things. Not sure that I want to support this properly,
    4002     but this makes it work at least.
    4003 
    4004 commit 9140f5b414e37a3714cde9c6d6c87c963338a83a
    4005 Author: Daniel Drake <dsd@gentoo.org>
    4006 Date:   Sat Jun 28 21:28:44 2008 -0500
    4007 
    4008     v0.9.1 release
    4009 
    4010 commit 83a029062c1d2bfb584d7a6ee94915583d37464c
    4011 Author: Daniel Drake <dsd@gentoo.org>
    4012 Date:   Sat Jun 28 21:24:49 2008 -0500
    4013 
    4014     Add missing GET_CONTEXT()
    4015 
    4016 commit fbad9a5426f0369394c88987355a8fb06a741ca1
    4017 Author: Daniel Drake <dsd@gentoo.org>
    4018 Date:   Sat Jun 28 21:18:41 2008 -0500
    4019 
    4020     Linux: Compatibility with new sysfs descriptors file
    4021    
    4022     As of 2.6.26, the descriptors file now includes all descriptors, not
    4023     just the active one.
    4024 
    4025 commit 819e65f880ca43526036e56c65c415042c91f58f
    4026 Author: Daniel Drake <dsd@gentoo.org>
    4027 Date:   Thu Jun 26 22:47:05 2008 -0500
    4028 
    4029     Allow user data pointer to be passed through pollfd notification API
    4030 
    4031 commit 1df713d622ab4f0b03aad72d903ac7beb8fb3b90
    4032 Author: Daniel Drake <dsd@gentoo.org>
    4033 Date:   Tue Jun 24 23:01:51 2008 -0500
    4034 
    4035     Introduce contexts to the API
    4036    
    4037     Suggested by David Zeuthen. This allows multiple libraries in the same
    4038     process to independently use libusb without interfering.
    4039 
    4040 commit 9818151c60a85aea6af24cb0996a92c3726c9864
    4041 Author: Daniel Drake <dsd@gentoo.org>
    4042 Date:   Tue Jun 24 21:31:13 2008 -0500
    4043 
    4044     Revert "Temporary workaround for event handling serialization issue"
    4045    
    4046     This reverts commit 2d3a1111caff40ebb87983c861ff548cdc9e5946.
    4047     This was based on the assumption that dying threads would automatically
    4048     release mutexes, which is not the case.
    4049 
    4050 commit d5f82893fab3f1c13b1af4ba17aac72479bad7d5
    4051 Author: Daniel Drake <dsd@gentoo.org>
    4052 Date:   Fri Jun 20 23:04:53 2008 -0500
    4053 
    4054     Overflow handling
    4055 
    4056 commit 546dee211eefbdd280fd1fc9dee84a9b52105078
    4057 Author: Artem Egorkine <arteme@gmail.com>
    4058 Date:   Tue Jun 17 18:27:38 2008 -0500
    4059 
    4060     a fix for SIGSEGV in handle_bulk_completion()
    4061    
    4062     We cannot dereference tpriv after calling
    4063     usbi_handle_transfer_cancellation() because that function may invoke
    4064     the user-supplied callback which may free the transfer.
    4065 
    4066 commit 947ba8056456a5215724fb502e3e09d50016f699
    4067 Author: Daniel Drake <dsd@gentoo.org>
    4068 Date:   Mon Jun 16 22:50:50 2008 -0500
    4069 
    4070     Refine configuration selection again
    4071    
    4072     At Alan Stern's suggestion, just offer the bare "set configuration" and
    4073     "get configuration" functionality, and let applications worry about the
    4074     specific race conditions and unusual situations.
    4075 
    4076 commit e7a7a49d0331ee0e14145f6e7ec39763b36314ac
    4077 Author: Daniel Drake <dsd@gentoo.org>
    4078 Date:   Sun Jun 15 15:29:38 2008 -0500
    4079 
    4080     docs update
    4081    
    4082     Add a THANKS file, make copyright notices easily accessible, update TODO
    4083 
    4084 commit 217534e4b396081e038ee5f94c813d1668963673
    4085 Author: Daniel Drake <dsd@gentoo.org>
    4086 Date:   Sun Jun 15 15:23:29 2008 -0500
    4087 
    4088     round up poll timeout
    4089    
    4090     Pointed out by Richard Röjfors, otherwise we end up busy-looping with
    4091     a poll() timeout of 0.
    4092 
    4093 commit 5ad79b324bc5e11a75a585398a1e81c26f05e758
    4094 Author: Felipe Balbi <me@felipebalbi.com>
    4095 Date:   Sun Jun 8 12:34:48 2008 +0300
    4096 
    4097     fix doc about libusb_open()
    4098    
    4099     libusb_open() returns int instead of libusb_device_handle.
    4100    
    4101     Signed-off-by: Felipe Balbi <me@felipebalbi.com>
    4102     [dsd: small correction]
    4103 
    4104 commit 2d3a1111caff40ebb87983c861ff548cdc9e5946
    4105 Author: Daniel Drake <dsd@gentoo.org>
    4106 Date:   Thu May 29 17:26:26 2008 +0100
    4107 
    4108     Temporary workaround for event handling serialization issue
    4109    
    4110     Ludovic Rousseau pointed out that libusb_unlock_events() is not called
    4111     when a thread gets terminated with a signal, meaning that event waiters
    4112     will not be woken up in this case.
    4113    
    4114     Add a temporary hack to libusb_event_handler_active() so that at least
    4115     the other threads will realise on the next iteration of their event
    4116     handling loop.
    4117    
    4118     The real fix will likely involve reworking most of this.
    4119 
    4120 commit 514bb8790cfe8b93ccfff82bc17081b1030acce0
    4121 Author: Daniel Drake <dsd@gentoo.org>
    4122 Date:   Thu May 29 12:35:01 2008 +0100
    4123 
    4124     Refine libusb_set_configuration() semantics
    4125    
    4126     Applications will generally want to set a configuration before claiming
    4127     interfaces. The problem is that the interface may already be set, and
    4128     someone else may have claimed an interface (meaning that all calls to
    4129     set_configuration will fail, even if it's for the same configuration).
    4130    
    4131     There are now 2 options:
    4132     1. Use the new libusb_get_configuration() to determine active
    4133        configuration before calling libusb_set_configuration()
    4134     2. Or just call libusb_set_configuration() as usual, which will do
    4135        nothing if that configuration is already active.
    4136 
    4137 commit d1292f8e7300051239a7ed2769d221dc7a6f9fca
    4138 Author: Daniel Drake <dsd@gentoo.org>
    4139 Date:   Sun May 25 23:42:42 2008 +0100
    4140 
    4141     v0.9.0 release
    4142    
    4143     First libusb-1.0 beta release
    4144 
    4145 commit 4cd249388e4ed2ca03f1263984ab67df5030bb65
    4146 Author: Daniel Drake <dsd@gentoo.org>
    4147 Date:   Sun May 25 22:59:09 2008 +0100
    4148 
    4149     Take lock before raising event waiters condition
    4150    
    4151     This avoids a race between the user checking for active event handler
    4152     and then blocking on the condition variable
    4153 
    4154 commit 7c525480ab3c4db9205bfe30bb0d2bef9096c444
    4155 Author: Daniel Drake <dsd@gentoo.org>
    4156 Date:   Fri May 23 15:57:07 2008 +0100
    4157 
    4158     Implement serialization of event handlers
    4159    
    4160     Now offers a mechanism to wait for events while another thread is
    4161     doing the event handling. Complicates things for MT async apps, but
    4162     then again it's a bit of a tricky combination to start with.
    4163 
    4164 commit ff0660a415ecfd0879600eaad1c5899b6d93a30a
    4165 Author: Daniel Drake <dsd@gentoo.org>
    4166 Date:   Sat May 24 21:28:31 2008 +0100
    4167 
    4168     allow LIBUSB_DEBUG env var to control message verbosity at runtime
    4169    
    4170     Based on ideas from Ludovic Rousseau
    4171 
    4172 commit 4d788967e3f8d75eaf3a1ac1ee8e2e8bed0601c1
    4173 Author: Daniel Drake <dsd@gentoo.org>
    4174 Date:   Fri May 23 15:58:11 2008 +0100
    4175 
    4176     don't print messages by default
    4177    
    4178     Add libusb_set_debug() API to set message verbosity.
    4179    
    4180     Ludovic Rousseau pointed out that applications may close stdout/stderr
    4181     descriptors, which might then be reused.
    4182 
    4183 commit bef33bb9eba0da04ee7488d9cd5e6ab12bc61c0c
    4184 Author: Daniel Drake <dsd@gentoo.org>
    4185 Date:   Mon May 19 15:43:27 2008 +0100
    4186 
    4187     Fix memory leak in libusb_control_transfer
    4188    
    4189     Pointed out by David Engraf: we weren't freeing the transfer buffer
    4190 
    4191 commit a345bacb6f07ebb2122402041a9e8092d4a20a4d
    4192 Author: David Engraf <david.engraf@netcom.eu>
    4193 Date:   Mon May 19 15:16:32 2008 +0100
    4194 
    4195     Linux: fix handling of ioctl failure
    4196    
    4197     The return value of some ioctl commands in linux_usbfs.c are not
    4198     handeled correct. The ioctl function returns != 0 and errno is set with
    4199     the error code.
    4200 
    4201 commit e44396a458ecea9e5edd9a7577e617571c76860d
    4202 Author: David Engraf <david.engraf@netcom.eu>
    4203 Date:   Mon May 19 15:13:38 2008 +0100
    4204 
    4205     critical memory leak in handle_events
    4206    
    4207     This patch closes a critical memory leak in handle_events. The fds
    4208     variable is malloced but never freed. When I'm calling
    4209     handle_events with a timeout of 0, my system runs out of memory after a
    4210     few seconds.
    4211 
    4212 commit eb25630f52bc9848b444e439632c899977d887b0
    4213 Author: Daniel Drake <dsd@gentoo.org>
    4214 Date:   Fri May 16 23:50:20 2008 +0100
    4215 
    4216     More informative libusb_open() return code
    4217    
    4218     Hopefully one of the last API tweaks...
    4219 
    4220 commit 2b2e9c40b195261b09ac52ebdb93eef25c79de90
    4221 Author: Daniel Drake <dsd@gentoo.org>
    4222 Date:   Fri May 16 22:37:56 2008 +0100
    4223 
    4224     Fix endianness with descriptor handling
    4225    
    4226     Alan Stern pointed out that usbfs gives host-endian data, but sysfs gives
    4227     bus-endian.
    4228 
    4229 commit 1298c51f516a7bf04ca9add1b7db14417cdc66f3
    4230 Author: Daniel Drake <dsd@gentoo.org>
    4231 Date:   Mon May 12 18:46:37 2008 +0100
    4232 
    4233     Backend documentation for porting efforts
    4234    
    4235     Hopefully comprehensive enough for people to get started.
    4236 
    4237 commit ade26afc42c34ceb1c45afcadd2ea5e8240eaca4
    4238 Author: Daniel Drake <dsd@gentoo.org>
    4239 Date:   Mon May 12 15:43:30 2008 +0100
    4240 
    4241     Linux: fix caching of guessed configuration
    4242    
    4243     Reported and tested by Xiaofan Chen
    4244 
    4245 commit e25d590a9198995b4f0b6afeb41ecae318715e7e
    4246 Author: Rob Walker <rob@tenfoot.org.uk>
    4247 Date:   Sun May 11 21:14:18 2008 +0100
    4248 
    4249     Linux: fix bulk transfer early completion
    4250    
    4251     We were forgetting about the remaining urbs when a non-final urb
    4252     completed early.
    4253    
    4254     [dsd: some touchups and a warning message for a corner case that we don't handle]
    4255 
    4256 commit fec7c84163e25b8f811632828334d75da82bcb16
    4257 Author: Daniel Drake <dsd@gentoo.org>
    4258 Date:   Sun May 11 20:31:58 2008 +0100
    4259 
    4260     Handle hot-unplugging
    4261    
    4262     This involved moving from select() to poll() because there is no way to
    4263     distinguish usbfs's POLLERR condition with select().
    4264 
    4265 commit aeb905fa5d78cdbba80a680aa7a2bb7338f27f65
    4266 Author: Daniel Drake <dsd@gentoo.org>
    4267 Date:   Sun May 11 16:04:35 2008 +0100
    4268 
    4269     Documentation work
    4270 
    4271 commit ba5d9a45c06311204f51faef41d1ee215bb5b823
    4272 Author: Daniel Drake <dsd@gentoo.org>
    4273 Date:   Sun May 11 15:36:24 2008 +0100
    4274 
    4275     Endianness of control setup packets
    4276    
    4277     Document behaviour where host-endian and bus-endian (little) should be
    4278     used respectively.
    4279    
    4280     Also remove packed attribute from libusb_control_setup as all fields
    4281     are naturally aligned.
    4282 
    4283 commit 7bedc3b2683f35ee1dd39a2ebe0ec05be0019f38
    4284 Author: Daniel Drake <dsd@gentoo.org>
    4285 Date:   Sun May 11 15:11:59 2008 +0100
    4286 
    4287     Document that releasing interface causes SET_INTERFACE control request
    4288 
    4289 commit f2ede9876cd4f5cfa7751b975670fa449187fe3d
    4290 Author: Daniel Drake <dsd@gentoo.org>
    4291 Date:   Sat May 10 21:45:42 2008 +0100
    4292 
    4293     Support unconfigured devices
    4294 
    4295 commit 8ebb4ccdfaf5f095a1c38787d909d280ea64405c
    4296 Author: Daniel Drake <dsd@gentoo.org>
    4297 Date:   Sat May 10 20:56:44 2008 +0100
    4298 
    4299     Linux: fix caching of active configuration for non-sysfs
    4300 
    4301 commit c3844f7aeb2176636ce6e6ef697659fdb0b30048
    4302 Author: Daniel Drake <dsd@gentoo.org>
    4303 Date:   Sat May 10 14:42:43 2008 +0100
    4304 
    4305     Fetch configurations by index (not value)
    4306    
    4307     Otherwise there is no way to know which values to look for.
    4308 
    4309 commit d77052c0d630e33737c38d601fd633155f6b2229
    4310 Author: Daniel Drake <dsd@gentoo.org>
    4311 Date:   Sat May 10 00:12:53 2008 +0100
    4312 
    4313     Linux: comprehensive sysfs vs usbfs access
    4314    
    4315     Be more flexible when certain parts of sysfs are not available.
    4316 
    4317 commit 74bc842bac1a32a26323da6c3e8af2f66e1b5cfa
    4318 Author: Daniel Drake <dsd@gentoo.org>
    4319 Date:   Fri May 9 19:38:13 2008 +0100
    4320 
    4321     Linux: no need to store usbfs node path
    4322    
    4323     This can be computed from bus number and device address
    4324 
    4325 commit fe4adcc99e30115204ab832ad3e0170c9aca7629
    4326 Author: Daniel Drake <dsd@gentoo.org>
    4327 Date:   Fri May 9 14:34:31 2008 +0100
    4328 
    4329     Rework configuration handling
    4330    
    4331     libusb no longer caches descriptors in libusb_device but backends are
    4332     intended to be able to provide copies from memory. In the common linux
    4333     case we can use sysfs.
    4334 
    4335 commit 5741bfe01a2481b8c3830c80edc3637bf62a7e16
    4336 Author: Daniel Drake <dsd@gentoo.org>
    4337 Date:   Fri May 9 14:36:14 2008 +0100
    4338 
    4339     libusb_get_device_list() can return negative error code
    4340 
    4341 commit 45413101b78298e9332b22a34bc6bc159000ad8a
    4342 Author: Daniel Drake <dsd@gentoo.org>
    4343 Date:   Thu May 8 23:09:21 2008 +0100
    4344 
    4345     Linux: fix clear_halt implementation
    4346    
    4347     The ioctl expects an integer.
    4348     Bug found with the assistance of Soumen Mondal
    4349 
    4350 commit 10d4e427cc171dfd6ad7f43a33ce3cfebcd7aa04
    4351 Author: Daniel Drake <dsd@gentoo.org>
    4352 Date:   Thu May 8 23:04:52 2008 +0100
    4353 
    4354     Documentation work
    4355    
    4356     Partially based on some libusb-devel discussions
    4357 
    4358 commit ded0a249322571a075e3ed3528021864247dfa55
    4359 Author: Daniel Drake <dsd@gentoo.org>
    4360 Date:   Mon May 5 22:57:48 2008 +0100
    4361 
    4362     Linux: enumerate devices and descriptors from sysfs
    4363    
    4364     Suggested by Alan Stern. This avoids waking up any suspended USB devices.
    4365     sysfs is not available on all systems, so the usbfs mechanism is still
    4366     in place as a fallback.
    4367 
    4368 commit 885c2a5de69d6b7d8902bb55d6d83680a5a1a6e5
    4369 Author: Daniel Drake <dsd@gentoo.org>
    4370 Date:   Mon May 5 21:34:31 2008 +0100
    4371 
    4372     documentation touchups
    4373 
    4374 commit 59c205d542b43d79fe28622dbe8f03a3a3300b6f
    4375 Author: Daniel Drake <dsd@gentoo.org>
    4376 Date:   Mon May 5 21:17:03 2008 +0100
    4377 
    4378     more error code sanitization
    4379 
    4380 commit 88055d4b5913102a90ff666f75fd922c74860dc5
    4381 Author: Daniel Drake <dsd@gentoo.org>
    4382 Date:   Mon May 5 20:57:43 2008 +0100
    4383 
    4384     Isochronous transfer helper functions
    4385 
    4386 commit a95c943ed301dcd20e92b0b3b255568899a4c42e
    4387 Author: Daniel Drake <dsd@gentoo.org>
    4388 Date:   Mon May 5 17:54:33 2008 +0100
    4389 
    4390     free open devices on exit
    4391 
    4392 commit b27fff633843824744df7d334cb89ece329cafa6
    4393 Author: Daniel Drake <dsd@gentoo.org>
    4394 Date:   Mon May 5 17:47:49 2008 +0100
    4395 
    4396     move descriptor parsing into main library
    4397    
    4398     OS modules now provide functionality for fetching device/config
    4399     descriptors
    4400 
    4401 commit a304eca71f22c6df7d70a901483b30f1b8e93378
    4402 Author: Daniel Drake <dsd@gentoo.org>
    4403 Date:   Mon May 5 16:22:33 2008 +0100
    4404 
    4405     Detect endpoint halts and unsupported control requests
    4406 
    4407 commit 7da521954ba661d3f537440c31a84b66e974d56b
    4408 Author: Daniel Drake <dsd@gentoo.org>
    4409 Date:   Mon May 5 01:00:31 2008 +0100
    4410 
    4411     Linux: fix logical URB allocation
    4412    
    4413     We were allocating the wrong number of URBs for transfers of size
    4414     multiples of 16k.
    4415 
    4416 commit 470b1bc42bf53373ce678fc76bab9160a54d6881
    4417 Author: Daniel Drake <dsd@gentoo.org>
    4418 Date:   Sun May 4 16:51:23 2008 +0100
    4419 
    4420     add functionality for querying and detaching kernel driver
    4421 
    4422 commit 17ecfb0ecc833596c43755c80d461cddb9b3b0d7
    4423 Author: Daniel Drake <dsd@gentoo.org>
    4424 Date:   Sun May 4 16:20:46 2008 +0100
    4425 
    4426     Descriptor reading functionality
    4427 
    4428 commit bdce367d1bd8691465844b2411c85215498f517d
    4429 Author: Daniel Drake <dsd@gentoo.org>
    4430 Date:   Sun May 4 14:22:16 2008 +0100
    4431 
    4432     sanitized error returns from synchronous I/O functions
    4433 
    4434 commit bfe74e9cd9c17a40fff042ea0647326f51cfecae
    4435 Author: Daniel Drake <dsd@gentoo.org>
    4436 Date:   Sun May 4 14:10:19 2008 +0100
    4437 
    4438     implement libusb_reset_device()
    4439 
    4440 commit c01f744ce07bbeccbe353e956479f0cc5a811a6f
    4441 Author: Daniel Drake <dsd@gentoo.org>
    4442 Date:   Sun May 4 13:46:41 2008 +0100
    4443 
    4444     Add functionality to clear endpoint halt conditions
    4445 
    4446 commit 5878daa85e3364bb3885190425d4f9deaa2d8c36
    4447 Author: Daniel Drake <dsd@gentoo.org>
    4448 Date:   Sun May 4 00:51:59 2008 +0100
    4449 
    4450     Fix libusb_get_device_list return value
    4451    
    4452     It was documented to return the list length, but was returning 0.
    4453 
    4454 commit a74106a9b48b88bae0e099be34a18d653a8f1238
    4455 Author: Daniel Drake <dsd@gentoo.org>
    4456 Date:   Sat May 3 16:50:58 2008 +0100
    4457 
    4458     Well-defined error codes for some operations
    4459    
    4460     Also renamed set_interface_altsetting to set_interface_alt_setting for
    4461     better consistency
    4462 
    4463 commit 0f463fe671455670efcf4a93e526b2a9082b0afe
    4464 Author: Daniel Drake <dsd@gentoo.org>
    4465 Date:   Sat May 3 16:24:11 2008 +0100
    4466 
    4467     Add libusb_set_configuration()
    4468 
    4469 commit e65608994f795f97e4d6adac20329ca08709db2d
    4470 Author: Daniel Drake <dsd@gentoo.org>
    4471 Date:   Sat May 3 15:40:23 2008 +0100
    4472 
    4473     rename LIBUSB_ERROR_NOMEM to LIBUSB_ERROR_NO_MEM
    4474     improves consistency
    4475 
    4476 commit 5384bbf300779e7936eac9ebd33ee38f5b533f8e
    4477 Author: Daniel Drake <dsd@gentoo.org>
    4478 Date:   Sat May 3 14:34:54 2008 +0100
    4479 
    4480     Linux: better EACCES handling
    4481 
    4482 commit 1936eeeba3f933a078df1005cc7c1533a8ec2bac
    4483 Author: Daniel Drake <dsd@gentoo.org>
    4484 Date:   Sat May 3 14:26:56 2008 +0100
    4485 
    4486     Rename reference counting API
    4487    
    4488     This improves consistency with the naming style of other functions
    4489 
    4490 commit e2f822b4f17342f614ab2455179a80975fca6cb0
    4491 Author: Daniel Drake <dsd@gentoo.org>
    4492 Date:   Sat May 3 14:24:40 2008 +0100
    4493 
    4494     Linux: use read-only access to enumerate devices and descriptors
    4495    
    4496     Write access is not needed until later.
    4497     Also fix handling of open() error code.
    4498 
    4499 commit 81204eed3d0a7744b89b68bd90d567b68d191a91
    4500 Author: Daniel Drake <dsd@gentoo.org>
    4501 Date:   Fri May 2 17:45:23 2008 +0100
    4502 
    4503     document pollfd notifiers
    4504 
    4505 commit e20f8281fb7da32587f81b5eea5818af1eab0fe0
    4506 Author: Daniel Drake <dsd@gentoo.org>
    4507 Date:   Fri May 2 17:33:52 2008 +0100
    4508 
    4509     Allow multiple interfaces to be claimed
    4510 
    4511 commit 66685ff25d81a1f1a2a3dbda882d407638d00672
    4512 Author: Daniel Drake <dsd@gentoo.org>
    4513 Date:   Fri May 2 16:55:36 2008 +0100
    4514 
    4515     Documentation improvements
    4516 
    4517 commit 55bce39cbe0c9746a428b66751d1afe551d86381
    4518 Author: Daniel Drake <dsd@gentoo.org>
    4519 Date:   Fri May 2 12:55:34 2008 +0100
    4520 
    4521     detect short descriptor reads
    4522 
    4523 commit f3f17846dcced6b2dc40f899ed6a2aba151c264b
    4524 Author: Daniel Drake <dsd@gentoo.org>
    4525 Date:   Fri May 2 12:32:46 2008 +0100
    4526 
    4527     remove "references" and "referenced by" listings in documentation
    4528 
    4529 commit fbb017dd9a26ce449578482b95157b3c850fa446
    4530 Author: Daniel Drake <dsd@gentoo.org>
    4531 Date:   Fri May 2 12:32:08 2008 +0100
    4532 
    4533     Use typedef ptr types in parameters and return types
    4534    
    4535     This is passed through to the docs
    4536 
    4537 commit 3675e978fb7a1042f8601931255658bcd14a2298
    4538 Author: Daniel Drake <dsd@gentoo.org>
    4539 Date:   Fri May 2 12:28:31 2008 +0100
    4540 
    4541     Expose bus number and device address
    4542 
    4543 commit 2012898ffc492317cb428d97077bf5ee0e98e1da
    4544 Author: Daniel Drake <dsd@gentoo.org>
    4545 Date:   Tue Apr 29 15:26:46 2008 +0100
    4546 
    4547     standardised error codes
    4548 
    4549 commit 0269c75ae3de7acb2dc555e45928750e35fdb320
    4550 Author: Daniel Drake <dsd@gentoo.org>
    4551 Date:   Tue Apr 29 13:34:26 2008 +0100
    4552 
    4553     Fix descriptor handling memory leaks
    4554 
    4555 commit d3ab4e3bd4068cba41c1e12c4b175018dc3cb343
    4556 Author: Daniel Drake <dsd@gentoo.org>
    4557 Date:   Sun Apr 27 23:50:01 2008 +0100
    4558 
    4559     Rename endpoint_type to transfer_type
    4560    
    4561     Matches the USB specs more closely
    4562 
    4563 commit 379e90e0fdcef6f4db1849fa0a7fd524407cf564
    4564 Author: Daniel Drake <dsd@gentoo.org>
    4565 Date:   Sun Apr 27 23:41:24 2008 +0100
    4566 
    4567     Remove a FIXME comment
    4568    
    4569     it can't.
    4570 
    4571 commit 2ddf81420557d016bbcbf28dda0d8d1c64d16264
    4572 Author: Daniel Drake <dsd@gentoo.org>
    4573 Date:   Sun Apr 27 23:30:34 2008 +0100
    4574 
    4575     Fix unlocked flying_transfers list access
    4576 
    4577 commit 7ac0a405b4c57db42e88cbcba5f135697f03b646
    4578 Author: Daniel Drake <dsd@gentoo.org>
    4579 Date:   Sun Apr 27 23:27:04 2008 +0100
    4580 
    4581     Remove libusb_cancel_transfer_sync
    4582    
    4583     This wasn't a particularly nice API. Cancellation should be handled by
    4584     the completion handler.
    4585 
    4586 commit a5006fd7b9dae6f1db7969c8744086ba3a7c027b
    4587 Author: Daniel Drake <dsd@gentoo.org>
    4588 Date:   Sun Apr 27 19:56:02 2008 +0100
    4589 
    4590     remove extra timeout check
    4591    
    4592     If select() didn't timeout then don't check for more timeouts
    4593 
    4594 commit 3bdafaa359d9c65e1af360b5338e1f25528a8066
    4595 Author: Daniel Drake <dsd@gentoo.org>
    4596 Date:   Sun Apr 27 19:53:51 2008 +0100
    4597 
    4598     Documentation touchups
    4599    
    4600     Detail that interrupt polling interval is fixed to endpoint bInterval,
    4601     and that data may be transferred even on a timeout condition.
    4602 
    4603 commit e12618c79d520955b1abf80a277e881d91907162
    4604 Author: Daniel Drake <dsd@gentoo.org>
    4605 Date:   Sat Apr 19 16:17:53 2008 +0100
    4606 
    4607     add threaded example program
    4608 
    4609 commit 1fcdb0678b759569db7cd530457dbc0a5f86fb1d
    4610 Author: Daniel Drake <dsd@gentoo.org>
    4611 Date:   Fri Apr 18 23:58:54 2008 +0100
    4612 
    4613     libusb_device mutex protection
    4614 
    4615 commit 0efd2efa65d5513e5754d717d522b2c5c45332e2
    4616 Author: Daniel Drake <dsd@gentoo.org>
    4617 Date:   Fri Apr 18 23:42:40 2008 +0100
    4618 
    4619     mutex protection for device and handle lists
    4620 
    4621 commit d2ff2b14a15e5099ff0214502944de30f141a39c
    4622 Author: Daniel Drake <dsd@gentoo.org>
    4623 Date:   Fri Apr 18 20:00:31 2008 +0100
    4624 
    4625     lock flying_transfers during transfer removal
    4626 
    4627 commit 2569980762cb66804da31e54bef243702da8dfe9
    4628 Author: Daniel Drake <dsd@gentoo.org>
    4629 Date:   Fri Apr 18 19:59:56 2008 +0100
    4630 
    4631     pollfds mutex protection
    4632 
    4633 commit f5a33e08ec0da51ccb5e95a5adec50c5211a9bf5
    4634 Author: Daniel Drake <dsd@gentoo.org>
    4635 Date:   Thu Apr 17 18:24:54 2008 +0100
    4636 
    4637     flying_transfers mutex protection
    4638    
    4639     This marks the beginnings of thread safety
    4640 
    4641 commit 85e1994123545125ce0653415d122f9790f8d041
    4642 Author: Daniel Drake <dsd@gentoo.org>
    4643 Date:   Thu Apr 17 17:44:28 2008 +0100
    4644 
    4645     Linux: fix control transfer cancellation
    4646 
    4647 commit cf9b831f7bfd97ba88721c1d934aeda522f3692c
    4648 Author: Daniel Drake <dsd@gentoo.org>
    4649 Date:   Mon Apr 14 20:03:27 2008 +0100
    4650 
    4651     set correct endpoint type for isochronous transfers
    4652    
    4653     Pointed out by Felix Domke
    4654 
    4655 commit ad6e2b712c5b54af44424e58a2776686314e26b7
    4656 Author: Daniel Drake <dsd@gentoo.org>
    4657 Date:   Fri Apr 11 21:40:07 2008 +0100
    4658 
    4659     Linux: fire multiple URBs at once for split transfers
    4660    
    4661     This results in a significant performance increase for bulk transfers
    4662     larger than 16kb, and fixes a bug where data would be spliced and mixed
    4663     between two simultaneously submitted transfers to the same endpoint.
    4664    
    4665     It also allows isochronous transfers larger than 16kb to be submitted.
    4666    
    4667     This commit also improves cancellation - the library now understands
    4668     what is going on.
    4669 
    4670 commit d9b2ce2894ed43d34de6850f2dac50ccabf1db55
    4671 Author: Daniel Drake <dsd@gentoo.org>
    4672 Date:   Tue Apr 1 23:28:32 2008 +0100
    4673 
    4674     Constify some return data
    4675    
    4676     Make it clear that apps should not mess with these structures
    4677 
    4678 commit 8d809854e2b19c2b7c27ab05e5d76b34e2a5cead
    4679 Author: Daniel Drake <dsd@gentoo.org>
    4680 Date:   Sun Mar 30 22:19:00 2008 +0100
    4681 
    4682     Rename libusb_poll() to libusb_handle_events()
    4683 
    4684 commit 211f80c9f2a4a58cd2bbf5b7751f45089c8961e7
    4685 Author: Daniel Drake <dsd@gentoo.org>
    4686 Date:   Tue Mar 25 16:24:30 2008 +0000
    4687 
    4688     Isochronous endpoint I/O
    4689    
    4690     Due to variable-sized structures, this involved changing allocation
    4691     mechanism. All transfers must now be allocated and freed through
    4692     libusb.
    4693    
    4694     A synchronous function is missing, and I could do with writing a few
    4695     more helper functions to simplify things.
    4696 
    4697 commit b1ade6fca668d8aa156d5b5bf3a933f116144dc2
    4698 Author: Daniel Drake <dsd@gentoo.org>
    4699 Date:   Sun Mar 23 21:17:32 2008 +0000
    4700 
    4701     distcheck fix for docs
    4702 
    4703 commit 62077b7fa5b222e1bb9dea3467585aed69d596e2
    4704 Author: Daniel Drake <dsd@gentoo.org>
    4705 Date:   Sun Mar 23 21:13:14 2008 +0000
    4706 
    4707     Support for changing altsetting
    4708    
    4709     Will probably be suject to later consideration w.r.t. claiming of endpoints
    4710 
    4711 commit 0499e9f418607b5786ac0c3e97bc46737a609ca3
    4712 Author: Daniel Drake <dsd@gentoo.org>
    4713 Date:   Thu Mar 20 21:10:01 2008 +0000
    4714 
    4715     it's called bmRequestType
    4716 
    4717 commit 88884ae4bbe721dac117d5190303cb67852fa5d3
    4718 Author: Daniel Drake <dsd@gentoo.org>
    4719 Date:   Thu Mar 20 21:07:00 2008 +0000
    4720 
    4721     Save transfer flags before invoking callback
    4722    
    4723     The callback may free the transfer, in which case we can't read the flags
    4724     after it has returned.
    4725 
    4726 commit ead09cde6895df0034a685516987ce253575e9a7
    4727 Author: Daniel Drake <dsd@gentoo.org>
    4728 Date:   Sat Mar 15 16:35:12 2008 +0000
    4729 
    4730     API documentation
    4731    
    4732     Hopefully mostly complete. Some constants were renamed and move into
    4733     enums.
    4734 
    4735 commit 285724cc14ea5f993e2c4c92fe0aaf6c335bc139
    4736 Author: Vasily Khoruzhick <anarsoul@gmail.com>
    4737 Date:   Sat Mar 15 13:50:53 2008 +0200
    4738 
    4739     Fix get_device_list for realloc case
    4740    
    4741     get_device_list can modify pointer passed to it with realloc, but this
    4742     case wasn't handled and caused crash on my machine. Fixed
    4743    
    4744     Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
    4745 
    4746 commit c0c9432d38b22784070dce3a7874c62c31786a27
    4747 Author: Daniel Drake <dsd@gentoo.org>
    4748 Date:   Thu Mar 13 12:36:56 2008 +0000
    4749 
    4750     Beginnings of cross-platform abstraction
    4751    
    4752     This also includes a libusb_get_pollfds API change
    4753 
    4754 commit de4c5341d168697baa4c0901c406deb47e78aae7
    4755 Author: Daniel Drake <dsd@gentoo.org>
    4756 Date:   Mon Mar 10 18:38:15 2008 +0000
    4757 
    4758     Add transfer flags
    4759 
    4760 commit aae05f688dc26a013166ab9436fd25018b49d76a
    4761 Author: Daniel Drake <dsd@gentoo.org>
    4762 Date:   Mon Mar 10 11:32:15 2008 +0000
    4763 
    4764     Simplify libusb_fill_control_transfer()
    4765    
    4766     Transfer length can be inferred from the setup packet.
    4767 
    4768 commit 7c5ea95297c2f3f6afc42f60c1bf1bef777bb1fb
    4769 Author: Daniel Drake <dsd@gentoo.org>
    4770 Date:   Mon Mar 10 11:29:24 2008 +0000
    4771 
    4772     get_device fixup
    4773    
    4774     Rename API away from "devh" and fix implementation to match header
    4775 
    4776 commit 9e89d1aa82cbe7e21672ee3e2e545238fffc5318
    4777 Author: Daniel Drake <dsd@gentoo.org>
    4778 Date:   Sun Mar 9 16:27:06 2008 +0000
    4779 
    4780     Rename descriptor-getting functions
    4781    
    4782     Based on feedback from Tim Roberts
    4783 
    4784 commit 283ae96c3ccbcee1c3950fce18ae47093ae8200e
    4785 Author: Daniel Drake <dsd@gentoo.org>
    4786 Date:   Sun Mar 9 16:15:02 2008 +0000
    4787 
    4788     Simplify cancellation API
    4789    
    4790     No need to provide the device here.
    4791 
    4792 commit ebad1c79688ba603ad017ed0fe2f3c0dc8edd1ad
    4793 Author: Daniel Drake <dsd@gentoo.org>
    4794 Date:   Sun Mar 9 16:12:08 2008 +0000
    4795 
    4796     Rename libusb_dev_handle to libusb_device_handle
    4797 
    4798 commit 1ac0a7d88f282b6f293c456fac8edb143cbaca3d
    4799 Author: Daniel Drake <dsd@gentoo.org>
    4800 Date:   Sun Mar 9 01:01:57 2008 +0000
    4801 
    4802     Move synchronous I/O implementation to its own file
    4803 
    4804 commit 66348c90ea4570bf999ac301089e006d0cce1926
    4805 Author: Daniel Drake <dsd@gentoo.org>
    4806 Date:   Sun Mar 9 00:58:09 2008 +0000
    4807 
    4808     Separate transfer allocation and submission
    4809    
    4810     Leads to some hefty API changes. Now we're much more similar to the
    4811     Linux kernel model.
    4812    
    4813     Problems with dealing with asynchronous control transfers are passed
    4814     on to the user, basically you must allocate a buffer, start with the
    4815     setup, and put the data after. This won't make much sense until
    4816     documented (soon...)
    4817 
    4818 commit d21ebe47ce578c93cd8969be1c933d503e32e5d4
    4819 Author: Daniel Drake <dsd@gentoo.org>
    4820 Date:   Sat Mar 8 12:48:35 2008 +0000
    4821 
    4822     Rework URB API naming
    4823    
    4824     Now refer to everything as "transfers" as consistent with the USB spec
    4825     libusb_transfer is now a kind of transfer handle. To reduce confusion
    4826     with libusb_bulk_transfer and libusb_control_transfer, those have been
    4827     renamed to libusb_{control,bulk}_transfer_request.
    4828 
    4829 commit fd6fb3cc093ad47271353a0e468d16547f991382
    4830 Author: Daniel Drake <dsd@gentoo.org>
    4831 Date:   Sat Mar 8 11:53:33 2008 +0000
    4832 
    4833     Add fallback on /proc/bus/usb
    4834    
    4835     /dev/bus/usb is a relatively new thing probably not present on every
    4836     system
    4837 
    4838 commit f3fdf447916289cd92b7190377681894e8ab611a
    4839 Author: Daniel Drake <dsd@gentoo.org>
    4840 Date:   Sat Mar 8 00:10:16 2008 +0000
    4841 
    4842     Persistent libusb_device storage
    4843    
    4844     Devices are now assigned a session ID (currently busnum:devaddr) which
    4845     is used to distinguish unique devices.
    4846    
    4847     Now multiple callers of libusb_get_device_list will get the same
    4848     libusb_device structure instances.
    4849 
    4850 commit 23f8fb8bafeeda93ce234cb40eb7219d2e36c19c
    4851 Author: Daniel Drake <dsd@gentoo.org>
    4852 Date:   Thu Mar 6 23:43:57 2008 +0000
    4853 
    4854     Add convenience function to find and open a device by USB VID+PID
    4855    
    4856     Lots of libusb apps I write are simple test apps not intended to be real
    4857     apps. Having a function available to quickly locate my device will be
    4858     handy in such situations.
    4859 
    4860 commit 9cfdb494fccac53a4277da7c8b6d15f1a72a4959
    4861 Author: Daniel Drake <dsd@gentoo.org>
    4862 Date:   Thu Mar 6 23:25:20 2008 +0000
    4863 
    4864     Rework device discovery API
    4865    
    4866     libusb_find_devices and libusb_get_devices are no more
    4867    
    4868     libusb_get_device_list obtains a list of libusb_device structures for all
    4869     known devices in the system.
    4870    
    4871     Each libusb_device now has a reference count, defaulting to 1 on
    4872     instantiation. The reference count of 1 refers to the fact that it is
    4873     present in the list in this scenario.
    4874    
    4875     Opening a device adds a pointer to the libusb_device structure in the
    4876     handle, so that also adds a reference. Closing the device removes that
    4877     reference.
    4878    
    4879     The function to free the device list can optionally unref all the devices
    4880     inside.
    4881    
    4882     In future we will make the libusb_device instances all "global" so that if
    4883     the app calls get_device_list twice it actually gets the same libusb_device
    4884     structure references back. This way we can start to track disconnects, and
    4885     we can investigate adding a unique "session ID" to each libusb_device, an
    4886     identifier guaranteed to be unique to that device until reboot.
    4887 
    4888 commit 77cea822788e024c848c7f554915f771a2dc1e0f
    4889 Author: Daniel Drake <dsd@gentoo.org>
    4890 Date:   Thu Mar 6 17:05:04 2008 +0000
    4891 
    4892     Remove ctrl debug code
    4893    
    4894     This was unintentionally committed
    4895 
    4896 commit b873521a6f575628d535f89278bb67888004d0ca
    4897 Author: Daniel Drake <dsd@gentoo.org>
    4898 Date:   Tue Feb 26 22:11:34 2008 +0000
    4899 
    4900     Notifications for changes to the fd set
    4901    
    4902     Applications can now be notified when they should start and stop polling
    4903     new file descriptors.
    4904 
    4905 commit ca66e16a370c828d08a5bc3f9f203db145c81a4c
    4906 Author: Daniel Drake <dsd@gentoo.org>
    4907 Date:   Fri Feb 1 12:20:20 2008 +0000
    4908 
    4909     Fix header installation path
    4910 
    4911 commit e583100a4086c411093eef5c450880b965df6b1b
    4912 Author: Daniel Drake <dsd@gentoo.org>
    4913 Date:   Wed Jan 30 13:24:54 2008 +0000
    4914 
    4915     TODO update
    4916 
    4917 commit 637a8d7ff8a11a23588925d9d3003a609bda8075
    4918 Author: Daniel Drake <dsd@gentoo.org>
    4919 Date:   Wed Jan 30 13:19:10 2008 +0000
    4920 
    4921     Remove timers and signalfd
    4922    
    4923     Instead of timers, add a mechanism for informing the parent app when the
    4924     next timeout is due to happen, so that it can call us at that time.
    4925    
    4926     As we no longer use signals, signalfd has also been removed.
    4927 
    4928 commit 8c56abe2e13ed4dd8c15737c21be7b6b1e5cf2ac
    4929 Author: Daniel Drake <dsd@gentoo.org>
    4930 Date:   Sat Jan 26 18:16:56 2008 +0000
    4931 
    4932     Poll usbfs descriptors directly
    4933    
    4934     We don't need to use signalfd for this functionality because we can poll
    4935     the file descriptors for write events.
    4936 
    4937 commit e3ce855acec33d37dd833bca5dad5e8c3773003a
    4938 Author: Daniel Drake <dsd@gentoo.org>
    4939 Date:   Sat Jan 26 17:26:40 2008 +0000
    4940 
    4941     Fix dpfp example compilation
    4942 
    4943 commit 1d41a5cda2fefe826877ee4445199af30aa188b7
    4944 Author: Daniel Drake <dsd@gentoo.org>
    4945 Date:   Sat Jan 26 17:22:53 2008 +0000
    4946 
    4947     C++ header safety
    4948    
    4949     Pointed out by JF
    4950 
    4951 commit 37b7f9a112eb1441d352467f661205b8872d0553
    4952 Author: Daniel Drake <dsd@gentoo.org>
    4953 Date:   Sat Jan 26 14:03:43 2008 +0000
    4954 
    4955     Only use -fgnu89-inline when supported
    4956    
    4957     J F pointed out that this option only works on gcc 4.3 and newer.
    4958 
    4959 commit e3a09ca0b9cb6f46d54a0130f678c6097240a2bd
    4960 Author: Daniel Drake <dsd@gentoo.org>
    4961 Date:   Sat Jan 5 21:59:40 2008 +0000
    4962 
    4963     Remove more fpusb remnants
    4964 
    4965 commit dcd5e0075fa84601d997d29bb60bc8370b97a375
    4966 Author: Daniel Drake <dsd@gentoo.org>
    4967 Date:   Fri Jan 4 01:19:07 2008 +0000
    4968 
    4969     TODO update
    4970    
    4971     Start listing the things I want to discuss/reconsider before 1.0 API
    4972     is final.
    4973 
    4974 commit de53d972ed9c1f21f86ffd585560520e986f212c
    4975 Author: Daniel Drake <dsd@gentoo.org>
    4976 Date:   Fri Jan 4 01:17:06 2008 +0000
    4977 
    4978     Rename some _devh_ functions
    4979    
    4980     Decided against naming functions in this style based on advice from
    4981     Tim Roberts. Still not really sure about devh naming in general.
    4982 
    4983 commit 132d84bf8ae34bd0892b3d8207a53d87cc0a9cba
    4984 Author: Daniel Drake <dsd@gentoo.org>
    4985 Date:   Fri Jan 4 01:13:25 2008 +0000
    4986 
    4987     Use "transfer" instead of "msg"
    4988    
    4989     Based on a discussion with Tim Roberts.
    4990 
    4991 commit ea6af58a8643137eb01eeb7d2f65404e390feb1b
    4992 Author: Daniel Drake <dsd@gentoo.org>
    4993 Date:   Fri Jan 4 00:57:00 2008 +0000
    4994 
    4995     Plural of bus is busses
    4996    
    4997     SF #1633043
    4998 
    4999 commit dbb3fd871e3972b4e670f3161e7cd2f58f357600
    5000 Author: Daniel Drake <dsd@gentoo.org>
    5001 Date:   Fri Jan 4 00:54:57 2008 +0000
    5002 
    5003     API renaming: remove fpi and usb_ stuff
    5004    
    5005     fpi changed to usbi.
    5006    
    5007     We should not expose structures with prefix "usb_" in the public
    5008     namespace as it is quite likely there will be some conflict somewhere.
    5009     Instead, using "libusb_" should be safer.
    5010 
    5011 commit e9364d72151ae1de9cce4175f330fe1529f02511
    5012 Author: Daniel Drake <dsd@gentoo.org>
    5013 Date:   Fri Jan 4 00:40:49 2008 +0000
    5014 
    5015     Rename to libusb-1.0
    5016    
    5017     I've taken over the libusb project, and what was previously known as fpusb
    5018     will eventually be released as libusb-1.0.
    5019 
    5020 commit f4ed0b6a3e0a20555fdfc9e9b8be7e8a2c8ae192
    5021 Author: Daniel Drake <dsd@gentoo.org>
    5022 Date:   Sun Dec 30 22:09:50 2007 +0000
    5023 
    5024     Compiler flags update
    5025    
    5026     Also fix some warnings
    5027 
    5028 commit d3d671efe27491baf1d2ceadbfeeb4e7428d6f9a
    5029 Author: Daniel Drake <dsd@gentoo.org>
    5030 Date:   Sun Dec 30 22:05:17 2007 +0000
    5031 
    5032     Fix signalfd structure size on x86
    5033    
    5034     ptr is a 64-bit value
    5035 
    5036 commit dfac6756faad76071a92945e3e3a16b8a841a7ea
    5037 Author: Daniel Drake <dsd@gentoo.org>
    5038 Date:   Wed Dec 12 23:32:54 2007 +0000
    5039 
    5040     Don't pass ctrl_msg/bulk_msg structures through async paths
    5041    
    5042     These are easiest to construct on the stack, but in the async case it is
    5043     likely that the submitting function returns (hence stack is destroyed)
    5044     before URB completion.
    5045 
    5046 commit a8d2881eb7c273892acf2ff6e1f3f552631d1d11
    5047 Author: Daniel Drake <dsd@gentoo.org>
    5048 Date:   Mon Dec 3 23:29:22 2007 +0000
    5049 
    5050     Add functionality to access device descriptors
    5051 
    5052 commit b5a7a411087b37a6bf56b4688a9e3290daaed153
    5053 Author: Daniel Drake <dsd@gentoo.org>
    5054 Date:   Mon Dec 3 22:27:21 2007 +0000
    5055 
    5056     Rename fpusb_device_handle functions to devh
    5057    
    5058     Prevents confusion with functions that work on fpusb_dev structures.
    5059 
    5060 commit eacf4505a473df0f521d1b69d5b45448f0709e2d
    5061 Author: Daniel Drake <dsd@gentoo.org>
    5062 Date:   Sun Dec 2 23:16:57 2007 +0000
    5063 
    5064     Add API to access poll fd
    5065    
    5066     Almost forgot... :)
    5067 
    5068 commit 852bba4754ec57679c823f33e8feba6e4a564cbe
    5069 Author: Daniel Drake <dsd@gentoo.org>
    5070 Date:   Wed Nov 28 13:48:45 2007 +0000
    5071 
    5072     Initial commit
    5073    
    5074     Basic library structure which supports enumerating detected USB devices
     1For detailed information about the changes below, please see the git log or
     2visit: http://log.libusb.info
     3
     42016-10-01: v1.0.21:
     5* Core: Refactor code related to transfer flags and timeout handling
     6* Darwin: Ignore root hub simulation devices
     7* Darwin: Improved support for OS X El Capitan
     8* Darwin: Work around devices with buggy endpoint descriptors
     9* Darwin: Do not use objc_registerThreadWithCollector after its deprecation
     10* Darwin: Use C11 atomics on 10.12+ as the OS atomics are now deprecated
     11* Linux: Support preallocating kernel memory for zerocopy USB
     12* Linux: Deal with receiving POLLERR before all transfers have completed
     13* Solaris: Add solaris backend
     14* Windows: Add Visual Studio 2015 support
     15* Windows: Add usbdk backend
     16* Prevent attempts to recursively handle events
     17* Fix race condition in handle_timeout()
     18* Allow transferred argument to be optional in bulk APIs
     19* Various other bug fixes and improvements
     20
     212015-09-13: v1.0.20
     22* Add Haiku support
     23* Fix multiple memory and resource leaks (#16, #52, #76, #81)
     24* Fix possible deadlock when executing transfer callback
     25* New libusb_free_pollfds() API
     26* Darwin: Fix devices not being detected on OS X 10.8 (#48)
     27* Linux: Allow larger isochronous transfer submission (#23)
     28* Windows: Fix broken builds Cygwin/MinGW builds and compiler warnings
     29* Windows: Fix broken bus number lookup
     30* Windows: Improve submission of control requests for composite devices
     31* Examples: Add two-stage load support to fxload (#12)
     32* Correctly report cancellations due to timeouts
     33* Improve efficiency of event handling
     34* Improve speed of transfer submission in multi-threaded environments
     35* Various other bug fixes and improvements
     36The (#xx) numbers are libusb issue numbers, see ie:
     37https://github.com/libusb/libusb/issues/16
     38
     392014-05-30: v1.0.19
     40* Add support for USB bulk streams on Linux and Mac OS X (#11)
     41* Windows: Add AMD and Intel USB-3.0 root hub support
     42* Windows: Fix USB 3.0 speed detection on Windows 8 or later (#10)
     43* Added Russian translation for libusb_strerror strings
     44* All: Various small fixes and cleanups
     45
     462014-01-25: v1.0.18
     47* Fix multiple memory leaks
     48* Fix a crash when HID transfers return no data on Windows
     49* Ensure all pending events are consumed
     50* Improve Android and ucLinux support
     51* Multiple Windows improvements (error logging, VS2013, VIA xHCI support)
     52* Multiple OS X improvements (broken compilation, SIGFPE, 64bit support)
     53
     542013-09-06: v1.0.17
     55* Hotplug callbacks now always get passed a libusb_context, even if it is
     56  the default context. Previously NULL would be passed for the default context,
     57  but since the first context created is the default context, and most apps
     58  use only 1 context, this meant that apps explicitly creating a context would
     59  still get passed NULL
     60* Android: Add .mk files to build with the Android NDK
     61* Darwin: Add Xcode project
     62* Darwin: Fix crash on unplug (#121)
     63* Linux: Fix hang (deadlock) on libusb_exit
     64* Linux: Fix libusb build failure with --disable-udev (#124)
     65* Linux: Fix libusb_get_device_list() hang with --disable-udev (#130)
     66* OpenBSD: Update OpenBSD backend with support for control transfers to
     67  non-ugen(4) devices and make get_configuration() no longer generate I/O.
     68  Note that using this libusb version on OpenBSD requires using
     69  OpenBSD 5.3-current or later. Users of older OpenBSD versions are advised
     70  to stay with the libusb shipped with OpenBSD (mpi)
     71* Windows: fix libusb_dll_2010.vcxproj link errors (#129)
     72* Various other bug fixes and improvements
     73
     742013-07-11: v1.0.16
     75* Add hotplug support for Darwin and Linux (#9)
     76* Add superspeed endpoint companion descriptor support (#15)
     77* Add BOS descriptor support (#15)
     78* Make descriptor parsing code more robust
     79* New libusb_get_port_numbers API, this is libusb_get_port_path without
     80  the unnecessary context parameter, libusb_get_port_path is now deprecated
     81* New libusb_strerror API (#14)
     82* New libusb_set_auto_detach_kernel_driver API (#17)
     83* Improve topology API docs (#95)
     84* Logging now use a single write call per log-message, avoiding log-message
     85  "interlacing" when using multiple threads.
     86* Android: use Android logging when building on Android (#101)
     87* Darwin: make libusb_reset reenumerate device on descriptors change (#89)
     88* Darwin: add support for the LIBUSB_TRANSFER_ADD_ZERO_PACKET flag (#91)
     89* Darwin: add a device cache (#112, #114)
     90* Examples: Add sam3u_benchmark isochronous example by Harald Welte (#109)
     91* Many other bug fixes and improvements
     92The (#xx) numbers are libusbx issue numbers, see ie:
     93https://github.com/libusbx/libusbx/issues/9
     94
     952013-04-15: v1.0.15
     96* Improve transfer cancellation and avoid short read failures on broken descriptors
     97* Filter out 8-bit characters in libusb_get_string_descriptor_ascii()
     98* Add WinCE support
     99* Add library stress tests
     100* Add Cypress FX3 firmware upload support for fxload sample
     101* Add HID and kernel driver detach support capabilities detection
     102* Add SuperSpeed detection on OS X
     103* Fix bInterval value interpretation on OS X
     104* Fix issues with autoclaim, composite HID devices, interface autoclaim and
     105  early abort in libusb_close() on Windows. Also add VS2012 solution files.
     106* Improve fd event handling on Linux
     107* Other bug fixes and improvements
     108
     1092012-09-26: v1.0.14
     110* Reverts the previous API change with regards to bMaxPower.
     111  If this doesn't matter to you, you are encouraged to keep using v1.0.13,
     112  as it will use the same attribute as v2.0, to be released soon.
     113* Note that LIBUSB_API_VERSION is *decreased* to 0x010000FF and the previous
     114  guidelines with regards to concurrent use of MaxPower/bMaxPower still apply.
     115
     1162012-09-20: v1.0.13
     117* [MAJOR] Fix a typo in the API with struct libusb_config_descriptor where
     118  MaxPower was used instead of bMaxPower, as defined in the specs. If your
     119  application was accessing the MaxPower attribute, and you need to maintain
     120  compatibility with libusb or older versions, see APPENDIX A below.
     121* Fix broken support for the 0.1 -> 1.0 libusb-compat layer
     122* Fix unwanted cancellation of pending timeouts as well as major timeout related bugs
     123* Fix handling of HID and composite devices on Windows
     124* Introduce LIBUSB_API_VERSION macro
     125* Add Cypress FX/FX2 firmware upload sample, based on fxload from
     126  http://linux-hotplug.sourceforge.net
     127* Add libusb0 (libusb-win32) and libusbK driver support on Windows. Note that while
     128  the drivers allow it, isochronous transfers are not supported yet in libusb. Also
     129  not supported yet is the use of libusb-win32 filter drivers on composite interfaces
     130* Add support for the new get_capabilities ioctl on Linux and avoid unnecessary
     131  splitting of bulk transfers
     132* Improve support for newer Intel and Renesas USB 3.0 controllers on Windows
     133* Harmonize the device number for root hubs across platforms
     134* Other bug fixes and improvements
     135
     1362012-06-15: v1.0.12
     137* Fix a potential major regression with pthread on Linux
     138* Fix missing thread ID from debug log output on cygwin
     139* Fix possible crash when using longjmp and MinGW's gcc 4.6
     140* Add topology calls: libusb_get_port_number(), libusb_get_parent() & libusb_get_port_path()
     141* Add toggleable debug, using libusb_set_debug() or the LIBUSB_DEBUG environment variable
     142* Define log levels in libusb.h and set timestamp origin to first libusb_init() call
     143* All logging is now sent to to stderr (info was sent to stdout previously)
     144* Update log messages severity and avoid polluting log output on OS-X
     145* Add HID driver support on Windows
     146* Enable interchangeability of MSVC and MinGW DLLs
     147* Additional bug fixes and improvements
     148
     1492012-05-08: v1.0.11
     150* Revert removal of critical Windows event handling that was introduced in 1.0.10
     151* Fix a possible deadlock in Windows when submitting transfers
     152* Add timestamped logging
     153* Add NetBSD support (experimental) and BSD libusb_get_device_speed() data
     154* Add bootstrap.sh alongside autogen.sh (bootstrap.sh doesn't invoke configure)
     155* Search for device nodes in /dev for Android support
     156* Other bug fixes
     157
     1582012-04-17: v1.0.10
     159* Public release
     160* Add libusb_get_version
     161* Add Visual Studio 2010 project files
     162* Some Windows code cleanup
     163* Fix xusb sample warnings
     164
     1652012-04-02: v1.0.9
     166* First libusbx release
     167* Add libusb_get_device_speed (all, except BSD) and libusb_error_name
     168* Add Windows support (WinUSB driver only)
     169* Add OpenBSD support
     170* Add xusb sample
     171* Tons of bug fixes
     172
     1732010-05-07: v1.0.8
     174* Bug fixes
     175
     1762010-04-19: v1.0.7
     177* Bug fixes and documentation tweaks
     178* Add more interface class definitions
     179
     1802009-11-22: v1.0.6
     181* Bug fixes
     182* Increase libusb_handle_events() timeout to 60s for powersaving
     183
     1842009-11-15: v1.0.5
     185 * Use timerfd when available for timer management
     186 * Small fixes/updates
     187
     1882009-11-06: v1.0.4 release
     189 * Bug fixes including transfer locking to fix some potential threading races
     190 * More flexibility with clock types on Linux
     191 * Use new bulk continuation tracking in Linux 2.6.32 for improved handling
     192   of short/failed transfers
     193
     1942009-08-27: v1.0.3 release
     195 * Bug fixes
     196 * Add libusb_get_max_iso_packet_size()
     197
     1982009-06-13: v1.0.2 release
     199 * Bug fixes
     200
     2012009-05-12: v1.0.1 release
     202 * Bug fixes
     203 * Darwin backend
     204
     2052008-12-13: v1.0.0 release
     206 * Bug fixes
     207
     2082008-11-21: v0.9.4 release
     209 * Bug fixes
     210 * Add libusb_attach_kernel_driver()
     211
     2122008-08-23: v0.9.3 release
     213 * Bug fixes
     214
     2152008-07-19: v0.9.2 release
     216 * Bug fixes
     217
     2182008-06-28: v0.9.1 release
     219 * Bug fixes
     220 * Introduce contexts to the API
     221 * Compatibility with new Linux kernel features
     222
     2232008-05-25: v0.9.0 release
     224 * First libusb-1.0 beta release
     225
     226~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     227
     228APPENDIX A - How to maintain code compatibility with versions of libusb and
     229libusb that use MaxPower:
     230
     231If you must to maintain compatibility with versions of the library that aren't
     232using the bMaxPower attribute in struct libusb_config_descriptor, the
     233recommended way is to use the new LIBUSB_API_VERSION macro with an #ifdef.
     234For instance, if your code was written as follows:
     235
     236  if (dev->config[0].MaxPower < 250)
     237
     238Then you should modify it to have:
     239
     240#if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01000100)
     241  if (dev->config[0].bMaxPower < 250)
     242#else
     243  if (dev->config[0].MaxPower < 250)
     244#endif
  • TabularUnified libusb1/trunk/INSTALL

    r1876 r1882  
    22*************************
    33
    4 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
    5 2006 Free Software Foundation, Inc.
    6 
    7 This file is free documentation; the Free Software Foundation gives
    8 unlimited permission to copy, distribute and modify it.
     4Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
     5Inc.
     6
     7   Copying and distribution of this file, with or without modification,
     8are permitted in any medium without royalty provided the copyright
     9notice and this notice are preserved.  This file is offered as-is,
     10without warranty of any kind.
    911
    1012Basic Installation
    1113==================
    1214
    13 Briefly, the shell commands `./configure; make; make install' should
    14 configure, build, and install this package.  The following
     15   Briefly, the shell command `./configure && make && make install'
     16should configure, build, and install this package.  The following
    1517more-detailed instructions are generic; see the `README' file for
    16 instructions specific to this package.
     18instructions specific to this package.  Some packages provide this
     19`INSTALL' file but do not implement all of the features documented
     20below.  The lack of an optional feature in a given package is not
     21necessarily a bug.  More recommendations for GNU packages can be found
     22in *note Makefile Conventions: (standards)Makefile Conventions.
    1723
    1824   The `configure' shell script attempts to guess correct values for
     
    4349of `autoconf'.
    4450
    45 The simplest way to compile this package is:
     51   The simplest way to compile this package is:
    4652
    4753  1. `cd' to the directory containing the package's source code and type
     
    5460
    5561  3. Optionally, type `make check' to run any self-tests that come with
    56      the package.
     62     the package, generally using the just-built uninstalled binaries.
    5763
    5864  4. Type `make install' to install the programs and any data files and
    59      documentation.
    60 
    61   5. You can remove the program binaries and object files from the
     65     documentation.  When installing into a prefix owned by root, it is
     66     recommended that the package be configured and built as a regular
     67     user, and only the `make install' phase executed with root
     68     privileges.
     69
     70  5. Optionally, type `make installcheck' to repeat any self-tests, but
     71     this time using the binaries in their final installed location.
     72     This target does not install anything.  Running this target as a
     73     regular user, particularly if the prior `make install' required
     74     root privileges, verifies that the installation completed
     75     correctly.
     76
     77  6. You can remove the program binaries and object files from the
    6278     source code directory by typing `make clean'.  To also remove the
    6379     files that `configure' created (so you can compile the package for
     
    6884     with the distribution.
    6985
     86  7. Often, you can also type `make uninstall' to remove the installed
     87     files again.  In practice, not all packages have tested that
     88     uninstallation works correctly, even though it is required by the
     89     GNU Coding Standards.
     90
     91  8. Some packages, particularly those that use Automake, provide `make
     92     distcheck', which can by used by developers to test that all other
     93     targets like `make install' and `make uninstall' work correctly.
     94     This target is generally not run by end users.
     95
    7096Compilers and Options
    7197=====================
    7298
    73 Some systems require unusual options for compilation or linking that the
    74 `configure' script does not know about.  Run `./configure --help' for
    75 details on some of the pertinent environment variables.
     99   Some systems require unusual options for compilation or linking that
     100the `configure' script does not know about.  Run `./configure --help'
     101for details on some of the pertinent environment variables.
    76102
    77103   You can give `configure' initial values for configuration parameters
     
    86112====================================
    87113
    88 You can compile the package for more than one kind of computer at the
     114   You can compile the package for more than one kind of computer at the
    89115same time, by placing the object files for each architecture in their
    90116own directory.  To do this, you can use GNU `make'.  `cd' to the
    91117directory where you want the object files and executables to go and run
    92118the `configure' script.  `configure' automatically checks for the
    93 source code in the directory that `configure' is in and in `..'.
     119source code in the directory that `configure' is in and in `..'.  This
     120is known as a "VPATH" build.
    94121
    95122   With a non-GNU `make', it is safer to compile the package for one
     
    98125reconfiguring for another architecture.
    99126
     127   On MacOS X 10.5 and later systems, you can create libraries and
     128executables that work on multiple system types--known as "fat" or
     129"universal" binaries--by specifying multiple `-arch' options to the
     130compiler but only a single `-arch' option to the preprocessor.  Like
     131this:
     132
     133     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
     134                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
     135                 CPP="gcc -E" CXXCPP="g++ -E"
     136
     137   This is not guaranteed to produce working output in all cases, you
     138may have to build one architecture at a time and combine the results
     139using the `lipo' tool if you have problems.
     140
    100141Installation Names
    101142==================
    102143
    103 By default, `make install' installs the package's commands under
     144   By default, `make install' installs the package's commands under
    104145`/usr/local/bin', include files under `/usr/local/include', etc.  You
    105146can specify an installation prefix other than `/usr/local' by giving
    106 `configure' the option `--prefix=PREFIX'.
     147`configure' the option `--prefix=PREFIX', where PREFIX must be an
     148absolute file name.
    107149
    108150   You can specify separate installation prefixes for
     
    115157options like `--bindir=DIR' to specify different values for particular
    116158kinds of files.  Run `configure --help' for a list of the directories
    117 you can set and what kinds of files go in them.
     159you can set and what kinds of files go in them.  In general, the
     160default for these options is expressed in terms of `${prefix}', so that
     161specifying just `--prefix' will affect all of the other directory
     162specifications that were not explicitly provided.
     163
     164   The most portable way to affect installation locations is to pass the
     165correct locations to `configure'; however, many packages provide one or
     166both of the following shortcuts of passing variable assignments to the
     167`make install' command line to change installation locations without
     168having to reconfigure or recompile.
     169
     170   The first method involves providing an override variable for each
     171affected directory.  For example, `make install
     172prefix=/alternate/directory' will choose an alternate location for all
     173directory configuration variables that were expressed in terms of
     174`${prefix}'.  Any directories that were specified during `configure',
     175but not in terms of `${prefix}', must each be overridden at install
     176time for the entire installation to be relocated.  The approach of
     177makefile variable overrides for each directory variable is required by
     178the GNU Coding Standards, and ideally causes no recompilation.
     179However, some platforms have known limitations with the semantics of
     180shared libraries that end up requiring recompilation when using this
     181method, particularly noticeable in packages that use GNU Libtool.
     182
     183   The second method involves providing the `DESTDIR' variable.  For
     184example, `make install DESTDIR=/alternate/directory' will prepend
     185`/alternate/directory' before all installation names.  The approach of
     186`DESTDIR' overrides is not required by the GNU Coding Standards, and
     187does not work on platforms that have drive letters.  On the other hand,
     188it does better at avoiding recompilation issues, and works well even
     189when some directory options were not specified in terms of `${prefix}'
     190at `configure' time.
     191
     192Optional Features
     193=================
    118194
    119195   If the package supports it, you can cause programs to be installed
     
    121197option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
    122198
    123 Optional Features
    124 =================
    125 
    126 Some packages pay attention to `--enable-FEATURE' options to
     199   Some packages pay attention to `--enable-FEATURE' options to
    127200`configure', where FEATURE indicates an optional part of the package.
    128201They may also pay attention to `--with-PACKAGE' options, where PACKAGE
     
    136209`--x-libraries=DIR' to specify their locations.
    137210
     211   Some packages offer the ability to configure how verbose the
     212execution of `make' will be.  For these packages, running `./configure
     213--enable-silent-rules' sets the default to minimal output, which can be
     214overridden with `make V=1'; while running `./configure
     215--disable-silent-rules' sets the default to verbose, which can be
     216overridden with `make V=0'.
     217
     218Particular systems
     219==================
     220
     221   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
     222CC is not installed, it is recommended to use the following options in
     223order to use an ANSI C compiler:
     224
     225     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
     226
     227and if that doesn't work, install pre-built binaries of GCC for HP-UX.
     228
     229   HP-UX `make' updates targets which have the same time stamps as
     230their prerequisites, which makes it generally unusable when shipped
     231generated files such as `configure' are involved.  Use GNU `make'
     232instead.
     233
     234   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
     235parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
     236a workaround.  If GNU CC is not installed, it is therefore recommended
     237to try
     238
     239     ./configure CC="cc"
     240
     241and if that doesn't work, try
     242
     243     ./configure CC="cc -nodtk"
     244
     245   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
     246directory contains several dysfunctional programs; working variants of
     247these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
     248in your `PATH', put it _after_ `/usr/bin'.
     249
     250   On Haiku, software installed for all users goes in `/boot/common',
     251not `/usr/local'.  It is recommended to use the following options:
     252
     253     ./configure --prefix=/boot/common
     254
    138255Specifying the System Type
    139256==========================
    140257
    141 There may be some features `configure' cannot figure out automatically,
    142 but needs to determine by the type of machine the package will run on.
    143 Usually, assuming the package is built to be run on the _same_
    144 architectures, `configure' can figure that out, but if it prints a
    145 message saying it cannot guess the machine type, give it the
     258   There may be some features `configure' cannot figure out
     259automatically, but needs to determine by the type of machine the package
     260will run on.  Usually, assuming the package is built to be run on the
     261_same_ architectures, `configure' can figure that out, but if it prints
     262a message saying it cannot guess the machine type, give it the
    146263`--build=TYPE' option.  TYPE can either be a short name for the system
    147264type, such as `sun4', or a canonical name which has the form:
     
    151268where SYSTEM can have one of these forms:
    152269
    153      OS KERNEL-OS
     270     OS
     271     KERNEL-OS
    154272
    155273   See the file `config.sub' for the possible values of each field.  If
     
    169287================
    170288
    171 If you want to set default values for `configure' scripts to share, you
    172 can create a site shell script called `config.site' that gives default
    173 values for variables like `CC', `cache_file', and `prefix'.
     289   If you want to set default values for `configure' scripts to share,
     290you can create a site shell script called `config.site' that gives
     291default values for variables like `CC', `cache_file', and `prefix'.
    174292`configure' looks for `PREFIX/share/config.site' if it exists, then
    175293`PREFIX/etc/config.site' if it exists.  Or, you can set the
     
    180298==================
    181299
    182 Variables not defined in a site shell script can be set in the
     300   Variables not defined in a site shell script can be set in the
    183301environment passed to `configure'.  However, some packages may run
    184302configure again during the build, and the customized values of these
     
    192310
    193311Unfortunately, this technique does not work for `CONFIG_SHELL' due to
    194 an Autoconf bug.  Until the bug is fixed you can use this workaround:
    195 
    196      CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
     312an Autoconf limitation.  Until the limitation is lifted, you can use
     313this workaround:
     314
     315     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
    197316
    198317`configure' Invocation
    199318======================
    200319
    201 `configure' recognizes the following options to control how it operates.
     320   `configure' recognizes the following options to control how it
     321operates.
    202322
    203323`--help'
    204324`-h'
    205      Print a summary of the options to `configure', and exit.
     325     Print a summary of all of the options to `configure', and exit.
     326
     327`--help=short'
     328`--help=recursive'
     329     Print a summary of the options unique to this package's
     330     `configure', and exit.  The `short' variant lists options used
     331     only in the top level, while the `recursive' variant lists options
     332     also present in any nested packages.
    206333
    207334`--version'
     
    230357     `configure' can determine that directory automatically.
    231358
     359`--prefix=DIR'
     360     Use DIR as the installation prefix.  *note Installation Names::
     361     for more details, including other options available for fine-tuning
     362     the installation locations.
     363
     364`--no-create'
     365`-n'
     366     Run the configure checks, but stop before creating any output
     367     files.
     368
    232369`configure' also accepts some other, not widely useful, options.  Run
    233370`configure --help' for more details.
    234 
  • TabularUnified libusb1/trunk/Makefile.am

    r1876 r1882  
    22ACLOCAL_AMFLAGS = -I m4
    33DISTCLEANFILES = libusb-1.0.pc
    4 MAINTAINERCLEANFILES = ChangeLog
    5 EXTRA_DIST = TODO PORTING msvc
     4EXTRA_DIST = TODO PORTING msvc libusb/libusb-1.0.def libusb/version_nano.h \
     5  examples/getopt/getopt.c examples/getopt/getopt1.c examples/getopt/getopt.h \
     6  android Xcode
    67SUBDIRS = libusb doc
    78
     
    1011endif
    1112
     13if BUILD_TESTS
     14SUBDIRS += tests
     15endif
     16
    1217pkgconfigdir=$(libdir)/pkgconfig
    1318pkgconfig_DATA=libusb-1.0.pc
    1419
    15 .PHONY: ChangeLog dist-up
    16 ChangeLog:
    17         git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
    18 
    19 dist-hook: ChangeLog
     20.PHONY: dist-up
    2021
    2122reldir = .release/$(distdir)
     
    2627        rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
    2728        rm -rf $(reldir)
    28 
  • TabularUnified libusb1/trunk/Makefile.in

    r1879 r1882  
    1 # Makefile.in generated by automake 1.11.1 from Makefile.am.
     1# Makefile.in generated by automake 1.14.1 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
    6 # Inc.
     4# Copyright (C) 1994-2013 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    1716
    1817VPATH = @srcdir@
     18am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
     19am__make_running_with_option = \
     20  case $${target_option-} in \
     21      ?) ;; \
     22      *) echo "am__make_running_with_option: internal error: invalid" \
     23              "target option '$${target_option-}' specified" >&2; \
     24         exit 1;; \
     25  esac; \
     26  has_opt=no; \
     27  sane_makeflags=$$MAKEFLAGS; \
     28  if $(am__is_gnu_make); then \
     29    sane_makeflags=$$MFLAGS; \
     30  else \
     31    case $$MAKEFLAGS in \
     32      *\\[\ \   ]*) \
     33        bs=\\; \
     34        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     35          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     36    esac; \
     37  fi; \
     38  skip_next=no; \
     39  strip_trailopt () \
     40  { \
     41    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     42  }; \
     43  for flg in $$sane_makeflags; do \
     44    test $$skip_next = yes && { skip_next=no; continue; }; \
     45    case $$flg in \
     46      *=*|--*) continue;; \
     47        -*I) strip_trailopt 'I'; skip_next=yes;; \
     48      -*I?*) strip_trailopt 'I';; \
     49        -*O) strip_trailopt 'O'; skip_next=yes;; \
     50      -*O?*) strip_trailopt 'O';; \
     51        -*l) strip_trailopt 'l'; skip_next=yes;; \
     52      -*l?*) strip_trailopt 'l';; \
     53      -[dEDm]) skip_next=yes;; \
     54      -[JT]) skip_next=yes;; \
     55    esac; \
     56    case $$flg in \
     57      *$$target_option*) has_opt=yes; break;; \
     58    esac; \
     59  done; \
     60  test $$has_opt = yes
     61am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     62am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    1963pkgdatadir = $(datadir)/@PACKAGE@
    2064pkgincludedir = $(includedir)/@PACKAGE@
     
    3680host_triplet = @host@
    3781@BUILD_EXAMPLES_TRUE@am__append_1 = examples
     82@BUILD_TESTS_TRUE@am__append_2 = tests
    3883subdir = .
    39 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
    40         $(srcdir)/Makefile.in $(srcdir)/config.h.in \
    41         $(srcdir)/libusb-1.0.pc.in $(top_srcdir)/configure AUTHORS \
    42         COPYING ChangeLog INSTALL NEWS THANKS TODO compile \
    43         config.guess config.sub depcomp install-sh ltmain.sh missing
     84DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
     85        $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
     86        $(top_srcdir)/configure $(am__configure_deps) \
     87        $(srcdir)/config.h.in $(srcdir)/libusb-1.0.pc.in COPYING TODO \
     88        compile config.guess config.sub depcomp install-sh missing \
     89        ltmain.sh
    4490ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4591am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
     
    55101CONFIG_CLEAN_FILES = libusb-1.0.pc
    56102CONFIG_CLEAN_VPATH_FILES =
    57 AM_V_GEN = $(am__v_GEN_$(V))
    58 am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
    59 am__v_GEN_0 = @echo "  GEN   " $@;
    60 AM_V_at = $(am__v_at_$(V))
    61 am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
     103AM_V_P = $(am__v_P_@AM_V@)
     104am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     105am__v_P_0 = false
     106am__v_P_1 = :
     107AM_V_GEN = $(am__v_GEN_@AM_V@)
     108am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     109am__v_GEN_0 = @echo "  GEN     " $@;
     110am__v_GEN_1 =
     111AM_V_at = $(am__v_at_@AM_V@)
     112am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    62113am__v_at_0 = @
     114am__v_at_1 =
    63115SOURCES =
    64116DIST_SOURCES =
    65 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
    66         html-recursive info-recursive install-data-recursive \
    67         install-dvi-recursive install-exec-recursive \
    68         install-html-recursive install-info-recursive \
    69         install-pdf-recursive install-ps-recursive install-recursive \
    70         installcheck-recursive installdirs-recursive pdf-recursive \
    71         ps-recursive uninstall-recursive
     117RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
     118        ctags-recursive dvi-recursive html-recursive info-recursive \
     119        install-data-recursive install-dvi-recursive \
     120        install-exec-recursive install-html-recursive \
     121        install-info-recursive install-pdf-recursive \
     122        install-ps-recursive install-recursive installcheck-recursive \
     123        installdirs-recursive pdf-recursive ps-recursive \
     124        tags-recursive uninstall-recursive
     125am__can_run_installinfo = \
     126  case $$AM_UPDATE_INFO_DIR in \
     127    n|no|NO) false;; \
     128    *) (install-info --version) >/dev/null 2>&1;; \
     129  esac
    72130am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
    73131am__vpath_adj = case $$p in \
     
    91149  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
    92150  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
     151am__uninstall_files_from_dir = { \
     152  test -z "$$files" \
     153    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
     154    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
     155         $(am__cd) "$$dir" && rm -f $$files; }; \
     156  }
    93157am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
    94158DATA = $(pkgconfig_DATA)
    95159RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
    96160  distclean-recursive maintainer-clean-recursive
    97 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
    98         $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
    99         distdir dist dist-all distcheck
     161am__recursive_targets = \
     162  $(RECURSIVE_TARGETS) \
     163  $(RECURSIVE_CLEAN_TARGETS) \
     164  $(am__extra_recursive_targets)
     165AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
     166        cscope distdir dist dist-all distcheck
     167am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
     168        $(LISP)config.h.in
     169# Read a list of newline-separated strings from the standard input,
     170# and print each of them once, without duplicates.  Input order is
     171# *not* preserved.
     172am__uniquify_input = $(AWK) '\
     173  BEGIN { nonempty = 0; } \
     174  { items[$$0] = 1; nonempty = 1; } \
     175  END { if (nonempty) { for (i in items) print i; }; } \
     176'
     177# Make sure the list of sources is unique.  This is necessary because,
     178# e.g., the same source file might be shared among _SOURCES variables
     179# for different programs/libraries.
     180am__define_uniq_tagged_files = \
     181  list='$(am__tagged_files)'; \
     182  unique=`for i in $$list; do \
     183    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     184  done | $(am__uniquify_input)`
    100185ETAGS = etags
    101186CTAGS = ctags
    102 DIST_SUBDIRS = libusb doc examples
     187CSCOPE = cscope
     188DIST_SUBDIRS = libusb doc examples tests
    103189DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    104190distdir = $(PACKAGE)-$(VERSION)
    105191top_distdir = $(distdir)
    106192am__remove_distdir = \
    107   { test ! -d "$(distdir)" \
    108     || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
    109          && rm -fr "$(distdir)"; }; }
     193  if test -d "$(distdir)"; then \
     194    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
     195      && rm -rf "$(distdir)" \
     196      || { sleep 5 && rm -rf "$(distdir)"; }; \
     197  else :; fi
     198am__post_remove_distdir = $(am__remove_distdir)
    110199am__relativize = \
    111200  dir0=`pwd`; \
     
    135224GZIP_ENV = --best
    136225DIST_ARCHIVES = $(distdir).tar.bz2
     226DIST_TARGETS = dist-bzip2
    137227distuninstallcheck_listfiles = find . -type f -print
     228am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
     229  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
    138230distcleancheck_listfiles = find . -type f -print
    139231ACLOCAL = @ACLOCAL@
     
    151243CPP = @CPP@
    152244CPPFLAGS = @CPPFLAGS@
     245CXX = @CXX@
     246CXXCPP = @CXXCPP@
     247CXXDEPMODE = @CXXDEPMODE@
     248CXXFLAGS = @CXXFLAGS@
    153249CYGPATH_W = @CYGPATH_W@
    154250DEFS = @DEFS@
     
    178274LTLDFLAGS = @LTLDFLAGS@
    179275LTLIBOBJS = @LTLIBOBJS@
    180 MAINT = @MAINT@
    181276MAKEINFO = @MAKEINFO@
    182277MANIFEST_TOOL = @MANIFEST_TOOL@
     
    187282OBJEXT = @OBJEXT@
    188283OS_DARWIN = @OS_DARWIN@
     284OS_HAIKU = @OS_HAIKU@
    189285OS_LINUX = @OS_LINUX@
     286OS_NETBSD = @OS_NETBSD@
    190287OS_OPENBSD = @OS_OPENBSD@
    191 OS_OS2 = @OS_OS2@
     288OS_SUNOS = @OS_SUNOS@
    192289OS_WINDOWS = @OS_WINDOWS@
    193290OTOOL = @OTOOL@
     
    201298PACKAGE_VERSION = @PACKAGE_VERSION@
    202299PATH_SEPARATOR = @PATH_SEPARATOR@
    203 PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
    204300RANLIB = @RANLIB@
    205301RC = @RC@
     
    208304SHELL = @SHELL@
    209305STRIP = @STRIP@
    210 THREAD_CFLAGS = @THREAD_CFLAGS@
    211306USE_UDEV = @USE_UDEV@
     307USE_USBDK = @USE_USBDK@
    212308VERSION = @VERSION@
    213 VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
    214309abs_builddir = @abs_builddir@
    215310abs_srcdir = @abs_srcdir@
     
    218313ac_ct_AR = @ac_ct_AR@
    219314ac_ct_CC = @ac_ct_CC@
     315ac_ct_CXX = @ac_ct_CXX@
    220316ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
    221317am__include = @am__include@
     
    267363ACLOCAL_AMFLAGS = -I m4
    268364DISTCLEANFILES = libusb-1.0.pc
    269 MAINTAINERCLEANFILES = ChangeLog
    270 EXTRA_DIST = TODO PORTING msvc
    271 SUBDIRS = libusb doc $(am__append_1)
     365EXTRA_DIST = TODO PORTING msvc libusb/libusb-1.0.def libusb/version_nano.h \
     366  examples/getopt/getopt.c examples/getopt/getopt1.c examples/getopt/getopt.h \
     367  android Xcode
     368
     369SUBDIRS = libusb doc $(am__append_1) $(am__append_2)
    272370pkgconfigdir = $(libdir)/pkgconfig
    273371pkgconfig_DATA = libusb-1.0.pc
     
    277375
    278376.SUFFIXES:
    279 am--refresh:
     377am--refresh: Makefile
    280378        @:
    281 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
     379$(srcdir)/Makefile.in: $(srcdir)/Makefile.am  $(am__configure_deps)
    282380        @for dep in $?; do \
    283381          case '$(am__configure_deps)' in \
     
    306404        $(SHELL) ./config.status --recheck
    307405
    308 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
     406$(top_srcdir)/configure: $(am__configure_deps)
    309407        $(am__cd) $(srcdir) && $(AUTOCONF)
    310 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
     408$(ACLOCAL_M4): $(am__aclocal_m4_deps)
    311409        $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
    312410$(am__aclocal_m4_deps):
    313411
    314412config.h: stamp-h1
    315         @if test ! -f $@; then \
    316           rm -f stamp-h1; \
    317           $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
    318         else :; fi
     413        @test -f $@ || rm -f stamp-h1
     414        @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
    319415
    320416stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
    321417        @rm -f stamp-h1
    322418        cd $(top_builddir) && $(SHELL) ./config.status config.h
    323 $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
     419$(srcdir)/config.h.in: $(am__configure_deps)
    324420        ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
    325421        rm -f stamp-h1
     
    341437install-pkgconfigDATA: $(pkgconfig_DATA)
    342438        @$(NORMAL_INSTALL)
    343         test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
    344439        @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
     440        if test -n "$$list"; then \
     441          echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
     442          $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
     443        fi; \
    345444        for p in $$list; do \
    346445          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
     
    356455        @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
    357456        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
    358         test -n "$$files" || exit 0; \
    359         echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
    360         cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
     457        dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
    361458
    362459# This directory's subdirectories are mostly independent; you can cd
    363 # into them and run `make' without going through this Makefile.
    364 # To change the values of `make' variables: instead of editing Makefiles,
    365 # (1) if the variable is set in `config.status', edit `config.status'
    366 #     (which will cause the Makefiles to be regenerated when you run `make');
    367 # (2) otherwise, pass the desired values on the `make' command line.
    368 $(RECURSIVE_TARGETS):
    369         @fail= failcom='exit 1'; \
    370         for f in x $$MAKEFLAGS; do \
    371           case $$f in \
    372             *=* | --[!k]*);; \
    373             *k*) failcom='fail=yes';; \
    374           esac; \
    375         done; \
     460# into them and run 'make' without going through this Makefile.
     461# To change the values of 'make' variables: instead of editing Makefiles,
     462# (1) if the variable is set in 'config.status', edit 'config.status'
     463#     (which will cause the Makefiles to be regenerated when you run 'make');
     464# (2) otherwise, pass the desired values on the 'make' command line.
     465$(am__recursive_targets):
     466        @fail=; \
     467        if $(am__make_keepgoing); then \
     468          failcom='fail=yes'; \
     469        else \
     470          failcom='exit 1'; \
     471        fi; \
    376472        dot_seen=no; \
    377473        target=`echo $@ | sed s/-recursive//`; \
    378         list='$(SUBDIRS)'; for subdir in $$list; do \
     474        case "$@" in \
     475          distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
     476          *) list='$(SUBDIRS)' ;; \
     477        esac; \
     478        for subdir in $$list; do \
    379479          echo "Making $$target in $$subdir"; \
    380480          if test "$$subdir" = "."; then \
     
    391491        fi; test -z "$$fail"
    392492
    393 $(RECURSIVE_CLEAN_TARGETS):
    394         @fail= failcom='exit 1'; \
    395         for f in x $$MAKEFLAGS; do \
    396           case $$f in \
    397             *=* | --[!k]*);; \
    398             *k*) failcom='fail=yes';; \
    399           esac; \
    400         done; \
    401         dot_seen=no; \
    402         case "$@" in \
    403           distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
    404           *) list='$(SUBDIRS)' ;; \
    405         esac; \
    406         rev=''; for subdir in $$list; do \
    407           if test "$$subdir" = "."; then :; else \
    408             rev="$$subdir $$rev"; \
    409           fi; \
    410         done; \
    411         rev="$$rev ."; \
    412         target=`echo $@ | sed s/-recursive//`; \
    413         for subdir in $$rev; do \
    414           echo "Making $$target in $$subdir"; \
    415           if test "$$subdir" = "."; then \
    416             local_target="$$target-am"; \
    417           else \
    418             local_target="$$target"; \
    419           fi; \
    420           ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
    421           || eval $$failcom; \
    422         done && test -z "$$fail"
    423 tags-recursive:
    424         list='$(SUBDIRS)'; for subdir in $$list; do \
    425           test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
    426         done
    427 ctags-recursive:
    428         list='$(SUBDIRS)'; for subdir in $$list; do \
    429           test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
    430         done
    431 
    432 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    433         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    434         unique=`for i in $$list; do \
    435             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    436           done | \
    437           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    438               END { if (nonempty) { for (i in files) print i; }; }'`; \
    439         mkid -fID $$unique
    440 tags: TAGS
    441 
    442 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
    443                 $(TAGS_FILES) $(LISP)
     493ID: $(am__tagged_files)
     494        $(am__define_uniq_tagged_files); mkid -fID $$unique
     495tags: tags-recursive
     496TAGS: tags
     497
     498tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    444499        set x; \
    445500        here=`pwd`; \
     
    457512          fi; \
    458513        done; \
    459         list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
    460         unique=`for i in $$list; do \
    461             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    462           done | \
    463           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    464               END { if (nonempty) { for (i in files) print i; }; }'`; \
     514        $(am__define_uniq_tagged_files); \
    465515        shift; \
    466516        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    474524          fi; \
    475525        fi
    476 ctags: CTAGS
    477 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
    478                 $(TAGS_FILES) $(LISP)
    479         list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
    480         unique=`for i in $$list; do \
    481             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    482           done | \
    483           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    484               END { if (nonempty) { for (i in files) print i; }; }'`; \
     526ctags: ctags-recursive
     527
     528CTAGS: ctags
     529ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     530        $(am__define_uniq_tagged_files); \
    485531        test -z "$(CTAGS_ARGS)$$unique" \
    486532          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    491537          && $(am__cd) $(top_srcdir) \
    492538          && gtags -i $(GTAGS_ARGS) "$$here"
     539cscope: cscope.files
     540        test ! -s cscope.files \
     541          || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
     542clean-cscope:
     543        -rm -f cscope.files
     544cscope.files: clean-cscope cscopelist
     545cscopelist: cscopelist-recursive
     546
     547cscopelist-am: $(am__tagged_files)
     548        list='$(am__tagged_files)'; \
     549        case "$(srcdir)" in \
     550          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     551          *) sdir=$(subdir)/$(srcdir) ;; \
     552        esac; \
     553        for i in $$list; do \
     554          if test -f "$$i"; then \
     555            echo "$(subdir)/$$i"; \
     556          else \
     557            echo "$$sdir/$$i"; \
     558          fi; \
     559        done >> $(top_builddir)/cscope.files
    493560
    494561distclean-tags:
    495562        -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
     563        -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
    496564
    497565distdir: $(DISTFILES)
     
    529597        @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
    530598          if test "$$subdir" = .; then :; else \
    531             test -d "$(distdir)/$$subdir" \
    532             || $(MKDIR_P) "$(distdir)/$$subdir" \
    533             || exit 1; \
    534           fi; \
    535         done
    536         @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
    537           if test "$$subdir" = .; then :; else \
     599            $(am__make_dryrun) \
     600              || test -d "$(distdir)/$$subdir" \
     601              || $(MKDIR_P) "$(distdir)/$$subdir" \
     602              || exit 1; \
    538603            dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
    539604            $(am__relativize); \
     
    555620          fi; \
    556621        done
    557         $(MAKE) $(AM_MAKEFLAGS) \
    558           top_distdir="$(top_distdir)" distdir="$(distdir)" \
    559           dist-hook
    560622        -test -n "$(am__skip_mode_fix)" \
    561623        || find "$(distdir)" -type d ! -perm -755 \
     
    567629dist-gzip: distdir
    568630        tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
    569         $(am__remove_distdir)
     631        $(am__post_remove_distdir)
    570632dist-bzip2: distdir
    571         tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
    572         $(am__remove_distdir)
    573 
    574 dist-lzma: distdir
    575         tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
    576         $(am__remove_distdir)
     633        tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
     634        $(am__post_remove_distdir)
     635
     636dist-lzip: distdir
     637        tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
     638        $(am__post_remove_distdir)
    577639
    578640dist-xz: distdir
    579         tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
    580         $(am__remove_distdir)
     641        tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
     642        $(am__post_remove_distdir)
    581643
    582644dist-tarZ: distdir
     645        @echo WARNING: "Support for shar distribution archives is" \
     646                       "deprecated." >&2
     647        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
    583648        tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
    584         $(am__remove_distdir)
     649        $(am__post_remove_distdir)
    585650
    586651dist-shar: distdir
     652        @echo WARNING: "Support for distribution archives compressed with" \
     653                       "legacy program 'compress' is deprecated." >&2
     654        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
    587655        shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
    588         $(am__remove_distdir)
     656        $(am__post_remove_distdir)
    589657
    590658dist-zip: distdir
    591659        -rm -f $(distdir).zip
    592660        zip -rq $(distdir).zip $(distdir)
    593         $(am__remove_distdir)
    594 
    595 dist dist-all: distdir
    596         tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
    597         $(am__remove_distdir)
     661        $(am__post_remove_distdir)
     662
     663dist dist-all:
     664        $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
     665        $(am__post_remove_distdir)
    598666
    599667# This target untars the dist file and tries a VPATH configuration.  Then
     
    606674        *.tar.bz2*) \
    607675          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
    608         *.tar.lzma*) \
    609           lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
     676        *.tar.lz*) \
     677          lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
    610678        *.tar.xz*) \
    611679          xz -dc $(distdir).tar.xz | $(am__untar) ;;\
     
    617685          unzip $(distdir).zip ;;\
    618686        esac
    619         chmod -R a-w $(distdir); chmod a+w $(distdir)
    620         mkdir $(distdir)/_build
    621         mkdir $(distdir)/_inst
     687        chmod -R a-w $(distdir)
     688        chmod u+w $(distdir)
     689        mkdir $(distdir)/_build $(distdir)/_inst
    622690        chmod a-w $(distdir)
    623691        test -d $(distdir)/_build || exit 0; \
     
    626694          && am__cwd=`pwd` \
    627695          && $(am__cd) $(distdir)/_build \
    628           && ../configure --srcdir=.. --prefix="$$dc_install_base" \
     696          && ../configure \
     697            $(AM_DISTCHECK_CONFIGURE_FLAGS) \
    629698            $(DISTCHECK_CONFIGURE_FLAGS) \
     699            --srcdir=.. --prefix="$$dc_install_base" \
    630700          && $(MAKE) $(AM_MAKEFLAGS) \
    631701          && $(MAKE) $(AM_MAKEFLAGS) dvi \
     
    650720          && cd "$$am__cwd" \
    651721          || exit 1
    652         $(am__remove_distdir)
     722        $(am__post_remove_distdir)
    653723        @(echo "$(distdir) archives ready for distribution: "; \
    654724          list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
    655725          sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
    656726distuninstallcheck:
    657         @$(am__cd) '$(distuninstallcheck_dir)' \
    658         && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
     727        @test -n '$(distuninstallcheck_dir)' || { \
     728          echo 'ERROR: trying to run $@ with an empty' \
     729               '$$(distuninstallcheck_dir)' >&2; \
     730          exit 1; \
     731        }; \
     732        $(am__cd) '$(distuninstallcheck_dir)' || { \
     733          echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
     734          exit 1; \
     735        }; \
     736        test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
    659737           || { echo "ERROR: files left after uninstall:" ; \
    660738                if test -n "$(DESTDIR)"; then \
     
    690768installcheck: installcheck-recursive
    691769install-strip:
    692         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
    693           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
    694           `test -z '$(STRIP)' || \
    695             echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
     770        if test -z '$(STRIP)'; then \
     771          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     772            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     773              install; \
     774        else \
     775          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     776            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     777            "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
     778        fi
    696779mostlyclean-generic:
    697780
     
    706789        @echo "This command is intended for maintainers to use"
    707790        @echo "it deletes files that may require special tools to rebuild."
    708         -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
    709791clean: clean-recursive
    710792
     
    777859uninstall-am: uninstall-pkgconfigDATA
    778860
    779 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
    780         ctags-recursive install-am install-strip tags-recursive
    781 
    782 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
    783         all all-am am--refresh check check-am clean clean-generic \
    784         clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
    785         dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
    786         dist-zip distcheck distclean distclean-generic distclean-hdr \
    787         distclean-libtool distclean-tags distcleancheck distdir \
    788         distuninstallcheck dvi dvi-am html html-am info info-am \
    789         install install-am install-data install-data-am install-dvi \
    790         install-dvi-am install-exec install-exec-am install-html \
    791         install-html-am install-info install-info-am install-man \
    792         install-pdf install-pdf-am install-pkgconfigDATA install-ps \
    793         install-ps-am install-strip installcheck installcheck-am \
    794         installdirs installdirs-am maintainer-clean \
     861.MAKE: $(am__recursive_targets) all install-am install-strip
     862
     863.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
     864        am--refresh check check-am clean clean-cscope clean-generic \
     865        clean-libtool cscope cscopelist-am ctags ctags-am dist \
     866        dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
     867        dist-xz dist-zip distcheck distclean distclean-generic \
     868        distclean-hdr distclean-libtool distclean-tags distcleancheck \
     869        distdir distuninstallcheck dvi dvi-am html html-am info \
     870        info-am install install-am install-data install-data-am \
     871        install-dvi install-dvi-am install-exec install-exec-am \
     872        install-html install-html-am install-info install-info-am \
     873        install-man install-pdf install-pdf-am install-pkgconfigDATA \
     874        install-ps install-ps-am install-strip installcheck \
     875        installcheck-am installdirs installdirs-am maintainer-clean \
    795876        maintainer-clean-generic mostlyclean mostlyclean-generic \
    796         mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
    797         uninstall uninstall-am uninstall-pkgconfigDATA
    798 
    799 
    800 .PHONY: ChangeLog dist-up
    801 ChangeLog:
    802         git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
    803 
    804 dist-hook: ChangeLog
     877        mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
     878        uninstall-am uninstall-pkgconfigDATA
     879
     880
     881.PHONY: dist-up
    805882dist-up: dist
    806883        rm -rf $(reldir)
  • TabularUnified libusb1/trunk/NEWS

    r1876 r1882  
    1 This file lists notable changes in each release. For the full history of all
    2 changes, see ChangeLog.
    3 
    4 2012-04-20: 1.0.9
    5 * Numerous bug fixes and improvements
    6 * Backend for Windows, for devices using the WinUSB.sys driver
    7 * Backend for OpenBSD and NetBSD, for devices using the ugen driver
    8 * Add libusb_get_device_speed()
    9 * Add libusb_has_capability()
    10 * Add libusb_error_name()
    11 * Add libusb_get_version()
    12 
    13 2010-05-07: v1.0.8
    14 * Bug fixes
    15 
    16 2010-04-19: v1.0.7
    17 * Bug fixes and documentation tweaks
    18 * Add more interface class definitions
    19 
    20 2009-11-22: v1.0.6
    21 * Bug fixes
    22 * Increase libusb_handle_events() timeout to 60s for powersaving
    23 
    24 2009-11-15: v1.0.5
    25  * Use timerfd when available for timer management
    26  * Small fixes/updates
    27 
    28 2009-11-06: v1.0.4 release
    29  * Bug fixes including transfer locking to fix some potential threading races
    30  * More flexibility with clock types on Linux
    31  * Use new bulk continuation tracking in Linux 2.6.32 for improved handling
    32    of short/failed transfers
    33 
    34 2009-08-27: v1.0.3 release
    35  * Bug fixes
    36  * Add libusb_get_max_iso_packet_size()
    37 
    38 2009-06-13: v1.0.2 release
    39  * Bug fixes
    40 
    41 2009-05-12: v1.0.1 release
    42  * Bug fixes
    43  * Darwin backend
    44 
    45 2008-12-13: v1.0.0 release
    46  * Bug fixes
    47 
    48 2008-11-21: v0.9.4 release
    49  * Bug fixes
    50  * Add libusb_attach_kernel_driver()
    51 
    52 2008-08-23: v0.9.3 release
    53  * Bug fixes
    54 
    55 2008-07-19: v0.9.2 release
    56  * Bug fixes
    57 
    58 2008-06-28: v0.9.1 release
    59  * Bug fixes
    60  * Introduce contexts to the API
    61  * Compatibility with new Linux kernel features
    62 
    63 2008-05-25: v0.9.0 release
    64  * First libusb-1.0 beta release
    65 
     1For the latest libusb news, please refer to the ChangeLog file, or visit:
     2http://libusb.info
  • TabularUnified libusb1/trunk/PORTING

    r1876 r1882  
    9393submissions). Even if you do not make such changes yourself, please do raise
    9494the issues on the mailing list at the very minimum.
    95 
  • TabularUnified libusb1/trunk/README

    r1876 r1882  
    1 libusb
    2 ======
     1# libusb
     2
     3[![Build Status](https://travis-ci.org/libusb/libusb.svg?branch=master)](https://travis-ci.org/libusb/libusb)
     4[![Build status](https://ci.appveyor.com/api/projects/status/xvrfam94jii4a6lw?svg=true)](https://ci.appveyor.com/project/LudovicRousseau/libusb)
     5[![Coverity Scan Build Status](https://scan.coverity.com/projects/2180/badge.svg)](https://scan.coverity.com/projects/libusb-libusb)
    36
    47libusb is a library for USB device access from Linux, Mac OS X,
    5 OpenBSD, NetBSD, and Windows userspace.
    6 It is written in C and licensed under the LGPL-2.1 (see COPYING).
     8Windows, OpenBSD/NetBSD and Haiku userspace.
     9It is written in C (Haiku backend in C++) and licensed under the GNU
     10Lesser General Public License version 2.1 or, at your option, any later
     11version (see [COPYING](COPYING)).
    712
    813libusb is abstracted internally in such a way that it can hopefully
    9 be ported to other operating systems. See the PORTING file for some
    10 information, if you fancy a challenge. :)
     14be ported to other operating systems. Please see the [PORTING](PORTING)
     15file for more information.
    1116
    1217libusb homepage:
    13 http://libusb.org/
     18http://libusb.info/
    1419
    1520Developers will wish to consult the API documentation:
    16 http://libusb.sourceforge.net/api-1.0/
     21http://api.libusb.info
    1722
    1823Use the mailing list for questions, comments, etc:
    19 http://libusb.org/wiki/MailingList
     24http://mailing-list.libusb.info
    2025
    21 - Peter Stuge <peter@stuge.se>
    22 (use the mailing list rather than mailing developers directly)
     26- Pete Batard <pete@akeo.ie>
     27- Hans de Goede <hdegoede@redhat.com>
     28- Xiaofan Chen <xiaofanc@gmail.com>
     29- Ludovic Rousseau <ludovic.rousseau@gmail.com>
     30- Nathan Hjelm <hjelmn@cs.unm.edu>
     31- Chris Dickens <christopher.a.dickens@gmail.com>
     32
     33(Please use the mailing list rather than mailing developers directly)
  • TabularUnified libusb1/trunk/TODO

    r1876 r1882  
    1 for 1.1 or future
    2 ==================
    3 optional timerfd support (runtime detection)
    4 notifications of hotplugged/unplugged devices
    5 offer API to create/destroy handle_events thread
    6 isochronous sync I/O?
    7 exposing of parent-child device relationships
    8 "usb primer" introduction docs
    9 more examples
     1Please see the libusb roadmap by visiting:
     2https://github.com/libusb/libusb/milestones?direction=asc&sort=due_date&state=open
  • TabularUnified libusb1/trunk/aclocal.m4

    r1879 r1882  
    1 # generated automatically by aclocal 1.11.1 -*- Autoconf -*-
    2 
    3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    4 # 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
     1# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
     2
     3# Copyright (C) 1996-2013 Free Software Foundation, Inc.
     4
    55# This file is free software; the Free Software Foundation
    66# gives unlimited permission to copy and/or distribute it,
     
    1212# PARTICULAR PURPOSE.
    1313
     14m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
    1415m4_ifndef([AC_AUTOCONF_VERSION],
    1516  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
    16 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
    17 [m4_warning([this file was generated for autoconf 2.64.
     17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
     18[m4_warning([this file was generated for autoconf 2.69.
    1819You have another version of autoconf.  It may work, but is not guaranteed to.
    1920If you have problems, you may need to regenerate the build system entirely.
    20 To do so, use the procedure documented by the package, typically `autoreconf'.])])
    21 
    22 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
     21To do so, use the procedure documented by the package, typically 'autoreconf'.])])
     22
     23# Copyright (C) 2002-2013 Free Software Foundation, Inc.
    2324#
    2425# This file is free software; the Free Software Foundation
     
    3233# (This private macro should not be called outside this file.)
    3334AC_DEFUN([AM_AUTOMAKE_VERSION],
    34 [am__api_version='1.11'
     35[am__api_version='1.14'
    3536dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
    3637dnl require some minimum version.  Point them to the right macro.
    37 m4_if([$1], [1.11.1], [],
     38m4_if([$1], [1.14.1], [],
    3839      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
    3940])
     
    5152# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
    5253AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
    53 [AM_AUTOMAKE_VERSION([1.11.1])dnl
     54[AM_AUTOMAKE_VERSION([1.14.1])dnl
    5455m4_ifndef([AC_AUTOCONF_VERSION],
    5556  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
     
    5859# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
    5960
    60 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
     61# Copyright (C) 2001-2013 Free Software Foundation, Inc.
    6162#
    6263# This file is free software; the Free Software Foundation
     
    6566
    6667# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
    67 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
    68 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
     68# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
     69# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
    6970#
    7071# Of course, Automake must honor this variable whenever it calls a
     
    8586# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
    8687# are both prefixed by $srcdir.  In an in-source build this is usually
    87 # harmless because $srcdir is `.', but things will broke when you
     88# harmless because $srcdir is '.', but things will broke when you
    8889# start a VPATH build or use an absolute $srcdir.
    8990#
     
    111112# AM_CONDITIONAL                                            -*- Autoconf -*-
    112113
    113 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
    114 # Free Software Foundation, Inc.
    115 #
    116 # This file is free software; the Free Software Foundation
    117 # gives unlimited permission to copy and/or distribute it,
    118 # with or without modifications, as long as this notice is preserved.
    119 
    120 # serial 9
     114# Copyright (C) 1997-2013 Free Software Foundation, Inc.
     115#
     116# This file is free software; the Free Software Foundation
     117# gives unlimited permission to copy and/or distribute it,
     118# with or without modifications, as long as this notice is preserved.
    121119
    122120# AM_CONDITIONAL(NAME, SHELL-CONDITION)
     
    124122# Define a conditional.
    125123AC_DEFUN([AM_CONDITIONAL],
    126 [AC_PREREQ(2.52)dnl
    127  ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
    128         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
     124[AC_PREREQ([2.52])dnl
     125 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
     126       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
    129127AC_SUBST([$1_TRUE])dnl
    130128AC_SUBST([$1_FALSE])dnl
     
    145143fi])])
    146144
    147 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
    148 # Free Software Foundation, Inc.
    149 #
    150 # This file is free software; the Free Software Foundation
    151 # gives unlimited permission to copy and/or distribute it,
    152 # with or without modifications, as long as this notice is preserved.
    153 
    154 # serial 10
    155 
    156 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
     145# Copyright (C) 1999-2013 Free Software Foundation, Inc.
     146#
     147# This file is free software; the Free Software Foundation
     148# gives unlimited permission to copy and/or distribute it,
     149# with or without modifications, as long as this notice is preserved.
     150
     151
     152# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
    157153# written in clear, in which case automake, when reading aclocal.m4,
    158154# will think it sees a *use*, and therefore will trigger all it's
     
    164160# ----------------------
    165161# See how the compiler implements dependency checking.
    166 # NAME is "CC", "CXX", "GCJ", or "OBJC".
     162# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
    167163# We try a few techniques and use that to set a single cache variable.
    168164#
     
    177173AC_REQUIRE([AM_DEP_TRACK])dnl
    178174
    179 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
    180        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
    181        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
    182        [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
    183        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
    184                    [depcc="$$1"   am_compiler_list=])
     175m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
     176      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
     177      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
     178      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
     179      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
     180      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
     181                    [depcc="$$1"   am_compiler_list=])
    185182
    186183AC_CACHE_CHECK([dependency style of $depcc],
     
    190187  # making bogus files that we don't know about and never remove.  For
    191188  # instance it was reported that on HP-UX the gcc test will end up
    192   # making a dummy file named `D' -- because `-MD' means `put the output
    193   # in D'.
     189  # making a dummy file named 'D' -- because '-MD' means "put the output
     190  # in D".
     191  rm -rf conftest.dir
    194192  mkdir conftest.dir
    195193  # Copy depcomp to subdir because otherwise we won't find it if we're
     
    230228    for i in 1 2 3 4 5 6; do
    231229      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    232       # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
    233       # Solaris 8's {/usr,}/bin/sh.
    234       touch sub/conftst$i.h
     230      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
     231      # Solaris 10 /bin/sh.
     232      echo '/* dummy */' > sub/conftst$i.h
    235233    done
    236234    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
    237235
    238     # We check with `-c' and `-o' for the sake of the "dashmstdout"
     236    # We check with '-c' and '-o' for the sake of the "dashmstdout"
    239237    # mode.  It turns out that the SunPro C++ compiler does not properly
    240     # handle `-M -o', and we need to detect this.  Also, some Intel
    241     # versions had trouble with output in subdirs
     238    # handle '-M -o', and we need to detect this.  Also, some Intel
     239    # versions had trouble with output in subdirs.
    242240    am__obj=sub/conftest.${OBJEXT-o}
    243241    am__minus_obj="-o $am__obj"
     
    248246      ;;
    249247    nosideeffect)
    250       # after this tag, mechanisms are not by side-effect, so they'll
    251       # only be used when explicitly requested
     248      # After this tag, mechanisms are not by side-effect, so they'll
     249      # only be used when explicitly requested.
    252250      if test "x$enable_dependency_tracking" = xyes; then
    253251        continue
     
    256254      fi
    257255      ;;
    258     msvisualcpp | msvcmsys)
    259       # This compiler won't grok `-c -o', but also, the minuso test has
     256    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
     257      # This compiler won't grok '-c -o', but also, the minuso test has
    260258      # not run yet.  These depmodes are late enough in the game, and
    261259      # so weak that their functioning should not be impacted.
     
    305303# -------------
    306304# Choose a directory name for dependency files.
    307 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
     305# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
    308306AC_DEFUN([AM_SET_DEPDIR],
    309307[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
     
    315313# ------------
    316314AC_DEFUN([AM_DEP_TRACK],
    317 [AC_ARG_ENABLE(dependency-tracking,
    318 [  --disable-dependency-tracking  speeds up one-time build
    319   --enable-dependency-tracking   do not reject slow dependency extractors])
     315[AC_ARG_ENABLE([dependency-tracking], [dnl
     316AS_HELP_STRING(
     317  [--enable-dependency-tracking],
     318  [do not reject slow dependency extractors])
     319AS_HELP_STRING(
     320  [--disable-dependency-tracking],
     321  [speeds up one-time build])])
    320322if test "x$enable_dependency_tracking" != xno; then
    321323  am_depcomp="$ac_aux_dir/depcomp"
    322324  AMDEPBACKSLASH='\'
     325  am__nodep='_no'
    323326fi
    324327AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
    325328AC_SUBST([AMDEPBACKSLASH])dnl
    326329_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
     330AC_SUBST([am__nodep])dnl
     331_AM_SUBST_NOTMAKE([am__nodep])dnl
    327332])
    328333
    329334# Generate code to set up dependency tracking.              -*- Autoconf -*-
    330335
    331 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
    332 # Free Software Foundation, Inc.
    333 #
    334 # This file is free software; the Free Software Foundation
    335 # gives unlimited permission to copy and/or distribute it,
    336 # with or without modifications, as long as this notice is preserved.
    337 
    338 #serial 5
     336# Copyright (C) 1999-2013 Free Software Foundation, Inc.
     337#
     338# This file is free software; the Free Software Foundation
     339# gives unlimited permission to copy and/or distribute it,
     340# with or without modifications, as long as this notice is preserved.
     341
    339342
    340343# _AM_OUTPUT_DEPENDENCY_COMMANDS
     
    342345AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
    343346[{
    344   # Autoconf 2.62 quotes --file arguments for eval, but not when files
     347  # Older Autoconf quotes --file arguments for eval, but not when files
    345348  # are listed without --file.  Let's play safe and only enable the eval
    346349  # if we detect the quoting.
     
    355358    mf=`echo "$mf" | sed -e 's/:.*$//'`
    356359    # Check whether this is an Automake generated Makefile or not.
    357     # We used to match only the files named `Makefile.in', but
     360    # We used to match only the files named 'Makefile.in', but
    358361    # some people rename them; so instead we look at the file content.
    359362    # Grep'ing the first line is not enough: some people post-process
     
    367370    fi
    368371    # Extract the definition of DEPDIR, am__include, and am__quote
    369     # from the Makefile without running `make'.
     372    # from the Makefile without running 'make'.
    370373    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
    371374    test -z "$DEPDIR" && continue
    372375    am__include=`sed -n 's/^am__include = //p' < "$mf"`
    373     test -z "am__include" && continue
     376    test -z "$am__include" && continue
    374377    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
    375     # When using ansi2knr, U may be empty or an underscore; expand it
    376     U=`sed -n 's/^U = //p' < "$mf"`
    377378    # Find all dependency output files, they are included files with
    378379    # $(DEPDIR) in their names.  We invoke sed twice because it is the
     
    381382    for file in `sed -n "
    382383      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
    383          sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
     384         sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
    384385      # Make sure the directory exists.
    385386      test -f "$dirpart/$file" && continue
     
    399400#
    400401# This code is only required when automatic dependency tracking
    401 # is enabled.  FIXME.  This creates each `.P' file that we will
     402# is enabled.  FIXME.  This creates each '.P' file that we will
    402403# need in order to bootstrap the dependency handling code.
    403404AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
     
    409410# Do all the work for Automake.                             -*- Autoconf -*-
    410411
    411 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    412 # 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
    413 #
    414 # This file is free software; the Free Software Foundation
    415 # gives unlimited permission to copy and/or distribute it,
    416 # with or without modifications, as long as this notice is preserved.
    417 
    418 # serial 16
     412# Copyright (C) 1996-2013 Free Software Foundation, Inc.
     413#
     414# This file is free software; the Free Software Foundation
     415# gives unlimited permission to copy and/or distribute it,
     416# with or without modifications, as long as this notice is preserved.
    419417
    420418# This macro actually does too much.  Some checks are only needed if
    421419# your package does certain things.  But this isn't really a big deal.
     420
     421dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
     422m4_define([AC_PROG_CC],
     423m4_defn([AC_PROG_CC])
     424[_AM_PROG_CC_C_O
     425])
    422426
    423427# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
     
    433437# release and drop the old call support.
    434438AC_DEFUN([AM_INIT_AUTOMAKE],
    435 [AC_PREREQ([2.62])dnl
     439[AC_PREREQ([2.65])dnl
    436440dnl Autoconf wants to disallow AM_ names.  We explicitly allow
    437441dnl the ones we care about.
     
    462466dnl Distinguish between old-style and new-style calls.
    463467m4_ifval([$2],
    464 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
     468[AC_DIAGNOSE([obsolete],
     469             [$0: two- and three-arguments forms are deprecated.])
     470m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
    465471 AC_SUBST([PACKAGE], [$1])dnl
    466472 AC_SUBST([VERSION], [$2])],
    467473[_AM_SET_OPTIONS([$1])dnl
    468474dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
    469 m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
     475m4_if(
     476  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
     477  [ok:ok],,
    470478  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
    471479 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
     
    473481
    474482_AM_IF_OPTION([no-define],,
    475 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
    476  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
     483[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
     484 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
    477485
    478486# Some tools Automake needs.
    479487AC_REQUIRE([AM_SANITY_CHECK])dnl
    480488AC_REQUIRE([AC_ARG_PROGRAM])dnl
    481 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
    482 AM_MISSING_PROG(AUTOCONF, autoconf)
    483 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
    484 AM_MISSING_PROG(AUTOHEADER, autoheader)
    485 AM_MISSING_PROG(MAKEINFO, makeinfo)
     489AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
     490AM_MISSING_PROG([AUTOCONF], [autoconf])
     491AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
     492AM_MISSING_PROG([AUTOHEADER], [autoheader])
     493AM_MISSING_PROG([MAKEINFO], [makeinfo])
    486494AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
    487495AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
    488 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
     496AC_REQUIRE([AC_PROG_MKDIR_P])dnl
     497# For better backward compatibility.  To be removed once Automake 1.9.x
     498# dies out for good.  For more background, see:
     499# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
     500# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
     501AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
    489502# We need awk for the "check" target.  The system "awk" is bad on
    490503# some platforms.
     
    497510_AM_IF_OPTION([no-dependencies],,
    498511[AC_PROVIDE_IFELSE([AC_PROG_CC],
    499                   [_AM_DEPENDENCIES(CC)],
    500                   [define([AC_PROG_CC],
    501                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
     512                  [_AM_DEPENDENCIES([CC])],
     513                  [m4_define([AC_PROG_CC],
     514                             m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
    502515AC_PROVIDE_IFELSE([AC_PROG_CXX],
    503                   [_AM_DEPENDENCIES(CXX)],
    504                   [define([AC_PROG_CXX],
    505                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
     516                  [_AM_DEPENDENCIES([CXX])],
     517                  [m4_define([AC_PROG_CXX],
     518                             m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
    506519AC_PROVIDE_IFELSE([AC_PROG_OBJC],
    507                   [_AM_DEPENDENCIES(OBJC)],
    508                   [define([AC_PROG_OBJC],
    509                           defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
    510 ])
    511 _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
    512 dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
    513 dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
    514 dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
     520                  [_AM_DEPENDENCIES([OBJC])],
     521                  [m4_define([AC_PROG_OBJC],
     522                             m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
     523AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
     524                  [_AM_DEPENDENCIES([OBJCXX])],
     525                  [m4_define([AC_PROG_OBJCXX],
     526                             m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
     527])
     528AC_REQUIRE([AM_SILENT_RULES])dnl
     529dnl The testsuite driver may need to know about EXEEXT, so add the
     530dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
     531dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
    515532AC_CONFIG_COMMANDS_PRE(dnl
    516533[m4_provide_if([_AM_COMPILER_EXEEXT],
    517534  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
    518 ])
    519 
    520 dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
     535
     536# POSIX will say in a future version that running "rm -f" with no argument
     537# is OK; and we want to be able to make that assumption in our Makefile
     538# recipes.  So use an aggressive probe to check that the usage we want is
     539# actually supported "in the wild" to an acceptable degree.
     540# See automake bug#10828.
     541# To make any issue more visible, cause the running configure to be aborted
     542# by default if the 'rm' program in use doesn't match our expectations; the
     543# user can still override this though.
     544if rm -f && rm -fr && rm -rf; then : OK; else
     545  cat >&2 <<'END'
     546Oops!
     547
     548Your 'rm' program seems unable to run without file operands specified
     549on the command line, even when the '-f' option is present.  This is contrary
     550to the behaviour of most rm programs out there, and not conforming with
     551the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
     552
     553Please tell bug-automake@gnu.org about your system, including the value
     554of your $PATH and any error possibly output before this message.  This
     555can help us improve future automake versions.
     556
     557END
     558  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
     559    echo 'Configuration will proceed anyway, since you have set the' >&2
     560    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
     561    echo >&2
     562  else
     563    cat >&2 <<'END'
     564Aborting the configuration process, to ensure you take notice of the issue.
     565
     566You can download and install GNU coreutils to get an 'rm' implementation
     567that behaves properly: <http://www.gnu.org/software/coreutils/>.
     568
     569If you want to complete the configuration process using your problematic
     570'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
     571to "yes", and re-run configure.
     572
     573END
     574    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
     575  fi
     576fi])
     577
     578dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
    521579dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
    522580dnl mangled by Autoconf and run in a shell conditional statement.
    523581m4_define([_AC_COMPILER_EXEEXT],
    524582m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
    525 
    526583
    527584# When config.status generates a header, we must update the stamp-h file.
     
    546603echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
    547604
    548 # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
     605# Copyright (C) 2001-2013 Free Software Foundation, Inc.
    549606#
    550607# This file is free software; the Free Software Foundation
     
    565622  esac
    566623fi
    567 AC_SUBST(install_sh)])
    568 
    569 # Copyright (C) 2003, 2005  Free Software Foundation, Inc.
    570 #
    571 # This file is free software; the Free Software Foundation
    572 # gives unlimited permission to copy and/or distribute it,
    573 # with or without modifications, as long as this notice is preserved.
    574 
    575 # serial 2
     624AC_SUBST([install_sh])])
     625
     626# Copyright (C) 2003-2013 Free Software Foundation, Inc.
     627#
     628# This file is free software; the Free Software Foundation
     629# gives unlimited permission to copy and/or distribute it,
     630# with or without modifications, as long as this notice is preserved.
    576631
    577632# Check whether the underlying file-system supports filenames
     
    588643AC_SUBST([am__leading_dot])])
    589644
    590 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
    591 # From Jim Meyering
    592 
    593 # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
    594 # Free Software Foundation, Inc.
    595 #
    596 # This file is free software; the Free Software Foundation
    597 # gives unlimited permission to copy and/or distribute it,
    598 # with or without modifications, as long as this notice is preserved.
    599 
    600 # serial 5
    601 
    602 # AM_MAINTAINER_MODE([DEFAULT-MODE])
    603 # ----------------------------------
    604 # Control maintainer-specific portions of Makefiles.
    605 # Default is to disable them, unless `enable' is passed literally.
    606 # For symmetry, `disable' may be passed as well.  Anyway, the user
    607 # can override the default with the --enable/--disable switch.
    608 AC_DEFUN([AM_MAINTAINER_MODE],
    609 [m4_case(m4_default([$1], [disable]),
    610        [enable], [m4_define([am_maintainer_other], [disable])],
    611        [disable], [m4_define([am_maintainer_other], [enable])],
    612        [m4_define([am_maintainer_other], [enable])
    613         m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
    614 AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
    615   dnl maintainer-mode's default is 'disable' unless 'enable' is passed
    616   AC_ARG_ENABLE([maintainer-mode],
    617 [  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
    618                           (and sometimes confusing) to the casual installer],
    619       [USE_MAINTAINER_MODE=$enableval],
    620       [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
    621   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
    622   AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
    623   MAINT=$MAINTAINER_MODE_TRUE
    624   AC_SUBST([MAINT])dnl
    625 ]
    626 )
    627 
    628 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
    629 
    630645# Check to see how 'make' treats includes.                  -*- Autoconf -*-
    631646
    632 # Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
    633 #
    634 # This file is free software; the Free Software Foundation
    635 # gives unlimited permission to copy and/or distribute it,
    636 # with or without modifications, as long as this notice is preserved.
    637 
    638 # serial 4
     647# Copyright (C) 2001-2013 Free Software Foundation, Inc.
     648#
     649# This file is free software; the Free Software Foundation
     650# gives unlimited permission to copy and/or distribute it,
     651# with or without modifications, as long as this notice is preserved.
    639652
    640653# AM_MAKE_INCLUDE()
     
    655668# First try GNU make style include.
    656669echo "include confinc" > confmf
    657 # Ignore all kinds of additional output from `make'.
     670# Ignore all kinds of additional output from 'make'.
    658671case `$am_make -s -f confmf 2> /dev/null` in #(
    659672*the\ am__doit\ target*)
     
    680693])
    681694
    682 # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
    683 # Free Software Foundation, Inc.
    684 #
    685 # This file is free software; the Free Software Foundation
    686 # gives unlimited permission to copy and/or distribute it,
    687 # with or without modifications, as long as this notice is preserved.
    688 
    689 # serial 6
    690 
    691 # AM_PROG_CC_C_O
    692 # --------------
    693 # Like AC_PROG_CC_C_O, but changed for automake.
    694 AC_DEFUN([AM_PROG_CC_C_O],
    695 [AC_REQUIRE([AC_PROG_CC_C_O])dnl
    696 AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
    697 AC_REQUIRE_AUX_FILE([compile])dnl
    698 # FIXME: we rely on the cache variable name because
    699 # there is no other way.
    700 set dummy $CC
    701 am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
    702 eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
    703 if test "$am_t" != yes; then
    704    # Losing compiler, so override with the script.
    705    # FIXME: It is wrong to rewrite CC.
    706    # But if we don't then we get into trouble of one sort or another.
    707    # A longer-term fix would be to have automake use am__CC in this case,
    708    # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
    709    CC="$am_aux_dir/compile $CC"
    710 fi
    711 dnl Make sure AC_PROG_CC is never called again, or it will override our
    712 dnl setting of CC.
    713 m4_define([AC_PROG_CC],
    714           [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
    715 ])
    716 
    717695# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
    718696
    719 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
    720 # Free Software Foundation, Inc.
    721 #
    722 # This file is free software; the Free Software Foundation
    723 # gives unlimited permission to copy and/or distribute it,
    724 # with or without modifications, as long as this notice is preserved.
    725 
    726 # serial 6
     697# Copyright (C) 1997-2013 Free Software Foundation, Inc.
     698#
     699# This file is free software; the Free Software Foundation
     700# gives unlimited permission to copy and/or distribute it,
     701# with or without modifications, as long as this notice is preserved.
    727702
    728703# AM_MISSING_PROG(NAME, PROGRAM)
     
    733708AC_SUBST($1)])
    734709
    735 
    736710# AM_MISSING_HAS_RUN
    737711# ------------------
    738 # Define MISSING if not defined so far and test if it supports --run.
    739 # If it does, set am_missing_run to use it, otherwise, to nothing.
     712# Define MISSING if not defined so far and test if it is modern enough.
     713# If it is, set am_missing_run to use it, otherwise, to nothing.
    740714AC_DEFUN([AM_MISSING_HAS_RUN],
    741715[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
     
    750724fi
    751725# Use eval to expand $SHELL
    752 if eval "$MISSING --run true"; then
    753   am_missing_run="$MISSING --run "
     726if eval "$MISSING --is-lightweight"; then
     727  am_missing_run="$MISSING "
    754728else
    755729  am_missing_run=
    756   AC_MSG_WARN([`missing' script is too old or missing])
    757 fi
    758 ])
    759 
    760 # Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
    761 #
    762 # This file is free software; the Free Software Foundation
    763 # gives unlimited permission to copy and/or distribute it,
    764 # with or without modifications, as long as this notice is preserved.
    765 
    766 # AM_PROG_MKDIR_P
    767 # ---------------
    768 # Check for `mkdir -p'.
    769 AC_DEFUN([AM_PROG_MKDIR_P],
    770 [AC_PREREQ([2.60])dnl
    771 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
    772 dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
    773 dnl while keeping a definition of mkdir_p for backward compatibility.
    774 dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
    775 dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
    776 dnl Makefile.ins that do not define MKDIR_P, so we do our own
    777 dnl adjustment using top_builddir (which is defined more often than
    778 dnl MKDIR_P).
    779 AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
    780 case $mkdir_p in
    781   [[\\/$]]* | ?:[[\\/]]*) ;;
    782   */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
    783 esac
     730  AC_MSG_WARN(['missing' script is too old or missing])
     731fi
    784732])
    785733
    786734# Helper functions for option handling.                     -*- Autoconf -*-
    787735
    788 # Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
    789 #
    790 # This file is free software; the Free Software Foundation
    791 # gives unlimited permission to copy and/or distribute it,
    792 # with or without modifications, as long as this notice is preserved.
    793 
    794 # serial 4
     736# Copyright (C) 2001-2013 Free Software Foundation, Inc.
     737#
     738# This file is free software; the Free Software Foundation
     739# gives unlimited permission to copy and/or distribute it,
     740# with or without modifications, as long as this notice is preserved.
    795741
    796742# _AM_MANGLE_OPTION(NAME)
     
    800746
    801747# _AM_SET_OPTION(NAME)
    802 # ------------------------------
     748# --------------------
    803749# Set option NAME.  Presently that only means defining a flag for this option.
    804750AC_DEFUN([_AM_SET_OPTION],
    805 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
     751[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
    806752
    807753# _AM_SET_OPTIONS(OPTIONS)
    808 # ----------------------------------
     754# ------------------------
    809755# OPTIONS is a space-separated list of Automake options.
    810756AC_DEFUN([_AM_SET_OPTIONS],
     
    817763[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
    818764
     765# Copyright (C) 1999-2013 Free Software Foundation, Inc.
     766#
     767# This file is free software; the Free Software Foundation
     768# gives unlimited permission to copy and/or distribute it,
     769# with or without modifications, as long as this notice is preserved.
     770
     771# _AM_PROG_CC_C_O
     772# ---------------
     773# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
     774# to automatically call this.
     775AC_DEFUN([_AM_PROG_CC_C_O],
     776[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
     777AC_REQUIRE_AUX_FILE([compile])dnl
     778AC_LANG_PUSH([C])dnl
     779AC_CACHE_CHECK(
     780  [whether $CC understands -c and -o together],
     781  [am_cv_prog_cc_c_o],
     782  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
     783  # Make sure it works both with $CC and with simple cc.
     784  # Following AC_PROG_CC_C_O, we do the test twice because some
     785  # compilers refuse to overwrite an existing .o file with -o,
     786  # though they will create one.
     787  am_cv_prog_cc_c_o=yes
     788  for am_i in 1 2; do
     789    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
     790         && test -f conftest2.$ac_objext; then
     791      : OK
     792    else
     793      am_cv_prog_cc_c_o=no
     794      break
     795    fi
     796  done
     797  rm -f core conftest*
     798  unset am_i])
     799if test "$am_cv_prog_cc_c_o" != yes; then
     800   # Losing compiler, so override with the script.
     801   # FIXME: It is wrong to rewrite CC.
     802   # But if we don't then we get into trouble of one sort or another.
     803   # A longer-term fix would be to have automake use am__CC in this case,
     804   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
     805   CC="$am_aux_dir/compile $CC"
     806fi
     807AC_LANG_POP([C])])
     808
     809# For backward compatibility.
     810AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
     811
     812# Copyright (C) 2001-2013 Free Software Foundation, Inc.
     813#
     814# This file is free software; the Free Software Foundation
     815# gives unlimited permission to copy and/or distribute it,
     816# with or without modifications, as long as this notice is preserved.
     817
     818# AM_RUN_LOG(COMMAND)
     819# -------------------
     820# Run COMMAND, save the exit status in ac_status, and log it.
     821# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
     822AC_DEFUN([AM_RUN_LOG],
     823[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
     824   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
     825   ac_status=$?
     826   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
     827   (exit $ac_status); }])
     828
    819829# Check to make sure that the build environment is sane.    -*- Autoconf -*-
    820830
    821 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
    822 # Free Software Foundation, Inc.
    823 #
    824 # This file is free software; the Free Software Foundation
    825 # gives unlimited permission to copy and/or distribute it,
    826 # with or without modifications, as long as this notice is preserved.
    827 
    828 # serial 5
     831# Copyright (C) 1996-2013 Free Software Foundation, Inc.
     832#
     833# This file is free software; the Free Software Foundation
     834# gives unlimited permission to copy and/or distribute it,
     835# with or without modifications, as long as this notice is preserved.
    829836
    830837# AM_SANITY_CHECK
     
    832839AC_DEFUN([AM_SANITY_CHECK],
    833840[AC_MSG_CHECKING([whether build environment is sane])
    834 # Just in case
    835 sleep 1
    836 echo timestamp > conftest.file
    837841# Reject unsafe characters in $srcdir or the absolute working directory
    838842# name.  Accept space and tab only in the latter.
     
    845849case $srcdir in
    846850  *[[\\\"\#\$\&\'\`$am_lf\ \    ]]*)
    847     AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
     851    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
    848852esac
    849853
    850 # Do `set' in a subshell so we don't clobber the current shell's
     854# Do 'set' in a subshell so we don't clobber the current shell's
    851855# arguments.  Must try -L first in case configure is actually a
    852856# symlink; some systems play weird games with the mod time of symlinks
     
    854858# directory).
    855859if (
    856    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    857    if test "$[*]" = "X"; then
    858       # -L didn't work.
    859       set X `ls -t "$srcdir/configure" conftest.file`
    860    fi
    861    rm -f conftest.file
    862    if test "$[*]" != "X $srcdir/configure conftest.file" \
    863       && test "$[*]" != "X conftest.file $srcdir/configure"; then
    864 
    865       # If neither matched, then we have a broken ls.  This can happen
    866       # if, for instance, CONFIG_SHELL is bash and it inherits a
    867       # broken ls alias from the environment.  This has actually
    868       # happened.  Such a system could not be considered "sane".
    869       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
    870 alias in your environment])
    871    fi
    872 
     860   am_has_slept=no
     861   for am_try in 1 2; do
     862     echo "timestamp, slept: $am_has_slept" > conftest.file
     863     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
     864     if test "$[*]" = "X"; then
     865        # -L didn't work.
     866        set X `ls -t "$srcdir/configure" conftest.file`
     867     fi
     868     if test "$[*]" != "X $srcdir/configure conftest.file" \
     869        && test "$[*]" != "X conftest.file $srcdir/configure"; then
     870
     871        # If neither matched, then we have a broken ls.  This can happen
     872        # if, for instance, CONFIG_SHELL is bash and it inherits a
     873        # broken ls alias from the environment.  This has actually
     874        # happened.  Such a system could not be considered "sane".
     875        AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
     876  alias in your environment])
     877     fi
     878     if test "$[2]" = conftest.file || test $am_try -eq 2; then
     879       break
     880     fi
     881     # Just in case.
     882     sleep 1
     883     am_has_slept=yes
     884   done
    873885   test "$[2]" = conftest.file
    874886   )
     
    880892Check your system clock])
    881893fi
    882 AC_MSG_RESULT(yes)])
    883 
    884 # Copyright (C) 2009  Free Software Foundation, Inc.
    885 #
    886 # This file is free software; the Free Software Foundation
    887 # gives unlimited permission to copy and/or distribute it,
    888 # with or without modifications, as long as this notice is preserved.
    889 
    890 # serial 1
     894AC_MSG_RESULT([yes])
     895# If we didn't sleep, we still need to ensure time stamps of config.status and
     896# generated files are strictly newer.
     897am_sleep_pid=
     898if grep 'slept: no' conftest.file >/dev/null 2>&1; then
     899  ( sleep 1 ) &
     900  am_sleep_pid=$!
     901fi
     902AC_CONFIG_COMMANDS_PRE(
     903  [AC_MSG_CHECKING([that generated files are newer than configure])
     904   if test -n "$am_sleep_pid"; then
     905     # Hide warnings about reused PIDs.
     906     wait $am_sleep_pid 2>/dev/null
     907   fi
     908   AC_MSG_RESULT([done])])
     909rm -f conftest.file
     910])
     911
     912# Copyright (C) 2009-2013 Free Software Foundation, Inc.
     913#
     914# This file is free software; the Free Software Foundation
     915# gives unlimited permission to copy and/or distribute it,
     916# with or without modifications, as long as this notice is preserved.
    891917
    892918# AM_SILENT_RULES([DEFAULT])
    893919# --------------------------
    894920# Enable less verbose build rules; with the default set to DEFAULT
    895 # (`yes' being less verbose, `no' or empty being verbose).
     921# ("yes" being less verbose, "no" or empty being verbose).
    896922AC_DEFUN([AM_SILENT_RULES],
    897 [AC_ARG_ENABLE([silent-rules],
    898 [  --enable-silent-rules          less verbose build output (undo: `make V=1')
    899   --disable-silent-rules         verbose build output (undo: `make V=0')])
    900 case $enable_silent_rules in
    901 yes) AM_DEFAULT_VERBOSITY=0;;
    902 no)  AM_DEFAULT_VERBOSITY=1;;
    903 *)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
     923[AC_ARG_ENABLE([silent-rules], [dnl
     924AS_HELP_STRING(
     925  [--enable-silent-rules],
     926  [less verbose build output (undo: "make V=1")])
     927AS_HELP_STRING(
     928  [--disable-silent-rules],
     929  [verbose build output (undo: "make V=0")])dnl
     930])
     931case $enable_silent_rules in @%:@ (((
     932  yes) AM_DEFAULT_VERBOSITY=0;;
     933   no) AM_DEFAULT_VERBOSITY=1;;
     934    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
    904935esac
     936dnl
     937dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
     938dnl do not support nested variable expansions.
     939dnl See automake bug#9928 and bug#10237.
     940am_make=${MAKE-make}
     941AC_CACHE_CHECK([whether $am_make supports nested variables],
     942   [am_cv_make_support_nested_variables],
     943   [if AS_ECHO([['TRUE=$(BAR$(V))
     944BAR0=false
     945BAR1=true
     946V=1
     947am__doit:
     948        @$(TRUE)
     949.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
     950  am_cv_make_support_nested_variables=yes
     951else
     952  am_cv_make_support_nested_variables=no
     953fi])
     954if test $am_cv_make_support_nested_variables = yes; then
     955  dnl Using '$V' instead of '$(V)' breaks IRIX make.
     956  AM_V='$(V)'
     957  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
     958else
     959  AM_V=$AM_DEFAULT_VERBOSITY
     960  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
     961fi
     962AC_SUBST([AM_V])dnl
     963AM_SUBST_NOTMAKE([AM_V])dnl
     964AC_SUBST([AM_DEFAULT_V])dnl
     965AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
    905966AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
    906967AM_BACKSLASH='\'
     
    909970])
    910971
    911 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
     972# Copyright (C) 2001-2013 Free Software Foundation, Inc.
    912973#
    913974# This file is free software; the Free Software Foundation
     
    917978# AM_PROG_INSTALL_STRIP
    918979# ---------------------
    919 # One issue with vendor `install' (even GNU) is that you can't
     980# One issue with vendor 'install' (even GNU) is that you can't
    920981# specify the program used to strip binaries.  This is especially
    921982# annoying in cross-compiling environments, where the build's strip
    922983# is unlikely to handle the host's binaries.
    923984# Fortunately install-sh will honor a STRIPPROG variable, so we
    924 # always use install-sh in `make install-strip', and initialize
     985# always use install-sh in "make install-strip", and initialize
    925986# STRIPPROG with the value of the STRIP variable (set by the user).
    926987AC_DEFUN([AM_PROG_INSTALL_STRIP],
    927988[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
    928 # Installed binaries are usually stripped using `strip' when the user
    929 # run `make install-strip'.  However `strip' might not be the right
     989# Installed binaries are usually stripped using 'strip' when the user
     990# run "make install-strip".  However 'strip' might not be the right
    930991# tool to use in cross-compilation environments, therefore Automake
    931 # will honor the `STRIP' environment variable to overrule this program.
    932 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
     992# will honor the 'STRIP' environment variable to overrule this program.
     993dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
    933994if test "$cross_compiling" != no; then
    934995  AC_CHECK_TOOL([STRIP], [strip], :)
     
    937998AC_SUBST([INSTALL_STRIP_PROGRAM])])
    938999
    939 # Copyright (C) 2006, 2008  Free Software Foundation, Inc.
    940 #
    941 # This file is free software; the Free Software Foundation
    942 # gives unlimited permission to copy and/or distribute it,
    943 # with or without modifications, as long as this notice is preserved.
    944 
    945 # serial 2
     1000# Copyright (C) 2006-2013 Free Software Foundation, Inc.
     1001#
     1002# This file is free software; the Free Software Foundation
     1003# gives unlimited permission to copy and/or distribute it,
     1004# with or without modifications, as long as this notice is preserved.
    9461005
    9471006# _AM_SUBST_NOTMAKE(VARIABLE)
     
    9521011
    9531012# AM_SUBST_NOTMAKE(VARIABLE)
    954 # ---------------------------
     1013# --------------------------
    9551014# Public sister of _AM_SUBST_NOTMAKE.
    9561015AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
     
    9581017# Check how to create a tarball.                            -*- Autoconf -*-
    9591018
    960 # Copyright (C) 2004, 2005  Free Software Foundation, Inc.
    961 #
    962 # This file is free software; the Free Software Foundation
    963 # gives unlimited permission to copy and/or distribute it,
    964 # with or without modifications, as long as this notice is preserved.
    965 
    966 # serial 2
     1019# Copyright (C) 2004-2013 Free Software Foundation, Inc.
     1020#
     1021# This file is free software; the Free Software Foundation
     1022# gives unlimited permission to copy and/or distribute it,
     1023# with or without modifications, as long as this notice is preserved.
    9671024
    9681025# _AM_PROG_TAR(FORMAT)
    9691026# --------------------
    9701027# Check how to create a tarball in format FORMAT.
    971 # FORMAT should be one of `v7', `ustar', or `pax'.
     1028# FORMAT should be one of 'v7', 'ustar', or 'pax'.
    9721029#
    9731030# Substitute a variable $(am__tar) that is a command
     
    9791036# a tarball read from stdin.
    9801037#     $(am__untar) < result.tar
     1038#
    9811039AC_DEFUN([_AM_PROG_TAR],
    982 [# Always define AMTAR for backward compatibility.
    983 AM_MISSING_PROG([AMTAR], [tar])
     1040[# Always define AMTAR for backward compatibility.  Yes, it's still used
     1041# in the wild :-(  We should find a proper way to deprecate it ...
     1042AC_SUBST([AMTAR], ['$${TAR-tar}'])
     1043
     1044# We'll loop over all known methods to create a tar archive until one works.
     1045_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
     1046
    9841047m4_if([$1], [v7],
    985      [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
    986      [m4_case([$1], [ustar],, [pax],,
    987               [m4_fatal([Unknown tar format])])
    988 AC_MSG_CHECKING([how to create a $1 tar archive])
    989 # Loop over all known methods to create a tar archive until one works.
    990 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
    991 _am_tools=${am_cv_prog_tar_$1-$_am_tools}
    992 # Do not fold the above two line into one, because Tru64 sh and
    993 # Solaris sh will not grok spaces in the rhs of `-'.
    994 for _am_tool in $_am_tools
    995 do
    996   case $_am_tool in
    997   gnutar)
    998     for _am_tar in tar gnutar gtar;
    999     do
    1000       AM_RUN_LOG([$_am_tar --version]) && break
    1001     done
    1002     am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
    1003     am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
    1004     am__untar="$_am_tar -xf -"
    1005     ;;
    1006   plaintar)
    1007     # Must skip GNU tar: if it does not support --format= it doesn't create
    1008     # ustar tarball either.
    1009     (tar --version) >/dev/null 2>&1 && continue
    1010     am__tar='tar chf - "$$tardir"'
    1011     am__tar_='tar chf - "$tardir"'
    1012     am__untar='tar xf -'
    1013     ;;
    1014   pax)
    1015     am__tar='pax -L -x $1 -w "$$tardir"'
    1016     am__tar_='pax -L -x $1 -w "$tardir"'
    1017     am__untar='pax -r'
    1018     ;;
    1019   cpio)
    1020     am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
    1021     am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
    1022     am__untar='cpio -i -H $1 -d'
    1023     ;;
    1024   none)
    1025     am__tar=false
    1026     am__tar_=false
    1027     am__untar=false
    1028     ;;
    1029   esac
    1030 
    1031   # If the value was cached, stop now.  We just wanted to have am__tar
    1032   # and am__untar set.
    1033   test -n "${am_cv_prog_tar_$1}" && break
    1034 
    1035   # tar/untar a dummy directory, and stop if the command works
     1048  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
     1049
     1050  [m4_case([$1],
     1051    [ustar],
     1052     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
     1053      # There is notably a 21 bits limit for the UID and the GID.  In fact,
     1054      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
     1055      # and bug#13588).
     1056      am_max_uid=2097151 # 2^21 - 1
     1057      am_max_gid=$am_max_uid
     1058      # The $UID and $GID variables are not portable, so we need to resort
     1059      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
     1060      # below are definitely unexpected, so allow the users to see them
     1061      # (that is, avoid stderr redirection).
     1062      am_uid=`id -u || echo unknown`
     1063      am_gid=`id -g || echo unknown`
     1064      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
     1065      if test $am_uid -le $am_max_uid; then
     1066         AC_MSG_RESULT([yes])
     1067      else
     1068         AC_MSG_RESULT([no])
     1069         _am_tools=none
     1070      fi
     1071      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
     1072      if test $am_gid -le $am_max_gid; then
     1073         AC_MSG_RESULT([yes])
     1074      else
     1075        AC_MSG_RESULT([no])
     1076        _am_tools=none
     1077      fi],
     1078
     1079  [pax],
     1080    [],
     1081
     1082  [m4_fatal([Unknown tar format])])
     1083
     1084  AC_MSG_CHECKING([how to create a $1 tar archive])
     1085
     1086  # Go ahead even if we have the value already cached.  We do so because we
     1087  # need to set the values for the 'am__tar' and 'am__untar' variables.
     1088  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
     1089
     1090  for _am_tool in $_am_tools; do
     1091    case $_am_tool in
     1092    gnutar)
     1093      for _am_tar in tar gnutar gtar; do
     1094        AM_RUN_LOG([$_am_tar --version]) && break
     1095      done
     1096      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
     1097      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
     1098      am__untar="$_am_tar -xf -"
     1099      ;;
     1100    plaintar)
     1101      # Must skip GNU tar: if it does not support --format= it doesn't create
     1102      # ustar tarball either.
     1103      (tar --version) >/dev/null 2>&1 && continue
     1104      am__tar='tar chf - "$$tardir"'
     1105      am__tar_='tar chf - "$tardir"'
     1106      am__untar='tar xf -'
     1107      ;;
     1108    pax)
     1109      am__tar='pax -L -x $1 -w "$$tardir"'
     1110      am__tar_='pax -L -x $1 -w "$tardir"'
     1111      am__untar='pax -r'
     1112      ;;
     1113    cpio)
     1114      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
     1115      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
     1116      am__untar='cpio -i -H $1 -d'
     1117      ;;
     1118    none)
     1119      am__tar=false
     1120      am__tar_=false
     1121      am__untar=false
     1122      ;;
     1123    esac
     1124
     1125    # If the value was cached, stop now.  We just wanted to have am__tar
     1126    # and am__untar set.
     1127    test -n "${am_cv_prog_tar_$1}" && break
     1128
     1129    # tar/untar a dummy directory, and stop if the command works.
     1130    rm -rf conftest.dir
     1131    mkdir conftest.dir
     1132    echo GrepMe > conftest.dir/file
     1133    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
     1134    rm -rf conftest.dir
     1135    if test -s conftest.tar; then
     1136      AM_RUN_LOG([$am__untar <conftest.tar])
     1137      AM_RUN_LOG([cat conftest.dir/file])
     1138      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
     1139    fi
     1140  done
    10361141  rm -rf conftest.dir
    1037   mkdir conftest.dir
    1038   echo GrepMe > conftest.dir/file
    1039   AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
    1040   rm -rf conftest.dir
    1041   if test -s conftest.tar; then
    1042     AM_RUN_LOG([$am__untar <conftest.tar])
    1043     grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
    1044   fi
    1045 done
    1046 rm -rf conftest.dir
    1047 
    1048 AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
    1049 AC_MSG_RESULT([$am_cv_prog_tar_$1])])
     1142
     1143  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
     1144  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
     1145
    10501146AC_SUBST([am__tar])
    10511147AC_SUBST([am__untar])
  • TabularUnified libusb1/trunk/compile

    r1876 r1882  
    22# Wrapper for compilers which do not understand '-c -o'.
    33
    4 scriptversion=2012-03-05.13; # UTC
    5 
    6 # Copyright (C) 1999-2012 Free Software Foundation, Inc.
     4scriptversion=2012-10-14.11; # UTC
     5
     6# Copyright (C) 1999-2013 Free Software Foundation, Inc.
    77# Written by Tom Tromey <tromey@cygnus.com>.
    88#
     
    113113      break
    114114    fi
     115    if test -f "$dir/lib$lib.a"; then
     116      found=yes
     117      lib=$dir/lib$lib.a
     118      break
     119    fi
    115120  done
    116121  IFS=$save_IFS
  • TabularUnified libusb1/trunk/config.guess

    r1876 r1882  
    11#! /bin/sh
    22# Attempt to guess a canonical system name.
    3 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    4 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
    5 #   2011, 2012 Free Software Foundation, Inc.
    6 
    7 timestamp='2012-06-10'
     3#   Copyright 1992-2013 Free Software Foundation, Inc.
     4
     5timestamp='2013-11-29'
    86
    97# This file is free software; you can redistribute it and/or modify it
    108# under the terms of the GNU General Public License as published by
    11 # the Free Software Foundation; either version 2 of the License, or
     9# the Free Software Foundation; either version 3 of the License, or
    1210# (at your option) any later version.
    1311#
     
    2321# distribute this file as part of a program that contains a
    2422# configuration script generated by Autoconf, you may include it under
    25 # the same distribution terms that you use for the rest of that program.
    26 
    27 
    28 # Originally written by Per Bothner.  Please send patches (context
    29 # diff format) to <config-patches@gnu.org> and include a ChangeLog
    30 # entry.
     23# the same distribution terms that you use for the rest of that
     24# program.  This Exception is an additional permission under section 7
     25# of the GNU General Public License, version 3 ("GPLv3").
    3126#
    32 # This script attempts to guess a canonical system name similar to
    33 # config.sub.  If it succeeds, it prints the system name on stdout, and
    34 # exits with 0.  Otherwise, it exits with 1.
     27# Originally written by Per Bothner.
    3528#
    3629# You can get the latest version of this script from:
    3730# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
     31#
     32# Please send patches with a ChangeLog entry to config-patches@gnu.org.
     33
    3834
    3935me=`echo "$0" | sed -e 's,.*/,,'`
     
    5551
    5652Originally written by Per Bothner.
    57 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
    58 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    59 Free Software Foundation, Inc.
     53Copyright 1992-2013 Free Software Foundation, Inc.
    6054
    6155This is free software; see the source for copying conditions.  There is NO
     
    138132UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
    139133UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
     134
     135case "${UNAME_SYSTEM}" in
     136Linux|GNU|GNU/*)
     137        # If the system lacks a compiler, then just pick glibc.
     138        # We could probably try harder.
     139        LIBC=gnu
     140
     141        eval $set_cc_for_build
     142        cat <<-EOF > $dummy.c
     143        #include <features.h>
     144        #if defined(__UCLIBC__)
     145        LIBC=uclibc
     146        #elif defined(__dietlibc__)
     147        LIBC=dietlibc
     148        #else
     149        LIBC=gnu
     150        #endif
     151        EOF
     152        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
     153        ;;
     154esac
    140155
    141156# Note: order is significant - the case branches are not exclusive.
     
    200215        # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
    201216        echo "${machine}-${os}${release}"
     217        exit ;;
     218    *:Bitrig:*:*)
     219        UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
     220        echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
    202221        exit ;;
    203222    *:OpenBSD:*:*)
     
    303322        echo arm-acorn-riscix${UNAME_RELEASE}
    304323        exit ;;
    305     arm:riscos:*:*|arm:RISCOS:*:*)
     324    arm*:riscos:*:*|arm*:RISCOS:*:*)
    306325        echo arm-unknown-riscos
    307326        exit ;;
     
    802821        echo ${UNAME_MACHINE}-pc-cygwin
    803822        exit ;;
     823    *:MINGW64*:*)
     824        echo ${UNAME_MACHINE}-pc-mingw64
     825        exit ;;
    804826    *:MINGW*:*)
    805827        echo ${UNAME_MACHINE}-pc-mingw32
     
    853875    *:GNU:*:*)
    854876        # the GNU system
    855         echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
     877        echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
    856878        exit ;;
    857879    *:GNU/*:*:*)
    858880        # other systems with GNU libc and userland
    859         echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
     881        echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
    860882        exit ;;
    861883    i*86:Minix:*:*)
     
    863885        exit ;;
    864886    aarch64:Linux:*:*)
    865         echo ${UNAME_MACHINE}-unknown-linux-gnu
     887        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    866888        exit ;;
    867889    aarch64_be:Linux:*:*)
    868890        UNAME_MACHINE=aarch64_be
    869         echo ${UNAME_MACHINE}-unknown-linux-gnu
     891        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    870892        exit ;;
    871893    alpha:Linux:*:*)
     
    880902        esac
    881903        objdump --private-headers /bin/sh | grep -q ld.so.1
    882         if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
    883         echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
     904        if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
     905        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
     906        exit ;;
     907    arc:Linux:*:* | arceb:Linux:*:*)
     908        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    884909        exit ;;
    885910    arm*:Linux:*:*)
     
    888913            | grep -q __ARM_EABI__
    889914        then
    890             echo ${UNAME_MACHINE}-unknown-linux-gnu
     915            echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    891916        else
    892917            if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
    893918                | grep -q __ARM_PCS_VFP
    894919            then
    895                 echo ${UNAME_MACHINE}-unknown-linux-gnueabi
     920                echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
    896921            else
    897                 echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
     922                echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
    898923            fi
    899924        fi
    900925        exit ;;
    901926    avr32*:Linux:*:*)
    902         echo ${UNAME_MACHINE}-unknown-linux-gnu
     927        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    903928        exit ;;
    904929    cris:Linux:*:*)
    905         echo ${UNAME_MACHINE}-axis-linux-gnu
     930        echo ${UNAME_MACHINE}-axis-linux-${LIBC}
    906931        exit ;;
    907932    crisv32:Linux:*:*)
    908         echo ${UNAME_MACHINE}-axis-linux-gnu
     933        echo ${UNAME_MACHINE}-axis-linux-${LIBC}
    909934        exit ;;
    910935    frv:Linux:*:*)
    911         echo ${UNAME_MACHINE}-unknown-linux-gnu
     936        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    912937        exit ;;
    913938    hexagon:Linux:*:*)
    914         echo ${UNAME_MACHINE}-unknown-linux-gnu
     939        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    915940        exit ;;
    916941    i*86:Linux:*:*)
    917         LIBC=gnu
    918         eval $set_cc_for_build
    919         sed 's/^        //' << EOF >$dummy.c
    920         #ifdef __dietlibc__
    921         LIBC=dietlibc
    922         #endif
    923 EOF
    924         eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
    925         echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
     942        echo ${UNAME_MACHINE}-pc-linux-${LIBC}
    926943        exit ;;
    927944    ia64:Linux:*:*)
    928         echo ${UNAME_MACHINE}-unknown-linux-gnu
     945        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    929946        exit ;;
    930947    m32r*:Linux:*:*)
    931         echo ${UNAME_MACHINE}-unknown-linux-gnu
     948        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    932949        exit ;;
    933950    m68*:Linux:*:*)
    934         echo ${UNAME_MACHINE}-unknown-linux-gnu
     951        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    935952        exit ;;
    936953    mips:Linux:*:* | mips64:Linux:*:*)
     
    951968EOF
    952969        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
    953         test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
     970        test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
    954971        ;;
     972    or1k:Linux:*:*)
     973        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
     974        exit ;;
    955975    or32:Linux:*:*)
    956         echo ${UNAME_MACHINE}-unknown-linux-gnu
     976        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    957977        exit ;;
    958978    padre:Linux:*:*)
    959         echo sparc-unknown-linux-gnu
     979        echo sparc-unknown-linux-${LIBC}
    960980        exit ;;
    961981    parisc64:Linux:*:* | hppa64:Linux:*:*)
    962         echo hppa64-unknown-linux-gnu
     982        echo hppa64-unknown-linux-${LIBC}
    963983        exit ;;
    964984    parisc:Linux:*:* | hppa:Linux:*:*)
    965985        # Look for CPU level
    966986        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
    967           PA7*) echo hppa1.1-unknown-linux-gnu ;;
    968           PA8*) echo hppa2.0-unknown-linux-gnu ;;
    969           *)    echo hppa-unknown-linux-gnu ;;
     987          PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
     988          PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
     989          *)    echo hppa-unknown-linux-${LIBC} ;;
    970990        esac
    971991        exit ;;
    972992    ppc64:Linux:*:*)
    973         echo powerpc64-unknown-linux-gnu
     993        echo powerpc64-unknown-linux-${LIBC}
    974994        exit ;;
    975995    ppc:Linux:*:*)
    976         echo powerpc-unknown-linux-gnu
     996        echo powerpc-unknown-linux-${LIBC}
     997        exit ;;
     998    ppc64le:Linux:*:*)
     999        echo powerpc64le-unknown-linux-${LIBC}
     1000        exit ;;
     1001    ppcle:Linux:*:*)
     1002        echo powerpcle-unknown-linux-${LIBC}
    9771003        exit ;;
    9781004    s390:Linux:*:* | s390x:Linux:*:*)
    979         echo ${UNAME_MACHINE}-ibm-linux
     1005        echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
    9801006        exit ;;
    9811007    sh64*:Linux:*:*)
    982         echo ${UNAME_MACHINE}-unknown-linux-gnu
     1008        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    9831009        exit ;;
    9841010    sh*:Linux:*:*)
    985         echo ${UNAME_MACHINE}-unknown-linux-gnu
     1011        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    9861012        exit ;;
    9871013    sparc:Linux:*:* | sparc64:Linux:*:*)
    988         echo ${UNAME_MACHINE}-unknown-linux-gnu
     1014        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    9891015        exit ;;
    9901016    tile*:Linux:*:*)
    991         echo ${UNAME_MACHINE}-unknown-linux-gnu
     1017        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    9921018        exit ;;
    9931019    vax:Linux:*:*)
    994         echo ${UNAME_MACHINE}-dec-linux-gnu
     1020        echo ${UNAME_MACHINE}-dec-linux-${LIBC}
    9951021        exit ;;
    9961022    x86_64:Linux:*:*)
    997         echo ${UNAME_MACHINE}-unknown-linux-gnu
     1023        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    9981024        exit ;;
    9991025    xtensa*:Linux:*:*)
    1000         echo ${UNAME_MACHINE}-unknown-linux-gnu
     1026        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
    10011027        exit ;;
    10021028    i*86:DYNIX/ptx:4*:*)
     
    12021228        echo i586-pc-haiku
    12031229        exit ;;
     1230    x86_64:Haiku:*:*)
     1231        echo x86_64-unknown-haiku
     1232        exit ;;
    12041233    SX-4:SUPER-UX:*:*)
    12051234        echo sx4-nec-superux${UNAME_RELEASE}
     
    12281257    *:Darwin:*:*)
    12291258        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
    1230         case $UNAME_PROCESSOR in
    1231             i386)
    1232                 eval $set_cc_for_build
    1233                 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
    1234                   if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
    1235                       (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
    1236                       grep IS_64BIT_ARCH >/dev/null
    1237                   then
    1238                       UNAME_PROCESSOR="x86_64"
    1239                   fi
    1240                 fi ;;
    1241             unknown) UNAME_PROCESSOR=powerpc ;;
    1242         esac
     1259        eval $set_cc_for_build
     1260        if test "$UNAME_PROCESSOR" = unknown ; then
     1261            UNAME_PROCESSOR=powerpc
     1262        fi
     1263        if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
     1264            if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
     1265                if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
     1266                    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
     1267                    grep IS_64BIT_ARCH >/dev/null
     1268                then
     1269                    case $UNAME_PROCESSOR in
     1270                        i386) UNAME_PROCESSOR=x86_64 ;;
     1271                        powerpc) UNAME_PROCESSOR=powerpc64 ;;
     1272                    esac
     1273                fi
     1274            fi
     1275        elif test "$UNAME_PROCESSOR" = i386 ; then
     1276            # Avoid executing cc on OS X 10.9, as it ships with a stub
     1277            # that puts up a graphical alert prompting to install
     1278            # developer tools.  Any system running Mac OS X 10.7 or
     1279            # later (Darwin 11 and later) is required to have a 64-bit
     1280            # processor. This is not true of the ARM version of Darwin
     1281            # that Apple uses in portable devices.
     1282            UNAME_PROCESSOR=x86_64
     1283        fi
    12431284        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
    12441285        exit ;;
     
    13301371        exit ;;
    13311372esac
    1332 
    1333 #echo '(No uname command or uname output not recognized.)' 1>&2
    1334 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
    13351373
    13361374eval $set_cc_for_build
  • TabularUnified libusb1/trunk/config.h.in

    r1879 r1882  
    44#undef DEFAULT_VISIBILITY
    55
    6 /* Debug message logging */
     6/* Start with debug message logging enabled */
    77#undef ENABLE_DEBUG_LOGGING
    88
    99/* Message logging */
    1010#undef ENABLE_LOGGING
     11
     12/* Define to 1 if you have the <asm/types.h> header file. */
     13#undef HAVE_ASM_TYPES_H
    1114
    1215/* Define to 1 if you have the <dlfcn.h> header file. */
     
    2528#undef HAVE_LIBUDEV_H
    2629
    27 /* Define to 1 if you have the <linux/filter.h> header file. */
    28 #undef HAVE_LINUX_FILTER_H
    29 
    3030/* Define to 1 if you have the <linux/netlink.h> header file. */
    3131#undef HAVE_LINUX_NETLINK_H
     
    3636/* Define to 1 if you have the <poll.h> header file. */
    3737#undef HAVE_POLL_H
     38
     39/* Define to 1 if you have the <signal.h> header file. */
     40#undef HAVE_SIGNAL_H
    3841
    3942/* Define to 1 if you have the <stdint.h> header file. */
     
    5154/* Define to 1 if the system has the type `struct timespec'. */
    5255#undef HAVE_STRUCT_TIMESPEC
     56
     57/* syslog() function available */
     58#undef HAVE_SYSLOG_FUNC
     59
     60/* Define to 1 if you have the <syslog.h> header file. */
     61#undef HAVE_SYSLOG_H
     62
     63/* Define to 1 if you have the <sys/socket.h> header file. */
     64#undef HAVE_SYS_SOCKET_H
    5365
    5466/* Define to 1 if you have the <sys/stat.h> header file. */
     
    6880#undef LT_OBJDIR
    6981
    70 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
    71 #undef NO_MINUS_C_MINUS_O
    72 
    7382/* Darwin backend */
    7483#undef OS_DARWIN
    7584
     85/* Haiku backend */
     86#undef OS_HAIKU
     87
    7688/* Linux backend */
    7789#undef OS_LINUX
     90
     91/* NetBSD backend */
     92#undef OS_NETBSD
    7893
    7994/* OpenBSD backend */
     
    8297/* OS/2 backend */
    8398#undef OS_OS2
     99
     100/* SunOS backend */
     101#undef OS_SUNOS
    84102
    85103/* Windows backend */
     
    119137#undef USBI_TIMERFD_AVAILABLE
    120138
     139/* Enable output to system log */
     140#undef USE_SYSTEM_LOGGING_FACILITY
     141
    121142/* Use udev for device enumeration/hotplug */
    122143#undef USE_UDEV
    123144
     145/* Use UsbDk Windows backend */
     146#undef USE_USBDK
     147
    124148/* Version number of package */
    125149#undef VERSION
     150
     151/* Oldest Windows version supported */
     152#undef WINVER
    126153
    127154/* Use GNU extensions */
  • TabularUnified libusb1/trunk/config.sub

    r1876 r1882  
    11#! /bin/sh
    22# Configuration validation subroutine script.
    3 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    4 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
    5 #   2011, 2012 Free Software Foundation, Inc.
    6 
    7 timestamp='2012-04-18'
    8 
    9 # This file is (in principle) common to ALL GNU software.
    10 # The presence of a machine in this file suggests that SOME GNU software
    11 # can handle that machine.  It does not imply ALL GNU software can.
    12 #
    13 # This file is free software; you can redistribute it and/or modify
    14 # it under the terms of the GNU General Public License as published by
    15 # the Free Software Foundation; either version 2 of the License, or
     3#   Copyright 1992-2013 Free Software Foundation, Inc.
     4
     5timestamp='2013-10-01'
     6
     7# This file is free software; you can redistribute it and/or modify it
     8# under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 3 of the License, or
    1610# (at your option) any later version.
    1711#
    18 # This program is distributed in the hope that it will be useful,
    19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21 # GNU General Public License for more details.
     12# This program is distributed in the hope that it will be useful, but
     13# WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15# General Public License for more details.
    2216#
    2317# You should have received a copy of the GNU General Public License
     
    2721# distribute this file as part of a program that contains a
    2822# configuration script generated by Autoconf, you may include it under
    29 # the same distribution terms that you use for the rest of that program.
    30 
    31 
    32 # Please send patches to <config-patches@gnu.org>.  Submit a context
    33 # diff and a properly formatted GNU ChangeLog entry.
     23# the same distribution terms that you use for the rest of that
     24# program.  This Exception is an additional permission under section 7
     25# of the GNU General Public License, version 3 ("GPLv3").
     26
     27
     28# Please send patches with a ChangeLog entry to config-patches@gnu.org.
    3429#
    3530# Configuration subroutine to validate and canonicalize a configuration type.
     
    7469GNU config.sub ($timestamp)
    7570
    76 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
    77 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    78 Free Software Foundation, Inc.
     71Copyright 1992-2013 Free Software Foundation, Inc.
    7972
    8073This is free software; see the source for copying conditions.  There is NO
     
    124117case $maybe_os in
    125118  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
    126   linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
     119  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
    127120  knetbsd*-gnu* | netbsd*-gnu* | \
    128121  kopensolaris*-gnu* | \
     
    157150        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
    158151        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
    159         -apple | -axis | -knuth | -cray | -microblaze)
     152        -apple | -axis | -knuth | -cray | -microblaze*)
    160153                os=
    161154                basic_machine=$1
     
    260253        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
    261254        | am33_2.0 \
    262         | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
    263         | be32 | be64 \
     255        | arc | arceb \
     256        | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
     257        | avr | avr32 \
     258        | be32 | be64 \
    264259        | bfin \
    265         | c4x | clipper \
     260        | c4x | c8051 | clipper \
    266261        | d10v | d30v | dlx | dsp16xx \
    267262        | epiphany \
     
    271266        | i370 | i860 | i960 | ia64 \
    272267        | ip2k | iq2000 \
     268        | k1om \
    273269        | le32 | le64 \
    274270        | lm32 \
    275271        | m32c | m32r | m32rle | m68000 | m68k | m88k \
    276         | maxq | mb | microblaze | mcore | mep | metag \
     272        | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
    277273        | mips | mipsbe | mipseb | mipsel | mipsle \
    278274        | mips16 \
     
    292288        | mipsisa64sb1 | mipsisa64sb1el \
    293289        | mipsisa64sr71k | mipsisa64sr71kel \
     290        | mipsr5900 | mipsr5900el \
    294291        | mipstx39 | mipstx39el \
    295292        | mn10200 | mn10300 \
     
    298295        | msp430 \
    299296        | nds32 | nds32le | nds32be \
    300         | nios | nios2 \
     297        | nios | nios2 | nios2eb | nios2el \
    301298        | ns16k | ns32k \
    302299        | open8 \
    303         | or32 \
     300        | or1k | or32 \
    304301        | pdp10 | pdp11 | pj | pjl \
    305302        | powerpc | powerpc64 | powerpc64le | powerpcle \
     
    329326                basic_machine=tic6x-unknown
    330327                ;;
    331         m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
     328        m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
    332329                basic_machine=$basic_machine-unknown
    333330                os=-none
     
    371368        | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
    372369        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
    373         | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
     370        | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
    374371        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
    375372        | avr-* | avr32-* \
     
    377374        | bfin-* | bs2000-* \
    378375        | c[123]* | c30-* | [cjt]90-* | c4x-* \
    379         | clipper-* | craynv-* | cydra-* \
     376        | c8051-* | clipper-* | craynv-* | cydra-* \
    380377        | d10v-* | d30v-* | dlx-* \
    381378        | elxsi-* \
     
    386383        | i*86-* | i860-* | i960-* | ia64-* \
    387384        | ip2k-* | iq2000-* \
     385        | k1om-* \
    388386        | le32-* | le64-* \
    389387        | lm32-* \
    390388        | m32c-* | m32r-* | m32rle-* \
    391389        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
    392         | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
     390        | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
     391        | microblaze-* | microblazeel-* \
    393392        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
    394393        | mips16-* \
     
    408407        | mipsisa64sb1-* | mipsisa64sb1el-* \
    409408        | mipsisa64sr71k-* | mipsisa64sr71kel-* \
     409        | mipsr5900-* | mipsr5900el-* \
    410410        | mipstx39-* | mipstx39el-* \
    411411        | mmix-* \
     
    413413        | msp430-* \
    414414        | nds32-* | nds32le-* | nds32be-* \
    415         | nios-* | nios2-* \
     415        | nios-* | nios2-* | nios2eb-* | nios2el-* \
    416416        | none-* | np1-* | ns16k-* | ns32k-* \
    417417        | open8-* \
     
    789789                os=-sysv
    790790                ;;
    791         microblaze)
     791        microblaze*)
    792792                basic_machine=microblaze-xilinx
    793793                ;;
     794        mingw64)
     795                basic_machine=x86_64-pc
     796                os=-mingw64
     797                ;;
    794798        mingw32)
    795                 basic_machine=i386-pc
     799                basic_machine=i686-pc
    796800                os=-mingw32
    797801                ;;
     
    829833                ;;
    830834        msys)
    831                 basic_machine=i386-pc
     835                basic_machine=i686-pc
    832836                os=-msys
    833837                ;;
     
    10201024                os=-pw32
    10211025                ;;
    1022         rdos)
     1026        rdos | rdos64)
     1027                basic_machine=x86_64-pc
     1028                os=-rdos
     1029                ;;
     1030        rdos32)
    10231031                basic_machine=i386-pc
    10241032                os=-rdos
     
    13471355              | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
    13481356              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
    1349               | -sym* | -kopensolaris* \
     1357              | -sym* | -kopensolaris* | -plan9* \
    13501358              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
    13511359              | -aos* | -aros* \
     
    13531361              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
    13541362              | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
    1355               | -openbsd* | -solidbsd* \
     1363              | -bitrig* | -openbsd* | -solidbsd* \
    13561364              | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
    13571365              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
     
    13601368              | -chorusos* | -chorusrdb* | -cegcc* \
    13611369              | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
    1362               | -mingw32* | -linux-gnu* | -linux-android* \
    1363               | -linux-newlib* | -linux-uclibc* \
     1370              | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
     1371              | -linux-newlib* | -linux-musl* | -linux-uclibc* \
    13641372              | -uxpv* | -beos* | -mpeix* | -udk* \
    13651373              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
     
    14931501                os=-aros
    14941502                ;;
    1495         -kaos*)
    1496                 os=-kaos
    1497                 ;;
    14981503        -zvmoe)
    14991504                os=-zvmoe
     
    15441549                os=-coff
    15451550                ;;
     1551        c8051-*)
     1552                os=-elf
     1553                ;;
    15461554        hexagon-*)
    15471555                os=-elf
     
    15851593                ;;
    15861594        mips*-*)
     1595                os=-elf
     1596                ;;
     1597        or1k-*)
    15871598                os=-elf
    15881599                ;;
  • TabularUnified libusb1/trunk/configure

    r1879 r1882  
    11#! /bin/sh
    22# Guess values for system-dependent variables and create Makefiles.
    3 # Generated by GNU Autoconf 2.64 for libusb 1.0.16-rc6.
     3# Generated by GNU Autoconf 2.69 for libusb 1.0.21.
    44#
    55# Report bugs to <libusb-devel@lists.sourceforge.net>.
    66#
    7 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
    8 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
    9 # Foundation, Inc.
     7#
     8# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
     9#
    1010#
    1111# This configure script is free software; the Free Software Foundation
     
    9090
    9191# Find who we are.  Look in the path if we contain no directory separator.
     92as_myself=
    9293case $0 in #((
    9394  *[\\/]* ) as_myself=$0 ;;
     
    134135(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
    135136
     137# Use a proper internal environment variable to ensure we don't fall
     138  # into an infinite loop, continuously re-executing ourselves.
     139  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
     140    _as_can_reexec=no; export _as_can_reexec;
     141    # We cannot yet assume a decent shell, so we have to provide a
     142# neutralization value for shells without unset; and this also
     143# works around shells that cannot unset nonexistent variables.
     144# Preserve -v and -x to the replacement shell.
     145BASH_ENV=/dev/null
     146ENV=/dev/null
     147(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
     148case $- in # ((((
     149  *v*x* | *x*v* ) as_opts=-vx ;;
     150  *v* ) as_opts=-v ;;
     151  *x* ) as_opts=-x ;;
     152  * ) as_opts= ;;
     153esac
     154exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
     155# Admittedly, this is quite paranoid, since all the known shells bail
     156# out after a failed `exec'.
     157$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
     158as_fn_exit 255
     159  fi
     160  # We don't want this to propagate to other subprocesses.
     161          { _as_can_reexec=; unset _as_can_reexec;}
    136162if test "x$CONFIG_SHELL" = x; then
    137163  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
     
    167193  exitcode=1; echo positional parameters were not saved.
    168194fi
    169 test x\$exitcode = x0 || exit 1"
     195test x\$exitcode = x0 || exit 1
     196test -x / || exit 1"
    170197  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
    171198  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
     
    220247
    221248      if test "x$CONFIG_SHELL" != x; then :
    222   # We cannot yet assume a decent shell, so we have to provide a
    223         # neutralization value for shells without unset; and this also
    224         # works around shells that cannot unset nonexistent variables.
    225         BASH_ENV=/dev/null
    226         ENV=/dev/null
    227         (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
    228         export CONFIG_SHELL
    229         exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
     249  export CONFIG_SHELL
     250             # We cannot yet assume a decent shell, so we have to provide a
     251# neutralization value for shells without unset; and this also
     252# works around shells that cannot unset nonexistent variables.
     253# Preserve -v and -x to the replacement shell.
     254BASH_ENV=/dev/null
     255ENV=/dev/null
     256(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
     257case $- in # ((((
     258  *v*x* | *x*v* ) as_opts=-vx ;;
     259  *v* ) as_opts=-v ;;
     260  *x* ) as_opts=-x ;;
     261  * ) as_opts= ;;
     262esac
     263exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
     264# Admittedly, this is quite paranoid, since all the known shells bail
     265# out after a failed `exec'.
     266$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
     267exit 255
    230268fi
    231269
     
    326364    done
    327365    test -z "$as_dirs" || eval "mkdir $as_dirs"
    328   } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
     366  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
    329367
    330368
    331369} # as_fn_mkdir_p
     370
     371# as_fn_executable_p FILE
     372# -----------------------
     373# Test if FILE is an executable regular file.
     374as_fn_executable_p ()
     375{
     376  test -f "$1" && test -x "$1"
     377} # as_fn_executable_p
    332378# as_fn_append VAR VALUE
    333379# ----------------------
     
    366412
    367413
    368 # as_fn_error ERROR [LINENO LOG_FD]
    369 # ---------------------------------
     414# as_fn_error STATUS ERROR [LINENO LOG_FD]
     415# ----------------------------------------
    370416# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
    371417# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
    372 # script with status $?, using 1 if that was 0.
     418# script with STATUS, using 1 if that was 0.
    373419as_fn_error ()
    374420{
    375   as_status=$?; test $as_status -eq 0 && as_status=1
    376   if test "$3"; then
    377     as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    378     $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
     421  as_status=$1; test $as_status -eq 0 && as_status=1
     422  if test "$4"; then
     423    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
     424    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
    379425  fi
    380   $as_echo "$as_me: error: $1" >&2
     426  $as_echo "$as_me: error: $2" >&2
    381427  as_fn_exit $as_status
    382428} # as_fn_error
     
    451497    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
    452498
     499  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
     500  # already done that, so ensure we don't try to do so again and fall
     501  # in an infinite loop.  This has already happened in practice.
     502  _as_can_reexec=no; export _as_can_reexec
    453503  # Don't try to exec as it changes $[0], causing all sort of problems
    454504  # (the dirname of $[0] is not the place where we might find the
     
    485535    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    486536    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    487     # In both cases, we have to default to `cp -p'.
     537    # In both cases, we have to default to `cp -pR'.
    488538    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
    489       as_ln_s='cp -p'
     539      as_ln_s='cp -pR'
    490540  elif ln conf$$.file conf$$ 2>/dev/null; then
    491541    as_ln_s=ln
    492542  else
    493     as_ln_s='cp -p'
     543    as_ln_s='cp -pR'
    494544  fi
    495545else
    496   as_ln_s='cp -p'
     546  as_ln_s='cp -pR'
    497547fi
    498548rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
     
    506556fi
    507557
    508 if test -x / >/dev/null 2>&1; then
    509   as_test_x='test -x'
    510 else
    511   if ls -dL / >/dev/null 2>&1; then
    512     as_ls_L_option=L
    513   else
    514     as_ls_L_option=
    515   fi
    516   as_test_x='
    517     eval sh -c '\''
    518       if test -d "$1"; then
    519         test -d "$1/.";
    520       else
    521         case $1 in #(
    522         -*)set "./$1";;
    523         esac;
    524         case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
    525         ???[sx]*):;;*)false;;esac;fi
    526     '\'' sh
    527   '
    528 fi
    529 as_executable_p=$as_test_x
     558as_test_x='test -x'
     559as_executable_p=as_fn_executable_p
    530560
    531561# Sed expression to map a string onto a valid CPP name.
     
    538568
    539569
    540 exec 7<&0 </dev/null 6>&1
     570test -n "$DJDIR" || exec 7<&0 </dev/null
     571exec 6>&1
    541572
    542573# Name of the host.
    543 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
     574# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
    544575# so uname gets run too.
    545576ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
     
    560591PACKAGE_NAME='libusb'
    561592PACKAGE_TARNAME='libusb'
    562 PACKAGE_VERSION='1.0.16-rc6'
    563 PACKAGE_STRING='libusb 1.0.16-rc6'
     593PACKAGE_VERSION='1.0.21'
     594PACKAGE_STRING='libusb 1.0.21'
    564595PACKAGE_BUGREPORT='libusb-devel@lists.sourceforge.net'
    565 PACKAGE_URL='http://www.libusb.org/'
     596PACKAGE_URL='http://libusb.info'
    566597
    567598ac_unique_file="libusb/core.c"
     
    608639LTLDFLAGS
    609640AM_CFLAGS
    610 VISIBILITY_CFLAGS
    611641HAVE_SIGACTION_FALSE
    612642HAVE_SIGACTION_TRUE
     643BUILD_TESTS_FALSE
     644BUILD_TESTS_TRUE
    613645BUILD_EXAMPLES_FALSE
    614646BUILD_EXAMPLES_TRUE
     647USE_USBDK_FALSE
     648USE_USBDK_TRUE
    615649USE_UDEV_FALSE
    616650USE_UDEV_TRUE
     651CREATE_IMPORT_LIB_FALSE
     652CREATE_IMPORT_LIB_TRUE
    617653THREADS_POSIX_FALSE
    618654THREADS_POSIX_TRUE
    619 OS_OS2_FALSE
    620 OS_OS2_TRUE
     655OS_HAIKU_FALSE
     656OS_HAIKU_TRUE
    621657OS_WINDOWS_FALSE
    622658OS_WINDOWS_TRUE
     659OS_NETBSD_FALSE
     660OS_NETBSD_TRUE
     661OS_SUNOS_FALSE
     662OS_SUNOS_TRUE
    623663OS_OPENBSD_FALSE
    624664OS_OPENBSD_TRUE
     
    627667OS_LINUX_FALSE
    628668OS_LINUX_TRUE
    629 PC_LIBS_PRIVATE
    630 THREAD_CFLAGS
    631 OS_OS2
     669OS_HAIKU
     670USE_USBDK
    632671OS_WINDOWS
     672OS_NETBSD
     673OS_SUNOS
    633674OS_OPENBSD
    634675OS_DARWIN
     
    636677OS_LINUX
    637678RC
     679CXXCPP
    638680CPP
    639681OTOOL64
     
    666708build
    667709LIBTOOL
     710am__fastdepCXX_FALSE
     711am__fastdepCXX_TRUE
     712CXXDEPMODE
     713ac_ct_CXX
     714CXXFLAGS
     715CXX
    668716am__fastdepCC_FALSE
    669717am__fastdepCC_TRUE
    670718CCDEPMODE
     719am__nodep
    671720AMDEPBACKSLASH
    672721AMDEP_FALSE
     
    684733AM_BACKSLASH
    685734AM_DEFAULT_VERBOSITY
    686 MAINT
    687 MAINTAINER_MODE_FALSE
    688 MAINTAINER_MODE_TRUE
     735AM_DEFAULT_V
     736AM_V
    689737am__untar
    690738am__tar
     
    751799ac_user_opts='
    752800enable_option_checking
    753 enable_maintainer_mode
    754801enable_silent_rules
    755802enable_dependency_tracking
     
    762809enable_libtool_lock
    763810enable_udev
     811enable_usbdk
    764812enable_timerfd
    765813enable_log
    766814enable_debug_log
     815enable_system_log
    767816enable_examples_build
     817enable_tests_build
    768818'
    769819      ac_precious_vars='build_alias
     
    775825LIBS
    776826CPPFLAGS
    777 CPP'
     827CXX
     828CXXFLAGS
     829CCC
     830CPP
     831CXXCPP'
    778832
    779833
     
    838892
    839893  case $ac_option in
    840   *=*)  ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
    841   *)    ac_optarg=yes ;;
     894  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
     895  *=)   ac_optarg= ;;
     896  *)    ac_optarg=yes ;;
    842897  esac
    843898
     
    884939    # Reject names that are not valid shell variable names.
    885940    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
    886       as_fn_error "invalid feature name: $ac_useropt"
     941      as_fn_error $? "invalid feature name: $ac_useropt"
    887942    ac_useropt_orig=$ac_useropt
    888943    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     
    910965    # Reject names that are not valid shell variable names.
    911966    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
    912       as_fn_error "invalid feature name: $ac_useropt"
     967      as_fn_error $? "invalid feature name: $ac_useropt"
    913968    ac_useropt_orig=$ac_useropt
    914969    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     
    11141169    # Reject names that are not valid shell variable names.
    11151170    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
    1116       as_fn_error "invalid package name: $ac_useropt"
     1171      as_fn_error $? "invalid package name: $ac_useropt"
    11171172    ac_useropt_orig=$ac_useropt
    11181173    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     
    11301185    # Reject names that are not valid shell variable names.
    11311186    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
    1132       as_fn_error "invalid package name: $ac_useropt"
     1187      as_fn_error $? "invalid package name: $ac_useropt"
    11331188    ac_useropt_orig=$ac_useropt
    11341189    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     
    11601215    x_libraries=$ac_optarg ;;
    11611216
    1162   -*) as_fn_error "unrecognized option: \`$ac_option'
    1163 Try \`$0 --help' for more information."
     1217  -*) as_fn_error $? "unrecognized option: \`$ac_option'
     1218Try \`$0 --help' for more information"
    11641219    ;;
    11651220
     
    11691224    case $ac_envvar in #(
    11701225      '' | [0-9]* | *[!_$as_cr_alnum]* )
    1171       as_fn_error "invalid variable name: \`$ac_envvar'" ;;
     1226      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
    11721227    esac
    11731228    eval $ac_envvar=\$ac_optarg
     
    11791234    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
    11801235      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
    1181     : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     1236    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
    11821237    ;;
    11831238
     
    11871242if test -n "$ac_prev"; then
    11881243  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
    1189   as_fn_error "missing argument to $ac_option"
     1244  as_fn_error $? "missing argument to $ac_option"
    11901245fi
    11911246
     
    11931248  case $enable_option_checking in
    11941249    no) ;;
    1195     fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
     1250    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
    11961251    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
    11971252  esac
     
    12161271    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
    12171272  esac
    1218   as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
     1273  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
    12191274done
    12201275
     
    12301285  if test "x$build_alias" = x; then
    12311286    cross_compiling=maybe
    1232     $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
    1233     If a cross compiler is detected then cross compile mode will be used." >&2
    12341287  elif test "x$build_alias" != "x$host_alias"; then
    12351288    cross_compiling=yes
     
    12461299ac_ls_di=`ls -di .` &&
    12471300ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
    1248   as_fn_error "working directory cannot be determined"
     1301  as_fn_error $? "working directory cannot be determined"
    12491302test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
    1250   as_fn_error "pwd does not report name of working directory"
     1303  as_fn_error $? "pwd does not report name of working directory"
    12511304
    12521305
     
    12871340if test ! -r "$srcdir/$ac_unique_file"; then
    12881341  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
    1289   as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
     1342  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
    12901343fi
    12911344ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
    12921345ac_abs_confdir=`(
    1293         cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
     1346        cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
    12941347        pwd)`
    12951348# When building in place, set srcdir=.
     
    13171370  # This message is too long to be a string in the A/UX 3.1 sh.
    13181371  cat <<_ACEOF
    1319 \`configure' configures libusb 1.0.16-rc6 to adapt to many kinds of systems.
     1372\`configure' configures libusb 1.0.21 to adapt to many kinds of systems.
    13201373
    13211374Usage: $0 [OPTION]... [VAR=VALUE]...
     
    13311384      --help=recursive    display the short help of all the included packages
    13321385  -V, --version           display version information and exit
    1333   -q, --quiet, --silent   do not print \`checking...' messages
     1386  -q, --quiet, --silent   do not print \`checking ...' messages
    13341387      --cache-file=FILE   cache test results in FILE [disabled]
    13351388  -C, --config-cache      alias for \`--cache-file=config.cache'
     
    13871440if test -n "$ac_init_help"; then
    13881441  case $ac_init_help in
    1389      short | recursive ) echo "Configuration of libusb 1.0.16-rc6:";;
     1442     short | recursive ) echo "Configuration of libusb 1.0.21:";;
    13901443   esac
    13911444  cat <<\_ACEOF
     
    13951448  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
    13961449  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
    1397   --enable-maintainer-mode  enable make rules and dependencies not useful
    1398                           (and sometimes confusing) to the casual installer
    1399   --enable-silent-rules          less verbose build output (undo: `make V=1')
    1400   --disable-silent-rules         verbose build output (undo: `make V=0')
    1401   --disable-dependency-tracking  speeds up one-time build
    1402   --enable-dependency-tracking   do not reject slow dependency extractors
     1450  --enable-silent-rules   less verbose build output (undo: "make V=1")
     1451  --disable-silent-rules  verbose build output (undo: "make V=0")
     1452  --enable-dependency-tracking
     1453                          do not reject slow dependency extractors
     1454  --disable-dependency-tracking
     1455                          speeds up one-time build
    14031456  --enable-shared[=PKGS]  build shared libraries [default=yes]
    14041457  --enable-static[=PKGS]  build static libraries [default=yes]
     
    14061459                          optimize for fast installation [default=yes]
    14071460  --disable-libtool-lock  avoid locking (might break parallel builds)
    1408   --with-udev             use udev for device enumeration and hotplug support
    1409                           (recommended, default: yes)
    1410   --enable-timerfd        use timerfd for timing (default auto)
     1461  --enable-udev           use udev for device enumeration and hotplug support
     1462                          (recommended) [default=yes]
     1463  --enable-usbdk          use UsbDk Windows backend [default=no]
     1464  --enable-timerfd        use timerfd for timing [default=auto]
    14111465  --disable-log           disable all logging
    1412   --enable-debug-log      enable debug logging (default n)
    1413   --enable-examples-build build example applications (default n)
     1466  --enable-debug-log      start with debug message logging enabled
     1467                          [default=no]
     1468  --enable-system-log     output logging messages to system wide log, if
     1469                          supported by the OS [default=no]
     1470  --enable-examples-build build example applications [default=no]
     1471  --enable-tests-build    build test applications [default=no]
    14141472
    14151473Optional Packages:
     
    14281486              nonstandard directory <lib dir>
    14291487  LIBS        libraries to pass to the linker, e.g. -l<library>
    1430   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
     1488  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
    14311489              you have headers in a nonstandard directory <include dir>
     1490  CXX         C++ compiler command
     1491  CXXFLAGS    C++ compiler flags
    14321492  CPP         C preprocessor
     1493  CXXCPP      C++ preprocessor
    14331494
    14341495Use these variables to override the choices made by `configure' or to help
     
    14361497
    14371498Report bugs to <libusb-devel@lists.sourceforge.net>.
    1438 libusb home page: <http://www.libusb.org/>.
     1499libusb home page: <http://libusb.info>.
    14391500_ACEOF
    14401501ac_status=$?
     
    14991560if $ac_init_version; then
    15001561  cat <<\_ACEOF
    1501 libusb configure 1.0.16-rc6
    1502 generated by GNU Autoconf 2.64
    1503 
    1504 Copyright (C) 2009 Free Software Foundation, Inc.
     1562libusb configure 1.0.21
     1563generated by GNU Autoconf 2.69
     1564
     1565Copyright (C) 2012 Free Software Foundation, Inc.
    15051566This configure script is free software; the Free Software Foundation
    15061567gives unlimited permission to copy, distribute and modify it.
     
    15461607        ac_retval=1
    15471608fi
    1548   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
    1549   return $ac_retval
     1609  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     1610  as_fn_set_status $ac_retval
    15501611
    15511612} # ac_fn_c_try_compile
     1613
     1614# ac_fn_cxx_try_compile LINENO
     1615# ----------------------------
     1616# Try to compile conftest.$ac_ext, and return whether this succeeded.
     1617ac_fn_cxx_try_compile ()
     1618{
     1619  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
     1620  rm -f conftest.$ac_objext
     1621  if { { ac_try="$ac_compile"
     1622case "(($ac_try" in
     1623  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     1624  *) ac_try_echo=$ac_try;;
     1625esac
     1626eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     1627$as_echo "$ac_try_echo"; } >&5
     1628  (eval "$ac_compile") 2>conftest.err
     1629  ac_status=$?
     1630  if test -s conftest.err; then
     1631    grep -v '^ *+' conftest.err >conftest.er1
     1632    cat conftest.er1 >&5
     1633    mv -f conftest.er1 conftest.err
     1634  fi
     1635  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     1636  test $ac_status = 0; } && {
     1637         test -z "$ac_cxx_werror_flag" ||
     1638         test ! -s conftest.err
     1639       } && test -s conftest.$ac_objext; then :
     1640  ac_retval=0
     1641else
     1642  $as_echo "$as_me: failed program was:" >&5
     1643sed 's/^/| /' conftest.$ac_ext >&5
     1644
     1645        ac_retval=1
     1646fi
     1647  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     1648  as_fn_set_status $ac_retval
     1649
     1650} # ac_fn_cxx_try_compile
    15521651
    15531652# ac_fn_c_try_link LINENO
     
    15781677       } && test -s conftest$ac_exeext && {
    15791678         test "$cross_compiling" = yes ||
    1580          $as_test_x conftest$ac_exeext
     1679         test -x conftest$ac_exeext
    15811680       }; then :
    15821681  ac_retval=0
     
    15921691  # left behind by Apple's compiler.  We do this before executing the actions.
    15931692  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
    1594   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
    1595   return $ac_retval
     1693  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     1694  as_fn_set_status $ac_retval
    15961695
    15971696} # ac_fn_c_try_link
     
    16061705  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
    16071706$as_echo_n "checking for $2... " >&6; }
    1608 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
     1707if eval \${$3+:} false; then :
    16091708  $as_echo_n "(cached) " >&6
    16101709else
     
    16241723               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
    16251724$as_echo "$ac_res" >&6; }
    1626   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
     1725  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    16271726
    16281727} # ac_fn_c_check_header_compile
     
    16491748  fi
    16501749  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    1651   test $ac_status = 0; } >/dev/null && {
     1750  test $ac_status = 0; } > conftest.i && {
    16521751         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
    16531752         test ! -s conftest.err
     
    16601759    ac_retval=1
    16611760fi
    1662   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
    1663   return $ac_retval
     1761  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     1762  as_fn_set_status $ac_retval
    16641763
    16651764} # ac_fn_c_try_cpp
     
    17021801fi
    17031802  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
    1704   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
    1705   return $ac_retval
     1803  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     1804  as_fn_set_status $ac_retval
    17061805
    17071806} # ac_fn_c_try_run
     
    17151814  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
    17161815$as_echo_n "checking for $2... " >&6; }
    1717 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
     1816if eval \${$3+:} false; then :
    17181817  $as_echo_n "(cached) " >&6
    17191818else
     
    17701869               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
    17711870$as_echo "$ac_res" >&6; }
    1772   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
     1871  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    17731872
    17741873} # ac_fn_c_check_func
     1874
     1875# ac_fn_cxx_try_cpp LINENO
     1876# ------------------------
     1877# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
     1878ac_fn_cxx_try_cpp ()
     1879{
     1880  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
     1881  if { { ac_try="$ac_cpp conftest.$ac_ext"
     1882case "(($ac_try" in
     1883  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     1884  *) ac_try_echo=$ac_try;;
     1885esac
     1886eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     1887$as_echo "$ac_try_echo"; } >&5
     1888  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
     1889  ac_status=$?
     1890  if test -s conftest.err; then
     1891    grep -v '^ *+' conftest.err >conftest.er1
     1892    cat conftest.er1 >&5
     1893    mv -f conftest.er1 conftest.err
     1894  fi
     1895  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     1896  test $ac_status = 0; } > conftest.i && {
     1897         test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
     1898         test ! -s conftest.err
     1899       }; then :
     1900  ac_retval=0
     1901else
     1902  $as_echo "$as_me: failed program was:" >&5
     1903sed 's/^/| /' conftest.$ac_ext >&5
     1904
     1905    ac_retval=1
     1906fi
     1907  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     1908  as_fn_set_status $ac_retval
     1909
     1910} # ac_fn_cxx_try_cpp
     1911
     1912# ac_fn_cxx_try_link LINENO
     1913# -------------------------
     1914# Try to link conftest.$ac_ext, and return whether this succeeded.
     1915ac_fn_cxx_try_link ()
     1916{
     1917  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
     1918  rm -f conftest.$ac_objext conftest$ac_exeext
     1919  if { { ac_try="$ac_link"
     1920case "(($ac_try" in
     1921  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     1922  *) ac_try_echo=$ac_try;;
     1923esac
     1924eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     1925$as_echo "$ac_try_echo"; } >&5
     1926  (eval "$ac_link") 2>conftest.err
     1927  ac_status=$?
     1928  if test -s conftest.err; then
     1929    grep -v '^ *+' conftest.err >conftest.er1
     1930    cat conftest.er1 >&5
     1931    mv -f conftest.er1 conftest.err
     1932  fi
     1933  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     1934  test $ac_status = 0; } && {
     1935         test -z "$ac_cxx_werror_flag" ||
     1936         test ! -s conftest.err
     1937       } && test -s conftest$ac_exeext && {
     1938         test "$cross_compiling" = yes ||
     1939         test -x conftest$ac_exeext
     1940       }; then :
     1941  ac_retval=0
     1942else
     1943  $as_echo "$as_me: failed program was:" >&5
     1944sed 's/^/| /' conftest.$ac_ext >&5
     1945
     1946        ac_retval=1
     1947fi
     1948  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
     1949  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
     1950  # interfere with the next link command; also delete a directory that is
     1951  # left behind by Apple's compiler.  We do this before executing the actions.
     1952  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
     1953  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     1954  as_fn_set_status $ac_retval
     1955
     1956} # ac_fn_cxx_try_link
    17751957
    17761958# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
     
    17821964{
    17831965  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    1784   if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
     1966  if eval \${$3+:} false; then :
    17851967  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
    17861968$as_echo_n "checking for $2... " >&6; }
    1787 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
     1969if eval \${$3+:} false; then :
    17881970  $as_echo_n "(cached) " >&6
    17891971fi
     
    18212003  ac_header_preproc=no
    18222004fi
    1823 rm -f conftest.err conftest.$ac_ext
     2005rm -f conftest.err conftest.i conftest.$ac_ext
    18242006{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
    18252007$as_echo "$ac_header_preproc" >&6; }
     
    18442026    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
    18452027$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
    1846 ( cat <<\_ASBOX
    1847 ## ------------------------------------------------- ##
     2028( $as_echo "## ------------------------------------------------- ##
    18482029## Report this to libusb-devel@lists.sourceforge.net ##
    1849 ## ------------------------------------------------- ##
    1850 _ASBOX
     2030## ------------------------------------------------- ##"
    18512031     ) | sed "s/^/$as_me: WARNING:     /" >&2
    18522032    ;;
     
    18542034  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
    18552035$as_echo_n "checking for $2... " >&6; }
    1856 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
     2036if eval \${$3+:} false; then :
    18572037  $as_echo_n "(cached) " >&6
    18582038else
     
    18632043$as_echo "$ac_res" >&6; }
    18642044fi
    1865   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
     2045  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    18662046
    18672047} # ac_fn_c_check_header_mongrel
     
    18762056  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
    18772057$as_echo_n "checking for $2... " >&6; }
    1878 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
     2058if eval \${$3+:} false; then :
    18792059  $as_echo_n "(cached) " >&6
    18802060else
     
    19172097               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
    19182098$as_echo "$ac_res" >&6; }
    1919   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
     2099  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    19202100
    19212101} # ac_fn_c_check_type
    19222102
    1923 # ac_fn_c_check_decl LINENO SYMBOL VAR
    1924 # ------------------------------------
    1925 # Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
     2103# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
     2104# ---------------------------------------------
     2105# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
     2106# accordingly.
    19262107ac_fn_c_check_decl ()
    19272108{
    19282109  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    1929   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
    1930 $as_echo_n "checking whether $2 is declared... " >&6; }
    1931 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
     2110  as_decl_name=`echo $2|sed 's/ *(.*//'`
     2111  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
     2112  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
     2113$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
     2114if eval \${$3+:} false; then :
    19322115  $as_echo_n "(cached) " >&6
    19332116else
     
    19382121main ()
    19392122{
    1940 #ifndef $2
    1941   (void) $2;
     2123#ifndef $as_decl_name
     2124#ifdef __cplusplus
     2125  (void) $as_decl_use;
     2126#else
     2127  (void) $as_decl_name;
     2128#endif
    19422129#endif
    19432130
     
    19562143               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
    19572144$as_echo "$ac_res" >&6; }
    1958   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
     2145  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    19592146
    19602147} # ac_fn_c_check_decl
     
    19632150running configure, to aid debugging if configure makes a mistake.
    19642151
    1965 It was created by libusb $as_me 1.0.16-rc6, which was
    1966 generated by GNU Autoconf 2.64.  Invocation command line was
     2152It was created by libusb $as_me 1.0.21, which was
     2153generated by GNU Autoconf 2.69.  Invocation command line was
    19672154
    19682155  $ $0 $@
     
    20742261    echo
    20752262
    2076     cat <<\_ASBOX
    2077 ## ---------------- ##
     2263    $as_echo "## ---------------- ##
    20782264## Cache variables. ##
    2079 ## ---------------- ##
    2080 _ASBOX
     2265## ---------------- ##"
    20812266    echo
    20822267    # The following way of writing the cache mishandles newlines in values,
     
    21122297    echo
    21132298
    2114     cat <<\_ASBOX
    2115 ## ----------------- ##
     2299    $as_echo "## ----------------- ##
    21162300## Output variables. ##
    2117 ## ----------------- ##
    2118 _ASBOX
     2301## ----------------- ##"
    21192302    echo
    21202303    for ac_var in $ac_subst_vars
     
    21292312
    21302313    if test -n "$ac_subst_files"; then
    2131       cat <<\_ASBOX
    2132 ## ------------------- ##
     2314      $as_echo "## ------------------- ##
    21332315## File substitutions. ##
    2134 ## ------------------- ##
    2135 _ASBOX
     2316## ------------------- ##"
    21362317      echo
    21372318      for ac_var in $ac_subst_files
     
    21472328
    21482329    if test -s confdefs.h; then
    2149       cat <<\_ASBOX
    2150 ## ----------- ##
     2330      $as_echo "## ----------- ##
    21512331## confdefs.h. ##
    2152 ## ----------- ##
    2153 _ASBOX
     2332## ----------- ##"
    21542333      echo
    21552334      cat confdefs.h
     
    22062385ac_site_file2=NONE
    22072386if test -n "$CONFIG_SITE"; then
    2208   ac_site_file1=$CONFIG_SITE
     2387  # We do not want a PATH search for config.site.
     2388  case $CONFIG_SITE in #((
     2389    -*)  ac_site_file1=./$CONFIG_SITE;;
     2390    */*) ac_site_file1=$CONFIG_SITE;;
     2391    *)   ac_site_file1=./$CONFIG_SITE;;
     2392  esac
    22092393elif test "x$prefix" != xNONE; then
    22102394  ac_site_file1=$prefix/share/config.site
     
    22172401do
    22182402  test "x$ac_site_file" = xNONE && continue
    2219   if test -r "$ac_site_file"; then
     2403  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
    22202404    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
    22212405$as_echo "$as_me: loading site script $ac_site_file" >&6;}
    22222406    sed 's/^/| /' "$ac_site_file" >&5
    2223     . "$ac_site_file"
     2407    . "$ac_site_file" \
     2408      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
     2409$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
     2410as_fn_error $? "failed to load site script $ac_site_file
     2411See \`config.log' for more details" "$LINENO" 5; }
    22242412  fi
    22252413done
    22262414
    22272415if test -r "$cache_file"; then
    2228   # Some versions of bash will fail to source /dev/null (special
    2229   # files actually), so we avoid doing that.
    2230   if test -f "$cache_file"; then
     2416  # Some versions of bash will fail to source /dev/null (special files
     2417  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
     2418  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
    22312419    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
    22322420$as_echo "$as_me: loading cache $cache_file" >&6;}
     
    22972485  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
    22982486$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
    2299   as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
     2487  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
    23002488fi
    23012489## -------------------- ##
     
    23152503# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
    23162504# http://sourceware.org/autobook/autobook/autobook_91.html
    2317 lt_current="2"
     2505lt_current="1"
    23182506lt_revision="0"
    2319 lt_age="0"
     2507lt_age="1"
    23202508LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
    23212509
    2322 am__api_version='1.11'
     2510am__api_version='1.14'
    23232511
    23242512ac_aux_dir=
    23252513for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
    2326   for ac_t in install-sh install.sh shtool; do
    2327     if test -f "$ac_dir/$ac_t"; then
    2328       ac_aux_dir=$ac_dir
    2329       ac_install_sh="$ac_aux_dir/$ac_t -c"
    2330       break 2
    2331     fi
    2332   done
     2514  if test -f "$ac_dir/install-sh"; then
     2515    ac_aux_dir=$ac_dir
     2516    ac_install_sh="$ac_aux_dir/install-sh -c"
     2517    break
     2518  elif test -f "$ac_dir/install.sh"; then
     2519    ac_aux_dir=$ac_dir
     2520    ac_install_sh="$ac_aux_dir/install.sh -c"
     2521    break
     2522  elif test -f "$ac_dir/shtool"; then
     2523    ac_aux_dir=$ac_dir
     2524    ac_install_sh="$ac_aux_dir/shtool install -c"
     2525    break
     2526  fi
    23332527done
    23342528if test -z "$ac_aux_dir"; then
    2335   as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
     2529  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
    23362530fi
    23372531
     
    23622556$as_echo_n "checking for a BSD-compatible install... " >&6; }
    23632557if test -z "$INSTALL"; then
    2364 if test "${ac_cv_path_install+set}" = set; then :
     2558if ${ac_cv_path_install+:} false; then :
    23652559  $as_echo_n "(cached) " >&6
    23662560else
     
    23822576    for ac_prog in ginstall scoinst install; do
    23832577      for ac_exec_ext in '' $ac_executable_extensions; do
    2384         if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
     2578        if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
    23852579          if test $ac_prog = install &&
    23862580            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
     
    24402634{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
    24412635$as_echo_n "checking whether build environment is sane... " >&6; }
    2442 # Just in case
    2443 sleep 1
    2444 echo timestamp > conftest.file
    24452636# Reject unsafe characters in $srcdir or the absolute working directory
    24462637# name.  Accept space and tab only in the latter.
     
    24492640case `pwd` in
    24502641  *[\\\"\#\$\&\'\`$am_lf]*)
    2451     as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
     2642    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
    24522643esac
    24532644case $srcdir in
    24542645  *[\\\"\#\$\&\'\`$am_lf\ \     ]*)
    2455     as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
     2646    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
    24562647esac
    24572648
    2458 # Do `set' in a subshell so we don't clobber the current shell's
     2649# Do 'set' in a subshell so we don't clobber the current shell's
    24592650# arguments.  Must try -L first in case configure is actually a
    24602651# symlink; some systems play weird games with the mod time of symlinks
     
    24622653# directory).
    24632654if (
    2464    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    2465    if test "$*" = "X"; then
    2466       # -L didn't work.
    2467       set X `ls -t "$srcdir/configure" conftest.file`
    2468    fi
    2469    rm -f conftest.file
    2470    if test "$*" != "X $srcdir/configure conftest.file" \
    2471       && test "$*" != "X conftest.file $srcdir/configure"; then
    2472 
    2473       # If neither matched, then we have a broken ls.  This can happen
    2474       # if, for instance, CONFIG_SHELL is bash and it inherits a
    2475       # broken ls alias from the environment.  This has actually
    2476       # happened.  Such a system could not be considered "sane".
    2477       as_fn_error "ls -t appears to fail.  Make sure there is not a broken
    2478 alias in your environment" "$LINENO" 5
    2479    fi
    2480 
     2655   am_has_slept=no
     2656   for am_try in 1 2; do
     2657     echo "timestamp, slept: $am_has_slept" > conftest.file
     2658     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
     2659     if test "$*" = "X"; then
     2660        # -L didn't work.
     2661        set X `ls -t "$srcdir/configure" conftest.file`
     2662     fi
     2663     if test "$*" != "X $srcdir/configure conftest.file" \
     2664        && test "$*" != "X conftest.file $srcdir/configure"; then
     2665
     2666        # If neither matched, then we have a broken ls.  This can happen
     2667        # if, for instance, CONFIG_SHELL is bash and it inherits a
     2668        # broken ls alias from the environment.  This has actually
     2669        # happened.  Such a system could not be considered "sane".
     2670        as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
     2671  alias in your environment" "$LINENO" 5
     2672     fi
     2673     if test "$2" = conftest.file || test $am_try -eq 2; then
     2674       break
     2675     fi
     2676     # Just in case.
     2677     sleep 1
     2678     am_has_slept=yes
     2679   done
    24812680   test "$2" = conftest.file
    24822681   )
     
    24852684   :
    24862685else
    2487    as_fn_error "newly created file is older than distributed files!
     2686   as_fn_error $? "newly created file is older than distributed files!
    24882687Check your system clock" "$LINENO" 5
    24892688fi
    24902689{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
    24912690$as_echo "yes" >&6; }
     2691# If we didn't sleep, we still need to ensure time stamps of config.status and
     2692# generated files are strictly newer.
     2693am_sleep_pid=
     2694if grep 'slept: no' conftest.file >/dev/null 2>&1; then
     2695  ( sleep 1 ) &
     2696  am_sleep_pid=$!
     2697fi
     2698
     2699rm -f conftest.file
     2700
    24922701test "$program_prefix" != NONE &&
    24932702  program_transform_name="s&^&$program_prefix&;$program_transform_name"
     
    25122721fi
    25132722# Use eval to expand $SHELL
    2514 if eval "$MISSING --run true"; then
    2515   am_missing_run="$MISSING --run "
     2723if eval "$MISSING --is-lightweight"; then
     2724  am_missing_run="$MISSING "
    25162725else
    25172726  am_missing_run=
    2518   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
    2519 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
     2727  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
     2728$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
    25202729fi
    25212730
     
    25292738fi
    25302739
    2531 # Installed binaries are usually stripped using `strip' when the user
    2532 # run `make install-strip'.  However `strip' might not be the right
     2740# Installed binaries are usually stripped using 'strip' when the user
     2741# run "make install-strip".  However 'strip' might not be the right
    25332742# tool to use in cross-compilation environments, therefore Automake
    2534 # will honor the `STRIP' environment variable to overrule this program.
     2743# will honor the 'STRIP' environment variable to overrule this program.
    25352744if test "$cross_compiling" != no; then
    25362745  if test -n "$ac_tool_prefix"; then
     
    25392748{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    25402749$as_echo_n "checking for $ac_word... " >&6; }
    2541 if test "${ac_cv_prog_STRIP+set}" = set; then :
     2750if ${ac_cv_prog_STRIP+:} false; then :
    25422751  $as_echo_n "(cached) " >&6
    25432752else
     
    25512760  test -z "$as_dir" && as_dir=.
    25522761    for ac_exec_ext in '' $ac_executable_extensions; do
    2553   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     2762  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    25542763    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
    25552764    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    25792788{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    25802789$as_echo_n "checking for $ac_word... " >&6; }
    2581 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
     2790if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
    25822791  $as_echo_n "(cached) " >&6
    25832792else
     
    25912800  test -z "$as_dir" && as_dir=.
    25922801    for ac_exec_ext in '' $ac_executable_extensions; do
    2593   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     2802  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    25942803    ac_cv_prog_ac_ct_STRIP="strip"
    25952804    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    26322841$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
    26332842if test -z "$MKDIR_P"; then
    2634   if test "${ac_cv_path_mkdir+set}" = set; then :
     2843  if ${ac_cv_path_mkdir+:} false; then :
    26352844  $as_echo_n "(cached) " >&6
    26362845else
     
    26422851    for ac_prog in mkdir gmkdir; do
    26432852         for ac_exec_ext in '' $ac_executable_extensions; do
    2644            { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
     2853           as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
    26452854           case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
    26462855             'mkdir (GNU coreutils) '* | \
     
    26572866fi
    26582867
     2868  test -d ./--version && rmdir ./--version
    26592869  if test "${ac_cv_path_mkdir+set}" = set; then
    26602870    MKDIR_P="$ac_cv_path_mkdir -p"
     
    26642874    # break other packages using the cache if that directory is
    26652875    # removed, or if the value is a relative name.
    2666     test -d ./--version && rmdir ./--version
    26672876    MKDIR_P="$ac_install_sh -d"
    26682877  fi
     
    26702879{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
    26712880$as_echo "$MKDIR_P" >&6; }
    2672 
    2673 mkdir_p="$MKDIR_P"
    2674 case $mkdir_p in
    2675   [\\/$]* | ?:[\\/]*) ;;
    2676   */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
    2677 esac
    26782881
    26792882for ac_prog in gawk mawk nawk awk
     
    26832886{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    26842887$as_echo_n "checking for $ac_word... " >&6; }
    2685 if test "${ac_cv_prog_AWK+set}" = set; then :
     2888if ${ac_cv_prog_AWK+:} false; then :
    26862889  $as_echo_n "(cached) " >&6
    26872890else
     
    26952898  test -z "$as_dir" && as_dir=.
    26962899    for ac_exec_ext in '' $ac_executable_extensions; do
    2697   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     2900  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    26982901    ac_cv_prog_AWK="$ac_prog"
    26992902    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    27232926set x ${MAKE-make}
    27242927ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
    2725 if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
     2928if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
    27262929  $as_echo_n "(cached) " >&6
    27272930else
     
    27312934        @echo '@@@%%%=$(MAKE)=@@@%%%'
    27322935_ACEOF
    2733 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
     2936# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
    27342937case `${MAKE-make} -f conftest.make 2>/dev/null` in
    27352938  *@@@%%%=?*=@@@%%%*)
     
    27592962rmdir .tst 2>/dev/null
    27602963
     2964# Check whether --enable-silent-rules was given.
     2965if test "${enable_silent_rules+set}" = set; then :
     2966  enableval=$enable_silent_rules;
     2967fi
     2968
     2969case $enable_silent_rules in # (((
     2970  yes) AM_DEFAULT_VERBOSITY=0;;
     2971   no) AM_DEFAULT_VERBOSITY=1;;
     2972    *) AM_DEFAULT_VERBOSITY=1;;
     2973esac
     2974am_make=${MAKE-make}
     2975{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
     2976$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
     2977if ${am_cv_make_support_nested_variables+:} false; then :
     2978  $as_echo_n "(cached) " >&6
     2979else
     2980  if $as_echo 'TRUE=$(BAR$(V))
     2981BAR0=false
     2982BAR1=true
     2983V=1
     2984am__doit:
     2985        @$(TRUE)
     2986.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
     2987  am_cv_make_support_nested_variables=yes
     2988else
     2989  am_cv_make_support_nested_variables=no
     2990fi
     2991fi
     2992{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
     2993$as_echo "$am_cv_make_support_nested_variables" >&6; }
     2994if test $am_cv_make_support_nested_variables = yes; then
     2995    AM_V='$(V)'
     2996  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
     2997else
     2998  AM_V=$AM_DEFAULT_VERBOSITY
     2999  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
     3000fi
     3001AM_BACKSLASH='\'
     3002
    27613003if test "`cd $srcdir && pwd`" != "`pwd`"; then
    27623004  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
     
    27653007  # test to see if srcdir already configured
    27663008  if test -f $srcdir/config.status; then
    2767     as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
     3009    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
    27683010  fi
    27693011fi
     
    27813023# Define the identity of the package.
    27823024 PACKAGE='libusb'
    2783  VERSION='1.0.16-rc6'
     3025 VERSION='1.0.21'
    27843026
    27853027
     
    28093051MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
    28103052
     3053# For better backward compatibility.  To be removed once Automake 1.9.x
     3054# dies out for good.  For more background, see:
     3055# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
     3056# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
     3057mkdir_p='$(MKDIR_P)'
     3058
    28113059# We need awk for the "check" target.  The system "awk" is bad on
    28123060# some platforms.
    2813 # Always define AMTAR for backward compatibility.
    2814 
    2815 AMTAR=${AMTAR-"${am_missing_run}tar"}
    2816 
    2817 am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
    2818 
    2819 
    2820 
    2821 
    2822 
    2823 
    2824 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
    2825 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
    2826     # Check whether --enable-maintainer-mode was given.
    2827 if test "${enable_maintainer_mode+set}" = set; then :
    2828   enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
    2829 else
    2830   USE_MAINTAINER_MODE=no
    2831 fi
    2832 
    2833   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
    2834 $as_echo "$USE_MAINTAINER_MODE" >&6; }
    2835    if test $USE_MAINTAINER_MODE = yes; then
    2836   MAINTAINER_MODE_TRUE=
    2837   MAINTAINER_MODE_FALSE='#'
    2838 else
    2839   MAINTAINER_MODE_TRUE='#'
    2840   MAINTAINER_MODE_FALSE=
    2841 fi
    2842 
    2843   MAINT=$MAINTAINER_MODE_TRUE
    2844 
    2845 
     3061# Always define AMTAR for backward compatibility.  Yes, it's still used
     3062# in the wild :-(  We should find a proper way to deprecate it ...
     3063AMTAR='$${TAR-tar}'
     3064
     3065
     3066# We'll loop over all known methods to create a tar archive until one works.
     3067_am_tools='gnutar  pax cpio none'
     3068
     3069am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
     3070
     3071
     3072
     3073
     3074
     3075
     3076# POSIX will say in a future version that running "rm -f" with no argument
     3077# is OK; and we want to be able to make that assumption in our Makefile
     3078# recipes.  So use an aggressive probe to check that the usage we want is
     3079# actually supported "in the wild" to an acceptable degree.
     3080# See automake bug#10828.
     3081# To make any issue more visible, cause the running configure to be aborted
     3082# by default if the 'rm' program in use doesn't match our expectations; the
     3083# user can still override this though.
     3084if rm -f && rm -fr && rm -rf; then : OK; else
     3085  cat >&2 <<'END'
     3086Oops!
     3087
     3088Your 'rm' program seems unable to run without file operands specified
     3089on the command line, even when the '-f' option is present.  This is contrary
     3090to the behaviour of most rm programs out there, and not conforming with
     3091the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
     3092
     3093Please tell bug-automake@gnu.org about your system, including the value
     3094of your $PATH and any error possibly output before this message.  This
     3095can help us improve future automake versions.
     3096
     3097END
     3098  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
     3099    echo 'Configuration will proceed anyway, since you have set the' >&2
     3100    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
     3101    echo >&2
     3102  else
     3103    cat >&2 <<'END'
     3104Aborting the configuration process, to ensure you take notice of the issue.
     3105
     3106You can download and install GNU coreutils to get an 'rm' implementation
     3107that behaves properly: <http://www.gnu.org/software/coreutils/>.
     3108
     3109If you want to complete the configuration process using your problematic
     3110'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
     3111to "yes", and re-run configure.
     3112
     3113END
     3114    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
     3115  fi
     3116fi
    28463117
    28473118
     
    28543125fi
    28553126
    2856 case $enable_silent_rules in
    2857 yes) AM_DEFAULT_VERBOSITY=0;;
    2858 no) AM_DEFAULT_VERBOSITY=1;;
    2859 *)  AM_DEFAULT_VERBOSITY=0;;
     3127case $enable_silent_rules in # (((
     3128  yes) AM_DEFAULT_VERBOSITY=0;;
     3129   no) AM_DEFAULT_VERBOSITY=1;;
     3130    *) AM_DEFAULT_VERBOSITY=0;;
    28603131esac
     3132am_make=${MAKE-make}
     3133{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
     3134$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
     3135if ${am_cv_make_support_nested_variables+:} false; then :
     3136  $as_echo_n "(cached) " >&6
     3137else
     3138  if $as_echo 'TRUE=$(BAR$(V))
     3139BAR0=false
     3140BAR1=true
     3141V=1
     3142am__doit:
     3143        @$(TRUE)
     3144.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
     3145  am_cv_make_support_nested_variables=yes
     3146else
     3147  am_cv_make_support_nested_variables=no
     3148fi
     3149fi
     3150{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
     3151$as_echo "$am_cv_make_support_nested_variables" >&6; }
     3152if test $am_cv_make_support_nested_variables = yes; then
     3153    AM_V='$(V)'
     3154  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
     3155else
     3156  AM_V=$AM_DEFAULT_VERBOSITY
     3157  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
     3158fi
    28613159AM_BACKSLASH='\'
    28623160
     
    28733171{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    28743172$as_echo_n "checking for $ac_word... " >&6; }
    2875 if test "${ac_cv_prog_CC+set}" = set; then :
     3173if ${ac_cv_prog_CC+:} false; then :
    28763174  $as_echo_n "(cached) " >&6
    28773175else
     
    28853183  test -z "$as_dir" && as_dir=.
    28863184    for ac_exec_ext in '' $ac_executable_extensions; do
    2887   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     3185  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    28883186    ac_cv_prog_CC="${ac_tool_prefix}gcc"
    28893187    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    29133211{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    29143212$as_echo_n "checking for $ac_word... " >&6; }
    2915 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
     3213if ${ac_cv_prog_ac_ct_CC+:} false; then :
    29163214  $as_echo_n "(cached) " >&6
    29173215else
     
    29253223  test -z "$as_dir" && as_dir=.
    29263224    for ac_exec_ext in '' $ac_executable_extensions; do
    2927   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     3225  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    29283226    ac_cv_prog_ac_ct_CC="gcc"
    29293227    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    29663264{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    29673265$as_echo_n "checking for $ac_word... " >&6; }
    2968 if test "${ac_cv_prog_CC+set}" = set; then :
     3266if ${ac_cv_prog_CC+:} false; then :
    29693267  $as_echo_n "(cached) " >&6
    29703268else
     
    29783276  test -z "$as_dir" && as_dir=.
    29793277    for ac_exec_ext in '' $ac_executable_extensions; do
    2980   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     3278  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    29813279    ac_cv_prog_CC="${ac_tool_prefix}cc"
    29823280    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    30063304{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    30073305$as_echo_n "checking for $ac_word... " >&6; }
    3008 if test "${ac_cv_prog_CC+set}" = set; then :
     3306if ${ac_cv_prog_CC+:} false; then :
    30093307  $as_echo_n "(cached) " >&6
    30103308else
     
    30193317  test -z "$as_dir" && as_dir=.
    30203318    for ac_exec_ext in '' $ac_executable_extensions; do
    3021   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     3319  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    30223320    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
    30233321       ac_prog_rejected=yes
     
    30653363{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    30663364$as_echo_n "checking for $ac_word... " >&6; }
    3067 if test "${ac_cv_prog_CC+set}" = set; then :
     3365if ${ac_cv_prog_CC+:} false; then :
    30683366  $as_echo_n "(cached) " >&6
    30693367else
     
    30773375  test -z "$as_dir" && as_dir=.
    30783376    for ac_exec_ext in '' $ac_executable_extensions; do
    3079   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     3377  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    30803378    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
    30813379    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    31093407{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    31103408$as_echo_n "checking for $ac_word... " >&6; }
    3111 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
     3409if ${ac_cv_prog_ac_ct_CC+:} false; then :
    31123410  $as_echo_n "(cached) " >&6
    31133411else
     
    31213419  test -z "$as_dir" && as_dir=.
    31223420    for ac_exec_ext in '' $ac_executable_extensions; do
    3123   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     3421  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    31243422    ac_cv_prog_ac_ct_CC="$ac_prog"
    31253423    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    31633461test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    31643462$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    3165 as_fn_error "no acceptable C compiler found in \$PATH
    3166 See \`config.log' for more details." "$LINENO" 5; }
     3463as_fn_error $? "no acceptable C compiler found in \$PATH
     3464See \`config.log' for more details" "$LINENO" 5; }
    31673465
    31683466# Provide some information about the compiler.
     
    31853483         10q' conftest.err >conftest.er1
    31863484    cat conftest.er1 >&5
    3187     rm -f conftest.er1 conftest.err
    31883485  fi
     3486  rm -f conftest.er1 conftest.err
    31893487  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    31903488  test $ac_status = 0; }
     
    31933491cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    31943492/* end confdefs.h.  */
    3195 #include <stdio.h>
     3493
    31963494int
    31973495main ()
    31983496{
    3199 FILE *f = fopen ("conftest.out", "w");
    3200  return ferror (f) || fclose (f) != 0;
    32013497
    32023498  ;
     
    32053501_ACEOF
    32063502ac_clean_files_save=$ac_clean_files
    3207 ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
     3503ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
    32083504# Try to create an executable without -o first, disregard a.out.
    32093505# It will help us diagnose broken compilers, and finding out an intuition
    32103506# of exeext.
    3211 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
    3212 $as_echo_n "checking for C compiler default output file name... " >&6; }
     3507{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
     3508$as_echo_n "checking whether the C compiler works... " >&6; }
    32133509ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
    32143510
     
    32723568  ac_file=''
    32733569fi
     3570if test -z "$ac_file"; then :
     3571  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     3572$as_echo "no" >&6; }
     3573$as_echo "$as_me: failed program was:" >&5
     3574sed 's/^/| /' conftest.$ac_ext >&5
     3575
     3576{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
     3577$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
     3578as_fn_error 77 "C compiler cannot create executables
     3579See \`config.log' for more details" "$LINENO" 5; }
     3580else
     3581  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     3582$as_echo "yes" >&6; }
     3583fi
     3584{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
     3585$as_echo_n "checking for C compiler default output file name... " >&6; }
    32743586{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
    32753587$as_echo "$ac_file" >&6; }
    3276 if test -z "$ac_file"; then :
    3277   $as_echo "$as_me: failed program was:" >&5
    3278 sed 's/^/| /' conftest.$ac_ext >&5
    3279 
    3280 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    3281 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    3282 { as_fn_set_status 77
    3283 as_fn_error "C compiler cannot create executables
    3284 See \`config.log' for more details." "$LINENO" 5; }; }
    3285 fi
    32863588ac_exeext=$ac_cv_exeext
    32873589
    3288 # Check that the compiler produces executables we can run.  If not, either
    3289 # the compiler is broken, or we cross compile.
    3290 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
    3291 $as_echo_n "checking whether the C compiler works... " >&6; }
    3292 # If not cross compiling, check that we can run a simple program.
    3293 if test "$cross_compiling" != yes; then
    3294   if { ac_try='./$ac_file'
    3295   { { case "(($ac_try" in
    3296   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    3297   *) ac_try_echo=$ac_try;;
    3298 esac
    3299 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
    3300 $as_echo "$ac_try_echo"; } >&5
    3301   (eval "$ac_try") 2>&5
    3302   ac_status=$?
    3303   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    3304   test $ac_status = 0; }; }; then
    3305     cross_compiling=no
    3306   else
    3307     if test "$cross_compiling" = maybe; then
    3308         cross_compiling=yes
    3309     else
    3310         { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    3311 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    3312 as_fn_error "cannot run C compiled programs.
    3313 If you meant to cross compile, use \`--host'.
    3314 See \`config.log' for more details." "$LINENO" 5; }
    3315     fi
    3316   fi
    3317 fi
    3318 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
    3319 $as_echo "yes" >&6; }
    3320 
    3321 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
     3590rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
    33223591ac_clean_files=$ac_clean_files_save
    3323 # Check that the compiler produces executables we can run.  If not, either
    3324 # the compiler is broken, or we cross compile.
    3325 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
    3326 $as_echo_n "checking whether we are cross compiling... " >&6; }
    3327 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
    3328 $as_echo "$cross_compiling" >&6; }
    3329 
    33303592{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
    33313593$as_echo_n "checking for suffix of executables... " >&6; }
     
    33573619  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    33583620$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    3359 as_fn_error "cannot compute suffix of executables: cannot compile and link
    3360 See \`config.log' for more details." "$LINENO" 5; }
    3361 fi
    3362 rm -f conftest$ac_cv_exeext
     3621as_fn_error $? "cannot compute suffix of executables: cannot compile and link
     3622See \`config.log' for more details" "$LINENO" 5; }
     3623fi
     3624rm -f conftest conftest$ac_cv_exeext
    33633625{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
    33643626$as_echo "$ac_cv_exeext" >&6; }
     
    33673629EXEEXT=$ac_cv_exeext
    33683630ac_exeext=$EXEEXT
     3631cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     3632/* end confdefs.h.  */
     3633#include <stdio.h>
     3634int
     3635main ()
     3636{
     3637FILE *f = fopen ("conftest.out", "w");
     3638 return ferror (f) || fclose (f) != 0;
     3639
     3640  ;
     3641  return 0;
     3642}
     3643_ACEOF
     3644ac_clean_files="$ac_clean_files conftest.out"
     3645# Check that the compiler produces executables we can run.  If not, either
     3646# the compiler is broken, or we cross compile.
     3647{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
     3648$as_echo_n "checking whether we are cross compiling... " >&6; }
     3649if test "$cross_compiling" != yes; then
     3650  { { ac_try="$ac_link"
     3651case "(($ac_try" in
     3652  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     3653  *) ac_try_echo=$ac_try;;
     3654esac
     3655eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     3656$as_echo "$ac_try_echo"; } >&5
     3657  (eval "$ac_link") 2>&5
     3658  ac_status=$?
     3659  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     3660  test $ac_status = 0; }
     3661  if { ac_try='./conftest$ac_cv_exeext'
     3662  { { case "(($ac_try" in
     3663  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     3664  *) ac_try_echo=$ac_try;;
     3665esac
     3666eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     3667$as_echo "$ac_try_echo"; } >&5
     3668  (eval "$ac_try") 2>&5
     3669  ac_status=$?
     3670  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     3671  test $ac_status = 0; }; }; then
     3672    cross_compiling=no
     3673  else
     3674    if test "$cross_compiling" = maybe; then
     3675        cross_compiling=yes
     3676    else
     3677        { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
     3678$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
     3679as_fn_error $? "cannot run C compiled programs.
     3680If you meant to cross compile, use \`--host'.
     3681See \`config.log' for more details" "$LINENO" 5; }
     3682    fi
     3683  fi
     3684fi
     3685{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
     3686$as_echo "$cross_compiling" >&6; }
     3687
     3688rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
     3689ac_clean_files=$ac_clean_files_save
    33693690{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
    33703691$as_echo_n "checking for suffix of object files... " >&6; }
    3371 if test "${ac_cv_objext+set}" = set; then :
     3692if ${ac_cv_objext+:} false; then :
    33723693  $as_echo_n "(cached) " >&6
    33733694else
     
    34093730{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    34103731$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    3411 as_fn_error "cannot compute suffix of object files: cannot compile
    3412 See \`config.log' for more details." "$LINENO" 5; }
     3732as_fn_error $? "cannot compute suffix of object files: cannot compile
     3733See \`config.log' for more details" "$LINENO" 5; }
    34133734fi
    34143735rm -f conftest.$ac_cv_objext conftest.$ac_ext
     
    34203741{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
    34213742$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
    3422 if test "${ac_cv_c_compiler_gnu+set}" = set; then :
     3743if ${ac_cv_c_compiler_gnu+:} false; then :
    34233744  $as_echo_n "(cached) " >&6
    34243745else
     
    34573778{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
    34583779$as_echo_n "checking whether $CC accepts -g... " >&6; }
    3459 if test "${ac_cv_prog_cc_g+set}" = set; then :
     3780if ${ac_cv_prog_cc_g+:} false; then :
    34603781  $as_echo_n "(cached) " >&6
    34613782else
     
    35353856{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
    35363857$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
    3537 if test "${ac_cv_prog_cc_c89+set}" = set; then :
     3858if ${ac_cv_prog_cc_c89+:} false; then :
    35383859  $as_echo_n "(cached) " >&6
    35393860else
     
    35443865#include <stdarg.h>
    35453866#include <stdio.h>
    3546 #include <sys/types.h>
    3547 #include <sys/stat.h>
     3867struct stat;
    35483868/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
    35493869struct buf { int x; };
     
    36293949ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    36303950ac_compiler_gnu=$ac_cv_c_compiler_gnu
     3951
     3952ac_ext=c
     3953ac_cpp='$CPP $CPPFLAGS'
     3954ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     3955ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     3956ac_compiler_gnu=$ac_cv_c_compiler_gnu
     3957{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
     3958$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
     3959if ${am_cv_prog_cc_c_o+:} false; then :
     3960  $as_echo_n "(cached) " >&6
     3961else
     3962  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     3963/* end confdefs.h.  */
     3964
     3965int
     3966main ()
     3967{
     3968
     3969  ;
     3970  return 0;
     3971}
     3972_ACEOF
     3973  # Make sure it works both with $CC and with simple cc.
     3974  # Following AC_PROG_CC_C_O, we do the test twice because some
     3975  # compilers refuse to overwrite an existing .o file with -o,
     3976  # though they will create one.
     3977  am_cv_prog_cc_c_o=yes
     3978  for am_i in 1 2; do
     3979    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
     3980   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
     3981   ac_status=$?
     3982   echo "$as_me:$LINENO: \$? = $ac_status" >&5
     3983   (exit $ac_status); } \
     3984         && test -f conftest2.$ac_objext; then
     3985      : OK
     3986    else
     3987      am_cv_prog_cc_c_o=no
     3988      break
     3989    fi
     3990  done
     3991  rm -f core conftest*
     3992  unset am_i
     3993fi
     3994{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
     3995$as_echo "$am_cv_prog_cc_c_o" >&6; }
     3996if test "$am_cv_prog_cc_c_o" != yes; then
     3997   # Losing compiler, so override with the script.
     3998   # FIXME: It is wrong to rewrite CC.
     3999   # But if we don't then we get into trouble of one sort or another.
     4000   # A longer-term fix would be to have automake use am__CC in this case,
     4001   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
     4002   CC="$am_aux_dir/compile $CC"
     4003fi
     4004ac_ext=c
     4005ac_cpp='$CPP $CPPFLAGS'
     4006ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     4007ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     4008ac_compiler_gnu=$ac_cv_c_compiler_gnu
     4009
    36314010DEPDIR="${am__leading_dot}deps"
    36324011
     
    36484027# First try GNU make style include.
    36494028echo "include confinc" > confmf
    3650 # Ignore all kinds of additional output from `make'.
     4029# Ignore all kinds of additional output from 'make'.
    36514030case `$am_make -s -f confmf 2> /dev/null` in #(
    36524031*the\ am__doit\ target*)
     
    36814060  am_depcomp="$ac_aux_dir/depcomp"
    36824061  AMDEPBACKSLASH='\'
     4062  am__nodep='_no'
    36834063fi
    36844064 if test "x$enable_dependency_tracking" != xno; then
     
    36964076{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
    36974077$as_echo_n "checking dependency style of $depcc... " >&6; }
    3698 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
     4078if ${am_cv_CC_dependencies_compiler_type+:} false; then :
    36994079  $as_echo_n "(cached) " >&6
    37004080else
     
    37034083  # making bogus files that we don't know about and never remove.  For
    37044084  # instance it was reported that on HP-UX the gcc test will end up
    3705   # making a dummy file named `D' -- because `-MD' means `put the output
    3706   # in D'.
     4085  # making a dummy file named 'D' -- because '-MD' means "put the output
     4086  # in D".
     4087  rm -rf conftest.dir
    37074088  mkdir conftest.dir
    37084089  # Copy depcomp to subdir because otherwise we won't find it if we're
     
    37384119    for i in 1 2 3 4 5 6; do
    37394120      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    3740       # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
    3741       # Solaris 8's {/usr,}/bin/sh.
    3742       touch sub/conftst$i.h
     4121      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
     4122      # Solaris 10 /bin/sh.
     4123      echo '/* dummy */' > sub/conftst$i.h
    37434124    done
    37444125    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
    37454126
    3746     # We check with `-c' and `-o' for the sake of the "dashmstdout"
     4127    # We check with '-c' and '-o' for the sake of the "dashmstdout"
    37474128    # mode.  It turns out that the SunPro C++ compiler does not properly
    3748     # handle `-M -o', and we need to detect this.  Also, some Intel
    3749     # versions had trouble with output in subdirs
     4129    # handle '-M -o', and we need to detect this.  Also, some Intel
     4130    # versions had trouble with output in subdirs.
    37504131    am__obj=sub/conftest.${OBJEXT-o}
    37514132    am__minus_obj="-o $am__obj"
     
    37564137      ;;
    37574138    nosideeffect)
    3758       # after this tag, mechanisms are not by side-effect, so they'll
    3759       # only be used when explicitly requested
     4139      # After this tag, mechanisms are not by side-effect, so they'll
     4140      # only be used when explicitly requested.
    37604141      if test "x$enable_dependency_tracking" = xyes; then
    37614142        continue
     
    37644145      fi
    37654146      ;;
    3766     msvisualcpp | msvcmsys)
    3767       # This compiler won't grok `-c -o', but also, the minuso test has
     4147    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
     4148      # This compiler won't grok '-c -o', but also, the minuso test has
    37684149      # not run yet.  These depmodes are late enough in the game, and
    37694150      # so weak that their functioning should not be impacted.
     
    38194200
    38204201
     4202ac_ext=cpp
     4203ac_cpp='$CXXCPP $CPPFLAGS'
     4204ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     4205ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     4206ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
     4207if test -z "$CXX"; then
     4208  if test -n "$CCC"; then
     4209    CXX=$CCC
     4210  else
     4211    if test -n "$ac_tool_prefix"; then
     4212  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
     4213  do
     4214    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
     4215set dummy $ac_tool_prefix$ac_prog; ac_word=$2
     4216{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
     4217$as_echo_n "checking for $ac_word... " >&6; }
     4218if ${ac_cv_prog_CXX+:} false; then :
     4219  $as_echo_n "(cached) " >&6
     4220else
     4221  if test -n "$CXX"; then
     4222  ac_cv_prog_CXX="$CXX" # Let the user override the test.
     4223else
     4224as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
     4225for as_dir in $PATH
     4226do
     4227  IFS=$as_save_IFS
     4228  test -z "$as_dir" && as_dir=.
     4229    for ac_exec_ext in '' $ac_executable_extensions; do
     4230  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4231    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     4232    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     4233    break 2
     4234  fi
     4235done
     4236  done
     4237IFS=$as_save_IFS
     4238
     4239fi
     4240fi
     4241CXX=$ac_cv_prog_CXX
     4242if test -n "$CXX"; then
     4243  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
     4244$as_echo "$CXX" >&6; }
     4245else
     4246  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     4247$as_echo "no" >&6; }
     4248fi
     4249
     4250
     4251    test -n "$CXX" && break
     4252  done
     4253fi
     4254if test -z "$CXX"; then
     4255  ac_ct_CXX=$CXX
     4256  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
     4257do
     4258  # Extract the first word of "$ac_prog", so it can be a program name with args.
     4259set dummy $ac_prog; ac_word=$2
     4260{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
     4261$as_echo_n "checking for $ac_word... " >&6; }
     4262if ${ac_cv_prog_ac_ct_CXX+:} false; then :
     4263  $as_echo_n "(cached) " >&6
     4264else
     4265  if test -n "$ac_ct_CXX"; then
     4266  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
     4267else
     4268as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
     4269for as_dir in $PATH
     4270do
     4271  IFS=$as_save_IFS
     4272  test -z "$as_dir" && as_dir=.
     4273    for ac_exec_ext in '' $ac_executable_extensions; do
     4274  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4275    ac_cv_prog_ac_ct_CXX="$ac_prog"
     4276    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     4277    break 2
     4278  fi
     4279done
     4280  done
     4281IFS=$as_save_IFS
     4282
     4283fi
     4284fi
     4285ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
     4286if test -n "$ac_ct_CXX"; then
     4287  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
     4288$as_echo "$ac_ct_CXX" >&6; }
     4289else
     4290  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     4291$as_echo "no" >&6; }
     4292fi
     4293
     4294
     4295  test -n "$ac_ct_CXX" && break
     4296done
     4297
     4298  if test "x$ac_ct_CXX" = x; then
     4299    CXX="g++"
     4300  else
     4301    case $cross_compiling:$ac_tool_warned in
     4302yes:)
     4303{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
     4304$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
     4305ac_tool_warned=yes ;;
     4306esac
     4307    CXX=$ac_ct_CXX
     4308  fi
     4309fi
     4310
     4311  fi
     4312fi
     4313# Provide some information about the compiler.
     4314$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
     4315set X $ac_compile
     4316ac_compiler=$2
     4317for ac_option in --version -v -V -qversion; do
     4318  { { ac_try="$ac_compiler $ac_option >&5"
     4319case "(($ac_try" in
     4320  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     4321  *) ac_try_echo=$ac_try;;
     4322esac
     4323eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     4324$as_echo "$ac_try_echo"; } >&5
     4325  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
     4326  ac_status=$?
     4327  if test -s conftest.err; then
     4328    sed '10a\
     4329... rest of stderr output deleted ...
     4330         10q' conftest.err >conftest.er1
     4331    cat conftest.er1 >&5
     4332  fi
     4333  rm -f conftest.er1 conftest.err
     4334  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     4335  test $ac_status = 0; }
     4336done
     4337
     4338{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
     4339$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
     4340if ${ac_cv_cxx_compiler_gnu+:} false; then :
     4341  $as_echo_n "(cached) " >&6
     4342else
     4343  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     4344/* end confdefs.h.  */
     4345
     4346int
     4347main ()
     4348{
     4349#ifndef __GNUC__
     4350       choke me
     4351#endif
     4352
     4353  ;
     4354  return 0;
     4355}
     4356_ACEOF
     4357if ac_fn_cxx_try_compile "$LINENO"; then :
     4358  ac_compiler_gnu=yes
     4359else
     4360  ac_compiler_gnu=no
     4361fi
     4362rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     4363ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
     4364
     4365fi
     4366{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
     4367$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
     4368if test $ac_compiler_gnu = yes; then
     4369  GXX=yes
     4370else
     4371  GXX=
     4372fi
     4373ac_test_CXXFLAGS=${CXXFLAGS+set}
     4374ac_save_CXXFLAGS=$CXXFLAGS
     4375{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
     4376$as_echo_n "checking whether $CXX accepts -g... " >&6; }
     4377if ${ac_cv_prog_cxx_g+:} false; then :
     4378  $as_echo_n "(cached) " >&6
     4379else
     4380  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
     4381   ac_cxx_werror_flag=yes
     4382   ac_cv_prog_cxx_g=no
     4383   CXXFLAGS="-g"
     4384   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     4385/* end confdefs.h.  */
     4386
     4387int
     4388main ()
     4389{
     4390
     4391  ;
     4392  return 0;
     4393}
     4394_ACEOF
     4395if ac_fn_cxx_try_compile "$LINENO"; then :
     4396  ac_cv_prog_cxx_g=yes
     4397else
     4398  CXXFLAGS=""
     4399      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     4400/* end confdefs.h.  */
     4401
     4402int
     4403main ()
     4404{
     4405
     4406  ;
     4407  return 0;
     4408}
     4409_ACEOF
     4410if ac_fn_cxx_try_compile "$LINENO"; then :
     4411
     4412else
     4413  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
     4414         CXXFLAGS="-g"
     4415         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     4416/* end confdefs.h.  */
     4417
     4418int
     4419main ()
     4420{
     4421
     4422  ;
     4423  return 0;
     4424}
     4425_ACEOF
     4426if ac_fn_cxx_try_compile "$LINENO"; then :
     4427  ac_cv_prog_cxx_g=yes
     4428fi
     4429rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     4430fi
     4431rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     4432fi
     4433rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     4434   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
     4435fi
     4436{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
     4437$as_echo "$ac_cv_prog_cxx_g" >&6; }
     4438if test "$ac_test_CXXFLAGS" = set; then
     4439  CXXFLAGS=$ac_save_CXXFLAGS
     4440elif test $ac_cv_prog_cxx_g = yes; then
     4441  if test "$GXX" = yes; then
     4442    CXXFLAGS="-g -O2"
     4443  else
     4444    CXXFLAGS="-g"
     4445  fi
     4446else
     4447  if test "$GXX" = yes; then
     4448    CXXFLAGS="-O2"
     4449  else
     4450    CXXFLAGS=
     4451  fi
     4452fi
     4453ac_ext=c
     4454ac_cpp='$CPP $CPPFLAGS'
     4455ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     4456ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     4457ac_compiler_gnu=$ac_cv_c_compiler_gnu
     4458
     4459depcc="$CXX"  am_compiler_list=
     4460
     4461{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
     4462$as_echo_n "checking dependency style of $depcc... " >&6; }
     4463if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
     4464  $as_echo_n "(cached) " >&6
     4465else
     4466  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
     4467  # We make a subdir and do the tests there.  Otherwise we can end up
     4468  # making bogus files that we don't know about and never remove.  For
     4469  # instance it was reported that on HP-UX the gcc test will end up
     4470  # making a dummy file named 'D' -- because '-MD' means "put the output
     4471  # in D".
     4472  rm -rf conftest.dir
     4473  mkdir conftest.dir
     4474  # Copy depcomp to subdir because otherwise we won't find it if we're
     4475  # using a relative directory.
     4476  cp "$am_depcomp" conftest.dir
     4477  cd conftest.dir
     4478  # We will build objects and dependencies in a subdirectory because
     4479  # it helps to detect inapplicable dependency modes.  For instance
     4480  # both Tru64's cc and ICC support -MD to output dependencies as a
     4481  # side effect of compilation, but ICC will put the dependencies in
     4482  # the current directory while Tru64 will put them in the object
     4483  # directory.
     4484  mkdir sub
     4485
     4486  am_cv_CXX_dependencies_compiler_type=none
     4487  if test "$am_compiler_list" = ""; then
     4488     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
     4489  fi
     4490  am__universal=false
     4491  case " $depcc " in #(
     4492     *\ -arch\ *\ -arch\ *) am__universal=true ;;
     4493     esac
     4494
     4495  for depmode in $am_compiler_list; do
     4496    # Setup a source with many dependencies, because some compilers
     4497    # like to wrap large dependency lists on column 80 (with \), and
     4498    # we should not choose a depcomp mode which is confused by this.
     4499    #
     4500    # We need to recreate these files for each test, as the compiler may
     4501    # overwrite some of them when testing with obscure command lines.
     4502    # This happens at least with the AIX C compiler.
     4503    : > sub/conftest.c
     4504    for i in 1 2 3 4 5 6; do
     4505      echo '#include "conftst'$i'.h"' >> sub/conftest.c
     4506      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
     4507      # Solaris 10 /bin/sh.
     4508      echo '/* dummy */' > sub/conftst$i.h
     4509    done
     4510    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
     4511
     4512    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     4513    # mode.  It turns out that the SunPro C++ compiler does not properly
     4514    # handle '-M -o', and we need to detect this.  Also, some Intel
     4515    # versions had trouble with output in subdirs.
     4516    am__obj=sub/conftest.${OBJEXT-o}
     4517    am__minus_obj="-o $am__obj"
     4518    case $depmode in
     4519    gcc)
     4520      # This depmode causes a compiler race in universal mode.
     4521      test "$am__universal" = false || continue
     4522      ;;
     4523    nosideeffect)
     4524      # After this tag, mechanisms are not by side-effect, so they'll
     4525      # only be used when explicitly requested.
     4526      if test "x$enable_dependency_tracking" = xyes; then
     4527        continue
     4528      else
     4529        break
     4530      fi
     4531      ;;
     4532    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
     4533      # This compiler won't grok '-c -o', but also, the minuso test has
     4534      # not run yet.  These depmodes are late enough in the game, and
     4535      # so weak that their functioning should not be impacted.
     4536      am__obj=conftest.${OBJEXT-o}
     4537      am__minus_obj=
     4538      ;;
     4539    none) break ;;
     4540    esac
     4541    if depmode=$depmode \
     4542       source=sub/conftest.c object=$am__obj \
     4543       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
     4544       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
     4545         >/dev/null 2>conftest.err &&
     4546       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
     4547       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
     4548       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
     4549       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
     4550      # icc doesn't choke on unknown options, it will just issue warnings
     4551      # or remarks (even with -Werror).  So we grep stderr for any message
     4552      # that says an option was ignored or not supported.
     4553      # When given -MP, icc 7.0 and 7.1 complain thusly:
     4554      #   icc: Command line warning: ignoring option '-M'; no argument required
     4555      # The diagnosis changed in icc 8.0:
     4556      #   icc: Command line remark: option '-MP' not supported
     4557      if (grep 'ignoring option' conftest.err ||
     4558          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
     4559        am_cv_CXX_dependencies_compiler_type=$depmode
     4560        break
     4561      fi
     4562    fi
     4563  done
     4564
     4565  cd ..
     4566  rm -rf conftest.dir
     4567else
     4568  am_cv_CXX_dependencies_compiler_type=none
     4569fi
     4570
     4571fi
     4572{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
     4573$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
     4574CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
     4575
     4576 if
     4577  test "x$enable_dependency_tracking" != xno \
     4578  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
     4579  am__fastdepCXX_TRUE=
     4580  am__fastdepCXX_FALSE='#'
     4581else
     4582  am__fastdepCXX_TRUE='#'
     4583  am__fastdepCXX_FALSE=
     4584fi
     4585
     4586
    38214587case `pwd` in
    38224588  *\ * | *\     *)
     
    38464612# Make sure we can run config.sub.
    38474613$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
    3848   as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
     4614  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
    38494615
    38504616{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
    38514617$as_echo_n "checking build system type... " >&6; }
    3852 if test "${ac_cv_build+set}" = set; then :
     4618if ${ac_cv_build+:} false; then :
    38534619  $as_echo_n "(cached) " >&6
    38544620else
     
    38574623  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
    38584624test "x$ac_build_alias" = x &&
    3859   as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
     4625  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
    38604626ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
    3861   as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
     4627  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
    38624628
    38634629fi
     
    38664632case $ac_cv_build in
    38674633*-*-*) ;;
    3868 *) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
     4634*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
    38694635esac
    38704636build=$ac_cv_build
     
    38844650{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
    38854651$as_echo_n "checking host system type... " >&6; }
    3886 if test "${ac_cv_host+set}" = set; then :
     4652if ${ac_cv_host+:} false; then :
    38874653  $as_echo_n "(cached) " >&6
    38884654else
     
    38914657else
    38924658  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
    3893     as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
     4659    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
    38944660fi
    38954661
     
    38994665case $ac_cv_host in
    39004666*-*-*) ;;
    3901 *) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
     4667*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
    39024668esac
    39034669host=$ac_cv_host
     
    39864752{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
    39874753$as_echo_n "checking for a sed that does not truncate output... " >&6; }
    3988 if test "${ac_cv_path_SED+set}" = set; then :
     4754if ${ac_cv_path_SED+:} false; then :
    39894755  $as_echo_n "(cached) " >&6
    39904756else
     
    40064772    for ac_exec_ext in '' $ac_executable_extensions; do
    40074773      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
    4008       { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
     4774      as_fn_executable_p "$ac_path_SED" || continue
    40094775# Check for GNU ac_path_SED and select it if it is found.
    40104776  # Check for GNU $ac_path_SED
     
    40414807IFS=$as_save_IFS
    40424808  if test -z "$ac_cv_path_SED"; then
    4043     as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
     4809    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
    40444810  fi
    40454811else
     
    40684834{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
    40694835$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
    4070 if test "${ac_cv_path_GREP+set}" = set; then :
     4836if ${ac_cv_path_GREP+:} false; then :
    40714837  $as_echo_n "(cached) " >&6
    40724838else
     
    40824848    for ac_exec_ext in '' $ac_executable_extensions; do
    40834849      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
    4084       { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
     4850      as_fn_executable_p "$ac_path_GREP" || continue
    40854851# Check for GNU ac_path_GREP and select it if it is found.
    40864852  # Check for GNU $ac_path_GREP
     
    41174883IFS=$as_save_IFS
    41184884  if test -z "$ac_cv_path_GREP"; then
    4119     as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
     4885    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
    41204886  fi
    41214887else
     
    41314897{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
    41324898$as_echo_n "checking for egrep... " >&6; }
    4133 if test "${ac_cv_path_EGREP+set}" = set; then :
     4899if ${ac_cv_path_EGREP+:} false; then :
    41344900  $as_echo_n "(cached) " >&6
    41354901else
     
    41484914    for ac_exec_ext in '' $ac_executable_extensions; do
    41494915      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
    4150       { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
     4916      as_fn_executable_p "$ac_path_EGREP" || continue
    41514917# Check for GNU ac_path_EGREP and select it if it is found.
    41524918  # Check for GNU $ac_path_EGREP
     
    41834949IFS=$as_save_IFS
    41844950  if test -z "$ac_cv_path_EGREP"; then
    4185     as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
     4951    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
    41864952  fi
    41874953else
     
    41984964{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
    41994965$as_echo_n "checking for fgrep... " >&6; }
    4200 if test "${ac_cv_path_FGREP+set}" = set; then :
     4966if ${ac_cv_path_FGREP+:} false; then :
    42014967  $as_echo_n "(cached) " >&6
    42024968else
     
    42154981    for ac_exec_ext in '' $ac_executable_extensions; do
    42164982      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
    4217       { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
     4983      as_fn_executable_p "$ac_path_FGREP" || continue
    42184984# Check for GNU ac_path_FGREP and select it if it is found.
    42194985  # Check for GNU $ac_path_FGREP
     
    42505016IFS=$as_save_IFS
    42515017  if test -z "$ac_cv_path_FGREP"; then
    4252     as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
     5018    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
    42535019  fi
    42545020else
     
    43295095$as_echo_n "checking for non-GNU ld... " >&6; }
    43305096fi
    4331 if test "${lt_cv_path_LD+set}" = set; then :
     5097if ${lt_cv_path_LD+:} false; then :
    43325098  $as_echo_n "(cached) " >&6
    43335099else
     
    43665132$as_echo "no" >&6; }
    43675133fi
    4368 test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
     5134test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
    43695135{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
    43705136$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
    4371 if test "${lt_cv_prog_gnu_ld+set}" = set; then :
     5137if ${lt_cv_prog_gnu_ld+:} false; then :
    43725138  $as_echo_n "(cached) " >&6
    43735139else
     
    43965162{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
    43975163$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
    4398 if test "${lt_cv_path_NM+set}" = set; then :
     5164if ${lt_cv_path_NM+:} false; then :
    43995165  $as_echo_n "(cached) " >&6
    44005166else
     
    44595225{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    44605226$as_echo_n "checking for $ac_word... " >&6; }
    4461 if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
     5227if ${ac_cv_prog_DUMPBIN+:} false; then :
    44625228  $as_echo_n "(cached) " >&6
    44635229else
     
    44715237  test -z "$as_dir" && as_dir=.
    44725238    for ac_exec_ext in '' $ac_executable_extensions; do
    4473   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     5239  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    44745240    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
    44755241    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    45035269{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    45045270$as_echo_n "checking for $ac_word... " >&6; }
    4505 if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
     5271if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
    45065272  $as_echo_n "(cached) " >&6
    45075273else
     
    45155281  test -z "$as_dir" && as_dir=.
    45165282    for ac_exec_ext in '' $ac_executable_extensions; do
    4517   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     5283  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    45185284    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
    45195285    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    45755341{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
    45765342$as_echo_n "checking the name lister ($NM) interface... " >&6; }
    4577 if test "${lt_cv_nm_interface+set}" = set; then :
     5343if ${lt_cv_nm_interface+:} false; then :
    45785344  $as_echo_n "(cached) " >&6
    45795345else
     
    46105376{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
    46115377$as_echo_n "checking the maximum length of command line arguments... " >&6; }
    4612 if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
     5378if ${lt_cv_sys_max_cmd_len+:} false; then :
    46135379  $as_echo_n "(cached) " >&6
    46145380else
     
    48125578{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
    48135579$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
    4814 if test "${lt_cv_to_host_file_cmd+set}" = set; then :
     5580if ${lt_cv_to_host_file_cmd+:} false; then :
    48155581  $as_echo_n "(cached) " >&6
    48165582else
     
    48595625{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
    48605626$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
    4861 if test "${lt_cv_to_tool_file_cmd+set}" = set; then :
     5627if ${lt_cv_to_tool_file_cmd+:} false; then :
    48625628  $as_echo_n "(cached) " >&6
    48635629else
     
    48865652{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
    48875653$as_echo_n "checking for $LD option to reload object files... " >&6; }
    4888 if test "${lt_cv_ld_reload_flag+set}" = set; then :
     5654if ${lt_cv_ld_reload_flag+:} false; then :
    48895655  $as_echo_n "(cached) " >&6
    48905656else
     
    49275693{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    49285694$as_echo_n "checking for $ac_word... " >&6; }
    4929 if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
     5695if ${ac_cv_prog_OBJDUMP+:} false; then :
    49305696  $as_echo_n "(cached) " >&6
    49315697else
     
    49395705  test -z "$as_dir" && as_dir=.
    49405706    for ac_exec_ext in '' $ac_executable_extensions; do
    4941   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     5707  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    49425708    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
    49435709    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    49675733{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    49685734$as_echo_n "checking for $ac_word... " >&6; }
    4969 if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
     5735if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
    49705736  $as_echo_n "(cached) " >&6
    49715737else
     
    49795745  test -z "$as_dir" && as_dir=.
    49805746    for ac_exec_ext in '' $ac_executable_extensions; do
    4981   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     5747  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    49825748    ac_cv_prog_ac_ct_OBJDUMP="objdump"
    49835749    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    50265792{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
    50275793$as_echo_n "checking how to recognize dependent libraries... " >&6; }
    5028 if test "${lt_cv_deplibs_check_method+set}" = set; then :
     5794if ${lt_cv_deplibs_check_method+:} false; then :
    50295795  $as_echo_n "(cached) " >&6
    50305796else
     
    52736039{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    52746040$as_echo_n "checking for $ac_word... " >&6; }
    5275 if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
     6041if ${ac_cv_prog_DLLTOOL+:} false; then :
    52766042  $as_echo_n "(cached) " >&6
    52776043else
     
    52856051  test -z "$as_dir" && as_dir=.
    52866052    for ac_exec_ext in '' $ac_executable_extensions; do
    5287   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6053  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    52886054    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
    52896055    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    53136079{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    53146080$as_echo_n "checking for $ac_word... " >&6; }
    5315 if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
     6081if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
    53166082  $as_echo_n "(cached) " >&6
    53176083else
     
    53256091  test -z "$as_dir" && as_dir=.
    53266092    for ac_exec_ext in '' $ac_executable_extensions; do
    5327   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6093  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    53286094    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
    53296095    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    53736139{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
    53746140$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
    5375 if test "${lt_cv_sharedlib_from_linklib_cmd+set}" = set; then :
     6141if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
    53766142  $as_echo_n "(cached) " >&6
    53776143else
     
    54176183{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    54186184$as_echo_n "checking for $ac_word... " >&6; }
    5419 if test "${ac_cv_prog_AR+set}" = set; then :
     6185if ${ac_cv_prog_AR+:} false; then :
    54206186  $as_echo_n "(cached) " >&6
    54216187else
     
    54296195  test -z "$as_dir" && as_dir=.
    54306196    for ac_exec_ext in '' $ac_executable_extensions; do
    5431   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6197  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    54326198    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
    54336199    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    54616227{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    54626228$as_echo_n "checking for $ac_word... " >&6; }
    5463 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
     6229if ${ac_cv_prog_ac_ct_AR+:} false; then :
    54646230  $as_echo_n "(cached) " >&6
    54656231else
     
    54736239  test -z "$as_dir" && as_dir=.
    54746240    for ac_exec_ext in '' $ac_executable_extensions; do
    5475   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6241  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    54766242    ac_cv_prog_ac_ct_AR="$ac_prog"
    54776243    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    55256291{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
    55266292$as_echo_n "checking for archiver @FILE support... " >&6; }
    5527 if test "${lt_cv_ar_at_file+set}" = set; then :
     6293if ${lt_cv_ar_at_file+:} false; then :
    55286294  $as_echo_n "(cached) " >&6
    55296295else
     
    55866352{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    55876353$as_echo_n "checking for $ac_word... " >&6; }
    5588 if test "${ac_cv_prog_STRIP+set}" = set; then :
     6354if ${ac_cv_prog_STRIP+:} false; then :
    55896355  $as_echo_n "(cached) " >&6
    55906356else
     
    55986364  test -z "$as_dir" && as_dir=.
    55996365    for ac_exec_ext in '' $ac_executable_extensions; do
    5600   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6366  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    56016367    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
    56026368    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    56266392{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    56276393$as_echo_n "checking for $ac_word... " >&6; }
    5628 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
     6394if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
    56296395  $as_echo_n "(cached) " >&6
    56306396else
     
    56386404  test -z "$as_dir" && as_dir=.
    56396405    for ac_exec_ext in '' $ac_executable_extensions; do
    5640   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6406  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    56416407    ac_cv_prog_ac_ct_STRIP="strip"
    56426408    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    56856451{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    56866452$as_echo_n "checking for $ac_word... " >&6; }
    5687 if test "${ac_cv_prog_RANLIB+set}" = set; then :
     6453if ${ac_cv_prog_RANLIB+:} false; then :
    56886454  $as_echo_n "(cached) " >&6
    56896455else
     
    56976463  test -z "$as_dir" && as_dir=.
    56986464    for ac_exec_ext in '' $ac_executable_extensions; do
    5699   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6465  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    57006466    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
    57016467    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    57256491{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    57266492$as_echo_n "checking for $ac_word... " >&6; }
    5727 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
     6493if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
    57286494  $as_echo_n "(cached) " >&6
    57296495else
     
    57376503  test -z "$as_dir" && as_dir=.
    57386504    for ac_exec_ext in '' $ac_executable_extensions; do
    5739   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     6505  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    57406506    ac_cv_prog_ac_ct_RANLIB="ranlib"
    57416507    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    58546620{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
    58556621$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
    5856 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
     6622if ${lt_cv_sys_global_symbol_pipe+:} false; then :
    58576623  $as_echo_n "(cached) " >&6
    58586624else
     
    61526918   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
    61536919$as_echo "${with_sysroot}" >&6; }
    6154    as_fn_error "The sysroot must be an absolute path." "$LINENO" 5
     6920   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
    61556921   ;;
    61566922esac
     
    62887054  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
    62897055$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
    6290 if test "${lt_cv_cc_needs_belf+set}" = set; then :
     7056if ${lt_cv_cc_needs_belf+:} false; then :
    62917057  $as_echo_n "(cached) " >&6
    62927058else
     
    63747140{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    63757141$as_echo_n "checking for $ac_word... " >&6; }
    6376 if test "${ac_cv_prog_MANIFEST_TOOL+set}" = set; then :
     7142if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
    63777143  $as_echo_n "(cached) " >&6
    63787144else
     
    63867152  test -z "$as_dir" && as_dir=.
    63877153    for ac_exec_ext in '' $ac_executable_extensions; do
    6388   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7154  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    63897155    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
    63907156    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    64147180{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    64157181$as_echo_n "checking for $ac_word... " >&6; }
    6416 if test "${ac_cv_prog_ac_ct_MANIFEST_TOOL+set}" = set; then :
     7182if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
    64177183  $as_echo_n "(cached) " >&6
    64187184else
     
    64267192  test -z "$as_dir" && as_dir=.
    64277193    for ac_exec_ext in '' $ac_executable_extensions; do
    6428   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7194  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    64297195    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
    64307196    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    64647230{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
    64657231$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
    6466 if test "${lt_cv_path_mainfest_tool+set}" = set; then :
     7232if ${lt_cv_path_mainfest_tool+:} false; then :
    64677233  $as_echo_n "(cached) " >&6
    64687234else
     
    64947260{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    64957261$as_echo_n "checking for $ac_word... " >&6; }
    6496 if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
     7262if ${ac_cv_prog_DSYMUTIL+:} false; then :
    64977263  $as_echo_n "(cached) " >&6
    64987264else
     
    65067272  test -z "$as_dir" && as_dir=.
    65077273    for ac_exec_ext in '' $ac_executable_extensions; do
    6508   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7274  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    65097275    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
    65107276    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    65347300{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    65357301$as_echo_n "checking for $ac_word... " >&6; }
    6536 if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
     7302if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
    65377303  $as_echo_n "(cached) " >&6
    65387304else
     
    65467312  test -z "$as_dir" && as_dir=.
    65477313    for ac_exec_ext in '' $ac_executable_extensions; do
    6548   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7314  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    65497315    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
    65507316    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    65867352{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    65877353$as_echo_n "checking for $ac_word... " >&6; }
    6588 if test "${ac_cv_prog_NMEDIT+set}" = set; then :
     7354if ${ac_cv_prog_NMEDIT+:} false; then :
    65897355  $as_echo_n "(cached) " >&6
    65907356else
     
    65987364  test -z "$as_dir" && as_dir=.
    65997365    for ac_exec_ext in '' $ac_executable_extensions; do
    6600   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7366  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    66017367    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
    66027368    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    66267392{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    66277393$as_echo_n "checking for $ac_word... " >&6; }
    6628 if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
     7394if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
    66297395  $as_echo_n "(cached) " >&6
    66307396else
     
    66387404  test -z "$as_dir" && as_dir=.
    66397405    for ac_exec_ext in '' $ac_executable_extensions; do
    6640   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7406  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    66417407    ac_cv_prog_ac_ct_NMEDIT="nmedit"
    66427408    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    66787444{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    66797445$as_echo_n "checking for $ac_word... " >&6; }
    6680 if test "${ac_cv_prog_LIPO+set}" = set; then :
     7446if ${ac_cv_prog_LIPO+:} false; then :
    66817447  $as_echo_n "(cached) " >&6
    66827448else
     
    66907456  test -z "$as_dir" && as_dir=.
    66917457    for ac_exec_ext in '' $ac_executable_extensions; do
    6692   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7458  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    66937459    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
    66947460    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    67187484{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    67197485$as_echo_n "checking for $ac_word... " >&6; }
    6720 if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
     7486if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
    67217487  $as_echo_n "(cached) " >&6
    67227488else
     
    67307496  test -z "$as_dir" && as_dir=.
    67317497    for ac_exec_ext in '' $ac_executable_extensions; do
    6732   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7498  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    67337499    ac_cv_prog_ac_ct_LIPO="lipo"
    67347500    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    67707536{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    67717537$as_echo_n "checking for $ac_word... " >&6; }
    6772 if test "${ac_cv_prog_OTOOL+set}" = set; then :
     7538if ${ac_cv_prog_OTOOL+:} false; then :
    67737539  $as_echo_n "(cached) " >&6
    67747540else
     
    67827548  test -z "$as_dir" && as_dir=.
    67837549    for ac_exec_ext in '' $ac_executable_extensions; do
    6784   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7550  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    67857551    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
    67867552    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    68107576{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    68117577$as_echo_n "checking for $ac_word... " >&6; }
    6812 if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
     7578if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
    68137579  $as_echo_n "(cached) " >&6
    68147580else
     
    68227588  test -z "$as_dir" && as_dir=.
    68237589    for ac_exec_ext in '' $ac_executable_extensions; do
    6824   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7590  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    68257591    ac_cv_prog_ac_ct_OTOOL="otool"
    68267592    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    68627628{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    68637629$as_echo_n "checking for $ac_word... " >&6; }
    6864 if test "${ac_cv_prog_OTOOL64+set}" = set; then :
     7630if ${ac_cv_prog_OTOOL64+:} false; then :
    68657631  $as_echo_n "(cached) " >&6
    68667632else
     
    68747640  test -z "$as_dir" && as_dir=.
    68757641    for ac_exec_ext in '' $ac_executable_extensions; do
    6876   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7642  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    68777643    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
    68787644    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    69027668{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    69037669$as_echo_n "checking for $ac_word... " >&6; }
    6904 if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
     7670if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
    69057671  $as_echo_n "(cached) " >&6
    69067672else
     
    69147680  test -z "$as_dir" && as_dir=.
    69157681    for ac_exec_ext in '' $ac_executable_extensions; do
    6916   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     7682  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    69177683    ac_cv_prog_ac_ct_OTOOL64="otool64"
    69187684    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    69777743    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
    69787744$as_echo_n "checking for -single_module linker flag... " >&6; }
    6979 if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
     7745if ${lt_cv_apple_cc_single_mod+:} false; then :
    69807746  $as_echo_n "(cached) " >&6
    69817747else
     
    70137779    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
    70147780$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
    7015 if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
     7781if ${lt_cv_ld_exported_symbols_list+:} false; then :
    70167782  $as_echo_n "(cached) " >&6
    70177783else
     
    70467812    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
    70477813$as_echo_n "checking for -force_load linker flag... " >&6; }
    7048 if test "${lt_cv_ld_force_load+set}" = set; then :
     7814if ${lt_cv_ld_force_load+:} false; then :
    70497815  $as_echo_n "(cached) " >&6
    70507816else
     
    71257891fi
    71267892if test -z "$CPP"; then
    7127   if test "${ac_cv_prog_CPP+set}" = set; then :
     7893  if ${ac_cv_prog_CPP+:} false; then :
    71287894  $as_echo_n "(cached) " >&6
    71297895else
     
    71557921continue
    71567922fi
    7157 rm -f conftest.err conftest.$ac_ext
     7923rm -f conftest.err conftest.i conftest.$ac_ext
    71587924
    71597925  # OK, works on sane cases.  Now check whether nonexistent headers
     
    71717937break
    71727938fi
    7173 rm -f conftest.err conftest.$ac_ext
     7939rm -f conftest.err conftest.i conftest.$ac_ext
    71747940
    71757941done
    71767942# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
    7177 rm -f conftest.err conftest.$ac_ext
     7943rm -f conftest.i conftest.err conftest.$ac_ext
    71787944if $ac_preproc_ok; then :
    71797945  break
     
    72147980continue
    72157981fi
    7216 rm -f conftest.err conftest.$ac_ext
     7982rm -f conftest.err conftest.i conftest.$ac_ext
    72177983
    72187984  # OK, works on sane cases.  Now check whether nonexistent headers
     
    72307996break
    72317997fi
    7232 rm -f conftest.err conftest.$ac_ext
     7998rm -f conftest.err conftest.i conftest.$ac_ext
    72337999
    72348000done
    72358001# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
    7236 rm -f conftest.err conftest.$ac_ext
     8002rm -f conftest.i conftest.err conftest.$ac_ext
    72378003if $ac_preproc_ok; then :
    72388004
     
    72408006  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    72418007$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    7242 as_fn_error "C preprocessor \"$CPP\" fails sanity check
    7243 See \`config.log' for more details." "$LINENO" 5; }
     8008as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
     8009See \`config.log' for more details" "$LINENO" 5; }
    72448010fi
    72458011
     
    72538019{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
    72548020$as_echo_n "checking for ANSI C header files... " >&6; }
    7255 if test "${ac_cv_header_stdc+set}" = set; then :
     8021if ${ac_cv_header_stdc+:} false; then :
    72568022  $as_echo_n "(cached) " >&6
    72578023else
     
    73708136ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
    73718137"
    7372 eval as_val=\$$as_ac_Header
    7373    if test "x$as_val" = x""yes; then :
     8138if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
    73748139  cat >>confdefs.h <<_ACEOF
    73758140#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
     
    73858150  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
    73868151"
    7387 if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
     8152if test "x$ac_cv_header_dlfcn_h" = xyes; then :
    73888153  cat >>confdefs.h <<_ACEOF
    73898154#define HAVE_DLFCN_H 1
     
    73938158
    73948159done
     8160
     8161
     8162
     8163
     8164func_stripname_cnf ()
     8165{
     8166  case ${2} in
     8167  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
     8168  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
     8169  esac
     8170} # func_stripname_cnf
    73958171
    73968172
     
    75918367{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
    75928368$as_echo_n "checking for objdir... " >&6; }
    7593 if test "${lt_cv_objdir+set}" = set; then :
     8369if ${lt_cv_objdir+:} false; then :
    75948370  $as_echo_n "(cached) " >&6
    75958371else
     
    76698445    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
    76708446$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
    7671 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
     8447if ${lt_cv_path_MAGIC_CMD+:} false; then :
    76728448  $as_echo_n "(cached) " >&6
    76738449else
     
    77358511    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
    77368512$as_echo_n "checking for file... " >&6; }
    7737 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
     8513if ${lt_cv_path_MAGIC_CMD+:} false; then :
    77388514  $as_echo_n "(cached) " >&6
    77398515else
     
    78778653  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
    78788654$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
    7879 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
     8655if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
    78808656  $as_echo_n "(cached) " >&6
    78818657else
     
    82399015{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
    82409016$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
    8241 if test "${lt_cv_prog_compiler_pic+set}" = set; then :
     9017if ${lt_cv_prog_compiler_pic+:} false; then :
    82429018  $as_echo_n "(cached) " >&6
    82439019else
     
    82549030  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
    82559031$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
    8256 if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
     9032if ${lt_cv_prog_compiler_pic_works+:} false; then :
    82579033  $as_echo_n "(cached) " >&6
    82589034else
     
    83189094{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
    83199095$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
    8320 if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
     9096if ${lt_cv_prog_compiler_static_works+:} false; then :
    83219097  $as_echo_n "(cached) " >&6
    83229098else
     
    83619137  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
    83629138$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
    8363 if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
     9139if ${lt_cv_prog_compiler_c_o+:} false; then :
    83649140  $as_echo_n "(cached) " >&6
    83659141else
     
    84169192  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
    84179193$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
    8418 if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
     9194if ${lt_cv_prog_compiler_c_o+:} false; then :
    84199195  $as_echo_n "(cached) " >&6
    84209196else
     
    89799755  aix_libpath=$lt_cv_aix_libpath
    89809756else
    8981   if test "${lt_cv_aix_libpath_+set}" = set; then :
     9757  if ${lt_cv_aix_libpath_+:} false; then :
    89829758  $as_echo_n "(cached) " >&6
    89839759else
     
    90329808  aix_libpath=$lt_cv_aix_libpath
    90339809else
    9034   if test "${lt_cv_aix_libpath_+set}" = set; then :
     9810  if ${lt_cv_aix_libpath_+:} false; then :
    90359811  $as_echo_n "(cached) " >&6
    90369812else
     
    930110077          { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
    930210078$as_echo_n "checking if $CC understands -b... " >&6; }
    9303 if test "${lt_cv_prog_compiler__b+set}" = set; then :
     10079if ${lt_cv_prog_compiler__b+:} false; then :
    930410080  $as_echo_n "(cached) " >&6
    930510081else
     
    937010146        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
    937110147$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
    9372 if test "${lt_cv_irix_exported_symbol+set}" = set; then :
     10148if ${lt_cv_irix_exported_symbol+:} false; then :
    937310149  $as_echo_n "(cached) " >&6
    937410150else
     
    968610462      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
    968710463$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
    9688 if test "${lt_cv_archive_cmds_need_lc+set}" = set; then :
     10464if ${lt_cv_archive_cmds_need_lc+:} false; then :
    968910465  $as_echo_n "(cached) " >&6
    969010466else
     
    1037911155
    1038011156  # Some binutils ld are patched to set DT_RUNPATH
    10381   if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then :
     11157  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
    1038211158  $as_echo_n "(cached) " >&6
    1038311159else
     
    1079911575    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
    1080011576$as_echo_n "checking for dlopen in -ldl... " >&6; }
    10801 if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
     11577if ${ac_cv_lib_dl_dlopen+:} false; then :
    1080211578  $as_echo_n "(cached) " >&6
    1080311579else
     
    1083311609{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
    1083411610$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
    10835 if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
     11611if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
    1083611612  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
    1083711613else
     
    1084711623  *)
    1084811624    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
    10849 if test "x$ac_cv_func_shl_load" = x""yes; then :
     11625if test "x$ac_cv_func_shl_load" = xyes; then :
    1085011626  lt_cv_dlopen="shl_load"
    1085111627else
    1085211628  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
    1085311629$as_echo_n "checking for shl_load in -ldld... " >&6; }
    10854 if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
     11630if ${ac_cv_lib_dld_shl_load+:} false; then :
    1085511631  $as_echo_n "(cached) " >&6
    1085611632else
     
    1088611662{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
    1088711663$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
    10888 if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
     11664if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
    1088911665  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
    1089011666else
    1089111667  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
    10892 if test "x$ac_cv_func_dlopen" = x""yes; then :
     11668if test "x$ac_cv_func_dlopen" = xyes; then :
    1089311669  lt_cv_dlopen="dlopen"
    1089411670else
    1089511671  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
    1089611672$as_echo_n "checking for dlopen in -ldl... " >&6; }
    10897 if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
     11673if ${ac_cv_lib_dl_dlopen+:} false; then :
    1089811674  $as_echo_n "(cached) " >&6
    1089911675else
     
    1092911705{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
    1093011706$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
    10931 if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
     11707if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
    1093211708  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
    1093311709else
    1093411710  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
    1093511711$as_echo_n "checking for dlopen in -lsvld... " >&6; }
    10936 if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
     11712if ${ac_cv_lib_svld_dlopen+:} false; then :
    1093711713  $as_echo_n "(cached) " >&6
    1093811714else
     
    1096811744{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
    1096911745$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
    10970 if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
     11746if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
    1097111747  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
    1097211748else
    1097311749  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
    1097411750$as_echo_n "checking for dld_link in -ldld... " >&6; }
    10975 if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
     11751if ${ac_cv_lib_dld_dld_link+:} false; then :
    1097611752  $as_echo_n "(cached) " >&6
    1097711753else
     
    1100711783{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
    1100811784$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
    11009 if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
     11785if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
    1101011786  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
    1101111787fi
     
    1104811824    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
    1104911825$as_echo_n "checking whether a program can dlopen itself... " >&6; }
    11050 if test "${lt_cv_dlopen_self+set}" = set; then :
     11826if ${lt_cv_dlopen_self+:} false; then :
    1105111827  $as_echo_n "(cached) " >&6
    1105211828else
     
    1115411930      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
    1115511931$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
    11156 if test "${lt_cv_dlopen_self_static+set}" = set; then :
     11932if ${lt_cv_dlopen_self_static+:} false; then :
    1115711933  $as_echo_n "(cached) " >&6
    1115811934else
     
    1138012156CC="$lt_save_CC"
    1138112157
     12158      if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
     12159    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
     12160    (test "X$CXX" != "Xg++"))) ; then
     12161  ac_ext=cpp
     12162ac_cpp='$CXXCPP $CPPFLAGS'
     12163ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     12164ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     12165ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
     12166{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
     12167$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
     12168if test -z "$CXXCPP"; then
     12169  if ${ac_cv_prog_CXXCPP+:} false; then :
     12170  $as_echo_n "(cached) " >&6
     12171else
     12172      # Double quotes because CXXCPP needs to be expanded
     12173    for CXXCPP in "$CXX -E" "/lib/cpp"
     12174    do
     12175      ac_preproc_ok=false
     12176for ac_cxx_preproc_warn_flag in '' yes
     12177do
     12178  # Use a header file that comes with gcc, so configuring glibc
     12179  # with a fresh cross-compiler works.
     12180  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     12181  # <limits.h> exists even on freestanding compilers.
     12182  # On the NeXT, cc -E runs the code through the compiler's parser,
     12183  # not just through cpp. "Syntax error" is here to catch this case.
     12184  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     12185/* end confdefs.h.  */
     12186#ifdef __STDC__
     12187# include <limits.h>
     12188#else
     12189# include <assert.h>
     12190#endif
     12191                     Syntax error
     12192_ACEOF
     12193if ac_fn_cxx_try_cpp "$LINENO"; then :
     12194
     12195else
     12196  # Broken: fails on valid input.
     12197continue
     12198fi
     12199rm -f conftest.err conftest.i conftest.$ac_ext
     12200
     12201  # OK, works on sane cases.  Now check whether nonexistent headers
     12202  # can be detected and how.
     12203  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     12204/* end confdefs.h.  */
     12205#include <ac_nonexistent.h>
     12206_ACEOF
     12207if ac_fn_cxx_try_cpp "$LINENO"; then :
     12208  # Broken: success on invalid input.
     12209continue
     12210else
     12211  # Passes both tests.
     12212ac_preproc_ok=:
     12213break
     12214fi
     12215rm -f conftest.err conftest.i conftest.$ac_ext
     12216
     12217done
     12218# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
     12219rm -f conftest.i conftest.err conftest.$ac_ext
     12220if $ac_preproc_ok; then :
     12221  break
     12222fi
     12223
     12224    done
     12225    ac_cv_prog_CXXCPP=$CXXCPP
     12226
     12227fi
     12228  CXXCPP=$ac_cv_prog_CXXCPP
     12229else
     12230  ac_cv_prog_CXXCPP=$CXXCPP
     12231fi
     12232{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
     12233$as_echo "$CXXCPP" >&6; }
     12234ac_preproc_ok=false
     12235for ac_cxx_preproc_warn_flag in '' yes
     12236do
     12237  # Use a header file that comes with gcc, so configuring glibc
     12238  # with a fresh cross-compiler works.
     12239  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     12240  # <limits.h> exists even on freestanding compilers.
     12241  # On the NeXT, cc -E runs the code through the compiler's parser,
     12242  # not just through cpp. "Syntax error" is here to catch this case.
     12243  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     12244/* end confdefs.h.  */
     12245#ifdef __STDC__
     12246# include <limits.h>
     12247#else
     12248# include <assert.h>
     12249#endif
     12250                     Syntax error
     12251_ACEOF
     12252if ac_fn_cxx_try_cpp "$LINENO"; then :
     12253
     12254else
     12255  # Broken: fails on valid input.
     12256continue
     12257fi
     12258rm -f conftest.err conftest.i conftest.$ac_ext
     12259
     12260  # OK, works on sane cases.  Now check whether nonexistent headers
     12261  # can be detected and how.
     12262  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     12263/* end confdefs.h.  */
     12264#include <ac_nonexistent.h>
     12265_ACEOF
     12266if ac_fn_cxx_try_cpp "$LINENO"; then :
     12267  # Broken: success on invalid input.
     12268continue
     12269else
     12270  # Passes both tests.
     12271ac_preproc_ok=:
     12272break
     12273fi
     12274rm -f conftest.err conftest.i conftest.$ac_ext
     12275
     12276done
     12277# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
     12278rm -f conftest.i conftest.err conftest.$ac_ext
     12279if $ac_preproc_ok; then :
     12280
     12281else
     12282  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
     12283$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
     12284as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
     12285See \`config.log' for more details" "$LINENO" 5; }
     12286fi
     12287
     12288ac_ext=c
     12289ac_cpp='$CPP $CPPFLAGS'
     12290ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     12291ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     12292ac_compiler_gnu=$ac_cv_c_compiler_gnu
     12293
     12294else
     12295  _lt_caught_CXX_error=yes
     12296fi
     12297
     12298ac_ext=cpp
     12299ac_cpp='$CXXCPP $CPPFLAGS'
     12300ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     12301ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     12302ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
     12303
     12304archive_cmds_need_lc_CXX=no
     12305allow_undefined_flag_CXX=
     12306always_export_symbols_CXX=no
     12307archive_expsym_cmds_CXX=
     12308compiler_needs_object_CXX=no
     12309export_dynamic_flag_spec_CXX=
     12310hardcode_direct_CXX=no
     12311hardcode_direct_absolute_CXX=no
     12312hardcode_libdir_flag_spec_CXX=
     12313hardcode_libdir_separator_CXX=
     12314hardcode_minus_L_CXX=no
     12315hardcode_shlibpath_var_CXX=unsupported
     12316hardcode_automatic_CXX=no
     12317inherit_rpath_CXX=no
     12318module_cmds_CXX=
     12319module_expsym_cmds_CXX=
     12320link_all_deplibs_CXX=unknown
     12321old_archive_cmds_CXX=$old_archive_cmds
     12322reload_flag_CXX=$reload_flag
     12323reload_cmds_CXX=$reload_cmds
     12324no_undefined_flag_CXX=
     12325whole_archive_flag_spec_CXX=
     12326enable_shared_with_static_runtimes_CXX=no
     12327
     12328# Source file extension for C++ test sources.
     12329ac_ext=cpp
     12330
     12331# Object file extension for compiled C++ test sources.
     12332objext=o
     12333objext_CXX=$objext
     12334
     12335# No sense in running all these tests if we already determined that
     12336# the CXX compiler isn't working.  Some variables (like enable_shared)
     12337# are currently assumed to apply to all compilers on this platform,
     12338# and will be corrupted by setting them based on a non-working compiler.
     12339if test "$_lt_caught_CXX_error" != yes; then
     12340  # Code to be used in simple compile tests
     12341  lt_simple_compile_test_code="int some_variable = 0;"
     12342
     12343  # Code to be used in simple link tests
     12344  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
     12345
     12346  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
     12347
     12348
     12349
     12350
     12351
     12352
     12353# If no C compiler was specified, use CC.
     12354LTCC=${LTCC-"$CC"}
     12355
     12356# If no C compiler flags were specified, use CFLAGS.
     12357LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
     12358
     12359# Allow CC to be a program name with arguments.
     12360compiler=$CC
     12361
     12362
     12363  # save warnings/boilerplate of simple test code
     12364  ac_outfile=conftest.$ac_objext
     12365echo "$lt_simple_compile_test_code" >conftest.$ac_ext
     12366eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
     12367_lt_compiler_boilerplate=`cat conftest.err`
     12368$RM conftest*
     12369
     12370  ac_outfile=conftest.$ac_objext
     12371echo "$lt_simple_link_test_code" >conftest.$ac_ext
     12372eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
     12373_lt_linker_boilerplate=`cat conftest.err`
     12374$RM -r conftest*
     12375
     12376
     12377  # Allow CC to be a program name with arguments.
     12378  lt_save_CC=$CC
     12379  lt_save_CFLAGS=$CFLAGS
     12380  lt_save_LD=$LD
     12381  lt_save_GCC=$GCC
     12382  GCC=$GXX
     12383  lt_save_with_gnu_ld=$with_gnu_ld
     12384  lt_save_path_LD=$lt_cv_path_LD
     12385  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
     12386    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
     12387  else
     12388    $as_unset lt_cv_prog_gnu_ld
     12389  fi
     12390  if test -n "${lt_cv_path_LDCXX+set}"; then
     12391    lt_cv_path_LD=$lt_cv_path_LDCXX
     12392  else
     12393    $as_unset lt_cv_path_LD
     12394  fi
     12395  test -z "${LDCXX+set}" || LD=$LDCXX
     12396  CC=${CXX-"c++"}
     12397  CFLAGS=$CXXFLAGS
     12398  compiler=$CC
     12399  compiler_CXX=$CC
     12400  for cc_temp in $compiler""; do
     12401  case $cc_temp in
     12402    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
     12403    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
     12404    \-*) ;;
     12405    *) break;;
     12406  esac
     12407done
     12408cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
     12409
     12410
     12411  if test -n "$compiler"; then
     12412    # We don't want -fno-exception when compiling C++ code, so set the
     12413    # no_builtin_flag separately
     12414    if test "$GXX" = yes; then
     12415      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
     12416    else
     12417      lt_prog_compiler_no_builtin_flag_CXX=
     12418    fi
     12419
     12420    if test "$GXX" = yes; then
     12421      # Set up default GNU C++ configuration
     12422
     12423
     12424
     12425# Check whether --with-gnu-ld was given.
     12426if test "${with_gnu_ld+set}" = set; then :
     12427  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
     12428else
     12429  with_gnu_ld=no
     12430fi
     12431
     12432ac_prog=ld
     12433if test "$GCC" = yes; then
     12434  # Check if gcc -print-prog-name=ld gives a path.
     12435  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
     12436$as_echo_n "checking for ld used by $CC... " >&6; }
     12437  case $host in
     12438  *-*-mingw*)
     12439    # gcc leaves a trailing carriage return which upsets mingw
     12440    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
     12441  *)
     12442    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
     12443  esac
     12444  case $ac_prog in
     12445    # Accept absolute paths.
     12446    [\\/]* | ?:[\\/]*)
     12447      re_direlt='/[^/][^/]*/\.\./'
     12448      # Canonicalize the pathname of ld
     12449      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
     12450      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
     12451        ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
     12452      done
     12453      test -z "$LD" && LD="$ac_prog"
     12454      ;;
     12455  "")
     12456    # If it fails, then pretend we aren't using GCC.
     12457    ac_prog=ld
     12458    ;;
     12459  *)
     12460    # If it is relative, then search for the first ld in PATH.
     12461    with_gnu_ld=unknown
     12462    ;;
     12463  esac
     12464elif test "$with_gnu_ld" = yes; then
     12465  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
     12466$as_echo_n "checking for GNU ld... " >&6; }
     12467else
     12468  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
     12469$as_echo_n "checking for non-GNU ld... " >&6; }
     12470fi
     12471if ${lt_cv_path_LD+:} false; then :
     12472  $as_echo_n "(cached) " >&6
     12473else
     12474  if test -z "$LD"; then
     12475  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
     12476  for ac_dir in $PATH; do
     12477    IFS="$lt_save_ifs"
     12478    test -z "$ac_dir" && ac_dir=.
     12479    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
     12480      lt_cv_path_LD="$ac_dir/$ac_prog"
     12481      # Check to see if the program is GNU ld.  I'd rather use --version,
     12482      # but apparently some variants of GNU ld only accept -v.
     12483      # Break only if it was the GNU/non-GNU ld that we prefer.
     12484      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
     12485      *GNU* | *'with BFD'*)
     12486        test "$with_gnu_ld" != no && break
     12487        ;;
     12488      *)
     12489        test "$with_gnu_ld" != yes && break
     12490        ;;
     12491      esac
     12492    fi
     12493  done
     12494  IFS="$lt_save_ifs"
     12495else
     12496  lt_cv_path_LD="$LD" # Let the user override the test with a path.
     12497fi
     12498fi
     12499
     12500LD="$lt_cv_path_LD"
     12501if test -n "$LD"; then
     12502  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
     12503$as_echo "$LD" >&6; }
     12504else
     12505  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     12506$as_echo "no" >&6; }
     12507fi
     12508test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
     12509{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
     12510$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
     12511if ${lt_cv_prog_gnu_ld+:} false; then :
     12512  $as_echo_n "(cached) " >&6
     12513else
     12514  # I'd rather use --version here, but apparently some GNU lds only accept -v.
     12515case `$LD -v 2>&1 </dev/null` in
     12516*GNU* | *'with BFD'*)
     12517  lt_cv_prog_gnu_ld=yes
     12518  ;;
     12519*)
     12520  lt_cv_prog_gnu_ld=no
     12521  ;;
     12522esac
     12523fi
     12524{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
     12525$as_echo "$lt_cv_prog_gnu_ld" >&6; }
     12526with_gnu_ld=$lt_cv_prog_gnu_ld
     12527
     12528
     12529
     12530
     12531
     12532
     12533
     12534      # Check if GNU C++ uses GNU ld as the underlying linker, since the
     12535      # archiving commands below assume that GNU ld is being used.
     12536      if test "$with_gnu_ld" = yes; then
     12537        archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
     12538        archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     12539
     12540        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
     12541        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
     12542
     12543        # If archive_cmds runs LD, not CC, wlarc should be empty
     12544        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
     12545        #     investigate it a little bit more. (MM)
     12546        wlarc='${wl}'
     12547
     12548        # ancient GNU ld didn't support --whole-archive et. al.
     12549        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
     12550          $GREP 'no-whole-archive' > /dev/null; then
     12551          whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
     12552        else
     12553          whole_archive_flag_spec_CXX=
     12554        fi
     12555      else
     12556        with_gnu_ld=no
     12557        wlarc=
     12558
     12559        # A generic and very simple default shared library creation
     12560        # command for GNU C++ for the case where it uses the native
     12561        # linker, instead of GNU ld.  If possible, this setting should
     12562        # overridden to take advantage of the native linker features on
     12563        # the platform it is being used on.
     12564        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
     12565      fi
     12566
     12567      # Commands to make compiler produce verbose output that lists
     12568      # what "hidden" libraries, object files and flags are used when
     12569      # linking a shared library.
     12570      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
     12571
     12572    else
     12573      GXX=no
     12574      with_gnu_ld=no
     12575      wlarc=
     12576    fi
     12577
     12578    # PORTME: fill in a description of your system's C++ link characteristics
     12579    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
     12580$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
     12581    ld_shlibs_CXX=yes
     12582    case $host_os in
     12583      aix3*)
     12584        # FIXME: insert proper C++ library support
     12585        ld_shlibs_CXX=no
     12586        ;;
     12587      aix[4-9]*)
     12588        if test "$host_cpu" = ia64; then
     12589          # On IA64, the linker does run time linking by default, so we don't
     12590          # have to do anything special.
     12591          aix_use_runtimelinking=no
     12592          exp_sym_flag='-Bexport'
     12593          no_entry_flag=""
     12594        else
     12595          aix_use_runtimelinking=no
     12596
     12597          # Test if we are trying to use run time linking or normal
     12598          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
     12599          # need to do runtime linking.
     12600          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
     12601            for ld_flag in $LDFLAGS; do
     12602              case $ld_flag in
     12603              *-brtl*)
     12604                aix_use_runtimelinking=yes
     12605                break
     12606                ;;
     12607              esac
     12608            done
     12609            ;;
     12610          esac
     12611
     12612          exp_sym_flag='-bexport'
     12613          no_entry_flag='-bnoentry'
     12614        fi
     12615
     12616        # When large executables or shared objects are built, AIX ld can
     12617        # have problems creating the table of contents.  If linking a library
     12618        # or program results in "error TOC overflow" add -mminimal-toc to
     12619        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
     12620        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
     12621
     12622        archive_cmds_CXX=''
     12623        hardcode_direct_CXX=yes
     12624        hardcode_direct_absolute_CXX=yes
     12625        hardcode_libdir_separator_CXX=':'
     12626        link_all_deplibs_CXX=yes
     12627        file_list_spec_CXX='${wl}-f,'
     12628
     12629        if test "$GXX" = yes; then
     12630          case $host_os in aix4.[012]|aix4.[012].*)
     12631          # We only want to do this on AIX 4.2 and lower, the check
     12632          # below for broken collect2 doesn't work under 4.3+
     12633          collect2name=`${CC} -print-prog-name=collect2`
     12634          if test -f "$collect2name" &&
     12635             strings "$collect2name" | $GREP resolve_lib_name >/dev/null
     12636          then
     12637            # We have reworked collect2
     12638            :
     12639          else
     12640            # We have old collect2
     12641            hardcode_direct_CXX=unsupported
     12642            # It fails to find uninstalled libraries when the uninstalled
     12643            # path is not listed in the libpath.  Setting hardcode_minus_L
     12644            # to unsupported forces relinking
     12645            hardcode_minus_L_CXX=yes
     12646            hardcode_libdir_flag_spec_CXX='-L$libdir'
     12647            hardcode_libdir_separator_CXX=
     12648          fi
     12649          esac
     12650          shared_flag='-shared'
     12651          if test "$aix_use_runtimelinking" = yes; then
     12652            shared_flag="$shared_flag "'${wl}-G'
     12653          fi
     12654        else
     12655          # not using gcc
     12656          if test "$host_cpu" = ia64; then
     12657          # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
     12658          # chokes on -Wl,-G. The following line is correct:
     12659          shared_flag='-G'
     12660          else
     12661            if test "$aix_use_runtimelinking" = yes; then
     12662              shared_flag='${wl}-G'
     12663            else
     12664              shared_flag='${wl}-bM:SRE'
     12665            fi
     12666          fi
     12667        fi
     12668
     12669        export_dynamic_flag_spec_CXX='${wl}-bexpall'
     12670        # It seems that -bexpall does not export symbols beginning with
     12671        # underscore (_), so it is better to generate a list of symbols to
     12672        # export.
     12673        always_export_symbols_CXX=yes
     12674        if test "$aix_use_runtimelinking" = yes; then
     12675          # Warning - without using the other runtime loading flags (-brtl),
     12676          # -berok will link without error, but may produce a broken library.
     12677          allow_undefined_flag_CXX='-berok'
     12678          # Determine the default libpath from the value encoded in an empty
     12679          # executable.
     12680          if test "${lt_cv_aix_libpath+set}" = set; then
     12681  aix_libpath=$lt_cv_aix_libpath
     12682else
     12683  if ${lt_cv_aix_libpath__CXX+:} false; then :
     12684  $as_echo_n "(cached) " >&6
     12685else
     12686  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     12687/* end confdefs.h.  */
     12688
     12689int
     12690main ()
     12691{
     12692
     12693  ;
     12694  return 0;
     12695}
     12696_ACEOF
     12697if ac_fn_cxx_try_link "$LINENO"; then :
     12698
     12699  lt_aix_libpath_sed='
     12700      /Import File Strings/,/^$/ {
     12701          /^0/ {
     12702              s/^0  *\([^ ]*\) *$/\1/
     12703              p
     12704          }
     12705      }'
     12706  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
     12707  # Check for a 64-bit object if we didn't find anything.
     12708  if test -z "$lt_cv_aix_libpath__CXX"; then
     12709    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
     12710  fi
     12711fi
     12712rm -f core conftest.err conftest.$ac_objext \
     12713    conftest$ac_exeext conftest.$ac_ext
     12714  if test -z "$lt_cv_aix_libpath__CXX"; then
     12715    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
     12716  fi
     12717
     12718fi
     12719
     12720  aix_libpath=$lt_cv_aix_libpath__CXX
     12721fi
     12722
     12723          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
     12724
     12725          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
     12726        else
     12727          if test "$host_cpu" = ia64; then
     12728            hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
     12729            allow_undefined_flag_CXX="-z nodefs"
     12730            archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
     12731          else
     12732            # Determine the default libpath from the value encoded in an
     12733            # empty executable.
     12734            if test "${lt_cv_aix_libpath+set}" = set; then
     12735  aix_libpath=$lt_cv_aix_libpath
     12736else
     12737  if ${lt_cv_aix_libpath__CXX+:} false; then :
     12738  $as_echo_n "(cached) " >&6
     12739else
     12740  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     12741/* end confdefs.h.  */
     12742
     12743int
     12744main ()
     12745{
     12746
     12747  ;
     12748  return 0;
     12749}
     12750_ACEOF
     12751if ac_fn_cxx_try_link "$LINENO"; then :
     12752
     12753  lt_aix_libpath_sed='
     12754      /Import File Strings/,/^$/ {
     12755          /^0/ {
     12756              s/^0  *\([^ ]*\) *$/\1/
     12757              p
     12758          }
     12759      }'
     12760  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
     12761  # Check for a 64-bit object if we didn't find anything.
     12762  if test -z "$lt_cv_aix_libpath__CXX"; then
     12763    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
     12764  fi
     12765fi
     12766rm -f core conftest.err conftest.$ac_objext \
     12767    conftest$ac_exeext conftest.$ac_ext
     12768  if test -z "$lt_cv_aix_libpath__CXX"; then
     12769    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
     12770  fi
     12771
     12772fi
     12773
     12774  aix_libpath=$lt_cv_aix_libpath__CXX
     12775fi
     12776
     12777            hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
     12778            # Warning - without using the other run time loading flags,
     12779            # -berok will link without error, but may produce a broken library.
     12780            no_undefined_flag_CXX=' ${wl}-bernotok'
     12781            allow_undefined_flag_CXX=' ${wl}-berok'
     12782            if test "$with_gnu_ld" = yes; then
     12783              # We only use this code for GNU lds that support --whole-archive.
     12784              whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
     12785            else
     12786              # Exported symbols can be pulled into shared objects from archives
     12787              whole_archive_flag_spec_CXX='$convenience'
     12788            fi
     12789            archive_cmds_need_lc_CXX=yes
     12790            # This is similar to how AIX traditionally builds its shared
     12791            # libraries.
     12792            archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
     12793          fi
     12794        fi
     12795        ;;
     12796
     12797      beos*)
     12798        if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
     12799          allow_undefined_flag_CXX=unsupported
     12800          # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
     12801          # support --undefined.  This deserves some investigation.  FIXME
     12802          archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     12803        else
     12804          ld_shlibs_CXX=no
     12805        fi
     12806        ;;
     12807
     12808      chorus*)
     12809        case $cc_basename in
     12810          *)
     12811          # FIXME: insert proper C++ library support
     12812          ld_shlibs_CXX=no
     12813          ;;
     12814        esac
     12815        ;;
     12816
     12817      cygwin* | mingw* | pw32* | cegcc*)
     12818        case $GXX,$cc_basename in
     12819        ,cl* | no,cl*)
     12820          # Native MSVC
     12821          # hardcode_libdir_flag_spec is actually meaningless, as there is
     12822          # no search path for DLLs.
     12823          hardcode_libdir_flag_spec_CXX=' '
     12824          allow_undefined_flag_CXX=unsupported
     12825          always_export_symbols_CXX=yes
     12826          file_list_spec_CXX='@'
     12827          # Tell ltmain to make .lib files, not .a files.
     12828          libext=lib
     12829          # Tell ltmain to make .dll files, not .so files.
     12830          shrext_cmds=".dll"
     12831          # FIXME: Setting linknames here is a bad hack.
     12832          archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
     12833          archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
     12834              $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
     12835            else
     12836              $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
     12837            fi~
     12838            $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
     12839            linknames='
     12840          # The linker will not automatically build a static lib if we build a DLL.
     12841          # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
     12842          enable_shared_with_static_runtimes_CXX=yes
     12843          # Don't use ranlib
     12844          old_postinstall_cmds_CXX='chmod 644 $oldlib'
     12845          postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
     12846            lt_tool_outputfile="@TOOL_OUTPUT@"~
     12847            case $lt_outputfile in
     12848              *.exe|*.EXE) ;;
     12849              *)
     12850                lt_outputfile="$lt_outputfile.exe"
     12851                lt_tool_outputfile="$lt_tool_outputfile.exe"
     12852                ;;
     12853            esac~
     12854            func_to_tool_file "$lt_outputfile"~
     12855            if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
     12856              $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
     12857              $RM "$lt_outputfile.manifest";
     12858            fi'
     12859          ;;
     12860        *)
     12861          # g++
     12862          # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
     12863          # as there is no search path for DLLs.
     12864          hardcode_libdir_flag_spec_CXX='-L$libdir'
     12865          export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
     12866          allow_undefined_flag_CXX=unsupported
     12867          always_export_symbols_CXX=no
     12868          enable_shared_with_static_runtimes_CXX=yes
     12869
     12870          if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
     12871            archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
     12872            # If the export-symbols file already is a .def file (1st line
     12873            # is EXPORTS), use it as is; otherwise, prepend...
     12874            archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
     12875              cp $export_symbols $output_objdir/$soname.def;
     12876            else
     12877              echo EXPORTS > $output_objdir/$soname.def;
     12878              cat $export_symbols >> $output_objdir/$soname.def;
     12879            fi~
     12880            $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
     12881          else
     12882            ld_shlibs_CXX=no
     12883          fi
     12884          ;;
     12885        esac
     12886        ;;
     12887      darwin* | rhapsody*)
     12888
     12889
     12890  archive_cmds_need_lc_CXX=no
     12891  hardcode_direct_CXX=no
     12892  hardcode_automatic_CXX=yes
     12893  hardcode_shlibpath_var_CXX=unsupported
     12894  if test "$lt_cv_ld_force_load" = "yes"; then
     12895    whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
     12896
     12897  else
     12898    whole_archive_flag_spec_CXX=''
     12899  fi
     12900  link_all_deplibs_CXX=yes
     12901  allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
     12902  case $cc_basename in
     12903     ifort*) _lt_dar_can_shared=yes ;;
     12904     *) _lt_dar_can_shared=$GCC ;;
     12905  esac
     12906  if test "$_lt_dar_can_shared" = "yes"; then
     12907    output_verbose_link_cmd=func_echo_all
     12908    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     12909    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     12910    archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
     12911    module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
     12912       if test "$lt_cv_apple_cc_single_mod" != "yes"; then
     12913      archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
     12914      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
     12915    fi
     12916
     12917  else
     12918  ld_shlibs_CXX=no
     12919  fi
     12920
     12921        ;;
     12922
     12923      dgux*)
     12924        case $cc_basename in
     12925          ec++*)
     12926            # FIXME: insert proper C++ library support
     12927            ld_shlibs_CXX=no
     12928            ;;
     12929          ghcx*)
     12930            # Green Hills C++ Compiler
     12931            # FIXME: insert proper C++ library support
     12932            ld_shlibs_CXX=no
     12933            ;;
     12934          *)
     12935            # FIXME: insert proper C++ library support
     12936            ld_shlibs_CXX=no
     12937            ;;
     12938        esac
     12939        ;;
     12940
     12941      freebsd2.*)
     12942        # C++ shared libraries reported to be fairly broken before
     12943        # switch to ELF
     12944        ld_shlibs_CXX=no
     12945        ;;
     12946
     12947      freebsd-elf*)
     12948        archive_cmds_need_lc_CXX=no
     12949        ;;
     12950
     12951      freebsd* | dragonfly*)
     12952        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     12953        # conventions
     12954        ld_shlibs_CXX=yes
     12955        ;;
     12956
     12957      gnu*)
     12958        ;;
     12959
     12960      haiku*)
     12961        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     12962        link_all_deplibs_CXX=yes
     12963        ;;
     12964
     12965      hpux9*)
     12966        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
     12967        hardcode_libdir_separator_CXX=:
     12968        export_dynamic_flag_spec_CXX='${wl}-E'
     12969        hardcode_direct_CXX=yes
     12970        hardcode_minus_L_CXX=yes # Not in the search PATH,
     12971                                             # but as the default
     12972                                             # location of the library.
     12973
     12974        case $cc_basename in
     12975          CC*)
     12976            # FIXME: insert proper C++ library support
     12977            ld_shlibs_CXX=no
     12978            ;;
     12979          aCC*)
     12980            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
     12981            # Commands to make compiler produce verbose output that lists
     12982            # what "hidden" libraries, object files and flags are used when
     12983            # linking a shared library.
     12984            #
     12985            # There doesn't appear to be a way to prevent this compiler from
     12986            # explicitly linking system object files so we need to strip them
     12987            # from the output so that they don't get included in the library
     12988            # dependencies.
     12989            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
     12990            ;;
     12991          *)
     12992            if test "$GXX" = yes; then
     12993              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
     12994            else
     12995              # FIXME: insert proper C++ library support
     12996              ld_shlibs_CXX=no
     12997            fi
     12998            ;;
     12999        esac
     13000        ;;
     13001
     13002      hpux10*|hpux11*)
     13003        if test $with_gnu_ld = no; then
     13004          hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
     13005          hardcode_libdir_separator_CXX=:
     13006
     13007          case $host_cpu in
     13008            hppa*64*|ia64*)
     13009              ;;
     13010            *)
     13011              export_dynamic_flag_spec_CXX='${wl}-E'
     13012              ;;
     13013          esac
     13014        fi
     13015        case $host_cpu in
     13016          hppa*64*|ia64*)
     13017            hardcode_direct_CXX=no
     13018            hardcode_shlibpath_var_CXX=no
     13019            ;;
     13020          *)
     13021            hardcode_direct_CXX=yes
     13022            hardcode_direct_absolute_CXX=yes
     13023            hardcode_minus_L_CXX=yes # Not in the search PATH,
     13024                                                 # but as the default
     13025                                                 # location of the library.
     13026            ;;
     13027        esac
     13028
     13029        case $cc_basename in
     13030          CC*)
     13031            # FIXME: insert proper C++ library support
     13032            ld_shlibs_CXX=no
     13033            ;;
     13034          aCC*)
     13035            case $host_cpu in
     13036              hppa*64*)
     13037                archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13038                ;;
     13039              ia64*)
     13040                archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13041                ;;
     13042              *)
     13043                archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13044                ;;
     13045            esac
     13046            # Commands to make compiler produce verbose output that lists
     13047            # what "hidden" libraries, object files and flags are used when
     13048            # linking a shared library.
     13049            #
     13050            # There doesn't appear to be a way to prevent this compiler from
     13051            # explicitly linking system object files so we need to strip them
     13052            # from the output so that they don't get included in the library
     13053            # dependencies.
     13054            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
     13055            ;;
     13056          *)
     13057            if test "$GXX" = yes; then
     13058              if test $with_gnu_ld = no; then
     13059                case $host_cpu in
     13060                  hppa*64*)
     13061                    archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13062                    ;;
     13063                  ia64*)
     13064                    archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13065                    ;;
     13066                  *)
     13067                    archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13068                    ;;
     13069                esac
     13070              fi
     13071            else
     13072              # FIXME: insert proper C++ library support
     13073              ld_shlibs_CXX=no
     13074            fi
     13075            ;;
     13076        esac
     13077        ;;
     13078
     13079      interix[3-9]*)
     13080        hardcode_direct_CXX=no
     13081        hardcode_shlibpath_var_CXX=no
     13082        hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
     13083        export_dynamic_flag_spec_CXX='${wl}-E'
     13084        # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
     13085        # Instead, shared libraries are loaded at an image base (0x10000000 by
     13086        # default) and relocated if they conflict, which is a slow very memory
     13087        # consuming and fragmenting process.  To avoid this, we pick a random,
     13088        # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
     13089        # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
     13090        archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
     13091        archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
     13092        ;;
     13093      irix5* | irix6*)
     13094        case $cc_basename in
     13095          CC*)
     13096            # SGI C++
     13097            archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
     13098
     13099            # Archives containing C++ object files must be created using
     13100            # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
     13101            # necessary to make sure instantiated templates are included
     13102            # in the archive.
     13103            old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
     13104            ;;
     13105          *)
     13106            if test "$GXX" = yes; then
     13107              if test "$with_gnu_ld" = no; then
     13108                archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     13109              else
     13110                archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
     13111              fi
     13112            fi
     13113            link_all_deplibs_CXX=yes
     13114            ;;
     13115        esac
     13116        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
     13117        hardcode_libdir_separator_CXX=:
     13118        inherit_rpath_CXX=yes
     13119        ;;
     13120
     13121      linux* | k*bsd*-gnu | kopensolaris*-gnu)
     13122        case $cc_basename in
     13123          KCC*)
     13124            # Kuck and Associates, Inc. (KAI) C++ Compiler
     13125
     13126            # KCC will only create a shared library if the output file
     13127            # ends with ".so" (or ".sl" for HP-UX), so rename the library
     13128            # to its proper name (with version) after linking.
     13129            archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
     13130            archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
     13131            # Commands to make compiler produce verbose output that lists
     13132            # what "hidden" libraries, object files and flags are used when
     13133            # linking a shared library.
     13134            #
     13135            # There doesn't appear to be a way to prevent this compiler from
     13136            # explicitly linking system object files so we need to strip them
     13137            # from the output so that they don't get included in the library
     13138            # dependencies.
     13139            output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
     13140
     13141            hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
     13142            export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
     13143
     13144            # Archives containing C++ object files must be created using
     13145            # "CC -Bstatic", where "CC" is the KAI C++ compiler.
     13146            old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
     13147            ;;
     13148          icpc* | ecpc* )
     13149            # Intel C++
     13150            with_gnu_ld=yes
     13151            # version 8.0 and above of icpc choke on multiply defined symbols
     13152            # if we add $predep_objects and $postdep_objects, however 7.1 and
     13153            # earlier do not add the objects themselves.
     13154            case `$CC -V 2>&1` in
     13155              *"Version 7."*)
     13156                archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
     13157                archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     13158                ;;
     13159              *)  # Version 8.0 or newer
     13160                tmp_idyn=
     13161                case $host_cpu in
     13162                  ia64*) tmp_idyn=' -i_dynamic';;
     13163                esac
     13164                archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     13165                archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     13166                ;;
     13167            esac
     13168            archive_cmds_need_lc_CXX=no
     13169            hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
     13170            export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
     13171            whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
     13172            ;;
     13173          pgCC* | pgcpp*)
     13174            # Portland Group C++ compiler
     13175            case `$CC -V` in
     13176            *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
     13177              prelink_cmds_CXX='tpldir=Template.dir~
     13178                rm -rf $tpldir~
     13179                $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
     13180                compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
     13181              old_archive_cmds_CXX='tpldir=Template.dir~
     13182                rm -rf $tpldir~
     13183                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
     13184                $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
     13185                $RANLIB $oldlib'
     13186              archive_cmds_CXX='tpldir=Template.dir~
     13187                rm -rf $tpldir~
     13188                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
     13189                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
     13190              archive_expsym_cmds_CXX='tpldir=Template.dir~
     13191                rm -rf $tpldir~
     13192                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
     13193                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
     13194              ;;
     13195            *) # Version 6 and above use weak symbols
     13196              archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
     13197              archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
     13198              ;;
     13199            esac
     13200
     13201            hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
     13202            export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
     13203            whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
     13204            ;;
     13205          cxx*)
     13206            # Compaq C++
     13207            archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
     13208            archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
     13209
     13210            runpath_var=LD_RUN_PATH
     13211            hardcode_libdir_flag_spec_CXX='-rpath $libdir'
     13212            hardcode_libdir_separator_CXX=:
     13213
     13214            # Commands to make compiler produce verbose output that lists
     13215            # what "hidden" libraries, object files and flags are used when
     13216            # linking a shared library.
     13217            #
     13218            # There doesn't appear to be a way to prevent this compiler from
     13219            # explicitly linking system object files so we need to strip them
     13220            # from the output so that they don't get included in the library
     13221            # dependencies.
     13222            output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
     13223            ;;
     13224          xl* | mpixl* | bgxl*)
     13225            # IBM XL 8.0 on PPC, with GNU ld
     13226            hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
     13227            export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
     13228            archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     13229            if test "x$supports_anon_versioning" = xyes; then
     13230              archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
     13231                cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
     13232                echo "local: *; };" >> $output_objdir/$libname.ver~
     13233                $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
     13234            fi
     13235            ;;
     13236          *)
     13237            case `$CC -V 2>&1 | sed 5q` in
     13238            *Sun\ C*)
     13239              # Sun C++ 5.9
     13240              no_undefined_flag_CXX=' -zdefs'
     13241              archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13242              archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
     13243              hardcode_libdir_flag_spec_CXX='-R$libdir'
     13244              whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
     13245              compiler_needs_object_CXX=yes
     13246
     13247              # Not sure whether something based on
     13248              # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
     13249              # would be better.
     13250              output_verbose_link_cmd='func_echo_all'
     13251
     13252              # Archives containing C++ object files must be created using
     13253              # "CC -xar", where "CC" is the Sun C++ compiler.  This is
     13254              # necessary to make sure instantiated templates are included
     13255              # in the archive.
     13256              old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
     13257              ;;
     13258            esac
     13259            ;;
     13260        esac
     13261        ;;
     13262
     13263      lynxos*)
     13264        # FIXME: insert proper C++ library support
     13265        ld_shlibs_CXX=no
     13266        ;;
     13267
     13268      m88k*)
     13269        # FIXME: insert proper C++ library support
     13270        ld_shlibs_CXX=no
     13271        ;;
     13272
     13273      mvs*)
     13274        case $cc_basename in
     13275          cxx*)
     13276            # FIXME: insert proper C++ library support
     13277            ld_shlibs_CXX=no
     13278            ;;
     13279          *)
     13280            # FIXME: insert proper C++ library support
     13281            ld_shlibs_CXX=no
     13282            ;;
     13283        esac
     13284        ;;
     13285
     13286      netbsd*)
     13287        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
     13288          archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
     13289          wlarc=
     13290          hardcode_libdir_flag_spec_CXX='-R$libdir'
     13291          hardcode_direct_CXX=yes
     13292          hardcode_shlibpath_var_CXX=no
     13293        fi
     13294        # Workaround some broken pre-1.5 toolchains
     13295        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
     13296        ;;
     13297
     13298      *nto* | *qnx*)
     13299        ld_shlibs_CXX=yes
     13300        ;;
     13301
     13302      openbsd2*)
     13303        # C++ shared libraries are fairly broken
     13304        ld_shlibs_CXX=no
     13305        ;;
     13306
     13307      openbsd*)
     13308        if test -f /usr/libexec/ld.so; then
     13309          hardcode_direct_CXX=yes
     13310          hardcode_shlibpath_var_CXX=no
     13311          hardcode_direct_absolute_CXX=yes
     13312          archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
     13313          hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
     13314          if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
     13315            archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
     13316            export_dynamic_flag_spec_CXX='${wl}-E'
     13317            whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
     13318          fi
     13319          output_verbose_link_cmd=func_echo_all
     13320        else
     13321          ld_shlibs_CXX=no
     13322        fi
     13323        ;;
     13324
     13325      osf3* | osf4* | osf5*)
     13326        case $cc_basename in
     13327          KCC*)
     13328            # Kuck and Associates, Inc. (KAI) C++ Compiler
     13329
     13330            # KCC will only create a shared library if the output file
     13331            # ends with ".so" (or ".sl" for HP-UX), so rename the library
     13332            # to its proper name (with version) after linking.
     13333            archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
     13334
     13335            hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
     13336            hardcode_libdir_separator_CXX=:
     13337
     13338            # Archives containing C++ object files must be created using
     13339            # the KAI C++ compiler.
     13340            case $host in
     13341              osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
     13342              *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
     13343            esac
     13344            ;;
     13345          RCC*)
     13346            # Rational C++ 2.4.1
     13347            # FIXME: insert proper C++ library support
     13348            ld_shlibs_CXX=no
     13349            ;;
     13350          cxx*)
     13351            case $host in
     13352              osf3*)
     13353                allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
     13354                archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
     13355                hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
     13356                ;;
     13357              *)
     13358                allow_undefined_flag_CXX=' -expect_unresolved \*'
     13359                archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
     13360                archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
     13361                  echo "-hidden">> $lib.exp~
     13362                  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
     13363                  $RM $lib.exp'
     13364                hardcode_libdir_flag_spec_CXX='-rpath $libdir'
     13365                ;;
     13366            esac
     13367
     13368            hardcode_libdir_separator_CXX=:
     13369
     13370            # Commands to make compiler produce verbose output that lists
     13371            # what "hidden" libraries, object files and flags are used when
     13372            # linking a shared library.
     13373            #
     13374            # There doesn't appear to be a way to prevent this compiler from
     13375            # explicitly linking system object files so we need to strip them
     13376            # from the output so that they don't get included in the library
     13377            # dependencies.
     13378            output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
     13379            ;;
     13380          *)
     13381            if test "$GXX" = yes && test "$with_gnu_ld" = no; then
     13382              allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
     13383              case $host in
     13384                osf3*)
     13385                  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     13386                  ;;
     13387                *)
     13388                  archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     13389                  ;;
     13390              esac
     13391
     13392              hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
     13393              hardcode_libdir_separator_CXX=:
     13394
     13395              # Commands to make compiler produce verbose output that lists
     13396              # what "hidden" libraries, object files and flags are used when
     13397              # linking a shared library.
     13398              output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
     13399
     13400            else
     13401              # FIXME: insert proper C++ library support
     13402              ld_shlibs_CXX=no
     13403            fi
     13404            ;;
     13405        esac
     13406        ;;
     13407
     13408      psos*)
     13409        # FIXME: insert proper C++ library support
     13410        ld_shlibs_CXX=no
     13411        ;;
     13412
     13413      sunos4*)
     13414        case $cc_basename in
     13415          CC*)
     13416            # Sun C++ 4.x
     13417            # FIXME: insert proper C++ library support
     13418            ld_shlibs_CXX=no
     13419            ;;
     13420          lcc*)
     13421            # Lucid
     13422            # FIXME: insert proper C++ library support
     13423            ld_shlibs_CXX=no
     13424            ;;
     13425          *)
     13426            # FIXME: insert proper C++ library support
     13427            ld_shlibs_CXX=no
     13428            ;;
     13429        esac
     13430        ;;
     13431
     13432      solaris*)
     13433        case $cc_basename in
     13434          CC* | sunCC*)
     13435            # Sun C++ 4.2, 5.x and Centerline C++
     13436            archive_cmds_need_lc_CXX=yes
     13437            no_undefined_flag_CXX=' -zdefs'
     13438            archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     13439            archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
     13440              $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
     13441
     13442            hardcode_libdir_flag_spec_CXX='-R$libdir'
     13443            hardcode_shlibpath_var_CXX=no
     13444            case $host_os in
     13445              solaris2.[0-5] | solaris2.[0-5].*) ;;
     13446              *)
     13447                # The compiler driver will combine and reorder linker options,
     13448                # but understands `-z linker_flag'.
     13449                # Supported since Solaris 2.6 (maybe 2.5.1?)
     13450                whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
     13451                ;;
     13452            esac
     13453            link_all_deplibs_CXX=yes
     13454
     13455            output_verbose_link_cmd='func_echo_all'
     13456
     13457            # Archives containing C++ object files must be created using
     13458            # "CC -xar", where "CC" is the Sun C++ compiler.  This is
     13459            # necessary to make sure instantiated templates are included
     13460            # in the archive.
     13461            old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
     13462            ;;
     13463          gcx*)
     13464            # Green Hills C++ Compiler
     13465            archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
     13466
     13467            # The C++ compiler must be used to create the archive.
     13468            old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
     13469            ;;
     13470          *)
     13471            # GNU C++ compiler with Solaris linker
     13472            if test "$GXX" = yes && test "$with_gnu_ld" = no; then
     13473              no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
     13474              if $CC --version | $GREP -v '^2\.7' > /dev/null; then
     13475                archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
     13476                archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
     13477                  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
     13478
     13479                # Commands to make compiler produce verbose output that lists
     13480                # what "hidden" libraries, object files and flags are used when
     13481                # linking a shared library.
     13482                output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
     13483              else
     13484                # g++ 2.7 appears to require `-G' NOT `-shared' on this
     13485                # platform.
     13486                archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
     13487                archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
     13488                  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
     13489
     13490                # Commands to make compiler produce verbose output that lists
     13491                # what "hidden" libraries, object files and flags are used when
     13492                # linking a shared library.
     13493                output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
     13494              fi
     13495
     13496              hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
     13497              case $host_os in
     13498                solaris2.[0-5] | solaris2.[0-5].*) ;;
     13499                *)
     13500                  whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
     13501                  ;;
     13502              esac
     13503            fi
     13504            ;;
     13505        esac
     13506        ;;
     13507
     13508    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
     13509      no_undefined_flag_CXX='${wl}-z,text'
     13510      archive_cmds_need_lc_CXX=no
     13511      hardcode_shlibpath_var_CXX=no
     13512      runpath_var='LD_RUN_PATH'
     13513
     13514      case $cc_basename in
     13515        CC*)
     13516          archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13517          archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13518          ;;
     13519        *)
     13520          archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13521          archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13522          ;;
     13523      esac
     13524      ;;
     13525
     13526      sysv5* | sco3.2v5* | sco5v6*)
     13527        # Note: We can NOT use -z defs as we might desire, because we do not
     13528        # link with -lc, and that would cause any symbols used from libc to
     13529        # always be unresolved, which means just about no library would
     13530        # ever link correctly.  If we're not using GNU ld we use -z text
     13531        # though, which does catch some bad symbols but isn't as heavy-handed
     13532        # as -z defs.
     13533        no_undefined_flag_CXX='${wl}-z,text'
     13534        allow_undefined_flag_CXX='${wl}-z,nodefs'
     13535        archive_cmds_need_lc_CXX=no
     13536        hardcode_shlibpath_var_CXX=no
     13537        hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
     13538        hardcode_libdir_separator_CXX=':'
     13539        link_all_deplibs_CXX=yes
     13540        export_dynamic_flag_spec_CXX='${wl}-Bexport'
     13541        runpath_var='LD_RUN_PATH'
     13542
     13543        case $cc_basename in
     13544          CC*)
     13545            archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13546            archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13547            old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
     13548              '"$old_archive_cmds_CXX"
     13549            reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
     13550              '"$reload_cmds_CXX"
     13551            ;;
     13552          *)
     13553            archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13554            archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     13555            ;;
     13556        esac
     13557      ;;
     13558
     13559      tandem*)
     13560        case $cc_basename in
     13561          NCC*)
     13562            # NonStop-UX NCC 3.20
     13563            # FIXME: insert proper C++ library support
     13564            ld_shlibs_CXX=no
     13565            ;;
     13566          *)
     13567            # FIXME: insert proper C++ library support
     13568            ld_shlibs_CXX=no
     13569            ;;
     13570        esac
     13571        ;;
     13572
     13573      vxworks*)
     13574        # FIXME: insert proper C++ library support
     13575        ld_shlibs_CXX=no
     13576        ;;
     13577
     13578      *)
     13579        # FIXME: insert proper C++ library support
     13580        ld_shlibs_CXX=no
     13581        ;;
     13582    esac
     13583
     13584    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
     13585$as_echo "$ld_shlibs_CXX" >&6; }
     13586    test "$ld_shlibs_CXX" = no && can_build_shared=no
     13587
     13588    GCC_CXX="$GXX"
     13589    LD_CXX="$LD"
     13590
     13591    ## CAVEAT EMPTOR:
     13592    ## There is no encapsulation within the following macros, do not change
     13593    ## the running order or otherwise move them around unless you know exactly
     13594    ## what you are doing...
     13595    # Dependencies to place before and after the object being linked:
     13596predep_objects_CXX=
     13597postdep_objects_CXX=
     13598predeps_CXX=
     13599postdeps_CXX=
     13600compiler_lib_search_path_CXX=
     13601
     13602cat > conftest.$ac_ext <<_LT_EOF
     13603class Foo
     13604{
     13605public:
     13606  Foo (void) { a = 0; }
     13607private:
     13608  int a;
     13609};
     13610_LT_EOF
     13611
     13612
     13613_lt_libdeps_save_CFLAGS=$CFLAGS
     13614case "$CC $CFLAGS " in #(
     13615*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
     13616*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
     13617*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
     13618esac
     13619
     13620if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
     13621  (eval $ac_compile) 2>&5
     13622  ac_status=$?
     13623  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     13624  test $ac_status = 0; }; then
     13625  # Parse the compiler output and extract the necessary
     13626  # objects, libraries and library flags.
     13627
     13628  # Sentinel used to keep track of whether or not we are before
     13629  # the conftest object file.
     13630  pre_test_object_deps_done=no
     13631
     13632  for p in `eval "$output_verbose_link_cmd"`; do
     13633    case ${prev}${p} in
     13634
     13635    -L* | -R* | -l*)
     13636       # Some compilers place space between "-{L,R}" and the path.
     13637       # Remove the space.
     13638       if test $p = "-L" ||
     13639          test $p = "-R"; then
     13640         prev=$p
     13641         continue
     13642       fi
     13643
     13644       # Expand the sysroot to ease extracting the directories later.
     13645       if test -z "$prev"; then
     13646         case $p in
     13647         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
     13648         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
     13649         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
     13650         esac
     13651       fi
     13652       case $p in
     13653       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
     13654       esac
     13655       if test "$pre_test_object_deps_done" = no; then
     13656         case ${prev} in
     13657         -L | -R)
     13658           # Internal compiler library paths should come after those
     13659           # provided the user.  The postdeps already come after the
     13660           # user supplied libs so there is no need to process them.
     13661           if test -z "$compiler_lib_search_path_CXX"; then
     13662             compiler_lib_search_path_CXX="${prev}${p}"
     13663           else
     13664             compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
     13665           fi
     13666           ;;
     13667         # The "-l" case would never come before the object being
     13668         # linked, so don't bother handling this case.
     13669         esac
     13670       else
     13671         if test -z "$postdeps_CXX"; then
     13672           postdeps_CXX="${prev}${p}"
     13673         else
     13674           postdeps_CXX="${postdeps_CXX} ${prev}${p}"
     13675         fi
     13676       fi
     13677       prev=
     13678       ;;
     13679
     13680    *.lto.$objext) ;; # Ignore GCC LTO objects
     13681    *.$objext)
     13682       # This assumes that the test object file only shows up
     13683       # once in the compiler output.
     13684       if test "$p" = "conftest.$objext"; then
     13685         pre_test_object_deps_done=yes
     13686         continue
     13687       fi
     13688
     13689       if test "$pre_test_object_deps_done" = no; then
     13690         if test -z "$predep_objects_CXX"; then
     13691           predep_objects_CXX="$p"
     13692         else
     13693           predep_objects_CXX="$predep_objects_CXX $p"
     13694         fi
     13695       else
     13696         if test -z "$postdep_objects_CXX"; then
     13697           postdep_objects_CXX="$p"
     13698         else
     13699           postdep_objects_CXX="$postdep_objects_CXX $p"
     13700         fi
     13701       fi
     13702       ;;
     13703
     13704    *) ;; # Ignore the rest.
     13705
     13706    esac
     13707  done
     13708
     13709  # Clean up.
     13710  rm -f a.out a.exe
     13711else
     13712  echo "libtool.m4: error: problem compiling CXX test program"
     13713fi
     13714
     13715$RM -f confest.$objext
     13716CFLAGS=$_lt_libdeps_save_CFLAGS
     13717
     13718# PORTME: override above test on systems where it is broken
     13719case $host_os in
     13720interix[3-9]*)
     13721  # Interix 3.5 installs completely hosed .la files for C++, so rather than
     13722  # hack all around it, let's just trust "g++" to DTRT.
     13723  predep_objects_CXX=
     13724  postdep_objects_CXX=
     13725  postdeps_CXX=
     13726  ;;
     13727
     13728linux*)
     13729  case `$CC -V 2>&1 | sed 5q` in
     13730  *Sun\ C*)
     13731    # Sun C++ 5.9
     13732
     13733    # The more standards-conforming stlport4 library is
     13734    # incompatible with the Cstd library. Avoid specifying
     13735    # it if it's in CXXFLAGS. Ignore libCrun as
     13736    # -library=stlport4 depends on it.
     13737    case " $CXX $CXXFLAGS " in
     13738    *" -library=stlport4 "*)
     13739      solaris_use_stlport4=yes
     13740      ;;
     13741    esac
     13742
     13743    if test "$solaris_use_stlport4" != yes; then
     13744      postdeps_CXX='-library=Cstd -library=Crun'
     13745    fi
     13746    ;;
     13747  esac
     13748  ;;
     13749
     13750solaris*)
     13751  case $cc_basename in
     13752  CC* | sunCC*)
     13753    # The more standards-conforming stlport4 library is
     13754    # incompatible with the Cstd library. Avoid specifying
     13755    # it if it's in CXXFLAGS. Ignore libCrun as
     13756    # -library=stlport4 depends on it.
     13757    case " $CXX $CXXFLAGS " in
     13758    *" -library=stlport4 "*)
     13759      solaris_use_stlport4=yes
     13760      ;;
     13761    esac
     13762
     13763    # Adding this requires a known-good setup of shared libraries for
     13764    # Sun compiler versions before 5.6, else PIC objects from an old
     13765    # archive will be linked into the output, leading to subtle bugs.
     13766    if test "$solaris_use_stlport4" != yes; then
     13767      postdeps_CXX='-library=Cstd -library=Crun'
     13768    fi
     13769    ;;
     13770  esac
     13771  ;;
     13772esac
     13773
     13774
     13775case " $postdeps_CXX " in
     13776*" -lc "*) archive_cmds_need_lc_CXX=no ;;
     13777esac
     13778 compiler_lib_search_dirs_CXX=
     13779if test -n "${compiler_lib_search_path_CXX}"; then
     13780 compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
     13781fi
     13782
     13783
     13784
     13785
     13786
     13787
     13788
     13789
     13790
     13791
     13792
     13793
     13794
     13795
     13796
     13797
     13798
     13799
     13800
     13801
     13802
     13803
     13804
     13805
     13806
     13807
     13808
     13809
     13810
     13811
     13812
     13813    lt_prog_compiler_wl_CXX=
     13814lt_prog_compiler_pic_CXX=
     13815lt_prog_compiler_static_CXX=
     13816
     13817
     13818  # C++ specific cases for pic, static, wl, etc.
     13819  if test "$GXX" = yes; then
     13820    lt_prog_compiler_wl_CXX='-Wl,'
     13821    lt_prog_compiler_static_CXX='-static'
     13822
     13823    case $host_os in
     13824    aix*)
     13825      # All AIX code is PIC.
     13826      if test "$host_cpu" = ia64; then
     13827        # AIX 5 now supports IA64 processor
     13828        lt_prog_compiler_static_CXX='-Bstatic'
     13829      fi
     13830      ;;
     13831
     13832    amigaos*)
     13833      case $host_cpu in
     13834      powerpc)
     13835            # see comment about AmigaOS4 .so support
     13836            lt_prog_compiler_pic_CXX='-fPIC'
     13837        ;;
     13838      m68k)
     13839            # FIXME: we need at least 68020 code to build shared libraries, but
     13840            # adding the `-m68020' flag to GCC prevents building anything better,
     13841            # like `-m68040'.
     13842            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
     13843        ;;
     13844      esac
     13845      ;;
     13846
     13847    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
     13848      # PIC is the default for these OSes.
     13849      ;;
     13850    mingw* | cygwin* | os2* | pw32* | cegcc*)
     13851      # This hack is so that the source file can tell whether it is being
     13852      # built for inclusion in a dll (and should export symbols for example).
     13853      # Although the cygwin gcc ignores -fPIC, still need this for old-style
     13854      # (--disable-auto-import) libraries
     13855      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
     13856      ;;
     13857    darwin* | rhapsody*)
     13858      # PIC is the default on this platform
     13859      # Common symbols not allowed in MH_DYLIB files
     13860      lt_prog_compiler_pic_CXX='-fno-common'
     13861      ;;
     13862    *djgpp*)
     13863      # DJGPP does not support shared libraries at all
     13864      lt_prog_compiler_pic_CXX=
     13865      ;;
     13866    haiku*)
     13867      # PIC is the default for Haiku.
     13868      # The "-static" flag exists, but is broken.
     13869      lt_prog_compiler_static_CXX=
     13870      ;;
     13871    interix[3-9]*)
     13872      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
     13873      # Instead, we relocate shared libraries at runtime.
     13874      ;;
     13875    sysv4*MP*)
     13876      if test -d /usr/nec; then
     13877        lt_prog_compiler_pic_CXX=-Kconform_pic
     13878      fi
     13879      ;;
     13880    hpux*)
     13881      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
     13882      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
     13883      # sets the default TLS model and affects inlining.
     13884      case $host_cpu in
     13885      hppa*64*)
     13886        ;;
     13887      *)
     13888        lt_prog_compiler_pic_CXX='-fPIC'
     13889        ;;
     13890      esac
     13891      ;;
     13892    *qnx* | *nto*)
     13893      # QNX uses GNU C++, but need to define -shared option too, otherwise
     13894      # it will coredump.
     13895      lt_prog_compiler_pic_CXX='-fPIC -shared'
     13896      ;;
     13897    *)
     13898      lt_prog_compiler_pic_CXX='-fPIC'
     13899      ;;
     13900    esac
     13901  else
     13902    case $host_os in
     13903      aix[4-9]*)
     13904        # All AIX code is PIC.
     13905        if test "$host_cpu" = ia64; then
     13906          # AIX 5 now supports IA64 processor
     13907          lt_prog_compiler_static_CXX='-Bstatic'
     13908        else
     13909          lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
     13910        fi
     13911        ;;
     13912      chorus*)
     13913        case $cc_basename in
     13914        cxch68*)
     13915          # Green Hills C++ Compiler
     13916          # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
     13917          ;;
     13918        esac
     13919        ;;
     13920      mingw* | cygwin* | os2* | pw32* | cegcc*)
     13921        # This hack is so that the source file can tell whether it is being
     13922        # built for inclusion in a dll (and should export symbols for example).
     13923        lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
     13924        ;;
     13925      dgux*)
     13926        case $cc_basename in
     13927          ec++*)
     13928            lt_prog_compiler_pic_CXX='-KPIC'
     13929            ;;
     13930          ghcx*)
     13931            # Green Hills C++ Compiler
     13932            lt_prog_compiler_pic_CXX='-pic'
     13933            ;;
     13934          *)
     13935            ;;
     13936        esac
     13937        ;;
     13938      freebsd* | dragonfly*)
     13939        # FreeBSD uses GNU C++
     13940        ;;
     13941      hpux9* | hpux10* | hpux11*)
     13942        case $cc_basename in
     13943          CC*)
     13944            lt_prog_compiler_wl_CXX='-Wl,'
     13945            lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
     13946            if test "$host_cpu" != ia64; then
     13947              lt_prog_compiler_pic_CXX='+Z'
     13948            fi
     13949            ;;
     13950          aCC*)
     13951            lt_prog_compiler_wl_CXX='-Wl,'
     13952            lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
     13953            case $host_cpu in
     13954            hppa*64*|ia64*)
     13955              # +Z the default
     13956              ;;
     13957            *)
     13958              lt_prog_compiler_pic_CXX='+Z'
     13959              ;;
     13960            esac
     13961            ;;
     13962          *)
     13963            ;;
     13964        esac
     13965        ;;
     13966      interix*)
     13967        # This is c89, which is MS Visual C++ (no shared libs)
     13968        # Anyone wants to do a port?
     13969        ;;
     13970      irix5* | irix6* | nonstopux*)
     13971        case $cc_basename in
     13972          CC*)
     13973            lt_prog_compiler_wl_CXX='-Wl,'
     13974            lt_prog_compiler_static_CXX='-non_shared'
     13975            # CC pic flag -KPIC is the default.
     13976            ;;
     13977          *)
     13978            ;;
     13979        esac
     13980        ;;
     13981      linux* | k*bsd*-gnu | kopensolaris*-gnu)
     13982        case $cc_basename in
     13983          KCC*)
     13984            # KAI C++ Compiler
     13985            lt_prog_compiler_wl_CXX='--backend -Wl,'
     13986            lt_prog_compiler_pic_CXX='-fPIC'
     13987            ;;
     13988          ecpc* )
     13989            # old Intel C++ for x86_64 which still supported -KPIC.
     13990            lt_prog_compiler_wl_CXX='-Wl,'
     13991            lt_prog_compiler_pic_CXX='-KPIC'
     13992            lt_prog_compiler_static_CXX='-static'
     13993            ;;
     13994          icpc* )
     13995            # Intel C++, used to be incompatible with GCC.
     13996            # ICC 10 doesn't accept -KPIC any more.
     13997            lt_prog_compiler_wl_CXX='-Wl,'
     13998            lt_prog_compiler_pic_CXX='-fPIC'
     13999            lt_prog_compiler_static_CXX='-static'
     14000            ;;
     14001          pgCC* | pgcpp*)
     14002            # Portland Group C++ compiler
     14003            lt_prog_compiler_wl_CXX='-Wl,'
     14004            lt_prog_compiler_pic_CXX='-fpic'
     14005            lt_prog_compiler_static_CXX='-Bstatic'
     14006            ;;
     14007          cxx*)
     14008            # Compaq C++
     14009            # Make sure the PIC flag is empty.  It appears that all Alpha
     14010            # Linux and Compaq Tru64 Unix objects are PIC.
     14011            lt_prog_compiler_pic_CXX=
     14012            lt_prog_compiler_static_CXX='-non_shared'
     14013            ;;
     14014          xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
     14015            # IBM XL 8.0, 9.0 on PPC and BlueGene
     14016            lt_prog_compiler_wl_CXX='-Wl,'
     14017            lt_prog_compiler_pic_CXX='-qpic'
     14018            lt_prog_compiler_static_CXX='-qstaticlink'
     14019            ;;
     14020          *)
     14021            case `$CC -V 2>&1 | sed 5q` in
     14022            *Sun\ C*)
     14023              # Sun C++ 5.9
     14024              lt_prog_compiler_pic_CXX='-KPIC'
     14025              lt_prog_compiler_static_CXX='-Bstatic'
     14026              lt_prog_compiler_wl_CXX='-Qoption ld '
     14027              ;;
     14028            esac
     14029            ;;
     14030        esac
     14031        ;;
     14032      lynxos*)
     14033        ;;
     14034      m88k*)
     14035        ;;
     14036      mvs*)
     14037        case $cc_basename in
     14038          cxx*)
     14039            lt_prog_compiler_pic_CXX='-W c,exportall'
     14040            ;;
     14041          *)
     14042            ;;
     14043        esac
     14044        ;;
     14045      netbsd*)
     14046        ;;
     14047      *qnx* | *nto*)
     14048        # QNX uses GNU C++, but need to define -shared option too, otherwise
     14049        # it will coredump.
     14050        lt_prog_compiler_pic_CXX='-fPIC -shared'
     14051        ;;
     14052      osf3* | osf4* | osf5*)
     14053        case $cc_basename in
     14054          KCC*)
     14055            lt_prog_compiler_wl_CXX='--backend -Wl,'
     14056            ;;
     14057          RCC*)
     14058            # Rational C++ 2.4.1
     14059            lt_prog_compiler_pic_CXX='-pic'
     14060            ;;
     14061          cxx*)
     14062            # Digital/Compaq C++
     14063            lt_prog_compiler_wl_CXX='-Wl,'
     14064            # Make sure the PIC flag is empty.  It appears that all Alpha
     14065            # Linux and Compaq Tru64 Unix objects are PIC.
     14066            lt_prog_compiler_pic_CXX=
     14067            lt_prog_compiler_static_CXX='-non_shared'
     14068            ;;
     14069          *)
     14070            ;;
     14071        esac
     14072        ;;
     14073      psos*)
     14074        ;;
     14075      solaris*)
     14076        case $cc_basename in
     14077          CC* | sunCC*)
     14078            # Sun C++ 4.2, 5.x and Centerline C++
     14079            lt_prog_compiler_pic_CXX='-KPIC'
     14080            lt_prog_compiler_static_CXX='-Bstatic'
     14081            lt_prog_compiler_wl_CXX='-Qoption ld '
     14082            ;;
     14083          gcx*)
     14084            # Green Hills C++ Compiler
     14085            lt_prog_compiler_pic_CXX='-PIC'
     14086            ;;
     14087          *)
     14088            ;;
     14089        esac
     14090        ;;
     14091      sunos4*)
     14092        case $cc_basename in
     14093          CC*)
     14094            # Sun C++ 4.x
     14095            lt_prog_compiler_pic_CXX='-pic'
     14096            lt_prog_compiler_static_CXX='-Bstatic'
     14097            ;;
     14098          lcc*)
     14099            # Lucid
     14100            lt_prog_compiler_pic_CXX='-pic'
     14101            ;;
     14102          *)
     14103            ;;
     14104        esac
     14105        ;;
     14106      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
     14107        case $cc_basename in
     14108          CC*)
     14109            lt_prog_compiler_wl_CXX='-Wl,'
     14110            lt_prog_compiler_pic_CXX='-KPIC'
     14111            lt_prog_compiler_static_CXX='-Bstatic'
     14112            ;;
     14113        esac
     14114        ;;
     14115      tandem*)
     14116        case $cc_basename in
     14117          NCC*)
     14118            # NonStop-UX NCC 3.20
     14119            lt_prog_compiler_pic_CXX='-KPIC'
     14120            ;;
     14121          *)
     14122            ;;
     14123        esac
     14124        ;;
     14125      vxworks*)
     14126        ;;
     14127      *)
     14128        lt_prog_compiler_can_build_shared_CXX=no
     14129        ;;
     14130    esac
     14131  fi
     14132
     14133case $host_os in
     14134  # For platforms which do not support PIC, -DPIC is meaningless:
     14135  *djgpp*)
     14136    lt_prog_compiler_pic_CXX=
     14137    ;;
     14138  *)
     14139    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
     14140    ;;
     14141esac
     14142
     14143{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
     14144$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
     14145if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
     14146  $as_echo_n "(cached) " >&6
     14147else
     14148  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
     14149fi
     14150{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
     14151$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
     14152lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
     14153
     14154#
     14155# Check to make sure the PIC flag actually works.
     14156#
     14157if test -n "$lt_prog_compiler_pic_CXX"; then
     14158  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
     14159$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
     14160if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
     14161  $as_echo_n "(cached) " >&6
     14162else
     14163  lt_cv_prog_compiler_pic_works_CXX=no
     14164   ac_outfile=conftest.$ac_objext
     14165   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
     14166   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
     14167   # Insert the option either (1) after the last *FLAGS variable, or
     14168   # (2) before a word containing "conftest.", or (3) at the end.
     14169   # Note that $ac_compile itself does not contain backslashes and begins
     14170   # with a dollar sign (not a hyphen), so the echo should work correctly.
     14171   # The option is referenced via a variable to avoid confusing sed.
     14172   lt_compile=`echo "$ac_compile" | $SED \
     14173   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
     14174   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
     14175   -e 's:$: $lt_compiler_flag:'`
     14176   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
     14177   (eval "$lt_compile" 2>conftest.err)
     14178   ac_status=$?
     14179   cat conftest.err >&5
     14180   echo "$as_me:$LINENO: \$? = $ac_status" >&5
     14181   if (exit $ac_status) && test -s "$ac_outfile"; then
     14182     # The compiler can only warn and ignore the option if not recognized
     14183     # So say no if there are warnings other than the usual output.
     14184     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
     14185     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
     14186     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
     14187       lt_cv_prog_compiler_pic_works_CXX=yes
     14188     fi
     14189   fi
     14190   $RM conftest*
     14191
     14192fi
     14193{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
     14194$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
     14195
     14196if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
     14197    case $lt_prog_compiler_pic_CXX in
     14198     "" | " "*) ;;
     14199     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
     14200     esac
     14201else
     14202    lt_prog_compiler_pic_CXX=
     14203     lt_prog_compiler_can_build_shared_CXX=no
     14204fi
     14205
     14206fi
     14207
     14208
     14209
     14210
     14211
     14212#
     14213# Check to make sure the static flag actually works.
     14214#
     14215wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
     14216{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
     14217$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
     14218if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
     14219  $as_echo_n "(cached) " >&6
     14220else
     14221  lt_cv_prog_compiler_static_works_CXX=no
     14222   save_LDFLAGS="$LDFLAGS"
     14223   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
     14224   echo "$lt_simple_link_test_code" > conftest.$ac_ext
     14225   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
     14226     # The linker can only warn and ignore the option if not recognized
     14227     # So say no if there are warnings
     14228     if test -s conftest.err; then
     14229       # Append any errors to the config.log.
     14230       cat conftest.err 1>&5
     14231       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
     14232       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
     14233       if diff conftest.exp conftest.er2 >/dev/null; then
     14234         lt_cv_prog_compiler_static_works_CXX=yes
     14235       fi
     14236     else
     14237       lt_cv_prog_compiler_static_works_CXX=yes
     14238     fi
     14239   fi
     14240   $RM -r conftest*
     14241   LDFLAGS="$save_LDFLAGS"
     14242
     14243fi
     14244{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
     14245$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
     14246
     14247if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
     14248    :
     14249else
     14250    lt_prog_compiler_static_CXX=
     14251fi
     14252
     14253
     14254
     14255
     14256    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
     14257$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
     14258if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
     14259  $as_echo_n "(cached) " >&6
     14260else
     14261  lt_cv_prog_compiler_c_o_CXX=no
     14262   $RM -r conftest 2>/dev/null
     14263   mkdir conftest
     14264   cd conftest
     14265   mkdir out
     14266   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
     14267
     14268   lt_compiler_flag="-o out/conftest2.$ac_objext"
     14269   # Insert the option either (1) after the last *FLAGS variable, or
     14270   # (2) before a word containing "conftest.", or (3) at the end.
     14271   # Note that $ac_compile itself does not contain backslashes and begins
     14272   # with a dollar sign (not a hyphen), so the echo should work correctly.
     14273   lt_compile=`echo "$ac_compile" | $SED \
     14274   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
     14275   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
     14276   -e 's:$: $lt_compiler_flag:'`
     14277   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
     14278   (eval "$lt_compile" 2>out/conftest.err)
     14279   ac_status=$?
     14280   cat out/conftest.err >&5
     14281   echo "$as_me:$LINENO: \$? = $ac_status" >&5
     14282   if (exit $ac_status) && test -s out/conftest2.$ac_objext
     14283   then
     14284     # The compiler can only warn and ignore the option if not recognized
     14285     # So say no if there are warnings
     14286     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
     14287     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
     14288     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
     14289       lt_cv_prog_compiler_c_o_CXX=yes
     14290     fi
     14291   fi
     14292   chmod u+w . 2>&5
     14293   $RM conftest*
     14294   # SGI C++ compiler will create directory out/ii_files/ for
     14295   # template instantiation
     14296   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
     14297   $RM out/* && rmdir out
     14298   cd ..
     14299   $RM -r conftest
     14300   $RM conftest*
     14301
     14302fi
     14303{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
     14304$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
     14305
     14306
     14307
     14308    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
     14309$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
     14310if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
     14311  $as_echo_n "(cached) " >&6
     14312else
     14313  lt_cv_prog_compiler_c_o_CXX=no
     14314   $RM -r conftest 2>/dev/null
     14315   mkdir conftest
     14316   cd conftest
     14317   mkdir out
     14318   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
     14319
     14320   lt_compiler_flag="-o out/conftest2.$ac_objext"
     14321   # Insert the option either (1) after the last *FLAGS variable, or
     14322   # (2) before a word containing "conftest.", or (3) at the end.
     14323   # Note that $ac_compile itself does not contain backslashes and begins
     14324   # with a dollar sign (not a hyphen), so the echo should work correctly.
     14325   lt_compile=`echo "$ac_compile" | $SED \
     14326   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
     14327   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
     14328   -e 's:$: $lt_compiler_flag:'`
     14329   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
     14330   (eval "$lt_compile" 2>out/conftest.err)
     14331   ac_status=$?
     14332   cat out/conftest.err >&5
     14333   echo "$as_me:$LINENO: \$? = $ac_status" >&5
     14334   if (exit $ac_status) && test -s out/conftest2.$ac_objext
     14335   then
     14336     # The compiler can only warn and ignore the option if not recognized
     14337     # So say no if there are warnings
     14338     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
     14339     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
     14340     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
     14341       lt_cv_prog_compiler_c_o_CXX=yes
     14342     fi
     14343   fi
     14344   chmod u+w . 2>&5
     14345   $RM conftest*
     14346   # SGI C++ compiler will create directory out/ii_files/ for
     14347   # template instantiation
     14348   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
     14349   $RM out/* && rmdir out
     14350   cd ..
     14351   $RM -r conftest
     14352   $RM conftest*
     14353
     14354fi
     14355{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
     14356$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
     14357
     14358
     14359
     14360
     14361hard_links="nottested"
     14362if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
     14363  # do not overwrite the value of need_locks provided by the user
     14364  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
     14365$as_echo_n "checking if we can lock with hard links... " >&6; }
     14366  hard_links=yes
     14367  $RM conftest*
     14368  ln conftest.a conftest.b 2>/dev/null && hard_links=no
     14369  touch conftest.a
     14370  ln conftest.a conftest.b 2>&5 || hard_links=no
     14371  ln conftest.a conftest.b 2>/dev/null && hard_links=no
     14372  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
     14373$as_echo "$hard_links" >&6; }
     14374  if test "$hard_links" = no; then
     14375    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
     14376$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
     14377    need_locks=warn
     14378  fi
     14379else
     14380  need_locks=no
     14381fi
     14382
     14383
     14384
     14385    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
     14386$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
     14387
     14388  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
     14389  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
     14390  case $host_os in
     14391  aix[4-9]*)
     14392    # If we're using GNU nm, then we don't want the "-C" option.
     14393    # -C means demangle to AIX nm, but means don't demangle with GNU nm
     14394    # Also, AIX nm treats weak defined symbols like other global defined
     14395    # symbols, whereas GNU nm marks them as "W".
     14396    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
     14397      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     14398    else
     14399      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     14400    fi
     14401    ;;
     14402  pw32*)
     14403    export_symbols_cmds_CXX="$ltdll_cmds"
     14404    ;;
     14405  cygwin* | mingw* | cegcc*)
     14406    case $cc_basename in
     14407    cl*)
     14408      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
     14409      ;;
     14410    *)
     14411      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
     14412      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
     14413      ;;
     14414    esac
     14415    ;;
     14416  *)
     14417    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
     14418    ;;
     14419  esac
     14420
     14421{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
     14422$as_echo "$ld_shlibs_CXX" >&6; }
     14423test "$ld_shlibs_CXX" = no && can_build_shared=no
     14424
     14425with_gnu_ld_CXX=$with_gnu_ld
     14426
     14427
     14428
     14429
     14430
     14431
     14432#
     14433# Do we need to explicitly link libc?
     14434#
     14435case "x$archive_cmds_need_lc_CXX" in
     14436x|xyes)
     14437  # Assume -lc should be added
     14438  archive_cmds_need_lc_CXX=yes
     14439
     14440  if test "$enable_shared" = yes && test "$GCC" = yes; then
     14441    case $archive_cmds_CXX in
     14442    *'~'*)
     14443      # FIXME: we may have to deal with multi-command sequences.
     14444      ;;
     14445    '$CC '*)
     14446      # Test whether the compiler implicitly links with -lc since on some
     14447      # systems, -lgcc has to come before -lc. If gcc already passes -lc
     14448      # to ld, don't add -lc before -lgcc.
     14449      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
     14450$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
     14451if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
     14452  $as_echo_n "(cached) " >&6
     14453else
     14454  $RM conftest*
     14455        echo "$lt_simple_compile_test_code" > conftest.$ac_ext
     14456
     14457        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
     14458  (eval $ac_compile) 2>&5
     14459  ac_status=$?
     14460  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     14461  test $ac_status = 0; } 2>conftest.err; then
     14462          soname=conftest
     14463          lib=conftest
     14464          libobjs=conftest.$ac_objext
     14465          deplibs=
     14466          wl=$lt_prog_compiler_wl_CXX
     14467          pic_flag=$lt_prog_compiler_pic_CXX
     14468          compiler_flags=-v
     14469          linker_flags=-v
     14470          verstring=
     14471          output_objdir=.
     14472          libname=conftest
     14473          lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
     14474          allow_undefined_flag_CXX=
     14475          if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
     14476  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
     14477  ac_status=$?
     14478  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     14479  test $ac_status = 0; }
     14480          then
     14481            lt_cv_archive_cmds_need_lc_CXX=no
     14482          else
     14483            lt_cv_archive_cmds_need_lc_CXX=yes
     14484          fi
     14485          allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
     14486        else
     14487          cat conftest.err 1>&5
     14488        fi
     14489        $RM conftest*
     14490
     14491fi
     14492{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
     14493$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
     14494      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
     14495      ;;
     14496    esac
     14497  fi
     14498  ;;
     14499esac
     14500
     14501
     14502
     14503
     14504
     14505
     14506
     14507
     14508
     14509
     14510
     14511
     14512
     14513
     14514
     14515
     14516
     14517
     14518
     14519
     14520
     14521
     14522
     14523
     14524
     14525
     14526
     14527
     14528
     14529
     14530
     14531
     14532
     14533
     14534
     14535
     14536
     14537
     14538
     14539
     14540
     14541
     14542
     14543
     14544
     14545
     14546
     14547
     14548
     14549
     14550
     14551
     14552
     14553
     14554
     14555
     14556
     14557
     14558
     14559
     14560
     14561
     14562    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
     14563$as_echo_n "checking dynamic linker characteristics... " >&6; }
     14564
     14565library_names_spec=
     14566libname_spec='lib$name'
     14567soname_spec=
     14568shrext_cmds=".so"
     14569postinstall_cmds=
     14570postuninstall_cmds=
     14571finish_cmds=
     14572finish_eval=
     14573shlibpath_var=
     14574shlibpath_overrides_runpath=unknown
     14575version_type=none
     14576dynamic_linker="$host_os ld.so"
     14577sys_lib_dlsearch_path_spec="/lib /usr/lib"
     14578need_lib_prefix=unknown
     14579hardcode_into_libs=no
     14580
     14581# when you set need_version to no, make sure it does not cause -set_version
     14582# flags to be left without arguments
     14583need_version=unknown
     14584
     14585case $host_os in
     14586aix3*)
     14587  version_type=linux # correct to gnu/linux during the next big refactor
     14588  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
     14589  shlibpath_var=LIBPATH
     14590
     14591  # AIX 3 has no versioning support, so we append a major version to the name.
     14592  soname_spec='${libname}${release}${shared_ext}$major'
     14593  ;;
     14594
     14595aix[4-9]*)
     14596  version_type=linux # correct to gnu/linux during the next big refactor
     14597  need_lib_prefix=no
     14598  need_version=no
     14599  hardcode_into_libs=yes
     14600  if test "$host_cpu" = ia64; then
     14601    # AIX 5 supports IA64
     14602    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
     14603    shlibpath_var=LD_LIBRARY_PATH
     14604  else
     14605    # With GCC up to 2.95.x, collect2 would create an import file
     14606    # for dependence libraries.  The import file would start with
     14607    # the line `#! .'.  This would cause the generated library to
     14608    # depend on `.', always an invalid library.  This was fixed in
     14609    # development snapshots of GCC prior to 3.0.
     14610    case $host_os in
     14611      aix4 | aix4.[01] | aix4.[01].*)
     14612      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
     14613           echo ' yes '
     14614           echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
     14615        :
     14616      else
     14617        can_build_shared=no
     14618      fi
     14619      ;;
     14620    esac
     14621    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
     14622    # soname into executable. Probably we can add versioning support to
     14623    # collect2, so additional links can be useful in future.
     14624    if test "$aix_use_runtimelinking" = yes; then
     14625      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
     14626      # instead of lib<name>.a to let people know that these are not
     14627      # typical AIX shared libraries.
     14628      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     14629    else
     14630      # We preserve .a as extension for shared libraries through AIX4.2
     14631      # and later when we are not doing run time linking.
     14632      library_names_spec='${libname}${release}.a $libname.a'
     14633      soname_spec='${libname}${release}${shared_ext}$major'
     14634    fi
     14635    shlibpath_var=LIBPATH
     14636  fi
     14637  ;;
     14638
     14639amigaos*)
     14640  case $host_cpu in
     14641  powerpc)
     14642    # Since July 2007 AmigaOS4 officially supports .so libraries.
     14643    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
     14644    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     14645    ;;
     14646  m68k)
     14647    library_names_spec='$libname.ixlibrary $libname.a'
     14648    # Create ${libname}_ixlibrary.a entries in /sys/libs.
     14649    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     14650    ;;
     14651  esac
     14652  ;;
     14653
     14654beos*)
     14655  library_names_spec='${libname}${shared_ext}'
     14656  dynamic_linker="$host_os ld.so"
     14657  shlibpath_var=LIBRARY_PATH
     14658  ;;
     14659
     14660bsdi[45]*)
     14661  version_type=linux # correct to gnu/linux during the next big refactor
     14662  need_version=no
     14663  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     14664  soname_spec='${libname}${release}${shared_ext}$major'
     14665  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
     14666  shlibpath_var=LD_LIBRARY_PATH
     14667  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
     14668  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
     14669  # the default ld.so.conf also contains /usr/contrib/lib and
     14670  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
     14671  # libtool to hard-code these into programs
     14672  ;;
     14673
     14674cygwin* | mingw* | pw32* | cegcc*)
     14675  version_type=windows
     14676  shrext_cmds=".dll"
     14677  need_version=no
     14678  need_lib_prefix=no
     14679
     14680  case $GCC,$cc_basename in
     14681  yes,*)
     14682    # gcc
     14683    library_names_spec='$libname.dll.a'
     14684    # DLL is installed to $(libdir)/../bin by postinstall_cmds
     14685    postinstall_cmds='base_file=`basename \${file}`~
     14686      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
     14687      dldir=$destdir/`dirname \$dlpath`~
     14688      test -d \$dldir || mkdir -p \$dldir~
     14689      $install_prog $dir/$dlname \$dldir/$dlname~
     14690      chmod a+x \$dldir/$dlname~
     14691      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
     14692        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
     14693      fi'
     14694    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
     14695      dlpath=$dir/\$dldll~
     14696       $RM \$dlpath'
     14697    shlibpath_overrides_runpath=yes
     14698
     14699    case $host_os in
     14700    cygwin*)
     14701      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
     14702      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
     14703
     14704      ;;
     14705    mingw* | cegcc*)
     14706      # MinGW DLLs use traditional 'lib' prefix
     14707      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
     14708      ;;
     14709    pw32*)
     14710      # pw32 DLLs use 'pw' prefix rather than 'lib'
     14711      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
     14712      ;;
     14713    esac
     14714    dynamic_linker='Win32 ld.exe'
     14715    ;;
     14716
     14717  *,cl*)
     14718    # Native MSVC
     14719    libname_spec='$name'
     14720    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
     14721    library_names_spec='${libname}.dll.lib'
     14722
     14723    case $build_os in
     14724    mingw*)
     14725      sys_lib_search_path_spec=
     14726      lt_save_ifs=$IFS
     14727      IFS=';'
     14728      for lt_path in $LIB
     14729      do
     14730        IFS=$lt_save_ifs
     14731        # Let DOS variable expansion print the short 8.3 style file name.
     14732        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
     14733        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
     14734      done
     14735      IFS=$lt_save_ifs
     14736      # Convert to MSYS style.
     14737      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
     14738      ;;
     14739    cygwin*)
     14740      # Convert to unix form, then to dos form, then back to unix form
     14741      # but this time dos style (no spaces!) so that the unix form looks
     14742      # like /cygdrive/c/PROGRA~1:/cygdr...
     14743      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
     14744      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
     14745      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
     14746      ;;
     14747    *)
     14748      sys_lib_search_path_spec="$LIB"
     14749      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
     14750        # It is most probably a Windows format PATH.
     14751        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
     14752      else
     14753        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
     14754      fi
     14755      # FIXME: find the short name or the path components, as spaces are
     14756      # common. (e.g. "Program Files" -> "PROGRA~1")
     14757      ;;
     14758    esac
     14759
     14760    # DLL is installed to $(libdir)/../bin by postinstall_cmds
     14761    postinstall_cmds='base_file=`basename \${file}`~
     14762      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
     14763      dldir=$destdir/`dirname \$dlpath`~
     14764      test -d \$dldir || mkdir -p \$dldir~
     14765      $install_prog $dir/$dlname \$dldir/$dlname'
     14766    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
     14767      dlpath=$dir/\$dldll~
     14768       $RM \$dlpath'
     14769    shlibpath_overrides_runpath=yes
     14770    dynamic_linker='Win32 link.exe'
     14771    ;;
     14772
     14773  *)
     14774    # Assume MSVC wrapper
     14775    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     14776    dynamic_linker='Win32 ld.exe'
     14777    ;;
     14778  esac
     14779  # FIXME: first we should search . and the directory the executable is in
     14780  shlibpath_var=PATH
     14781  ;;
     14782
     14783darwin* | rhapsody*)
     14784  dynamic_linker="$host_os dyld"
     14785  version_type=darwin
     14786  need_lib_prefix=no
     14787  need_version=no
     14788  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
     14789  soname_spec='${libname}${release}${major}$shared_ext'
     14790  shlibpath_overrides_runpath=yes
     14791  shlibpath_var=DYLD_LIBRARY_PATH
     14792  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
     14793
     14794  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
     14795  ;;
     14796
     14797dgux*)
     14798  version_type=linux # correct to gnu/linux during the next big refactor
     14799  need_lib_prefix=no
     14800  need_version=no
     14801  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
     14802  soname_spec='${libname}${release}${shared_ext}$major'
     14803  shlibpath_var=LD_LIBRARY_PATH
     14804  ;;
     14805
     14806freebsd* | dragonfly*)
     14807  # DragonFly does not have aout.  When/if they implement a new
     14808  # versioning mechanism, adjust this.
     14809  if test -x /usr/bin/objformat; then
     14810    objformat=`/usr/bin/objformat`
     14811  else
     14812    case $host_os in
     14813    freebsd[23].*) objformat=aout ;;
     14814    *) objformat=elf ;;
     14815    esac
     14816  fi
     14817  version_type=freebsd-$objformat
     14818  case $version_type in
     14819    freebsd-elf*)
     14820      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
     14821      need_version=no
     14822      need_lib_prefix=no
     14823      ;;
     14824    freebsd-*)
     14825      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
     14826      need_version=yes
     14827      ;;
     14828  esac
     14829  shlibpath_var=LD_LIBRARY_PATH
     14830  case $host_os in
     14831  freebsd2.*)
     14832    shlibpath_overrides_runpath=yes
     14833    ;;
     14834  freebsd3.[01]* | freebsdelf3.[01]*)
     14835    shlibpath_overrides_runpath=yes
     14836    hardcode_into_libs=yes
     14837    ;;
     14838  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
     14839  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
     14840    shlibpath_overrides_runpath=no
     14841    hardcode_into_libs=yes
     14842    ;;
     14843  *) # from 4.6 on, and DragonFly
     14844    shlibpath_overrides_runpath=yes
     14845    hardcode_into_libs=yes
     14846    ;;
     14847  esac
     14848  ;;
     14849
     14850gnu*)
     14851  version_type=linux # correct to gnu/linux during the next big refactor
     14852  need_lib_prefix=no
     14853  need_version=no
     14854  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
     14855  soname_spec='${libname}${release}${shared_ext}$major'
     14856  shlibpath_var=LD_LIBRARY_PATH
     14857  shlibpath_overrides_runpath=no
     14858  hardcode_into_libs=yes
     14859  ;;
     14860
     14861haiku*)
     14862  version_type=linux # correct to gnu/linux during the next big refactor
     14863  need_lib_prefix=no
     14864  need_version=no
     14865  dynamic_linker="$host_os runtime_loader"
     14866  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
     14867  soname_spec='${libname}${release}${shared_ext}$major'
     14868  shlibpath_var=LIBRARY_PATH
     14869  shlibpath_overrides_runpath=yes
     14870  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
     14871  hardcode_into_libs=yes
     14872  ;;
     14873
     14874hpux9* | hpux10* | hpux11*)
     14875  # Give a soname corresponding to the major version so that dld.sl refuses to
     14876  # link against other versions.
     14877  version_type=sunos
     14878  need_lib_prefix=no
     14879  need_version=no
     14880  case $host_cpu in
     14881  ia64*)
     14882    shrext_cmds='.so'
     14883    hardcode_into_libs=yes
     14884    dynamic_linker="$host_os dld.so"
     14885    shlibpath_var=LD_LIBRARY_PATH
     14886    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
     14887    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     14888    soname_spec='${libname}${release}${shared_ext}$major'
     14889    if test "X$HPUX_IA64_MODE" = X32; then
     14890      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
     14891    else
     14892      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
     14893    fi
     14894    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     14895    ;;
     14896  hppa*64*)
     14897    shrext_cmds='.sl'
     14898    hardcode_into_libs=yes
     14899    dynamic_linker="$host_os dld.sl"
     14900    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
     14901    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
     14902    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     14903    soname_spec='${libname}${release}${shared_ext}$major'
     14904    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
     14905    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     14906    ;;
     14907  *)
     14908    shrext_cmds='.sl'
     14909    dynamic_linker="$host_os dld.sl"
     14910    shlibpath_var=SHLIB_PATH
     14911    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
     14912    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     14913    soname_spec='${libname}${release}${shared_ext}$major'
     14914    ;;
     14915  esac
     14916  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
     14917  postinstall_cmds='chmod 555 $lib'
     14918  # or fails outright, so override atomically:
     14919  install_override_mode=555
     14920  ;;
     14921
     14922interix[3-9]*)
     14923  version_type=linux # correct to gnu/linux during the next big refactor
     14924  need_lib_prefix=no
     14925  need_version=no
     14926  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
     14927  soname_spec='${libname}${release}${shared_ext}$major'
     14928  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
     14929  shlibpath_var=LD_LIBRARY_PATH
     14930  shlibpath_overrides_runpath=no
     14931  hardcode_into_libs=yes
     14932  ;;
     14933
     14934irix5* | irix6* | nonstopux*)
     14935  case $host_os in
     14936    nonstopux*) version_type=nonstopux ;;
     14937    *)
     14938        if test "$lt_cv_prog_gnu_ld" = yes; then
     14939                version_type=linux # correct to gnu/linux during the next big refactor
     14940        else
     14941                version_type=irix
     14942        fi ;;
     14943  esac
     14944  need_lib_prefix=no
     14945  need_version=no
     14946  soname_spec='${libname}${release}${shared_ext}$major'
     14947  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
     14948  case $host_os in
     14949  irix5* | nonstopux*)
     14950    libsuff= shlibsuff=
     14951    ;;
     14952  *)
     14953    case $LD in # libtool.m4 will add one of these switches to LD
     14954    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
     14955      libsuff= shlibsuff= libmagic=32-bit;;
     14956    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
     14957      libsuff=32 shlibsuff=N32 libmagic=N32;;
     14958    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
     14959      libsuff=64 shlibsuff=64 libmagic=64-bit;;
     14960    *) libsuff= shlibsuff= libmagic=never-match;;
     14961    esac
     14962    ;;
     14963  esac
     14964  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
     14965  shlibpath_overrides_runpath=no
     14966  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
     14967  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
     14968  hardcode_into_libs=yes
     14969  ;;
     14970
     14971# No shared lib support for Linux oldld, aout, or coff.
     14972linux*oldld* | linux*aout* | linux*coff*)
     14973  dynamic_linker=no
     14974  ;;
     14975
     14976# This must be glibc/ELF.
     14977linux* | k*bsd*-gnu | kopensolaris*-gnu)
     14978  version_type=linux # correct to gnu/linux during the next big refactor
     14979  need_lib_prefix=no
     14980  need_version=no
     14981  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     14982  soname_spec='${libname}${release}${shared_ext}$major'
     14983  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
     14984  shlibpath_var=LD_LIBRARY_PATH
     14985  shlibpath_overrides_runpath=no
     14986
     14987  # Some binutils ld are patched to set DT_RUNPATH
     14988  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
     14989  $as_echo_n "(cached) " >&6
     14990else
     14991  lt_cv_shlibpath_overrides_runpath=no
     14992    save_LDFLAGS=$LDFLAGS
     14993    save_libdir=$libdir
     14994    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
     14995         LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
     14996    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     14997/* end confdefs.h.  */
     14998
     14999int
     15000main ()
     15001{
     15002
     15003  ;
     15004  return 0;
     15005}
     15006_ACEOF
     15007if ac_fn_cxx_try_link "$LINENO"; then :
     15008  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
     15009  lt_cv_shlibpath_overrides_runpath=yes
     15010fi
     15011fi
     15012rm -f core conftest.err conftest.$ac_objext \
     15013    conftest$ac_exeext conftest.$ac_ext
     15014    LDFLAGS=$save_LDFLAGS
     15015    libdir=$save_libdir
     15016
     15017fi
     15018
     15019  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
     15020
     15021  # This implies no fast_install, which is unacceptable.
     15022  # Some rework will be needed to allow for fast_install
     15023  # before this can be enabled.
     15024  hardcode_into_libs=yes
     15025
     15026  # Append ld.so.conf contents to the search path
     15027  if test -f /etc/ld.so.conf; then
     15028    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[       ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     15029    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
     15030  fi
     15031
     15032  # We used to test for /lib/ld.so.1 and disable shared libraries on
     15033  # powerpc, because MkLinux only supported shared libraries with the
     15034  # GNU dynamic linker.  Since this was broken with cross compilers,
     15035  # most powerpc-linux boxes support dynamic linking these days and
     15036  # people can always --disable-shared, the test was removed, and we
     15037  # assume the GNU/Linux dynamic linker is in use.
     15038  dynamic_linker='GNU/Linux ld.so'
     15039  ;;
     15040
     15041netbsd*)
     15042  version_type=sunos
     15043  need_lib_prefix=no
     15044  need_version=no
     15045  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
     15046    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
     15047    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     15048    dynamic_linker='NetBSD (a.out) ld.so'
     15049  else
     15050    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
     15051    soname_spec='${libname}${release}${shared_ext}$major'
     15052    dynamic_linker='NetBSD ld.elf_so'
     15053  fi
     15054  shlibpath_var=LD_LIBRARY_PATH
     15055  shlibpath_overrides_runpath=yes
     15056  hardcode_into_libs=yes
     15057  ;;
     15058
     15059newsos6)
     15060  version_type=linux # correct to gnu/linux during the next big refactor
     15061  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     15062  shlibpath_var=LD_LIBRARY_PATH
     15063  shlibpath_overrides_runpath=yes
     15064  ;;
     15065
     15066*nto* | *qnx*)
     15067  version_type=qnx
     15068  need_lib_prefix=no
     15069  need_version=no
     15070  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     15071  soname_spec='${libname}${release}${shared_ext}$major'
     15072  shlibpath_var=LD_LIBRARY_PATH
     15073  shlibpath_overrides_runpath=no
     15074  hardcode_into_libs=yes
     15075  dynamic_linker='ldqnx.so'
     15076  ;;
     15077
     15078openbsd*)
     15079  version_type=sunos
     15080  sys_lib_dlsearch_path_spec="/usr/lib"
     15081  need_lib_prefix=no
     15082  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
     15083  case $host_os in
     15084    openbsd3.3 | openbsd3.3.*)  need_version=yes ;;
     15085    *)                          need_version=no  ;;
     15086  esac
     15087  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
     15088  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     15089  shlibpath_var=LD_LIBRARY_PATH
     15090  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
     15091    case $host_os in
     15092      openbsd2.[89] | openbsd2.[89].*)
     15093        shlibpath_overrides_runpath=no
     15094        ;;
     15095      *)
     15096        shlibpath_overrides_runpath=yes
     15097        ;;
     15098      esac
     15099  else
     15100    shlibpath_overrides_runpath=yes
     15101  fi
     15102  ;;
     15103
     15104os2*)
     15105  libname_spec='$name'
     15106  shrext_cmds=".dll"
     15107  need_lib_prefix=no
     15108  library_names_spec='$libname${shared_ext} $libname.a'
     15109  dynamic_linker='OS/2 ld.exe'
     15110  shlibpath_var=LIBPATH
     15111  ;;
     15112
     15113osf3* | osf4* | osf5*)
     15114  version_type=osf
     15115  need_lib_prefix=no
     15116  need_version=no
     15117  soname_spec='${libname}${release}${shared_ext}$major'
     15118  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     15119  shlibpath_var=LD_LIBRARY_PATH
     15120  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
     15121  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
     15122  ;;
     15123
     15124rdos*)
     15125  dynamic_linker=no
     15126  ;;
     15127
     15128solaris*)
     15129  version_type=linux # correct to gnu/linux during the next big refactor
     15130  need_lib_prefix=no
     15131  need_version=no
     15132  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     15133  soname_spec='${libname}${release}${shared_ext}$major'
     15134  shlibpath_var=LD_LIBRARY_PATH
     15135  shlibpath_overrides_runpath=yes
     15136  hardcode_into_libs=yes
     15137  # ldd complains unless libraries are executable
     15138  postinstall_cmds='chmod +x $lib'
     15139  ;;
     15140
     15141sunos4*)
     15142  version_type=sunos
     15143  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
     15144  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
     15145  shlibpath_var=LD_LIBRARY_PATH
     15146  shlibpath_overrides_runpath=yes
     15147  if test "$with_gnu_ld" = yes; then
     15148    need_lib_prefix=no
     15149  fi
     15150  need_version=yes
     15151  ;;
     15152
     15153sysv4 | sysv4.3*)
     15154  version_type=linux # correct to gnu/linux during the next big refactor
     15155  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     15156  soname_spec='${libname}${release}${shared_ext}$major'
     15157  shlibpath_var=LD_LIBRARY_PATH
     15158  case $host_vendor in
     15159    sni)
     15160      shlibpath_overrides_runpath=no
     15161      need_lib_prefix=no
     15162      runpath_var=LD_RUN_PATH
     15163      ;;
     15164    siemens)
     15165      need_lib_prefix=no
     15166      ;;
     15167    motorola)
     15168      need_lib_prefix=no
     15169      need_version=no
     15170      shlibpath_overrides_runpath=no
     15171      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
     15172      ;;
     15173  esac
     15174  ;;
     15175
     15176sysv4*MP*)
     15177  if test -d /usr/nec ;then
     15178    version_type=linux # correct to gnu/linux during the next big refactor
     15179    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     15180    soname_spec='$libname${shared_ext}.$major'
     15181    shlibpath_var=LD_LIBRARY_PATH
     15182  fi
     15183  ;;
     15184
     15185sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
     15186  version_type=freebsd-elf
     15187  need_lib_prefix=no
     15188  need_version=no
     15189  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
     15190  soname_spec='${libname}${release}${shared_ext}$major'
     15191  shlibpath_var=LD_LIBRARY_PATH
     15192  shlibpath_overrides_runpath=yes
     15193  hardcode_into_libs=yes
     15194  if test "$with_gnu_ld" = yes; then
     15195    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
     15196  else
     15197    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
     15198    case $host_os in
     15199      sco3.2v5*)
     15200        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
     15201        ;;
     15202    esac
     15203  fi
     15204  sys_lib_dlsearch_path_spec='/usr/lib'
     15205  ;;
     15206
     15207tpf*)
     15208  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
     15209  version_type=linux # correct to gnu/linux during the next big refactor
     15210  need_lib_prefix=no
     15211  need_version=no
     15212  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     15213  shlibpath_var=LD_LIBRARY_PATH
     15214  shlibpath_overrides_runpath=no
     15215  hardcode_into_libs=yes
     15216  ;;
     15217
     15218uts4*)
     15219  version_type=linux # correct to gnu/linux during the next big refactor
     15220  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     15221  soname_spec='${libname}${release}${shared_ext}$major'
     15222  shlibpath_var=LD_LIBRARY_PATH
     15223  ;;
     15224
     15225*)
     15226  dynamic_linker=no
     15227  ;;
     15228esac
     15229{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
     15230$as_echo "$dynamic_linker" >&6; }
     15231test "$dynamic_linker" = no && can_build_shared=no
     15232
     15233variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
     15234if test "$GCC" = yes; then
     15235  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
     15236fi
     15237
     15238if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
     15239  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
     15240fi
     15241if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
     15242  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
     15243fi
     15244
     15245
     15246
     15247
     15248
     15249
     15250
     15251
     15252
     15253
     15254
     15255
     15256
     15257
     15258
     15259
     15260
     15261
     15262
     15263
     15264
     15265
     15266
     15267
     15268
     15269
     15270
     15271
     15272
     15273
     15274
     15275
     15276
     15277
     15278
     15279
     15280
     15281
     15282    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
     15283$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
     15284hardcode_action_CXX=
     15285if test -n "$hardcode_libdir_flag_spec_CXX" ||
     15286   test -n "$runpath_var_CXX" ||
     15287   test "X$hardcode_automatic_CXX" = "Xyes" ; then
     15288
     15289  # We can hardcode non-existent directories.
     15290  if test "$hardcode_direct_CXX" != no &&
     15291     # If the only mechanism to avoid hardcoding is shlibpath_var, we
     15292     # have to relink, otherwise we might link with an installed library
     15293     # when we should be linking with a yet-to-be-installed one
     15294     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
     15295     test "$hardcode_minus_L_CXX" != no; then
     15296    # Linking always hardcodes the temporary library directory.
     15297    hardcode_action_CXX=relink
     15298  else
     15299    # We can link without hardcoding, and we can hardcode nonexisting dirs.
     15300    hardcode_action_CXX=immediate
     15301  fi
     15302else
     15303  # We cannot hardcode anything, or else we can only hardcode existing
     15304  # directories.
     15305  hardcode_action_CXX=unsupported
     15306fi
     15307{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
     15308$as_echo "$hardcode_action_CXX" >&6; }
     15309
     15310if test "$hardcode_action_CXX" = relink ||
     15311   test "$inherit_rpath_CXX" = yes; then
     15312  # Fast installation is not supported
     15313  enable_fast_install=no
     15314elif test "$shlibpath_overrides_runpath" = yes ||
     15315     test "$enable_shared" = no; then
     15316  # Fast installation is not necessary
     15317  enable_fast_install=needless
     15318fi
     15319
     15320
     15321
     15322
     15323
     15324
     15325
     15326  fi # test -n "$compiler"
     15327
     15328  CC=$lt_save_CC
     15329  CFLAGS=$lt_save_CFLAGS
     15330  LDCXX=$LD
     15331  LD=$lt_save_LD
     15332  GCC=$lt_save_GCC
     15333  with_gnu_ld=$lt_save_with_gnu_ld
     15334  lt_cv_path_LDCXX=$lt_cv_path_LD
     15335  lt_cv_path_LD=$lt_save_path_LD
     15336  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
     15337  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
     15338fi # test "$_lt_caught_CXX_error" != yes
     15339
     15340ac_ext=c
     15341ac_cpp='$CPP $CPPFLAGS'
     15342ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     15343ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     15344ac_compiler_gnu=$ac_cv_c_compiler_gnu
     15345
    1138215346
    1138315347
     
    1140715371{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    1140815372$as_echo_n "checking for $ac_word... " >&6; }
    11409 if test "${ac_cv_prog_RC+set}" = set; then :
     15373if ${ac_cv_prog_RC+:} false; then :
    1141015374  $as_echo_n "(cached) " >&6
    1141115375else
     
    1141915383  test -z "$as_dir" && as_dir=.
    1142015384    for ac_exec_ext in '' $ac_executable_extensions; do
    11421   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     15385  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    1142215386    ac_cv_prog_RC="${ac_tool_prefix}windres"
    1142315387    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    1144715411{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    1144815412$as_echo_n "checking for $ac_word... " >&6; }
    11449 if test "${ac_cv_prog_ac_ct_RC+set}" = set; then :
     15413if ${ac_cv_prog_ac_ct_RC+:} false; then :
    1145015414  $as_echo_n "(cached) " >&6
    1145115415else
     
    1145915423  test -z "$as_dir" && as_dir=.
    1146015424    for ac_exec_ext in '' $ac_executable_extensions; do
    11461   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     15425  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    1146215426    ac_cv_prog_ac_ct_RC="windres"
    1146315427    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    1158115545{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
    1158215546$as_echo_n "checking for inline... " >&6; }
    11583 if test "${ac_cv_c_inline+set}" = set; then :
     15547if ${ac_cv_c_inline+:} false; then :
    1158415548  $as_echo_n "(cached) " >&6
    1158515549else
     
    1162115585esac
    1162215586
    11623 if test "x$CC" != xcc; then
    11624   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
    11625 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
    11626 else
    11627   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
    11628 $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
    11629 fi
    11630 set dummy $CC; ac_cc=`$as_echo "$2" |
    11631                       sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
    11632 if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then :
    11633   $as_echo_n "(cached) " >&6
    11634 else
    11635   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    11636 /* end confdefs.h.  */
    11637 
    11638 int
    11639 main ()
    11640 {
    11641 
    11642   ;
    11643   return 0;
    11644 }
    11645 _ACEOF
    11646 # Make sure it works both with $CC and with simple cc.
    11647 # We do the test twice because some compilers refuse to overwrite an
    11648 # existing .o file with -o, though they will create one.
    11649 ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
    11650 rm -f conftest2.*
    11651 if { { case "(($ac_try" in
    11652   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    11653   *) ac_try_echo=$ac_try;;
    11654 esac
    11655 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
    11656 $as_echo "$ac_try_echo"; } >&5
    11657   (eval "$ac_try") 2>&5
    11658   ac_status=$?
    11659   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    11660   test $ac_status = 0; } &&
    11661    test -f conftest2.$ac_objext && { { case "(($ac_try" in
    11662   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    11663   *) ac_try_echo=$ac_try;;
    11664 esac
    11665 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
    11666 $as_echo "$ac_try_echo"; } >&5
    11667   (eval "$ac_try") 2>&5
    11668   ac_status=$?
    11669   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    11670   test $ac_status = 0; };
    11671 then
    11672   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
    11673   if test "x$CC" != xcc; then
    11674     # Test first that cc exists at all.
    11675     if { ac_try='cc -c conftest.$ac_ext >&5'
    11676   { { case "(($ac_try" in
    11677   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    11678   *) ac_try_echo=$ac_try;;
    11679 esac
    11680 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
    11681 $as_echo "$ac_try_echo"; } >&5
    11682   (eval "$ac_try") 2>&5
    11683   ac_status=$?
    11684   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    11685   test $ac_status = 0; }; }; then
    11686       ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
    11687       rm -f conftest2.*
    11688       if { { case "(($ac_try" in
    11689   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    11690   *) ac_try_echo=$ac_try;;
    11691 esac
    11692 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
    11693 $as_echo "$ac_try_echo"; } >&5
    11694   (eval "$ac_try") 2>&5
    11695   ac_status=$?
    11696   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    11697   test $ac_status = 0; } &&
    11698          test -f conftest2.$ac_objext && { { case "(($ac_try" in
    11699   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    11700   *) ac_try_echo=$ac_try;;
    11701 esac
    11702 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
    11703 $as_echo "$ac_try_echo"; } >&5
    11704   (eval "$ac_try") 2>&5
    11705   ac_status=$?
    11706   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    11707   test $ac_status = 0; };
    11708       then
    11709         # cc works too.
    11710         :
    11711       else
    11712         # cc exists but doesn't like -o.
    11713         eval ac_cv_prog_cc_${ac_cc}_c_o=no
    11714       fi
    11715     fi
    11716   fi
    11717 else
    11718   eval ac_cv_prog_cc_${ac_cc}_c_o=no
    11719 fi
    11720 rm -f core conftest*
    11721 
    11722 fi
    11723 if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
    11724   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
    11725 $as_echo "yes" >&6; }
    11726 else
    11727   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    11728 $as_echo "no" >&6; }
    11729 
    11730 $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
    11731 
    11732 fi
    11733 
    11734 # FIXME: we rely on the cache variable name because
    11735 # there is no other way.
    11736 set dummy $CC
    11737 am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
    11738 eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
    11739 if test "$am_t" != yes; then
    11740    # Losing compiler, so override with the script.
    11741    # FIXME: It is wrong to rewrite CC.
    11742    # But if we don't then we get into trouble of one sort or another.
    11743    # A longer-term fix would be to have automake use am__CC in this case,
    11744    # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
    11745    CC="$am_aux_dir/compile $CC"
    11746 fi
    11747 
    1174815587
    1174915588
     
    1175515594{ $as_echo "$as_me:${as_lineno-$LINENO}: checking operating system" >&5
    1175615595$as_echo_n "checking operating system... " >&6; }
     15596
    1175715597case $host in
    11758 *-linux*)
     15598*-linux-android*)
     15599        { $as_echo "$as_me:${as_lineno-$LINENO}: result: This is a Linux-Android system" >&5
     15600$as_echo "This is a Linux-Android system" >&6; }
     15601        is_backend_android="yes"
     15602        ;;
     15603*)
     15604        is_backend_android="no"
     15605esac
     15606
     15607case $host in
     15608*-linux* | *-uclinux*)
    1175915609        { $as_echo "$as_me:${as_lineno-$LINENO}: result: Linux" >&5
    1176015610$as_echo "Linux" >&6; }
    1176115611        backend="linux"
     15612        threads="posix"
    1176215613        ;;
    1176315614*-darwin*)
     
    1176515616$as_echo "Darwin/Mac OS X" >&6; }
    1176615617        backend="darwin"
     15618        threads="posix"
    1176715619        ;;
    1176815620*-openbsd*)
     
    1177015622$as_echo "OpenBSD" >&6; }
    1177115623        backend="openbsd"
     15624        threads="posix"
    1177215625        ;;
    1177315626*-netbsd*)
    11774         { $as_echo "$as_me:${as_lineno-$LINENO}: result: NetBSD (using OpenBSD backend)" >&5
    11775 $as_echo "NetBSD (using OpenBSD backend)" >&6; }
    11776         backend="openbsd"
     15627        { $as_echo "$as_me:${as_lineno-$LINENO}: result: NetBSD" >&5
     15628$as_echo "NetBSD" >&6; }
     15629        backend="netbsd"
     15630        threads="posix"
    1177715631        ;;
    11778 *-mingw*)
     15632*-mingw* | *msys*)
    1177915633        { $as_echo "$as_me:${as_lineno-$LINENO}: result: Windows" >&5
    1178015634$as_echo "Windows" >&6; }
    1178115635        backend="windows"
    11782         ;;
    11783 *-os2-emx*)
    11784         { $as_echo "$as_me:${as_lineno-$LINENO}: result: OS2" >&5
    11785 $as_echo "OS2" >&6; }
    11786         backend="os2"
     15636        threads="windows"
     15637        create_import_lib="yes"
     15638        AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
    1178715639        ;;
    1178815640*-cygwin*)
     
    1179215644        threads="posix"
    1179315645        ;;
     15646*-haiku*)
     15647        { $as_echo "$as_me:${as_lineno-$LINENO}: result: Haiku" >&5
     15648$as_echo "Haiku" >&6; }
     15649        backend="haiku"
     15650        threads="posix"
     15651        ;;
     15652*-solaris*)
     15653        { $as_echo "$as_me:${as_lineno-$LINENO}: result: SunOS" >&5
     15654$as_echo "SunOS" >&6; }
     15655        backend="sunos"
     15656        threads="posix"
     15657        ;;
    1179415658*)
    11795         as_fn_error "unsupported operating system" "$LINENO" 5
     15659        as_fn_error $? "unsupported operating system $host" "$LINENO" 5
    1179615660esac
     15661
    1179715662case $backend in
    1179815663linux)
     
    1180115666
    1180215667
    11803         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
    11804 $as_echo_n "checking for clock_gettime in -lrt... " >&6; }
    11805 if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then :
     15668        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
     15669$as_echo_n "checking for library containing clock_gettime... " >&6; }
     15670if ${ac_cv_search_clock_gettime+:} false; then :
    1180615671  $as_echo_n "(cached) " >&6
    1180715672else
    11808   ac_check_lib_save_LIBS=$LIBS
    11809 LIBS="-lrt  $LIBS"
     15673  ac_func_search_save_LIBS=$LIBS
    1181015674cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1181115675/* end confdefs.h.  */
     
    1182615690}
    1182715691_ACEOF
    11828 if ac_fn_c_try_link "$LINENO"; then :
    11829   ac_cv_lib_rt_clock_gettime=yes
    11830 else
    11831   ac_cv_lib_rt_clock_gettime=no
     15692for ac_lib in '' rt; do
     15693  if test -z "$ac_lib"; then
     15694    ac_res="none required"
     15695  else
     15696    ac_res=-l$ac_lib
     15697    LIBS="-l$ac_lib -pthread $ac_func_search_save_LIBS"
     15698  fi
     15699  if ac_fn_c_try_link "$LINENO"; then :
     15700  ac_cv_search_clock_gettime=$ac_res
    1183215701fi
    1183315702rm -f core conftest.err conftest.$ac_objext \
    11834     conftest$ac_exeext conftest.$ac_ext
    11835 LIBS=$ac_check_lib_save_LIBS
    11836 fi
    11837 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
    11838 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
    11839 if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then :
    11840   PC_LIBS_PRIVATE="-lrt"
     15703    conftest$ac_exeext
     15704  if ${ac_cv_search_clock_gettime+:} false; then :
     15705  break
     15706fi
     15707done
     15708if ${ac_cv_search_clock_gettime+:} false; then :
     15709
     15710else
     15711  ac_cv_search_clock_gettime=no
     15712fi
     15713rm conftest.$ac_ext
     15714LIBS=$ac_func_search_save_LIBS
     15715fi
     15716{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
     15717$as_echo "$ac_cv_search_clock_gettime" >&6; }
     15718ac_res=$ac_cv_search_clock_gettime
     15719if test "$ac_res" != no; then :
     15720  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
     15721
    1184115722fi
    1184215723
     
    1184815729fi
    1184915730
    11850         if test "x$enable_udev" = "xyes" ; then
    11851                 # system has udev. use it or fail!
    11852                 for ac_header in libudev.h
     15731                if test "x$enable_udev" = "xyes" ; then
     15732                        # system has udev. use it or fail!
     15733                        for ac_header in libudev.h
    1185315734do :
    1185415735  ac_fn_c_check_header_mongrel "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default"
    11855 if test "x$ac_cv_header_libudev_h" = x""yes; then :
     15736if test "x$ac_cv_header_libudev_h" = xyes; then :
    1185615737  cat >>confdefs.h <<_ACEOF
    1185715738#define HAVE_LIBUDEV_H 1
     
    1185915740
    1186015741else
    11861   as_fn_error "\"udev support requested but libudev not installed\"" "$LINENO" 5
     15742  as_fn_error $? "\"udev support requested but libudev not installed\"" "$LINENO" 5
    1186215743fi
    1186315744
    1186415745done
    1186515746
    11866                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for udev_new in -ludev" >&5
     15747                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for udev_new in -ludev" >&5
    1186715748$as_echo_n "checking for udev_new in -ludev... " >&6; }
    11868 if test "${ac_cv_lib_udev_udev_new+set}" = set; then :
     15749if ${ac_cv_lib_udev_udev_new+:} false; then :
    1186915750  $as_echo_n "(cached) " >&6
    1187015751else
     
    1190015781{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_new" >&5
    1190115782$as_echo "$ac_cv_lib_udev_udev_new" >&6; }
    11902 if test "x$ac_cv_lib_udev_udev_new" = x""yes; then :
     15783if test "x$ac_cv_lib_udev_udev_new" = xyes; then :
    1190315784  cat >>confdefs.h <<_ACEOF
    1190415785#define HAVE_LIBUDEV 1
     
    1190815789
    1190915790else
    11910   as_fn_error "\"udev support requested but libudev not installed\"" "$LINENO" 5
     15791  as_fn_error $? "\"udev support requested but libudev not installed\"" "$LINENO" 5
    1191115792fi
    1191215793
     
    1191415795$as_echo "#define USE_UDEV 1" >>confdefs.h
    1191515796
    11916         else
    11917                 for ac_header in linux/netlink.h linux/filter.h
     15797                else
     15798                        for ac_header in asm/types.h
     15799do :
     15800  ac_fn_c_check_header_mongrel "$LINENO" "asm/types.h" "ac_cv_header_asm_types_h" "$ac_includes_default"
     15801if test "x$ac_cv_header_asm_types_h" = xyes; then :
     15802  cat >>confdefs.h <<_ACEOF
     15803#define HAVE_ASM_TYPES_H 1
     15804_ACEOF
     15805
     15806fi
     15807
     15808done
     15809
     15810                        for ac_header in sys/socket.h linux/netlink.h
    1191815811do :
    1191915812  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
    11920 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
    11921 eval as_val=\$$as_ac_Header
    11922    if test "x$as_val" = x""yes; then :
     15813ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
     15814#ifdef HAVE_ASM_TYPES_H
     15815#include <asm/types.h>
     15816#endif
     15817#include <sys/socket.h>
     15818
     15819"
     15820if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
    1192315821  cat >>confdefs.h <<_ACEOF
    1192415822#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
     
    1192615824
    1192715825else
    11928   as_fn_error "\"Linux netlink headers not found\"" "$LINENO" 5
     15826  as_fn_error $? "\"Linux netlink headers not found\"" "$LINENO" 5
    1192915827fi
    1193015828
    1193115829done
    1193215830
    11933         fi
    11934 
    11935         threads="posix"
     15831                fi
     15832
     15833
     15834case $is_backend_android in
     15835yes)
     15836
     15837$as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h
     15838
     15839        ;;
     15840*)
    1193615841        THREAD_CFLAGS="-pthread"
    11937         PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
     15842        LIBS="${LIBS} -pthread"
     15843esac
     15844
    1193815845        for ac_header in poll.h
    1193915846do :
    1194015847  ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default"
    11941 if test "x$ac_cv_header_poll_h" = x""yes; then :
     15848if test "x$ac_cv_header_poll_h" = xyes; then :
    1194215849  cat >>confdefs.h <<_ACEOF
    1194315850#define HAVE_POLL_H 1
     
    1195715864
    1195815865
    11959         threads="posix"
    11960         PC_LIBS_PRIVATE="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
     15866        LIBS="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
    1196115867        LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
    1196215868        for ac_header in poll.h
    1196315869do :
    1196415870  ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default"
    11965 if test "x$ac_cv_header_poll_h" = x""yes; then :
     15871if test "x$ac_cv_header_poll_h" = xyes; then :
    1196615872  cat >>confdefs.h <<_ACEOF
    1196715873#define HAVE_POLL_H 1
     
    1197415880        ac_fn_c_check_type "$LINENO" "nfds_t" "ac_cv_type_nfds_t" "#include <poll.h>
    1197515881"
    11976 if test "x$ac_cv_type_nfds_t" = x""yes; then :
     15882if test "x$ac_cv_type_nfds_t" = xyes; then :
    1197715883
    1197815884$as_echo "#define POLL_NFDS_TYPE nfds_t" >>confdefs.h
     
    1199015896
    1199115897
    11992         threads="posix"
    1199315898        THREAD_CFLAGS="-pthread"
    11994         PC_LIBS_PRIVATE="-pthread"
     15899        LIBS="-pthread"
    1199515900        for ac_header in poll.h
    1199615901do :
    1199715902  ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default"
    11998 if test "x$ac_cv_header_poll_h" = x""yes; then :
     15903if test "x$ac_cv_header_poll_h" = xyes; then :
    1199915904  cat >>confdefs.h <<_ACEOF
    1200015905#define HAVE_POLL_H 1
     
    1200915914
    1201015915        ;;
     15916sunos)
     15917
     15918$as_echo "#define OS_SUNOS 1" >>confdefs.h
     15919
     15920
     15921        THREAD_CFLAGS="-pthread"
     15922        LIBS="-pthread -ldevinfo"
     15923        for ac_header in poll.h
     15924do :
     15925  ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default"
     15926if test "x$ac_cv_header_poll_h" = xyes; then :
     15927  cat >>confdefs.h <<_ACEOF
     15928#define HAVE_POLL_H 1
     15929_ACEOF
     15930
     15931fi
     15932
     15933done
     15934
     15935
     15936$as_echo "#define POLL_NFDS_TYPE nfds_t" >>confdefs.h
     15937
     15938        ;;
     15939netbsd)
     15940
     15941$as_echo "#define OS_NETBSD 1" >>confdefs.h
     15942
     15943
     15944        THREAD_CFLAGS="-pthread"
     15945        LIBS="-pthread"
     15946        for ac_header in poll.h
     15947do :
     15948  ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default"
     15949if test "x$ac_cv_header_poll_h" = xyes; then :
     15950  cat >>confdefs.h <<_ACEOF
     15951#define HAVE_POLL_H 1
     15952_ACEOF
     15953
     15954fi
     15955
     15956done
     15957
     15958
     15959$as_echo "#define POLL_NFDS_TYPE nfds_t" >>confdefs.h
     15960
     15961        ;;
    1201115962windows)
    1201215963
     
    1201415965
    1201515966
    12016         PC_LIBS_PRIVATE=""
     15967        LIBS=""
    1201715968        LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
    1201815969
    1201915970$as_echo "#define POLL_NFDS_TYPE unsigned int" >>confdefs.h
    1202015971
     15972
     15973$as_echo "#define WINVER 0x0501" >>confdefs.h
     15974
     15975
     15976        # Check whether --enable-usbdk was given.
     15977if test "${enable_usbdk+set}" = set; then :
     15978  enableval=$enable_usbdk;
     15979else
     15980  enable_usbdk="no"
     15981fi
     15982
     15983                if test "x$enable_usbdk" = "xyes" ; then
     15984
     15985$as_echo "#define USE_USBDK 1" >>confdefs.h
     15986
     15987                fi
     15988
    1202115989        ;;
    12022 os2)
    12023 
    12024 $as_echo "#define OS_OS2 1" >>confdefs.h
    12025 
    12026 
    12027         threads="posix"
    12028         PC_LIBS_PRIVATE="-lpthread"
    12029 
    12030 $as_echo "#define POLL_NFDS_TYPE unsigned int" >>confdefs.h
     15990haiku)
     15991
     15992$as_echo "#define OS_HAIKU 1" >>confdefs.h
     15993
     15994
     15995        LIBS="${LIBS} -lbe"
     15996        for ac_header in poll.h
     15997do :
     15998  ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default"
     15999if test "x$ac_cv_header_poll_h" = xyes; then :
     16000  cat >>confdefs.h <<_ACEOF
     16001#define HAVE_POLL_H 1
     16002_ACEOF
     16003
     16004fi
     16005
     16006done
     16007
     16008
     16009$as_echo "#define POLL_NFDS_TYPE nfds_t" >>confdefs.h
    1203116010
    1203216011        ;;
     
    1203416013
    1203516014
    12036 LIBS="${LIBS} ${PC_LIBS_PRIVATE}"
    1203716015
    1203816016 if test "x$backend" = xlinux; then
     
    1206016038fi
    1206116039
     16040 if test "x$backend" = xsunos; then
     16041  OS_SUNOS_TRUE=
     16042  OS_SUNOS_FALSE='#'
     16043else
     16044  OS_SUNOS_TRUE='#'
     16045  OS_SUNOS_FALSE=
     16046fi
     16047
     16048 if test "x$backend" = xnetbsd; then
     16049  OS_NETBSD_TRUE=
     16050  OS_NETBSD_FALSE='#'
     16051else
     16052  OS_NETBSD_TRUE='#'
     16053  OS_NETBSD_FALSE=
     16054fi
     16055
    1206216056 if test "x$backend" = xwindows; then
    1206316057  OS_WINDOWS_TRUE=
     
    1206816062fi
    1206916063
    12070  if test "x$backend" = xos2; then
    12071   OS_OS2_TRUE=
    12072   OS_OS2_FALSE='#'
    12073 else
    12074   OS_OS2_TRUE='#'
    12075   OS_OS2_FALSE=
     16064 if test "x$backend" = xhaiku; then
     16065  OS_HAIKU_TRUE=
     16066  OS_HAIKU_FALSE='#'
     16067else
     16068  OS_HAIKU_TRUE='#'
     16069  OS_HAIKU_FALSE=
    1207616070fi
    1207716071
     
    1208416078fi
    1208516079
     16080 if test "x$create_import_lib" = "xyes"; then
     16081  CREATE_IMPORT_LIB_TRUE=
     16082  CREATE_IMPORT_LIB_FALSE='#'
     16083else
     16084  CREATE_IMPORT_LIB_TRUE='#'
     16085  CREATE_IMPORT_LIB_FALSE=
     16086fi
     16087
    1208616088 if test "x$enable_udev" = xyes; then
    1208716089  USE_UDEV_TRUE=
     
    1209216094fi
    1209316095
     16096 if test "x$enable_usbdk" = xyes; then
     16097  USE_USBDK_TRUE=
     16098  USE_USBDK_FALSE='#'
     16099else
     16100  USE_USBDK_TRUE='#'
     16101  USE_USBDK_FALSE=
     16102fi
     16103
    1209416104if test "$threads" = posix; then
    1209516105
     
    1210016110# timerfd
    1210116111ac_fn_c_check_header_mongrel "$LINENO" "sys/timerfd.h" "ac_cv_header_sys_timerfd_h" "$ac_includes_default"
    12102 if test "x$ac_cv_header_sys_timerfd_h" = x""yes; then :
     16112if test "x$ac_cv_header_sys_timerfd_h" = xyes; then :
    1210316113  timerfd_h=1
    1210416114else
     
    1211616126
    1211716127if test "x$use_timerfd" = "xyes" -a "x$timerfd_h" = "x0"; then
    12118         as_fn_error "timerfd header not available; glibc 2.9+ required" "$LINENO" 5
     16128        as_fn_error $? "timerfd header not available; glibc 2.9+ required" "$LINENO" 5
    1211916129fi
    1212016130
    1212116131ac_fn_c_check_decl "$LINENO" "TFD_NONBLOCK" "ac_cv_have_decl_TFD_NONBLOCK" "#include <sys/timerfd.h>
    1212216132"
    12123 if test "x$ac_cv_have_decl_TFD_NONBLOCK" = x""yes; then :
     16133if test "x$ac_cv_have_decl_TFD_NONBLOCK" = xyes; then :
    1212416134  tfd_hdr_ok=yes
    1212516135else
     
    1212816138
    1212916139if test "x$use_timerfd" = "xyes" -a "x$tfd_hdr_ok" = "xno"; then
    12130         as_fn_error "timerfd header not usable; glibc 2.9+ required" "$LINENO" 5
     16140        as_fn_error $? "timerfd header not usable; glibc 2.9+ required" "$LINENO" 5
    1213116141fi
    1213216142
     
    1215016160
    1215116161ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "$ac_includes_default"
    12152 if test "x$ac_cv_type_struct_timespec" = x""yes; then :
     16162if test "x$ac_cv_type_struct_timespec" = xyes; then :
    1215316163
    1215416164cat >>confdefs.h <<_ACEOF
     
    1218716197fi
    1218816198
     16199# Check whether --enable-system-log was given.
     16200if test "${enable_system_log+set}" = set; then :
     16201  enableval=$enable_system_log; system_log_enabled=$enableval
     16202else
     16203  system_log_enabled='no'
     16204fi
     16205
     16206if test "x$system_log_enabled" != "xno"; then
     16207
     16208$as_echo "#define USE_SYSTEM_LOGGING_FACILITY 1" >>confdefs.h
     16209
     16210fi
     16211
     16212# Check if syslog is available in standard C library
     16213for ac_header in syslog.h
     16214do :
     16215  ac_fn_c_check_header_mongrel "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default"
     16216if test "x$ac_cv_header_syslog_h" = xyes; then :
     16217  cat >>confdefs.h <<_ACEOF
     16218#define HAVE_SYSLOG_H 1
     16219_ACEOF
     16220
     16221fi
     16222
     16223done
     16224
     16225ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog"
     16226if test "x$ac_cv_func_syslog" = xyes; then :
     16227  have_syslog=yes
     16228else
     16229  have_syslog=no
     16230fi
     16231
     16232if test "x$have_syslog" != "xno"; then
     16233
     16234$as_echo "#define HAVE_SYSLOG_FUNC 1" >>confdefs.h
     16235
     16236fi
     16237
    1218916238# Examples build
    1219016239# Check whether --enable-examples-build was given.
     
    1220116250  BUILD_EXAMPLES_TRUE='#'
    1220216251  BUILD_EXAMPLES_FALSE=
     16252fi
     16253
     16254
     16255# Tests build
     16256# Check whether --enable-tests-build was given.
     16257if test "${enable_tests_build+set}" = set; then :
     16258  enableval=$enable_tests_build; build_tests=$enableval
     16259else
     16260  build_tests='no'
     16261fi
     16262
     16263 if test "x$build_tests" != "xno"; then
     16264  BUILD_TESTS_TRUE=
     16265  BUILD_TESTS_FALSE='#'
     16266else
     16267  BUILD_TESTS_TRUE='#'
     16268  BUILD_TESTS_FALSE=
    1220316269fi
    1220416270
     
    1225716323# sigaction not available on MinGW
    1225816324ac_fn_c_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction"
    12259 if test "x$ac_cv_func_sigaction" = x""yes; then :
     16325if test "x$ac_cv_func_sigaction" = xyes; then :
    1226016326  have_sigaction=yes
    1226116327else
     
    1227616342do :
    1227716343  ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default"
    12278 if test "x$ac_cv_header_sys_time_h" = x""yes; then :
     16344if test "x$ac_cv_header_sys_time_h" = xyes; then :
    1227916345  cat >>confdefs.h <<_ACEOF
    1228016346#define HAVE_SYS_TIME_H 1
     
    1228816354do :
    1228916355  ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday"
    12290 if test "x$ac_cv_func_gettimeofday" = x""yes; then :
     16356if test "x$ac_cv_func_gettimeofday" = xyes; then :
    1229116357  cat >>confdefs.h <<_ACEOF
    1229216358#define HAVE_GETTIMEOFDAY 1
     
    1229616362done
    1229716363
    12298 
    12299 AM_CFLAGS="-std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
    12300 
     16364for ac_header in signal.h
     16365do :
     16366  ac_fn_c_check_header_mongrel "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default"
     16367if test "x$ac_cv_header_signal_h" = xyes; then :
     16368  cat >>confdefs.h <<_ACEOF
     16369#define HAVE_SIGNAL_H 1
     16370_ACEOF
     16371
     16372fi
     16373
     16374done
     16375
     16376
     16377# check for -std=gnu99 compiler support
     16378saved_cflags="$CFLAGS"
     16379CFLAGS="-std=gnu99"
     16380{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CC supports -std=gnu99" >&5
     16381$as_echo_n "checking whether CC supports -std=gnu99... " >&6; }
     16382cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     16383/* end confdefs.h.  */
     16384
     16385int
     16386main ()
     16387{
     16388
     16389  ;
     16390  return 0;
     16391}
     16392_ACEOF
     16393if ac_fn_c_try_compile "$LINENO"; then :
     16394  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     16395$as_echo "yes" >&6; }
     16396    AM_CFLAGS="${AM_CFLAGS} -std=gnu99"
     16397else
     16398  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     16399$as_echo "no" >&6; }
     16400
     16401fi
     16402rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     16403CFLAGS="$saved_cflags"
     16404
     16405AM_CFLAGS="${AM_CFLAGS} -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow ${THREAD_CFLAGS} ${VISIBILITY_CFLAGS}"
    1230116406
    1230216407
     
    1231016415
    1231116416ac_config_files="$ac_config_files examples/Makefile"
     16417
     16418ac_config_files="$ac_config_files tests/Makefile"
    1231216419
    1231316420ac_config_files="$ac_config_files doc/Makefile"
     
    1237916486if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
    1238016487  if test -w "$cache_file"; then
    12381     test "x$cache_file" != "x/dev/null" &&
     16488    if test "x$cache_file" != "x/dev/null"; then
    1238216489      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
    1238316490$as_echo "$as_me: updating cache $cache_file" >&6;}
    12384     cat confcache >$cache_file
     16491      if test ! -f "$cache_file" || test -h "$cache_file"; then
     16492        cat confcache >"$cache_file"
     16493      else
     16494        case $cache_file in #(
     16495        */* | ?:*)
     16496          mv -f confcache "$cache_file"$$ &&
     16497          mv -f "$cache_file"$$ "$cache_file" ;; #(
     16498        *)
     16499          mv -f confcache "$cache_file" ;;
     16500        esac
     16501      fi
     16502    fi
    1238516503  else
    1238616504    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
     
    1239816516ac_libobjs=
    1239916517ac_ltlibobjs=
     16518U=
    1240016519for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
    1240116520  # 1. Remove the extension, and $U if already installed.
     
    1241216531
    1241316532
     16533{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
     16534$as_echo_n "checking that generated files are newer than configure... " >&6; }
     16535   if test -n "$am_sleep_pid"; then
     16536     # Hide warnings about reused PIDs.
     16537     wait $am_sleep_pid 2>/dev/null
     16538   fi
     16539   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
     16540$as_echo "done" >&6; }
    1241416541 if test -n "$EXEEXT"; then
    1241516542  am__EXEEXT_TRUE=
     
    1242016547fi
    1242116548
    12422 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
    12423   as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
     16549if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
     16550  as_fn_error $? "conditional \"AMDEP\" was never defined.
    1242416551Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1242516552fi
    12426 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
    12427   as_fn_error "conditional \"AMDEP\" was never defined.
     16553if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
     16554  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
    1242816555Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1242916556fi
    12430 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
    12431   as_fn_error "conditional \"am__fastdepCC\" was never defined.
     16557if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
     16558  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
    1243216559Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1243316560fi
    1243416561if test -z "${OS_LINUX_TRUE}" && test -z "${OS_LINUX_FALSE}"; then
    12435   as_fn_error "conditional \"OS_LINUX\" was never defined.
     16562  as_fn_error $? "conditional \"OS_LINUX\" was never defined.
    1243616563Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1243716564fi
    1243816565if test -z "${OS_DARWIN_TRUE}" && test -z "${OS_DARWIN_FALSE}"; then
    12439   as_fn_error "conditional \"OS_DARWIN\" was never defined.
     16566  as_fn_error $? "conditional \"OS_DARWIN\" was never defined.
    1244016567Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1244116568fi
    1244216569if test -z "${OS_OPENBSD_TRUE}" && test -z "${OS_OPENBSD_FALSE}"; then
    12443   as_fn_error "conditional \"OS_OPENBSD\" was never defined.
     16570  as_fn_error $? "conditional \"OS_OPENBSD\" was never defined.
    1244416571Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1244516572fi
     16573if test -z "${OS_SUNOS_TRUE}" && test -z "${OS_SUNOS_FALSE}"; then
     16574  as_fn_error $? "conditional \"OS_SUNOS\" was never defined.
     16575Usually this means the macro was only invoked conditionally." "$LINENO" 5
     16576fi
     16577if test -z "${OS_NETBSD_TRUE}" && test -z "${OS_NETBSD_FALSE}"; then
     16578  as_fn_error $? "conditional \"OS_NETBSD\" was never defined.
     16579Usually this means the macro was only invoked conditionally." "$LINENO" 5
     16580fi
    1244616581if test -z "${OS_WINDOWS_TRUE}" && test -z "${OS_WINDOWS_FALSE}"; then
    12447   as_fn_error "conditional \"OS_WINDOWS\" was never defined.
     16582  as_fn_error $? "conditional \"OS_WINDOWS\" was never defined.
    1244816583Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1244916584fi
    12450 if test -z "${OS_OS2_TRUE}" && test -z "${OS_OS2_FALSE}"; then
    12451   as_fn_error "conditional \"OS_OS2\" was never defined.
     16585if test -z "${OS_HAIKU_TRUE}" && test -z "${OS_HAIKU_FALSE}"; then
     16586  as_fn_error $? "conditional \"OS_HAIKU\" was never defined.
    1245216587Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1245316588fi
    1245416589if test -z "${THREADS_POSIX_TRUE}" && test -z "${THREADS_POSIX_FALSE}"; then
    12455   as_fn_error "conditional \"THREADS_POSIX\" was never defined.
     16590  as_fn_error $? "conditional \"THREADS_POSIX\" was never defined.
    1245616591Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1245716592fi
     16593if test -z "${CREATE_IMPORT_LIB_TRUE}" && test -z "${CREATE_IMPORT_LIB_FALSE}"; then
     16594  as_fn_error $? "conditional \"CREATE_IMPORT_LIB\" was never defined.
     16595Usually this means the macro was only invoked conditionally." "$LINENO" 5
     16596fi
    1245816597if test -z "${USE_UDEV_TRUE}" && test -z "${USE_UDEV_FALSE}"; then
    12459   as_fn_error "conditional \"USE_UDEV\" was never defined.
     16598  as_fn_error $? "conditional \"USE_UDEV\" was never defined.
    1246016599Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1246116600fi
     16601if test -z "${USE_USBDK_TRUE}" && test -z "${USE_USBDK_FALSE}"; then
     16602  as_fn_error $? "conditional \"USE_USBDK\" was never defined.
     16603Usually this means the macro was only invoked conditionally." "$LINENO" 5
     16604fi
    1246216605if test -z "${BUILD_EXAMPLES_TRUE}" && test -z "${BUILD_EXAMPLES_FALSE}"; then
    12463   as_fn_error "conditional \"BUILD_EXAMPLES\" was never defined.
     16606  as_fn_error $? "conditional \"BUILD_EXAMPLES\" was never defined.
    1246416607Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1246516608fi
     16609if test -z "${BUILD_TESTS_TRUE}" && test -z "${BUILD_TESTS_FALSE}"; then
     16610  as_fn_error $? "conditional \"BUILD_TESTS\" was never defined.
     16611Usually this means the macro was only invoked conditionally." "$LINENO" 5
     16612fi
    1246616613if test -z "${HAVE_SIGACTION_TRUE}" && test -z "${HAVE_SIGACTION_FALSE}"; then
    12467   as_fn_error "conditional \"HAVE_SIGACTION\" was never defined.
     16614  as_fn_error $? "conditional \"HAVE_SIGACTION\" was never defined.
    1246816615Usually this means the macro was only invoked conditionally." "$LINENO" 5
    1246916616fi
    1247016617
    12471 : ${CONFIG_STATUS=./config.status}
     16618: "${CONFIG_STATUS=./config.status}"
    1247216619ac_write_fail=0
    1247316620ac_clean_files_save=$ac_clean_files
     
    1257016717
    1257116718# Find who we are.  Look in the path if we contain no directory separator.
     16719as_myself=
    1257216720case $0 in #((
    1257316721  *[\\/]* ) as_myself=$0 ;;
     
    1261516763
    1261616764
    12617 # as_fn_error ERROR [LINENO LOG_FD]
    12618 # ---------------------------------
     16765# as_fn_error STATUS ERROR [LINENO LOG_FD]
     16766# ----------------------------------------
    1261916767# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
    1262016768# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
    12621 # script with status $?, using 1 if that was 0.
     16769# script with STATUS, using 1 if that was 0.
    1262216770as_fn_error ()
    1262316771{
    12624   as_status=$?; test $as_status -eq 0 && as_status=1
    12625   if test "$3"; then
    12626     as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    12627     $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
     16772  as_status=$1; test $as_status -eq 0 && as_status=1
     16773  if test "$4"; then
     16774    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
     16775    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
    1262816776  fi
    12629   $as_echo "$as_me: error: $1" >&2
     16777  $as_echo "$as_me: error: $2" >&2
    1263016778  as_fn_exit $as_status
    1263116779} # as_fn_error
     
    1276516913    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    1276616914    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    12767     # In both cases, we have to default to `cp -p'.
     16915    # In both cases, we have to default to `cp -pR'.
    1276816916    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
    12769       as_ln_s='cp -p'
     16917      as_ln_s='cp -pR'
    1277016918  elif ln conf$$.file conf$$ 2>/dev/null; then
    1277116919    as_ln_s=ln
    1277216920  else
    12773     as_ln_s='cp -p'
     16921    as_ln_s='cp -pR'
    1277416922  fi
    1277516923else
    12776   as_ln_s='cp -p'
     16924  as_ln_s='cp -pR'
    1277716925fi
    1277816926rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
     
    1282316971    done
    1282416972    test -z "$as_dirs" || eval "mkdir $as_dirs"
    12825   } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
     16973  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
    1282616974
    1282716975
     
    1283416982fi
    1283516983
    12836 if test -x / >/dev/null 2>&1; then
    12837   as_test_x='test -x'
    12838 else
    12839   if ls -dL / >/dev/null 2>&1; then
    12840     as_ls_L_option=L
    12841   else
    12842     as_ls_L_option=
    12843   fi
    12844   as_test_x='
    12845     eval sh -c '\''
    12846       if test -d "$1"; then
    12847         test -d "$1/.";
    12848       else
    12849         case $1 in #(
    12850         -*)set "./$1";;
    12851         esac;
    12852         case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
    12853         ???[sx]*):;;*)false;;esac;fi
    12854     '\'' sh
    12855   '
    12856 fi
    12857 as_executable_p=$as_test_x
     16984
     16985# as_fn_executable_p FILE
     16986# -----------------------
     16987# Test if FILE is an executable regular file.
     16988as_fn_executable_p ()
     16989{
     16990  test -f "$1" && test -x "$1"
     16991} # as_fn_executable_p
     16992as_test_x='test -x'
     16993as_executable_p=as_fn_executable_p
    1285816994
    1285916995# Sed expression to map a string onto a valid CPP name.
     
    1287617012# values after options handling.
    1287717013ac_log="
    12878 This file was extended by libusb $as_me 1.0.16-rc6, which was
    12879 generated by GNU Autoconf 2.64.  Invocation command line was
     17014This file was extended by libusb $as_me 1.0.21, which was
     17015generated by GNU Autoconf 2.69.  Invocation command line was
    1288017016
    1288117017  CONFIG_FILES    = $CONFIG_FILES
     
    1291717053  -h, --help       print this help, then exit
    1291817054  -V, --version    print version number and configuration settings, then exit
     17055      --config     print configuration, then exit
    1291917056  -q, --quiet, --silent
    1292017057                   do not print progress messages
     
    1293617073
    1293717074Report bugs to <libusb-devel@lists.sourceforge.net>.
    12938 libusb home page: <http://www.libusb.org/>."
     17075libusb home page: <http://libusb.info>."
    1293917076
    1294017077_ACEOF
    1294117078cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
     17079ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
    1294217080ac_cs_version="\\
    12943 libusb config.status 1.0.16-rc6
    12944 configured by $0, generated by GNU Autoconf 2.64,
    12945   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
    12946 
    12947 Copyright (C) 2009 Free Software Foundation, Inc.
     17081libusb config.status 1.0.21
     17082configured by $0, generated by GNU Autoconf 2.69,
     17083  with options \\"\$ac_cs_config\\"
     17084
     17085Copyright (C) 2012 Free Software Foundation, Inc.
    1294817086This config.status script is free software; the Free Software Foundation
    1294917087gives unlimited permission to copy, distribute and modify it."
     
    1296317101do
    1296417102  case $1 in
    12965   --*=*)
     17103  --*=?*)
    1296617104    ac_option=`expr "X$1" : 'X\([^=]*\)='`
    1296717105    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     17106    ac_shift=:
     17107    ;;
     17108  --*=)
     17109    ac_option=`expr "X$1" : 'X\([^=]*\)='`
     17110    ac_optarg=
    1296817111    ac_shift=:
    1296917112    ;;
     
    1298117124  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
    1298217125    $as_echo "$ac_cs_version"; exit ;;
     17126  --config | --confi | --conf | --con | --co | --c )
     17127    $as_echo "$ac_cs_config"; exit ;;
    1298317128  --debug | --debu | --deb | --de | --d | -d )
    1298417129    debug=: ;;
     
    1298717132    case $ac_optarg in
    1298817133    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     17134    '') as_fn_error $? "missing file argument" ;;
    1298917135    esac
    1299017136    as_fn_append CONFIG_FILES " '$ac_optarg'"
     
    1299917145  --he | --h)
    1300017146    # Conflict between --help and --header
    13001     as_fn_error "ambiguous option: \`$1'
     17147    as_fn_error $? "ambiguous option: \`$1'
    1300217148Try \`$0 --help' for more information.";;
    1300317149  --help | --hel | -h )
     
    1300817154
    1300917155  # This is an error.
    13010   -*) as_fn_error "unrecognized option: \`$1'
     17156  -*) as_fn_error $? "unrecognized option: \`$1'
    1301117157Try \`$0 --help' for more information." ;;
    1301217158
     
    1302817174cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
    1302917175if \$ac_cs_recheck; then
    13030   set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
     17176  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
    1303117177  shift
    1303217178  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
     
    1319217338old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
    1319317339striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
     17340compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
     17341predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
     17342postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
     17343predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
     17344postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
     17345compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
     17346LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
    1319417347LD_RC='`$ECHO "$LD_RC" | $SED "$delay_single_quote_subst"`'
     17348reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
    1319517349reload_flag_RC='`$ECHO "$reload_flag_RC" | $SED "$delay_single_quote_subst"`'
     17350reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1319617351reload_cmds_RC='`$ECHO "$reload_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17352old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1319717353old_archive_cmds_RC='`$ECHO "$old_archive_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17354compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
    1319817355compiler_RC='`$ECHO "$compiler_RC" | $SED "$delay_single_quote_subst"`'
     17356GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
    1319917357GCC_RC='`$ECHO "$GCC_RC" | $SED "$delay_single_quote_subst"`'
     17358lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
    1320017359lt_prog_compiler_no_builtin_flag_RC='`$ECHO "$lt_prog_compiler_no_builtin_flag_RC" | $SED "$delay_single_quote_subst"`'
     17360lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
    1320117361lt_prog_compiler_pic_RC='`$ECHO "$lt_prog_compiler_pic_RC" | $SED "$delay_single_quote_subst"`'
     17362lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
    1320217363lt_prog_compiler_wl_RC='`$ECHO "$lt_prog_compiler_wl_RC" | $SED "$delay_single_quote_subst"`'
     17364lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
    1320317365lt_prog_compiler_static_RC='`$ECHO "$lt_prog_compiler_static_RC" | $SED "$delay_single_quote_subst"`'
     17366lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
    1320417367lt_cv_prog_compiler_c_o_RC='`$ECHO "$lt_cv_prog_compiler_c_o_RC" | $SED "$delay_single_quote_subst"`'
     17368archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
    1320517369archive_cmds_need_lc_RC='`$ECHO "$archive_cmds_need_lc_RC" | $SED "$delay_single_quote_subst"`'
     17370enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
    1320617371enable_shared_with_static_runtimes_RC='`$ECHO "$enable_shared_with_static_runtimes_RC" | $SED "$delay_single_quote_subst"`'
     17372export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
    1320717373export_dynamic_flag_spec_RC='`$ECHO "$export_dynamic_flag_spec_RC" | $SED "$delay_single_quote_subst"`'
     17374whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
    1320817375whole_archive_flag_spec_RC='`$ECHO "$whole_archive_flag_spec_RC" | $SED "$delay_single_quote_subst"`'
     17376compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
    1320917377compiler_needs_object_RC='`$ECHO "$compiler_needs_object_RC" | $SED "$delay_single_quote_subst"`'
     17378old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1321017379old_archive_from_new_cmds_RC='`$ECHO "$old_archive_from_new_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17380old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1321117381old_archive_from_expsyms_cmds_RC='`$ECHO "$old_archive_from_expsyms_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17382archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1321217383archive_cmds_RC='`$ECHO "$archive_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17384archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1321317385archive_expsym_cmds_RC='`$ECHO "$archive_expsym_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17386module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1321417387module_cmds_RC='`$ECHO "$module_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17388module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1321517389module_expsym_cmds_RC='`$ECHO "$module_expsym_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17390with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
    1321617391with_gnu_ld_RC='`$ECHO "$with_gnu_ld_RC" | $SED "$delay_single_quote_subst"`'
     17392allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
    1321717393allow_undefined_flag_RC='`$ECHO "$allow_undefined_flag_RC" | $SED "$delay_single_quote_subst"`'
     17394no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
    1321817395no_undefined_flag_RC='`$ECHO "$no_undefined_flag_RC" | $SED "$delay_single_quote_subst"`'
     17396hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
    1321917397hardcode_libdir_flag_spec_RC='`$ECHO "$hardcode_libdir_flag_spec_RC" | $SED "$delay_single_quote_subst"`'
     17398hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
    1322017399hardcode_libdir_separator_RC='`$ECHO "$hardcode_libdir_separator_RC" | $SED "$delay_single_quote_subst"`'
     17400hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
    1322117401hardcode_direct_RC='`$ECHO "$hardcode_direct_RC" | $SED "$delay_single_quote_subst"`'
     17402hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
    1322217403hardcode_direct_absolute_RC='`$ECHO "$hardcode_direct_absolute_RC" | $SED "$delay_single_quote_subst"`'
     17404hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
    1322317405hardcode_minus_L_RC='`$ECHO "$hardcode_minus_L_RC" | $SED "$delay_single_quote_subst"`'
     17406hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
    1322417407hardcode_shlibpath_var_RC='`$ECHO "$hardcode_shlibpath_var_RC" | $SED "$delay_single_quote_subst"`'
     17408hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
    1322517409hardcode_automatic_RC='`$ECHO "$hardcode_automatic_RC" | $SED "$delay_single_quote_subst"`'
     17410inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
    1322617411inherit_rpath_RC='`$ECHO "$inherit_rpath_RC" | $SED "$delay_single_quote_subst"`'
     17412link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
    1322717413link_all_deplibs_RC='`$ECHO "$link_all_deplibs_RC" | $SED "$delay_single_quote_subst"`'
     17414always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
    1322817415always_export_symbols_RC='`$ECHO "$always_export_symbols_RC" | $SED "$delay_single_quote_subst"`'
     17416export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1322917417export_symbols_cmds_RC='`$ECHO "$export_symbols_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17418exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
    1323017419exclude_expsyms_RC='`$ECHO "$exclude_expsyms_RC" | $SED "$delay_single_quote_subst"`'
     17420include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
    1323117421include_expsyms_RC='`$ECHO "$include_expsyms_RC" | $SED "$delay_single_quote_subst"`'
     17422prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1323217423prelink_cmds_RC='`$ECHO "$prelink_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17424postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
    1323317425postlink_cmds_RC='`$ECHO "$postlink_cmds_RC" | $SED "$delay_single_quote_subst"`'
     17426file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
    1323417427file_list_spec_RC='`$ECHO "$file_list_spec_RC" | $SED "$delay_single_quote_subst"`'
     17428hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
    1323517429hardcode_action_RC='`$ECHO "$hardcode_action_RC" | $SED "$delay_single_quote_subst"`'
     17430compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
     17431compiler_lib_search_dirs_RC='`$ECHO "$compiler_lib_search_dirs_RC" | $SED "$delay_single_quote_subst"`'
     17432predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
     17433predep_objects_RC='`$ECHO "$predep_objects_RC" | $SED "$delay_single_quote_subst"`'
     17434postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
     17435postdep_objects_RC='`$ECHO "$postdep_objects_RC" | $SED "$delay_single_quote_subst"`'
     17436predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
     17437predeps_RC='`$ECHO "$predeps_RC" | $SED "$delay_single_quote_subst"`'
     17438postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
     17439postdeps_RC='`$ECHO "$postdeps_RC" | $SED "$delay_single_quote_subst"`'
     17440compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
     17441compiler_lib_search_path_RC='`$ECHO "$compiler_lib_search_path_RC" | $SED "$delay_single_quote_subst"`'
    1323617442
    1323717443LTCC='$LTCC'
     
    1331317519old_striplib \
    1331417520striplib \
     17521compiler_lib_search_dirs \
     17522predep_objects \
     17523postdep_objects \
     17524predeps \
     17525postdeps \
     17526compiler_lib_search_path \
     17527LD_CXX \
    1331517528LD_RC \
     17529reload_flag_CXX \
    1331617530reload_flag_RC \
     17531compiler_CXX \
    1331717532compiler_RC \
     17533lt_prog_compiler_no_builtin_flag_CXX \
    1331817534lt_prog_compiler_no_builtin_flag_RC \
     17535lt_prog_compiler_pic_CXX \
    1331917536lt_prog_compiler_pic_RC \
     17537lt_prog_compiler_wl_CXX \
    1332017538lt_prog_compiler_wl_RC \
     17539lt_prog_compiler_static_CXX \
    1332117540lt_prog_compiler_static_RC \
     17541lt_cv_prog_compiler_c_o_CXX \
    1332217542lt_cv_prog_compiler_c_o_RC \
     17543export_dynamic_flag_spec_CXX \
    1332317544export_dynamic_flag_spec_RC \
     17545whole_archive_flag_spec_CXX \
    1332417546whole_archive_flag_spec_RC \
     17547compiler_needs_object_CXX \
    1332517548compiler_needs_object_RC \
     17549with_gnu_ld_CXX \
    1332617550with_gnu_ld_RC \
     17551allow_undefined_flag_CXX \
    1332717552allow_undefined_flag_RC \
     17553no_undefined_flag_CXX \
    1332817554no_undefined_flag_RC \
     17555hardcode_libdir_flag_spec_CXX \
    1332917556hardcode_libdir_flag_spec_RC \
     17557hardcode_libdir_separator_CXX \
    1333017558hardcode_libdir_separator_RC \
     17559exclude_expsyms_CXX \
    1333117560exclude_expsyms_RC \
     17561include_expsyms_CXX \
    1333217562include_expsyms_RC \
    13333 file_list_spec_RC; do
     17563file_list_spec_CXX \
     17564file_list_spec_RC \
     17565compiler_lib_search_dirs_CXX \
     17566compiler_lib_search_dirs_RC \
     17567predep_objects_CXX \
     17568predep_objects_RC \
     17569postdep_objects_CXX \
     17570postdep_objects_RC \
     17571predeps_CXX \
     17572predeps_RC \
     17573postdeps_CXX \
     17574postdeps_RC \
     17575compiler_lib_search_path_CXX \
     17576compiler_lib_search_path_RC; do
    1333417577    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
    1333517578    *[\\\\\\\`\\"\\\$]*)
     
    1336217605sys_lib_search_path_spec \
    1336317606sys_lib_dlsearch_path_spec \
     17607reload_cmds_CXX \
    1336417608reload_cmds_RC \
     17609old_archive_cmds_CXX \
    1336517610old_archive_cmds_RC \
     17611old_archive_from_new_cmds_CXX \
    1336617612old_archive_from_new_cmds_RC \
     17613old_archive_from_expsyms_cmds_CXX \
    1336717614old_archive_from_expsyms_cmds_RC \
     17615archive_cmds_CXX \
    1336817616archive_cmds_RC \
     17617archive_expsym_cmds_CXX \
    1336917618archive_expsym_cmds_RC \
     17619module_cmds_CXX \
    1337017620module_cmds_RC \
     17621module_expsym_cmds_CXX \
    1337117622module_expsym_cmds_RC \
     17623export_symbols_cmds_CXX \
    1337217624export_symbols_cmds_RC \
     17625prelink_cmds_CXX \
    1337317626prelink_cmds_RC \
     17627postlink_cmds_CXX \
    1337417628postlink_cmds_RC; do
    1337517629    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     
    1339917653    RM='$RM'
    1340017654    ofile='$ofile'
     17655
     17656
    1340117657
    1340217658
     
    1342017676    "libusb/Makefile") CONFIG_FILES="$CONFIG_FILES libusb/Makefile" ;;
    1342117677    "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
     17678    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
    1342217679    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
    1342317680    "doc/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES doc/doxygen.cfg" ;;
    1342417681
    13425   *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
     17682  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
    1342617683  esac
    1342717684done
     
    1344617703$debug ||
    1344717704{
    13448   tmp=
     17705  tmp= ac_tmp=
    1344917706  trap 'exit_status=$?
    13450   { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
     17707  : "${ac_tmp:=$tmp}"
     17708  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
    1345117709' 0
    1345217710  trap 'as_fn_exit 1' 1 2 13 15
     
    1345617714{
    1345717715  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
    13458   test -n "$tmp" && test -d "$tmp"
     17716  test -d "$tmp"
    1345917717}  ||
    1346017718{
    1346117719  tmp=./conf$$-$RANDOM
    1346217720  (umask 077 && mkdir "$tmp")
    13463 } || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
     17721} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
     17722ac_tmp=$tmp
    1346417723
    1346517724# Set up the scripts for CONFIG_FILES section.
     
    1347817737ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
    1347917738if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
    13480   ac_cs_awk_cr='\r'
     17739  ac_cs_awk_cr='\\r'
    1348117740else
    1348217741  ac_cs_awk_cr=$ac_cr
    1348317742fi
    1348417743
    13485 echo 'BEGIN {' >"$tmp/subs1.awk" &&
     17744echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
    1348617745_ACEOF
    1348717746
     
    1349217751  echo "_ACEOF"
    1349317752} >conf$$subs.sh ||
    13494   as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
    13495 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
     17753  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
     17754ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
    1349617755ac_delim='%!_!# '
    1349717756for ac_last_try in false false false false false :; do
    1349817757  . ./conf$$subs.sh ||
    13499     as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
     17758    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
    1350017759
    1350117760  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
     
    1350317762    break
    1350417763  elif $ac_last_try; then
    13505     as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
     17764    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
    1350617765  else
    1350717766    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
     
    1351117770
    1351217771cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
    13513 cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
     17772cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
    1351417773_ACEOF
    1351517774sed -n '
     
    1352517784:nl
    1352617785h
    13527 s/\(.\{148\}\).*/\1/
     17786s/\(.\{148\}\)..*/\1/
    1352817787t more1
    1352917788s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
     
    1353917798:delim
    1354017799h
    13541 s/\(.\{148\}\).*/\1/
     17800s/\(.\{148\}\)..*/\1/
    1354217801t more2
    1354317802s/["\\]/\\&/g; s/^/"/; s/$/"/
     
    1355917818cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
    1356017819_ACAWK
    13561 cat >>"\$tmp/subs1.awk" <<_ACAWK &&
     17820cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
    1356217821  for (key in S) S_is_set[key] = 1
    1356317822  FS = ""
     
    1359117850else
    1359217851  cat
    13593 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
    13594   || as_fn_error "could not setup config files machinery" "$LINENO" 5
     17852fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
     17853  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
    1359517854_ACEOF
    1359617855
    13597 # VPATH may cause trouble with some makes, so we remove $(srcdir),
    13598 # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
     17856# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
     17857# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
    1359917858# trailing colons and then remove the whole line if VPATH becomes empty
    1360017859# (actually we leave an empty line to preserve line numbers).
    1360117860if test "x$srcdir" = x.; then
    13602   ac_vpsub='/^[  ]*VPATH[        ]*=/{
    13603 s/:*\$(srcdir):*/:/
    13604 s/:*\${srcdir}:*/:/
    13605 s/:*@srcdir@:*/:/
    13606 s/^\([^=]*=[     ]*\):*/\1/
     17861  ac_vpsub='/^[  ]*VPATH[        ]*=[    ]*/{
     17862h
     17863s///
     17864s/^/:/
     17865s/[      ]*$/:/
     17866s/:\$(srcdir):/:/g
     17867s/:\${srcdir}:/:/g
     17868s/:@srcdir@:/:/g
     17869s/^:*//
    1360717870s/:*$//
     17871x
     17872s/\(=[   ]*\).*/\1/
     17873G
     17874s/\n//
    1360817875s/^[^=]*=[       ]*$//
    1360917876}'
     
    1361717884# This happens for instance with `./config.status Makefile'.
    1361817885if test -n "$CONFIG_HEADERS"; then
    13619 cat >"$tmp/defines.awk" <<\_ACAWK ||
     17886cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
    1362017887BEGIN {
    1362117888_ACEOF
     
    1362917896ac_delim='%!_!# '
    1363017897for ac_last_try in false false :; do
    13631   ac_t=`sed -n "/$ac_delim/p" confdefs.h`
    13632   if test -z "$ac_t"; then
     17898  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
     17899  if test -z "$ac_tt"; then
    1363317900    break
    1363417901  elif $ac_last_try; then
    13635     as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
     17902    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
    1363617903  else
    1363717904    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
     
    1371817985_ACEOF
    1371917986cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
    13720   as_fn_error "could not setup config headers machinery" "$LINENO" 5
     17987  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
    1372117988fi # test -n "$CONFIG_HEADERS"
    1372217989
     
    1373117998  case $ac_mode$ac_tag in
    1373217999  :[FHL]*:*);;
    13733   :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
     18000  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
    1373418001  :[FH]-) ac_tag=-:-;;
    1373518002  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
     
    1375018017    do
    1375118018      case $ac_f in
    13752       -) ac_f="$tmp/stdin";;
     18019      -) ac_f="$ac_tmp/stdin";;
    1375318020      *) # Look for the file first in the build tree, then in the source tree
    1375418021         # (if the path is not absolute).  The absolute path cannot be DOS-style,
     
    1375918026           *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
    1376018027           esac ||
    13761            as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
     18028           as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
    1376218029      esac
    1376318030      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
     
    1378518052
    1378618053    case $ac_tag in
    13787     *:-:* | *:-) cat >"$tmp/stdin" \
    13788       || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
     18054    *:-:* | *:-) cat >"$ac_tmp/stdin" \
     18055      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
    1378918056    esac
    1379018057    ;;
     
    1392218189$ac_datarootdir_hack
    1392318190"
    13924 eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
    13925   || as_fn_error "could not create $ac_file" "$LINENO" 5
     18191eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
     18192  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
    1392618193
    1392718194test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
    13928   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
    13929   { ac_out=`sed -n '/^[  ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
     18195  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
     18196  { ac_out=`sed -n '/^[  ]*datarootdir[  ]*:*=/p' \
     18197      "$ac_tmp/out"`; test -z "$ac_out"; } &&
    1393018198  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
    13931 which seems to be undefined.  Please make sure it is defined." >&5
     18199which seems to be undefined.  Please make sure it is defined" >&5
    1393218200$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
    13933 which seems to be undefined.  Please make sure it is defined." >&2;}
    13934 
    13935   rm -f "$tmp/stdin"
     18201which seems to be undefined.  Please make sure it is defined" >&2;}
     18202
     18203  rm -f "$ac_tmp/stdin"
    1393618204  case $ac_file in
    13937   -) cat "$tmp/out" && rm -f "$tmp/out";;
    13938   *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
     18205  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
     18206  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
    1393918207  esac \
    13940   || as_fn_error "could not create $ac_file" "$LINENO" 5
     18208  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
    1394118209 ;;
    1394218210  :H)
     
    1394718215    {
    1394818216      $as_echo "/* $configure_input  */" \
    13949       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
    13950     } >"$tmp/config.h" \
    13951       || as_fn_error "could not create $ac_file" "$LINENO" 5
    13952     if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
     18217      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
     18218    } >"$ac_tmp/config.h" \
     18219      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     18220    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
    1395318221      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
    1395418222$as_echo "$as_me: $ac_file is unchanged" >&6;}
    1395518223    else
    1395618224      rm -f "$ac_file"
    13957       mv "$tmp/config.h" "$ac_file" \
    13958         || as_fn_error "could not create $ac_file" "$LINENO" 5
     18225      mv "$ac_tmp/config.h" "$ac_file" \
     18226        || as_fn_error $? "could not create $ac_file" "$LINENO" 5
    1395918227    fi
    1396018228  else
    1396118229    $as_echo "/* $configure_input  */" \
    13962       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
    13963       || as_fn_error "could not create -" "$LINENO" 5
     18230      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
     18231      || as_fn_error $? "could not create -" "$LINENO" 5
    1396418232  fi
    1396518233# Compute "$ac_file"'s index in $config_headers.
     
    1400718275  case $ac_file$ac_mode in
    1400818276    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
    14009   # Autoconf 2.62 quotes --file arguments for eval, but not when files
     18277  # Older Autoconf quotes --file arguments for eval, but not when files
    1401018278  # are listed without --file.  Let's play safe and only enable the eval
    1401118279  # if we detect the quoting.
     
    1402018288    mf=`echo "$mf" | sed -e 's/:.*$//'`
    1402118289    # Check whether this is an Automake generated Makefile or not.
    14022     # We used to match only the files named `Makefile.in', but
     18290    # We used to match only the files named 'Makefile.in', but
    1402318291    # some people rename them; so instead we look at the file content.
    1402418292    # Grep'ing the first line is not enough: some people post-process
     
    1405418322    fi
    1405518323    # Extract the definition of DEPDIR, am__include, and am__quote
    14056     # from the Makefile without running `make'.
     18324    # from the Makefile without running 'make'.
    1405718325    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
    1405818326    test -z "$DEPDIR" && continue
    1405918327    am__include=`sed -n 's/^am__include = //p' < "$mf"`
    14060     test -z "am__include" && continue
     18328    test -z "$am__include" && continue
    1406118329    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
    14062     # When using ansi2knr, U may be empty or an underscore; expand it
    14063     U=`sed -n 's/^U = //p' < "$mf"`
    1406418330    # Find all dependency output files, they are included files with
    1406518331    # $(DEPDIR) in their names.  We invoke sed twice because it is the
     
    1406818334    for file in `sed -n "
    1406918335      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
    14070          sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
     18336         sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
    1407118337      # Make sure the directory exists.
    1407218338      test -f "$dirpart/$file" && continue
     
    1415118417
    1415218418# The names of the tagged configurations supported by this script.
    14153 available_tags="RC "
     18419available_tags="CXX RC "
    1415418420
    1415518421# ### BEGIN LIBTOOL CONFIG
     
    1453718803# How to hardcode a shared library path into an executable.
    1453818804hardcode_action=$hardcode_action
     18805
     18806# The directories searched by this compiler when creating a shared library.
     18807compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
     18808
     18809# Dependencies to place before and after the objects being linked to
     18810# create a shared library.
     18811predep_objects=$lt_predep_objects
     18812postdep_objects=$lt_postdep_objects
     18813predeps=$lt_predeps
     18814postdeps=$lt_postdeps
     18815
     18816# The library search path used internally by the compiler when linking
     18817# a shared library.
     18818compiler_lib_search_path=$lt_compiler_lib_search_path
    1453918819
    1454018820# ### END LIBTOOL CONFIG
     
    1473319013    cat <<_LT_EOF >> "$ofile"
    1473419014
     19015# ### BEGIN LIBTOOL TAG CONFIG: CXX
     19016
     19017# The linker used to build libraries.
     19018LD=$lt_LD_CXX
     19019
     19020# How to create reloadable object files.
     19021reload_flag=$lt_reload_flag_CXX
     19022reload_cmds=$lt_reload_cmds_CXX
     19023
     19024# Commands used to build an old-style archive.
     19025old_archive_cmds=$lt_old_archive_cmds_CXX
     19026
     19027# A language specific compiler.
     19028CC=$lt_compiler_CXX
     19029
     19030# Is the compiler the GNU compiler?
     19031with_gcc=$GCC_CXX
     19032
     19033# Compiler flag to turn off builtin functions.
     19034no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
     19035
     19036# Additional compiler flags for building library objects.
     19037pic_flag=$lt_lt_prog_compiler_pic_CXX
     19038
     19039# How to pass a linker flag through the compiler.
     19040wl=$lt_lt_prog_compiler_wl_CXX
     19041
     19042# Compiler flag to prevent dynamic linking.
     19043link_static_flag=$lt_lt_prog_compiler_static_CXX
     19044
     19045# Does compiler simultaneously support -c and -o options?
     19046compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
     19047
     19048# Whether or not to add -lc for building shared libraries.
     19049build_libtool_need_lc=$archive_cmds_need_lc_CXX
     19050
     19051# Whether or not to disallow shared libs when runtime libs are static.
     19052allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
     19053
     19054# Compiler flag to allow reflexive dlopens.
     19055export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
     19056
     19057# Compiler flag to generate shared objects directly from archives.
     19058whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
     19059
     19060# Whether the compiler copes with passing no objects directly.
     19061compiler_needs_object=$lt_compiler_needs_object_CXX
     19062
     19063# Create an old-style archive from a shared archive.
     19064old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
     19065
     19066# Create a temporary old-style archive to link instead of a shared archive.
     19067old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
     19068
     19069# Commands used to build a shared archive.
     19070archive_cmds=$lt_archive_cmds_CXX
     19071archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
     19072
     19073# Commands used to build a loadable module if different from building
     19074# a shared archive.
     19075module_cmds=$lt_module_cmds_CXX
     19076module_expsym_cmds=$lt_module_expsym_cmds_CXX
     19077
     19078# Whether we are building with GNU ld or not.
     19079with_gnu_ld=$lt_with_gnu_ld_CXX
     19080
     19081# Flag that allows shared libraries with undefined symbols to be built.
     19082allow_undefined_flag=$lt_allow_undefined_flag_CXX
     19083
     19084# Flag that enforces no undefined symbols.
     19085no_undefined_flag=$lt_no_undefined_flag_CXX
     19086
     19087# Flag to hardcode \$libdir into a binary during linking.
     19088# This must work even if \$libdir does not exist
     19089hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
     19090
     19091# Whether we need a single "-rpath" flag with a separated argument.
     19092hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
     19093
     19094# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
     19095# DIR into the resulting binary.
     19096hardcode_direct=$hardcode_direct_CXX
     19097
     19098# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
     19099# DIR into the resulting binary and the resulting library dependency is
     19100# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
     19101# library is relocated.
     19102hardcode_direct_absolute=$hardcode_direct_absolute_CXX
     19103
     19104# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
     19105# into the resulting binary.
     19106hardcode_minus_L=$hardcode_minus_L_CXX
     19107
     19108# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
     19109# into the resulting binary.
     19110hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
     19111
     19112# Set to "yes" if building a shared library automatically hardcodes DIR
     19113# into the library and all subsequent libraries and executables linked
     19114# against it.
     19115hardcode_automatic=$hardcode_automatic_CXX
     19116
     19117# Set to yes if linker adds runtime paths of dependent libraries
     19118# to runtime path list.
     19119inherit_rpath=$inherit_rpath_CXX
     19120
     19121# Whether libtool must link a program against all its dependency libraries.
     19122link_all_deplibs=$link_all_deplibs_CXX
     19123
     19124# Set to "yes" if exported symbols are required.
     19125always_export_symbols=$always_export_symbols_CXX
     19126
     19127# The commands to list exported symbols.
     19128export_symbols_cmds=$lt_export_symbols_cmds_CXX
     19129
     19130# Symbols that should not be listed in the preloaded symbols.
     19131exclude_expsyms=$lt_exclude_expsyms_CXX
     19132
     19133# Symbols that must always be exported.
     19134include_expsyms=$lt_include_expsyms_CXX
     19135
     19136# Commands necessary for linking programs (against libraries) with templates.
     19137prelink_cmds=$lt_prelink_cmds_CXX
     19138
     19139# Commands necessary for finishing linking programs.
     19140postlink_cmds=$lt_postlink_cmds_CXX
     19141
     19142# Specify filename containing input files.
     19143file_list_spec=$lt_file_list_spec_CXX
     19144
     19145# How to hardcode a shared library path into an executable.
     19146hardcode_action=$hardcode_action_CXX
     19147
     19148# The directories searched by this compiler when creating a shared library.
     19149compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
     19150
     19151# Dependencies to place before and after the objects being linked to
     19152# create a shared library.
     19153predep_objects=$lt_predep_objects_CXX
     19154postdep_objects=$lt_postdep_objects_CXX
     19155predeps=$lt_predeps_CXX
     19156postdeps=$lt_postdeps_CXX
     19157
     19158# The library search path used internally by the compiler when linking
     19159# a shared library.
     19160compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
     19161
     19162# ### END LIBTOOL TAG CONFIG: CXX
     19163_LT_EOF
     19164
     19165
     19166    cat <<_LT_EOF >> "$ofile"
     19167
    1473519168# ### BEGIN LIBTOOL TAG CONFIG: RC
    1473619169
     
    1486619299hardcode_action=$hardcode_action_RC
    1486719300
     19301# The directories searched by this compiler when creating a shared library.
     19302compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC
     19303
     19304# Dependencies to place before and after the objects being linked to
     19305# create a shared library.
     19306predep_objects=$lt_predep_objects_RC
     19307postdep_objects=$lt_postdep_objects_RC
     19308predeps=$lt_predeps_RC
     19309postdeps=$lt_postdeps_RC
     19310
     19311# The library search path used internally by the compiler when linking
     19312# a shared library.
     19313compiler_lib_search_path=$lt_compiler_lib_search_path_RC
     19314
    1486819315# ### END LIBTOOL TAG CONFIG: RC
    1486919316_LT_EOF
     
    1488019327
    1488119328test $ac_write_fail = 0 ||
    14882   as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
     19329  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
    1488319330
    1488419331
     
    1490119348  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
    1490219349  # would make configure fail if this is the last instruction.
    14903   $ac_cs_success || as_fn_exit $?
     19350  $ac_cs_success || as_fn_exit 1
    1490419351fi
    1490519352if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
  • TabularUnified libusb1/trunk/configure.ac

    r1879 r1882  
    99dnl The m4_bregexp() returns (only) the numbers following the #define named
    1010dnl in the first macro parameter. m4_define() then defines the name for use
    11 dnl in AC_INIT().
     11dnl in AC_INIT.
    1212
    1313LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR])
     
    1616LU_DEFINE_VERSION_RC_ATOM([LIBUSB_RC])
    1717
    18 AC_INIT([libusb], LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/])
     18AC_INIT([libusb],[LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC],[libusb-devel@lists.sourceforge.net],[libusb],[http://libusb.info])
    1919
    2020# Library versioning
     
    2222# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
    2323# http://sourceware.org/autobook/autobook/autobook_91.html
    24 lt_current="2"
     24lt_current="1"
    2525lt_revision="0"
    26 lt_age="0"
     26lt_age="1"
    2727LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
    2828
    2929AM_INIT_AUTOMAKE
    30 AM_MAINTAINER_MODE
    3130
    3231AC_CONFIG_SRCDIR([libusb/core.c])
     
    3534m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
    3635
    37 AC_PREREQ([2.50])
     36AC_PREREQ([2.69])
    3837AC_PROG_CC
    39 AC_PROG_LIBTOOL
     38AC_PROG_CXX
     39LT_INIT
    4040LT_LANG([Windows Resource])
    4141AC_C_INLINE
     
    4646
    4747AC_MSG_CHECKING([operating system])
     48
     49dnl on linux-android platform, some functions are in different places
    4850case $host in
    49 *-linux*)
     51*-linux-android*)
     52        AC_MSG_RESULT([This is a Linux-Android system])
     53        is_backend_android="yes"
     54        ;;
     55*)
     56        is_backend_android="no"
     57esac
     58
     59case $host in
     60*-linux* | *-uclinux*)
    5061        AC_MSG_RESULT([Linux])
    5162        backend="linux"
     63        threads="posix"
    5264        ;;
    5365*-darwin*)
    5466        AC_MSG_RESULT([Darwin/Mac OS X])
    5567        backend="darwin"
     68        threads="posix"
    5669        ;;
    5770*-openbsd*)
    5871        AC_MSG_RESULT([OpenBSD])
    5972        backend="openbsd"
     73        threads="posix"
    6074        ;;
    6175*-netbsd*)
    62         AC_MSG_RESULT([NetBSD (using OpenBSD backend)])
    63         backend="openbsd"
    64         ;;
    65 *-mingw*)
     76        AC_MSG_RESULT([NetBSD])
     77        backend="netbsd"
     78        threads="posix"
     79        ;;
     80*-mingw* | *msys*)
    6681        AC_MSG_RESULT([Windows])
    6782        backend="windows"
     83        threads="windows"
     84        create_import_lib="yes"
     85        AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
    6886        ;;
    6987*-os2-emx*)
    7088        AC_MSG_RESULT([OS2])
    7189        backend="os2"
     90        threads="posix"
    7291        ;;
    7392*-cygwin*)
     
    7695        threads="posix"
    7796        ;;
     97*-haiku*)
     98        AC_MSG_RESULT([Haiku])
     99        backend="haiku"
     100        threads="posix"
     101        ;;
     102*-solaris*)
     103        AC_MSG_RESULT([SunOS])
     104        backend="sunos"
     105        threads="posix"
     106        ;;
    78107*)
    79         AC_MSG_ERROR([unsupported operating system])
     108        AC_MSG_ERROR([unsupported operating system $host])
    80109esac
     110
    81111case $backend in
    82112linux)
    83113        AC_DEFINE(OS_LINUX, 1, [Linux backend])
    84114        AC_SUBST(OS_LINUX)
    85         AC_CHECK_LIB(rt, clock_gettime, PC_LIBS_PRIVATE="-lrt")
     115        AC_SEARCH_LIBS(clock_gettime, rt, [], [], -pthread)
    86116        AC_ARG_ENABLE([udev],
    87                       [AC_HELP_STRING([--with-udev], [use udev for device enumeration and hotplug support (recommended, default: yes)])],
    88                       [], [enable_udev="yes"])
    89         if test "x$enable_udev" = "xyes" ; then
    90                 # system has udev. use it or fail!
    91                 AC_CHECK_HEADERS([libudev.h],[],[AC_ERROR(["udev support requested but libudev not installed"])])
    92                 AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])])
    93                 AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug])
    94         else
    95                 AC_CHECK_HEADERS([linux/netlink.h linux/filter.h], [], [AC_ERROR(["Linux netlink headers not found"])])
    96         fi
    97         AC_SUBST(USE_UDEV)
    98         threads="posix"
     117                [AC_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended) [default=yes]])],
     118                [], [enable_udev="yes"])
     119                if test "x$enable_udev" = "xyes" ; then
     120                        # system has udev. use it or fail!
     121                        AC_CHECK_HEADERS([libudev.h],[],[AC_ERROR(["udev support requested but libudev not installed"])])
     122                        AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])])
     123                        AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug])
     124                else
     125                        AC_CHECK_HEADERS([asm/types.h], [], [])
     126                        AC_CHECK_HEADERS([sys/socket.h linux/netlink.h], [], [AC_ERROR(["Linux netlink headers not found"])], [
     127#ifdef HAVE_ASM_TYPES_H
     128#include <asm/types.h>
     129#endif
     130#include <sys/socket.h>
     131])
     132                fi
     133                AC_SUBST(USE_UDEV)
     134
     135case $is_backend_android in
     136yes)
     137        dnl there are gettimeofday function but configure doesn't seem to be able to find it.
     138        AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [Define if you have gettimeofday])
     139        ;;
     140*)
    99141        THREAD_CFLAGS="-pthread"
    100         PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
     142        LIBS="${LIBS} -pthread"
     143esac
     144
    101145        AC_CHECK_HEADERS([poll.h])
    102146        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
     
    105149        AC_DEFINE(OS_DARWIN, 1, [Darwin backend])
    106150        AC_SUBST(OS_DARWIN)
    107         threads="posix"
    108         PC_LIBS_PRIVATE="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
     151        LIBS="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
    109152        LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
    110153        AC_CHECK_HEADERS([poll.h])
     
    117160        AC_DEFINE(OS_OPENBSD, 1, [OpenBSD backend])
    118161        AC_SUBST(OS_OPENBSD)
    119         threads="posix"
    120162        THREAD_CFLAGS="-pthread"
    121         PC_LIBS_PRIVATE="-pthread"
     163        LIBS="-pthread"
     164        AC_CHECK_HEADERS([poll.h])
     165        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
     166        ;;
     167sunos)
     168        AC_DEFINE(OS_SUNOS, 1, [SunOS backend])
     169        AC_SUBST(OS_SUNOS)
     170        THREAD_CFLAGS="-pthread"
     171        LIBS="-pthread -ldevinfo"
     172        AC_CHECK_HEADERS([poll.h])
     173        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
     174        ;;
     175netbsd)
     176        AC_DEFINE(OS_NETBSD, 1, [NetBSD backend])
     177        AC_SUBST(OS_NETBSD)
     178        THREAD_CFLAGS="-pthread"
     179        LIBS="-pthread"
    122180        AC_CHECK_HEADERS([poll.h])
    123181        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
     
    126184        AC_DEFINE(OS_WINDOWS, 1, [Windows backend])
    127185        AC_SUBST(OS_WINDOWS)
    128         PC_LIBS_PRIVATE=""
     186        LIBS=""
    129187        LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
    130188        AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
     189        AC_DEFINE([WINVER], 0x0501, [Oldest Windows version supported])
     190
     191        AC_ARG_ENABLE([usbdk],
     192                [AC_HELP_STRING([--enable-usbdk], [use UsbDk Windows backend [default=no]])],
     193                [], [enable_usbdk="no"])
     194                if test "x$enable_usbdk" = "xyes" ; then
     195                    AC_DEFINE(USE_USBDK, 1, [Use UsbDk Windows backend])
     196                fi
     197                AC_SUBST(USE_USBDK)
    131198        ;;
    132199os2)
    133200        AC_DEFINE(OS_OS2, 1, [OS/2 backend])
    134201        AC_SUBST(OS_OS2)
    135         threads="posix"
    136         PC_LIBS_PRIVATE="-lpthread"
    137         AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
     202        LIBS="${LIBS} -lpthread"
     203        AC_CHECK_HEADERS([poll.h])
     204        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
     205        ;;
     206haiku)
     207        AC_DEFINE(OS_HAIKU, 1, [Haiku backend])
     208        AC_SUBST(OS_HAIKU)
     209        LIBS="${LIBS} -lbe"
     210        AC_CHECK_HEADERS([poll.h])
     211        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
    138212        ;;
    139213esac
    140 AC_SUBST(THREAD_CFLAGS)
    141 AC_SUBST(PC_LIBS_PRIVATE)
    142 LIBS="${LIBS} ${PC_LIBS_PRIVATE}"
     214
     215AC_SUBST(LIBS)
    143216
    144217AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
    145218AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
    146219AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xopenbsd)
     220AM_CONDITIONAL(OS_SUNOS, test "x$backend" = xsunos)
     221AM_CONDITIONAL(OS_NETBSD, test "x$backend" = xnetbsd)
    147222AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
    148223AM_CONDITIONAL(OS_OS2, test "x$backend" = xos2)
     224AM_CONDITIONAL(OS_HAIKU, test "x$backend" = xhaiku)
    149225AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
     226AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes")
    150227AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes)
     228AM_CONDITIONAL(USE_USBDK, test "x$enable_usbdk" = xyes)
    151229if test "$threads" = posix; then
    152230        AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
     
    157235AC_ARG_ENABLE([timerfd],
    158236        [AS_HELP_STRING([--enable-timerfd],
    159                 [use timerfd for timing (default auto)])],
     237                [use timerfd for timing [default=auto]])],
    160238        [use_timerfd=$enableval], [use_timerfd='auto'])
    161239
     
    192270
    193271AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
    194         [enable debug logging (default n)])],
     272        [start with debug message logging enabled [default=no]])],
    195273        [debug_log_enabled=$enableval],
    196274        [debug_log_enabled='no'])
    197275if test "x$debug_log_enabled" != "xno"; then
    198         AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
     276        AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Start with debug message logging enabled])
     277fi
     278
     279AC_ARG_ENABLE([system-log], [AS_HELP_STRING([--enable-system-log],
     280        [output logging messages to system wide log, if supported by the OS [default=no]])],
     281        [system_log_enabled=$enableval],
     282        [system_log_enabled='no'])
     283if test "x$system_log_enabled" != "xno"; then
     284        AC_DEFINE([USE_SYSTEM_LOGGING_FACILITY], 1, [Enable output to system log])
     285fi
     286
     287# Check if syslog is available in standard C library
     288AC_CHECK_HEADERS(syslog.h)
     289AC_CHECK_FUNC([syslog], [have_syslog=yes], [have_syslog=no])
     290if test "x$have_syslog" != "xno"; then
     291        AC_DEFINE([HAVE_SYSLOG_FUNC], 1, [syslog() function available])
    199292fi
    200293
    201294# Examples build
    202295AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
    203         [build example applications (default n)])],
     296        [build example applications [default=no]])],
    204297        [build_examples=$enableval],
    205298        [build_examples='no'])
    206299AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
     300
     301# Tests build
     302AC_ARG_ENABLE([tests-build], [AS_HELP_STRING([--enable-tests-build],
     303        [build test applications [default=no]])],
     304        [build_tests=$enableval],
     305        [build_tests='no'])
     306AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != "xno"])
    207307
    208308# check for -fvisibility=hidden compiler support (GCC >= 3.4)
     
    232332AC_CHECK_HEADERS([sys/time.h])
    233333AC_CHECK_FUNCS(gettimeofday)
    234 
    235 AM_CFLAGS="-std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
    236 
    237 AC_SUBST(VISIBILITY_CFLAGS)
     334AC_CHECK_HEADERS([signal.h])
     335
     336# check for -std=gnu99 compiler support
     337saved_cflags="$CFLAGS"
     338CFLAGS="-std=gnu99"
     339AC_MSG_CHECKING([whether CC supports -std=gnu99])
     340AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
     341    [AC_MSG_RESULT([yes])]
     342    [AM_CFLAGS="${AM_CFLAGS} -std=gnu99"],
     343    [AC_MSG_RESULT([no])]
     344)
     345CFLAGS="$saved_cflags"
     346
     347AM_CFLAGS="${AM_CFLAGS} -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow ${THREAD_CFLAGS} ${VISIBILITY_CFLAGS}"
     348
    238349AC_SUBST(AM_CFLAGS)
    239350AC_SUBST(LTLDFLAGS)
     
    243354AC_CONFIG_FILES([libusb/Makefile])
    244355AC_CONFIG_FILES([examples/Makefile])
     356AC_CONFIG_FILES([tests/Makefile])
    245357AC_CONFIG_FILES([doc/Makefile])
    246358AC_CONFIG_FILES([doc/doxygen.cfg])
  • TabularUnified libusb1/trunk/depcomp

    r1876 r1882  
    22# depcomp - compile a program generating dependencies as side-effects
    33
    4 scriptversion=2012-03-27.16; # UTC
    5 
    6 # Copyright (C) 1999-2012 Free Software Foundation, Inc.
     4scriptversion=2013-05-30.07; # UTC
     5
     6# Copyright (C) 1999-2013 Free Software Foundation, Inc.
    77
    88# This program is free software; you can redistribute it and/or modify
     
    2828case $1 in
    2929  '')
    30      echo "$0: No command.  Try '$0 --help' for more information." 1>&2
    31      exit 1;
    32      ;;
     30    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
     31    exit 1;
     32    ;;
    3333  -h | --h*)
    3434    cat <<\EOF
     
    5757esac
    5858
     59# Get the directory component of the given path, and save it in the
     60# global variables '$dir'.  Note that this directory component will
     61# be either empty or ending with a '/' character.  This is deliberate.
     62set_dir_from ()
     63{
     64  case $1 in
     65    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
     66      *) dir=;;
     67  esac
     68}
     69
     70# Get the suffix-stripped basename of the given path, and save it the
     71# global variable '$base'.
     72set_base_from ()
     73{
     74  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
     75}
     76
     77# If no dependency file was actually created by the compiler invocation,
     78# we still have to create a dummy depfile, to avoid errors with the
     79# Makefile "include basename.Plo" scheme.
     80make_dummy_depfile ()
     81{
     82  echo "#dummy" > "$depfile"
     83}
     84
     85# Factor out some common post-processing of the generated depfile.
     86# Requires the auxiliary global variable '$tmpdepfile' to be set.
     87aix_post_process_depfile ()
     88{
     89  # If the compiler actually managed to produce a dependency file,
     90  # post-process it.
     91  if test -f "$tmpdepfile"; then
     92    # Each line is of the form 'foo.o: dependency.h'.
     93    # Do two passes, one to just change these to
     94    #   $object: dependency.h
     95    # and one to simply output
     96    #   dependency.h:
     97    # which is needed to avoid the deleted-header problem.
     98    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
     99      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
     100    } > "$depfile"
     101    rm -f "$tmpdepfile"
     102  else
     103    make_dummy_depfile
     104  fi
     105}
     106
    59107# A tabulation character.
    60108tab='   '
     
    62110nl='
    63111'
     112# Character ranges might be problematic outside the C locale.
     113# These definitions help.
     114upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
     115lower=abcdefghijklmnopqrstuvwxyz
     116digits=0123456789
     117alpha=${upper}${lower}
    64118
    65119if test -z "$depmode" || test -z "$source" || test -z "$object"; then
     
    74128
    75129rm -f "$tmpdepfile"
     130
     131# Avoid interferences from the environment.
     132gccflag= dashmflag=
    76133
    77134# Some modes work just like other modes, but use different flags.  We
     
    86143
    87144if test "$depmode" = dashXmstdout; then
    88    # This is just like dashmstdout with a different argument.
    89    dashmflag=-xM
    90    depmode=dashmstdout
     145  # This is just like dashmstdout with a different argument.
     146  dashmflag=-xM
     147  depmode=dashmstdout
    91148fi
    92149
    93150cygpath_u="cygpath -u -f -"
    94151if test "$depmode" = msvcmsys; then
    95    # This is just like msvisualcpp but w/o cygpath translation.
    96    # Just convert the backslash-escaped backslashes to single forward
    97    # slashes to satisfy depend.m4
    98    cygpath_u='sed s,\\\\,/,g'
    99    depmode=msvisualcpp
     152  # This is just like msvisualcpp but w/o cygpath translation.
     153  # Just convert the backslash-escaped backslashes to single forward
     154  # slashes to satisfy depend.m4
     155  cygpath_u='sed s,\\\\,/,g'
     156  depmode=msvisualcpp
    100157fi
    101158
    102159if test "$depmode" = msvc7msys; then
    103    # This is just like msvc7 but w/o cygpath translation.
    104    # Just convert the backslash-escaped backslashes to single forward
    105    # slashes to satisfy depend.m4
    106    cygpath_u='sed s,\\\\,/,g'
    107    depmode=msvc7
     160  # This is just like msvc7 but w/o cygpath translation.
     161  # Just convert the backslash-escaped backslashes to single forward
     162  # slashes to satisfy depend.m4
     163  cygpath_u='sed s,\\\\,/,g'
     164  depmode=msvc7
    108165fi
    109166
    110167if test "$depmode" = xlc; then
    111    # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
    112    gccflag=-qmakedep=gcc,-MF
    113    depmode=gcc
     168  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
     169  gccflag=-qmakedep=gcc,-MF
     170  depmode=gcc
    114171fi
    115172
     
    134191  "$@"
    135192  stat=$?
    136   if test $stat -eq 0; then :
    137   else
     193  if test $stat -ne 0; then
    138194    rm -f "$tmpdepfile"
    139195    exit $stat
     
    143199
    144200gcc)
     201## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
     202## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
     203## (see the conditional assignment to $gccflag above).
    145204## There are various ways to get dependency output from gcc.  Here's
    146205## why we pick this rather obscure method:
     
    149208##   (We might end up doing this anyway to support other compilers.)
    150209## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
    151 ##   -MM, not -M (despite what the docs say).
     210##   -MM, not -M (despite what the docs say).  Also, it might not be
     211##   supported by the other compilers which use the 'gcc' depmode.
    152212## - Using -M directly means running the compiler twice (even worse
    153213##   than renaming).
     
    157217  "$@" -Wp,"$gccflag$tmpdepfile"
    158218  stat=$?
    159   if test $stat -eq 0; then :
    160   else
     219  if test $stat -ne 0; then
    161220    rm -f "$tmpdepfile"
    162221    exit $stat
     
    164223  rm -f "$depfile"
    165224  echo "$object : \\" > "$depfile"
    166   alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
    167 ## The second -e expression handles DOS-style file names with drive letters.
     225  # The second -e expression handles DOS-style file names with drive
     226  # letters.
    168227  sed -e 's/^[^:]*: / /' \
    169228      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
     
    174233## dummy dependencies for each header file.  Too bad gcc doesn't do
    175234## this for us directly.
    176   tr ' ' "$nl" < "$tmpdepfile" |
    177235## Some versions of gcc put a space before the ':'.  On the theory
    178236## that the space means something, we add a space to the output as
     
    181239## Some versions of the HPUX 10.20 sed can't process this invocation
    182240## correctly.  Breaking it into two sed invocations is a workaround.
    183     sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
    184       | sed -e 's/$/ :/' >> "$depfile"
     241  tr ' ' "$nl" < "$tmpdepfile" \
     242    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
     243    | sed -e 's/$/ :/' >> "$depfile"
    185244  rm -f "$tmpdepfile"
    186245  ;;
     
    200259  fi
    201260  stat=$?
    202   if test $stat -eq 0; then :
    203   else
     261  if test $stat -ne 0; then
    204262    rm -f "$tmpdepfile"
    205263    exit $stat
     
    209267  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
    210268    echo "$object : \\" > "$depfile"
    211 
    212269    # Clip off the initial element (the dependent).  Don't try to be
    213270    # clever and replace this with sed code, as IRIX sed won't handle
     
    217274    # dependency line.
    218275    tr ' ' "$nl" < "$tmpdepfile" \
    219     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
    220     tr "$nl" ' ' >> "$depfile"
     276      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
     277      | tr "$nl" ' ' >> "$depfile"
    221278    echo >> "$depfile"
    222 
    223279    # The second pass generates a dummy entry for each header file.
    224280    tr ' ' "$nl" < "$tmpdepfile" \
    225    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
    226    >> "$depfile"
     281      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
     282      >> "$depfile"
    227283  else
    228     # The sourcefile does not contain any dependencies, so just
    229     # store a dummy comment line, to avoid errors with the Makefile
    230     # "include basename.Plo" scheme.
    231     echo "#dummy" > "$depfile"
     284    make_dummy_depfile
    232285  fi
    233286  rm -f "$tmpdepfile"
     
    247300  # start of each line; $object doesn't have directory information.
    248301  # Version 6 uses the directory in both cases.
    249   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
    250   test "x$dir" = "x$object" && dir=
    251   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
     302  set_dir_from "$object"
     303  set_base_from "$object"
    252304  if test "$libtool" = yes; then
    253305    tmpdepfile1=$dir$base.u
     
    262314  fi
    263315  stat=$?
    264 
    265   if test $stat -eq 0; then :
    266   else
     316  if test $stat -ne 0; then
    267317    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
    268318    exit $stat
     
    273323    test -f "$tmpdepfile" && break
    274324  done
    275   if test -f "$tmpdepfile"; then
    276     # Each line is of the form 'foo.o: dependent.h'.
    277     # Do two passes, one to just change these to
    278     # '$object: dependent.h' and one to simply 'dependent.h:'.
    279     sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
    280     sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    281   else
    282     # The sourcefile does not contain any dependencies, so just
    283     # store a dummy comment line, to avoid errors with the Makefile
    284     # "include basename.Plo" scheme.
    285     echo "#dummy" > "$depfile"
    286   fi
     325  aix_post_process_depfile
     326  ;;
     327
     328tcc)
     329  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
     330  # FIXME: That version still under development at the moment of writing.
     331  #        Make that this statement remains true also for stable, released
     332  #        versions.
     333  # It will wrap lines (doesn't matter whether long or short) with a
     334  # trailing '\', as in:
     335  #
     336  #   foo.o : \
     337  #    foo.c \
     338  #    foo.h \
     339  #
     340  # It will put a trailing '\' even on the last line, and will use leading
     341  # spaces rather than leading tabs (at least since its commit 0394caf7
     342  # "Emit spaces for -MD").
     343  "$@" -MD -MF "$tmpdepfile"
     344  stat=$?
     345  if test $stat -ne 0; then
     346    rm -f "$tmpdepfile"
     347    exit $stat
     348  fi
     349  rm -f "$depfile"
     350  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
     351  # We have to change lines of the first kind to '$object: \'.
     352  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
     353  # And for each line of the second kind, we have to emit a 'dep.h:'
     354  # dummy dependency, to avoid the deleted-header problem.
     355  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
    287356  rm -f "$tmpdepfile"
    288357  ;;
    289358
    290 icc)
    291   # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
    292   # However on
    293   #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
    294   # ICC 7.0 will fill foo.d with something like
    295   #    foo.o: sub/foo.c
    296   #    foo.o: sub/foo.h
    297   # which is wrong.  We want
    298   #    sub/foo.o: sub/foo.c
    299   #    sub/foo.o: sub/foo.h
    300   #    sub/foo.c:
    301   #    sub/foo.h:
    302   # ICC 7.1 will output
     359## The order of this option in the case statement is important, since the
     360## shell code in configure will try each of these formats in the order
     361## listed in this file.  A plain '-MD' option would be understood by many
     362## compilers, so we must ensure this comes after the gcc and icc options.
     363pgcc)
     364  # Portland's C compiler understands '-MD'.
     365  # Will always output deps to 'file.d' where file is the root name of the
     366  # source file under compilation, even if file resides in a subdirectory.
     367  # The object file name does not affect the name of the '.d' file.
     368  # pgcc 10.2 will output
    303369  #    foo.o: sub/foo.c sub/foo.h
    304   # and will wrap long lines using '\':
     370  # and will wrap long lines using '\' :
    305371  #    foo.o: sub/foo.c ... \
    306372  #     sub/foo.h ... \
    307373  #     ...
    308   # tcc 0.9.26 (FIXME still under development at the moment of writing)
    309   # will emit a similar output, but also prepend the continuation lines
    310   # with horizontal tabulation characters.
    311   "$@" -MD -MF "$tmpdepfile"
    312   stat=$?
    313   if test $stat -eq 0; then :
    314   else
     374  set_dir_from "$object"
     375  # Use the source, not the object, to determine the base name, since
     376  # that's sadly what pgcc will do too.
     377  set_base_from "$source"
     378  tmpdepfile=$base.d
     379
     380  # For projects that build the same source file twice into different object
     381  # files, the pgcc approach of using the *source* file root name can cause
     382  # problems in parallel builds.  Use a locking strategy to avoid stomping on
     383  # the same $tmpdepfile.
     384  lockdir=$base.d-lock
     385  trap "
     386    echo '$0: caught signal, cleaning up...' >&2
     387    rmdir '$lockdir'
     388    exit 1
     389  " 1 2 13 15
     390  numtries=100
     391  i=$numtries
     392  while test $i -gt 0; do
     393    # mkdir is a portable test-and-set.
     394    if mkdir "$lockdir" 2>/dev/null; then
     395      # This process acquired the lock.
     396      "$@" -MD
     397      stat=$?
     398      # Release the lock.
     399      rmdir "$lockdir"
     400      break
     401    else
     402      # If the lock is being held by a different process, wait
     403      # until the winning process is done or we timeout.
     404      while test -d "$lockdir" && test $i -gt 0; do
     405        sleep 1
     406        i=`expr $i - 1`
     407      done
     408    fi
     409    i=`expr $i - 1`
     410  done
     411  trap - 1 2 13 15
     412  if test $i -le 0; then
     413    echo "$0: failed to acquire lock after $numtries attempts" >&2
     414    echo "$0: check lockdir '$lockdir'" >&2
     415    exit 1
     416  fi
     417
     418  if test $stat -ne 0; then
    315419    rm -f "$tmpdepfile"
    316420    exit $stat
    317421  fi
    318422  rm -f "$depfile"
    319   # Each line is of the form 'foo.o: dependent.h',
    320   # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
     423  # Each line is of the form `foo.o: dependent.h',
     424  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
    321425  # Do two passes, one to just change these to
    322   # '$object: dependent.h' and one to simply 'dependent.h:'.
    323   sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
    324     < "$tmpdepfile" > "$depfile"
    325   sed '
    326     s/[ '"$tab"'][ '"$tab"']*/ /g
    327     s/^ *//
    328     s/ *\\*$//
    329     s/^[^:]*: *//
    330     /^$/d
    331     /:$/d
    332     s/$/ :/
    333   ' < "$tmpdepfile" >> "$depfile"
     426  # `$object: dependent.h' and one to simply `dependent.h:'.
     427  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
     428  # Some versions of the HPUX 10.20 sed can't process this invocation
     429  # correctly.  Breaking it into two sed invocations is a workaround.
     430  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
     431    | sed -e 's/$/ :/' >> "$depfile"
    334432  rm -f "$tmpdepfile"
    335433  ;;
     
    342440  # happens to be.
    343441  # Much of this is similar to the tru64 case; see comments there.
    344   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
    345   test "x$dir" = "x$object" && dir=
    346   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
     442  set_dir_from  "$object"
     443  set_base_from "$object"
    347444  if test "$libtool" = yes; then
    348445    tmpdepfile1=$dir$base.d
     
    355452  fi
    356453  stat=$?
    357   if test $stat -eq 0; then :
    358   else
     454  if test $stat -ne 0; then
    359455     rm -f "$tmpdepfile1" "$tmpdepfile2"
    360456     exit $stat
     
    366462  done
    367463  if test -f "$tmpdepfile"; then
    368     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
     464    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
    369465    # Add 'dependent.h:' lines.
    370466    sed -ne '2,${
    371                s/^ *//
    372                s/ \\*$//
    373                s/$/:/
    374                p
    375              }' "$tmpdepfile" >> "$depfile"
     467               s/^ *//
     468               s/ \\*$//
     469               s/$/:/
     470               p
     471             }' "$tmpdepfile" >> "$depfile"
    376472  else
    377     echo "#dummy" > "$depfile"
     473    make_dummy_depfile
    378474  fi
    379475  rm -f "$tmpdepfile" "$tmpdepfile2"
     
    381477
    382478tru64)
    383    # The Tru64 compiler uses -MD to generate dependencies as a side
    384    # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
    385    # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
    386    # dependencies in 'foo.d' instead, so we check for that too.
    387    # Subdirectories are respected.
    388    dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
    389    test "x$dir" = "x$object" && dir=
    390    base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
    391 
    392    if test "$libtool" = yes; then
    393       # With Tru64 cc, shared objects can also be used to make a
    394       # static library.  This mechanism is used in libtool 1.4 series to
    395       # handle both shared and static libraries in a single compilation.
    396       # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
    397       #
    398       # With libtool 1.5 this exception was removed, and libtool now
    399       # generates 2 separate objects for the 2 libraries.  These two
    400       # compilations output dependencies in $dir.libs/$base.o.d and
    401       # in $dir$base.o.d.  We have to check for both files, because
    402       # one of the two compilations can be disabled.  We should prefer
    403       # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
    404       # automatically cleaned when .libs/ is deleted, while ignoring
    405       # the former would cause a distcleancheck panic.
    406       tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
    407       tmpdepfile2=$dir$base.o.d          # libtool 1.5
    408       tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
    409       tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
    410       "$@" -Wc,-MD
    411    else
    412       tmpdepfile1=$dir$base.o.d
    413       tmpdepfile2=$dir$base.d
    414       tmpdepfile3=$dir$base.d
    415       tmpdepfile4=$dir$base.d
    416       "$@" -MD
    417    fi
    418 
    419    stat=$?
    420    if test $stat -eq 0; then :
    421    else
    422       rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
    423       exit $stat
    424    fi
    425 
    426    for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
    427    do
    428      test -f "$tmpdepfile" && break
    429    done
    430    if test -f "$tmpdepfile"; then
    431       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
    432       sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    433    else
    434       echo "#dummy" > "$depfile"
    435    fi
    436    rm -f "$tmpdepfile"
    437    ;;
     479  # The Tru64 compiler uses -MD to generate dependencies as a side
     480  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
     481  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
     482  # dependencies in 'foo.d' instead, so we check for that too.
     483  # Subdirectories are respected.
     484  set_dir_from  "$object"
     485  set_base_from "$object"
     486
     487  if test "$libtool" = yes; then
     488    # Libtool generates 2 separate objects for the 2 libraries.  These
     489    # two compilations output dependencies in $dir.libs/$base.o.d and
     490    # in $dir$base.o.d.  We have to check for both files, because
     491    # one of the two compilations can be disabled.  We should prefer
     492    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
     493    # automatically cleaned when .libs/ is deleted, while ignoring
     494    # the former would cause a distcleancheck panic.
     495    tmpdepfile1=$dir$base.o.d          # libtool 1.5
     496    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
     497    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
     498    "$@" -Wc,-MD
     499  else
     500    tmpdepfile1=$dir$base.d
     501    tmpdepfile2=$dir$base.d
     502    tmpdepfile3=$dir$base.d
     503    "$@" -MD
     504  fi
     505
     506  stat=$?
     507  if test $stat -ne 0; then
     508    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     509    exit $stat
     510  fi
     511
     512  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     513  do
     514    test -f "$tmpdepfile" && break
     515  done
     516  # Same post-processing that is required for AIX mode.
     517  aix_post_process_depfile
     518  ;;
    438519
    439520msvc7)
     
    446527  stat=$?
    447528  grep -v '^Note: including file: ' "$tmpdepfile"
    448   if test "$stat" = 0; then :
    449   else
     529  if test $stat -ne 0; then
    450530    rm -f "$tmpdepfile"
    451531    exit $stat
     
    473553  p
    474554}' >> "$depfile"
     555  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
    475556  rm -f "$tmpdepfile"
    476557  ;;
     
    524605  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
    525606  "$@" $dashmflag |
    526     sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
     607    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
    527608  rm -f "$depfile"
    528609  cat < "$tmpdepfile" > "$depfile"
    529   tr ' ' "$nl" < "$tmpdepfile" | \
    530 ## Some versions of the HPUX 10.20 sed can't process this invocation
    531 ## correctly.  Breaking it into two sed invocations is a workaround.
    532     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
     610  # Some versions of the HPUX 10.20 sed can't process this sed invocation
     611  # correctly.  Breaking it into two sed invocations is a workaround.
     612  tr ' ' "$nl" < "$tmpdepfile" \
     613    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
     614    | sed -e 's/$/ :/' >> "$depfile"
    533615  rm -f "$tmpdepfile"
    534616  ;;
     
    583665  # No need to regex-escape $object, excess matching of '.' is harmless.
    584666  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
    585   sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
    586 ## Some versions of the HPUX 10.20 sed can't process this invocation
    587 ## correctly.  Breaking it into two sed invocations is a workaround.
    588     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
     667  # Some versions of the HPUX 10.20 sed can't process the last invocation
     668  # correctly.  Breaking it into two sed invocations is a workaround.
     669  sed '1,2d' "$tmpdepfile" \
     670    | tr ' ' "$nl" \
     671    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
     672    | sed -e 's/$/ :/' >> "$depfile"
    589673  rm -f "$tmpdepfile" "$tmpdepfile".bak
    590674  ;;
     
    622706  done
    623707
    624   "$@" -E |
    625     sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
    626        -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
    627     sed '$ s: \\$::' > "$tmpdepfile"
     708  "$@" -E \
     709    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
     710             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
     711    | sed '$ s: \\$::' > "$tmpdepfile"
    628712  rm -f "$depfile"
    629713  echo "$object : \\" > "$depfile"
     
    657741      ;;
    658742    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
    659         set fnord "$@"
    660         shift
    661         shift
    662         ;;
     743        set fnord "$@"
     744        shift
     745        shift
     746        ;;
    663747    *)
    664         set fnord "$@" "$arg"
    665         shift
    666         shift
    667         ;;
     748        set fnord "$@" "$arg"
     749        shift
     750        shift
     751        ;;
    668752    esac
    669753  done
  • TabularUnified libusb1/trunk/doc/Makefile.am

    r1876 r1882  
    66docs-upload: docs
    77        ln -s html api-1.0
    8         rsync -av api-1.0/ web.sourceforge.net:htdocs/api-1.0/
     8        scp -r api-1.0 pbatard@web.sourceforge.net:/home/project-web/libusb/htdocs
    99        rm -f api-1.0
    10 
  • TabularUnified libusb1/trunk/doc/Makefile.in

    r1879 r1882  
    1 # Makefile.in generated by automake 1.11.1 from Makefile.am.
     1# Makefile.in generated by automake 1.14.1 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
    6 # Inc.
     4# Copyright (C) 1994-2013 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    1615@SET_MAKE@
    1716VPATH = @srcdir@
     17am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
     18am__make_running_with_option = \
     19  case $${target_option-} in \
     20      ?) ;; \
     21      *) echo "am__make_running_with_option: internal error: invalid" \
     22              "target option '$${target_option-}' specified" >&2; \
     23         exit 1;; \
     24  esac; \
     25  has_opt=no; \
     26  sane_makeflags=$$MAKEFLAGS; \
     27  if $(am__is_gnu_make); then \
     28    sane_makeflags=$$MFLAGS; \
     29  else \
     30    case $$MAKEFLAGS in \
     31      *\\[\ \   ]*) \
     32        bs=\\; \
     33        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     34          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     35    esac; \
     36  fi; \
     37  skip_next=no; \
     38  strip_trailopt () \
     39  { \
     40    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     41  }; \
     42  for flg in $$sane_makeflags; do \
     43    test $$skip_next = yes && { skip_next=no; continue; }; \
     44    case $$flg in \
     45      *=*|--*) continue;; \
     46        -*I) strip_trailopt 'I'; skip_next=yes;; \
     47      -*I?*) strip_trailopt 'I';; \
     48        -*O) strip_trailopt 'O'; skip_next=yes;; \
     49      -*O?*) strip_trailopt 'O';; \
     50        -*l) strip_trailopt 'l'; skip_next=yes;; \
     51      -*l?*) strip_trailopt 'l';; \
     52      -[dEDm]) skip_next=yes;; \
     53      -[JT]) skip_next=yes;; \
     54    esac; \
     55    case $$flg in \
     56      *$$target_option*) has_opt=yes; break;; \
     57    esac; \
     58  done; \
     59  test $$has_opt = yes
     60am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     61am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    1862pkgdatadir = $(datadir)/@PACKAGE@
    1963pkgincludedir = $(includedir)/@PACKAGE@
     
    3579host_triplet = @host@
    3680subdir = doc
    37 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
     81DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
    3882        $(srcdir)/doxygen.cfg.in
    3983ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    4892CONFIG_CLEAN_FILES = doxygen.cfg
    4993CONFIG_CLEAN_VPATH_FILES =
    50 AM_V_GEN = $(am__v_GEN_$(V))
    51 am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
    52 am__v_GEN_0 = @echo "  GEN   " $@;
    53 AM_V_at = $(am__v_at_$(V))
    54 am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
     94AM_V_P = $(am__v_P_@AM_V@)
     95am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     96am__v_P_0 = false
     97am__v_P_1 = :
     98AM_V_GEN = $(am__v_GEN_@AM_V@)
     99am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     100am__v_GEN_0 = @echo "  GEN     " $@;
     101am__v_GEN_1 =
     102AM_V_at = $(am__v_at_@AM_V@)
     103am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    55104am__v_at_0 = @
     105am__v_at_1 =
    56106SOURCES =
    57107DIST_SOURCES =
     108am__can_run_installinfo = \
     109  case $$AM_UPDATE_INFO_DIR in \
     110    n|no|NO) false;; \
     111    *) (install-info --version) >/dev/null 2>&1;; \
     112  esac
     113am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    58114DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    59115ACLOCAL = @ACLOCAL@
     
    71127CPP = @CPP@
    72128CPPFLAGS = @CPPFLAGS@
     129CXX = @CXX@
     130CXXCPP = @CXXCPP@
     131CXXDEPMODE = @CXXDEPMODE@
     132CXXFLAGS = @CXXFLAGS@
    73133CYGPATH_W = @CYGPATH_W@
    74134DEFS = @DEFS@
     
    98158LTLDFLAGS = @LTLDFLAGS@
    99159LTLIBOBJS = @LTLIBOBJS@
    100 MAINT = @MAINT@
    101160MAKEINFO = @MAKEINFO@
    102161MANIFEST_TOOL = @MANIFEST_TOOL@
     
    107166OBJEXT = @OBJEXT@
    108167OS_DARWIN = @OS_DARWIN@
     168OS_HAIKU = @OS_HAIKU@
    109169OS_LINUX = @OS_LINUX@
     170OS_NETBSD = @OS_NETBSD@
    110171OS_OPENBSD = @OS_OPENBSD@
    111 OS_OS2 = @OS_OS2@
     172OS_SUNOS = @OS_SUNOS@
    112173OS_WINDOWS = @OS_WINDOWS@
    113174OTOOL = @OTOOL@
     
    121182PACKAGE_VERSION = @PACKAGE_VERSION@
    122183PATH_SEPARATOR = @PATH_SEPARATOR@
    123 PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
    124184RANLIB = @RANLIB@
    125185RC = @RC@
     
    128188SHELL = @SHELL@
    129189STRIP = @STRIP@
    130 THREAD_CFLAGS = @THREAD_CFLAGS@
    131190USE_UDEV = @USE_UDEV@
     191USE_USBDK = @USE_USBDK@
    132192VERSION = @VERSION@
    133 VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
    134193abs_builddir = @abs_builddir@
    135194abs_srcdir = @abs_srcdir@
     
    138197ac_ct_AR = @ac_ct_AR@
    139198ac_ct_CC = @ac_ct_CC@
     199ac_ct_CXX = @ac_ct_CXX@
    140200ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
    141201am__include = @am__include@
     
    188248
    189249.SUFFIXES:
    190 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
     250$(srcdir)/Makefile.in: $(srcdir)/Makefile.am  $(am__configure_deps)
    191251        @for dep in $?; do \
    192252          case '$(am__configure_deps)' in \
     
    213273        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    214274
    215 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
     275$(top_srcdir)/configure: $(am__configure_deps)
    216276        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    217 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
     277$(ACLOCAL_M4): $(am__aclocal_m4_deps)
    218278        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    219279$(am__aclocal_m4_deps):
     
    226286clean-libtool:
    227287        -rm -rf .libs _libs
    228 tags: TAGS
    229 TAGS:
    230 
    231 ctags: CTAGS
    232 CTAGS:
     288tags TAGS:
     289
     290ctags CTAGS:
     291
     292cscope cscopelist:
    233293
    234294
     
    277337installcheck: installcheck-am
    278338install-strip:
    279         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
    280           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
    281           `test -z '$(STRIP)' || \
    282             echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
     339        if test -z '$(STRIP)'; then \
     340          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     341            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     342              install; \
     343        else \
     344          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     345            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     346            "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
     347        fi
    283348mostlyclean-generic:
    284349
     
    361426
    362427.PHONY: all all-am check check-am clean clean-generic clean-libtool \
    363         distclean distclean-generic distclean-libtool distdir dvi \
    364         dvi-am html html-am info info-am install install-am \
    365         install-data install-data-am install-dvi install-dvi-am \
    366         install-exec install-exec-am install-html install-html-am \
    367         install-info install-info-am install-man install-pdf \
    368         install-pdf-am install-ps install-ps-am install-strip \
    369         installcheck installcheck-am installdirs maintainer-clean \
    370         maintainer-clean-generic mostlyclean mostlyclean-generic \
    371         mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
     428        cscopelist-am ctags-am distclean distclean-generic \
     429        distclean-libtool distdir dvi dvi-am html html-am info info-am \
     430        install install-am install-data install-data-am install-dvi \
     431        install-dvi-am install-exec install-exec-am install-html \
     432        install-html-am install-info install-info-am install-man \
     433        install-pdf install-pdf-am install-ps install-ps-am \
     434        install-strip installcheck installcheck-am installdirs \
     435        maintainer-clean maintainer-clean-generic mostlyclean \
     436        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
     437        tags-am uninstall uninstall-am
    372438
    373439
     
    377443docs-upload: docs
    378444        ln -s html api-1.0
    379         rsync -av api-1.0/ web.sourceforge.net:htdocs/api-1.0/
     445        scp -r api-1.0 pbatard@web.sourceforge.net:/home/project-web/libusb/htdocs
    380446        rm -f api-1.0
    381447
  • TabularUnified libusb1/trunk/doc/doxygen.cfg.in

    r1876 r1882  
    1 # Doxyfile 1.5.3
     1# Doxyfile 1.8.8
    22
    33# This file describes the settings to be used by the documentation system
    4 # doxygen (www.doxygen.org) for a project
    5 #
    6 # All text after a hash (#) is considered a comment and will be ignored
     4# doxygen (www.doxygen.org) for a project.
     5#
     6# All text after a double hash (##) is considered a comment and is placed in
     7# front of the TAG it is preceding.
     8#
     9# All text after a single hash (#) is considered a comment and will be ignored.
    710# The format is:
    8 #       TAG = value [value, ...]
    9 # For lists items can also be appended using:
    10 #       TAG += value [value, ...]
    11 # Values that contain spaces should be placed between quotes (" ")
     11# TAG = value [value, ...]
     12# For lists, items can also be appended using:
     13# TAG += value [value, ...]
     14# Values that contain spaces should be placed between quotes (\" \").
    1215
    1316#---------------------------------------------------------------------------
     
    1518#---------------------------------------------------------------------------
    1619
    17 # This tag specifies the encoding used for all characters in the config file that
    18 # follow. The default is UTF-8 which is also the encoding used for all text before
    19 # the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
    20 # libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
    21 # possible encodings.
     20# This tag specifies the encoding used for all characters in the config file
     21# that follow. The default is UTF-8 which is also the encoding used for all text
     22# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
     23# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
     24# for the list of possible encodings.
     25# The default value is: UTF-8.
    2226
    2327DOXYFILE_ENCODING      = UTF-8
    2428
    25 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
    26 # by quotes) that should identify the project.
    27 
    28 PROJECT_NAME           = libusb
    29 
    30 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
    31 # This could be handy for archiving the generated documentation or
    32 # if some version control system is used.
    33 
    34 PROJECT_NUMBER         =
    35 
    36 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
    37 # base path where the generated documentation will be put.
    38 # If a relative path is entered, it will be relative to the location
    39 # where doxygen was started. If left blank the current directory will be used.
    40 
    41 OUTPUT_DIRECTORY       =
    42 
    43 # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
    44 # 4096 sub-directories (in 2 levels) under the output directory of each output
    45 # format and will distribute the generated files over these directories.
    46 # Enabling this option can be useful when feeding doxygen a huge amount of
    47 # source files, where putting all generated files in the same directory would
    48 # otherwise cause performance problems for the file system.
     29# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
     30# double-quotes, unless you are using Doxywizard) that should identify the
     31# project for which the documentation is generated. This name is used in the
     32# title of most generated pages and in a few other places.
     33# The default value is: My Project.
     34
     35PROJECT_NAME           =
     36
     37# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
     38# could be handy for archiving the generated documentation or if some version
     39# control system is used.
     40
     41PROJECT_NUMBER         =
     42
     43# Using the PROJECT_BRIEF tag one can provide an optional one line description
     44# for a project that appears at the top of each page and should give viewer a
     45# quick idea about the purpose of the project. Keep the description short.
     46
     47PROJECT_BRIEF          = "A cross-platform user library to access USB devices"
     48
     49# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
     50# the documentation. The maximum height of the logo should not exceed 55 pixels
     51# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
     52# to the output directory.
     53
     54PROJECT_LOGO           = libusb.png
     55
     56# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
     57# into which the generated documentation will be written. If a relative path is
     58# entered, it will be relative to the location where doxygen was started. If
     59# left blank the current directory will be used.
     60
     61OUTPUT_DIRECTORY       =
     62
     63# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
     64# directories (in 2 levels) under the output directory of each output format and
     65# will distribute the generated files over these directories. Enabling this
     66# option can be useful when feeding doxygen a huge amount of source files, where
     67# putting all generated files in the same directory would otherwise causes
     68# performance problems for the file system.
     69# The default value is: NO.
    4970
    5071CREATE_SUBDIRS         = NO
    5172
    52 # The OUTPUT_LANGUAGE tag is used to specify the language in which all
    53 # documentation generated by doxygen is written. Doxygen will use this
    54 # information to generate all constant output in the proper language.
    55 # The default language is English, other supported languages are:
    56 # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
    57 # Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
    58 # Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
    59 # Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
    60 # Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
     73# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
     74# characters to appear in the names of generated files. If set to NO, non-ASCII
     75# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
     76# U+3044.
     77# The default value is: NO.
     78
     79ALLOW_UNICODE_NAMES    = NO
     80
     81# The OUTPUT_LANGUAGE tag is used to specify the language in which all
     82# documentation generated by doxygen is written. Doxygen will use this
     83# information to generate all constant output in the proper language.
     84# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
     85# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
     86# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
     87# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
     88# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
     89# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
     90# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
     91# Ukrainian and Vietnamese.
     92# The default value is: English.
    6193
    6294OUTPUT_LANGUAGE        = English
    6395
    64 # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
    65 # include brief member descriptions after the members that are listed in
    66 # the file and class documentation (similar to JavaDoc).
    67 # Set to NO to disable this.
     96# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
     97# descriptions after the members that are listed in the file and class
     98# documentation (similar to Javadoc). Set to NO to disable this.
     99# The default value is: YES.
    68100
    69101BRIEF_MEMBER_DESC      = YES
    70102
    71 # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
    72 # the brief description of a member or function before the detailed description.
    73 # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
     103# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
     104# description of a member or function before the detailed description
     105#
     106# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
    74107# brief descriptions will be completely suppressed.
     108# The default value is: YES.
    75109
    76110REPEAT_BRIEF           = YES
    77111
    78 # This tag implements a quasi-intelligent brief description abbreviator
    79 # that is used to form the text in various listings. Each string
    80 # in this list, if found as the leading text of the brief description, will be
    81 # stripped from the text and the result after processing the whole list, is
    82 # used as the annotated text. Otherwise, the brief description is used as-is.
    83 # If left blank, the following values are used ("$name" is automatically
    84 # replaced with the name of the entity): "The $name class" "The $name widget"
    85 # "The $name file" "is" "provides" "specifies" "contains"
    86 # "represents" "a" "an" "the"
    87 
    88 ABBREVIATE_BRIEF       =
    89 
    90 # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
    91 # Doxygen will generate a detailed section even if there is only a brief
     112# This tag implements a quasi-intelligent brief description abbreviator that is
     113# used to form the text in various listings. Each string in this list, if found
     114# as the leading text of the brief description, will be stripped from the text
     115# and the result, after processing the whole list, is used as the annotated
     116# text. Otherwise, the brief description is used as-is. If left blank, the
     117# following values are used ($name is automatically replaced with the name of
     118# the entity):The $name class, The $name widget, The $name file, is, provides,
     119# specifies, contains, represents, a, an and the.
     120
     121ABBREVIATE_BRIEF       =
     122
     123# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
     124# doxygen will generate a detailed section even if there is only a brief
    92125# description.
     126# The default value is: NO.
    93127
    94128ALWAYS_DETAILED_SEC    = NO
    95129
    96 # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
    97 # inherited members of a class in the documentation of that class as if those 
    98 # members were ordinary class members. Constructors, destructors and assignment 
     130# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
     131# inherited members of a class in the documentation of that class as if those
     132# members were ordinary class members. Constructors, destructors and assignment
    99133# operators of the base classes will not be shown.
     134# The default value is: NO.
    100135
    101136INLINE_INHERITED_MEMB  = NO
    102137
    103 # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
    104 # path before files name in the file list and in the header files. If set
    105 # to NO the shortest path that makes the file name unique will be used.
     138# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
     139# before files name in the file list and in the header files. If set to NO the
     140# shortest path that makes the file name unique will be used
     141# The default value is: YES.
    106142
    107143FULL_PATH_NAMES        = NO
    108144
    109 # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
    110 # can be used to strip a user-defined part of the path. Stripping is
    111 # only done if one of the specified strings matches the left-hand part of
    112 # the path. The tag can be used to show relative paths in the file list.
    113 # If left blank the directory from which doxygen is run is used as the
    114 # path to strip.
    115 
    116 STRIP_FROM_PATH        =
    117 
    118 # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
    119 # the path mentioned in the documentation of a class, which tells
    120 # the reader which header file to include in order to use a class.
    121 # If left blank only the name of the header file containing the class
    122 # definition is used. Otherwise one should specify the include paths that
    123 # are normally passed to the compiler using the -I flag.
    124 
    125 STRIP_FROM_INC_PATH    =
    126 
    127 # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
    128 # (but less readable) file names. This can be useful is your file systems
    129 # doesn't support long names like on DOS, Mac, or CD-ROM.
     145# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
     146# Stripping is only done if one of the specified strings matches the left-hand
     147# part of the path. The tag can be used to show relative paths in the file list.
     148# If left blank the directory from which doxygen is run is used as the path to
     149# strip.
     150#
     151# Note that you can specify absolute paths here, but also relative paths, which
     152# will be relative from the directory where doxygen is started.
     153# This tag requires that the tag FULL_PATH_NAMES is set to YES.
     154
     155STRIP_FROM_PATH        =
     156
     157# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
     158# path mentioned in the documentation of a class, which tells the reader which
     159# header file to include in order to use a class. If left blank only the name of
     160# the header file containing the class definition is used. Otherwise one should
     161# specify the list of include paths that are normally passed to the compiler
     162# using the -I flag.
     163
     164STRIP_FROM_INC_PATH    =
     165
     166# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
     167# less readable) file names. This can be useful is your file systems doesn't
     168# support long names like on DOS, Mac, or CD-ROM.
     169# The default value is: NO.
    130170
    131171SHORT_NAMES            = NO
    132172
    133 # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
    134 # will interpret the first line (until the first dot) of a JavaDoc-style
    135 # comment as the brief description. If set to NO, the JavaDoc
    136 # comments will behave just like regular Qt-style comments
    137 # (thus requiring an explicit @brief command for a brief description.)
     173# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
     174# first line (until the first dot) of a Javadoc-style comment as the brief
     175# description. If set to NO, the Javadoc-style will behave just like regular Qt-
     176# style comments (thus requiring an explicit @brief command for a brief
     177# description.)
     178# The default value is: NO.
    138179
    139180JAVADOC_AUTOBRIEF      = YES
    140181
    141 # If the QT_AUTOBRIEF tag is set to YES then Doxygen will
    142 # interpret the first line (until the first dot) of a Qt-style
    143 # comment as the brief description. If set to NO, the comments
    144 # will behave just like regular Qt-style comments (thus requiring
    145 # an explicit \brief command for a brief description.)
     182# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
     183# line (until the first dot) of a Qt-style comment as the brief description. If
     184# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
     185# requiring an explicit \brief command for a brief description.)
     186# The default value is: NO.
    146187
    147188QT_AUTOBRIEF           = NO
    148189
    149 # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
    150 # treat a multi-line C++ special comment block (i.e. a block of //! or ///
    151 # comments) as a brief description. This used to be the default behaviour.
    152 # The new default is to treat a multi-line C++ comment block as a detailed
    153 # description. Set this tag to YES if you prefer the old behaviour instead.
     190# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
     191# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
     192# a brief description. This used to be the default behavior. The new default is
     193# to treat a multi-line C++ comment block as a detailed description. Set this
     194# tag to YES if you prefer the old behavior instead.
     195#
     196# Note that setting this tag to YES also means that rational rose comments are
     197# not recognized any more.
     198# The default value is: NO.
    154199
    155200MULTILINE_CPP_IS_BRIEF = NO
    156201
    157 # If the DETAILS_AT_TOP tag is set to YES then Doxygen
    158 # will output the detailed description near the top, like JavaDoc.
    159 # If set to NO, the detailed description appears after the member
    160 # documentation.
    161 
    162 DETAILS_AT_TOP         = NO
    163 
    164 # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
    165 # member inherits the documentation from any documented member that it
    166 # re-implements.
     202# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
     203# documentation from any documented member that it re-implements.
     204# The default value is: YES.
    167205
    168206INHERIT_DOCS           = YES
    169207
    170 # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
    171 # a new page for each member. If set to NO, the documentation of a member will
    172 # be part of the file/class/namespace that contains it.
     208# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
     209# new page for each member. If set to NO, the documentation of a member will be
     210# part of the file/class/namespace that contains it.
     211# The default value is: NO.
    173212
    174213SEPARATE_MEMBER_PAGES  = NO
    175214
    176 # The TAB_SIZE tag can be used to set the number of spaces in a tab.
    177 # Doxygen uses this value to replace tabs by spaces in code fragments.
     215# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
     216# uses this value to replace tabs by spaces in code fragments.
     217# Minimum value: 1, maximum value: 16, default value: 4.
    178218
    179219TAB_SIZE               = 4
    180220
    181 # This tag can be used to specify a number of aliases that acts
    182 # as commands in the documentation. An alias has the form "name=value".
    183 # For example adding "sideeffect=\par Side Effects:\n" will allow you to
    184 # put the command \sideeffect (or @sideeffect) in the documentation, which
    185 # will result in a user-defined paragraph with heading "Side Effects:".
    186 # You can put \n's in the value part of an alias to insert newlines.
    187 
    188 ALIASES                =
    189 
    190 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
    191 # sources only. Doxygen will then generate output that is more tailored for C.
    192 # For instance, some of the names that are used will be different. The list
    193 # of all members will be omitted, etc.
     221# This tag can be used to specify a number of aliases that act as commands in
     222# the documentation. An alias has the form:
     223# name=value
     224# For example adding
     225# "sideeffect=@par Side Effects:\n"
     226# will allow you to put the command \sideeffect (or @sideeffect) in the
     227# documentation, which will result in a user-defined paragraph with heading
     228# "Side Effects:". You can put \n's in the value part of an alias to insert
     229# newlines.
     230
     231ALIASES                =
     232
     233# This tag can be used to specify a number of word-keyword mappings (TCL only).
     234# A mapping has the form "name=value". For example adding "class=itcl::class"
     235# will allow you to use the command class in the itcl::class meaning.
     236
     237TCL_SUBST              =
     238
     239# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
     240# only. Doxygen will then generate output that is more tailored for C. For
     241# instance, some of the names that are used will be different. The list of all
     242# members will be omitted, etc.
     243# The default value is: NO.
    194244
    195245OPTIMIZE_OUTPUT_FOR_C  = YES
    196246
    197 # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
    198 # sources only. Doxygen will then generate output that is more tailored for Java.
    199 # For instance, namespaces will be presented as packages, qualified scopes
    200 # will look different, etc.
     247# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
     248# Python sources only. Doxygen will then generate output that is more tailored
     249# for that language. For instance, namespaces will be presented as packages,
     250# qualified scopes will look different, etc.
     251# The default value is: NO.
    201252
    202253OPTIMIZE_OUTPUT_JAVA   = NO
    203254
    204 # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
    205 # include (a tag file for) the STL sources as input, then you should
    206 # set this tag to YES in order to let doxygen match functions declarations and
    207 # definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
    208 # func(std::string) {}). This also make the inheritance and collaboration
     255# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
     256# sources. Doxygen will then generate output that is tailored for Fortran.
     257# The default value is: NO.
     258
     259OPTIMIZE_FOR_FORTRAN   = NO
     260
     261# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
     262# sources. Doxygen will then generate output that is tailored for VHDL.
     263# The default value is: NO.
     264
     265OPTIMIZE_OUTPUT_VHDL   = NO
     266
     267# Doxygen selects the parser to use depending on the extension of the files it
     268# parses. With this tag you can assign which parser to use for a given
     269# extension. Doxygen has a built-in mapping, but you can override or extend it
     270# using this tag. The format is ext=language, where ext is a file extension, and
     271# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
     272# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
     273# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
     274# Fortran. In the later case the parser tries to guess whether the code is fixed
     275# or free formatted code, this is the default for Fortran type files), VHDL. For
     276# instance to make doxygen treat .inc files as Fortran files (default is PHP),
     277# and .f files as C (default is Fortran), use: inc=Fortran f=C.
     278#
     279# Note For files without extension you can use no_extension as a placeholder.
     280#
     281# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
     282# the files are not read by doxygen.
     283
     284EXTENSION_MAPPING      =
     285
     286# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
     287# according to the Markdown format, which allows for more readable
     288# documentation. See http://daringfireball.net/projects/markdown/ for details.
     289# The output of markdown processing is further processed by doxygen, so you can
     290# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
     291# case of backward compatibilities issues.
     292# The default value is: YES.
     293
     294MARKDOWN_SUPPORT       = YES
     295
     296# When enabled doxygen tries to link words that correspond to documented
     297# classes, or namespaces to their corresponding documentation. Such a link can
     298# be prevented in individual cases by by putting a % sign in front of the word
     299# or globally by setting AUTOLINK_SUPPORT to NO.
     300# The default value is: YES.
     301
     302AUTOLINK_SUPPORT       = YES
     303
     304# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
     305# to include (a tag file for) the STL sources as input, then you should set this
     306# tag to YES in order to let doxygen match functions declarations and
     307# definitions whose arguments contain STL classes (e.g. func(std::string);
     308# versus func(std::string) {}). This also make the inheritance and collaboration
    209309# diagrams that involve STL classes more complete and accurate.
     310# The default value is: NO.
    210311
    211312BUILTIN_STL_SUPPORT    = NO
     
    213314# If you use Microsoft's C++/CLI language, you should set this option to YES to
    214315# enable parsing support.
     316# The default value is: NO.
    215317
    216318CPP_CLI_SUPPORT        = NO
    217319
    218 # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
    219 # tag is set to YES, then doxygen will reuse the documentation of the first
    220 # member in the group (if any) for the other members of the group. By default
     320# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
     321# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
     322# will parse them like normal C++ but will assume all classes use public instead
     323# of private inheritance when no explicit protection keyword is present.
     324# The default value is: NO.
     325
     326SIP_SUPPORT            = NO
     327
     328# For Microsoft's IDL there are propget and propput attributes to indicate
     329# getter and setter methods for a property. Setting this option to YES will make
     330# doxygen to replace the get and set methods by a property in the documentation.
     331# This will only work if the methods are indeed getting or setting a simple
     332# type. If this is not the case, or you want to show the methods anyway, you
     333# should set this option to NO.
     334# The default value is: YES.
     335
     336IDL_PROPERTY_SUPPORT   = YES
     337
     338# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
     339# tag is set to YES, then doxygen will reuse the documentation of the first
     340# member in the group (if any) for the other members of the group. By default
    221341# all members of a group must be documented explicitly.
     342# The default value is: NO.
    222343
    223344DISTRIBUTE_GROUP_DOC   = NO
    224345
    225 # Set the SUBGROUPING tag to YES (the default) to allow class member groups of
    226 # the same type (for instance a group of public functions) to be put as a
    227 # subgroup of that type (e.g. under the Public Functions section). Set it to
    228 # NO to prevent subgrouping. Alternatively, this can be done per class using
    229 # the \nosubgrouping command.
     346# Set the SUBGROUPING tag to YES to allow class member groups of the same type
     347# (for instance a group of public functions) to be put as a subgroup of that
     348# type (e.g. under the Public Functions section). Set it to NO to prevent
     349# subgrouping. Alternatively, this can be done per class using the
     350# \nosubgrouping command.
     351# The default value is: YES.
    230352
    231353SUBGROUPING            = YES
    232354
     355# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
     356# are shown inside the group in which they are included (e.g. using \ingroup)
     357# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
     358# and RTF).
     359#
     360# Note that this feature does not work in combination with
     361# SEPARATE_MEMBER_PAGES.
     362# The default value is: NO.
     363
     364INLINE_GROUPED_CLASSES = NO
     365
     366# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
     367# with only public data fields or simple typedef fields will be shown inline in
     368# the documentation of the scope in which they are defined (i.e. file,
     369# namespace, or group documentation), provided this scope is documented. If set
     370# to NO, structs, classes, and unions are shown on a separate page (for HTML and
     371# Man pages) or section (for LaTeX and RTF).
     372# The default value is: NO.
     373
     374INLINE_SIMPLE_STRUCTS  = NO
     375
     376# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
     377# enum is documented as struct, union, or enum with the name of the typedef. So
     378# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
     379# with name TypeT. When disabled the typedef will appear as a member of a file,
     380# namespace, or class. And the struct will be named TypeS. This can typically be
     381# useful for C code in case the coding convention dictates that all compound
     382# types are typedef'ed and only the typedef is referenced, never the tag name.
     383# The default value is: NO.
     384
     385TYPEDEF_HIDES_STRUCT   = NO
     386
     387# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
     388# cache is used to resolve symbols given their name and scope. Since this can be
     389# an expensive process and often the same symbol appears multiple times in the
     390# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
     391# doxygen will become slower. If the cache is too large, memory is wasted. The
     392# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
     393# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
     394# symbols. At the end of a run doxygen will report the cache usage and suggest
     395# the optimal cache size from a speed point of view.
     396# Minimum value: 0, maximum value: 9, default value: 0.
     397
     398LOOKUP_CACHE_SIZE      = 0
     399
    233400#---------------------------------------------------------------------------
    234401# Build related configuration options
    235402#---------------------------------------------------------------------------
    236403
    237 # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
    238 # documentation are documented, even if no documentation was available.
    239 # Private class members and static file members will be hidden unless
    240 # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
     404# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
     405# documentation are documented, even if no documentation was available. Private
     406# class members and static file members will be hidden unless the
     407# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
     408# Note: This will also disable the warnings about undocumented members that are
     409# normally produced when WARNINGS is set to YES.
     410# The default value is: NO.
    241411
    242412EXTRACT_ALL            = NO
    243413
    244 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
    245 # will be included in the documentation.
     414# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
     415# be included in the documentation.
     416# The default value is: NO.
    246417
    247418EXTRACT_PRIVATE        = NO
    248419
    249 # If the EXTRACT_STATIC tag is set to YES all static members of a file
    250 # will be included in the documentation.
     420# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
     421# scope will be included in the documentation.
     422# The default value is: NO.
     423
     424EXTRACT_PACKAGE        = NO
     425
     426# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
     427# included in the documentation.
     428# The default value is: NO.
    251429
    252430EXTRACT_STATIC         = YES
    253431
    254 # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
    255 # defined locally in source files will be included in the documentation.
    256 # If set to NO only classes defined in header files are included.
     432# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
     433# locally in source files will be included in the documentation. If set to NO
     434# only classes defined in header files are included. Does not have any effect
     435# for Java sources.
     436# The default value is: YES.
    257437
    258438EXTRACT_LOCAL_CLASSES  = YES
    259439
    260 # This flag is only useful for Objective-C code. When set to YES local
    261 # methods, which are defined in the implementation section but not in
    262 # the interface are included in the documentation.
    263 # If set to NO (the default) only methods in the interface are included.
     440# This flag is only useful for Objective-C code. When set to YES local methods,
     441# which are defined in the implementation section but not in the interface are
     442# included in the documentation. If set to NO only methods in the interface are
     443# included.
     444# The default value is: NO.
    264445
    265446EXTRACT_LOCAL_METHODS  = NO
    266447
    267 # If this flag is set to YES, the members of anonymous namespaces will be extracted
    268 # and appear in the documentation as a namespace called 'anonymous_namespace{file}',
    269 # where file will be replaced with the base name of the file that contains the anonymous
    270 # namespace. By default anonymous namespace are hidden.
     448# If this flag is set to YES, the members of anonymous namespaces will be
     449# extracted and appear in the documentation as a namespace called
     450# 'anonymous_namespace{file}', where file will be replaced with the base name of
     451# the file that contains the anonymous namespace. By default anonymous namespace
     452# are hidden.
     453# The default value is: NO.
    271454
    272455EXTRACT_ANON_NSPACES   = NO
    273456
    274 # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
    275 # undocumented members of documented classes, files or namespaces.
    276 # If set to NO (the default) these members will be included in the
    277 # various overviews, but no documentation section is generated.
    278 # This option has no effect if EXTRACT_ALL is enabled.
     457# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
     458# undocumented members inside documented classes or files. If set to NO these
     459# members will be included in the various overviews, but no documentation
     460# section is generated. This option has no effect if EXTRACT_ALL is enabled.
     461# The default value is: NO.
    279462
    280463HIDE_UNDOC_MEMBERS     = NO
    281464
    282 # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
    283 # undocumented classes that are normally visible in the class hierarchy.
    284 # If set to NO (the default) these classes will be included in the various
    285 # overviews. This option has no effect if EXTRACT_ALL is enabled.
     465# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
     466# undocumented classes that are normally visible in the class hierarchy. If set
     467# to NO these classes will be included in the various overviews. This option has
     468# no effect if EXTRACT_ALL is enabled.
     469# The default value is: NO.
    286470
    287471HIDE_UNDOC_CLASSES     = NO
    288472
    289 # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
    290 # friend (class|struct|union) declarations.
    291 # If set to NO (the default) these declarations will be included in the
     473# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
     474# (class|struct|union) declarations. If set to NO these declarations will be
     475# included in the documentation.
     476# The default value is: NO.
     477
     478HIDE_FRIEND_COMPOUNDS  = NO
     479
     480# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
     481# documentation blocks found inside the body of a function. If set to NO these
     482# blocks will be appended to the function's detailed documentation block.
     483# The default value is: NO.
     484
     485HIDE_IN_BODY_DOCS      = NO
     486
     487# The INTERNAL_DOCS tag determines if documentation that is typed after a
     488# \internal command is included. If the tag is set to NO then the documentation
     489# will be excluded. Set it to YES to include the internal documentation.
     490# The default value is: NO.
     491
     492INTERNAL_DOCS          = NO
     493
     494# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
     495# names in lower-case letters. If set to YES upper-case letters are also
     496# allowed. This is useful if you have classes or files whose names only differ
     497# in case and if your file system supports case sensitive file names. Windows
     498# and Mac users are advised to set this option to NO.
     499# The default value is: system dependent.
     500
     501CASE_SENSE_NAMES       = YES
     502
     503# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
     504# their full class and namespace scopes in the documentation. If set to YES the
     505# scope will be hidden.
     506# The default value is: NO.
     507
     508HIDE_SCOPE_NAMES       = NO
     509
     510# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
     511# the files that are included by a file in the documentation of that file.
     512# The default value is: YES.
     513
     514SHOW_INCLUDE_FILES     = YES
     515
     516# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
     517# grouped member an include statement to the documentation, telling the reader
     518# which file to include in order to use the member.
     519# The default value is: NO.
     520
     521SHOW_GROUPED_MEMB_INC  = NO
     522
     523# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
     524# files with double quotes in the documentation rather than with sharp brackets.
     525# The default value is: NO.
     526
     527FORCE_LOCAL_INCLUDES   = NO
     528
     529# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
     530# documentation for inline members.
     531# The default value is: YES.
     532
     533INLINE_INFO            = YES
     534
     535# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
     536# (detailed) documentation of file and class members alphabetically by member
     537# name. If set to NO the members will appear in declaration order.
     538# The default value is: YES.
     539
     540SORT_MEMBER_DOCS       = NO
     541
     542# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
     543# descriptions of file, namespace and class members alphabetically by member
     544# name. If set to NO the members will appear in declaration order. Note that
     545# this will also influence the order of the classes in the class list.
     546# The default value is: NO.
     547
     548SORT_BRIEF_DOCS        = NO
     549
     550# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
     551# (brief and detailed) documentation of class members so that constructors and
     552# destructors are listed first. If set to NO the constructors will appear in the
     553# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
     554# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
     555# member documentation.
     556# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
     557# detailed member documentation.
     558# The default value is: NO.
     559
     560SORT_MEMBERS_CTORS_1ST = NO
     561
     562# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
     563# of group names into alphabetical order. If set to NO the group names will
     564# appear in their defined order.
     565# The default value is: NO.
     566
     567SORT_GROUP_NAMES       = NO
     568
     569# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
     570# fully-qualified names, including namespaces. If set to NO, the class list will
     571# be sorted only by class name, not including the namespace part.
     572# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
     573# Note: This option applies only to the class list, not to the alphabetical
     574# list.
     575# The default value is: NO.
     576
     577SORT_BY_SCOPE_NAME     = NO
     578
     579# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
     580# type resolution of all parameters of a function it will reject a match between
     581# the prototype and the implementation of a member function even if there is
     582# only one candidate or it is obvious which candidate to choose by doing a
     583# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
     584# accept a match between prototype and implementation in such cases.
     585# The default value is: NO.
     586
     587STRICT_PROTO_MATCHING  = NO
     588
     589# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
     590# todo list. This list is created by putting \todo commands in the
    292591# documentation.
    293 
    294 HIDE_FRIEND_COMPOUNDS  = NO
    295 
    296 # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
    297 # documentation blocks found inside the body of a function.
    298 # If set to NO (the default) these blocks will be appended to the
    299 # function's detailed documentation block.
    300 
    301 HIDE_IN_BODY_DOCS      = NO
    302 
    303 # The INTERNAL_DOCS tag determines if documentation
    304 # that is typed after a \internal command is included. If the tag is set
    305 # to NO (the default) then the documentation will be excluded.
    306 # Set it to YES to include the internal documentation.
    307 
    308 INTERNAL_DOCS          = NO
    309 
    310 # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
    311 # file names in lower-case letters. If set to YES upper-case letters are also
    312 # allowed. This is useful if you have classes or files whose names only differ
    313 # in case and if your file system supports case sensitive file names. Windows
    314 # and Mac users are advised to set this option to NO.
    315 
    316 CASE_SENSE_NAMES       = YES
    317 
    318 # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
    319 # will show members with their full class and namespace scopes in the
    320 # documentation. If set to YES the scope will be hidden.
    321 
    322 HIDE_SCOPE_NAMES       = NO
    323 
    324 # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
    325 # will put a list of the files that are included by a file in the documentation
    326 # of that file.
    327 
    328 SHOW_INCLUDE_FILES     = YES
    329 
    330 # If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
    331 # is inserted in the documentation for inline members.
    332 
    333 INLINE_INFO            = YES
    334 
    335 # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
    336 # will sort the (detailed) documentation of file and class members
    337 # alphabetically by member name. If set to NO the members will appear in
    338 # declaration order.
    339 
    340 SORT_MEMBER_DOCS       = NO
    341 
    342 # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
    343 # brief documentation of file, namespace and class members alphabetically
    344 # by member name. If set to NO (the default) the members will appear in
    345 # declaration order.
    346 
    347 SORT_BRIEF_DOCS        = NO
    348 
    349 # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
    350 # sorted by fully-qualified names, including namespaces. If set to
    351 # NO (the default), the class list will be sorted only by class name,
    352 # not including the namespace part.
    353 # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
    354 # Note: This option applies only to the class list, not to the
    355 # alphabetical list.
    356 
    357 SORT_BY_SCOPE_NAME     = NO
    358 
    359 # The GENERATE_TODOLIST tag can be used to enable (YES) or
    360 # disable (NO) the todo list. This list is created by putting \todo
    361 # commands in the documentation.
     592# The default value is: YES.
    362593
    363594GENERATE_TODOLIST      = YES
    364595
    365 # The GENERATE_TESTLIST tag can be used to enable (YES) or
    366 # disable (NO) the test list. This list is created by putting \test
    367 # commands in the documentation.
     596# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
     597# test list. This list is created by putting \test commands in the
     598# documentation.
     599# The default value is: YES.
    368600
    369601GENERATE_TESTLIST      = YES
    370602
    371 # The GENERATE_BUGLIST tag can be used to enable (YES) or
    372 # disable (NO) the bug list. This list is created by putting \bug
    373 # commands in the documentation.
     603# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
     604# list. This list is created by putting \bug commands in the documentation.
     605# The default value is: YES.
    374606
    375607GENERATE_BUGLIST       = YES
    376608
    377 # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
    378 # disable (NO) the deprecated list. This list is created by putting
    379 # \deprecated commands in the documentation.
     609# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
     610# the deprecated list. This list is created by putting \deprecated commands in
     611# the documentation.
     612# The default value is: YES.
    380613
    381614GENERATE_DEPRECATEDLIST= YES
    382615
    383 # The ENABLED_SECTIONS tag can be used to enable conditional
    384 # documentation sections, marked by \if sectionname ... \endif.
    385 
    386 ENABLED_SECTIONS       =
    387 
    388 # The MAX_INITIALIZER_LINES tag determines the maximum number of lines
    389 # the initial value of a variable or define consists of for it to appear in
    390 # the documentation. If the initializer consists of more lines than specified
    391 # here it will be hidden. Use a value of 0 to hide initializers completely.
    392 # The appearance of the initializer of individual variables and defines in the
    393 # documentation can be controlled using \showinitializer or \hideinitializer
    394 # command in the documentation regardless of this setting.
     616# The ENABLED_SECTIONS tag can be used to enable conditional documentation
     617# sections, marked by \if <section_label> ... \endif and \cond <section_label>
     618# ... \endcond blocks.
     619
     620ENABLED_SECTIONS       =
     621
     622# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
     623# initial value of a variable or macro / define can have for it to appear in the
     624# documentation. If the initializer consists of more lines than specified here
     625# it will be hidden. Use a value of 0 to hide initializers completely. The
     626# appearance of the value of individual variables and macros / defines can be
     627# controlled using \showinitializer or \hideinitializer command in the
     628# documentation regardless of this setting.
     629# Minimum value: 0, maximum value: 10000, default value: 30.
    395630
    396631MAX_INITIALIZER_LINES  = 30
    397632
    398 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated
    399 # at the bottom of the documentation of classes and structs. If set to YES the
    400 # list will mention the files that were used to generate the documentation.
     633# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
     634# the bottom of the documentation of classes and structs. If set to YES the list
     635# will mention the files that were used to generate the documentation.
     636# The default value is: YES.
    401637
    402638SHOW_USED_FILES        = YES
    403639
    404 # If the sources in your project are distributed over multiple directories
    405 # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
    406 # in the documentation. The default is NO.
    407 
    408 SHOW_DIRECTORIES       = NO
    409 
    410 # The FILE_VERSION_FILTER tag can be used to specify a program or script that
    411 # doxygen should invoke to get the current version for each file (typically from the
    412 # version control system). Doxygen will invoke the program by executing (via
    413 # popen()) the command <command> <input-file>, where <command> is the value of
    414 # the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
    415 # provided by doxygen. Whatever the program writes to standard output
    416 # is used as the file version. See the manual for examples.
    417 
    418 FILE_VERSION_FILTER    =
    419 
    420 #---------------------------------------------------------------------------
    421 # configuration options related to warning and progress messages
    422 #---------------------------------------------------------------------------
    423 
    424 # The QUIET tag can be used to turn on/off the messages that are generated
    425 # by doxygen. Possible values are YES and NO. If left blank NO is used.
    426 
    427 QUIET                  = NO
    428 
    429 # The WARNINGS tag can be used to turn on/off the warning messages that are
    430 # generated by doxygen. Possible values are YES and NO. If left blank
    431 # NO is used.
     640# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
     641# will remove the Files entry from the Quick Index and from the Folder Tree View
     642# (if specified).
     643# The default value is: YES.
     644
     645SHOW_FILES             = YES
     646
     647# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
     648# page. This will remove the Namespaces entry from the Quick Index and from the
     649# Folder Tree View (if specified).
     650# The default value is: YES.
     651
     652SHOW_NAMESPACES        = YES
     653
     654# The FILE_VERSION_FILTER tag can be used to specify a program or script that
     655# doxygen should invoke to get the current version for each file (typically from
     656# the version control system). Doxygen will invoke the program by executing (via
     657# popen()) the command command input-file, where command is the value of the
     658# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
     659# by doxygen. Whatever the program writes to standard output is used as the file
     660# version. For an example see the documentation.
     661
     662FILE_VERSION_FILTER    =
     663
     664# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
     665# by doxygen. The layout file controls the global structure of the generated
     666# output files in an output format independent way. To create the layout file
     667# that represents doxygen's defaults, run doxygen with the -l option. You can
     668# optionally specify a file name after the option, if omitted DoxygenLayout.xml
     669# will be used as the name of the layout file.
     670#
     671# Note that if you run doxygen from a directory containing a file called
     672# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
     673# tag is left empty.
     674
     675LAYOUT_FILE            =
     676
     677# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
     678# the reference definitions. This must be a list of .bib files. The .bib
     679# extension is automatically appended if omitted. This requires the bibtex tool
     680# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
     681# For LaTeX the style of the bibliography can be controlled using
     682# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
     683# search path. See also \cite for info how to create references.
     684
     685CITE_BIB_FILES         =
     686
     687#---------------------------------------------------------------------------
     688# Configuration options related to warning and progress messages
     689#---------------------------------------------------------------------------
     690
     691# The QUIET tag can be used to turn on/off the messages that are generated to
     692# standard output by doxygen. If QUIET is set to YES this implies that the
     693# messages are off.
     694# The default value is: NO.
     695
     696QUIET                  = YES
     697
     698# The WARNINGS tag can be used to turn on/off the warning messages that are
     699# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
     700# this implies that the warnings are on.
     701#
     702# Tip: Turn warnings on while writing the documentation.
     703# The default value is: YES.
    432704
    433705WARNINGS               = YES
    434706
    435 # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
    436 # for undocumented members. If EXTRACT_ALL is set to YES then this flag will
    437 # automatically be disabled.
     707# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
     708# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
     709# will automatically be disabled.
     710# The default value is: YES.
    438711
    439712WARN_IF_UNDOCUMENTED   = YES
    440713
    441 # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
    442 # potential errors in the documentation, such as not documenting some
    443 # parameters in a documented function, or documenting parameters that
    444 # don't exist or using markup commands wrongly.
     714# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
     715# potential errors in the documentation, such as not documenting some parameters
     716# in a documented function, or documenting parameters that don't exist or using
     717# markup commands wrongly.
     718# The default value is: YES.
    445719
    446720WARN_IF_DOC_ERROR      = YES
    447721
    448 # This WARN_NO_PARAMDOC option can be abled to get warnings for
    449 # functions that are documented, but have no documentation for their parameters
    450 # or return value. If set to NO (the default) doxygen will only warn about
    451 # wrong or incomplete parameter documentation, but not about the absence of
    452 # documentation.
     722# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
     723# are documented, but have no documentation for their parameters or return
     724# value. If set to NO doxygen will only warn about wrong or incomplete parameter
     725# documentation, but not about the absence of documentation.
     726# The default value is: NO.
    453727
    454728WARN_NO_PARAMDOC       = NO
    455729
    456 # The WARN_FORMAT tag determines the format of the warning messages that
    457 # doxygen can produce. The string should contain the $file, $line, and $text
    458 # tags, which will be replaced by the file and line number from which the
    459 # warning originated and the warning text. Optionally the format may contain
    460 # $version, which will be replaced by the version of the file (if it could
    461 # be obtained via FILE_VERSION_FILTER)
     730# The WARN_FORMAT tag determines the format of the warning messages that doxygen
     731# can produce. The string should contain the $file, $line, and $text tags, which
     732# will be replaced by the file and line number from which the warning originated
     733# and the warning text. Optionally the format may contain $version, which will
     734# be replaced by the version of the file (if it could be obtained via
     735# FILE_VERSION_FILTER)
     736# The default value is: $file:$line: $text.
    462737
    463738WARN_FORMAT            = "$file:$line: $text"
    464739
    465 # The WARN_LOGFILE tag can be used to specify a file to which warning
    466 # and error messages should be written. If left blank the output is written
    467 # to stderr.
    468 
    469 WARN_LOGFILE           =
    470 
    471 #---------------------------------------------------------------------------
    472 # configuration options related to the input files
    473 #---------------------------------------------------------------------------
    474 
    475 # The INPUT tag can be used to specify the files and/or directories that contain
    476 # documented source files. You may enter file names like "myfile.cpp" or
    477 # directories like "/usr/src/myproject". Separate the files or directories
    478 # with spaces.
     740# The WARN_LOGFILE tag can be used to specify a file to which warning and error
     741# messages should be written. If left blank the output is written to standard
     742# error (stderr).
     743
     744WARN_LOGFILE           =
     745
     746#---------------------------------------------------------------------------
     747# Configuration options related to the input files
     748#---------------------------------------------------------------------------
     749
     750# The INPUT tag is used to specify the files and/or directories that contain
     751# documented source files. You may enter file names like myfile.cpp or
     752# directories like /usr/src/myproject. Separate the files or directories with
     753# spaces.
     754# Note: If this tag is empty the current directory is searched.
    479755
    480756INPUT                  = @top_srcdir@/libusb
    481757
    482 # This tag can be used to specify the character encoding of the source files that
    483 # doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
    484 # input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
    485 # See http://www.gnu.org/software/libiconv for the list of possible encodings.
     758# This tag can be used to specify the character encoding of the source files
     759# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
     760# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
     761# documentation (see: http://www.gnu.org/software/libiconv) for the list of
     762# possible encodings.
     763# The default value is: UTF-8.
    486764
    487765INPUT_ENCODING         = UTF-8
    488766
    489 # If the value of the INPUT tag contains directories, you can use the
    490 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
    491 # and *.h) to filter out the source-files in the directories. If left
    492 # blank the following patterns are tested:
    493 # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
    494 # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
    495 
    496 FILE_PATTERNS          =
    497 
    498 # The RECURSIVE tag can be used to turn specify whether or not subdirectories
    499 # should be searched for input files as well. Possible values are YES and NO.
    500 # If left blank NO is used.
     767# If the value of the INPUT tag contains directories, you can use the
     768# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
     769# *.h) to filter out the source-files in the directories. If left blank the
     770# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
     771# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
     772# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
     773# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
     774# *.qsf, *.as and *.js.
     775
     776FILE_PATTERNS          =
     777
     778# The RECURSIVE tag can be used to specify whether or not subdirectories should
     779# be searched for input files as well.
     780# The default value is: NO.
    501781
    502782RECURSIVE              = NO
    503783
    504 # The EXCLUDE tag can be used to specify files and/or directories that should
    505 # excluded from the INPUT source files. This way you can easily exclude a 
     784# The EXCLUDE tag can be used to specify files and/or directories that should be
     785# excluded from the INPUT source files. This way you can easily exclude a
    506786# subdirectory from a directory tree whose root is specified with the INPUT tag.
    507 
    508 EXCLUDE                = @top_srcdir@/libusb/libusbi.h @top_srcdir@/libusb/hotplug.h
    509 
    510 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
    511 # directories that are symbolic links (a Unix filesystem feature) are excluded
     787#
     788# Note that relative paths are relative to the directory from which doxygen is
     789# run.
     790
     791EXCLUDE                = @top_srcdir@/libusb/libusbi.h \
     792                         @top_srcdir@/libusb/hotplug.h
     793
     794# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
     795# directories that are symbolic links (a Unix file system feature) are excluded
    512796# from the input.
     797# The default value is: NO.
    513798
    514799EXCLUDE_SYMLINKS       = NO
    515800
    516 # If the value of the INPUT tag contains directories, you can use the
    517 # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
    518 # certain files from those directories. Note that the wildcards are matched
    519 # against the file with absolute path, so to exclude all test directories
    520 # for example use the pattern */test/*
    521 
    522 EXCLUDE_PATTERNS       =
    523 
    524 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
    525 # (namespaces, classes, functions, etc.) that should be excluded from the output.
    526 # The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
    527 # a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
    528 
    529 EXCLUDE_SYMBOLS        =
    530 
    531 # The EXAMPLE_PATH tag can be used to specify one or more files or
    532 # directories that contain example code fragments that are included (see
    533 # the \include command).
    534 
    535 EXAMPLE_PATH           =
    536 
    537 # If the value of the EXAMPLE_PATH tag contains directories, you can use the
    538 # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
    539 # and *.h) to filter out the source-files in the directories. If left
    540 # blank all files are included.
    541 
    542 EXAMPLE_PATTERNS       =
    543 
    544 # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
    545 # searched for input files to be used with the \include or \dontinclude
    546 # commands irrespective of the value of the RECURSIVE tag.
    547 # Possible values are YES and NO. If left blank NO is used.
     801# If the value of the INPUT tag contains directories, you can use the
     802# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
     803# certain files from those directories.
     804#
     805# Note that the wildcards are matched against the file with absolute path, so to
     806# exclude all test directories for example use the pattern */test/*
     807
     808EXCLUDE_PATTERNS       =
     809
     810# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
     811# (namespaces, classes, functions, etc.) that should be excluded from the
     812# output. The symbol name can be a fully qualified name, a word, or if the
     813# wildcard * is used, a substring. Examples: ANamespace, AClass,
     814# AClass::ANamespace, ANamespace::*Test
     815#
     816# Note that the wildcards are matched against the file with absolute path, so to
     817# exclude all test directories use the pattern */test/*
     818
     819EXCLUDE_SYMBOLS        =
     820
     821# The EXAMPLE_PATH tag can be used to specify one or more files or directories
     822# that contain example code fragments that are included (see the \include
     823# command).
     824
     825EXAMPLE_PATH           =
     826
     827# If the value of the EXAMPLE_PATH tag contains directories, you can use the
     828# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
     829# *.h) to filter out the source-files in the directories. If left blank all
     830# files are included.
     831
     832EXAMPLE_PATTERNS       =
     833
     834# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
     835# searched for input files to be used with the \include or \dontinclude commands
     836# irrespective of the value of the RECURSIVE tag.
     837# The default value is: NO.
    548838
    549839EXAMPLE_RECURSIVE      = NO
    550840
    551 # The IMAGE_PATH tag can be used to specify one or more files or
    552 # directories that contain image that are included in the documentation (see
    553 # the \image command).
    554 
    555 IMAGE_PATH             =
    556 
    557 # The INPUT_FILTER tag can be used to specify a program that doxygen should
    558 # invoke to filter for each input file. Doxygen will invoke the filter program
    559 # by executing (via popen()) the command <filter> <input-file>, where <filter>
    560 # is the value of the INPUT_FILTER tag, and <input-file> is the name of an
    561 # input file. Doxygen will then use the output that the filter program writes
    562 # to standard output.  If FILTER_PATTERNS is specified, this tag will be
    563 # ignored.
    564 
    565 INPUT_FILTER           =
    566 
    567 # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
    568 # basis.  Doxygen will compare the file name with each pattern and apply the
    569 # filter if there is a match.  The filters are a list of the form:
    570 # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
    571 # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
    572 # is applied to all files.
    573 
    574 FILTER_PATTERNS        =
    575 
    576 # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
    577 # INPUT_FILTER) will be used to filter the input files when producing source
    578 # files to browse (i.e. when SOURCE_BROWSER is set to YES).
     841# The IMAGE_PATH tag can be used to specify one or more files or directories
     842# that contain images that are to be included in the documentation (see the
     843# \image command).
     844
     845IMAGE_PATH             =
     846
     847# The INPUT_FILTER tag can be used to specify a program that doxygen should
     848# invoke to filter for each input file. Doxygen will invoke the filter program
     849# by executing (via popen()) the command:
     850#
     851# <filter> <input-file>
     852#
     853# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
     854# name of an input file. Doxygen will then use the output that the filter
     855# program writes to standard output. If FILTER_PATTERNS is specified, this tag
     856# will be ignored.
     857#
     858# Note that the filter must not add or remove lines; it is applied before the
     859# code is scanned, but not when the output code is generated. If lines are added
     860# or removed, the anchors will not be placed correctly.
     861
     862INPUT_FILTER           =
     863
     864# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
     865# basis. Doxygen will compare the file name with each pattern and apply the
     866# filter if there is a match. The filters are a list of the form: pattern=filter
     867# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
     868# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
     869# patterns match the file name, INPUT_FILTER is applied.
     870
     871FILTER_PATTERNS        =
     872
     873# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
     874# INPUT_FILTER ) will also be used to filter the input files that are used for
     875# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
     876# The default value is: NO.
    579877
    580878FILTER_SOURCE_FILES    = NO
    581879
    582 #---------------------------------------------------------------------------
    583 # configuration options related to source browsing
    584 #---------------------------------------------------------------------------
    585 
    586 # If the SOURCE_BROWSER tag is set to YES then a list of source files will
    587 # be generated. Documented entities will be cross-referenced with these sources.
    588 # Note: To get rid of all source code in the generated output, make sure also
    589 # VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH
    590 # then you must also enable this option. If you don't then doxygen will produce
    591 # a warning and turn it on anyway
     880# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
     881# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
     882# it is also possible to disable source filtering for a specific pattern using
     883# *.ext= (so without naming a filter).
     884# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
     885
     886FILTER_SOURCE_PATTERNS =
     887
     888# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
     889# is part of the input, its contents will be placed on the main page
     890# (index.html). This can be useful if you have a project on for instance GitHub
     891# and want to reuse the introduction page also for the doxygen output.
     892
     893USE_MDFILE_AS_MAINPAGE =
     894
     895#---------------------------------------------------------------------------
     896# Configuration options related to source browsing
     897#---------------------------------------------------------------------------
     898
     899# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
     900# generated. Documented entities will be cross-referenced with these sources.
     901#
     902# Note: To get rid of all source code in the generated output, make sure that
     903# also VERBATIM_HEADERS is set to NO.
     904# The default value is: NO.
    592905
    593906SOURCE_BROWSER         = NO
    594907
    595 # Setting the INLINE_SOURCES tag to YES will include the body
    596 # of functions and classes directly in the documentation.
     908# Setting the INLINE_SOURCES tag to YES will include the body of functions,
     909# classes and enums directly into the documentation.
     910# The default value is: NO.
    597911
    598912INLINE_SOURCES         = NO
    599913
    600 # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
    601 # doxygen to hide any special comment blocks from generated source code
    602 # fragments. Normal C and C++ comments will always remain visible.
     914# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
     915# special comment blocks from generated source code fragments. Normal C, C++ and
     916# Fortran comments will always remain visible.
     917# The default value is: YES.
    603918
    604919STRIP_CODE_COMMENTS    = YES
    605920
    606 # If the REFERENCED_BY_RELATION tag is set to YES (the default)
    607 # then for each documented function all documented
    608 # functions referencing it will be listed.
     921# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
     922# function all documented functions referencing it will be listed.
     923# The default value is: NO.
    609924
    610925REFERENCED_BY_RELATION = NO
    611926
    612 # If the REFERENCES_RELATION tag is set to YES (the default)
    613 # then for each documented function all documented entities
    614 # called/used by that function will be listed.
     927# If the REFERENCES_RELATION tag is set to YES then for each documented function
     928# all documented entities called/used by that function will be listed.
     929# The default value is: NO.
    615930
    616931REFERENCES_RELATION    = NO
    617932
    618 # If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
    619 # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
    620 # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
    621 # link to the source code.  Otherwise they will link to the documentstion.
     933# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
     934# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
     935# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
     936# link to the documentation.
     937# The default value is: YES.
    622938
    623939REFERENCES_LINK_SOURCE = YES
    624940
    625 # If the USE_HTAGS tag is set to YES then the references to source code
    626 # will point to the HTML generated by the htags(1) tool instead of doxygen
    627 # built-in source browser. The htags tool is part of GNU's global source
    628 # tagging system (see http://www.gnu.org/software/global/global.html). You
    629 # will need version 4.8.6 or higher.
     941# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
     942# source code will show a tooltip with additional information such as prototype,
     943# brief description and links to the definition and documentation. Since this
     944# will make the HTML file larger and loading of large files a bit slower, you
     945# can opt to disable this feature.
     946# The default value is: YES.
     947# This tag requires that the tag SOURCE_BROWSER is set to YES.
     948
     949SOURCE_TOOLTIPS        = YES
     950
     951# If the USE_HTAGS tag is set to YES then the references to source code will
     952# point to the HTML generated by the htags(1) tool instead of doxygen built-in
     953# source browser. The htags tool is part of GNU's global source tagging system
     954# (see http://www.gnu.org/software/global/global.html). You will need version
     955# 4.8.6 or higher.
     956#
     957# To use it do the following:
     958# - Install the latest version of global
     959# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
     960# - Make sure the INPUT points to the root of the source tree
     961# - Run doxygen as normal
     962#
     963# Doxygen will invoke htags (and that will in turn invoke gtags), so these
     964# tools must be available from the command line (i.e. in the search path).
     965#
     966# The result: instead of the source browser generated by doxygen, the links to
     967# source code will now point to the output of htags.
     968# The default value is: NO.
     969# This tag requires that the tag SOURCE_BROWSER is set to YES.
    630970
    631971USE_HTAGS              = NO
    632972
    633 # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
    634 # will generate a verbatim copy of the header file for each class for
    635 # which an include is specified. Set to NO to disable this.
     973# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
     974# verbatim copy of the header file for each class for which an include is
     975# specified. Set to NO to disable this.
     976# See also: Section \class.
     977# The default value is: YES.
    636978
    637979VERBATIM_HEADERS       = YES
    638980
    639981#---------------------------------------------------------------------------
    640 # configuration options related to the alphabetical class index
    641 #---------------------------------------------------------------------------
    642 
    643 # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
    644 # of all compounds will be generated. Enable this if the project
    645 # contains a lot of classes, structs, unions or interfaces.
     982# Configuration options related to the alphabetical class index
     983#---------------------------------------------------------------------------
     984
     985# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
     986# compounds will be generated. Enable this if the project contains a lot of
     987# classes, structs, unions or interfaces.
     988# The default value is: YES.
    646989
    647990ALPHABETICAL_INDEX     = YES
    648991
    649 # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
    650 # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
    651 # in which this list will be split (can be a number in the range [1..20])
     992# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
     993# which the alphabetical index list will be split.
     994# Minimum value: 1, maximum value: 20, default value: 5.
     995# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
    652996
    653997COLS_IN_ALPHA_INDEX    = 5
    654998
    655 # In case all classes in a project start with a common prefix, all
    656 # classes will be put under the same header in the alphabetical index.
    657 # The IGNORE_PREFIX tag can be used to specify one or more prefixes that
    658 # should be ignored while generating the index headers.
    659 
    660 IGNORE_PREFIX          =
    661 
    662 #---------------------------------------------------------------------------
    663 # configuration options related to the HTML output
    664 #---------------------------------------------------------------------------
    665 
    666 # If the GENERATE_HTML tag is set to YES (the default) Doxygen will
    667 # generate HTML output.
     999# In case all classes in a project start with a common prefix, all classes will
     1000# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
     1001# can be used to specify a prefix (or a list of prefixes) that should be ignored
     1002# while generating the index headers.
     1003# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
     1004
     1005IGNORE_PREFIX          =
     1006
     1007#---------------------------------------------------------------------------
     1008# Configuration options related to the HTML output
     1009#---------------------------------------------------------------------------
     1010
     1011# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
     1012# The default value is: YES.
    6681013
    6691014GENERATE_HTML          = YES
    6701015
    671 # The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
    672 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
    673 # put in front of it. If left blank `html' will be used as the default path.
     1016# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
     1017# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
     1018# it.
     1019# The default directory is: html.
     1020# This tag requires that the tag GENERATE_HTML is set to YES.
    6741021
    6751022HTML_OUTPUT            = html
    6761023
    677 # The HTML_FILE_EXTENSION tag can be used to specify the file extension for
    678 # each generated HTML page (for example: .htm,.php,.asp). If it is left blank
    679 # doxygen will generate files with .html extension.
     1024# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
     1025# generated HTML page (for example: .htm, .php, .asp).
     1026# The default value is: .html.
     1027# This tag requires that the tag GENERATE_HTML is set to YES.
    6801028
    6811029HTML_FILE_EXTENSION    = .html
    6821030
    683 # The HTML_HEADER tag can be used to specify a personal HTML header for
    684 # each generated HTML page. If it is left blank doxygen will generate a
     1031# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
     1032# each generated HTML page. If the tag is left blank doxygen will generate a
    6851033# standard header.
    686 
    687 HTML_HEADER            =
    688 
    689 # The HTML_FOOTER tag can be used to specify a personal HTML footer for
    690 # each generated HTML page. If it is left blank doxygen will generate a
    691 # standard footer.
    692 
    693 HTML_FOOTER            =
    694 
    695 # The HTML_STYLESHEET tag can be used to specify a user-defined cascading
    696 # style sheet that is used by each HTML page. It can be used to
    697 # fine-tune the look of the HTML output. If the tag is left blank doxygen
    698 # will generate a default style sheet. Note that doxygen will try to copy
    699 # the style sheet file to the HTML output directory, so don't put your own
    700 # stylesheet in the HTML output directory as well, or it will be erased!
    701 
    702 HTML_STYLESHEET        =
    703 
    704 # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
    705 # files or namespaces will be aligned in HTML using tables. If set to
    706 # NO a bullet list will be used.
    707 
    708 HTML_ALIGN_MEMBERS     = YES
    709 
    710 # If the GENERATE_HTMLHELP tag is set to YES, additional index files
    711 # will be generated that can be used as input for tools like the
    712 # Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
    713 # of the generated HTML documentation.
     1034#
     1035# To get valid HTML the header file that includes any scripts and style sheets
     1036# that doxygen needs, which is dependent on the configuration options used (e.g.
     1037# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
     1038# default header using
     1039# doxygen -w html new_header.html new_footer.html new_stylesheet.css
     1040# YourConfigFile
     1041# and then modify the file new_header.html. See also section "Doxygen usage"
     1042# for information on how to generate the default header that doxygen normally
     1043# uses.
     1044# Note: The header is subject to change so you typically have to regenerate the
     1045# default header when upgrading to a newer version of doxygen. For a description
     1046# of the possible markers and block names see the documentation.
     1047# This tag requires that the tag GENERATE_HTML is set to YES.
     1048
     1049HTML_HEADER            =
     1050
     1051# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
     1052# generated HTML page. If the tag is left blank doxygen will generate a standard
     1053# footer. See HTML_HEADER for more information on how to generate a default
     1054# footer and what special commands can be used inside the footer. See also
     1055# section "Doxygen usage" for information on how to generate the default footer
     1056# that doxygen normally uses.
     1057# This tag requires that the tag GENERATE_HTML is set to YES.
     1058
     1059HTML_FOOTER            =
     1060
     1061# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
     1062# sheet that is used by each HTML page. It can be used to fine-tune the look of
     1063# the HTML output. If left blank doxygen will generate a default style sheet.
     1064# See also section "Doxygen usage" for information on how to generate the style
     1065# sheet that doxygen normally uses.
     1066# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
     1067# it is more robust and this tag (HTML_STYLESHEET) will in the future become
     1068# obsolete.
     1069# This tag requires that the tag GENERATE_HTML is set to YES.
     1070
     1071HTML_STYLESHEET        =
     1072
     1073# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
     1074# cascading style sheets that are included after the standard style sheets
     1075# created by doxygen. Using this option one can overrule certain style aspects.
     1076# This is preferred over using HTML_STYLESHEET since it does not replace the
     1077# standard style sheet and is therefor more robust against future updates.
     1078# Doxygen will copy the style sheet files to the output directory.
     1079# Note: The order of the extra stylesheet files is of importance (e.g. the last
     1080# stylesheet in the list overrules the setting of the previous ones in the
     1081# list). For an example see the documentation.
     1082# This tag requires that the tag GENERATE_HTML is set to YES.
     1083
     1084HTML_EXTRA_STYLESHEET  =
     1085
     1086# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
     1087# other source files which should be copied to the HTML output directory. Note
     1088# that these files will be copied to the base HTML output directory. Use the
     1089# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
     1090# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
     1091# files will be copied as-is; there are no commands or markers available.
     1092# This tag requires that the tag GENERATE_HTML is set to YES.
     1093
     1094HTML_EXTRA_FILES       =
     1095
     1096# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
     1097# will adjust the colors in the stylesheet and background images according to
     1098# this color. Hue is specified as an angle on a colorwheel, see
     1099# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
     1100# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
     1101# purple, and 360 is red again.
     1102# Minimum value: 0, maximum value: 359, default value: 220.
     1103# This tag requires that the tag GENERATE_HTML is set to YES.
     1104
     1105HTML_COLORSTYLE_HUE    = 220
     1106
     1107# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
     1108# in the HTML output. For a value of 0 the output will use grayscales only. A
     1109# value of 255 will produce the most vivid colors.
     1110# Minimum value: 0, maximum value: 255, default value: 100.
     1111# This tag requires that the tag GENERATE_HTML is set to YES.
     1112
     1113HTML_COLORSTYLE_SAT    = 100
     1114
     1115# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
     1116# luminance component of the colors in the HTML output. Values below 100
     1117# gradually make the output lighter, whereas values above 100 make the output
     1118# darker. The value divided by 100 is the actual gamma applied, so 80 represents
     1119# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
     1120# change the gamma.
     1121# Minimum value: 40, maximum value: 240, default value: 80.
     1122# This tag requires that the tag GENERATE_HTML is set to YES.
     1123
     1124HTML_COLORSTYLE_GAMMA  = 80
     1125
     1126# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
     1127# page will contain the date and time when the page was generated. Setting this
     1128# to NO can help when comparing the output of multiple runs.
     1129# The default value is: YES.
     1130# This tag requires that the tag GENERATE_HTML is set to YES.
     1131
     1132HTML_TIMESTAMP         = YES
     1133
     1134# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
     1135# documentation will contain sections that can be hidden and shown after the
     1136# page has loaded.
     1137# The default value is: NO.
     1138# This tag requires that the tag GENERATE_HTML is set to YES.
     1139
     1140HTML_DYNAMIC_SECTIONS  = YES
     1141
     1142# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
     1143# shown in the various tree structured indices initially; the user can expand
     1144# and collapse entries dynamically later on. Doxygen will expand the tree to
     1145# such a level that at most the specified number of entries are visible (unless
     1146# a fully collapsed tree already exceeds this amount). So setting the number of
     1147# entries 1 will produce a full collapsed tree by default. 0 is a special value
     1148# representing an infinite number of entries and will result in a full expanded
     1149# tree by default.
     1150# Minimum value: 0, maximum value: 9999, default value: 100.
     1151# This tag requires that the tag GENERATE_HTML is set to YES.
     1152
     1153HTML_INDEX_NUM_ENTRIES = 100
     1154
     1155# If the GENERATE_DOCSET tag is set to YES, additional index files will be
     1156# generated that can be used as input for Apple's Xcode 3 integrated development
     1157# environment (see: http://developer.apple.com/tools/xcode/), introduced with
     1158# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
     1159# Makefile in the HTML output directory. Running make will produce the docset in
     1160# that directory and running make install will install the docset in
     1161# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
     1162# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
     1163# for more information.
     1164# The default value is: NO.
     1165# This tag requires that the tag GENERATE_HTML is set to YES.
     1166
     1167GENERATE_DOCSET        = NO
     1168
     1169# This tag determines the name of the docset feed. A documentation feed provides
     1170# an umbrella under which multiple documentation sets from a single provider
     1171# (such as a company or product suite) can be grouped.
     1172# The default value is: Doxygen generated docs.
     1173# This tag requires that the tag GENERATE_DOCSET is set to YES.
     1174
     1175DOCSET_FEEDNAME        = "Doxygen generated docs"
     1176
     1177# This tag specifies a string that should uniquely identify the documentation
     1178# set bundle. This should be a reverse domain-name style string, e.g.
     1179# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
     1180# The default value is: org.doxygen.Project.
     1181# This tag requires that the tag GENERATE_DOCSET is set to YES.
     1182
     1183DOCSET_BUNDLE_ID       = org.doxygen.Project
     1184
     1185# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
     1186# the documentation publisher. This should be a reverse domain-name style
     1187# string, e.g. com.mycompany.MyDocSet.documentation.
     1188# The default value is: org.doxygen.Publisher.
     1189# This tag requires that the tag GENERATE_DOCSET is set to YES.
     1190
     1191DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
     1192
     1193# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
     1194# The default value is: Publisher.
     1195# This tag requires that the tag GENERATE_DOCSET is set to YES.
     1196
     1197DOCSET_PUBLISHER_NAME  = Publisher
     1198
     1199# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
     1200# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
     1201# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
     1202# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
     1203# Windows.
     1204#
     1205# The HTML Help Workshop contains a compiler that can convert all HTML output
     1206# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
     1207# files are now used as the Windows 98 help format, and will replace the old
     1208# Windows help format (.hlp) on all Windows platforms in the future. Compressed
     1209# HTML files also contain an index, a table of contents, and you can search for
     1210# words in the documentation. The HTML workshop also contains a viewer for
     1211# compressed HTML files.
     1212# The default value is: NO.
     1213# This tag requires that the tag GENERATE_HTML is set to YES.
    7141214
    7151215GENERATE_HTMLHELP      = NO
    7161216
    717 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
    718 # documentation will contain sections that can be hidden and shown after the
    719 # page has loaded. For this to work a browser that supports
    720 # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
    721 # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
    722 
    723 HTML_DYNAMIC_SECTIONS  = YES
    724 
    725 # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
    726 # be used to specify the file name of the resulting .chm file. You
    727 # can add a path in front of the file if the result should not be
     1217# The CHM_FILE tag can be used to specify the file name of the resulting .chm
     1218# file. You can add a path in front of the file if the result should not be
    7281219# written to the html output directory.
    729 
    730 CHM_FILE               =
    731 
    732 # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
    733 # be used to specify the location (absolute path including file name) of
    734 # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
    735 # the HTML help compiler on the generated index.hhp.
    736 
    737 HHC_LOCATION           =
    738 
    739 # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
    740 # controls if a separate .chi index file is generated (YES) or that
    741 # it should be included in the master .chm file (NO).
     1220# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
     1221
     1222CHM_FILE               =
     1223
     1224# The HHC_LOCATION tag can be used to specify the location (absolute path
     1225# including file name) of the HTML help compiler ( hhc.exe). If non-empty
     1226# doxygen will try to run the HTML help compiler on the generated index.hhp.
     1227# The file has to be specified with full path.
     1228# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
     1229
     1230HHC_LOCATION           =
     1231
     1232# The GENERATE_CHI flag controls if a separate .chi index file is generated (
     1233# YES) or that it should be included in the master .chm file ( NO).
     1234# The default value is: NO.
     1235# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
    7421236
    7431237GENERATE_CHI           = NO
    7441238
    745 # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
    746 # controls whether a binary table of contents is generated (YES) or a
    747 # normal table of contents (NO) in the .chm file.
     1239# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
     1240# and project file content.
     1241# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
     1242
     1243CHM_INDEX_ENCODING     =
     1244
     1245# The BINARY_TOC flag controls whether a binary table of contents is generated (
     1246# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
     1247# enables the Previous and Next buttons.
     1248# The default value is: NO.
     1249# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
    7481250
    7491251BINARY_TOC             = NO
    7501252
    751 # The TOC_EXPAND flag can be set to YES to add extra items for group members
    752 # to the contents of the HTML help documentation and to the tree view.
     1253# The TOC_EXPAND flag can be set to YES to add extra items for group members to
     1254# the table of contents of the HTML help documentation and to the tree view.
     1255# The default value is: NO.
     1256# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
    7531257
    7541258TOC_EXPAND             = NO
    7551259
    756 # The DISABLE_INDEX tag can be used to turn on/off the condensed index at
    757 # top of each HTML page. The value NO (the default) enables the index and
    758 # the value YES disables it.
     1260# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
     1261# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
     1262# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
     1263# (.qch) of the generated HTML documentation.
     1264# The default value is: NO.
     1265# This tag requires that the tag GENERATE_HTML is set to YES.
     1266
     1267GENERATE_QHP           = NO
     1268
     1269# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
     1270# the file name of the resulting .qch file. The path specified is relative to
     1271# the HTML output folder.
     1272# This tag requires that the tag GENERATE_QHP is set to YES.
     1273
     1274QCH_FILE               =
     1275
     1276# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
     1277# Project output. For more information please see Qt Help Project / Namespace
     1278# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
     1279# The default value is: org.doxygen.Project.
     1280# This tag requires that the tag GENERATE_QHP is set to YES.
     1281
     1282QHP_NAMESPACE          = org.doxygen.Project
     1283
     1284# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
     1285# Help Project output. For more information please see Qt Help Project / Virtual
     1286# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
     1287# folders).
     1288# The default value is: doc.
     1289# This tag requires that the tag GENERATE_QHP is set to YES.
     1290
     1291QHP_VIRTUAL_FOLDER     = doc
     1292
     1293# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
     1294# filter to add. For more information please see Qt Help Project / Custom
     1295# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
     1296# filters).
     1297# This tag requires that the tag GENERATE_QHP is set to YES.
     1298
     1299QHP_CUST_FILTER_NAME   =
     1300
     1301# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
     1302# custom filter to add. For more information please see Qt Help Project / Custom
     1303# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
     1304# filters).
     1305# This tag requires that the tag GENERATE_QHP is set to YES.
     1306
     1307QHP_CUST_FILTER_ATTRS  =
     1308
     1309# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
     1310# project's filter section matches. Qt Help Project / Filter Attributes (see:
     1311# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
     1312# This tag requires that the tag GENERATE_QHP is set to YES.
     1313
     1314QHP_SECT_FILTER_ATTRS  =
     1315
     1316# The QHG_LOCATION tag can be used to specify the location of Qt's
     1317# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
     1318# generated .qhp file.
     1319# This tag requires that the tag GENERATE_QHP is set to YES.
     1320
     1321QHG_LOCATION           =
     1322
     1323# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
     1324# generated, together with the HTML files, they form an Eclipse help plugin. To
     1325# install this plugin and make it available under the help contents menu in
     1326# Eclipse, the contents of the directory containing the HTML and XML files needs
     1327# to be copied into the plugins directory of eclipse. The name of the directory
     1328# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
     1329# After copying Eclipse needs to be restarted before the help appears.
     1330# The default value is: NO.
     1331# This tag requires that the tag GENERATE_HTML is set to YES.
     1332
     1333GENERATE_ECLIPSEHELP   = NO
     1334
     1335# A unique identifier for the Eclipse help plugin. When installing the plugin
     1336# the directory name containing the HTML and XML files should also have this
     1337# name. Each documentation set should have its own identifier.
     1338# The default value is: org.doxygen.Project.
     1339# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
     1340
     1341ECLIPSE_DOC_ID         = org.doxygen.Project
     1342
     1343# If you want full control over the layout of the generated HTML pages it might
     1344# be necessary to disable the index and replace it with your own. The
     1345# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
     1346# of each HTML page. A value of NO enables the index and the value YES disables
     1347# it. Since the tabs in the index contain the same information as the navigation
     1348# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
     1349# The default value is: NO.
     1350# This tag requires that the tag GENERATE_HTML is set to YES.
    7591351
    7601352DISABLE_INDEX          = NO
    7611353
    762 # This tag can be used to set the number of enum values (range [1..20])
    763 # that doxygen will group on one line in the generated HTML documentation.
     1354# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
     1355# structure should be generated to display hierarchical information. If the tag
     1356# value is set to YES, a side panel will be generated containing a tree-like
     1357# index structure (just like the one that is generated for HTML Help). For this
     1358# to work a browser that supports JavaScript, DHTML, CSS and frames is required
     1359# (i.e. any modern browser). Windows users are probably better off using the
     1360# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
     1361# further fine-tune the look of the index. As an example, the default style
     1362# sheet generated by doxygen has an example that shows how to put an image at
     1363# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
     1364# the same information as the tab index, you could consider setting
     1365# DISABLE_INDEX to YES when enabling this option.
     1366# The default value is: NO.
     1367# This tag requires that the tag GENERATE_HTML is set to YES.
     1368
     1369GENERATE_TREEVIEW      = NO
     1370
     1371# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
     1372# doxygen will group on one line in the generated HTML documentation.
     1373#
     1374# Note that a value of 0 will completely suppress the enum values from appearing
     1375# in the overview section.
     1376# Minimum value: 0, maximum value: 20, default value: 4.
     1377# This tag requires that the tag GENERATE_HTML is set to YES.
    7641378
    7651379ENUM_VALUES_PER_LINE   = 4
    7661380
    767 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
    768 # generated containing a tree-like index structure (just like the one that
    769 # is generated for HTML Help). For this to work a browser that supports
    770 # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
    771 # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
    772 # probably better off using the HTML help feature.
    773 
    774 GENERATE_TREEVIEW      = NO
    775 
    776 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
    777 # used to set the initial width (in pixels) of the frame in which the tree
    778 # is shown.
     1381# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
     1382# to set the initial width (in pixels) of the frame in which the tree is shown.
     1383# Minimum value: 0, maximum value: 1500, default value: 250.
     1384# This tag requires that the tag GENERATE_HTML is set to YES.
    7791385
    7801386TREEVIEW_WIDTH         = 250
    7811387
    782 #---------------------------------------------------------------------------
    783 # configuration options related to the LaTeX output
    784 #---------------------------------------------------------------------------
    785 
    786 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
    787 # generate Latex output.
     1388# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
     1389# external symbols imported via tag files in a separate window.
     1390# The default value is: NO.
     1391# This tag requires that the tag GENERATE_HTML is set to YES.
     1392
     1393EXT_LINKS_IN_WINDOW    = NO
     1394
     1395# Use this tag to change the font size of LaTeX formulas included as images in
     1396# the HTML documentation. When you change the font size after a successful
     1397# doxygen run you need to manually remove any form_*.png images from the HTML
     1398# output directory to force them to be regenerated.
     1399# Minimum value: 8, maximum value: 50, default value: 10.
     1400# This tag requires that the tag GENERATE_HTML is set to YES.
     1401
     1402FORMULA_FONTSIZE       = 10
     1403
     1404# Use the FORMULA_TRANPARENT tag to determine whether or not the images
     1405# generated for formulas are transparent PNGs. Transparent PNGs are not
     1406# supported properly for IE 6.0, but are supported on all modern browsers.
     1407#
     1408# Note that when changing this option you need to delete any form_*.png files in
     1409# the HTML output directory before the changes have effect.
     1410# The default value is: YES.
     1411# This tag requires that the tag GENERATE_HTML is set to YES.
     1412
     1413FORMULA_TRANSPARENT    = YES
     1414
     1415# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
     1416# http://www.mathjax.org) which uses client side Javascript for the rendering
     1417# instead of using prerendered bitmaps. Use this if you do not have LaTeX
     1418# installed or if you want to formulas look prettier in the HTML output. When
     1419# enabled you may also need to install MathJax separately and configure the path
     1420# to it using the MATHJAX_RELPATH option.
     1421# The default value is: NO.
     1422# This tag requires that the tag GENERATE_HTML is set to YES.
     1423
     1424USE_MATHJAX            = NO
     1425
     1426# When MathJax is enabled you can set the default output format to be used for
     1427# the MathJax output. See the MathJax site (see:
     1428# http://docs.mathjax.org/en/latest/output.html) for more details.
     1429# Possible values are: HTML-CSS (which is slower, but has the best
     1430# compatibility), NativeMML (i.e. MathML) and SVG.
     1431# The default value is: HTML-CSS.
     1432# This tag requires that the tag USE_MATHJAX is set to YES.
     1433
     1434MATHJAX_FORMAT         = HTML-CSS
     1435
     1436# When MathJax is enabled you need to specify the location relative to the HTML
     1437# output directory using the MATHJAX_RELPATH option. The destination directory
     1438# should contain the MathJax.js script. For instance, if the mathjax directory
     1439# is located at the same level as the HTML output directory, then
     1440# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
     1441# Content Delivery Network so you can quickly see the result without installing
     1442# MathJax. However, it is strongly recommended to install a local copy of
     1443# MathJax from http://www.mathjax.org before deployment.
     1444# The default value is: http://cdn.mathjax.org/mathjax/latest.
     1445# This tag requires that the tag USE_MATHJAX is set to YES.
     1446
     1447MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
     1448
     1449# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
     1450# extension names that should be enabled during MathJax rendering. For example
     1451# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
     1452# This tag requires that the tag USE_MATHJAX is set to YES.
     1453
     1454MATHJAX_EXTENSIONS     =
     1455
     1456# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
     1457# of code that will be used on startup of the MathJax code. See the MathJax site
     1458# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
     1459# example see the documentation.
     1460# This tag requires that the tag USE_MATHJAX is set to YES.
     1461
     1462MATHJAX_CODEFILE       =
     1463
     1464# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
     1465# the HTML output. The underlying search engine uses javascript and DHTML and
     1466# should work on any modern browser. Note that when using HTML help
     1467# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
     1468# there is already a search function so this one should typically be disabled.
     1469# For large projects the javascript based search engine can be slow, then
     1470# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
     1471# search using the keyboard; to jump to the search box use <access key> + S
     1472# (what the <access key> is depends on the OS and browser, but it is typically
     1473# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
     1474# key> to jump into the search results window, the results can be navigated
     1475# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
     1476# the search. The filter options can be selected when the cursor is inside the
     1477# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
     1478# to select a filter and <Enter> or <escape> to activate or cancel the filter
     1479# option.
     1480# The default value is: YES.
     1481# This tag requires that the tag GENERATE_HTML is set to YES.
     1482
     1483SEARCHENGINE           = NO
     1484
     1485# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
     1486# implemented using a web server instead of a web client using Javascript. There
     1487# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
     1488# setting. When disabled, doxygen will generate a PHP script for searching and
     1489# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
     1490# and searching needs to be provided by external tools. See the section
     1491# "External Indexing and Searching" for details.
     1492# The default value is: NO.
     1493# This tag requires that the tag SEARCHENGINE is set to YES.
     1494
     1495SERVER_BASED_SEARCH    = NO
     1496
     1497# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
     1498# script for searching. Instead the search results are written to an XML file
     1499# which needs to be processed by an external indexer. Doxygen will invoke an
     1500# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
     1501# search results.
     1502#
     1503# Doxygen ships with an example indexer ( doxyindexer) and search engine
     1504# (doxysearch.cgi) which are based on the open source search engine library
     1505# Xapian (see: http://xapian.org/).
     1506#
     1507# See the section "External Indexing and Searching" for details.
     1508# The default value is: NO.
     1509# This tag requires that the tag SEARCHENGINE is set to YES.
     1510
     1511EXTERNAL_SEARCH        = NO
     1512
     1513# The SEARCHENGINE_URL should point to a search engine hosted by a web server
     1514# which will return the search results when EXTERNAL_SEARCH is enabled.
     1515#
     1516# Doxygen ships with an example indexer ( doxyindexer) and search engine
     1517# (doxysearch.cgi) which are based on the open source search engine library
     1518# Xapian (see: http://xapian.org/). See the section "External Indexing and
     1519# Searching" for details.
     1520# This tag requires that the tag SEARCHENGINE is set to YES.
     1521
     1522SEARCHENGINE_URL       =
     1523
     1524# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
     1525# search data is written to a file for indexing by an external tool. With the
     1526# SEARCHDATA_FILE tag the name of this file can be specified.
     1527# The default file is: searchdata.xml.
     1528# This tag requires that the tag SEARCHENGINE is set to YES.
     1529
     1530SEARCHDATA_FILE        = searchdata.xml
     1531
     1532# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
     1533# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
     1534# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
     1535# projects and redirect the results back to the right project.
     1536# This tag requires that the tag SEARCHENGINE is set to YES.
     1537
     1538EXTERNAL_SEARCH_ID     =
     1539
     1540# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
     1541# projects other than the one defined by this configuration file, but that are
     1542# all added to the same external search index. Each project needs to have a
     1543# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
     1544# to a relative location where the documentation can be found. The format is:
     1545# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
     1546# This tag requires that the tag SEARCHENGINE is set to YES.
     1547
     1548EXTRA_SEARCH_MAPPINGS  =
     1549
     1550#---------------------------------------------------------------------------
     1551# Configuration options related to the LaTeX output
     1552#---------------------------------------------------------------------------
     1553
     1554# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
     1555# The default value is: YES.
    7881556
    7891557GENERATE_LATEX         = NO
    7901558
    791 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
    792 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
    793 # put in front of it. If left blank `latex' will be used as the default path.
     1559# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
     1560# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
     1561# it.
     1562# The default directory is: latex.
     1563# This tag requires that the tag GENERATE_LATEX is set to YES.
    7941564
    7951565LATEX_OUTPUT           = latex
    7961566
    797 # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
    798 # invoked. If left blank `latex' will be used as the default command name.
     1567# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
     1568# invoked.
     1569#
     1570# Note that when enabling USE_PDFLATEX this option is only used for generating
     1571# bitmaps for formulas in the HTML output, but not in the Makefile that is
     1572# written to the output directory.
     1573# The default file is: latex.
     1574# This tag requires that the tag GENERATE_LATEX is set to YES.
    7991575
    8001576LATEX_CMD_NAME         = latex
    8011577
    802 # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
    803 # generate index for LaTeX. If left blank `makeindex' will be used as the
    804 # default command name.
     1578# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
     1579# index for LaTeX.
     1580# The default file is: makeindex.
     1581# This tag requires that the tag GENERATE_LATEX is set to YES.
    8051582
    8061583MAKEINDEX_CMD_NAME     = makeindex
    8071584
    808 # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
    809 # LaTeX documents. This may be useful for small projects and may help to
    810 # save some trees in general.
     1585# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
     1586# documents. This may be useful for small projects and may help to save some
     1587# trees in general.
     1588# The default value is: NO.
     1589# This tag requires that the tag GENERATE_LATEX is set to YES.
    8111590
    8121591COMPACT_LATEX          = NO
    8131592
    814 # The PAPER_TYPE tag can be used to set the paper type that is used
    815 # by the printer. Possible values are: a4, a4wide, letter, legal and
    816 # executive. If left blank a4wide will be used.
     1593# The PAPER_TYPE tag can be used to set the paper type that is used by the
     1594# printer.
     1595# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
     1596# 14 inches) and executive (7.25 x 10.5 inches).
     1597# The default value is: a4.
     1598# This tag requires that the tag GENERATE_LATEX is set to YES.
    8171599
    8181600PAPER_TYPE             = a4wide
    8191601
    820 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
    821 # packages that should be included in the LaTeX output.
    822 
    823 EXTRA_PACKAGES         =
    824 
    825 # The LATEX_HEADER tag can be used to specify a personal LaTeX header for
    826 # the generated latex document. The header should contain everything until
    827 # the first chapter. If it is left blank doxygen will generate a
    828 # standard header. Notice: only use this tag if you know what you are doing!
    829 
    830 LATEX_HEADER           =
    831 
    832 # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
    833 # is prepared for conversion to pdf (using ps2pdf). The pdf file will
    834 # contain links (just like the HTML output) instead of page references
    835 # This makes the output suitable for online browsing using a pdf viewer.
     1602# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
     1603# that should be included in the LaTeX output. To get the times font for
     1604# instance you can specify
     1605# EXTRA_PACKAGES=times
     1606# If left blank no extra packages will be included.
     1607# This tag requires that the tag GENERATE_LATEX is set to YES.
     1608
     1609EXTRA_PACKAGES         =
     1610
     1611# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
     1612# generated LaTeX document. The header should contain everything until the first
     1613# chapter. If it is left blank doxygen will generate a standard header. See
     1614# section "Doxygen usage" for information on how to let doxygen write the
     1615# default header to a separate file.
     1616#
     1617# Note: Only use a user-defined header if you know what you are doing! The
     1618# following commands have a special meaning inside the header: $title,
     1619# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
     1620# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string,
     1621# for the replacement values of the other commands the user is refered to
     1622# HTML_HEADER.
     1623# This tag requires that the tag GENERATE_LATEX is set to YES.
     1624
     1625LATEX_HEADER           =
     1626
     1627# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
     1628# generated LaTeX document. The footer should contain everything after the last
     1629# chapter. If it is left blank doxygen will generate a standard footer. See
     1630# LATEX_HEADER for more information on how to generate a default footer and what
     1631# special commands can be used inside the footer.
     1632#
     1633# Note: Only use a user-defined footer if you know what you are doing!
     1634# This tag requires that the tag GENERATE_LATEX is set to YES.
     1635
     1636LATEX_FOOTER           =
     1637
     1638# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
     1639# other source files which should be copied to the LATEX_OUTPUT output
     1640# directory. Note that the files will be copied as-is; there are no commands or
     1641# markers available.
     1642# This tag requires that the tag GENERATE_LATEX is set to YES.
     1643
     1644LATEX_EXTRA_FILES      =
     1645
     1646# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
     1647# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
     1648# contain links (just like the HTML output) instead of page references. This
     1649# makes the output suitable for online browsing using a PDF viewer.
     1650# The default value is: YES.
     1651# This tag requires that the tag GENERATE_LATEX is set to YES.
    8361652
    8371653PDF_HYPERLINKS         = NO
    8381654
    839 # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
    840 # plain latex in the generated Makefile. Set this option to YES to get a
     1655# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
     1656# the PDF file directly from the LaTeX files. Set this option to YES to get a
    8411657# higher quality PDF documentation.
     1658# The default value is: YES.
     1659# This tag requires that the tag GENERATE_LATEX is set to YES.
    8421660
    8431661USE_PDFLATEX           = NO
    8441662
    845 # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
    846 # command to the generated LaTeX files. This will instruct LaTeX to keep
    847 # running if errors occur, instead of asking the user for help.
    848 # This option is also used when generating formulas in HTML.
     1663# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
     1664# command to the generated LaTeX files. This will instruct LaTeX to keep running
     1665# if errors occur, instead of asking the user for help. This option is also used
     1666# when generating formulas in HTML.
     1667# The default value is: NO.
     1668# This tag requires that the tag GENERATE_LATEX is set to YES.
    8491669
    8501670LATEX_BATCHMODE        = NO
    8511671
    852 # If LATEX_HIDE_INDICES is set to YES then doxygen will not
    853 # include the index chapters (such as File Index, Compound Index, etc.)
    854 # in the output.
     1672# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
     1673# index chapters (such as File Index, Compound Index, etc.) in the output.
     1674# The default value is: NO.
     1675# This tag requires that the tag GENERATE_LATEX is set to YES.
    8551676
    8561677LATEX_HIDE_INDICES     = NO
    8571678
    858 #---------------------------------------------------------------------------
    859 # configuration options related to the RTF output
    860 #---------------------------------------------------------------------------
    861 
    862 # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
    863 # The RTF output is optimized for Word 97 and may not look very pretty with
    864 # other RTF readers or editors.
     1679# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
     1680# code with syntax highlighting in the LaTeX output.
     1681#
     1682# Note that which sources are shown also depends on other settings such as
     1683# SOURCE_BROWSER.
     1684# The default value is: NO.
     1685# This tag requires that the tag GENERATE_LATEX is set to YES.
     1686
     1687LATEX_SOURCE_CODE      = NO
     1688
     1689# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
     1690# bibliography, e.g. plainnat, or ieeetr. See
     1691# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
     1692# The default value is: plain.
     1693# This tag requires that the tag GENERATE_LATEX is set to YES.
     1694
     1695LATEX_BIB_STYLE        = plain
     1696
     1697#---------------------------------------------------------------------------
     1698# Configuration options related to the RTF output
     1699#---------------------------------------------------------------------------
     1700
     1701# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
     1702# RTF output is optimized for Word 97 and may not look too pretty with other RTF
     1703# readers/editors.
     1704# The default value is: NO.
    8651705
    8661706GENERATE_RTF           = NO
    8671707
    868 # The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
    869 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
    870 # put in front of it. If left blank `rtf' will be used as the default path.
     1708# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
     1709# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
     1710# it.
     1711# The default directory is: rtf.
     1712# This tag requires that the tag GENERATE_RTF is set to YES.
    8711713
    8721714RTF_OUTPUT             = rtf
    8731715
    874 # If the COMPACT_RTF tag is set to YES Doxygen generates more compact
    875 # RTF documents. This may be useful for small projects and may help to
    876 # save some trees in general.
     1716# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
     1717# documents. This may be useful for small projects and may help to save some
     1718# trees in general.
     1719# The default value is: NO.
     1720# This tag requires that the tag GENERATE_RTF is set to YES.
    8771721
    8781722COMPACT_RTF            = NO
    8791723
    880 # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
    881 # will contain hyperlink fields. The RTF file will
    882 # contain links (just like the HTML output) instead of page references.
    883 # This makes the output suitable for online browsing using WORD or other
    884 # programs which support those fields.
    885 # Note: wordpad (write) and others do not support links.
     1724# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
     1725# contain hyperlink fields. The RTF file will contain links (just like the HTML
     1726# output) instead of page references. This makes the output suitable for online
     1727# browsing using Word or some other Word compatible readers that support those
     1728# fields.
     1729#
     1730# Note: WordPad (write) and others do not support links.
     1731# The default value is: NO.
     1732# This tag requires that the tag GENERATE_RTF is set to YES.
    8861733
    8871734RTF_HYPERLINKS         = NO
    8881735
    889 # Load stylesheet definitions from file. Syntax is similar to doxygen's
    890 # config file, i.e. a series of assignments. You only have to provide
    891 # replacements, missing definitions are set to their default value.
    892 
    893 RTF_STYLESHEET_FILE    =
    894 
    895 # Set optional variables used in the generation of an rtf document.
    896 # Syntax is similar to doxygen's config file.
    897 
    898 RTF_EXTENSIONS_FILE    =
    899 
    900 #---------------------------------------------------------------------------
    901 # configuration options related to the man page output
    902 #---------------------------------------------------------------------------
    903 
    904 # If the GENERATE_MAN tag is set to YES (the default) Doxygen will
    905 # generate man pages
     1736# Load stylesheet definitions from file. Syntax is similar to doxygen's config
     1737# file, i.e. a series of assignments. You only have to provide replacements,
     1738# missing definitions are set to their default value.
     1739#
     1740# See also section "Doxygen usage" for information on how to generate the
     1741# default style sheet that doxygen normally uses.
     1742# This tag requires that the tag GENERATE_RTF is set to YES.
     1743
     1744RTF_STYLESHEET_FILE    =
     1745
     1746# Set optional variables used in the generation of an RTF document. Syntax is
     1747# similar to doxygen's config file. A template extensions file can be generated
     1748# using doxygen -e rtf extensionFile.
     1749# This tag requires that the tag GENERATE_RTF is set to YES.
     1750
     1751RTF_EXTENSIONS_FILE    =
     1752
     1753#---------------------------------------------------------------------------
     1754# Configuration options related to the man page output
     1755#---------------------------------------------------------------------------
     1756
     1757# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
     1758# classes and files.
     1759# The default value is: NO.
    9061760
    9071761GENERATE_MAN           = NO
    9081762
    909 # The MAN_OUTPUT tag is used to specify where the man pages will be put.
    910 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
    911 # put in front of it. If left blank `man' will be used as the default path.
     1763# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
     1764# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
     1765# it. A directory man3 will be created inside the directory specified by
     1766# MAN_OUTPUT.
     1767# The default directory is: man.
     1768# This tag requires that the tag GENERATE_MAN is set to YES.
    9121769
    9131770MAN_OUTPUT             = man
    9141771
    915 # The MAN_EXTENSION tag determines the extension that is added to
    916 # the generated man pages (default is the subroutine's section .3)
     1772# The MAN_EXTENSION tag determines the extension that is added to the generated
     1773# man pages. In case the manual section does not start with a number, the number
     1774# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
     1775# optional.
     1776# The default value is: .3.
     1777# This tag requires that the tag GENERATE_MAN is set to YES.
    9171778
    9181779MAN_EXTENSION          = .3
    9191780
    920 # If the MAN_LINKS tag is set to YES and Doxygen generates man output,
    921 # then it will generate one additional man file for each entity
    922 # documented in the real man page(s). These additional files
    923 # only source the real man page, but without them the man command
    924 # would be unable to find the correct page. The default is NO.
     1781# The MAN_SUBDIR tag determines the name of the directory created within
     1782# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
     1783# MAN_EXTENSION with the initial . removed.
     1784# This tag requires that the tag GENERATE_MAN is set to YES.
     1785
     1786MAN_SUBDIR             =
     1787
     1788# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
     1789# will generate one additional man file for each entity documented in the real
     1790# man page(s). These additional files only source the real man page, but without
     1791# them the man command would be unable to find the correct page.
     1792# The default value is: NO.
     1793# This tag requires that the tag GENERATE_MAN is set to YES.
    9251794
    9261795MAN_LINKS              = NO
    9271796
    9281797#---------------------------------------------------------------------------
    929 # configuration options related to the XML output
    930 #---------------------------------------------------------------------------
    931 
    932 # If the GENERATE_XML tag is set to YES Doxygen will
    933 # generate an XML file that captures the structure of
    934 # the code including all documentation.
     1798# Configuration options related to the XML output
     1799#---------------------------------------------------------------------------
     1800
     1801# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
     1802# captures the structure of the code including all documentation.
     1803# The default value is: NO.
    9351804
    9361805GENERATE_XML           = NO
    9371806
    938 # The XML_OUTPUT tag is used to specify where the XML pages will be put.
    939 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
    940 # put in front of it. If left blank `xml' will be used as the default path.
     1807# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
     1808# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
     1809# it.
     1810# The default directory is: xml.
     1811# This tag requires that the tag GENERATE_XML is set to YES.
    9411812
    9421813XML_OUTPUT             = xml
    9431814
    944 # The XML_SCHEMA tag can be used to specify an XML schema,
    945 # which can be used by a validating XML parser to check the
    946 # syntax of the XML files.
    947 
    948 XML_SCHEMA             =
    949 
    950 # The XML_DTD tag can be used to specify an XML DTD,
    951 # which can be used by a validating XML parser to check the
    952 # syntax of the XML files.
    953 
    954 XML_DTD                =
    955 
    956 # If the XML_PROGRAMLISTING tag is set to YES Doxygen will
    957 # dump the program listings (including syntax highlighting
    958 # and cross-referencing information) to the XML output. Note that
    959 # enabling this will significantly increase the size of the XML output.
     1815# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
     1816# listings (including syntax highlighting and cross-referencing information) to
     1817# the XML output. Note that enabling this will significantly increase the size
     1818# of the XML output.
     1819# The default value is: YES.
     1820# This tag requires that the tag GENERATE_XML is set to YES.
    9601821
    9611822XML_PROGRAMLISTING     = YES
    9621823
    9631824#---------------------------------------------------------------------------
    964 # configuration options for the AutoGen Definitions output
    965 #---------------------------------------------------------------------------
    966 
    967 # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
    968 # generate an AutoGen Definitions (see autogen.sf.net) file
    969 # that captures the structure of the code including all
    970 # documentation. Note that this feature is still experimental
    971 # and incomplete at the moment.
     1825# Configuration options related to the DOCBOOK output
     1826#---------------------------------------------------------------------------
     1827
     1828# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
     1829# that can be used to generate PDF.
     1830# The default value is: NO.
     1831
     1832GENERATE_DOCBOOK       = NO
     1833
     1834# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
     1835# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
     1836# front of it.
     1837# The default directory is: docbook.
     1838# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
     1839
     1840DOCBOOK_OUTPUT         = docbook
     1841
     1842# If the DOCBOOK_PROGRAMLISTING tag is set to YES doxygen will include the
     1843# program listings (including syntax highlighting and cross-referencing
     1844# information) to the DOCBOOK output. Note that enabling this will significantly
     1845# increase the size of the DOCBOOK output.
     1846# The default value is: NO.
     1847# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
     1848
     1849DOCBOOK_PROGRAMLISTING = NO
     1850
     1851#---------------------------------------------------------------------------
     1852# Configuration options for the AutoGen Definitions output
     1853#---------------------------------------------------------------------------
     1854
     1855# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
     1856# Definitions (see http://autogen.sf.net) file that captures the structure of
     1857# the code including all documentation. Note that this feature is still
     1858# experimental and incomplete at the moment.
     1859# The default value is: NO.
    9721860
    9731861GENERATE_AUTOGEN_DEF   = NO
    9741862
    9751863#---------------------------------------------------------------------------
    976 # configuration options related to the Perl module output
    977 #---------------------------------------------------------------------------
    978 
    979 # If the GENERATE_PERLMOD tag is set to YES Doxygen will
    980 # generate a Perl module file that captures the structure of
    981 # the code including all documentation. Note that this
    982 # feature is still experimental and incomplete at the
    983 # moment.
     1864# Configuration options related to the Perl module output
     1865#---------------------------------------------------------------------------
     1866
     1867# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
     1868# file that captures the structure of the code including all documentation.
     1869#
     1870# Note that this feature is still experimental and incomplete at the moment.
     1871# The default value is: NO.
    9841872
    9851873GENERATE_PERLMOD       = NO
    9861874
    987 # If the PERLMOD_LATEX tag is set to YES Doxygen will generate
    988 # the necessary Makefile rules, Perl scripts and LaTeX code to be able
    989 # to generate PDF and DVI output from the Perl module output.
     1875# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
     1876# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
     1877# output from the Perl module output.
     1878# The default value is: NO.
     1879# This tag requires that the tag GENERATE_PERLMOD is set to YES.
    9901880
    9911881PERLMOD_LATEX          = NO
    9921882
    993 # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
    994 # nicely formatted so it can be parsed by a human reader.  This is useful
    995 # if you want to understand what is going on.  On the other hand, if this
    996 # tag is set to NO the size of the Perl module output will be much smaller
    997 # and Perl will parse it just the same.
     1883# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
     1884# formatted so it can be parsed by a human reader. This is useful if you want to
     1885# understand what is going on. On the other hand, if this tag is set to NO the
     1886# size of the Perl module output will be much smaller and Perl will parse it
     1887# just the same.
     1888# The default value is: YES.
     1889# This tag requires that the tag GENERATE_PERLMOD is set to YES.
    9981890
    9991891PERLMOD_PRETTY         = YES
    10001892
    1001 # The names of the make variables in the generated doxyrules.make file
    1002 # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
    1003 # This is useful so different doxyrules.make files included by the same
    1004 # Makefile don't overwrite each other's variables.
    1005 
    1006 PERLMOD_MAKEVAR_PREFIX =
    1007 
    1008 #---------------------------------------------------------------------------
    1009 # Configuration options related to the preprocessor   
    1010 #---------------------------------------------------------------------------
    1011 
    1012 # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
    1013 # evaluate all C-preprocessor directives found in the sources and include
     1893# The names of the make variables in the generated doxyrules.make file are
     1894# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
     1895# so different doxyrules.make files included by the same Makefile don't
     1896# overwrite each other's variables.
     1897# This tag requires that the tag GENERATE_PERLMOD is set to YES.
     1898
     1899PERLMOD_MAKEVAR_PREFIX =
     1900
     1901#---------------------------------------------------------------------------
     1902# Configuration options related to the preprocessor
     1903#---------------------------------------------------------------------------
     1904
     1905# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
     1906# C-preprocessor directives found in the sources and include files.
     1907# The default value is: YES.
     1908
     1909ENABLE_PREPROCESSING   = YES
     1910
     1911# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
     1912# in the source code. If set to NO only conditional compilation will be
     1913# performed. Macro expansion can be done in a controlled way by setting
     1914# EXPAND_ONLY_PREDEF to YES.
     1915# The default value is: NO.
     1916# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
     1917
     1918MACRO_EXPANSION        = YES
     1919
     1920# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
     1921# the macro expansion is limited to the macros specified with the PREDEFINED and
     1922# EXPAND_AS_DEFINED tags.
     1923# The default value is: NO.
     1924# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
     1925
     1926EXPAND_ONLY_PREDEF     = YES
     1927
     1928# If the SEARCH_INCLUDES tag is set to YES the includes files in the
     1929# INCLUDE_PATH will be searched if a #include is found.
     1930# The default value is: YES.
     1931# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
     1932
     1933SEARCH_INCLUDES        = YES
     1934
     1935# The INCLUDE_PATH tag can be used to specify one or more directories that
     1936# contain include files that are not input files but should be processed by the
     1937# preprocessor.
     1938# This tag requires that the tag SEARCH_INCLUDES is set to YES.
     1939
     1940INCLUDE_PATH           =
     1941
     1942# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
     1943# patterns (like *.h and *.hpp) to filter out the header-files in the
     1944# directories. If left blank, the patterns specified with FILE_PATTERNS will be
     1945# used.
     1946# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
     1947
     1948INCLUDE_FILE_PATTERNS  =
     1949
     1950# The PREDEFINED tag can be used to specify one or more macro names that are
     1951# defined before the preprocessor is started (similar to the -D option of e.g.
     1952# gcc). The argument of the tag is a list of macros of the form: name or
     1953# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
     1954# is assumed. To prevent a macro definition from being undefined via #undef or
     1955# recursively expanded use the := operator instead of the = operator.
     1956# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
     1957
     1958PREDEFINED             = API_EXPORTED= \
     1959                         LIBUSB_CALL= \
     1960                         DEFAULT_VISIBILITY=
     1961
     1962# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
     1963# tag can be used to specify a list of macro names that should be expanded. The
     1964# macro definition that is found in the sources will be used. Use the PREDEFINED
     1965# tag if you want to use a different macro definition that overrules the
     1966# definition found in the source code.
     1967# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
     1968
     1969EXPAND_AS_DEFINED      =
     1970
     1971# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
     1972# remove all references to function-like macros that are alone on a line, have
     1973# an all uppercase name, and do not end with a semicolon. Such function macros
     1974# are typically used for boiler-plate code, and will confuse the parser if not
     1975# removed.
     1976# The default value is: YES.
     1977# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
     1978
     1979SKIP_FUNCTION_MACROS   = YES
     1980
     1981#---------------------------------------------------------------------------
     1982# Configuration options related to external references
     1983#---------------------------------------------------------------------------
     1984
     1985# The TAGFILES tag can be used to specify one or more tag files. For each tag
     1986# file the location of the external documentation should be added. The format of
     1987# a tag file without this location is as follows:
     1988# TAGFILES = file1 file2 ...
     1989# Adding location for the tag files is done as follows:
     1990# TAGFILES = file1=loc1 "file2 = loc2" ...
     1991# where loc1 and loc2 can be relative or absolute paths or URLs. See the
     1992# section "Linking to external documentation" for more information about the use
     1993# of tag files.
     1994# Note: Each tag file must have a unique name (where the name does NOT include
     1995# the path). If a tag file is not located in the directory in which doxygen is
     1996# run, you must also specify the path to the tagfile here.
     1997
     1998TAGFILES               =
     1999
     2000# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
     2001# tag file that is based on the input files it reads. See section "Linking to
     2002# external documentation" for more information about the usage of tag files.
     2003
     2004GENERATE_TAGFILE       =
     2005
     2006# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
     2007# class index. If set to NO only the inherited external classes will be listed.
     2008# The default value is: NO.
     2009
     2010ALLEXTERNALS           = NO
     2011
     2012# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
     2013# the modules index. If set to NO, only the current project's groups will be
     2014# listed.
     2015# The default value is: YES.
     2016
     2017EXTERNAL_GROUPS        = YES
     2018
     2019# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
     2020# the related pages index. If set to NO, only the current project's pages will
     2021# be listed.
     2022# The default value is: YES.
     2023
     2024EXTERNAL_PAGES         = YES
     2025
     2026# The PERL_PATH should be the absolute path and name of the perl script
     2027# interpreter (i.e. the result of 'which perl').
     2028# The default file (with absolute path) is: /usr/bin/perl.
     2029
     2030PERL_PATH              = /usr/bin/perl
     2031
     2032#---------------------------------------------------------------------------
     2033# Configuration options related to the dot tool
     2034#---------------------------------------------------------------------------
     2035
     2036# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
     2037# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
     2038# NO turns the diagrams off. Note that this option also works with HAVE_DOT
     2039# disabled, but it is recommended to install and use dot, since it yields more
     2040# powerful graphs.
     2041# The default value is: YES.
     2042
     2043CLASS_DIAGRAMS         = YES
     2044
     2045# You can define message sequence charts within doxygen comments using the \msc
     2046# command. Doxygen will then run the mscgen tool (see:
     2047# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
     2048# documentation. The MSCGEN_PATH tag allows you to specify the directory where
     2049# the mscgen tool resides. If left empty the tool is assumed to be found in the
     2050# default search path.
     2051
     2052MSCGEN_PATH            =
     2053
     2054# You can include diagrams made with dia in doxygen documentation. Doxygen will
     2055# then run dia to produce the diagram and insert it in the documentation. The
     2056# DIA_PATH tag allows you to specify the directory where the dia binary resides.
     2057# If left empty dia is assumed to be found in the default search path.
     2058
     2059DIA_PATH               =
     2060
     2061# If set to YES, the inheritance and collaboration graphs will hide inheritance
     2062# and usage relations if the target is undocumented or is not a class.
     2063# The default value is: YES.
     2064
     2065HIDE_UNDOC_RELATIONS   = YES
     2066
     2067# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
     2068# available from the path. This tool is part of Graphviz (see:
     2069# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
     2070# Bell Labs. The other options in this section have no effect if this option is
     2071# set to NO
     2072# The default value is: NO.
     2073
     2074HAVE_DOT               = NO
     2075
     2076# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
     2077# to run in parallel. When set to 0 doxygen will base this on the number of
     2078# processors available in the system. You can set it explicitly to a value
     2079# larger than 0 to get control over the balance between CPU load and processing
     2080# speed.
     2081# Minimum value: 0, maximum value: 32, default value: 0.
     2082# This tag requires that the tag HAVE_DOT is set to YES.
     2083
     2084DOT_NUM_THREADS        = 0
     2085
     2086# When you want a differently looking font in the dot files that doxygen
     2087# generates you can specify the font name using DOT_FONTNAME. You need to make
     2088# sure dot is able to find the font, which can be done by putting it in a
     2089# standard location or by setting the DOTFONTPATH environment variable or by
     2090# setting DOT_FONTPATH to the directory containing the font.
     2091# The default value is: Helvetica.
     2092# This tag requires that the tag HAVE_DOT is set to YES.
     2093
     2094DOT_FONTNAME           = Helvetica
     2095
     2096# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
     2097# dot graphs.
     2098# Minimum value: 4, maximum value: 24, default value: 10.
     2099# This tag requires that the tag HAVE_DOT is set to YES.
     2100
     2101DOT_FONTSIZE           = 10
     2102
     2103# By default doxygen will tell dot to use the default font as specified with
     2104# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
     2105# the path where dot can find it using this tag.
     2106# This tag requires that the tag HAVE_DOT is set to YES.
     2107
     2108DOT_FONTPATH           =
     2109
     2110# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
     2111# each documented class showing the direct and indirect inheritance relations.
     2112# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
     2113# The default value is: YES.
     2114# This tag requires that the tag HAVE_DOT is set to YES.
     2115
     2116CLASS_GRAPH            = YES
     2117
     2118# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
     2119# graph for each documented class showing the direct and indirect implementation
     2120# dependencies (inheritance, containment, and class references variables) of the
     2121# class with other documented classes.
     2122# The default value is: YES.
     2123# This tag requires that the tag HAVE_DOT is set to YES.
     2124
     2125COLLABORATION_GRAPH    = YES
     2126
     2127# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
     2128# groups, showing the direct groups dependencies.
     2129# The default value is: YES.
     2130# This tag requires that the tag HAVE_DOT is set to YES.
     2131
     2132GROUP_GRAPHS           = YES
     2133
     2134# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
     2135# collaboration diagrams in a style similar to the OMG's Unified Modeling
     2136# Language.
     2137# The default value is: NO.
     2138# This tag requires that the tag HAVE_DOT is set to YES.
     2139
     2140UML_LOOK               = NO
     2141
     2142# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
     2143# class node. If there are many fields or methods and many nodes the graph may
     2144# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
     2145# number of items for each type to make the size more manageable. Set this to 0
     2146# for no limit. Note that the threshold may be exceeded by 50% before the limit
     2147# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
     2148# but if the number exceeds 15, the total amount of fields shown is limited to
     2149# 10.
     2150# Minimum value: 0, maximum value: 100, default value: 10.
     2151# This tag requires that the tag HAVE_DOT is set to YES.
     2152
     2153UML_LIMIT_NUM_FIELDS   = 10
     2154
     2155# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
     2156# collaboration graphs will show the relations between templates and their
     2157# instances.
     2158# The default value is: NO.
     2159# This tag requires that the tag HAVE_DOT is set to YES.
     2160
     2161TEMPLATE_RELATIONS     = NO
     2162
     2163# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
     2164# YES then doxygen will generate a graph for each documented file showing the
     2165# direct and indirect include dependencies of the file with other documented
    10142166# files.
    1015 
    1016 ENABLE_PREPROCESSING   = YES
    1017 
    1018 # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
    1019 # names in the source code. If set to NO (the default) only conditional
    1020 # compilation will be performed. Macro expansion can be done in a controlled
    1021 # way by setting EXPAND_ONLY_PREDEF to YES.
    1022 
    1023 MACRO_EXPANSION        = YES
    1024 
    1025 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
    1026 # then the macro expansion is limited to the macros specified with the
    1027 # PREDEFINED and EXPAND_AS_DEFINED tags.
    1028 
    1029 EXPAND_ONLY_PREDEF     = YES
    1030 
    1031 # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
    1032 # in the INCLUDE_PATH (see below) will be search if a #include is found.
    1033 
    1034 SEARCH_INCLUDES        = YES
    1035 
    1036 # The INCLUDE_PATH tag can be used to specify one or more directories that
    1037 # contain include files that are not input files but should be processed by
    1038 # the preprocessor.
    1039 
    1040 INCLUDE_PATH           =
    1041 
    1042 # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
    1043 # patterns (like *.h and *.hpp) to filter out the header-files in the
    1044 # directories. If left blank, the patterns specified with FILE_PATTERNS will
    1045 # be used.
    1046 
    1047 INCLUDE_FILE_PATTERNS  =
    1048 
    1049 # The PREDEFINED tag can be used to specify one or more macro names that
    1050 # are defined before the preprocessor is started (similar to the -D option of
    1051 # gcc). The argument of the tag is a list of macros of the form: name
    1052 # or name=definition (no spaces). If the definition and the = are
    1053 # omitted =1 is assumed. To prevent a macro definition from being
    1054 # undefined via #undef or recursively expanded use the := operator
    1055 # instead of the = operator.
    1056 
    1057 PREDEFINED             = API_EXPORTED= LIBUSB_CALL= DEFAULT_VISIBILITY=
    1058 
    1059 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
    1060 # this tag can be used to specify a list of macro names that should be expanded.
    1061 # The macro definition that is found in the sources will be used.
    1062 # Use the PREDEFINED tag if you want to use a different macro definition.
    1063 
    1064 EXPAND_AS_DEFINED      =
    1065 
    1066 # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
    1067 # doxygen's preprocessor will remove all function-like macros that are alone
    1068 # on a line, have an all uppercase name, and do not end with a semicolon. Such
    1069 # function macros are typically used for boiler-plate code, and will confuse
    1070 # the parser if not removed.
    1071 
    1072 SKIP_FUNCTION_MACROS   = YES
    1073 
    1074 #---------------------------------------------------------------------------
    1075 # Configuration::additions related to external references   
    1076 #---------------------------------------------------------------------------
    1077 
    1078 # The TAGFILES option can be used to specify one or more tagfiles.
    1079 # Optionally an initial location of the external documentation
    1080 # can be added for each tagfile. The format of a tag file without
    1081 # this location is as follows:
    1082 #   TAGFILES = file1 file2 ...
    1083 # Adding location for the tag files is done as follows:
    1084 #   TAGFILES = file1=loc1 "file2 = loc2" ...
    1085 # where "loc1" and "loc2" can be relative or absolute paths or
    1086 # URLs. If a location is present for each tag, the installdox tool
    1087 # does not have to be run to correct the links.
    1088 # Note that each tag file must have a unique name
    1089 # (where the name does NOT include the path)
    1090 # If a tag file is not located in the directory in which doxygen
    1091 # is run, you must also specify the path to the tagfile here.
    1092 
    1093 TAGFILES               =
    1094 
    1095 # When a file name is specified after GENERATE_TAGFILE, doxygen will create
    1096 # a tag file that is based on the input files it reads.
    1097 
    1098 GENERATE_TAGFILE       =
    1099 
    1100 # If the ALLEXTERNALS tag is set to YES all external classes will be listed
    1101 # in the class index. If set to NO only the inherited external classes
    1102 # will be listed.
    1103 
    1104 ALLEXTERNALS           = NO
    1105 
    1106 # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
    1107 # in the modules index. If set to NO, only the current project's groups will
    1108 # be listed.
    1109 
    1110 EXTERNAL_GROUPS        = YES
    1111 
    1112 # The PERL_PATH should be the absolute path and name of the perl script
    1113 # interpreter (i.e. the result of `which perl').
    1114 
    1115 PERL_PATH              = /usr/bin/perl
    1116 
    1117 #---------------------------------------------------------------------------
    1118 # Configuration options related to the dot tool   
    1119 #---------------------------------------------------------------------------
    1120 
    1121 # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
    1122 # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
    1123 # or super classes. Setting the tag to NO turns the diagrams off. Note that
    1124 # this option is superseded by the HAVE_DOT option below. This is only a
    1125 # fallback. It is recommended to install and use dot, since it yields more
    1126 # powerful graphs.
    1127 
    1128 CLASS_DIAGRAMS         = YES
    1129 
    1130 # You can define message sequence charts within doxygen comments using the \msc
    1131 # command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
    1132 # produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
    1133 # specify the directory where the mscgen tool resides. If left empty the tool is assumed to
    1134 # be found in the default search path.
    1135 
    1136 MSCGEN_PATH            =
    1137 
    1138 # If set to YES, the inheritance and collaboration graphs will hide
    1139 # inheritance and usage relations if the target is undocumented
    1140 # or is not a class.
    1141 
    1142 HIDE_UNDOC_RELATIONS   = YES
    1143 
    1144 # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
    1145 # available from the path. This tool is part of Graphviz, a graph visualization
    1146 # toolkit from AT&T and Lucent Bell Labs. The other options in this section
    1147 # have no effect if this option is set to NO (the default)
    1148 
    1149 HAVE_DOT               = NO
    1150 
    1151 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
    1152 # will generate a graph for each documented class showing the direct and
    1153 # indirect inheritance relations. Setting this tag to YES will force the
    1154 # the CLASS_DIAGRAMS tag to NO.
    1155 
    1156 CLASS_GRAPH            = YES
    1157 
    1158 # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
    1159 # will generate a graph for each documented class showing the direct and
    1160 # indirect implementation dependencies (inheritance, containment, and
    1161 # class references variables) of the class with other documented classes.
    1162 
    1163 COLLABORATION_GRAPH    = YES
    1164 
    1165 # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
    1166 # will generate a graph for groups, showing the direct groups dependencies
    1167 
    1168 GROUP_GRAPHS           = YES
    1169 
    1170 # If the UML_LOOK tag is set to YES doxygen will generate inheritance and
    1171 # collaboration diagrams in a style similar to the OMG's Unified Modeling
    1172 # Language.
    1173 
    1174 UML_LOOK               = NO
    1175 
    1176 # If set to YES, the inheritance and collaboration graphs will show the
    1177 # relations between templates and their instances.
    1178 
    1179 TEMPLATE_RELATIONS     = NO
    1180 
    1181 # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
    1182 # tags are set to YES then doxygen will generate a graph for each documented
    1183 # file showing the direct and indirect include dependencies of the file with
    1184 # other documented files.
     2167# The default value is: YES.
     2168# This tag requires that the tag HAVE_DOT is set to YES.
    11852169
    11862170INCLUDE_GRAPH          = YES
    11872171
    1188 # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
    1189 # HAVE_DOT tags are set to YES then doxygen will generate a graph for each
    1190 # documented header file showing the documented files that directly or
    1191 # indirectly include this file.
     2172# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
     2173# set to YES then doxygen will generate a graph for each documented file showing
     2174# the direct and indirect include dependencies of the file with other documented
     2175# files.
     2176# The default value is: YES.
     2177# This tag requires that the tag HAVE_DOT is set to YES.
    11922178
    11932179INCLUDED_BY_GRAPH      = YES
    11942180
    1195 # If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
    1196 # generate a call dependency graph for every global function or class method.
    1197 # Note that enabling this option will significantly increase the time of a run.
    1198 # So in most cases it will be better to enable call graphs for selected
     2181# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
     2182# dependency graph for every global function or class method.
     2183#
     2184# Note that enabling this option will significantly increase the time of a run.
     2185# So in most cases it will be better to enable call graphs for selected
    11992186# functions only using the \callgraph command.
     2187# The default value is: NO.
     2188# This tag requires that the tag HAVE_DOT is set to YES.
    12002189
    12012190CALL_GRAPH             = NO
    12022191
    1203 # If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
    1204 # generate a caller dependency graph for every global function or class method.
    1205 # Note that enabling this option will significantly increase the time of a run.
    1206 # So in most cases it will be better to enable caller graphs for selected
     2192# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
     2193# dependency graph for every global function or class method.
     2194#
     2195# Note that enabling this option will significantly increase the time of a run.
     2196# So in most cases it will be better to enable caller graphs for selected
    12072197# functions only using the \callergraph command.
     2198# The default value is: NO.
     2199# This tag requires that the tag HAVE_DOT is set to YES.
    12082200
    12092201CALLER_GRAPH           = NO
    12102202
    1211 # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
    1212 # will graphical hierarchy of all classes instead of a textual one.
     2203# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
     2204# hierarchy of all classes instead of a textual one.
     2205# The default value is: YES.
     2206# This tag requires that the tag HAVE_DOT is set to YES.
    12132207
    12142208GRAPHICAL_HIERARCHY    = YES
    12152209
    1216 # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
    1217 # then doxygen will show the dependencies a directory has on other directories
    1218 # in a graphical way. The dependency relations are determined by the #include
    1219 # relations between the files in the directories.
     2210# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
     2211# dependencies a directory has on other directories in a graphical way. The
     2212# dependency relations are determined by the #include relations between the
     2213# files in the directories.
     2214# The default value is: YES.
     2215# This tag requires that the tag HAVE_DOT is set to YES.
    12202216
    12212217DIRECTORY_GRAPH        = YES
    12222218
    1223 # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
    1224 # generated by dot. Possible values are png, jpg, or gif
    1225 # If left blank png will be used.
     2219# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
     2220# generated by dot.
     2221# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
     2222# to make the SVG files visible in IE 9+ (other browsers do not have this
     2223# requirement).
     2224# Possible values are: png, jpg, gif and svg.
     2225# The default value is: png.
     2226# This tag requires that the tag HAVE_DOT is set to YES.
    12262227
    12272228DOT_IMAGE_FORMAT       = png
    12282229
    1229 # The tag DOT_PATH can be used to specify the path where the dot tool can be
     2230# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
     2231# enable generation of interactive SVG images that allow zooming and panning.
     2232#
     2233# Note that this requires a modern browser other than Internet Explorer. Tested
     2234# and working are Firefox, Chrome, Safari, and Opera.
     2235# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
     2236# the SVG files visible. Older versions of IE do not have SVG support.
     2237# The default value is: NO.
     2238# This tag requires that the tag HAVE_DOT is set to YES.
     2239
     2240INTERACTIVE_SVG        = NO
     2241
     2242# The DOT_PATH tag can be used to specify the path where the dot tool can be
    12302243# found. If left blank, it is assumed the dot tool can be found in the path.
    1231 
    1232 DOT_PATH               =
    1233 
    1234 # The DOTFILE_DIRS tag can be used to specify one or more directories that
    1235 # contain dot files that are included in the documentation (see the
    1236 # \dotfile command).
    1237 
    1238 DOTFILE_DIRS           =
    1239 
    1240 # The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
    1241 # nodes that will be shown in the graph. If the number of nodes in a graph
    1242 # becomes larger than this value, doxygen will truncate the graph, which is
    1243 # visualized by representing a node as a red box. Note that doxygen if the number
    1244 # of direct children of the root node in a graph is already larger than
    1245 # MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note
    1246 # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
     2244# This tag requires that the tag HAVE_DOT is set to YES.
     2245
     2246DOT_PATH               =
     2247
     2248# The DOTFILE_DIRS tag can be used to specify one or more directories that
     2249# contain dot files that are included in the documentation (see the \dotfile
     2250# command).
     2251# This tag requires that the tag HAVE_DOT is set to YES.
     2252
     2253DOTFILE_DIRS           =
     2254
     2255# The MSCFILE_DIRS tag can be used to specify one or more directories that
     2256# contain msc files that are included in the documentation (see the \mscfile
     2257# command).
     2258
     2259MSCFILE_DIRS           =
     2260
     2261# The DIAFILE_DIRS tag can be used to specify one or more directories that
     2262# contain dia files that are included in the documentation (see the \diafile
     2263# command).
     2264
     2265DIAFILE_DIRS           =
     2266
     2267# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
     2268# path where java can find the plantuml.jar file. If left blank, it is assumed
     2269# PlantUML is not used or called during a preprocessing step. Doxygen will
     2270# generate a warning when it encounters a \startuml command in this case and
     2271# will not generate output for the diagram.
     2272# This tag requires that the tag HAVE_DOT is set to YES.
     2273
     2274PLANTUML_JAR_PATH      =
     2275
     2276# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
     2277# that will be shown in the graph. If the number of nodes in a graph becomes
     2278# larger than this value, doxygen will truncate the graph, which is visualized
     2279# by representing a node as a red box. Note that doxygen if the number of direct
     2280# children of the root node in a graph is already larger than
     2281# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
     2282# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
     2283# Minimum value: 0, maximum value: 10000, default value: 50.
     2284# This tag requires that the tag HAVE_DOT is set to YES.
    12472285
    12482286DOT_GRAPH_MAX_NODES    = 50
    12492287
    1250 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
    1251 # graphs generated by dot. A depth value of 3 means that only nodes reachable
    1252 # from the root by following a path via at most 3 edges will be shown. Nodes
    1253 # that lay further from the root node will be omitted. Note that setting this
    1254 # option to 1 or 2 may greatly reduce the computation time needed for large
    1255 # code bases. Also note that the size of a graph can be further restricted by
     2288# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
     2289# generated by dot. A depth value of 3 means that only nodes reachable from the
     2290# root by following a path via at most 3 edges will be shown. Nodes that lay
     2291# further from the root node will be omitted. Note that setting this option to 1
     2292# or 2 may greatly reduce the computation time needed for large code bases. Also
     2293# note that the size of a graph can be further restricted by
    12562294# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
     2295# Minimum value: 0, maximum value: 1000, default value: 0.
     2296# This tag requires that the tag HAVE_DOT is set to YES.
    12572297
    12582298MAX_DOT_GRAPH_DEPTH    = 0
    12592299
    1260 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
    1261 # background. This is disabled by default, which results in a white background.
    1262 # Warning: Depending on the platform used, enabling this option may lead to
    1263 # badly anti-aliased labels on the edges of a graph (i.e. they become hard to
     2300# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
     2301# background. This is disabled by default, because dot on Windows does not seem
     2302# to support this out of the box.
     2303#
     2304# Warning: Depending on the platform used, enabling this option may lead to
     2305# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
    12642306# read).
     2307# The default value is: NO.
     2308# This tag requires that the tag HAVE_DOT is set to YES.
    12652309
    12662310DOT_TRANSPARENT        = NO
    12672311
    1268 # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
    1269 # files in one run (i.e. multiple -o and -T options on the command line). This
    1270 # makes dot run faster, but since only newer versions of dot (>1.8.10)
    1271 # support this, this feature is disabled by default.
     2312# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
     2313# files in one run (i.e. multiple -o and -T options on the command line). This
     2314# makes dot run faster, but since only newer versions of dot (>1.8.10) support
     2315# this, this feature is disabled by default.
     2316# The default value is: NO.
     2317# This tag requires that the tag HAVE_DOT is set to YES.
    12722318
    12732319DOT_MULTI_TARGETS      = NO
    12742320
    1275 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
    1276 # generate a legend page explaining the meaning of the various boxes and
    1277 # arrows in the dot generated graphs.
     2321# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
     2322# explaining the meaning of the various boxes and arrows in the dot generated
     2323# graphs.
     2324# The default value is: YES.
     2325# This tag requires that the tag HAVE_DOT is set to YES.
    12782326
    12792327GENERATE_LEGEND        = YES
    12802328
    1281 # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
    1282 # remove the intermediate dot files that are used to generate
    1283 # the various graphs.
     2329# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
     2330# files that are used to generate the various graphs.
     2331# The default value is: YES.
     2332# This tag requires that the tag HAVE_DOT is set to YES.
    12842333
    12852334DOT_CLEANUP            = YES
    1286 
    1287 #---------------------------------------------------------------------------
    1288 # Configuration::additions related to the search engine   
    1289 #---------------------------------------------------------------------------
    1290 
    1291 # The SEARCHENGINE tag specifies whether or not a search engine should be
    1292 # used. If set to NO the values of all tags below this one will be ignored.
    1293 
    1294 SEARCHENGINE           = NO
  • TabularUnified libusb1/trunk/examples/Makefile.am

    r1876 r1882  
    11AM_CPPFLAGS = -I$(top_srcdir)/libusb
    22LDADD = ../libusb/libusb-1.0.la
    3 noinst_PROGRAMS = listdevs hotplugtest testlibusb1
     3
     4noinst_PROGRAMS = listdevs xusb fxload hotplugtest testlibusb
    45
    56if HAVE_SIGACTION
     
    78
    89if THREADS_POSIX
    9 dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
     10dpfp_threaded_CFLAGS = $(AM_CFLAGS)
    1011noinst_PROGRAMS += dpfp_threaded
    1112endif
     
    1415noinst_PROGRAMS += sam3u_benchmark
    1516endif
     17
     18fxload_SOURCES = ezusb.c ezusb.h fxload.c
     19fxload_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
  • TabularUnified libusb1/trunk/examples/Makefile.in

    r1879 r1882  
    1 # Makefile.in generated by automake 1.11.1 from Makefile.am.
     1# Makefile.in generated by automake 1.14.1 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
    6 # Inc.
     4# Copyright (C) 1994-2013 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    1716
    1817VPATH = @srcdir@
     18am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
     19am__make_running_with_option = \
     20  case $${target_option-} in \
     21      ?) ;; \
     22      *) echo "am__make_running_with_option: internal error: invalid" \
     23              "target option '$${target_option-}' specified" >&2; \
     24         exit 1;; \
     25  esac; \
     26  has_opt=no; \
     27  sane_makeflags=$$MAKEFLAGS; \
     28  if $(am__is_gnu_make); then \
     29    sane_makeflags=$$MFLAGS; \
     30  else \
     31    case $$MAKEFLAGS in \
     32      *\\[\ \   ]*) \
     33        bs=\\; \
     34        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     35          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     36    esac; \
     37  fi; \
     38  skip_next=no; \
     39  strip_trailopt () \
     40  { \
     41    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     42  }; \
     43  for flg in $$sane_makeflags; do \
     44    test $$skip_next = yes && { skip_next=no; continue; }; \
     45    case $$flg in \
     46      *=*|--*) continue;; \
     47        -*I) strip_trailopt 'I'; skip_next=yes;; \
     48      -*I?*) strip_trailopt 'I';; \
     49        -*O) strip_trailopt 'O'; skip_next=yes;; \
     50      -*O?*) strip_trailopt 'O';; \
     51        -*l) strip_trailopt 'l'; skip_next=yes;; \
     52      -*l?*) strip_trailopt 'l';; \
     53      -[dEDm]) skip_next=yes;; \
     54      -[JT]) skip_next=yes;; \
     55    esac; \
     56    case $$flg in \
     57      *$$target_option*) has_opt=yes; break;; \
     58    esac; \
     59  done; \
     60  test $$has_opt = yes
     61am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     62am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    1963pkgdatadir = $(datadir)/@PACKAGE@
    2064pkgincludedir = $(includedir)/@PACKAGE@
     
    3579build_triplet = @build@
    3680host_triplet = @host@
    37 noinst_PROGRAMS = listdevs$(EXEEXT) hotplugtest$(EXEEXT) \
    38         testlibusb1$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
    39         $(am__EXEEXT_3)
     81noinst_PROGRAMS = listdevs$(EXEEXT) xusb$(EXEEXT) fxload$(EXEEXT) \
     82        hotplugtest$(EXEEXT) testlibusb$(EXEEXT) $(am__EXEEXT_1) \
     83        $(am__EXEEXT_2) $(am__EXEEXT_3)
    4084@HAVE_SIGACTION_TRUE@am__append_1 = dpfp
    4185@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@am__append_2 = dpfp_threaded
    4286@HAVE_SIGACTION_TRUE@am__append_3 = sam3u_benchmark
    4387subdir = examples
    44 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
     88DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
     89        $(top_srcdir)/depcomp
    4590ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4691am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
     
    62107dpfp_LDADD = $(LDADD)
    63108dpfp_DEPENDENCIES = ../libusb/libusb-1.0.la
    64 AM_V_lt = $(am__v_lt_$(V))
    65 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
     109AM_V_lt = $(am__v_lt_@AM_V@)
     110am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    66111am__v_lt_0 = --silent
     112am__v_lt_1 =
    67113dpfp_threaded_SOURCES = dpfp_threaded.c
    68114dpfp_threaded_OBJECTS = dpfp_threaded-dpfp_threaded.$(OBJEXT)
     
    72118        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dpfp_threaded_CFLAGS) \
    73119        $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
     120am_fxload_OBJECTS = fxload-ezusb.$(OBJEXT) fxload-fxload.$(OBJEXT)
     121fxload_OBJECTS = $(am_fxload_OBJECTS)
     122fxload_LDADD = $(LDADD)
     123fxload_DEPENDENCIES = ../libusb/libusb-1.0.la
     124fxload_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     125        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(fxload_CFLAGS) $(CFLAGS) \
     126        $(AM_LDFLAGS) $(LDFLAGS) -o $@
    74127hotplugtest_SOURCES = hotplugtest.c
    75128hotplugtest_OBJECTS = hotplugtest.$(OBJEXT)
     
    86139sam3u_benchmark_LDADD = $(LDADD)
    87140sam3u_benchmark_DEPENDENCIES = ../libusb/libusb-1.0.la
    88 testlibusb1_SOURCES = testlibusb1.c
    89 testlibusb1_OBJECTS = testlibusb1.$(OBJEXT)
    90 testlibusb1_LDADD = $(LDADD)
    91 testlibusb1_DEPENDENCIES = ../libusb/libusb-1.0.la
     141testlibusb_SOURCES = testlibusb.c
     142testlibusb_OBJECTS = testlibusb.$(OBJEXT)
     143testlibusb_LDADD = $(LDADD)
     144testlibusb_DEPENDENCIES = ../libusb/libusb-1.0.la
     145xusb_SOURCES = xusb.c
     146xusb_OBJECTS = xusb.$(OBJEXT)
     147xusb_LDADD = $(LDADD)
     148xusb_DEPENDENCIES = ../libusb/libusb-1.0.la
     149AM_V_P = $(am__v_P_@AM_V@)
     150am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     151am__v_P_0 = false
     152am__v_P_1 = :
     153AM_V_GEN = $(am__v_GEN_@AM_V@)
     154am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     155am__v_GEN_0 = @echo "  GEN     " $@;
     156am__v_GEN_1 =
     157AM_V_at = $(am__v_at_@AM_V@)
     158am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     159am__v_at_0 = @
     160am__v_at_1 =
    92161DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    93162depcomp = $(SHELL) $(top_srcdir)/depcomp
     
    100169        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
    101170        $(AM_CFLAGS) $(CFLAGS)
    102 AM_V_CC = $(am__v_CC_$(V))
    103 am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
    104 am__v_CC_0 = @echo "  CC    " $@;
    105 AM_V_at = $(am__v_at_$(V))
    106 am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
    107 am__v_at_0 = @
     171AM_V_CC = $(am__v_CC_@AM_V@)
     172am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
     173am__v_CC_0 = @echo "  CC      " $@;
     174am__v_CC_1 =
    108175CCLD = $(CC)
    109176LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    110177        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    111178        $(AM_LDFLAGS) $(LDFLAGS) -o $@
    112 AM_V_CCLD = $(am__v_CCLD_$(V))
    113 am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
    114 am__v_CCLD_0 = @echo "  CCLD  " $@;
    115 AM_V_GEN = $(am__v_GEN_$(V))
    116 am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
    117 am__v_GEN_0 = @echo "  GEN   " $@;
    118 SOURCES = dpfp.c dpfp_threaded.c hotplugtest.c listdevs.c \
    119         $(sam3u_benchmark_SOURCES) testlibusb1.c
    120 DIST_SOURCES = dpfp.c dpfp_threaded.c hotplugtest.c listdevs.c \
    121         $(am__sam3u_benchmark_SOURCES_DIST) testlibusb1.c
     179AM_V_CCLD = $(am__v_CCLD_@AM_V@)
     180am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
     181am__v_CCLD_0 = @echo "  CCLD    " $@;
     182am__v_CCLD_1 =
     183SOURCES = dpfp.c dpfp_threaded.c $(fxload_SOURCES) hotplugtest.c \
     184        listdevs.c $(sam3u_benchmark_SOURCES) testlibusb.c xusb.c
     185DIST_SOURCES = dpfp.c dpfp_threaded.c $(fxload_SOURCES) hotplugtest.c \
     186        listdevs.c $(am__sam3u_benchmark_SOURCES_DIST) testlibusb.c \
     187        xusb.c
     188am__can_run_installinfo = \
     189  case $$AM_UPDATE_INFO_DIR in \
     190    n|no|NO) false;; \
     191    *) (install-info --version) >/dev/null 2>&1;; \
     192  esac
     193am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     194# Read a list of newline-separated strings from the standard input,
     195# and print each of them once, without duplicates.  Input order is
     196# *not* preserved.
     197am__uniquify_input = $(AWK) '\
     198  BEGIN { nonempty = 0; } \
     199  { items[$$0] = 1; nonempty = 1; } \
     200  END { if (nonempty) { for (i in items) print i; }; } \
     201'
     202# Make sure the list of sources is unique.  This is necessary because,
     203# e.g., the same source file might be shared among _SOURCES variables
     204# for different programs/libraries.
     205am__define_uniq_tagged_files = \
     206  list='$(am__tagged_files)'; \
     207  unique=`for i in $$list; do \
     208    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     209  done | $(am__uniquify_input)`
    122210ETAGS = etags
    123211CTAGS = ctags
     
    137225CPP = @CPP@
    138226CPPFLAGS = @CPPFLAGS@
     227CXX = @CXX@
     228CXXCPP = @CXXCPP@
     229CXXDEPMODE = @CXXDEPMODE@
     230CXXFLAGS = @CXXFLAGS@
    139231CYGPATH_W = @CYGPATH_W@
    140232DEFS = @DEFS@
     
    164256LTLDFLAGS = @LTLDFLAGS@
    165257LTLIBOBJS = @LTLIBOBJS@
    166 MAINT = @MAINT@
    167258MAKEINFO = @MAKEINFO@
    168259MANIFEST_TOOL = @MANIFEST_TOOL@
     
    173264OBJEXT = @OBJEXT@
    174265OS_DARWIN = @OS_DARWIN@
     266OS_HAIKU = @OS_HAIKU@
    175267OS_LINUX = @OS_LINUX@
     268OS_NETBSD = @OS_NETBSD@
    176269OS_OPENBSD = @OS_OPENBSD@
    177 OS_OS2 = @OS_OS2@
     270OS_SUNOS = @OS_SUNOS@
    178271OS_WINDOWS = @OS_WINDOWS@
    179272OTOOL = @OTOOL@
     
    187280PACKAGE_VERSION = @PACKAGE_VERSION@
    188281PATH_SEPARATOR = @PATH_SEPARATOR@
    189 PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
    190282RANLIB = @RANLIB@
    191283RC = @RC@
     
    194286SHELL = @SHELL@
    195287STRIP = @STRIP@
    196 THREAD_CFLAGS = @THREAD_CFLAGS@
    197288USE_UDEV = @USE_UDEV@
     289USE_USBDK = @USE_USBDK@
    198290VERSION = @VERSION@
    199 VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
    200291abs_builddir = @abs_builddir@
    201292abs_srcdir = @abs_srcdir@
     
    204295ac_ct_AR = @ac_ct_AR@
    205296ac_ct_CC = @ac_ct_CC@
     297ac_ct_CXX = @ac_ct_CXX@
    206298ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
    207299am__include = @am__include@
     
    252344AM_CPPFLAGS = -I$(top_srcdir)/libusb
    253345LDADD = ../libusb/libusb-1.0.la
    254 @HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
     346@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@dpfp_threaded_CFLAGS = $(AM_CFLAGS)
    255347@HAVE_SIGACTION_TRUE@sam3u_benchmark_SOURCES = sam3u_benchmark.c
     348fxload_SOURCES = ezusb.c ezusb.h fxload.c
     349fxload_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
    256350all: all-am
    257351
    258352.SUFFIXES:
    259353.SUFFIXES: .c .lo .o .obj
    260 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
     354$(srcdir)/Makefile.in: $(srcdir)/Makefile.am  $(am__configure_deps)
    261355        @for dep in $?; do \
    262356          case '$(am__configure_deps)' in \
     
    283377        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    284378
    285 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
     379$(top_srcdir)/configure: $(am__configure_deps)
    286380        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    287 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
     381$(ACLOCAL_M4): $(am__aclocal_m4_deps)
    288382        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    289383$(am__aclocal_m4_deps):
     
    297391        echo " rm -f" $$list; \
    298392        rm -f $$list
    299 dpfp$(EXEEXT): $(dpfp_OBJECTS) $(dpfp_DEPENDENCIES)
     393
     394dpfp$(EXEEXT): $(dpfp_OBJECTS) $(dpfp_DEPENDENCIES) $(EXTRA_dpfp_DEPENDENCIES)
    300395        @rm -f dpfp$(EXEEXT)
    301396        $(AM_V_CCLD)$(LINK) $(dpfp_OBJECTS) $(dpfp_LDADD) $(LIBS)
    302 dpfp_threaded$(EXEEXT): $(dpfp_threaded_OBJECTS) $(dpfp_threaded_DEPENDENCIES)
     397
     398dpfp_threaded$(EXEEXT): $(dpfp_threaded_OBJECTS) $(dpfp_threaded_DEPENDENCIES) $(EXTRA_dpfp_threaded_DEPENDENCIES)
    303399        @rm -f dpfp_threaded$(EXEEXT)
    304400        $(AM_V_CCLD)$(dpfp_threaded_LINK) $(dpfp_threaded_OBJECTS) $(dpfp_threaded_LDADD) $(LIBS)
    305 hotplugtest$(EXEEXT): $(hotplugtest_OBJECTS) $(hotplugtest_DEPENDENCIES)
     401
     402fxload$(EXEEXT): $(fxload_OBJECTS) $(fxload_DEPENDENCIES) $(EXTRA_fxload_DEPENDENCIES)
     403        @rm -f fxload$(EXEEXT)
     404        $(AM_V_CCLD)$(fxload_LINK) $(fxload_OBJECTS) $(fxload_LDADD) $(LIBS)
     405
     406hotplugtest$(EXEEXT): $(hotplugtest_OBJECTS) $(hotplugtest_DEPENDENCIES) $(EXTRA_hotplugtest_DEPENDENCIES)
    306407        @rm -f hotplugtest$(EXEEXT)
    307408        $(AM_V_CCLD)$(LINK) $(hotplugtest_OBJECTS) $(hotplugtest_LDADD) $(LIBS)
    308 listdevs$(EXEEXT): $(listdevs_OBJECTS) $(listdevs_DEPENDENCIES)
     409
     410listdevs$(EXEEXT): $(listdevs_OBJECTS) $(listdevs_DEPENDENCIES) $(EXTRA_listdevs_DEPENDENCIES)
    309411        @rm -f listdevs$(EXEEXT)
    310412        $(AM_V_CCLD)$(LINK) $(listdevs_OBJECTS) $(listdevs_LDADD) $(LIBS)
    311 sam3u_benchmark$(EXEEXT): $(sam3u_benchmark_OBJECTS) $(sam3u_benchmark_DEPENDENCIES)
     413
     414sam3u_benchmark$(EXEEXT): $(sam3u_benchmark_OBJECTS) $(sam3u_benchmark_DEPENDENCIES) $(EXTRA_sam3u_benchmark_DEPENDENCIES)
    312415        @rm -f sam3u_benchmark$(EXEEXT)
    313416        $(AM_V_CCLD)$(LINK) $(sam3u_benchmark_OBJECTS) $(sam3u_benchmark_LDADD) $(LIBS)
    314 testlibusb1$(EXEEXT): $(testlibusb1_OBJECTS) $(testlibusb1_DEPENDENCIES)
    315         @rm -f testlibusb1$(EXEEXT)
    316         $(AM_V_CCLD)$(LINK) $(testlibusb1_OBJECTS) $(testlibusb1_LDADD) $(LIBS)
     417
     418testlibusb$(EXEEXT): $(testlibusb_OBJECTS) $(testlibusb_DEPENDENCIES) $(EXTRA_testlibusb_DEPENDENCIES)
     419        @rm -f testlibusb$(EXEEXT)
     420        $(AM_V_CCLD)$(LINK) $(testlibusb_OBJECTS) $(testlibusb_LDADD) $(LIBS)
     421
     422xusb$(EXEEXT): $(xusb_OBJECTS) $(xusb_DEPENDENCIES) $(EXTRA_xusb_DEPENDENCIES)
     423        @rm -f xusb$(EXEEXT)
     424        $(AM_V_CCLD)$(LINK) $(xusb_OBJECTS) $(xusb_LDADD) $(LIBS)
    317425
    318426mostlyclean-compile:
     
    324432@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpfp.Po@am__quote@
    325433@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpfp_threaded-dpfp_threaded.Po@am__quote@
     434@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fxload-ezusb.Po@am__quote@
     435@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fxload-fxload.Po@am__quote@
    326436@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hotplugtest.Po@am__quote@
    327437@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listdevs.Po@am__quote@
    328438@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sam3u_benchmark.Po@am__quote@
    329 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlibusb1.Po@am__quote@
     439@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlibusb.Po@am__quote@
     440@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xusb.Po@am__quote@
    330441
    331442.c.o:
    332443@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    333444@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    334 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    335 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    336 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    337 @am__fastdepCC_FALSE@   $(COMPILE) -c $<
     445@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     446@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     447@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
    338448
    339449.c.obj:
    340450@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
    341451@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    342 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    343 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    344 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    345 @am__fastdepCC_FALSE@   $(COMPILE) -c `$(CYGPATH_W) '$<'`
     452@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     453@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     454@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    346455
    347456.c.lo:
    348457@am__fastdepCC_TRUE@    $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    349458@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
    350 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    351 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
    352 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    353 @am__fastdepCC_FALSE@   $(LTCOMPILE) -c -o $@ $<
     459@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
     460@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     461@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
    354462
    355463dpfp_threaded-dpfp_threaded.o: dpfp_threaded.c
    356464@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -MT dpfp_threaded-dpfp_threaded.o -MD -MP -MF $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo -c -o dpfp_threaded-dpfp_threaded.o `test -f 'dpfp_threaded.c' || echo '$(srcdir)/'`dpfp_threaded.c
    357465@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo $(DEPDIR)/dpfp_threaded-dpfp_threaded.Po
    358 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    359 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.o' libtool=no @AMDEPBACKSLASH@
    360 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    361 @am__fastdepCC_FALSE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.o `test -f 'dpfp_threaded.c' || echo '$(srcdir)/'`dpfp_threaded.c
     466@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.o' libtool=no @AMDEPBACKSLASH@
     467@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     468@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.o `test -f 'dpfp_threaded.c' || echo '$(srcdir)/'`dpfp_threaded.c
    362469
    363470dpfp_threaded-dpfp_threaded.obj: dpfp_threaded.c
    364471@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -MT dpfp_threaded-dpfp_threaded.obj -MD -MP -MF $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo -c -o dpfp_threaded-dpfp_threaded.obj `if test -f 'dpfp_threaded.c'; then $(CYGPATH_W) 'dpfp_threaded.c'; else $(CYGPATH_W) '$(srcdir)/dpfp_threaded.c'; fi`
    365472@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo $(DEPDIR)/dpfp_threaded-dpfp_threaded.Po
    366 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    367 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.obj' libtool=no @AMDEPBACKSLASH@
    368 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    369 @am__fastdepCC_FALSE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.obj `if test -f 'dpfp_threaded.c'; then $(CYGPATH_W) 'dpfp_threaded.c'; else $(CYGPATH_W) '$(srcdir)/dpfp_threaded.c'; fi`
     473@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.obj' libtool=no @AMDEPBACKSLASH@
     474@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     475@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.obj `if test -f 'dpfp_threaded.c'; then $(CYGPATH_W) 'dpfp_threaded.c'; else $(CYGPATH_W) '$(srcdir)/dpfp_threaded.c'; fi`
     476
     477fxload-ezusb.o: ezusb.c
     478@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -MT fxload-ezusb.o -MD -MP -MF $(DEPDIR)/fxload-ezusb.Tpo -c -o fxload-ezusb.o `test -f 'ezusb.c' || echo '$(srcdir)/'`ezusb.c
     479@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fxload-ezusb.Tpo $(DEPDIR)/fxload-ezusb.Po
     480@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='ezusb.c' object='fxload-ezusb.o' libtool=no @AMDEPBACKSLASH@
     481@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     482@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -c -o fxload-ezusb.o `test -f 'ezusb.c' || echo '$(srcdir)/'`ezusb.c
     483
     484fxload-ezusb.obj: ezusb.c
     485@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -MT fxload-ezusb.obj -MD -MP -MF $(DEPDIR)/fxload-ezusb.Tpo -c -o fxload-ezusb.obj `if test -f 'ezusb.c'; then $(CYGPATH_W) 'ezusb.c'; else $(CYGPATH_W) '$(srcdir)/ezusb.c'; fi`
     486@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fxload-ezusb.Tpo $(DEPDIR)/fxload-ezusb.Po
     487@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='ezusb.c' object='fxload-ezusb.obj' libtool=no @AMDEPBACKSLASH@
     488@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     489@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -c -o fxload-ezusb.obj `if test -f 'ezusb.c'; then $(CYGPATH_W) 'ezusb.c'; else $(CYGPATH_W) '$(srcdir)/ezusb.c'; fi`
     490
     491fxload-fxload.o: fxload.c
     492@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -MT fxload-fxload.o -MD -MP -MF $(DEPDIR)/fxload-fxload.Tpo -c -o fxload-fxload.o `test -f 'fxload.c' || echo '$(srcdir)/'`fxload.c
     493@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fxload-fxload.Tpo $(DEPDIR)/fxload-fxload.Po
     494@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='fxload.c' object='fxload-fxload.o' libtool=no @AMDEPBACKSLASH@
     495@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     496@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -c -o fxload-fxload.o `test -f 'fxload.c' || echo '$(srcdir)/'`fxload.c
     497
     498fxload-fxload.obj: fxload.c
     499@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -MT fxload-fxload.obj -MD -MP -MF $(DEPDIR)/fxload-fxload.Tpo -c -o fxload-fxload.obj `if test -f 'fxload.c'; then $(CYGPATH_W) 'fxload.c'; else $(CYGPATH_W) '$(srcdir)/fxload.c'; fi`
     500@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fxload-fxload.Tpo $(DEPDIR)/fxload-fxload.Po
     501@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='fxload.c' object='fxload-fxload.obj' libtool=no @AMDEPBACKSLASH@
     502@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     503@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fxload_CFLAGS) $(CFLAGS) -c -o fxload-fxload.obj `if test -f 'fxload.c'; then $(CYGPATH_W) 'fxload.c'; else $(CYGPATH_W) '$(srcdir)/fxload.c'; fi`
    370504
    371505mostlyclean-libtool:
     
    375509        -rm -rf .libs _libs
    376510
    377 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    378         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    379         unique=`for i in $$list; do \
    380             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    381           done | \
    382           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    383               END { if (nonempty) { for (i in files) print i; }; }'`; \
    384         mkid -fID $$unique
    385 tags: TAGS
    386 
    387 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    388                 $(TAGS_FILES) $(LISP)
     511ID: $(am__tagged_files)
     512        $(am__define_uniq_tagged_files); mkid -fID $$unique
     513tags: tags-am
     514TAGS: tags
     515
     516tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    389517        set x; \
    390518        here=`pwd`; \
    391         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    392         unique=`for i in $$list; do \
    393             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    394           done | \
    395           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    396               END { if (nonempty) { for (i in files) print i; }; }'`; \
     519        $(am__define_uniq_tagged_files); \
    397520        shift; \
    398521        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    406529          fi; \
    407530        fi
    408 ctags: CTAGS
    409 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    410                 $(TAGS_FILES) $(LISP)
    411         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    412         unique=`for i in $$list; do \
    413             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    414           done | \
    415           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    416               END { if (nonempty) { for (i in files) print i; }; }'`; \
     531ctags: ctags-am
     532
     533CTAGS: ctags
     534ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     535        $(am__define_uniq_tagged_files); \
    417536        test -z "$(CTAGS_ARGS)$$unique" \
    418537          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    423542          && $(am__cd) $(top_srcdir) \
    424543          && gtags -i $(GTAGS_ARGS) "$$here"
     544cscopelist: cscopelist-am
     545
     546cscopelist-am: $(am__tagged_files)
     547        list='$(am__tagged_files)'; \
     548        case "$(srcdir)" in \
     549          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     550          *) sdir=$(subdir)/$(srcdir) ;; \
     551        esac; \
     552        for i in $$list; do \
     553          if test -f "$$i"; then \
     554            echo "$(subdir)/$$i"; \
     555          else \
     556            echo "$$sdir/$$i"; \
     557          fi; \
     558        done >> $(top_builddir)/cscope.files
    425559
    426560distclean-tags:
     
    471605installcheck: installcheck-am
    472606install-strip:
    473         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
    474           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
    475           `test -z '$(STRIP)' || \
    476             echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
     607        if test -z '$(STRIP)'; then \
     608          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     609            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     610              install; \
     611        else \
     612          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     613            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     614            "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
     615        fi
    477616mostlyclean-generic:
    478617
     
    559698.MAKE: install-am install-strip
    560699
    561 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
    562         clean-libtool clean-noinstPROGRAMS ctags distclean \
    563         distclean-compile distclean-generic distclean-libtool \
    564         distclean-tags distdir dvi dvi-am html html-am info info-am \
    565         install install-am install-data install-data-am install-dvi \
    566         install-dvi-am install-exec install-exec-am install-html \
    567         install-html-am install-info install-info-am install-man \
    568         install-pdf install-pdf-am install-ps install-ps-am \
    569         install-strip installcheck installcheck-am installdirs \
    570         maintainer-clean maintainer-clean-generic mostlyclean \
    571         mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
    572         pdf pdf-am ps ps-am tags uninstall uninstall-am
     700.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
     701        clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
     702        ctags-am distclean distclean-compile distclean-generic \
     703        distclean-libtool distclean-tags distdir dvi dvi-am html \
     704        html-am info info-am install install-am install-data \
     705        install-data-am install-dvi install-dvi-am install-exec \
     706        install-exec-am install-html install-html-am install-info \
     707        install-info-am install-man install-pdf install-pdf-am \
     708        install-ps install-ps-am install-strip installcheck \
     709        installcheck-am installdirs maintainer-clean \
     710        maintainer-clean-generic mostlyclean mostlyclean-compile \
     711        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
     712        tags tags-am uninstall uninstall-am
    573713
    574714
  • TabularUnified libusb1/trunk/examples/dpfp.c

    r1876 r1882  
    11/*
    22 * libusb example program to manipulate U.are.U 4000B fingerprint scanner.
    3  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
     3 * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
    44 *
    55 * Basic image capture program only, does not consider the powerup quirks or
     
    2828#include <stdlib.h>
    2929
    30 #include <libusb.h>
     30#include "libusb.h"
    3131
    3232#define EP_INTR                 (1 | LIBUSB_ENDPOINT_IN)
     
    165165static int set_mode_async(unsigned char data)
    166166{
    167         unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
     167        unsigned char *buf = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
    168168        struct libusb_transfer *transfer;
    169169
     
    505505        return r >= 0 ? r : -r;
    506506}
    507 
  • TabularUnified libusb1/trunk/examples/dpfp_threaded.c

    r1876 r1882  
    11/*
    22 * libusb example program to manipulate U.are.U 4000B fingerprint scanner.
    3  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
     3 * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
     4 * Copyright © 2016 Nathan Hjelm <hjelmn@mac.com>
    45 *
    56 * Basic image capture program only, does not consider the powerup quirks or
     
    2425#include <errno.h>
    2526#include <pthread.h>
     27#include <semaphore.h>
    2628#include <signal.h>
    2729#include <string.h>
    2830#include <stdio.h>
    2931#include <stdlib.h>
    30 
    31 #include <libusb.h>
     32#include <fcntl.h>
     33
     34#include "libusb.h"
    3235
    3336#define EP_INTR                 (1 | LIBUSB_ENDPOINT_IN)
     
    3740#define USB_RQ                  0x04
    3841#define INTR_LENGTH             64
     42#define SEM_NAME                "/org.libusb.example.dpfp_threaded"
    3943
    4044enum {
     
    6569static struct libusb_transfer *irq_transfer = NULL;
    6670static int img_idx = 0;
    67 static int do_exit = 0;
     71static volatile sig_atomic_t do_exit = 0;
    6872
    6973static pthread_t poll_thread;
    70 static pthread_cond_t exit_cond = PTHREAD_COND_INITIALIZER;
    71 static pthread_mutex_t exit_cond_lock = PTHREAD_MUTEX_INITIALIZER;
    72 
    73 static void request_exit(int code)
     74static sem_t *exit_sem;
     75
     76static void request_exit(sig_atomic_t code)
    7477{
    7578        do_exit = code;
    76         pthread_cond_signal(&exit_cond);
     79        sem_post(exit_sem);
    7780}
    7881
     
    194197static int set_mode_async(unsigned char data)
    195198{
    196         unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
     199        unsigned char *buf = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
    197200        struct libusb_transfer *transfer;
    198201
     
    447450        int r = 1;
    448451
     452        exit_sem = sem_open (SEM_NAME, O_CREAT, 0);
     453        if (!exit_sem) {
     454                fprintf(stderr, "failed to initialise semaphore error %d", errno);
     455                exit(1);
     456        }
     457
     458        /* only using this semaphore in this process so go ahead and unlink it now */
     459        sem_unlink (SEM_NAME);
     460
    449461        r = libusb_init(NULL);
    450462        if (r < 0) {
     
    501513        }
    502514
    503         while (!do_exit) {
    504                 pthread_mutex_lock(&exit_cond_lock);
    505                 pthread_cond_wait(&exit_cond, &exit_cond_lock);
    506                 pthread_mutex_unlock(&exit_cond_lock);
    507         }
     515        while (!do_exit)
     516                sem_wait(exit_sem);
    508517
    509518        printf("shutting down...\n");
     
    543552        return r >= 0 ? r : -r;
    544553}
    545 
  • TabularUnified libusb1/trunk/examples/hotplugtest.c

    r1876 r1882  
     1/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
    12/*
    23 * libusb example program for hotplug API
    3  * Copyright (C) 2012-2013 Nathan Hjelm <hjelmn@mac.ccom>
     4 * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2021#include <stdlib.h>
    2122#include <stdio.h>
    22 #include <sched.h>
    23 #include <unistd.h>
    2423
    25 #include <libusb.h>
     24#include "libusb.h"
    2625
    2726int done = 0;
    28 libusb_device_handle *handle;
     27libusb_device_handle *handle = NULL;
    2928
    30 int hotplug_callback (libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data) {
    31   struct libusb_device_descriptor desc;
    32   int rc;
     29static int LIBUSB_CALL hotplug_callback(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data)
     30{
     31        struct libusb_device_descriptor desc;
     32        int rc;
    3333
    34   rc = libusb_get_device_descriptor(dev, &desc);
    35   if (LIBUSB_SUCCESS != rc) {
    36     fprintf (stderr, "Error getting device descriptor\n");
    37   }
     34        rc = libusb_get_device_descriptor(dev, &desc);
     35        if (LIBUSB_SUCCESS != rc) {
     36                fprintf (stderr, "Error getting device descriptor\n");
     37        }
    3838
    39   printf ("Device attach: %04x:%04x\n", desc.idVendor, desc.idProduct);
     39        printf ("Device attached: %04x:%04x\n", desc.idVendor, desc.idProduct);
    4040
    41   libusb_open (dev, &handle);
     41        if (handle) {
     42                libusb_close (handle);
     43                handle = NULL;
     44        }
    4245
    43   done++;
     46        rc = libusb_open (dev, &handle);
     47        if (LIBUSB_SUCCESS != rc) {
     48                fprintf (stderr, "Error opening device\n");
     49        }
    4450
    45   return 0;
     51        done++;
     52
     53        return 0;
    4654}
    4755
    48 int hotplug_callback_detach (libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data) {
    49   printf ("Device detached\n");
     56static int LIBUSB_CALL hotplug_callback_detach(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data)
     57{
     58        printf ("Device detached\n");
    5059
    51   libusb_close (handle);
     60        if (handle) {
     61                libusb_close (handle);
     62                handle = NULL;
     63        }
    5264
    53   done++;
    54   return 0;
     65        done++;
     66
     67        return 0;
    5568}
    5669
    57 int main (int argc, char *argv[]) {
    58   libusb_hotplug_callback_handle hp[2];
    59   int product_id, vendor_id, class_id;
    60   int rc;
     70int main(int argc, char *argv[])
     71{
     72        libusb_hotplug_callback_handle hp[2];
     73        int product_id, vendor_id, class_id;
     74        int rc;
    6175
    62   vendor_id  = (argc > 1) ? strtol (argv[1], NULL, 0) : 0x045a;
    63   product_id = (argc > 2) ? strtol (argv[2], NULL, 0) : 0x5005;
    64   class_id   = (argc > 3) ? strtol (argv[3], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
     76        vendor_id  = (argc > 1) ? (int)strtol (argv[1], NULL, 0) : 0x045a;
     77        product_id = (argc > 2) ? (int)strtol (argv[2], NULL, 0) : 0x5005;
     78        class_id   = (argc > 3) ? (int)strtol (argv[3], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
    6579
    66   libusb_init (NULL);
     80        rc = libusb_init (NULL);
     81        if (rc < 0)
     82        {
     83                printf("failed to initialise libusb: %s\n", libusb_error_name(rc));
     84                return EXIT_FAILURE;
     85        }
    6786
    68   if (!libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)) {
    69     printf ("Hotplug not supported by this build of libusb\n");
    70     libusb_exit (NULL);
    71     return EXIT_FAILURE;
    72   }
     87        if (!libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)) {
     88                printf ("Hotplug capabilites are not supported on this platform\n");
     89                libusb_exit (NULL);
     90                return EXIT_FAILURE;
     91        }
    7392
    74   rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, 0, vendor_id,
    75                                          product_id, class_id, hotplug_callback, NULL, &hp[0]);
    76   if (LIBUSB_SUCCESS != rc) {
    77     fprintf (stderr, "Error registering callback 0\n");
    78     libusb_exit (NULL);
    79     return EXIT_FAILURE;
    80   }
     93        rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, 0, vendor_id,
     94                product_id, class_id, hotplug_callback, NULL, &hp[0]);
     95        if (LIBUSB_SUCCESS != rc) {
     96                fprintf (stderr, "Error registering callback 0\n");
     97                libusb_exit (NULL);
     98                return EXIT_FAILURE;
     99        }
    81100
    82   rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, vendor_id,
    83                                          product_id,class_id, hotplug_callback_detach, NULL, &hp[1]);
    84   if (LIBUSB_SUCCESS != rc) {
    85     fprintf (stderr, "Error registering callback 1\n");
    86     libusb_exit (NULL);
    87     return EXIT_FAILURE;
    88   }
     101        rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, vendor_id,
     102                product_id,class_id, hotplug_callback_detach, NULL, &hp[1]);
     103        if (LIBUSB_SUCCESS != rc) {
     104                fprintf (stderr, "Error registering callback 1\n");
     105                libusb_exit (NULL);
     106                return EXIT_FAILURE;
     107        }
    89108
    90   while (done < 2) {
    91     libusb_handle_events (NULL);
    92   }
     109        while (done < 2) {
     110                rc = libusb_handle_events (NULL);
     111                if (rc < 0)
     112                        printf("libusb_handle_events() failed: %s\n", libusb_error_name(rc));
     113        }
    93114
    94   libusb_exit (NULL);
     115        if (handle) {
     116                libusb_close (handle);
     117        }
     118
     119        libusb_exit (NULL);
     120
     121        return EXIT_SUCCESS;
    95122}
  • TabularUnified libusb1/trunk/examples/listdevs.c

    r1876 r1882  
    11/*
    22 * libusb example program to list devices on the bus
    3  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
     3 * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
    44 *
    55 * This library is free software; you can redistribute it and/or
     
    1919
    2020#include <stdio.h>
    21 #include <sys/types.h>
    2221
    23 #include <libusb.h>
     22#include "libusb.h"
    2423
    2524static void print_devs(libusb_device **devs)
    2625{
    2726        libusb_device *dev;
    28         int i = 0;
     27        int i = 0, j = 0;
     28        uint8_t path[8];
    2929
    3030        while ((dev = devs[i++]) != NULL) {
     
    3636                }
    3737
    38                 printf("%04x:%04x (bus %d, device %d)\n",
     38                printf("%04x:%04x (bus %d, device %d)",
    3939                        desc.idVendor, desc.idProduct,
    4040                        libusb_get_bus_number(dev), libusb_get_device_address(dev));
     41
     42                r = libusb_get_port_numbers(dev, path, sizeof(path));
     43                if (r > 0) {
     44                        printf(" path: %d", path[0]);
     45                        for (j = 1; j < r; j++)
     46                                printf(".%d", path[j]);
     47                }
     48                printf("\n");
    4149        }
    4250}
     
    6270        return 0;
    6371}
    64 
  • TabularUnified libusb1/trunk/examples/sam3u_benchmark.c

    r1876 r1882  
    4141static struct timeval tv_start;
    4242
    43 static void cb_xfr(struct libusb_transfer *xfr)
     43static void LIBUSB_CALL cb_xfr(struct libusb_transfer *xfr)
    4444{
    45         unsigned int i;
     45        int i;
    4646
    4747        if (xfr->status != LIBUSB_TRANSFER_COMPLETED) {
  • TabularUnified libusb1/trunk/libusb-1.0.pc.in

    r1876 r1882  
    55
    66Name: libusb-1.0
    7 Description: C API for USB device access from Linux, Mac OS X, OpenBSD, NetBSD and Windows userspace
     7Description: C API for USB device access from Linux, Mac OS X, Windows, OpenBSD/NetBSD and Solaris userspace
    88Version: @VERSION@
    99Libs: -L${libdir} -lusb-1.0
    10 Libs.private: @PC_LIBS_PRIVATE@
     10Libs.private: @LIBS@
    1111Cflags: -I${includedir}/libusb-1.0
    12 
  • TabularUnified libusb1/trunk/libusb/Makefile.am

    r1879 r1882  
     1all: libusb-1.0.la libusb-1.0.dll
     2
     3AUTOMAKE_OPTIONS = subdir-objects
     4
    15lib_LTLIBRARIES = libusb-1.0.la
    26
    3 LINUX_USBFS_SRC = os/linux_usbfs.c
    4 DARWIN_USB_SRC = os/darwin_usb.c
     7POSIX_POLL_SRC = os/poll_posix.h os/poll_posix.c
     8POSIX_THREADS_SRC = os/threads_posix.h os/threads_posix.c
     9WINDOWS_POLL_SRC = os/poll_windows.h os/poll_windows.c
     10WINDOWS_THREADS_SRC = os/threads_windows.h os/threads_windows.c
     11LINUX_USBFS_SRC = os/linux_usbfs.h os/linux_usbfs.c
     12DARWIN_USB_SRC = os/darwin_usb.h os/darwin_usb.c
    513OPENBSD_USB_SRC = os/openbsd_usb.c
    614OS2_USB_SRC = os/poll_os2.c os/os2_usb.c
    7 WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
    8         libusb-1.0.def
     15NETBSD_USB_SRC = os/netbsd_usb.c
     16SUNOS_USB_SRC = os/sunos_usb.c os/sunos_usb.h
     17WINDOWS_COMMON_SRC = os/windows_nt_common.h os/windows_nt_common.c \
     18                     os/windows_common.h libusb-1.0.rc libusb-1.0.def
     19WINDOWS_USB_SRC = os/windows_winusb.h os/windows_winusb.c
     20WINDOWS_USBDK_SRC = os/windows_usbdk.h os/windows_usbdk.c
     21WINCE_USB_SRC = os/wince_usb.h os/wince_usb.c
     22HAIKU_USB_SRC = os/haiku_usb.h os/haiku_usb_backend.cpp \
     23                os/haiku_usb_raw.h os/haiku_usb_raw.cpp os/haiku_pollfs.cpp
    924
    10 EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
    11         $(WINDOWS_USB_SRC) os/threads_posix.c os/threads_windows.c \
     25EXTRA_DIST = $(POSIX_POLL_SRC) $(POSIX_THREADS_SRC) \
     26        $(WINDOWS_POLL_SRC) $(WINDOWS_THREADS_SRC) \
     27        $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) \
     28        $(OPENBSD_USB_SRC) $(NETBSD_USB_SRC) \
     29        $(WINDOWS_COMMON_SRC) $(WINDOWS_USB_SRC) $(WINDOWS_USBDK_SRC) \
     30        $(WINCE_USB_SRC) $(HAIKU_USB_SRC) \
    1231        os/linux_udev.c os/linux_netlink.c
    1332
     
    3554endif
    3655
     56if OS_NETBSD
     57OS_SRC = $(NETBSD_USB_SRC)
     58endif
     59
     60if OS_SUNOS
     61OS_SRC = $(SUNOS_USB_SRC)
     62endif
     63
     64if OS_HAIKU
     65noinst_LTLIBRARIES = libusb_haiku.la
     66libusb_haiku_la_SOURCES = $(HAIKU_USB_SRC)
     67libusb_1_0_la_LIBADD = libusb_haiku.la
     68endif
     69
    3770if OS_WINDOWS
    38 OS_SRC = $(WINDOWS_USB_SRC)
     71
     72if USE_USBDK
     73OS_SRC = $(WINDOWS_USBDK_SRC) $(WINDOWS_COMMON_SRC)
     74else
     75OS_SRC = $(WINDOWS_USB_SRC) $(WINDOWS_COMMON_SRC)
     76endif
    3977
    4078.rc.lo:
    4179        $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
    4280
    43 libusb-1.0.rc: version.h
     81libusb-1.0.rc: version.h version_nano.h
     82endif
     83
     84libusb-1.0.dll: libusb-1.0.def libusb-1.0.la
     85if CREATE_IMPORT_LIB
     86# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
     87        $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
     88endif
     89
     90if OS_WINDOWS
     91POLL_SRC = $(WINDOWS_POLL_SRC)
     92else
     93POLL_SRC = $(POSIX_POLL_SRC)
    4494endif
    4595
    4696if THREADS_POSIX
    47 THREADS_SRC = os/threads_posix.h os/threads_posix.c
     97THREADS_SRC = $(POSIX_THREADS_SRC)
    4898else
    49 THREADS_SRC = os/threads_windows.h os/threads_windows.c
     99THREADS_SRC = $(WINDOWS_THREADS_SRC)
    50100endif
    51101
    52 libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) $(THREAD_CFLAGS) \
    53         -DLIBUSB_DESCRIBE=\"`git --git-dir "$(top_srcdir)/.git" describe --tags 2>/dev/null`\"
     102libusb_1_0_la_CFLAGS = $(AM_CFLAGS)
    54103libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
    55 libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \
    56         hotplug.h hotplug.c os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \
    57         $(THREADS_SRC) os/poll_posix.h os/poll_windows.h
     104libusb_1_0_la_SOURCES = libusbi.h libusb.h version.h version_nano.h \
     105        core.c descriptor.c hotplug.h hotplug.c io.c strerror.c sync.c \
     106        $(POLL_SRC) $(THREADS_SRC) $(OS_SRC)
    58107
    59108hdrdir = $(includedir)/libusb-1.0
  • TabularUnified libusb1/trunk/libusb/Makefile.in

    r1879 r1882  
    1 # Makefile.in generated by automake 1.11.1 from Makefile.am.
     1# Makefile.in generated by automake 1.14.1 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
    6 # Inc.
     4# Copyright (C) 1994-2013 Free Software Foundation, Inc.
     5
    76# This Makefile.in is free software; the Free Software Foundation
    87# gives unlimited permission to copy and/or distribute it,
     
    1615@SET_MAKE@
    1716
    18 OS2_LA_NAME=usb-1.0
    19 OS2_DLL_NAME=libusb10
    20 OS2_DLL_OBJ=$(libusb_1_0_la_OBJECTS:%.lo=%.o)
    21 OS2_DLL_LIBS=-lpthread -lusbcalls
    2217
    2318VPATH = @srcdir@
     19am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
     20am__make_running_with_option = \
     21  case $${target_option-} in \
     22      ?) ;; \
     23      *) echo "am__make_running_with_option: internal error: invalid" \
     24              "target option '$${target_option-}' specified" >&2; \
     25         exit 1;; \
     26  esac; \
     27  has_opt=no; \
     28  sane_makeflags=$$MAKEFLAGS; \
     29  if $(am__is_gnu_make); then \
     30    sane_makeflags=$$MFLAGS; \
     31  else \
     32    case $$MAKEFLAGS in \
     33      *\\[\ \   ]*) \
     34        bs=\\; \
     35        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
     36          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
     37    esac; \
     38  fi; \
     39  skip_next=no; \
     40  strip_trailopt () \
     41  { \
     42    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
     43  }; \
     44  for flg in $$sane_makeflags; do \
     45    test $$skip_next = yes && { skip_next=no; continue; }; \
     46    case $$flg in \
     47      *=*|--*) continue;; \
     48        -*I) strip_trailopt 'I'; skip_next=yes;; \
     49      -*I?*) strip_trailopt 'I';; \
     50        -*O) strip_trailopt 'O'; skip_next=yes;; \
     51      -*O?*) strip_trailopt 'O';; \
     52        -*l) strip_trailopt 'l'; skip_next=yes;; \
     53      -*l?*) strip_trailopt 'l';; \
     54      -[dEDm]) skip_next=yes;; \
     55      -[JT]) skip_next=yes;; \
     56    esac; \
     57    case $$flg in \
     58      *$$target_option*) has_opt=yes; break;; \
     59    esac; \
     60  done; \
     61  test $$has_opt = yes
     62am__make_dryrun = (target_option=n; $(am__make_running_with_option))
     63am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    2464pkgdatadir = $(datadir)/@PACKAGE@
    2565pkgincludedir = $(includedir)/@PACKAGE@
     
    4181host_triplet = @host@
    4282subdir = libusb
    43 DIST_COMMON = $(hdr_HEADERS) $(srcdir)/Makefile.am \
    44         $(srcdir)/Makefile.in
     83DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
     84        $(top_srcdir)/depcomp $(hdr_HEADERS)
    4585ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4686am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
     
    75115  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
    76116  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
     117am__uninstall_files_from_dir = { \
     118  test -z "$$files" \
     119    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
     120    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
     121         $(am__cd) "$$dir" && rm -f $$files; }; \
     122  }
    77123am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"
    78 LTLIBRARIES = $(lib_LTLIBRARIES)
    79 libusb_1_0_la_LIBADD =
    80 am__libusb_1_0_la_SOURCES_DIST = libusbi.h core.c descriptor.c io.c \
    81         sync.c os/darwin_usb.c os/linux_usbfs.c os/linux_netlink.c \
    82         os/linux_udev.c os/openbsd_usb.c os/poll_os2.c os/os2_usb.c \
    83         os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
    84         libusb-1.0.def hotplug.h hotplug.c os/linux_usbfs.h \
    85         os/darwin_usb.h os/windows_usb.h os/threads_windows.h \
     124LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
     125@OS_HAIKU_TRUE@libusb_1_0_la_DEPENDENCIES = libusb_haiku.la
     126am__libusb_1_0_la_SOURCES_DIST = libusbi.h libusb.h version.h \
     127        version_nano.h core.c descriptor.c hotplug.h hotplug.c io.c \
     128        strerror.c sync.c os/poll_posix.h os/poll_posix.c \
     129        os/poll_windows.h os/poll_windows.c os/threads_windows.h \
    86130        os/threads_windows.c os/threads_posix.h os/threads_posix.c \
    87         os/poll_posix.h os/poll_windows.h
    88 am__objects_1 = libusb_1_0_la-darwin_usb.lo
    89 am__objects_2 = libusb_1_0_la-linux_usbfs.lo
    90 am__objects_3 = libusb_1_0_la-openbsd_usb.lo
    91 am__objects_4 = libusb_1_0_la-poll_os2.lo libusb_1_0_la-os2_usb.lo
    92 am__objects_5 = libusb_1_0_la-poll_windows.lo \
    93         libusb_1_0_la-windows_usb.lo libusb-1.0.lo
    94 @OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_FALSE@@OS_OS2_FALSE@@OS_WINDOWS_TRUE@am__objects_6 = $(am__objects_5)
    95 @OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_FALSE@@OS_OS2_TRUE@am__objects_6 = $(am__objects_4)
    96 @OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_TRUE@am__objects_6 = $(am__objects_3)
    97 @OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_FALSE@am__objects_6 = $(am__objects_2) \
    98 @OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_FALSE@        libusb_1_0_la-linux_netlink.lo
    99 @OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_TRUE@am__objects_6 = $(am__objects_2) \
    100 @OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_TRUE@ libusb_1_0_la-linux_udev.lo
    101 @OS_DARWIN_TRUE@am__objects_6 = $(am__objects_1)
    102 @THREADS_POSIX_FALSE@am__objects_7 = libusb_1_0_la-threads_windows.lo
    103 @THREADS_POSIX_TRUE@am__objects_7 = libusb_1_0_la-threads_posix.lo
     131        os/darwin_usb.h os/darwin_usb.c os/linux_usbfs.h \
     132        os/linux_usbfs.c os/linux_netlink.c os/linux_udev.c \
     133        os/netbsd_usb.c os/openbsd_usb.c os/sunos_usb.c os/sunos_usb.h \
     134        os/windows_winusb.h os/windows_winusb.c os/windows_nt_common.h \
     135        os/windows_nt_common.c os/windows_common.h libusb-1.0.rc \
     136        libusb-1.0.def os/windows_usbdk.h os/windows_usbdk.c
     137am__dirstamp = $(am__leading_dot)dirstamp
     138am__objects_1 = os/libusb_1_0_la-poll_posix.lo
     139am__objects_2 = os/libusb_1_0_la-poll_windows.lo
     140@OS_WINDOWS_FALSE@am__objects_3 = $(am__objects_1)
     141@OS_WINDOWS_TRUE@am__objects_3 = $(am__objects_2)
     142am__objects_4 = os/libusb_1_0_la-threads_windows.lo
     143am__objects_5 = os/libusb_1_0_la-threads_posix.lo
     144@THREADS_POSIX_FALSE@am__objects_6 = $(am__objects_4)
     145@THREADS_POSIX_TRUE@am__objects_6 = $(am__objects_5)
     146am__objects_7 = os/libusb_1_0_la-darwin_usb.lo
     147am__objects_8 = os/libusb_1_0_la-linux_usbfs.lo
     148am__objects_9 = os/libusb_1_0_la-netbsd_usb.lo
     149am__objects_10 = os/libusb_1_0_la-openbsd_usb.lo
     150am__objects_11 = os/libusb_1_0_la-sunos_usb.lo
     151am__objects_12 = os/libusb_1_0_la-windows_winusb.lo
     152am__objects_13 = os/libusb_1_0_la-windows_nt_common.lo libusb-1.0.lo
     153am__objects_14 = os/libusb_1_0_la-windows_usbdk.lo
     154@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_NETBSD_FALSE@@OS_OPENBSD_FALSE@@OS_SUNOS_FALSE@@OS_WINDOWS_TRUE@@USE_USBDK_FALSE@am__objects_15 = $(am__objects_12) \
     155@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_NETBSD_FALSE@@OS_OPENBSD_FALSE@@OS_SUNOS_FALSE@@OS_WINDOWS_TRUE@@USE_USBDK_FALSE@  $(am__objects_13)
     156@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_NETBSD_FALSE@@OS_OPENBSD_FALSE@@OS_SUNOS_FALSE@@OS_WINDOWS_TRUE@@USE_USBDK_TRUE@am__objects_15 = $(am__objects_14) \
     157@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_NETBSD_FALSE@@OS_OPENBSD_FALSE@@OS_SUNOS_FALSE@@OS_WINDOWS_TRUE@@USE_USBDK_TRUE@   $(am__objects_13)
     158@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_NETBSD_FALSE@@OS_OPENBSD_FALSE@@OS_SUNOS_TRUE@am__objects_15 = $(am__objects_11)
     159@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_NETBSD_FALSE@@OS_OPENBSD_TRUE@am__objects_15 = $(am__objects_10)
     160@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_NETBSD_TRUE@am__objects_15 = $(am__objects_9)
     161@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_FALSE@am__objects_15 = $(am__objects_8) \
     162@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_FALSE@        os/libusb_1_0_la-linux_netlink.lo
     163@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_TRUE@am__objects_15 = $(am__objects_8) \
     164@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_TRUE@ os/libusb_1_0_la-linux_udev.lo
     165@OS_DARWIN_TRUE@am__objects_15 = $(am__objects_7)
    104166am_libusb_1_0_la_OBJECTS = libusb_1_0_la-core.lo \
    105         libusb_1_0_la-descriptor.lo libusb_1_0_la-io.lo \
    106         libusb_1_0_la-sync.lo $(am__objects_6) \
    107         libusb_1_0_la-hotplug.lo $(am__objects_7)
     167        libusb_1_0_la-descriptor.lo libusb_1_0_la-hotplug.lo \
     168        libusb_1_0_la-io.lo libusb_1_0_la-strerror.lo \
     169        libusb_1_0_la-sync.lo $(am__objects_3) $(am__objects_6) \
     170        $(am__objects_15)
    108171libusb_1_0_la_OBJECTS = $(am_libusb_1_0_la_OBJECTS)
    109 AM_V_lt = $(am__v_lt_$(V))
    110 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
     172AM_V_lt = $(am__v_lt_@AM_V@)
     173am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    111174am__v_lt_0 = --silent
     175am__v_lt_1 =
    112176libusb_1_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    113177        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libusb_1_0_la_CFLAGS) \
    114178        $(CFLAGS) $(libusb_1_0_la_LDFLAGS) $(LDFLAGS) -o $@
     179libusb_haiku_la_LIBADD =
     180am__libusb_haiku_la_SOURCES_DIST = os/haiku_usb.h \
     181        os/haiku_usb_backend.cpp os/haiku_usb_raw.h \
     182        os/haiku_usb_raw.cpp os/haiku_pollfs.cpp
     183am__objects_16 = os/haiku_usb_backend.lo os/haiku_usb_raw.lo \
     184        os/haiku_pollfs.lo
     185@OS_HAIKU_TRUE@am_libusb_haiku_la_OBJECTS = $(am__objects_16)
     186libusb_haiku_la_OBJECTS = $(am_libusb_haiku_la_OBJECTS)
     187@OS_HAIKU_TRUE@am_libusb_haiku_la_rpath =
     188AM_V_P = $(am__v_P_@AM_V@)
     189am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     190am__v_P_0 = false
     191am__v_P_1 = :
     192AM_V_GEN = $(am__v_GEN_@AM_V@)
     193am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     194am__v_GEN_0 = @echo "  GEN     " $@;
     195am__v_GEN_1 =
     196AM_V_at = $(am__v_at_@AM_V@)
     197am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     198am__v_at_0 = @
     199am__v_at_1 =
    115200DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    116201depcomp = $(SHELL) $(top_srcdir)/depcomp
     
    123208        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
    124209        $(AM_CFLAGS) $(CFLAGS)
    125 AM_V_CC = $(am__v_CC_$(V))
    126 am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
    127 am__v_CC_0 = @echo "  CC    " $@;
    128 AM_V_at = $(am__v_at_$(V))
    129 am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
    130 am__v_at_0 = @
     210AM_V_CC = $(am__v_CC_@AM_V@)
     211am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
     212am__v_CC_0 = @echo "  CC      " $@;
     213am__v_CC_1 =
    131214CCLD = $(CC)
    132215LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    133216        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    134217        $(AM_LDFLAGS) $(LDFLAGS) -o $@
    135 AM_V_CCLD = $(am__v_CCLD_$(V))
    136 am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
    137 am__v_CCLD_0 = @echo "  CCLD  " $@;
    138 AM_V_GEN = $(am__v_GEN_$(V))
    139 am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
    140 am__v_GEN_0 = @echo "  GEN   " $@;
    141 SOURCES = $(libusb_1_0_la_SOURCES)
    142 DIST_SOURCES = $(am__libusb_1_0_la_SOURCES_DIST)
     218AM_V_CCLD = $(am__v_CCLD_@AM_V@)
     219am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
     220am__v_CCLD_0 = @echo "  CCLD    " $@;
     221am__v_CCLD_1 =
     222CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
     223        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     224LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
     225        $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
     226        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
     227        $(AM_CXXFLAGS) $(CXXFLAGS)
     228AM_V_CXX = $(am__v_CXX_@AM_V@)
     229am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
     230am__v_CXX_0 = @echo "  CXX     " $@;
     231am__v_CXX_1 =
     232CXXLD = $(CXX)
     233CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
     234        $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
     235        $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
     236AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
     237am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
     238am__v_CXXLD_0 = @echo "  CXXLD   " $@;
     239am__v_CXXLD_1 =
     240SOURCES = $(libusb_1_0_la_SOURCES) $(libusb_haiku_la_SOURCES)
     241DIST_SOURCES = $(am__libusb_1_0_la_SOURCES_DIST) \
     242        $(am__libusb_haiku_la_SOURCES_DIST)
     243am__can_run_installinfo = \
     244  case $$AM_UPDATE_INFO_DIR in \
     245    n|no|NO) false;; \
     246    *) (install-info --version) >/dev/null 2>&1;; \
     247  esac
    143248HEADERS = $(hdr_HEADERS)
     249am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     250# Read a list of newline-separated strings from the standard input,
     251# and print each of them once, without duplicates.  Input order is
     252# *not* preserved.
     253am__uniquify_input = $(AWK) '\
     254  BEGIN { nonempty = 0; } \
     255  { items[$$0] = 1; nonempty = 1; } \
     256  END { if (nonempty) { for (i in items) print i; }; } \
     257'
     258# Make sure the list of sources is unique.  This is necessary because,
     259# e.g., the same source file might be shared among _SOURCES variables
     260# for different programs/libraries.
     261am__define_uniq_tagged_files = \
     262  list='$(am__tagged_files)'; \
     263  unique=`for i in $$list; do \
     264    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     265  done | $(am__uniquify_input)`
    144266ETAGS = etags
    145267CTAGS = ctags
     
    159281CPP = @CPP@
    160282CPPFLAGS = @CPPFLAGS@
     283CXX = @CXX@
     284CXXCPP = @CXXCPP@
     285CXXDEPMODE = @CXXDEPMODE@
     286CXXFLAGS = @CXXFLAGS@
    161287CYGPATH_W = @CYGPATH_W@
    162288DEFS = @DEFS@
     
    186312LTLDFLAGS = @LTLDFLAGS@
    187313LTLIBOBJS = @LTLIBOBJS@
    188 MAINT = @MAINT@
    189314MAKEINFO = @MAKEINFO@
    190315MANIFEST_TOOL = @MANIFEST_TOOL@
     
    195320OBJEXT = @OBJEXT@
    196321OS_DARWIN = @OS_DARWIN@
     322OS_HAIKU = @OS_HAIKU@
    197323OS_LINUX = @OS_LINUX@
     324OS_NETBSD = @OS_NETBSD@
    198325OS_OPENBSD = @OS_OPENBSD@
    199 OS_OS2 = @OS_OS2@
     326OS_SUNOS = @OS_SUNOS@
    200327OS_WINDOWS = @OS_WINDOWS@
    201328OTOOL = @OTOOL@
     
    209336PACKAGE_VERSION = @PACKAGE_VERSION@
    210337PATH_SEPARATOR = @PATH_SEPARATOR@
    211 PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
    212338RANLIB = @RANLIB@
    213339RC = @RC@
     
    216342SHELL = @SHELL@
    217343STRIP = @STRIP@
    218 THREAD_CFLAGS = @THREAD_CFLAGS@
    219344USE_UDEV = @USE_UDEV@
     345USE_USBDK = @USE_USBDK@
    220346VERSION = @VERSION@
    221 VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
    222347abs_builddir = @abs_builddir@
    223348abs_srcdir = @abs_srcdir@
     
    226351ac_ct_AR = @ac_ct_AR@
    227352ac_ct_CC = @ac_ct_CC@
     353ac_ct_CXX = @ac_ct_CXX@
    228354ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
    229355am__include = @am__include@
     
    272398top_builddir = @top_builddir@
    273399top_srcdir = @top_srcdir@
     400AUTOMAKE_OPTIONS = subdir-objects
    274401lib_LTLIBRARIES = libusb-1.0.la
    275 LINUX_USBFS_SRC = os/linux_usbfs.c
    276 DARWIN_USB_SRC = os/darwin_usb.c
     402POSIX_POLL_SRC = os/poll_posix.h os/poll_posix.c
     403POSIX_THREADS_SRC = os/threads_posix.h os/threads_posix.c
     404WINDOWS_POLL_SRC = os/poll_windows.h os/poll_windows.c
     405WINDOWS_THREADS_SRC = os/threads_windows.h os/threads_windows.c
     406LINUX_USBFS_SRC = os/linux_usbfs.h os/linux_usbfs.c
     407DARWIN_USB_SRC = os/darwin_usb.h os/darwin_usb.c
    277408OPENBSD_USB_SRC = os/openbsd_usb.c
    278 OS2_USB_SRC = os/poll_os2.c os/os2_usb.c
    279 WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
    280         libusb-1.0.def
    281 
    282 EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
    283         $(WINDOWS_USB_SRC) os/threads_posix.c os/threads_windows.c \
     409NETBSD_USB_SRC = os/netbsd_usb.c
     410SUNOS_USB_SRC = os/sunos_usb.c os/sunos_usb.h
     411WINDOWS_COMMON_SRC = os/windows_nt_common.h os/windows_nt_common.c \
     412                     os/windows_common.h libusb-1.0.rc libusb-1.0.def
     413
     414WINDOWS_USB_SRC = os/windows_winusb.h os/windows_winusb.c
     415WINDOWS_USBDK_SRC = os/windows_usbdk.h os/windows_usbdk.c
     416WINCE_USB_SRC = os/wince_usb.h os/wince_usb.c
     417HAIKU_USB_SRC = os/haiku_usb.h os/haiku_usb_backend.cpp \
     418                os/haiku_usb_raw.h os/haiku_usb_raw.cpp os/haiku_pollfs.cpp
     419
     420EXTRA_DIST = $(POSIX_POLL_SRC) $(POSIX_THREADS_SRC) \
     421        $(WINDOWS_POLL_SRC) $(WINDOWS_THREADS_SRC) \
     422        $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) \
     423        $(OPENBSD_USB_SRC) $(NETBSD_USB_SRC) \
     424        $(WINDOWS_COMMON_SRC) $(WINDOWS_USB_SRC) $(WINDOWS_USBDK_SRC) \
     425        $(WINCE_USB_SRC) $(HAIKU_USB_SRC) \
    284426        os/linux_udev.c os/linux_netlink.c
    285427
     
    287429@OS_LINUX_TRUE@@USE_UDEV_FALSE@OS_SRC = $(LINUX_USBFS_SRC) os/linux_netlink.c
    288430@OS_LINUX_TRUE@@USE_UDEV_TRUE@OS_SRC = $(LINUX_USBFS_SRC) os/linux_udev.c
     431@OS_NETBSD_TRUE@OS_SRC = $(NETBSD_USB_SRC)
    289432@OS_OPENBSD_TRUE@OS_SRC = $(OPENBSD_USB_SRC)
    290 @OS_OS2_TRUE@OS_SRC = $(OS2_USB_SRC)
    291 @OS_WINDOWS_TRUE@OS_SRC = $(WINDOWS_USB_SRC)
     433@OS_SUNOS_TRUE@OS_SRC = $(SUNOS_USB_SRC)
     434@OS_WINDOWS_TRUE@@USE_USBDK_FALSE@OS_SRC = $(WINDOWS_USB_SRC) $(WINDOWS_COMMON_SRC)
     435@OS_WINDOWS_TRUE@@USE_USBDK_TRUE@OS_SRC = $(WINDOWS_USBDK_SRC) $(WINDOWS_COMMON_SRC)
    292436@OS_DARWIN_TRUE@AM_CFLAGS_EXT = -no-cpp-precomp
    293 @THREADS_POSIX_FALSE@THREADS_SRC = os/threads_windows.h os/threads_windows.c
    294 @THREADS_POSIX_TRUE@THREADS_SRC = os/threads_posix.h os/threads_posix.c
    295 libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) $(THREAD_CFLAGS) \
    296         -DLIBUSB_DESCRIBE=\"`git --git-dir "$(top_srcdir)/.git" describe --tags 2>/dev/null`\"
    297 
     437@OS_HAIKU_TRUE@noinst_LTLIBRARIES = libusb_haiku.la
     438@OS_HAIKU_TRUE@libusb_haiku_la_SOURCES = $(HAIKU_USB_SRC)
     439@OS_HAIKU_TRUE@libusb_1_0_la_LIBADD = libusb_haiku.la
     440@OS_WINDOWS_FALSE@POLL_SRC = $(POSIX_POLL_SRC)
     441@OS_WINDOWS_TRUE@POLL_SRC = $(WINDOWS_POLL_SRC)
     442@THREADS_POSIX_FALSE@THREADS_SRC = $(WINDOWS_THREADS_SRC)
     443@THREADS_POSIX_TRUE@THREADS_SRC = $(POSIX_THREADS_SRC)
     444libusb_1_0_la_CFLAGS = $(AM_CFLAGS)
    298445libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
    299 libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \
    300         hotplug.h hotplug.c os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \
    301         $(THREADS_SRC) os/poll_posix.h os/poll_windows.h
     446libusb_1_0_la_SOURCES = libusbi.h libusb.h version.h version_nano.h \
     447        core.c descriptor.c hotplug.h hotplug.c io.c strerror.c sync.c \
     448        $(POLL_SRC) $(THREADS_SRC) $(OS_SRC)
    302449
    303450hdrdir = $(includedir)/libusb-1.0
     
    306453
    307454.SUFFIXES:
    308 .SUFFIXES: .c .lo .o .obj .rc
    309 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
     455.SUFFIXES: .c .cpp .lo .o .obj .rc
     456$(srcdir)/Makefile.in: $(srcdir)/Makefile.am  $(am__configure_deps)
    310457        @for dep in $?; do \
    311458          case '$(am__configure_deps)' in \
     
    332479        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    333480
    334 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
     481$(top_srcdir)/configure: $(am__configure_deps)
    335482        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    336 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
     483$(ACLOCAL_M4): $(am__aclocal_m4_deps)
    337484        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    338485$(am__aclocal_m4_deps):
     486
    339487install-libLTLIBRARIES: $(lib_LTLIBRARIES)
    340488        @$(NORMAL_INSTALL)
    341         test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
    342489        @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
    343490        list2=; for p in $$list; do \
     
    347494        done; \
    348495        test -z "$$list2" || { \
     496          echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
     497          $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
    349498          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
    350499          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
     
    362511clean-libLTLIBRARIES:
    363512        -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
    364         @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
    365           dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
    366           test "$$dir" != "$$p" || dir=.; \
    367           echo "rm -f \"$${dir}/so_locations\""; \
    368           rm -f "$${dir}/so_locations"; \
    369         done
    370 libusb-1.0.la: $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_DEPENDENCIES)
     513        @list='$(lib_LTLIBRARIES)'; \
     514        locs=`for p in $$list; do echo $$p; done | \
     515              sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
     516              sort -u`; \
     517        test -z "$$locs" || { \
     518          echo rm -f $${locs}; \
     519          rm -f $${locs}; \
     520        }
     521
     522clean-noinstLTLIBRARIES:
     523        -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
     524        @list='$(noinst_LTLIBRARIES)'; \
     525        locs=`for p in $$list; do echo $$p; done | \
     526              sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
     527              sort -u`; \
     528        test -z "$$locs" || { \
     529          echo rm -f $${locs}; \
     530          rm -f $${locs}; \
     531        }
     532os/$(am__dirstamp):
     533        @$(MKDIR_P) os
     534        @: > os/$(am__dirstamp)
     535os/$(DEPDIR)/$(am__dirstamp):
     536        @$(MKDIR_P) os/$(DEPDIR)
     537        @: > os/$(DEPDIR)/$(am__dirstamp)
     538os/libusb_1_0_la-poll_posix.lo: os/$(am__dirstamp) \
     539        os/$(DEPDIR)/$(am__dirstamp)
     540os/libusb_1_0_la-poll_windows.lo: os/$(am__dirstamp) \
     541        os/$(DEPDIR)/$(am__dirstamp)
     542os/libusb_1_0_la-threads_windows.lo: os/$(am__dirstamp) \
     543        os/$(DEPDIR)/$(am__dirstamp)
     544os/libusb_1_0_la-threads_posix.lo: os/$(am__dirstamp) \
     545        os/$(DEPDIR)/$(am__dirstamp)
     546os/libusb_1_0_la-darwin_usb.lo: os/$(am__dirstamp) \
     547        os/$(DEPDIR)/$(am__dirstamp)
     548os/libusb_1_0_la-linux_usbfs.lo: os/$(am__dirstamp) \
     549        os/$(DEPDIR)/$(am__dirstamp)
     550os/libusb_1_0_la-linux_netlink.lo: os/$(am__dirstamp) \
     551        os/$(DEPDIR)/$(am__dirstamp)
     552os/libusb_1_0_la-linux_udev.lo: os/$(am__dirstamp) \
     553        os/$(DEPDIR)/$(am__dirstamp)
     554os/libusb_1_0_la-netbsd_usb.lo: os/$(am__dirstamp) \
     555        os/$(DEPDIR)/$(am__dirstamp)
     556os/libusb_1_0_la-openbsd_usb.lo: os/$(am__dirstamp) \
     557        os/$(DEPDIR)/$(am__dirstamp)
     558os/libusb_1_0_la-sunos_usb.lo: os/$(am__dirstamp) \
     559        os/$(DEPDIR)/$(am__dirstamp)
     560os/libusb_1_0_la-windows_winusb.lo: os/$(am__dirstamp) \
     561        os/$(DEPDIR)/$(am__dirstamp)
     562os/libusb_1_0_la-windows_nt_common.lo: os/$(am__dirstamp) \
     563        os/$(DEPDIR)/$(am__dirstamp)
     564os/libusb_1_0_la-windows_usbdk.lo: os/$(am__dirstamp) \
     565        os/$(DEPDIR)/$(am__dirstamp)
     566
     567libusb-1.0.la: $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_DEPENDENCIES) $(EXTRA_libusb_1_0_la_DEPENDENCIES)
    371568        $(AM_V_CCLD)$(libusb_1_0_la_LINK) -rpath $(libdir) $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_LIBADD) $(LIBS)
     569os/haiku_usb_backend.lo: os/$(am__dirstamp) \
     570        os/$(DEPDIR)/$(am__dirstamp)
     571os/haiku_usb_raw.lo: os/$(am__dirstamp) os/$(DEPDIR)/$(am__dirstamp)
     572os/haiku_pollfs.lo: os/$(am__dirstamp) os/$(DEPDIR)/$(am__dirstamp)
     573
     574libusb_haiku.la: $(libusb_haiku_la_OBJECTS) $(libusb_haiku_la_DEPENDENCIES) $(EXTRA_libusb_haiku_la_DEPENDENCIES)
     575        $(AM_V_CXXLD)$(CXXLINK) $(am_libusb_haiku_la_rpath) $(libusb_haiku_la_OBJECTS) $(libusb_haiku_la_LIBADD) $(LIBS)
    372576
    373577mostlyclean-compile:
    374578        -rm -f *.$(OBJEXT)
     579        -rm -f os/*.$(OBJEXT)
     580        -rm -f os/*.lo
    375581
    376582distclean-compile:
     
    378584
    379585@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-core.Plo@am__quote@
    380 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-darwin_usb.Plo@am__quote@
    381586@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-descriptor.Plo@am__quote@
    382587@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-hotplug.Plo@am__quote@
    383588@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-io.Plo@am__quote@
    384 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-linux_netlink.Plo@am__quote@
    385 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-linux_udev.Plo@am__quote@
    386 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo@am__quote@
    387 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo@am__quote@
    388 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-os2_usb.Plo@am__quote@
    389 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-poll_os2.Plo@am__quote@
    390 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-poll_windows.Plo@am__quote@
     589@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-strerror.Plo@am__quote@
    391590@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-sync.Plo@am__quote@
    392 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-threads_posix.Plo@am__quote@
    393 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-threads_windows.Plo@am__quote@
    394 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-windows_usb.Plo@am__quote@
     591@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/haiku_pollfs.Plo@am__quote@
     592@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/haiku_usb_backend.Plo@am__quote@
     593@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/haiku_usb_raw.Plo@am__quote@
     594@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-darwin_usb.Plo@am__quote@
     595@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-linux_netlink.Plo@am__quote@
     596@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-linux_udev.Plo@am__quote@
     597@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo@am__quote@
     598@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-netbsd_usb.Plo@am__quote@
     599@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo@am__quote@
     600@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-poll_posix.Plo@am__quote@
     601@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-poll_windows.Plo@am__quote@
     602@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-sunos_usb.Plo@am__quote@
     603@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-threads_posix.Plo@am__quote@
     604@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-threads_windows.Plo@am__quote@
     605@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-windows_nt_common.Plo@am__quote@
     606@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-windows_usbdk.Plo@am__quote@
     607@AMDEP_TRUE@@am__include@ @am__quote@os/$(DEPDIR)/libusb_1_0_la-windows_winusb.Plo@am__quote@
    395608
    396609.c.o:
    397 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    398 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    399 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    400 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    401 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    402 @am__fastdepCC_FALSE@   $(COMPILE) -c $<
     610@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     611@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     612@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     613@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     614@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     615@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
    403616
    404617.c.obj:
    405 @am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
    406 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    407 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    408 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    409 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    410 @am__fastdepCC_FALSE@   $(COMPILE) -c `$(CYGPATH_W) '$<'`
     618@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
     619@am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
     620@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     621@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     622@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     623@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    411624
    412625.c.lo:
    413 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    414 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
    415 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    416 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
    417 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    418 @am__fastdepCC_FALSE@   $(LTCOMPILE) -c -o $@ $<
     626@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     627@am__fastdepCC_TRUE@    $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     628@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Plo
     629@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
     630@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     631@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
    419632
    420633libusb_1_0_la-core.lo: core.c
    421634@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-core.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-core.Tpo -c -o libusb_1_0_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c
    422635@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-core.Tpo $(DEPDIR)/libusb_1_0_la-core.Plo
    423 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    424 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='core.c' object='libusb_1_0_la-core.lo' libtool=yes @AMDEPBACKSLASH@
    425 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    426 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c
     636@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='core.c' object='libusb_1_0_la-core.lo' libtool=yes @AMDEPBACKSLASH@
     637@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     638@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c
    427639
    428640libusb_1_0_la-descriptor.lo: descriptor.c
    429641@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-descriptor.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-descriptor.Tpo -c -o libusb_1_0_la-descriptor.lo `test -f 'descriptor.c' || echo '$(srcdir)/'`descriptor.c
    430642@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-descriptor.Tpo $(DEPDIR)/libusb_1_0_la-descriptor.Plo
    431 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    432 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='descriptor.c' object='libusb_1_0_la-descriptor.lo' libtool=yes @AMDEPBACKSLASH@
    433 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    434 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-descriptor.lo `test -f 'descriptor.c' || echo '$(srcdir)/'`descriptor.c
     643@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='descriptor.c' object='libusb_1_0_la-descriptor.lo' libtool=yes @AMDEPBACKSLASH@
     644@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     645@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-descriptor.lo `test -f 'descriptor.c' || echo '$(srcdir)/'`descriptor.c
     646
     647libusb_1_0_la-hotplug.lo: hotplug.c
     648@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-hotplug.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-hotplug.Tpo -c -o libusb_1_0_la-hotplug.lo `test -f 'hotplug.c' || echo '$(srcdir)/'`hotplug.c
     649@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-hotplug.Tpo $(DEPDIR)/libusb_1_0_la-hotplug.Plo
     650@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='hotplug.c' object='libusb_1_0_la-hotplug.lo' libtool=yes @AMDEPBACKSLASH@
     651@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     652@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-hotplug.lo `test -f 'hotplug.c' || echo '$(srcdir)/'`hotplug.c
    435653
    436654libusb_1_0_la-io.lo: io.c
    437655@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-io.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-io.Tpo -c -o libusb_1_0_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c
    438656@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-io.Tpo $(DEPDIR)/libusb_1_0_la-io.Plo
    439 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    440 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='io.c' object='libusb_1_0_la-io.lo' libtool=yes @AMDEPBACKSLASH@
    441 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    442 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c
     657@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='io.c' object='libusb_1_0_la-io.lo' libtool=yes @AMDEPBACKSLASH@
     658@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     659@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c
     660
     661libusb_1_0_la-strerror.lo: strerror.c
     662@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-strerror.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-strerror.Tpo -c -o libusb_1_0_la-strerror.lo `test -f 'strerror.c' || echo '$(srcdir)/'`strerror.c
     663@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-strerror.Tpo $(DEPDIR)/libusb_1_0_la-strerror.Plo
     664@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='strerror.c' object='libusb_1_0_la-strerror.lo' libtool=yes @AMDEPBACKSLASH@
     665@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     666@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-strerror.lo `test -f 'strerror.c' || echo '$(srcdir)/'`strerror.c
    443667
    444668libusb_1_0_la-sync.lo: sync.c
    445669@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-sync.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-sync.Tpo -c -o libusb_1_0_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c
    446670@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-sync.Tpo $(DEPDIR)/libusb_1_0_la-sync.Plo
    447 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    448 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='sync.c' object='libusb_1_0_la-sync.lo' libtool=yes @AMDEPBACKSLASH@
    449 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    450 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c
    451 
    452 libusb_1_0_la-darwin_usb.lo: os/darwin_usb.c
    453 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-darwin_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo -c -o libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
    454 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo $(DEPDIR)/libusb_1_0_la-darwin_usb.Plo
    455 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    456 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/darwin_usb.c' object='libusb_1_0_la-darwin_usb.lo' libtool=yes @AMDEPBACKSLASH@
    457 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    458 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
    459 
    460 libusb_1_0_la-linux_usbfs.lo: os/linux_usbfs.c
    461 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-linux_usbfs.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo -c -o libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
    462 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo $(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo
    463 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    464 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/linux_usbfs.c' object='libusb_1_0_la-linux_usbfs.lo' libtool=yes @AMDEPBACKSLASH@
    465 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    466 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
    467 
    468 libusb_1_0_la-linux_netlink.lo: os/linux_netlink.c
    469 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-linux_netlink.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-linux_netlink.Tpo -c -o libusb_1_0_la-linux_netlink.lo `test -f 'os/linux_netlink.c' || echo '$(srcdir)/'`os/linux_netlink.c
    470 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_netlink.Tpo $(DEPDIR)/libusb_1_0_la-linux_netlink.Plo
    471 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    472 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/linux_netlink.c' object='libusb_1_0_la-linux_netlink.lo' libtool=yes @AMDEPBACKSLASH@
    473 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    474 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-linux_netlink.lo `test -f 'os/linux_netlink.c' || echo '$(srcdir)/'`os/linux_netlink.c
    475 
    476 libusb_1_0_la-linux_udev.lo: os/linux_udev.c
    477 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-linux_udev.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-linux_udev.Tpo -c -o libusb_1_0_la-linux_udev.lo `test -f 'os/linux_udev.c' || echo '$(srcdir)/'`os/linux_udev.c
    478 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_udev.Tpo $(DEPDIR)/libusb_1_0_la-linux_udev.Plo
    479 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    480 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/linux_udev.c' object='libusb_1_0_la-linux_udev.lo' libtool=yes @AMDEPBACKSLASH@
    481 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    482 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-linux_udev.lo `test -f 'os/linux_udev.c' || echo '$(srcdir)/'`os/linux_udev.c
    483 
    484 libusb_1_0_la-openbsd_usb.lo: os/openbsd_usb.c
    485 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-openbsd_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo -c -o libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
    486 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo $(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo
    487 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    488 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/openbsd_usb.c' object='libusb_1_0_la-openbsd_usb.lo' libtool=yes @AMDEPBACKSLASH@
    489 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    490 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
    491 
    492 libusb_1_0_la-poll_os2.lo: os/poll_os2.c
    493 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-poll_os2.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-poll_os2.Tpo -c -o libusb_1_0_la-poll_os2.lo `test -f 'os/poll_os2.c' || echo '$(srcdir)/'`os/poll_os2.c
    494 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-poll_os2.Tpo $(DEPDIR)/libusb_1_0_la-poll_os2.Plo
    495 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    496 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/poll_os2.c' object='libusb_1_0_la-poll_os2.lo' libtool=yes @AMDEPBACKSLASH@
    497 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    498 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-poll_os2.lo `test -f 'os/poll_os2.c' || echo '$(srcdir)/'`os/poll_os2.c
    499 
    500 libusb_1_0_la-os2_usb.lo: os/os2_usb.c
    501 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-os2_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-os2_usb.Tpo -c -o libusb_1_0_la-os2_usb.lo `test -f 'os/os2_usb.c' || echo '$(srcdir)/'`os/os2_usb.c
    502 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-os2_usb.Tpo $(DEPDIR)/libusb_1_0_la-os2_usb.Plo
    503 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    504 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/os2_usb.c' object='libusb_1_0_la-os2_usb.lo' libtool=yes @AMDEPBACKSLASH@
    505 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    506 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-os2_usb.lo `test -f 'os/os2_usb.c' || echo '$(srcdir)/'`os/os2_usb.c
    507 
    508 libusb_1_0_la-poll_windows.lo: os/poll_windows.c
    509 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-poll_windows.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-poll_windows.Tpo -c -o libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
    510 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-poll_windows.Tpo $(DEPDIR)/libusb_1_0_la-poll_windows.Plo
    511 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    512 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/poll_windows.c' object='libusb_1_0_la-poll_windows.lo' libtool=yes @AMDEPBACKSLASH@
    513 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    514 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
    515 
    516 libusb_1_0_la-windows_usb.lo: os/windows_usb.c
    517 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-windows_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-windows_usb.Tpo -c -o libusb_1_0_la-windows_usb.lo `test -f 'os/windows_usb.c' || echo '$(srcdir)/'`os/windows_usb.c
    518 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-windows_usb.Tpo $(DEPDIR)/libusb_1_0_la-windows_usb.Plo
    519 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    520 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/windows_usb.c' object='libusb_1_0_la-windows_usb.lo' libtool=yes @AMDEPBACKSLASH@
    521 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    522 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-windows_usb.lo `test -f 'os/windows_usb.c' || echo '$(srcdir)/'`os/windows_usb.c
    523 
    524 libusb_1_0_la-hotplug.lo: hotplug.c
    525 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-hotplug.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-hotplug.Tpo -c -o libusb_1_0_la-hotplug.lo `test -f 'hotplug.c' || echo '$(srcdir)/'`hotplug.c
    526 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-hotplug.Tpo $(DEPDIR)/libusb_1_0_la-hotplug.Plo
    527 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    528 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='hotplug.c' object='libusb_1_0_la-hotplug.lo' libtool=yes @AMDEPBACKSLASH@
    529 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    530 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-hotplug.lo `test -f 'hotplug.c' || echo '$(srcdir)/'`hotplug.c
    531 
    532 libusb_1_0_la-threads_windows.lo: os/threads_windows.c
    533 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-threads_windows.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-threads_windows.Tpo -c -o libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
    534 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_windows.Tpo $(DEPDIR)/libusb_1_0_la-threads_windows.Plo
    535 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    536 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/threads_windows.c' object='libusb_1_0_la-threads_windows.lo' libtool=yes @AMDEPBACKSLASH@
    537 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    538 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
    539 
    540 libusb_1_0_la-threads_posix.lo: os/threads_posix.c
    541 @am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-threads_posix.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-threads_posix.Tpo -c -o libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
    542 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_posix.Tpo $(DEPDIR)/libusb_1_0_la-threads_posix.Plo
    543 @am__fastdepCC_FALSE@   $(AM_V_CC) @AM_BACKSLASH@
    544 @AMDEP_TRUE@@am__fastdepCC_FALSE@       source='os/threads_posix.c' object='libusb_1_0_la-threads_posix.lo' libtool=yes @AMDEPBACKSLASH@
    545 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    546 @am__fastdepCC_FALSE@   $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
     671@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='sync.c' object='libusb_1_0_la-sync.lo' libtool=yes @AMDEPBACKSLASH@
     672@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     673@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c
     674
     675os/libusb_1_0_la-poll_posix.lo: os/poll_posix.c
     676@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-poll_posix.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-poll_posix.Tpo -c -o os/libusb_1_0_la-poll_posix.lo `test -f 'os/poll_posix.c' || echo '$(srcdir)/'`os/poll_posix.c
     677@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-poll_posix.Tpo os/$(DEPDIR)/libusb_1_0_la-poll_posix.Plo
     678@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/poll_posix.c' object='os/libusb_1_0_la-poll_posix.lo' libtool=yes @AMDEPBACKSLASH@
     679@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     680@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-poll_posix.lo `test -f 'os/poll_posix.c' || echo '$(srcdir)/'`os/poll_posix.c
     681
     682os/libusb_1_0_la-poll_windows.lo: os/poll_windows.c
     683@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-poll_windows.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-poll_windows.Tpo -c -o os/libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
     684@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-poll_windows.Tpo os/$(DEPDIR)/libusb_1_0_la-poll_windows.Plo
     685@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/poll_windows.c' object='os/libusb_1_0_la-poll_windows.lo' libtool=yes @AMDEPBACKSLASH@
     686@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     687@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
     688
     689os/libusb_1_0_la-threads_windows.lo: os/threads_windows.c
     690@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-threads_windows.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-threads_windows.Tpo -c -o os/libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
     691@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-threads_windows.Tpo os/$(DEPDIR)/libusb_1_0_la-threads_windows.Plo
     692@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/threads_windows.c' object='os/libusb_1_0_la-threads_windows.lo' libtool=yes @AMDEPBACKSLASH@
     693@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     694@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
     695
     696os/libusb_1_0_la-threads_posix.lo: os/threads_posix.c
     697@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-threads_posix.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-threads_posix.Tpo -c -o os/libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
     698@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-threads_posix.Tpo os/$(DEPDIR)/libusb_1_0_la-threads_posix.Plo
     699@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/threads_posix.c' object='os/libusb_1_0_la-threads_posix.lo' libtool=yes @AMDEPBACKSLASH@
     700@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     701@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
     702
     703os/libusb_1_0_la-darwin_usb.lo: os/darwin_usb.c
     704@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-darwin_usb.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo -c -o os/libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
     705@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo os/$(DEPDIR)/libusb_1_0_la-darwin_usb.Plo
     706@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/darwin_usb.c' object='os/libusb_1_0_la-darwin_usb.lo' libtool=yes @AMDEPBACKSLASH@
     707@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     708@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
     709
     710os/libusb_1_0_la-linux_usbfs.lo: os/linux_usbfs.c
     711@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-linux_usbfs.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo -c -o os/libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
     712@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo os/$(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo
     713@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/linux_usbfs.c' object='os/libusb_1_0_la-linux_usbfs.lo' libtool=yes @AMDEPBACKSLASH@
     714@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     715@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
     716
     717os/libusb_1_0_la-linux_netlink.lo: os/linux_netlink.c
     718@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-linux_netlink.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-linux_netlink.Tpo -c -o os/libusb_1_0_la-linux_netlink.lo `test -f 'os/linux_netlink.c' || echo '$(srcdir)/'`os/linux_netlink.c
     719@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-linux_netlink.Tpo os/$(DEPDIR)/libusb_1_0_la-linux_netlink.Plo
     720@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/linux_netlink.c' object='os/libusb_1_0_la-linux_netlink.lo' libtool=yes @AMDEPBACKSLASH@
     721@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     722@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-linux_netlink.lo `test -f 'os/linux_netlink.c' || echo '$(srcdir)/'`os/linux_netlink.c
     723
     724os/libusb_1_0_la-linux_udev.lo: os/linux_udev.c
     725@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-linux_udev.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-linux_udev.Tpo -c -o os/libusb_1_0_la-linux_udev.lo `test -f 'os/linux_udev.c' || echo '$(srcdir)/'`os/linux_udev.c
     726@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-linux_udev.Tpo os/$(DEPDIR)/libusb_1_0_la-linux_udev.Plo
     727@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/linux_udev.c' object='os/libusb_1_0_la-linux_udev.lo' libtool=yes @AMDEPBACKSLASH@
     728@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     729@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-linux_udev.lo `test -f 'os/linux_udev.c' || echo '$(srcdir)/'`os/linux_udev.c
     730
     731os/libusb_1_0_la-netbsd_usb.lo: os/netbsd_usb.c
     732@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-netbsd_usb.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-netbsd_usb.Tpo -c -o os/libusb_1_0_la-netbsd_usb.lo `test -f 'os/netbsd_usb.c' || echo '$(srcdir)/'`os/netbsd_usb.c
     733@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-netbsd_usb.Tpo os/$(DEPDIR)/libusb_1_0_la-netbsd_usb.Plo
     734@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/netbsd_usb.c' object='os/libusb_1_0_la-netbsd_usb.lo' libtool=yes @AMDEPBACKSLASH@
     735@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     736@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-netbsd_usb.lo `test -f 'os/netbsd_usb.c' || echo '$(srcdir)/'`os/netbsd_usb.c
     737
     738os/libusb_1_0_la-openbsd_usb.lo: os/openbsd_usb.c
     739@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-openbsd_usb.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo -c -o os/libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
     740@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo os/$(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo
     741@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/openbsd_usb.c' object='os/libusb_1_0_la-openbsd_usb.lo' libtool=yes @AMDEPBACKSLASH@
     742@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     743@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
     744
     745os/libusb_1_0_la-sunos_usb.lo: os/sunos_usb.c
     746@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-sunos_usb.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-sunos_usb.Tpo -c -o os/libusb_1_0_la-sunos_usb.lo `test -f 'os/sunos_usb.c' || echo '$(srcdir)/'`os/sunos_usb.c
     747@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-sunos_usb.Tpo os/$(DEPDIR)/libusb_1_0_la-sunos_usb.Plo
     748@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/sunos_usb.c' object='os/libusb_1_0_la-sunos_usb.lo' libtool=yes @AMDEPBACKSLASH@
     749@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     750@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-sunos_usb.lo `test -f 'os/sunos_usb.c' || echo '$(srcdir)/'`os/sunos_usb.c
     751
     752os/libusb_1_0_la-windows_winusb.lo: os/windows_winusb.c
     753@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-windows_winusb.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-windows_winusb.Tpo -c -o os/libusb_1_0_la-windows_winusb.lo `test -f 'os/windows_winusb.c' || echo '$(srcdir)/'`os/windows_winusb.c
     754@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-windows_winusb.Tpo os/$(DEPDIR)/libusb_1_0_la-windows_winusb.Plo
     755@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/windows_winusb.c' object='os/libusb_1_0_la-windows_winusb.lo' libtool=yes @AMDEPBACKSLASH@
     756@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     757@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-windows_winusb.lo `test -f 'os/windows_winusb.c' || echo '$(srcdir)/'`os/windows_winusb.c
     758
     759os/libusb_1_0_la-windows_nt_common.lo: os/windows_nt_common.c
     760@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-windows_nt_common.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-windows_nt_common.Tpo -c -o os/libusb_1_0_la-windows_nt_common.lo `test -f 'os/windows_nt_common.c' || echo '$(srcdir)/'`os/windows_nt_common.c
     761@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-windows_nt_common.Tpo os/$(DEPDIR)/libusb_1_0_la-windows_nt_common.Plo
     762@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/windows_nt_common.c' object='os/libusb_1_0_la-windows_nt_common.lo' libtool=yes @AMDEPBACKSLASH@
     763@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     764@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-windows_nt_common.lo `test -f 'os/windows_nt_common.c' || echo '$(srcdir)/'`os/windows_nt_common.c
     765
     766os/libusb_1_0_la-windows_usbdk.lo: os/windows_usbdk.c
     767@am__fastdepCC_TRUE@    $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT os/libusb_1_0_la-windows_usbdk.lo -MD -MP -MF os/$(DEPDIR)/libusb_1_0_la-windows_usbdk.Tpo -c -o os/libusb_1_0_la-windows_usbdk.lo `test -f 'os/windows_usbdk.c' || echo '$(srcdir)/'`os/windows_usbdk.c
     768@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) os/$(DEPDIR)/libusb_1_0_la-windows_usbdk.Tpo os/$(DEPDIR)/libusb_1_0_la-windows_usbdk.Plo
     769@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='os/windows_usbdk.c' object='os/libusb_1_0_la-windows_usbdk.lo' libtool=yes @AMDEPBACKSLASH@
     770@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     771@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o os/libusb_1_0_la-windows_usbdk.lo `test -f 'os/windows_usbdk.c' || echo '$(srcdir)/'`os/windows_usbdk.c
     772
     773.cpp.o:
     774@am__fastdepCXX_TRUE@   $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     775@am__fastdepCXX_TRUE@   $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     776@am__fastdepCXX_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
     777@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     778@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     779@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
     780
     781.cpp.obj:
     782@am__fastdepCXX_TRUE@   $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
     783@am__fastdepCXX_TRUE@   $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
     784@am__fastdepCXX_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
     785@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     786@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     787@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
     788
     789.cpp.lo:
     790@am__fastdepCXX_TRUE@   $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     791@am__fastdepCXX_TRUE@   $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     792@am__fastdepCXX_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Plo
     793@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
     794@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     795@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
    547796
    548797mostlyclean-libtool:
     
    551800clean-libtool:
    552801        -rm -rf .libs _libs
     802        -rm -rf os/.libs os/_libs
    553803install-hdrHEADERS: $(hdr_HEADERS)
    554804        @$(NORMAL_INSTALL)
    555         test -z "$(hdrdir)" || $(MKDIR_P) "$(DESTDIR)$(hdrdir)"
    556805        @list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
     806        if test -n "$$list"; then \
     807          echo " $(MKDIR_P) '$(DESTDIR)$(hdrdir)'"; \
     808          $(MKDIR_P) "$(DESTDIR)$(hdrdir)" || exit 1; \
     809        fi; \
    557810        for p in $$list; do \
    558811          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
     
    568821        @list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
    569822        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
    570         test -n "$$files" || exit 0; \
    571         echo " ( cd '$(DESTDIR)$(hdrdir)' && rm -f" $$files ")"; \
    572         cd "$(DESTDIR)$(hdrdir)" && rm -f $$files
    573 
    574 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
    575         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
    576         unique=`for i in $$list; do \
    577             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    578           done | \
    579           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    580               END { if (nonempty) { for (i in files) print i; }; }'`; \
    581         mkid -fID $$unique
    582 tags: TAGS
    583 
    584 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    585                 $(TAGS_FILES) $(LISP)
     823        dir='$(DESTDIR)$(hdrdir)'; $(am__uninstall_files_from_dir)
     824
     825ID: $(am__tagged_files)
     826        $(am__define_uniq_tagged_files); mkid -fID $$unique
     827tags: tags-am
     828TAGS: tags
     829
     830tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    586831        set x; \
    587832        here=`pwd`; \
    588         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    589         unique=`for i in $$list; do \
    590             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    591           done | \
    592           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    593               END { if (nonempty) { for (i in files) print i; }; }'`; \
     833        $(am__define_uniq_tagged_files); \
    594834        shift; \
    595835        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    603843          fi; \
    604844        fi
    605 ctags: CTAGS
    606 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
    607                 $(TAGS_FILES) $(LISP)
    608         list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
    609         unique=`for i in $$list; do \
    610             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    611           done | \
    612           $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
    613               END { if (nonempty) { for (i in files) print i; }; }'`; \
     845ctags: ctags-am
     846
     847CTAGS: ctags
     848ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     849        $(am__define_uniq_tagged_files); \
    614850        test -z "$(CTAGS_ARGS)$$unique" \
    615851          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    620856          && $(am__cd) $(top_srcdir) \
    621857          && gtags -i $(GTAGS_ARGS) "$$here"
     858cscopelist: cscopelist-am
     859
     860cscopelist-am: $(am__tagged_files)
     861        list='$(am__tagged_files)'; \
     862        case "$(srcdir)" in \
     863          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
     864          *) sdir=$(subdir)/$(srcdir) ;; \
     865        esac; \
     866        for i in $$list; do \
     867          if test -f "$$i"; then \
     868            echo "$(subdir)/$$i"; \
     869          else \
     870            echo "$$sdir/$$i"; \
     871          fi; \
     872        done >> $(top_builddir)/cscope.files
    622873
    623874distclean-tags:
     
    656907check-am: all-am
    657908check: check-am
    658 all-am: Makefile $(LTLIBRARIES) $(OS2_DLL_NAME).dll $(HEADERS)
     909all-am: Makefile $(LTLIBRARIES) $(HEADERS)
    659910installdirs:
    660911        for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"; do \
     
    671922installcheck: installcheck-am
    672923install-strip:
    673         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
    674           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
    675           `test -z '$(STRIP)' || \
    676             echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
     924        if test -z '$(STRIP)'; then \
     925          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     926            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     927              install; \
     928        else \
     929          $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
     930            install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
     931            "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
     932        fi
    677933mostlyclean-generic:
    678934
     
    682938        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
    683939        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
     940        -rm -f os/$(DEPDIR)/$(am__dirstamp)
     941        -rm -f os/$(am__dirstamp)
    684942
    685943maintainer-clean-generic:
     
    689947
    690948clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
    691         mostlyclean-am
     949        clean-noinstLTLIBRARIES mostlyclean-am
    692950
    693951distclean: distclean-am
    694         -rm -rf ./$(DEPDIR)
     952        -rm -rf ./$(DEPDIR) os/$(DEPDIR)
    695953        -rm -f Makefile
    696954distclean-am: clean-am distclean-compile distclean-generic \
     
    738996
    739997maintainer-clean: maintainer-clean-am
    740         -rm -rf ./$(DEPDIR)
     998        -rm -rf ./$(DEPDIR) os/$(DEPDIR)
    741999        -rm -f Makefile
    7421000maintainer-clean-am: distclean-am maintainer-clean-generic
     
    7591017.MAKE: install-am install-strip
    7601018
    761 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
    762         clean-libLTLIBRARIES clean-libtool ctags distclean \
    763         distclean-compile distclean-generic distclean-libtool \
    764         distclean-tags distdir dvi dvi-am html html-am info info-am \
    765         install install-am install-data install-data-am install-dvi \
    766         install-dvi-am install-exec install-exec-am install-hdrHEADERS \
    767         install-html install-html-am install-info install-info-am \
     1019.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
     1020        clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
     1021        cscopelist-am ctags ctags-am distclean distclean-compile \
     1022        distclean-generic distclean-libtool distclean-tags distdir dvi \
     1023        dvi-am html html-am info info-am install install-am \
     1024        install-data install-data-am install-dvi install-dvi-am \
     1025        install-exec install-exec-am install-hdrHEADERS install-html \
     1026        install-html-am install-info install-info-am \
    7681027        install-libLTLIBRARIES install-man install-pdf install-pdf-am \
    7691028        install-ps install-ps-am install-strip installcheck \
     
    7711030        maintainer-clean-generic mostlyclean mostlyclean-compile \
    7721031        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
    773         tags uninstall uninstall-am uninstall-hdrHEADERS \
     1032        tags tags-am uninstall uninstall-am uninstall-hdrHEADERS \
    7741033        uninstall-libLTLIBRARIES
    7751034
     1035all: libusb-1.0.la libusb-1.0.dll
    7761036
    7771037@OS_WINDOWS_TRUE@.rc.lo:
    7781038@OS_WINDOWS_TRUE@       $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
    7791039
    780 @OS_WINDOWS_TRUE@libusb-1.0.rc: version.h
     1040@OS_WINDOWS_TRUE@libusb-1.0.rc: version.h version_nano.h
     1041
     1042libusb-1.0.dll: libusb-1.0.def libusb-1.0.la
     1043# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
     1044@CREATE_IMPORT_LIB_TRUE@        $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
    7811045
    7821046# Tell versions [3.59,3.63) of GNU make to not export all variables.
    7831047# Otherwise a system limit (for SysV at least) may be exceeded.
    7841048.NOEXPORT:
    785 
    786 $(OS2_DLL_NAME).dll: lib$(OS2_LA_NAME).la
    787         rm -f .libs/$(OS2_DLL_NAME)*.a
    788         ar cru .libs/$(OS2_LA_NAME)_s.a $(OS2_DLL_OBJ)
    789         echo "LIBRARY $(OS2_DLL_NAME) INITINSTANCE TERMINSTANCE" > $(OS2_DLL_NAME).def
    790         echo "DATA MULTIPLE" >> $(OS2_DLL_NAME).def
    791         echo "EXPORTS" >> $(OS2_DLL_NAME).def
    792         emxexp $(OS2_DLL_OBJ) >> $(OS2_DLL_NAME).def
    793         gcc -g -Zbin-files -Zhigh-mem -Zomf -Zdll $(OS2_DLL_NAME).def -o $@ $(OS2_DLL_OBJ) $(OS2_DLL_LIBS) 
    794         emximp -o .libs/$(OS2_LA_NAME).a $(OS2_DLL_NAME).def
    795         emximp -o .libs/$(OS2_LA_NAME).lib $(OS2_DLL_NAME).def
    796         cp $@ .libs
  • TabularUnified libusb1/trunk/libusb/core.c

    r1879 r1882  
     1/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
    12/*
    23 * Core functions for libusb
    3  * Copyright (c) 2012-2013 Nathan Hjelm <hjelmn@cs.unm.edu>
    4  * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
    5  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
     4 * Copyright © 2012-2013 Nathan Hjelm <hjelmn@cs.unm.edu>
     5 * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
     6 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    2021 */
    2122
    22 #include <config.h>
     23#include "config.h"
    2324
    2425#include <errno.h>
     
    2728#include <stdlib.h>
    2829#include <string.h>
     30#ifdef HAVE_SYS_TYPES_H
    2931#include <sys/types.h>
    30 
     32#endif
    3133#ifdef HAVE_SYS_TIME_H
    3234#include <sys/time.h>
     35#endif
     36#ifdef HAVE_SYSLOG_H
     37#include <syslog.h>
     38#endif
     39
     40#ifdef __ANDROID__
     41#include <android/log.h>
    3342#endif
    3443
     
    4251#elif defined(OS_OPENBSD)
    4352const struct usbi_os_backend * const usbi_backend = &openbsd_backend;
     53#elif defined(OS_NETBSD)
     54const struct usbi_os_backend * const usbi_backend = &netbsd_backend;
    4455#elif defined(OS_WINDOWS)
     56
     57#if defined(USE_USBDK)
     58const struct usbi_os_backend * const usbi_backend = &usbdk_backend;
     59#else
    4560const struct usbi_os_backend * const usbi_backend = &windows_backend;
     61#endif
     62
     63#elif defined(OS_WINCE)
     64const struct usbi_os_backend * const usbi_backend = &wince_backend;
     65#elif defined(OS_HAIKU)
     66const struct usbi_os_backend * const usbi_backend = &haiku_usb_raw_backend;
     67#elif defined (OS_SUNOS)
     68const struct usbi_os_backend * const usbi_backend = &sunos_backend;
    4669#elif defined(OS_OS2)
    4770const struct usbi_os_backend * const usbi_backend = &os2_backend;
     
    5073#endif
    5174
    52 const struct libusb_version libusb_version_internal = {
    53         LIBUSB_MAJOR, LIBUSB_MINOR, LIBUSB_MICRO, LIBUSB_NANO, LIBUSB_RC,
    54         LIBUSB_DESCRIBE
    55 };
    56 
    5775struct libusb_context *usbi_default_context = NULL;
     76static const struct libusb_version libusb_version_internal =
     77        { LIBUSB_MAJOR, LIBUSB_MINOR, LIBUSB_MICRO, LIBUSB_NANO,
     78          LIBUSB_RC, "http://libusb.info" };
    5879static int default_context_refcnt = 0;
    5980static usbi_mutex_static_t default_context_lock = USBI_MUTEX_INITIALIZER;
     81static struct timeval timestamp_origin = { 0, 0 };
    6082
    6183usbi_mutex_static_t active_contexts_lock = USBI_MUTEX_INITIALIZER;
     
    6991 * libusb is an open source library that allows you to communicate with USB
    7092 * devices from userspace. For more info, see the
    71  * <a href="http://libusb.sourceforge.net">libusb homepage</a>.
     93 * <a href="http://libusb.info">libusb homepage</a>.
    7294 *
    7395 * This documentation is aimed at application developers wishing to
    7496 * communicate with USB peripherals from their own software. After reviewing
    7597 * this documentation, feedback and questions can be sent to the
    76  * <a href="http://sourceforge.net/mail/?group_id=1674">libusb-devel mailing
    77  * list</a>.
     98 * <a href="http://mailing-list.libusb.info">libusb-devel mailing list</a>.
    7899 *
    79100 * This documentation assumes knowledge of how to operate USB devices from
    80101 * a software standpoint (descriptors, configurations, interfaces, endpoints,
    81102 * control/bulk/interrupt/isochronous transfers, etc). Full information
    82  * can be found in the <a href="http://www.usb.org/developers/docs/">USB 2.0
     103 * can be found in the <a href="http://www.usb.org/developers/docs/">USB 3.0
    83104 * Specification</a> which is available for free download. You can probably
    84105 * find less verbose introductions by searching the web.
     106 *
     107 * \section API Application Programming Interface (API)
     108 *
     109 * See the \ref libusb_api page for a complete list of the libusb functions.
    85110 *
    86111 * \section features Library features
     
    94119 * - Lightweight with lean API
    95120 * - Compatible with libusb-0.1 through the libusb-compat-0.1 translation layer
    96  * - Hotplug support (see \ref hotplug)
     121 * - Hotplug support (on some platforms). See \ref libusb_hotplug.
    97122 *
    98123 * \section gettingstarted Getting Started
     
    102127 *
    103128 * One decision you will have to make is whether to use the synchronous
    104  * or the asynchronous data transfer interface. The \ref io documentation
     129 * or the asynchronous data transfer interface. The \ref libusb_io documentation
    105130 * provides some insight into this topic.
    106131 *
     
    113138 * libusb functions typically return 0 on success or a negative error code
    114139 * on failure. These negative error codes relate to LIBUSB_ERROR constants
    115  * which are listed on the \ref misc "miscellaneous" documentation page.
     140 * which are listed on the \ref libusb_misc "miscellaneous" documentation page.
    116141 *
    117142 * \section msglog Debug message logging
    118143 *
    119  * libusb does not log any messages by default. Your application is therefore
    120  * free to close stdout/stderr and those descriptors may be reused without
    121  * worry.
    122  *
    123  * The libusb_set_debug() function can be used to enable stdout/stderr logging
    124  * of certain messages. Under standard configuration, libusb doesn't really
    125  * log much at all, so you are advised to use this function to enable all
    126  * error/warning/informational messages. It will help you debug problems with
    127  * your software.
     144 * libusb uses stderr for all logging. By default, logging is set to NONE,
     145 * which means that no output will be produced. However, unless the library
     146 * has been compiled with logging disabled, then any application calls to
     147 * libusb_set_debug(), or the setting of the environmental variable
     148 * LIBUSB_DEBUG outside of the application, can result in logging being
     149 * produced. Your application should therefore not close stderr, but instead
     150 * direct it to the null device if its output is undesirable.
     151 *
     152 * The libusb_set_debug() function can be used to enable logging of certain
     153 * messages. Under standard configuration, libusb doesn't really log much
     154 * so you are advised to use this function to enable all error/warning/
     155 * informational messages. It will help debug problems with your software.
    128156 *
    129157 * The logged messages are unstructured. There is no one-to-one correspondence
     
    131159 * libusb functions. There is no format to the messages, so you should not
    132160 * try to capture or parse them. They are not and will not be localized.
    133  * These messages are not suitable for being passed to your application user;
     161 * These messages are not intended to being passed to your application user;
    134162 * instead, you should interpret the error codes returned from libusb functions
    135163 * and provide appropriate notification to the user. The messages are simply
     
    139167 *
    140168 * The LIBUSB_DEBUG environment variable can be used to enable message logging
    141  * at run-time. This environment variable should be set to a number, which is
    142  * interpreted the same as the libusb_set_debug() parameter. When this
     169 * at run-time. This environment variable should be set to a log level number,
     170 * which is interpreted the same as the libusb_set_debug() parameter. When this
    143171 * environment variable is set, the message logging verbosity level is fixed
    144172 * and libusb_set_debug() effectively does nothing.
     
    148176 * variable have no effects.
    149177 *
    150  * libusb can also be compiled with verbose debugging messages. When the
    151  * library is compiled in this way, all messages of all verbosities are always
    152  * logged.  libusb_set_debug() and the LIBUSB_DEBUG environment variable have
    153  * no effects.
     178 * libusb can also be compiled with verbose debugging messages always. When
     179 * the library is compiled in this way, all messages of all verbosities are
     180 * always logged. libusb_set_debug() and the LIBUSB_DEBUG environment variable
     181 * have no effects.
    154182 *
    155183 * \section remarks Other remarks
    156184 *
    157  * libusb does have imperfections. The \ref caveats "caveats" page attempts
     185 * libusb does have imperfections. The \ref libusb_caveats "caveats" page attempts
    158186 * to document these.
    159187 */
    160188
    161189/**
    162  * \page caveats Caveats
     190 * \page libusb_caveats Caveats
    163191 *
    164192 * \section devresets Device resets
     
    206234 *    libusb_set_configuration() using the same configuration value will cause
    207235 *    a lightweight device reset. This may not be desirable behaviour.
    208  * -# libusb will be unable to change configuration if the device is in
    209  *    another configuration and other programs or drivers have claimed
    210  *    interfaces under that configuration.
    211236 * -# In the case where the desired configuration is already active, libusb
    212237 *    may not even be able to perform a lightweight device reset. For example,
     
    217242 *    perform the lightweight device reset, so libusb_set_configuration() will
    218243 *    fail. (Luckily the device in question only has a single configuration.)
     244 * -# libusb will be unable to set a configuration if other programs or
     245 *    drivers have claimed interfaces. In particular, this means that kernel
     246 *    drivers must be detached from all the interfaces before
     247 *    libusb_set_configuration() may succeed.
    219248 *
    220249 * One solution to some of the above problems is to consider the currently
     
    222251 * we don't have to select any configuration:
    223252\code
    224 cfg = libusb_get_configuration(dev);
     253cfg = -1;
     254libusb_get_configuration(dev, &cfg);
    225255if (cfg != desired)
    226256        libusb_set_configuration(dev, desired);
     
    257287 *
    258288 * On legacy platforms, libusb is unable to do this in all situations. After
    259  * the incomplete packet occurs, "surplus" data may be transferred. Prior to
    260  * libusb v1.0.2, this information was lost (and for device-to-host transfers,
    261  * the corresponding data was discarded). As of libusb v1.0.3, this information
    262  * is kept (the data length of the transfer is updated) and, for device-to-host
    263  * transfers, any surplus data was added to the buffer. Still, this is not
    264  * a nice solution because it loses the information about the end of the short
    265  * packet, and the user probably wanted that surplus data to arrive in the next
    266  * logical transfer.
    267  *
    268  * A previous workaround was to only ever submit transfers of size 16kb or
    269  * less.
    270  *
    271  * As of libusb v1.0.4 and Linux v2.6.32, this is fixed. A technical
    272  * explanation of this issue follows.
    273  *
    274  * When you ask libusb to submit a bulk transfer larger than 16kb in size,
    275  * libusb breaks it up into a number of smaller subtransfers. This is because
    276  * the usbfs kernel interface only accepts transfers of up to 16kb in size.
    277  * The subtransfers are submitted all at once so that the kernel can queue
    278  * them at the hardware level, therefore maximizing bus throughput.
    279  *
    280  * On legacy platforms, this caused problems when transfers completed early.
    281  * Upon this event, the kernel would terminate all further packets in that
    282  * subtransfer (but not any following ones). libusb would note this event and
    283  * immediately cancel any following subtransfers that had been queued,
    284  * but often libusb was not fast enough, and the following subtransfers had
    285  * started before libusb got around to cancelling them.
    286  *
    287  * Thanks to an API extension to usbfs, this is fixed with recent kernel and
    288  * libusb releases. The solution was to allow libusb to communicate to the
    289  * kernel where boundaries occur between logical libusb-level transfers. When
    290  * a short transfer (or other error) occurs, the kernel will cancel all the
    291  * subtransfers until the boundary without allowing those transfers to start.
     289 * the incomplete packet occurs, "surplus" data may be transferred. For recent
     290 * versions of libusb, this information is kept (the data length of the
     291 * transfer is updated) and, for device-to-host transfers, any surplus data was
     292 * added to the buffer. Still, this is not a nice solution because it loses the
     293 * information about the end of the short packet, and the user probably wanted
     294 * that surplus data to arrive in the next logical transfer.
     295 *
    292296 *
    293297 * \section zlp Zero length packets
    294298 *
    295299 * - libusb is able to send a packet of zero length to an endpoint simply by
    296  * submitting a transfer of zero length. On Linux, this did not work with
    297  * libusb versions prior to 1.0.3 and kernel versions prior to 2.6.31.
     300 * submitting a transfer of zero length.
    298301 * - The \ref libusb_transfer_flags::LIBUSB_TRANSFER_ADD_ZERO_PACKET
    299302 * "LIBUSB_TRANSFER_ADD_ZERO_PACKET" flag is currently only supported on Linux.
     
    301304
    302305/**
    303  * \page contexts Contexts
     306 * \page libusb_contexts Contexts
    304307 *
    305308 * It is possible that libusb may be used simultaneously from two independent
     
    339342 */
    340343
     344 /**
     345  * \page libusb_api Application Programming Interface
     346  *
     347  * This is the complete list of libusb functions, structures and
     348  * enumerations in alphabetical order.
     349  *
     350  * \section Functions
     351  * - libusb_alloc_streams()
     352  * - libusb_alloc_transfer()
     353  * - libusb_attach_kernel_driver()
     354  * - libusb_bulk_transfer()
     355  * - libusb_cancel_transfer()
     356  * - libusb_claim_interface()
     357  * - libusb_clear_halt()
     358  * - libusb_close()
     359  * - libusb_control_transfer()
     360  * - libusb_control_transfer_get_data()
     361  * - libusb_control_transfer_get_setup()
     362  * - libusb_cpu_to_le16()
     363  * - libusb_detach_kernel_driver()
     364  * - libusb_dev_mem_alloc()
     365  * - libusb_dev_mem_free()
     366  * - libusb_error_name()
     367  * - libusb_event_handler_active()
     368  * - libusb_event_handling_ok()
     369  * - libusb_exit()
     370  * - libusb_fill_bulk_stream_transfer()
     371  * - libusb_fill_bulk_transfer()
     372  * - libusb_fill_control_setup()
     373  * - libusb_fill_control_transfer()
     374  * - libusb_fill_interrupt_transfer()
     375  * - libusb_fill_iso_transfer()
     376  * - libusb_free_bos_descriptor()
     377  * - libusb_free_config_descriptor()
     378  * - libusb_free_container_id_descriptor()
     379  * - libusb_free_device_list()
     380  * - libusb_free_pollfds()
     381  * - libusb_free_ss_endpoint_companion_descriptor()
     382  * - libusb_free_ss_usb_device_capability_descriptor()
     383  * - libusb_free_streams()
     384  * - libusb_free_transfer()
     385  * - libusb_free_usb_2_0_extension_descriptor()
     386  * - libusb_get_active_config_descriptor()
     387  * - libusb_get_bos_descriptor()
     388  * - libusb_get_bus_number()
     389  * - libusb_get_config_descriptor()
     390  * - libusb_get_config_descriptor_by_value()
     391  * - libusb_get_configuration()
     392  * - libusb_get_container_id_descriptor()
     393  * - libusb_get_descriptor()
     394  * - libusb_get_device()
     395  * - libusb_get_device_address()
     396  * - libusb_get_device_descriptor()
     397  * - libusb_get_device_list()
     398  * - libusb_get_device_speed()
     399  * - libusb_get_iso_packet_buffer()
     400  * - libusb_get_iso_packet_buffer_simple()
     401  * - libusb_get_max_iso_packet_size()
     402  * - libusb_get_max_packet_size()
     403  * - libusb_get_next_timeout()
     404  * - libusb_get_parent()
     405  * - libusb_get_pollfds()
     406  * - libusb_get_port_number()
     407  * - libusb_get_port_numbers()
     408  * - libusb_get_port_path()
     409  * - libusb_get_ss_endpoint_companion_descriptor()
     410  * - libusb_get_ss_usb_device_capability_descriptor()
     411  * - libusb_get_string_descriptor()
     412  * - libusb_get_string_descriptor_ascii()
     413  * - libusb_get_usb_2_0_extension_descriptor()
     414  * - libusb_get_version()
     415  * - libusb_handle_events()
     416  * - libusb_handle_events_completed()
     417  * - libusb_handle_events_locked()
     418  * - libusb_handle_events_timeout()
     419  * - libusb_handle_events_timeout_completed()
     420  * - libusb_has_capability()
     421  * - libusb_hotplug_deregister_callback()
     422  * - libusb_hotplug_register_callback()
     423  * - libusb_init()
     424  * - libusb_interrupt_event_handler()
     425  * - libusb_interrupt_transfer()
     426  * - libusb_kernel_driver_active()
     427  * - libusb_lock_events()
     428  * - libusb_lock_event_waiters()
     429  * - libusb_open()
     430  * - libusb_open_device_with_vid_pid()
     431  * - libusb_pollfds_handle_timeouts()
     432  * - libusb_ref_device()
     433  * - libusb_release_interface()
     434  * - libusb_reset_device()
     435  * - libusb_set_auto_detach_kernel_driver()
     436  * - libusb_set_configuration()
     437  * - libusb_set_debug()
     438  * - libusb_set_interface_alt_setting()
     439  * - libusb_set_iso_packet_lengths()
     440  * - libusb_setlocale()
     441  * - libusb_set_pollfd_notifiers()
     442  * - libusb_strerror()
     443  * - libusb_submit_transfer()
     444  * - libusb_transfer_get_stream_id()
     445  * - libusb_transfer_set_stream_id()
     446  * - libusb_try_lock_events()
     447  * - libusb_unlock_events()
     448  * - libusb_unlock_event_waiters()
     449  * - libusb_unref_device()
     450  * - libusb_wait_for_event()
     451  *
     452  * \section Structures
     453  * - libusb_bos_descriptor
     454  * - libusb_bos_dev_capability_descriptor
     455  * - libusb_config_descriptor
     456  * - libusb_container_id_descriptor
     457  * - \ref libusb_context
     458  * - libusb_control_setup
     459  * - \ref libusb_device
     460  * - libusb_device_descriptor
     461  * - \ref libusb_device_handle
     462  * - libusb_endpoint_descriptor
     463  * - libusb_interface
     464  * - libusb_interface_descriptor
     465  * - libusb_iso_packet_descriptor
     466  * - libusb_pollfd
     467  * - libusb_ss_endpoint_companion_descriptor
     468  * - libusb_ss_usb_device_capability_descriptor
     469  * - libusb_transfer
     470  * - libusb_usb_2_0_extension_descriptor
     471  * - libusb_version
     472  *
     473  * \section Enums
     474  * - \ref libusb_bos_type
     475  * - \ref libusb_capability
     476  * - \ref libusb_class_code
     477  * - \ref libusb_descriptor_type
     478  * - \ref libusb_endpoint_direction
     479  * - \ref libusb_error
     480  * - \ref libusb_iso_sync_type
     481  * - \ref libusb_iso_usage_type
     482  * - \ref libusb_log_level
     483  * - \ref libusb_request_recipient
     484  * - \ref libusb_request_type
     485  * - \ref libusb_speed
     486  * - \ref libusb_ss_usb_device_capability_attributes
     487  * - \ref libusb_standard_request
     488  * - \ref libusb_supported_speed
     489  * - \ref libusb_transfer_flags
     490  * - \ref libusb_transfer_status
     491  * - \ref libusb_transfer_type
     492  * - \ref libusb_usb_2_0_extension_attributes
     493  */
     494
    341495/**
    342  * @defgroup lib Library initialization/deinitialization
     496 * @defgroup libusb_lib Library initialization/deinitialization
    343497 * This page details how to initialize and deinitialize libusb. Initialization
    344498 * must be performed before using any libusb functionality, and similarly you
     
    347501
    348502/**
    349  * @defgroup dev Device handling and enumeration
     503 * @defgroup libusb_dev Device handling and enumeration
    350504 * The functionality documented below is designed to help with the following
    351505 * operations:
     
    457611 */
    458612
    459 /** @defgroup misc Miscellaneous */
     613/** @defgroup libusb_misc Miscellaneous */
    460614
    461615/* we traverse usbfs without knowing how many devices we are going to find.
     
    478632}
    479633
     634static void discovered_devs_free(struct discovered_devs *discdevs)
     635{
     636        size_t i;
     637
     638        for (i = 0; i < discdevs->len; i++)
     639                libusb_unref_device(discdevs->devices[i]);
     640
     641        free(discdevs);
     642}
     643
    480644/* append a device to the discovered devices collection. may realloc itself,
    481645 * returning new discdevs. returns NULL on realloc failure. */
     
    485649        size_t len = discdevs->len;
    486650        size_t capacity;
     651        struct discovered_devs *new_discdevs;
    487652
    488653        /* if there is space, just append the device */
     
    496661        usbi_dbg("need to increase capacity");
    497662        capacity = discdevs->capacity + DISCOVERED_DEVICES_SIZE_STEP;
    498         discdevs = realloc(discdevs,
     663        /* can't use usbi_reallocf here because in failure cases it would
     664         * free the existing discdevs without unreferencing its devices. */
     665        new_discdevs = realloc(discdevs,
    499666                sizeof(*discdevs) + (sizeof(void *) * capacity));
    500         if (discdevs) {
    501                 discdevs->capacity = capacity;
    502                 discdevs->devices[len] = libusb_ref_device(dev);
    503                 discdevs->len++;
    504         }
     667        if (!new_discdevs) {
     668                discovered_devs_free(discdevs);
     669                return NULL;
     670        }
     671
     672        discdevs = new_discdevs;
     673        discdevs->capacity = capacity;
     674        discdevs->devices[len] = libusb_ref_device(dev);
     675        discdevs->len++;
    505676
    506677        return discdevs;
    507 }
    508 
    509 static void discovered_devs_free(struct discovered_devs *discdevs)
    510 {
    511         size_t i;
    512 
    513         for (i = 0; i < discdevs->len; i++)
    514                 libusb_unref_device(discdevs->devices[i]);
    515 
    516         free(discdevs);
    517678}
    518679
     
    529690                return NULL;
    530691
    531         r = usbi_mutex_init(&dev->lock, NULL);
     692        r = usbi_mutex_init(&dev->lock);
    532693        if (r) {
    533694                free(dev);
     
    539700        dev->session_data = session_id;
    540701        dev->speed = LIBUSB_SPEED_UNKNOWN;
    541         memset(&dev->os_priv, 0, priv_size);
    542702
    543703        if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
     
    550710void usbi_connect_device(struct libusb_device *dev)
    551711{
    552         libusb_hotplug_message message = {LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, dev};
    553         int ret;
     712        struct libusb_context *ctx = DEVICE_CTX(dev);
    554713
    555714        dev->attached = 1;
     
    559718        usbi_mutex_unlock(&dev->ctx->usb_devs_lock);
    560719
    561         /* Signal that an event has occurred for this device if we support hotplug AND
    562            the hotplug pipe is ready. This prevents an event from getting raised during
    563            initial enumeration. */
    564         if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && dev->ctx->hotplug_pipe[1] > 0) {
    565                 ret = usbi_write(dev->ctx->hotplug_pipe[1], &message, sizeof (message));
    566                 if (sizeof (message) != ret) {
    567                         usbi_err(DEVICE_CTX(dev), "error writing hotplug message");
    568                 }
    569         }
     720        /* Signal that an event has occurred for this device if we support hotplug AND
     721         * the hotplug message list is ready. This prevents an event from getting raised
     722         * during initial enumeration. */
     723        if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && dev->ctx->hotplug_msgs.next) {
     724                usbi_hotplug_notification(ctx, dev, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED);
     725        }
    570726}
    571727
    572728void usbi_disconnect_device(struct libusb_device *dev)
    573729{
    574         libusb_hotplug_message message = {LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, dev};
    575         struct libusb_context *ctx = dev->ctx;
    576         int ret;
     730        struct libusb_context *ctx = DEVICE_CTX(dev);
    577731
    578732        usbi_mutex_lock(&dev->lock);
     
    580734        usbi_mutex_unlock(&dev->lock);
    581735
    582         /* Signal that an event has occurred for this device if we support hotplug AND
    583            the hotplug pipe is ready. This prevents an event from getting raised during
    584            initial enumeration. libusb_handle_events will take care of dereferencing the
    585            device. */
    586         if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && dev->ctx->hotplug_pipe[1] > 0) {
    587                 ret = usbi_write(dev->ctx->hotplug_pipe[1], &message, sizeof (message));
    588                 if (sizeof(message) != ret) {
    589                         usbi_err(DEVICE_CTX(dev), "error writing hotplug message");
    590                 }
    591         }
    592 
    593736        usbi_mutex_lock(&ctx->usb_devs_lock);
    594737        list_del(&dev->list);
    595738        usbi_mutex_unlock(&ctx->usb_devs_lock);
     739
     740        /* Signal that an event has occurred for this device if we support hotplug AND
     741         * the hotplug message list is ready. This prevents an event from getting raised
     742         * during initial enumeration. libusb_handle_events will take care of dereferencing
     743         * the device. */
     744        if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && dev->ctx->hotplug_msgs.next) {
     745                usbi_hotplug_notification(ctx, dev, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT);
     746        }
    596747}
    597748
     
    631782        list_for_each_entry(dev, &ctx->usb_devs, list, struct libusb_device)
    632783                if (dev->session_data == session_id) {
    633                         ret = dev;
     784                        ret = libusb_ref_device(dev);
    634785                        break;
    635786                }
     
    639790}
    640791
    641 /** @ingroup dev
     792/** @ingroup libusb_dev
    642793 * Returns a list of USB devices currently attached to the system. This is
    643794 * your entry point into finding a USB device to operate.
     
    656807 * \param list output location for a list of devices. Must be later freed with
    657808 * libusb_free_device_list().
    658  * \returns The number of devices in the outputted list, or any
     809 * \returns the number of devices in the outputted list, or any
    659810 * \ref libusb_error according to errors encountered by the backend.
    660811 */
     
    675826                /* backend provides hotplug support */
    676827                struct libusb_device *dev;
     828
     829                if (usbi_backend->hotplug_poll)
     830                        usbi_backend->hotplug_poll();
    677831
    678832                usbi_mutex_lock(&ctx->usb_devs_lock);
     
    698852        /* convert discovered_devs into a list */
    699853        len = discdevs->len;
    700         ret = malloc(sizeof(void *) * (len + 1));
     854        ret = calloc(len + 1, sizeof(struct libusb_device *));
    701855        if (!ret) {
    702856                len = LIBUSB_ERROR_NO_MEM;
     
    712866
    713867out:
    714         discovered_devs_free(discdevs);
     868        if (discdevs)
     869                discovered_devs_free(discdevs);
    715870        return len;
    716871}
    717872
    718 /** \ingroup dev
     873/** \ingroup libusb_dev
    719874 * Frees a list of devices previously discovered using
    720875 * libusb_get_device_list(). If the unref_devices parameter is set, the
     
    739894}
    740895
    741 /** \ingroup dev
     896/** \ingroup libusb_dev
    742897 * Get the number of the bus that a device is connected to.
    743898 * \param dev a device
     
    749904}
    750905
    751 /** \ingroup dev
     906/** \ingroup libusb_dev
     907 * Get the number of the port that a device is connected to.
     908 * Unless the OS does something funky, or you are hot-plugging USB extension cards,
     909 * the port number returned by this call is usually guaranteed to be uniquely tied
     910 * to a physical port, meaning that different devices plugged on the same physical
     911 * port should return the same port number.
     912 *
     913 * But outside of this, there is no guarantee that the port number returned by this
     914 * call will remain the same, or even match the order in which ports have been
     915 * numbered by the HUB/HCD manufacturer.
     916 *
     917 * \param dev a device
     918 * \returns the port number (0 if not available)
     919 */
     920uint8_t API_EXPORTED libusb_get_port_number(libusb_device *dev)
     921{
     922        return dev->port_number;
     923}
     924
     925/** \ingroup libusb_dev
     926 * Get the list of all port numbers from root for the specified device
     927 *
     928 * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
     929 * \param dev a device
     930 * \param port_numbers the array that should contain the port numbers
     931 * \param port_numbers_len the maximum length of the array. As per the USB 3.0
     932 * specs, the current maximum limit for the depth is 7.
     933 * \returns the number of elements filled
     934 * \returns LIBUSB_ERROR_OVERFLOW if the array is too small
     935 */
     936int API_EXPORTED libusb_get_port_numbers(libusb_device *dev,
     937        uint8_t* port_numbers, int port_numbers_len)
     938{
     939        int i = port_numbers_len;
     940        struct libusb_context *ctx = DEVICE_CTX(dev);
     941
     942        if (port_numbers_len <= 0)
     943                return LIBUSB_ERROR_INVALID_PARAM;
     944
     945        // HCDs can be listed as devices with port #0
     946        while((dev) && (dev->port_number != 0)) {
     947                if (--i < 0) {
     948                        usbi_warn(ctx, "port numbers array is too small");
     949                        return LIBUSB_ERROR_OVERFLOW;
     950                }
     951                port_numbers[i] = dev->port_number;
     952                dev = dev->parent_dev;
     953        }
     954        if (i < port_numbers_len)
     955                memmove(port_numbers, &port_numbers[i], port_numbers_len - i);
     956        return port_numbers_len - i;
     957}
     958
     959/** \ingroup libusb_dev
     960 * Deprecated please use libusb_get_port_numbers instead.
     961 */
     962int API_EXPORTED libusb_get_port_path(libusb_context *ctx, libusb_device *dev,
     963        uint8_t* port_numbers, uint8_t port_numbers_len)
     964{
     965        UNUSED(ctx);
     966
     967        return libusb_get_port_numbers(dev, port_numbers, port_numbers_len);
     968}
     969
     970/** \ingroup libusb_dev
     971 * Get the the parent from the specified device.
     972 * \param dev a device
     973 * \returns the device parent or NULL if not available
     974 * You should issue a \ref libusb_get_device_list() before calling this
     975 * function and make sure that you only access the parent before issuing
     976 * \ref libusb_free_device_list(). The reason is that libusb currently does
     977 * not maintain a permanent list of device instances, and therefore can
     978 * only guarantee that parents are fully instantiated within a
     979 * libusb_get_device_list() - libusb_free_device_list() block.
     980 */
     981DEFAULT_VISIBILITY
     982libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev)
     983{
     984        return dev->parent_dev;
     985}
     986
     987/** \ingroup libusb_dev
    752988 * Get the address of the device on the bus it is connected to.
    753989 * \param dev a device
     
    759995}
    760996
    761 /** \ingroup dev
     997/** \ingroup libusb_dev
    762998 * Get the negotiated connection speed for a device.
    763999 * \param dev a device
     
    7951031}
    7961032
    797 /** \ingroup dev
     1033/** \ingroup libusb_dev
    7981034 * Convenience function to retrieve the wMaxPacketSize value for a particular
    7991035 * endpoint in the active device configuration.
     
    8261062
    8271063        ep = find_endpoint(config, endpoint);
    828         if (!ep)
    829                 return LIBUSB_ERROR_NOT_FOUND;
     1064        if (!ep) {
     1065                r = LIBUSB_ERROR_NOT_FOUND;
     1066                goto out;
     1067        }
    8301068
    8311069        r = ep->wMaxPacketSize;
     1070
     1071out:
    8321072        libusb_free_config_descriptor(config);
    8331073        return r;
    8341074}
    8351075
    836 /** \ingroup dev
     1076/** \ingroup libusb_dev
    8371077 * Calculate the maximum packet size which a specific endpoint is capable is
    8381078 * sending or receiving in the duration of 1 microframe
    8391079 *
    840  * Only the active configution is examined. The calculation is based on the
     1080 * Only the active configuration is examined. The calculation is based on the
    8411081 * wMaxPacketSize field in the endpoint descriptor as described in section
    8421082 * 9.6.6 in the USB 2.0 specifications.
     
    8771117
    8781118        ep = find_endpoint(config, endpoint);
    879         if (!ep)
    880                 return LIBUSB_ERROR_NOT_FOUND;
     1119        if (!ep) {
     1120                r = LIBUSB_ERROR_NOT_FOUND;
     1121                goto out;
     1122        }
    8811123
    8821124        val = ep->wMaxPacketSize;
    883         ep_type = ep->bmAttributes & 0x3;
    884         libusb_free_config_descriptor(config);
     1125        ep_type = (enum libusb_transfer_type) (ep->bmAttributes & 0x3);
    8851126
    8861127        r = val & 0x07ff;
     
    8881129                        || ep_type == LIBUSB_TRANSFER_TYPE_INTERRUPT)
    8891130                r *= (1 + ((val >> 11) & 3));
     1131
     1132out:
     1133        libusb_free_config_descriptor(config);
    8901134        return r;
    8911135}
    8921136
    893 /** \ingroup dev
     1137/** \ingroup libusb_dev
    8941138 * Increment the reference count of a device.
    8951139 * \param dev the device to reference
     
    9051149}
    9061150
    907 /** \ingroup dev
     1151/** \ingroup libusb_dev
    9081152 * Decrement the reference count of a device. If the decrement operation
    9091153 * causes the reference count to reach zero, the device shall be destroyed.
     
    9231167        if (refcnt == 0) {
    9241168                usbi_dbg("destroy device %d.%d", dev->bus_number, dev->device_address);
     1169
     1170                libusb_unref_device(dev->parent_dev);
    9251171
    9261172                if (usbi_backend->destroy_device)
     
    9381184
    9391185/*
    940  * Interrupt the iteration of the event handling thread, so that it picks
    941  * up the new fd.
    942  */
    943 void usbi_fd_notification(struct libusb_context *ctx)
     1186 * Signal the event pipe so that the event handling thread will be
     1187 * interrupted to process an internal event.
     1188 */
     1189int usbi_signal_event(struct libusb_context *ctx)
    9441190{
    9451191        unsigned char dummy = 1;
    9461192        ssize_t r;
    9471193
    948         if (ctx == NULL)
    949                 return;
    950 
    951         /* record that we are messing with poll fds */
    952         usbi_mutex_lock(&ctx->pollfd_modify_lock);
    953         ctx->pollfd_modify++;
    954         usbi_mutex_unlock(&ctx->pollfd_modify_lock);
    955 
    956         /* write some data on control pipe to interrupt event handlers */
    957         r = usbi_write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
    958         if (r <= 0) {
     1194        /* write some data on event pipe to interrupt event handlers */
     1195        r = usbi_write(ctx->event_pipe[1], &dummy, sizeof(dummy));
     1196        if (r != sizeof(dummy)) {
    9591197                usbi_warn(ctx, "internal signalling write failed");
    960                 usbi_mutex_lock(&ctx->pollfd_modify_lock);
    961                 ctx->pollfd_modify--;
    962                 usbi_mutex_unlock(&ctx->pollfd_modify_lock);
    963                 return;
    964         }
    965 
    966         /* take event handling lock */
    967         libusb_lock_events(ctx);
    968 
    969         /* read the dummy data */
    970         r = usbi_read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy));
    971         if (r <= 0)
     1198                return LIBUSB_ERROR_IO;
     1199        }
     1200
     1201        return 0;
     1202}
     1203
     1204/*
     1205 * Clear the event pipe so that the event handling will no longer be
     1206 * interrupted.
     1207 */
     1208int usbi_clear_event(struct libusb_context *ctx)
     1209{
     1210        unsigned char dummy;
     1211        ssize_t r;
     1212
     1213        /* read some data on event pipe to clear it */
     1214        r = usbi_read(ctx->event_pipe[0], &dummy, sizeof(dummy));
     1215        if (r != sizeof(dummy)) {
    9721216                usbi_warn(ctx, "internal signalling read failed");
    973 
    974         /* we're done with modifying poll fds */
    975         usbi_mutex_lock(&ctx->pollfd_modify_lock);
    976         ctx->pollfd_modify--;
    977         usbi_mutex_unlock(&ctx->pollfd_modify_lock);
    978 
    979         /* Release event handling lock and wake up event waiters */
    980         libusb_unlock_events(ctx);
    981 }
    982 
    983 /** \ingroup dev
     1217                return LIBUSB_ERROR_IO;
     1218        }
     1219
     1220        return 0;
     1221}
     1222
     1223/** \ingroup libusb_dev
    9841224 * Open a device and obtain a device handle. A handle allows you to perform
    9851225 * I/O on the device in question.
     
    9921232 *
    9931233 * \param dev the device to open
    994  * \param handle output location for the returned device handle pointer. Only
     1234 * \param dev_handle output location for the returned device handle pointer. Only
    9951235 * populated when the return code is 0.
    9961236 * \returns 0 on success
     
    10011241 */
    10021242int API_EXPORTED libusb_open(libusb_device *dev,
    1003         libusb_device_handle **handle)
     1243        libusb_device_handle **dev_handle)
    10041244{
    10051245        struct libusb_context *ctx = DEVICE_CTX(dev);
    1006         struct libusb_device_handle *_handle;
     1246        struct libusb_device_handle *_dev_handle;
    10071247        size_t priv_size = usbi_backend->device_handle_priv_size;
    10081248        int r;
     
    10131253        }
    10141254
    1015         _handle = malloc(sizeof(*_handle) + priv_size);
    1016         if (!_handle)
     1255        _dev_handle = malloc(sizeof(*_dev_handle) + priv_size);
     1256        if (!_dev_handle)
    10171257                return LIBUSB_ERROR_NO_MEM;
    10181258
    1019         r = usbi_mutex_init(&_handle->lock, NULL);
     1259        r = usbi_mutex_init(&_dev_handle->lock);
    10201260        if (r) {
    1021                 free(_handle);
     1261                free(_dev_handle);
    10221262                return LIBUSB_ERROR_OTHER;
    10231263        }
    10241264
    1025         _handle->dev = libusb_ref_device(dev);
    1026         _handle->claimed_interfaces = 0;
    1027         memset(&_handle->os_priv, 0, priv_size);
    1028 
    1029         r = usbi_backend->open(_handle);
     1265        _dev_handle->dev = libusb_ref_device(dev);
     1266        _dev_handle->auto_detach_kernel_driver = 0;
     1267        _dev_handle->claimed_interfaces = 0;
     1268        memset(&_dev_handle->os_priv, 0, priv_size);
     1269
     1270        r = usbi_backend->open(_dev_handle);
    10301271        if (r < 0) {
    10311272                usbi_dbg("open %d.%d returns %d", dev->bus_number, dev->device_address, r);
    10321273                libusb_unref_device(dev);
    1033                 usbi_mutex_destroy(&_handle->lock);
    1034                 free(_handle);
     1274                usbi_mutex_destroy(&_dev_handle->lock);
     1275                free(_dev_handle);
    10351276                return r;
    10361277        }
    10371278
    10381279        usbi_mutex_lock(&ctx->open_devs_lock);
    1039         list_add(&_handle->list, &ctx->open_devs);
     1280        list_add(&_dev_handle->list, &ctx->open_devs);
    10401281        usbi_mutex_unlock(&ctx->open_devs_lock);
    1041         *handle = _handle;
    1042 
    1043         /* At this point, we want to interrupt any existing event handlers so
    1044          * that they realise the addition of the new device's poll fd. One
    1045          * example when this is desirable is if the user is running a separate
    1046          * dedicated libusb events handling thread, which is running with a long
    1047          * or infinite timeout. We want to interrupt that iteration of the loop,
    1048          * so that it picks up the new fd, and then continues. */
    1049         usbi_fd_notification(ctx);
     1282        *dev_handle = _dev_handle;
    10501283
    10511284        return 0;
    10521285}
    10531286
    1054 /** \ingroup dev
     1287/** \ingroup libusb_dev
    10551288 * Convenience function for finding a device with a particular
    10561289 * <tt>idVendor</tt>/<tt>idProduct</tt> combination. This function is intended
     
    10661299 * \param vendor_id the idVendor value to search for
    10671300 * \param product_id the idProduct value to search for
    1068  * \returns a handle for the first found device, or NULL on error or if the
    1069  * device could not be found. */
     1301 * \returns a device handle for the first found device, or NULL on error
     1302 * or if the device could not be found. */
    10701303DEFAULT_VISIBILITY
    10711304libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid(
     
    10751308        struct libusb_device *found = NULL;
    10761309        struct libusb_device *dev;
    1077         struct libusb_device_handle *handle = NULL;
     1310        struct libusb_device_handle *dev_handle = NULL;
    10781311        size_t i = 0;
    10791312        int r;
     
    10941327
    10951328        if (found) {
    1096                 r = libusb_open(found, &handle);
     1329                r = libusb_open(found, &dev_handle);
    10971330                if (r < 0)
    1098                         handle = NULL;
     1331                        dev_handle = NULL;
    10991332        }
    11001333
    11011334out:
    11021335        libusb_free_device_list(devs, 1);
    1103         return handle;
     1336        return dev_handle;
    11041337}
    11051338
     
    11091342        struct usbi_transfer *itransfer;
    11101343        struct usbi_transfer *tmp;
    1111 
    1112         libusb_lock_events(ctx);
    11131344
    11141345        /* remove any transfers in flight that are for this device */
     
    11181349        list_for_each_entry_safe(itransfer, tmp, &ctx->flying_transfers, list, struct usbi_transfer) {
    11191350                struct libusb_transfer *transfer =
    1120                         USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
     1351                        USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    11211352
    11221353                if (transfer->dev_handle != dev_handle)
    11231354                        continue;
    11241355
    1125                 if (!(itransfer->flags & USBI_TRANSFER_DEVICE_DISAPPEARED)) {
     1356                usbi_mutex_lock(&itransfer->lock);
     1357                if (!(itransfer->state_flags & USBI_TRANSFER_DEVICE_DISAPPEARED)) {
    11261358                        usbi_err(ctx, "Device handle closed while transfer was still being processed, but the device is still connected as far as we know");
    11271359
    1128                         if (itransfer->flags & USBI_TRANSFER_CANCELLING)
     1360                        if (itransfer->state_flags & USBI_TRANSFER_CANCELLING)
    11291361                                usbi_warn(ctx, "A cancellation for an in-flight transfer hasn't completed but closing the device handle");
    11301362                        else
    11311363                                usbi_err(ctx, "A cancellation hasn't even been scheduled on the transfer for which the device is closing");
    11321364                }
     1365                usbi_mutex_unlock(&itransfer->lock);
    11331366
    11341367                /* remove from the list of in-flight transfers and make sure
     
    11361369                 * (or that such accesses will be easily caught and identified as a crash)
    11371370                 */
    1138                 usbi_mutex_lock(&itransfer->lock);
    11391371                list_del(&itransfer->list);
    11401372                transfer->dev_handle = NULL;
    1141                 usbi_mutex_unlock(&itransfer->lock);
    11421373
    11431374                /* it is up to the user to free up the actual transfer struct.  this is
     
    11501381        usbi_mutex_unlock(&ctx->flying_transfers_lock);
    11511382
    1152         libusb_unlock_events(ctx);
    1153 
    11541383        usbi_mutex_lock(&ctx->open_devs_lock);
    11551384        list_del(&dev_handle->list);
     
    11621391}
    11631392
    1164 /** \ingroup dev
     1393/** \ingroup libusb_dev
    11651394 * Close a device handle. Should be called on all open handles before your
    11661395 * application exits.
     
    11711400 * This is a non-blocking function; no requests are sent over the bus.
    11721401 *
    1173  * \param dev_handle the handle to close
     1402 * \param dev_handle the device handle to close
    11741403 */
    11751404void API_EXPORTED libusb_close(libusb_device_handle *dev_handle)
    11761405{
    11771406        struct libusb_context *ctx;
    1178         unsigned char dummy = 1;
    1179         ssize_t r;
     1407        int handling_events;
     1408        int pending_events;
    11801409
    11811410        if (!dev_handle)
     
    11841413
    11851414        ctx = HANDLE_CTX(dev_handle);
     1415        handling_events = usbi_handling_events(ctx);
    11861416
    11871417        /* Similarly to libusb_open(), we want to interrupt all event handlers
     
    11891419         * the device while holding the event handling lock (preventing any other
    11901420         * thread from doing event handling) because we will be removing a file
    1191          * descriptor from the polling loop. */
    1192 
    1193         /* record that we are messing with poll fds */
    1194         usbi_mutex_lock(&ctx->pollfd_modify_lock);
    1195         ctx->pollfd_modify++;
    1196         usbi_mutex_unlock(&ctx->pollfd_modify_lock);
    1197 
    1198         /* write some data on control pipe to interrupt event handlers */
    1199         r = usbi_write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
    1200         if (r <= 0) {
    1201                 usbi_warn(ctx, "internal signalling write failed, closing anyway");
    1202                 do_close(ctx, dev_handle);
    1203                 usbi_mutex_lock(&ctx->pollfd_modify_lock);
    1204                 ctx->pollfd_modify--;
    1205                 usbi_mutex_unlock(&ctx->pollfd_modify_lock);
    1206                 return;
    1207         }
    1208 
    1209         /* take event handling lock */
    1210         libusb_lock_events(ctx);
    1211 
    1212         /* read the dummy data */
    1213         r = usbi_read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy));
    1214         if (r <= 0)
    1215                 usbi_warn(ctx, "internal signalling read failed, closing anyway");
     1421         * descriptor from the polling loop. If this is being called by the current
     1422         * event handler, we can bypass the interruption code because we already
     1423         * hold the event handling lock. */
     1424
     1425        if (!handling_events) {
     1426                /* Record that we are closing a device.
     1427                 * Only signal an event if there are no prior pending events. */
     1428                usbi_mutex_lock(&ctx->event_data_lock);
     1429                pending_events = usbi_pending_events(ctx);
     1430                ctx->device_close++;
     1431                if (!pending_events)
     1432                        usbi_signal_event(ctx);
     1433                usbi_mutex_unlock(&ctx->event_data_lock);
     1434
     1435                /* take event handling lock */
     1436                libusb_lock_events(ctx);
     1437        }
    12161438
    12171439        /* Close the device */
    12181440        do_close(ctx, dev_handle);
    12191441
    1220         /* we're done with modifying poll fds */
    1221         usbi_mutex_lock(&ctx->pollfd_modify_lock);
    1222         ctx->pollfd_modify--;
    1223         usbi_mutex_unlock(&ctx->pollfd_modify_lock);
    1224 
    1225         /* Release event handling lock and wake up event waiters */
    1226         libusb_unlock_events(ctx);
    1227 }
    1228 
    1229 /** \ingroup dev
    1230  * Get the underlying device for a handle. This function does not modify
     1442        if (!handling_events) {
     1443                /* We're done with closing this device.
     1444                 * Clear the event pipe if there are no further pending events. */
     1445                usbi_mutex_lock(&ctx->event_data_lock);
     1446                ctx->device_close--;
     1447                pending_events = usbi_pending_events(ctx);
     1448                if (!pending_events)
     1449                        usbi_clear_event(ctx);
     1450                usbi_mutex_unlock(&ctx->event_data_lock);
     1451
     1452                /* Release event handling lock and wake up event waiters */
     1453                libusb_unlock_events(ctx);
     1454        }
     1455}
     1456
     1457/** \ingroup libusb_dev
     1458 * Get the underlying device for a device handle. This function does not modify
    12311459 * the reference count of the returned device, so do not feel compelled to
    12321460 * unreference it when you are done.
     
    12401468}
    12411469
    1242 /** \ingroup dev
     1470/** \ingroup libusb_dev
    12431471 * Determine the bConfigurationValue of the currently active configuration.
    12441472 *
     
    12531481 * parameter if the device is in unconfigured state.
    12541482 *
    1255  * \param dev a device handle
     1483 * \param dev_handle a device handle
    12561484 * \param config output location for the bConfigurationValue of the active
    12571485 * configuration (only valid for return code 0)
     
    12601488 * \returns another LIBUSB_ERROR code on other failure
    12611489 */
    1262 int API_EXPORTED libusb_get_configuration(libusb_device_handle *dev,
     1490int API_EXPORTED libusb_get_configuration(libusb_device_handle *dev_handle,
    12631491        int *config)
    12641492{
     
    12671495        usbi_dbg("");
    12681496        if (usbi_backend->get_configuration)
    1269                 r = usbi_backend->get_configuration(dev, config);
     1497                r = usbi_backend->get_configuration(dev_handle, config);
    12701498
    12711499        if (r == LIBUSB_ERROR_NOT_SUPPORTED) {
    12721500                uint8_t tmp = 0;
    12731501                usbi_dbg("falling back to control message");
    1274                 r = libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN,
     1502                r = libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
    12751503                        LIBUSB_REQUEST_GET_CONFIGURATION, 0, 0, &tmp, 1, 1000);
    12761504                if (r == 0) {
    1277                         usbi_err(HANDLE_CTX(dev), "zero bytes returned in ctrl transfer?");
     1505                        usbi_err(HANDLE_CTX(dev_handle), "zero bytes returned in ctrl transfer?");
    12781506                        r = LIBUSB_ERROR_IO;
    12791507                } else if (r == 1) {
     
    12911519}
    12921520
    1293 /** \ingroup dev
     1521/** \ingroup libusb_dev
    12941522 * Set the active configuration for a device.
    12951523 *
     
    13061534 *
    13071535 * You cannot change/reset configuration if your application has claimed
    1308  * interfaces - you should free them with libusb_release_interface() first.
     1536 * interfaces. It is advised to set the desired configuration before claiming
     1537 * interfaces.
     1538 *
     1539 * Alternatively you can call libusb_release_interface() first. Note if you
     1540 * do things this way you must ensure that auto_detach_kernel_driver for
     1541 * <tt>dev</tt> is 0, otherwise the kernel driver will be re-attached when you
     1542 * release the interface(s).
     1543 *
    13091544 * You cannot change/reset configuration if other applications or drivers have
    13101545 * claimed interfaces.
     
    13201555 * This is a blocking function.
    13211556 *
    1322  * \param dev a device handle
     1557 * \param dev_handle a device handle
    13231558 * \param configuration the bConfigurationValue of the configuration you
    1324  * wish to activate, or -1 if you wish to put the device in unconfigured state
     1559 * wish to activate, or -1 if you wish to put the device in an unconfigured
     1560 * state
    13251561 * \returns 0 on success
    13261562 * \returns LIBUSB_ERROR_NOT_FOUND if the requested configuration does not exist
     
    13281564 * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
    13291565 * \returns another LIBUSB_ERROR code on other failure
    1330  */
    1331 int API_EXPORTED libusb_set_configuration(libusb_device_handle *dev,
     1566 * \see libusb_set_auto_detach_kernel_driver()
     1567 */
     1568int API_EXPORTED libusb_set_configuration(libusb_device_handle *dev_handle,
    13321569        int configuration)
    13331570{
    13341571        usbi_dbg("configuration %d", configuration);
    1335         return usbi_backend->set_configuration(dev, configuration);
    1336 }
    1337 
    1338 /** \ingroup dev
     1572        return usbi_backend->set_configuration(dev_handle, configuration);
     1573}
     1574
     1575/** \ingroup libusb_dev
    13391576 * Claim an interface on a given device handle. You must claim the interface
    13401577 * you wish to use before you can perform I/O on any of its endpoints.
     
    13421579 * It is legal to attempt to claim an already-claimed interface, in which
    13431580 * case libusb just returns 0 without doing anything.
     1581 *
     1582 * If auto_detach_kernel_driver is set to 1 for <tt>dev</tt>, the kernel driver
     1583 * will be detached if necessary, on failure the detach error is returned.
    13441584 *
    13451585 * Claiming of interfaces is a purely logical operation; it does not cause
     
    13501590 * This is a non-blocking function.
    13511591 *
    1352  * \param dev a device handle
     1592 * \param dev_handle a device handle
    13531593 * \param interface_number the <tt>bInterfaceNumber</tt> of the interface you
    13541594 * wish to claim
     
    13591599 * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
    13601600 * \returns a LIBUSB_ERROR code on other failure
    1361  */
    1362 int API_EXPORTED libusb_claim_interface(libusb_device_handle *dev,
     1601 * \see libusb_set_auto_detach_kernel_driver()
     1602 */
     1603int API_EXPORTED libusb_claim_interface(libusb_device_handle *dev_handle,
    13631604        int interface_number)
    13641605{
     
    13691610                return LIBUSB_ERROR_INVALID_PARAM;
    13701611
    1371         if (!dev->dev->attached)
     1612        if (!dev_handle->dev->attached)
    13721613                return LIBUSB_ERROR_NO_DEVICE;
    13731614
    1374         usbi_mutex_lock(&dev->lock);
    1375         if (dev->claimed_interfaces & (1 << interface_number))
     1615        usbi_mutex_lock(&dev_handle->lock);
     1616        if (dev_handle->claimed_interfaces & (1 << interface_number))
    13761617                goto out;
    13771618
    1378         r = usbi_backend->claim_interface(dev, interface_number);
     1619        r = usbi_backend->claim_interface(dev_handle, interface_number);
    13791620        if (r == 0)
    1380                 dev->claimed_interfaces |= 1 << interface_number;
     1621                dev_handle->claimed_interfaces |= 1 << interface_number;
    13811622
    13821623out:
    1383         usbi_mutex_unlock(&dev->lock);
     1624        usbi_mutex_unlock(&dev_handle->lock);
    13841625        return r;
    13851626}
    13861627
    1387 /** \ingroup dev
     1628/** \ingroup libusb_dev
    13881629 * Release an interface previously claimed with libusb_claim_interface(). You
    13891630 * should release all claimed interfaces before closing a device handle.
     
    13921633 * to the device, resetting interface state to the first alternate setting.
    13931634 *
    1394  * \param dev a device handle
     1635 * If auto_detach_kernel_driver is set to 1 for <tt>dev</tt>, the kernel
     1636 * driver will be re-attached after releasing the interface.
     1637 *
     1638 * \param dev_handle a device handle
    13951639 * \param interface_number the <tt>bInterfaceNumber</tt> of the
    13961640 * previously-claimed interface
     
    13991643 * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
    14001644 * \returns another LIBUSB_ERROR code on other failure
    1401  */
    1402 int API_EXPORTED libusb_release_interface(libusb_device_handle *dev,
     1645 * \see libusb_set_auto_detach_kernel_driver()
     1646 */
     1647int API_EXPORTED libusb_release_interface(libusb_device_handle *dev_handle,
    14031648        int interface_number)
    14041649{
     
    14091654                return LIBUSB_ERROR_INVALID_PARAM;
    14101655
    1411         usbi_mutex_lock(&dev->lock);
    1412         if (!(dev->claimed_interfaces & (1 << interface_number))) {
     1656        usbi_mutex_lock(&dev_handle->lock);
     1657        if (!(dev_handle->claimed_interfaces & (1 << interface_number))) {
    14131658                r = LIBUSB_ERROR_NOT_FOUND;
    14141659                goto out;
    14151660        }
    14161661
    1417         r = usbi_backend->release_interface(dev, interface_number);
     1662        r = usbi_backend->release_interface(dev_handle, interface_number);
    14181663        if (r == 0)
    1419                 dev->claimed_interfaces &= ~(1 << interface_number);
     1664                dev_handle->claimed_interfaces &= ~(1 << interface_number);
    14201665
    14211666out:
    1422         usbi_mutex_unlock(&dev->lock);
     1667        usbi_mutex_unlock(&dev_handle->lock);
    14231668        return r;
    14241669}
    14251670
    1426 /** \ingroup dev
     1671/** \ingroup libusb_dev
    14271672 * Activate an alternate setting for an interface. The interface must have
    14281673 * been previously claimed with libusb_claim_interface().
     
    14341679 * This is a blocking function.
    14351680 *
    1436  * \param dev a device handle
     1681 * \param dev_handle a device handle
    14371682 * \param interface_number the <tt>bInterfaceNumber</tt> of the
    14381683 * previously-claimed interface
     
    14451690 * \returns another LIBUSB_ERROR code on other failure
    14461691 */
    1447 int API_EXPORTED libusb_set_interface_alt_setting(libusb_device_handle *dev,
     1692int API_EXPORTED libusb_set_interface_alt_setting(libusb_device_handle *dev_handle,
    14481693        int interface_number, int alternate_setting)
    14491694{
     
    14531698                return LIBUSB_ERROR_INVALID_PARAM;
    14541699
    1455         usbi_mutex_lock(&dev->lock);
    1456         if (!dev->dev->attached) {
    1457                 usbi_mutex_unlock(&dev->lock);
     1700        usbi_mutex_lock(&dev_handle->lock);
     1701        if (!dev_handle->dev->attached) {
     1702                usbi_mutex_unlock(&dev_handle->lock);
    14581703                return LIBUSB_ERROR_NO_DEVICE;
    14591704        }
    14601705
    1461         if (!(dev->claimed_interfaces & (1 << interface_number))) {
    1462                 usbi_mutex_unlock(&dev->lock);
     1706        if (!(dev_handle->claimed_interfaces & (1 << interface_number))) {
     1707                usbi_mutex_unlock(&dev_handle->lock);
    14631708                return LIBUSB_ERROR_NOT_FOUND;
    14641709        }
    1465         usbi_mutex_unlock(&dev->lock);
    1466 
    1467         return usbi_backend->set_interface_altsetting(dev, interface_number,
     1710        usbi_mutex_unlock(&dev_handle->lock);
     1711
     1712        return usbi_backend->set_interface_altsetting(dev_handle, interface_number,
    14681713                alternate_setting);
    14691714}
    14701715
    1471 /** \ingroup dev
     1716/** \ingroup libusb_dev
    14721717 * Clear the halt/stall condition for an endpoint. Endpoints with halt status
    14731718 * are unable to receive or transmit data until the halt condition is stalled.
     
    14781723 * This is a blocking function.
    14791724 *
    1480  * \param dev a device handle
     1725 * \param dev_handle a device handle
    14811726 * \param endpoint the endpoint to clear halt status
    14821727 * \returns 0 on success
     
    14851730 * \returns another LIBUSB_ERROR code on other failure
    14861731 */
    1487 int API_EXPORTED libusb_clear_halt(libusb_device_handle *dev,
     1732int API_EXPORTED libusb_clear_halt(libusb_device_handle *dev_handle,
    14881733        unsigned char endpoint)
    14891734{
    14901735        usbi_dbg("endpoint %x", endpoint);
    1491         if (!dev->dev->attached)
     1736        if (!dev_handle->dev->attached)
    14921737                return LIBUSB_ERROR_NO_DEVICE;
    14931738
    1494         return usbi_backend->clear_halt(dev, endpoint);
    1495 }
    1496 
    1497 /** \ingroup dev
     1739        return usbi_backend->clear_halt(dev_handle, endpoint);
     1740}
     1741
     1742/** \ingroup libusb_dev
    14981743 * Perform a USB port reset to reinitialize a device. The system will attempt
    14991744 * to restore the previous configuration and alternate settings after the
     
    15081753 * This is a blocking function which usually incurs a noticeable delay.
    15091754 *
    1510  * \param dev a handle of the device to reset
     1755 * \param dev_handle a handle of the device to reset
    15111756 * \returns 0 on success
    15121757 * \returns LIBUSB_ERROR_NOT_FOUND if re-enumeration is required, or if the
     
    15141759 * \returns another LIBUSB_ERROR code on other failure
    15151760 */
    1516 int API_EXPORTED libusb_reset_device(libusb_device_handle *dev)
     1761int API_EXPORTED libusb_reset_device(libusb_device_handle *dev_handle)
    15171762{
    15181763        usbi_dbg("");
    1519         if (!dev->dev->attached)
     1764        if (!dev_handle->dev->attached)
    15201765                return LIBUSB_ERROR_NO_DEVICE;
    15211766
    1522         return usbi_backend->reset_device(dev);
    1523 }
    1524 
    1525 /** \ingroup dev
     1767        return usbi_backend->reset_device(dev_handle);
     1768}
     1769
     1770/** \ingroup libusb_asyncio
     1771 * Allocate up to num_streams usb bulk streams on the specified endpoints. This
     1772 * function takes an array of endpoints rather then a single endpoint because
     1773 * some protocols require that endpoints are setup with similar stream ids.
     1774 * All endpoints passed in must belong to the same interface.
     1775 *
     1776 * Note this function may return less streams then requested. Also note that the
     1777 * same number of streams are allocated for each endpoint in the endpoint array.
     1778 *
     1779 * Stream id 0 is reserved, and should not be used to communicate with devices.
     1780 * If libusb_alloc_streams() returns with a value of N, you may use stream ids
     1781 * 1 to N.
     1782 *
     1783 * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103
     1784 *
     1785 * \param dev_handle a device handle
     1786 * \param num_streams number of streams to try to allocate
     1787 * \param endpoints array of endpoints to allocate streams on
     1788 * \param num_endpoints length of the endpoints array
     1789 * \returns number of streams allocated, or a LIBUSB_ERROR code on failure
     1790 */
     1791int API_EXPORTED libusb_alloc_streams(libusb_device_handle *dev_handle,
     1792        uint32_t num_streams, unsigned char *endpoints, int num_endpoints)
     1793{
     1794        usbi_dbg("streams %u eps %d", (unsigned) num_streams, num_endpoints);
     1795
     1796        if (!dev_handle->dev->attached)
     1797                return LIBUSB_ERROR_NO_DEVICE;
     1798
     1799        if (usbi_backend->alloc_streams)
     1800                return usbi_backend->alloc_streams(dev_handle, num_streams, endpoints,
     1801                                                   num_endpoints);
     1802        else
     1803                return LIBUSB_ERROR_NOT_SUPPORTED;
     1804}
     1805
     1806/** \ingroup libusb_asyncio
     1807 * Free usb bulk streams allocated with libusb_alloc_streams().
     1808 *
     1809 * Note streams are automatically free-ed when releasing an interface.
     1810 *
     1811 * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103
     1812 *
     1813 * \param dev_handle a device handle
     1814 * \param endpoints array of endpoints to free streams on
     1815 * \param num_endpoints length of the endpoints array
     1816 * \returns LIBUSB_SUCCESS, or a LIBUSB_ERROR code on failure
     1817 */
     1818int API_EXPORTED libusb_free_streams(libusb_device_handle *dev_handle,
     1819        unsigned char *endpoints, int num_endpoints)
     1820{
     1821        usbi_dbg("eps %d", num_endpoints);
     1822
     1823        if (!dev_handle->dev->attached)
     1824                return LIBUSB_ERROR_NO_DEVICE;
     1825
     1826        if (usbi_backend->free_streams)
     1827                return usbi_backend->free_streams(dev_handle, endpoints,
     1828                                                  num_endpoints);
     1829        else
     1830                return LIBUSB_ERROR_NOT_SUPPORTED;
     1831}
     1832
     1833/** \ingroup libusb_asyncio
     1834 * Attempts to allocate a block of persistent DMA memory suitable for transfers
     1835 * against the given device. If successful, will return a block of memory
     1836 * that is suitable for use as "buffer" in \ref libusb_transfer against this
     1837 * device. Using this memory instead of regular memory means that the host
     1838 * controller can use DMA directly into the buffer to increase performance, and
     1839 * also that transfers can no longer fail due to kernel memory fragmentation.
     1840 *
     1841 * Note that this means you should not modify this memory (or even data on
     1842 * the same cache lines) when a transfer is in progress, although it is legal
     1843 * to have several transfers going on within the same memory block.
     1844 *
     1845 * Will return NULL on failure. Many systems do not support such zerocopy
     1846 * and will always return NULL. Memory allocated with this function must be
     1847 * freed with \ref libusb_dev_mem_free. Specifically, this means that the
     1848 * flag \ref LIBUSB_TRANSFER_FREE_BUFFER cannot be used to free memory allocated
     1849 * with this function.
     1850 *
     1851 * Since version 1.0.21, \ref LIBUSB_API_VERSION >= 0x01000105
     1852 *
     1853 * \param dev_handle a device handle
     1854 * \param length size of desired data buffer
     1855 * \returns a pointer to the newly allocated memory, or NULL on failure
     1856 */
     1857DEFAULT_VISIBILITY
     1858unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle,
     1859        size_t length)
     1860{
     1861        if (!dev_handle->dev->attached)
     1862                return NULL;
     1863
     1864        if (usbi_backend->dev_mem_alloc)
     1865                return usbi_backend->dev_mem_alloc(dev_handle, length);
     1866        else
     1867                return NULL;
     1868}
     1869
     1870/** \ingroup libusb_asyncio
     1871 * Free device memory allocated with libusb_dev_mem_alloc().
     1872 *
     1873 * \param dev_handle a device handle
     1874 * \param buffer pointer to the previously allocated memory
     1875 * \param length size of previously allocated memory
     1876 * \returns LIBUSB_SUCCESS, or a LIBUSB_ERROR code on failure
     1877 */
     1878int API_EXPORTED libusb_dev_mem_free(libusb_device_handle *dev_handle,
     1879        unsigned char *buffer, size_t length)
     1880{
     1881        if (usbi_backend->dev_mem_free)
     1882                return usbi_backend->dev_mem_free(dev_handle, buffer, length);
     1883        else
     1884                return LIBUSB_ERROR_NOT_SUPPORTED;
     1885}
     1886
     1887/** \ingroup libusb_dev
    15261888 * Determine if a kernel driver is active on an interface. If a kernel driver
    15271889 * is active, you cannot claim the interface, and libusb will be unable to
     
    15301892 * This functionality is not available on Windows.
    15311893 *
    1532  * \param dev a device handle
     1894 * \param dev_handle a device handle
    15331895 * \param interface_number the interface to check
    15341896 * \returns 0 if no kernel driver is active
     
    15401902 * \see libusb_detach_kernel_driver()
    15411903 */
    1542 int API_EXPORTED libusb_kernel_driver_active(libusb_device_handle *dev,
     1904int API_EXPORTED libusb_kernel_driver_active(libusb_device_handle *dev_handle,
    15431905        int interface_number)
    15441906{
    15451907        usbi_dbg("interface %d", interface_number);
    15461908
    1547         if (!dev->dev->attached)
     1909        if (!dev_handle->dev->attached)
    15481910                return LIBUSB_ERROR_NO_DEVICE;
    15491911
    15501912        if (usbi_backend->kernel_driver_active)
    1551                 return usbi_backend->kernel_driver_active(dev, interface_number);
     1913                return usbi_backend->kernel_driver_active(dev_handle, interface_number);
    15521914        else
    15531915                return LIBUSB_ERROR_NOT_SUPPORTED;
    15541916}
    15551917
    1556 /** \ingroup dev
     1918/** \ingroup libusb_dev
    15571919 * Detach a kernel driver from an interface. If successful, you will then be
    15581920 * able to claim the interface and perform I/O.
     
    15601922 * This functionality is not available on Darwin or Windows.
    15611923 *
    1562  * \param dev a device handle
     1924 * Note that libusb itself also talks to the device through a special kernel
     1925 * driver, if this driver is already attached to the device, this call will
     1926 * not detach it and return LIBUSB_ERROR_NOT_FOUND.
     1927 *
     1928 * \param dev_handle a device handle
    15631929 * \param interface_number the interface to detach the driver from
    15641930 * \returns 0 on success
     
    15711937 * \see libusb_kernel_driver_active()
    15721938 */
    1573 int API_EXPORTED libusb_detach_kernel_driver(libusb_device_handle *dev,
     1939int API_EXPORTED libusb_detach_kernel_driver(libusb_device_handle *dev_handle,
    15741940        int interface_number)
    15751941{
    15761942        usbi_dbg("interface %d", interface_number);
    15771943
    1578         if (!dev->dev->attached)
     1944        if (!dev_handle->dev->attached)
    15791945                return LIBUSB_ERROR_NO_DEVICE;
    15801946
    15811947        if (usbi_backend->detach_kernel_driver)
    1582                 return usbi_backend->detach_kernel_driver(dev, interface_number);
     1948                return usbi_backend->detach_kernel_driver(dev_handle, interface_number);
    15831949        else
    15841950                return LIBUSB_ERROR_NOT_SUPPORTED;
    15851951}
    15861952
    1587 /** \ingroup dev
     1953/** \ingroup libusb_dev
    15881954 * Re-attach an interface's kernel driver, which was previously detached
    15891955 * using libusb_detach_kernel_driver(). This call is only effective on
     
    15921958 * This functionality is not available on Darwin or Windows.
    15931959 *
    1594  * \param dev a device handle
     1960 * \param dev_handle a device handle
    15951961 * \param interface_number the interface to attach the driver from
    15961962 * \returns 0 on success
     
    16051971 * \see libusb_kernel_driver_active()
    16061972 */
    1607 int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev,
     1973int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev_handle,
    16081974        int interface_number)
    16091975{
    16101976        usbi_dbg("interface %d", interface_number);
    16111977
    1612         if (!dev->dev->attached)
     1978        if (!dev_handle->dev->attached)
    16131979                return LIBUSB_ERROR_NO_DEVICE;
    16141980
    16151981        if (usbi_backend->attach_kernel_driver)
    1616                 return usbi_backend->attach_kernel_driver(dev, interface_number);
     1982                return usbi_backend->attach_kernel_driver(dev_handle, interface_number);
    16171983        else
    16181984                return LIBUSB_ERROR_NOT_SUPPORTED;
    16191985}
    16201986
    1621 /** \ingroup lib
    1622  * Set message verbosity.
    1623  *  - Level 0: no messages ever printed by the library (default)
    1624  *  - Level 1: error messages are printed to stderr
    1625  *  - Level 2: warning and error messages are printed to stderr
    1626  *  - Level 3: informational messages are printed to stdout, warning and error
    1627  *    messages are printed to stderr
    1628  *
    1629  * The default level is 0, which means no messages are ever printed. If you
    1630  * choose to increase the message verbosity level, ensure that your
    1631  * application does not close the stdout/stderr file descriptors.
    1632  *
    1633  * You are advised to set level 3. libusb is conservative with its message
    1634  * logging and most of the time, will only log messages that explain error
    1635  * conditions and other oddities. This will help you debug your software.
     1987/** \ingroup libusb_dev
     1988 * Enable/disable libusb's automatic kernel driver detachment. When this is
     1989 * enabled libusb will automatically detach the kernel driver on an interface
     1990 * when claiming the interface, and attach it when releasing the interface.
     1991 *
     1992 * Automatic kernel driver detachment is disabled on newly opened device
     1993 * handles by default.
     1994 *
     1995 * On platforms which do not have LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER
     1996 * this function will return LIBUSB_ERROR_NOT_SUPPORTED, and libusb will
     1997 * continue as if this function was never called.
     1998 *
     1999 * \param dev_handle a device handle
     2000 * \param enable whether to enable or disable auto kernel driver detachment
     2001 *
     2002 * \returns LIBUSB_SUCCESS on success
     2003 * \returns LIBUSB_ERROR_NOT_SUPPORTED on platforms where the functionality
     2004 * is not available
     2005 * \see libusb_claim_interface()
     2006 * \see libusb_release_interface()
     2007 * \see libusb_set_configuration()
     2008 */
     2009int API_EXPORTED libusb_set_auto_detach_kernel_driver(
     2010        libusb_device_handle *dev_handle, int enable)
     2011{
     2012        if (!(usbi_backend->caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER))
     2013                return LIBUSB_ERROR_NOT_SUPPORTED;
     2014
     2015        dev_handle->auto_detach_kernel_driver = enable;
     2016        return LIBUSB_SUCCESS;
     2017}
     2018
     2019/** \ingroup libusb_lib
     2020 * Set log message verbosity.
     2021 *
     2022 * The default level is LIBUSB_LOG_LEVEL_NONE, which means no messages are ever
     2023 * printed. If you choose to increase the message verbosity level, ensure
     2024 * that your application does not close the stdout/stderr file descriptors.
     2025 *
     2026 * You are advised to use level LIBUSB_LOG_LEVEL_WARNING. libusb is conservative
     2027 * with its message logging and most of the time, will only log messages that
     2028 * explain error conditions and other oddities. This will help you debug
     2029 * your software.
    16362030 *
    16372031 * If the LIBUSB_DEBUG environment variable was set when libusb was
     
    16552049}
    16562050
    1657 /** \ingroup lib
     2051/** \ingroup libusb_lib
    16582052 * Initialize libusb. This function must be called before calling any other
    16592053 * libusb function.
     
    16662060 * Only valid on return code 0.
    16672061 * \returns 0 on success, or a LIBUSB_ERROR code on failure
    1668  * \see contexts
     2062 * \see libusb_contexts
    16692063 */
    16702064int API_EXPORTED libusb_init(libusb_context **context)
    16712065{
     2066        struct libusb_device *dev, *next;
    16722067        char *dbg = getenv("LIBUSB_DEBUG");
    16732068        struct libusb_context *ctx;
     
    16762071
    16772072        usbi_mutex_static_lock(&default_context_lock);
     2073
     2074        if (!timestamp_origin.tv_sec) {
     2075                usbi_gettimeofday(&timestamp_origin, NULL);
     2076        }
     2077
    16782078        if (!context && usbi_default_context) {
    16792079                usbi_dbg("reusing default context");
     
    16832083        }
    16842084
    1685         ctx = malloc(sizeof(*ctx));
     2085        ctx = calloc(1, sizeof(*ctx));
    16862086        if (!ctx) {
    16872087                r = LIBUSB_ERROR_NO_MEM;
    16882088                goto err_unlock;
    16892089        }
    1690         memset(ctx, 0, sizeof(*ctx));
     2090
     2091#ifdef ENABLE_DEBUG_LOGGING
     2092        ctx->debug = LIBUSB_LOG_LEVEL_DEBUG;
     2093#endif
    16912094
    16922095        if (dbg) {
     
    16962099        }
    16972100
    1698         usbi_dbg("libusb-%d.%d.%d%s%s%s",
    1699                  libusb_version_internal.major,
    1700                  libusb_version_internal.minor,
    1701                  libusb_version_internal.micro,
    1702                  libusb_version_internal.rc,
    1703                  libusb_version_internal.describe[0] ? " git:" : "",
    1704                  libusb_version_internal.describe);
    1705 
    1706         usbi_mutex_init(&ctx->usb_devs_lock, NULL);
    1707         usbi_mutex_init(&ctx->open_devs_lock, NULL);
    1708         usbi_mutex_init(&ctx->hotplug_cbs_lock, NULL);
     2101        /* default context should be initialized before calling usbi_dbg */
     2102        if (!usbi_default_context) {
     2103                usbi_default_context = ctx;
     2104                default_context_refcnt++;
     2105                usbi_dbg("created default context");
     2106        }
     2107
     2108        usbi_dbg("libusb v%u.%u.%u.%u%s", libusb_version_internal.major, libusb_version_internal.minor,
     2109                libusb_version_internal.micro, libusb_version_internal.nano, libusb_version_internal.rc);
     2110
     2111        usbi_mutex_init(&ctx->usb_devs_lock);
     2112        usbi_mutex_init(&ctx->open_devs_lock);
     2113        usbi_mutex_init(&ctx->hotplug_cbs_lock);
    17092114        list_init(&ctx->usb_devs);
    17102115        list_init(&ctx->open_devs);
    17112116        list_init(&ctx->hotplug_cbs);
     2117
     2118        usbi_mutex_static_lock(&active_contexts_lock);
     2119        if (first_init) {
     2120                first_init = 0;
     2121                list_init (&active_contexts_list);
     2122        }
     2123        list_add (&ctx->list, &active_contexts_list);
     2124        usbi_mutex_static_unlock(&active_contexts_lock);
    17122125
    17132126        if (usbi_backend->init) {
     
    17182131
    17192132        r = usbi_io_init(ctx);
    1720         if (r < 0) {
    1721                 if (usbi_backend->exit)
    1722                         usbi_backend->exit();
    1723                 goto err_destroy_mutex;
    1724         }
    1725 
    1726         if (context) {
     2133        if (r < 0)
     2134                goto err_backend_exit;
     2135
     2136        usbi_mutex_static_unlock(&default_context_lock);
     2137
     2138        if (context)
    17272139                *context = ctx;
    1728         } else if (!usbi_default_context) {
    1729                 usbi_dbg("created default context");
    1730                 usbi_default_context = ctx;
    1731                 default_context_refcnt++;
    1732         }
    1733         usbi_mutex_static_unlock(&default_context_lock);
    1734 
    1735         usbi_mutex_static_lock(&active_contexts_lock);
    1736         if (first_init) {
    1737                 first_init = 0;
    1738                 list_init (&active_contexts_list);
    1739         }
    1740 
    1741         list_add (&ctx->list, &active_contexts_list);
    1742         usbi_mutex_static_unlock(&active_contexts_lock);
    17432140
    17442141        return 0;
    17452142
    1746 err_destroy_mutex:
     2143err_backend_exit:
     2144        if (usbi_backend->exit)
     2145                usbi_backend->exit();
     2146err_free_ctx:
     2147        if (ctx == usbi_default_context) {
     2148                usbi_default_context = NULL;
     2149                default_context_refcnt--;
     2150        }
     2151
     2152        usbi_mutex_static_lock(&active_contexts_lock);
     2153        list_del (&ctx->list);
     2154        usbi_mutex_static_unlock(&active_contexts_lock);
     2155
     2156        usbi_mutex_lock(&ctx->usb_devs_lock);
     2157        list_for_each_entry_safe(dev, next, &ctx->usb_devs, list, struct libusb_device) {
     2158                list_del(&dev->list);
     2159                libusb_unref_device(dev);
     2160        }
     2161        usbi_mutex_unlock(&ctx->usb_devs_lock);
     2162
    17472163        usbi_mutex_destroy(&ctx->open_devs_lock);
    17482164        usbi_mutex_destroy(&ctx->usb_devs_lock);
    1749 err_free_ctx:
     2165        usbi_mutex_destroy(&ctx->hotplug_cbs_lock);
     2166
    17502167        free(ctx);
    17512168err_unlock:
     
    17542171}
    17552172
    1756 /** \ingroup lib
     2173/** \ingroup libusb_lib
    17572174 * Deinitialize libusb. Should be called after closing all open devices and
    17582175 * before your application terminates.
     
    17612178void API_EXPORTED libusb_exit(struct libusb_context *ctx)
    17622179{
     2180        struct libusb_device *dev, *next;
     2181        struct timeval tv = { 0, 0 };
     2182
    17632183        usbi_dbg("");
    17642184        USBI_GET_CONTEXT(ctx);
     
    17662186        /* if working with default context, only actually do the deinitialization
    17672187         * if we're the last user */
     2188        usbi_mutex_static_lock(&default_context_lock);
    17682189        if (ctx == usbi_default_context) {
    1769                 usbi_mutex_static_lock(&default_context_lock);
    17702190                if (--default_context_refcnt > 0) {
    17712191                        usbi_dbg("not destroying default context");
     
    17752195                usbi_dbg("destroying default context");
    17762196                usbi_default_context = NULL;
    1777                 usbi_mutex_static_unlock(&default_context_lock);
    1778         }
    1779 
    1780         usbi_mutex_static_lock(&active_contexts_lock);
    1781         list_del (&ctx->list);
    1782         usbi_mutex_static_unlock(&active_contexts_lock);
    1783 
    1784         usbi_hotplug_deregister_all(ctx);
    1785 
    1786         /* a little sanity check. doesn't bother with open_devs locking because
    1787          * unless there is an application bug, nobody will be accessing this. */
     2197        }
     2198        usbi_mutex_static_unlock(&default_context_lock);
     2199
     2200        usbi_mutex_static_lock(&active_contexts_lock);
     2201        list_del (&ctx->list);
     2202        usbi_mutex_static_unlock(&active_contexts_lock);
     2203
     2204        if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
     2205                usbi_hotplug_deregister_all(ctx);
     2206
     2207                /*
     2208                 * Ensure any pending unplug events are read from the hotplug
     2209                 * pipe. The usb_device-s hold in the events are no longer part
     2210                 * of usb_devs, but the events still hold a reference!
     2211                 *
     2212                 * Note we don't do this if the application has left devices
     2213                 * open (which implies a buggy app) to avoid packet completion
     2214                 * handlers running when the app does not expect them to run.
     2215                 */
     2216                if (list_empty(&ctx->open_devs))
     2217                        libusb_handle_events_timeout(ctx, &tv);
     2218
     2219                usbi_mutex_lock(&ctx->usb_devs_lock);
     2220                list_for_each_entry_safe(dev, next, &ctx->usb_devs, list, struct libusb_device) {
     2221                        list_del(&dev->list);
     2222                        libusb_unref_device(dev);
     2223                }
     2224                usbi_mutex_unlock(&ctx->usb_devs_lock);
     2225        }
     2226
     2227        /* a few sanity checks. don't bother with locking because unless
     2228         * there is an application bug, nobody will be accessing these. */
     2229        if (!list_empty(&ctx->usb_devs))
     2230                usbi_warn(ctx, "some libusb_devices were leaked");
    17882231        if (!list_empty(&ctx->open_devs))
    17892232                usbi_warn(ctx, "application left some devices open");
     
    17992242}
    18002243
    1801 /** \ingroup misc
     2244/** \ingroup libusb_misc
    18022245 * Check at runtime if the loaded library has a given capability.
     2246 * This call should be performed after \ref libusb_init(), to ensure the
     2247 * backend has updated its capability set.
    18032248 *
    18042249 * \param capability the \ref libusb_capability to check for
    1805  * \returns 1 if the running library has the capability, 0 otherwise
     2250 * \returns nonzero if the running library has the capability, 0 otherwise
    18062251 */
    18072252int API_EXPORTED libusb_has_capability(uint32_t capability)
    18082253{
    1809         enum libusb_capability cap = capability;
    1810         switch (cap) {
     2254        switch (capability) {
    18112255        case LIBUSB_CAP_HAS_CAPABILITY:
    18122256                return 1;
    18132257        case LIBUSB_CAP_HAS_HOTPLUG:
    18142258                return !(usbi_backend->get_device_list);
     2259        case LIBUSB_CAP_HAS_HID_ACCESS:
     2260                return (usbi_backend->caps & USBI_CAP_HAS_HID_ACCESS);
     2261        case LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER:
     2262                return (usbi_backend->caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER);
    18152263        }
    18162264        return 0;
     
    18452293
    18462294int usbi_gettimeofday(struct timeval *tp, void *tzp)
    1847  {
    1848   union {
    1849     unsigned __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
    1850     FILETIME ft;
    1851   }  _now;
    1852 
    1853   if(tp)
    1854     {
    1855       GetSystemTimeAsFileTime (&_now.ft);
    1856       tp->tv_usec=(long)((_now.ns100 / 10) % 1000000 );
    1857       tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000);
    1858     }
    1859   /* Always return 0 as per Open Group Base Specifications Issue 6.
    1860      Do not set errno on error.  */
    1861   return 0;
    1862 }
     2295{
     2296        union {
     2297                unsigned __int64 ns100; /* Time since 1 Jan 1601, in 100ns units */
     2298                FILETIME ft;
     2299        } _now;
     2300        UNUSED(tzp);
     2301
     2302        if(tp) {
     2303#if defined(OS_WINCE)
     2304                SYSTEMTIME st;
     2305                GetSystemTime(&st);
     2306                SystemTimeToFileTime(&st, &_now.ft);
     2307#else
     2308                GetSystemTimeAsFileTime (&_now.ft);
    18632309#endif
    1864 
    1865 void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level,
     2310                tp->tv_usec=(long)((_now.ns100 / 10) % 1000000 );
     2311                tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000);
     2312        }
     2313        /* Always return 0 as per Open Group Base Specifications Issue 6.
     2314           Do not set errno on error.  */
     2315        return 0;
     2316}
     2317#endif
     2318
     2319static void usbi_log_str(struct libusb_context *ctx,
     2320        enum libusb_log_level level, const char * str)
     2321{
     2322#if defined(USE_SYSTEM_LOGGING_FACILITY)
     2323#if defined(OS_WINDOWS) || defined(OS_WINCE)
     2324        /* Windows CE only supports the Unicode version of OutputDebugString. */
     2325        WCHAR wbuf[USBI_MAX_LOG_LEN];
     2326        MultiByteToWideChar(CP_UTF8, 0, str, -1, wbuf, sizeof(wbuf));
     2327        OutputDebugStringW(wbuf);
     2328#elif defined(__ANDROID__)
     2329        int priority = ANDROID_LOG_UNKNOWN;
     2330        switch (level) {
     2331        case LIBUSB_LOG_LEVEL_INFO: priority = ANDROID_LOG_INFO; break;
     2332        case LIBUSB_LOG_LEVEL_WARNING: priority = ANDROID_LOG_WARN; break;
     2333        case LIBUSB_LOG_LEVEL_ERROR: priority = ANDROID_LOG_ERROR; break;
     2334        case LIBUSB_LOG_LEVEL_DEBUG: priority = ANDROID_LOG_DEBUG; break;
     2335        }
     2336        __android_log_write(priority, "libusb", str);
     2337#elif defined(HAVE_SYSLOG_FUNC)
     2338        int syslog_level = LOG_INFO;
     2339        switch (level) {
     2340        case LIBUSB_LOG_LEVEL_INFO: syslog_level = LOG_INFO; break;
     2341        case LIBUSB_LOG_LEVEL_WARNING: syslog_level = LOG_WARNING; break;
     2342        case LIBUSB_LOG_LEVEL_ERROR: syslog_level = LOG_ERR; break;
     2343        case LIBUSB_LOG_LEVEL_DEBUG: syslog_level = LOG_DEBUG; break;
     2344        }
     2345        syslog(syslog_level, "%s", str);
     2346#else /* All of gcc, Clang, XCode seem to use #warning */
     2347#warning System logging is not supported on this platform. Logging to stderr will be used instead.
     2348        fputs(str, stderr);
     2349#endif
     2350#else
     2351        fputs(str, stderr);
     2352#endif /* USE_SYSTEM_LOGGING_FACILITY */
     2353        UNUSED(ctx);
     2354        UNUSED(level);
     2355}
     2356
     2357void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
    18662358        const char *function, const char *format, va_list args)
    18672359{
    1868         FILE *stream = stdout;
    1869         const char *prefix;
     2360        const char *prefix = "";
     2361        char buf[USBI_MAX_LOG_LEN];
    18702362        struct timeval now;
    1871         static struct timeval first = { 0, 0 };
    1872 
    1873 #ifndef ENABLE_DEBUG_LOGGING
     2363        int global_debug, header_len, text_len;
     2364        static int has_debug_header_been_displayed = 0;
     2365
     2366#ifdef ENABLE_DEBUG_LOGGING
     2367        global_debug = 1;
     2368        UNUSED(ctx);
     2369#else
     2370        int ctx_level = 0;
     2371
    18742372        USBI_GET_CONTEXT(ctx);
    1875         if (!ctx)
     2373        if (ctx) {
     2374                ctx_level = ctx->debug;
     2375        } else {
     2376                char *dbg = getenv("LIBUSB_DEBUG");
     2377                if (dbg)
     2378                        ctx_level = atoi(dbg);
     2379        }
     2380        global_debug = (ctx_level == LIBUSB_LOG_LEVEL_DEBUG);
     2381        if (!ctx_level)
    18762382                return;
    1877         if (!ctx->debug)
     2383        if (level == LIBUSB_LOG_LEVEL_WARNING && ctx_level < LIBUSB_LOG_LEVEL_WARNING)
    18782384                return;
    1879         if (level == LOG_LEVEL_WARNING && ctx->debug < 2)
     2385        if (level == LIBUSB_LOG_LEVEL_INFO && ctx_level < LIBUSB_LOG_LEVEL_INFO)
    18802386                return;
    1881         if (level == LOG_LEVEL_INFO && ctx->debug < 3)
     2387        if (level == LIBUSB_LOG_LEVEL_DEBUG && ctx_level < LIBUSB_LOG_LEVEL_DEBUG)
    18822388                return;
    18832389#endif
    18842390
    18852391        usbi_gettimeofday(&now, NULL);
    1886         if (!first.tv_sec) {
    1887                 first.tv_sec = now.tv_sec;
    1888                 first.tv_usec = now.tv_usec;
    1889         }
    1890         if (now.tv_usec < first.tv_usec) {
     2392        if ((global_debug) && (!has_debug_header_been_displayed)) {
     2393                has_debug_header_been_displayed = 1;
     2394                usbi_log_str(ctx, LIBUSB_LOG_LEVEL_DEBUG, "[timestamp] [threadID] facility level [function call] <message>" USBI_LOG_LINE_END);
     2395                usbi_log_str(ctx, LIBUSB_LOG_LEVEL_DEBUG, "--------------------------------------------------------------------------------" USBI_LOG_LINE_END);
     2396        }
     2397        if (now.tv_usec < timestamp_origin.tv_usec) {
    18912398                now.tv_sec--;
    18922399                now.tv_usec += 1000000;
    18932400        }
    1894         now.tv_sec -= first.tv_sec;
    1895         now.tv_usec -= first.tv_usec;
     2401        now.tv_sec -= timestamp_origin.tv_sec;
     2402        now.tv_usec -= timestamp_origin.tv_usec;
    18962403
    18972404        switch (level) {
    1898         case LOG_LEVEL_INFO:
     2405        case LIBUSB_LOG_LEVEL_INFO:
    18992406                prefix = "info";
    19002407                break;
    1901         case LOG_LEVEL_WARNING:
    1902                 stream = stderr;
     2408        case LIBUSB_LOG_LEVEL_WARNING:
    19032409                prefix = "warning";
    19042410                break;
    1905         case LOG_LEVEL_ERROR:
    1906                 stream = stderr;
     2411        case LIBUSB_LOG_LEVEL_ERROR:
    19072412                prefix = "error";
    19082413                break;
    1909         case LOG_LEVEL_DEBUG:
    1910                 stream = stderr;
     2414        case LIBUSB_LOG_LEVEL_DEBUG:
    19112415                prefix = "debug";
    19122416                break;
     2417        case LIBUSB_LOG_LEVEL_NONE:
     2418                return;
    19132419        default:
    1914                 stream = stderr;
    19152420                prefix = "unknown";
    19162421                break;
    19172422        }
    19182423
    1919         fprintf(stream, "libusb: %d.%06d %s [%s] ",
    1920                 (int)now.tv_sec, (int)now.tv_usec, prefix, function);
    1921 
    1922         vfprintf(stream, format, args);
    1923 
    1924         fprintf(stream, "\n");
    1925 }
    1926 
    1927 void usbi_log(struct libusb_context *ctx, enum usbi_log_level level,
     2424        if (global_debug) {
     2425                header_len = snprintf(buf, sizeof(buf),
     2426                        "[%2d.%06d] [%08x] libusb: %s [%s] ",
     2427                        (int)now.tv_sec, (int)now.tv_usec, usbi_get_tid(), prefix, function);
     2428        } else {
     2429                header_len = snprintf(buf, sizeof(buf),
     2430                        "libusb: %s [%s] ", prefix, function);
     2431        }
     2432
     2433        if (header_len < 0 || header_len >= (int)sizeof(buf)) {
     2434                /* Somehow snprintf failed to write to the buffer,
     2435                 * remove the header so something useful is output. */
     2436                header_len = 0;
     2437        }
     2438        /* Make sure buffer is NUL terminated */
     2439        buf[header_len] = '\0';
     2440        text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len,
     2441                format, args);
     2442        if (text_len < 0 || text_len + header_len >= (int)sizeof(buf)) {
     2443                /* Truncated log output. On some platforms a -1 return value means
     2444                 * that the output was truncated. */
     2445                text_len = sizeof(buf) - header_len;
     2446        }
     2447        if (header_len + text_len + sizeof(USBI_LOG_LINE_END) >= sizeof(buf)) {
     2448                /* Need to truncate the text slightly to fit on the terminator. */
     2449                text_len -= (header_len + text_len + sizeof(USBI_LOG_LINE_END)) - sizeof(buf);
     2450        }
     2451        strcpy(buf + header_len + text_len, USBI_LOG_LINE_END);
     2452
     2453        usbi_log_str(ctx, level, buf);
     2454}
     2455
     2456void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
    19282457        const char *function, const char *format, ...)
    19292458{
     
    19352464}
    19362465
    1937 /** \ingroup misc
     2466/** \ingroup libusb_misc
    19382467 * Returns a constant NULL-terminated string with the ASCII name of a libusb
    1939  * error code. The caller must not free() the returned string.
    1940  *
    1941  * \param error_code The \ref libusb_error code to return the name of.
     2468 * error or transfer status code. The caller must not free() the returned
     2469 * string.
     2470 *
     2471 * \param error_code The \ref libusb_error or libusb_transfer_status code to
     2472 * return the name of.
    19422473 * \returns The error name, or the string **UNKNOWN** if the value of
    1943  * error_code is not a known error code.
     2474 * error_code is not a known error / status code.
    19442475 */
    19452476DEFAULT_VISIBILITY const char * LIBUSB_CALL libusb_error_name(int error_code)
    19462477{
    1947         enum libusb_error error = error_code;
    1948         switch (error) {
    1949         case LIBUSB_SUCCESS:
    1950                 return "LIBUSB_SUCCESS";
     2478        switch (error_code) {
    19512479        case LIBUSB_ERROR_IO:
    19522480                return "LIBUSB_ERROR_IO";
     
    19752503        case LIBUSB_ERROR_OTHER:
    19762504                return "LIBUSB_ERROR_OTHER";
    1977         }
    1978         return "**UNKNOWN**";
    1979 }
    1980 
    1981 /** \ingroup misc
     2505
     2506        case LIBUSB_TRANSFER_ERROR:
     2507                return "LIBUSB_TRANSFER_ERROR";
     2508        case LIBUSB_TRANSFER_TIMED_OUT:
     2509                return "LIBUSB_TRANSFER_TIMED_OUT";
     2510        case LIBUSB_TRANSFER_CANCELLED:
     2511                return "LIBUSB_TRANSFER_CANCELLED";
     2512        case LIBUSB_TRANSFER_STALL:
     2513                return "LIBUSB_TRANSFER_STALL";
     2514        case LIBUSB_TRANSFER_NO_DEVICE:
     2515                return "LIBUSB_TRANSFER_NO_DEVICE";
     2516        case LIBUSB_TRANSFER_OVERFLOW:
     2517                return "LIBUSB_TRANSFER_OVERFLOW";
     2518
     2519        case 0:
     2520                return "LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED";
     2521        default:
     2522                return "**UNKNOWN**";
     2523        }
     2524}
     2525
     2526/** \ingroup libusb_misc
    19822527 * Returns a pointer to const struct libusb_version with the version
    1983  * (major, minor, micro, rc, and nano) of the running library.
     2528 * (major, minor, micro, nano and rc) of the running library.
    19842529 */
    19852530DEFAULT_VISIBILITY
  • TabularUnified libusb1/trunk/libusb/descriptor.c

    r1876 r1882  
     1/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
    12/*
    23 * USB descriptor handling functions for libusb
    3  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
    4  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
    5  * Copyright (c) 2012-2013 Nathan Hjelm <hjelmn@cs.unm.edu>
     4 * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
     5 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    2020 */
    2121
     22#include <config.h>
     23
    2224#include <errno.h>
    2325#include <stdint.h>
    2426#include <stdlib.h>
    2527#include <string.h>
    26 #include <stdio.h>
    27 #include <assert.h>
    2828
    2929#include "libusbi.h"
     
    3636#define ENDPOINT_AUDIO_DESC_LENGTH      9
    3737
    38 /** @defgroup desc USB descriptors
     38/** @defgroup libusb_desc USB descriptors
    3939 * This page details how to examine the various standard USB descriptors
    4040 * for detected devices
     
    6969                                dp += 2;
    7070                                break;
    71                         /* 32-bit word, convert from little endian to CPU */
    72                         case 'd':
    73                         /* Align to word boundary */
    74                                 dp += ((unsigned long)dp & 1);
     71                        case 'd':       /* 32-bit word, convert from little endian to CPU */
     72                                dp += ((uintptr_t)dp & 1);      /* Align to word boundary */
    7573
    7674                                if (host_endian) {
     
    8482                                dp += 4;
    8583                                break;
     84                        case 'u':       /* 16 byte UUID */
     85                                memcpy(dp, sp, 16);
     86                                sp += 16;
     87                                dp += 16;
     88                                break;
    8689                }
    8790        }
     
    9295static void clear_endpoint(struct libusb_endpoint_descriptor *endpoint)
    9396{
    94         if (endpoint->extra)
    95                 free((unsigned char *) endpoint->extra);
     97        free((void *) endpoint->extra);
    9698}
    9799
     
    106108        int len;
    107109
     110        if (size < DESC_HEADER_LENGTH) {
     111                usbi_err(ctx, "short endpoint descriptor read %d/%d",
     112                         size, DESC_HEADER_LENGTH);
     113                return LIBUSB_ERROR_IO;
     114        }
     115
    108116        usbi_parse_descriptor(buffer, "bb", &header, 0);
    109 
    110         /* Everything should be fine being passed into here, but we sanity */
    111         /*  check JIC */
    112         if (header.bLength > size) {
    113                 usbi_err(ctx, "ran out of descriptors parsing");
    114                 return -1;
    115         }
    116 
    117117        if (header.bDescriptorType != LIBUSB_DT_ENDPOINT) {
    118118                usbi_err(ctx, "unexpected descriptor %x (expected %x)",
     
    120120                return parsed;
    121121        }
    122 
     122        if (header.bLength > size) {
     123                usbi_warn(ctx, "short endpoint descriptor read %d/%d",
     124                          size, header.bLength);
     125                return parsed;
     126        }
    123127        if (header.bLength >= ENDPOINT_AUDIO_DESC_LENGTH)
    124128                usbi_parse_descriptor(buffer, "bbbbwbbb", endpoint, host_endian);
    125129        else if (header.bLength >= ENDPOINT_DESC_LENGTH)
    126130                usbi_parse_descriptor(buffer, "bbbbwb", endpoint, host_endian);
     131        else {
     132                usbi_err(ctx, "invalid endpoint bLength (%d)", header.bLength);
     133                return LIBUSB_ERROR_IO;
     134        }
    127135
    128136        buffer += header.bLength;
     
    135143        while (size >= DESC_HEADER_LENGTH) {
    136144                usbi_parse_descriptor(buffer, "bb", &header, 0);
    137 
    138                 if (header.bLength < 2) {
    139                         usbi_err(ctx, "invalid descriptor length %d", header.bLength);
    140                         return -1;
     145                if (header.bLength < DESC_HEADER_LENGTH) {
     146                        usbi_err(ctx, "invalid extra ep desc len (%d)",
     147                                 header.bLength);
     148                        return LIBUSB_ERROR_IO;
     149                } else if (header.bLength > size) {
     150                        usbi_warn(ctx, "short extra ep desc read %d/%d",
     151                                  size, header.bLength);
     152                        return parsed;
    141153                }
    142154
    143155                /* If we find another "proper" descriptor then we're done  */
    144156                if ((header.bDescriptorType == LIBUSB_DT_ENDPOINT) ||
    145                     (header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
    146                     (header.bDescriptorType == LIBUSB_DT_CONFIG) ||
    147                     (header.bDescriptorType == LIBUSB_DT_DEVICE))
     157                                (header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
     158                                (header.bDescriptorType == LIBUSB_DT_CONFIG) ||
     159                                (header.bDescriptorType == LIBUSB_DT_DEVICE))
    148160                        break;
    149161
     
    186198                                (struct libusb_interface_descriptor *)
    187199                                usb_interface->altsetting + i;
    188                         if (ifp->extra)
    189                                 free((void *) ifp->extra);
     200                        free((void *) ifp->extra);
    190201                        if (ifp->endpoint) {
    191202                                for (j = 0; j < ifp->bNumEndpoints; j++)
    192203                                        clear_endpoint((struct libusb_endpoint_descriptor *)
    193                                                 ifp->endpoint + j);
    194                                 free((void *) ifp->endpoint);
     204                                                       ifp->endpoint + j);
    195205                        }
    196                 }
    197                 free((void *) usb_interface->altsetting);
    198                 usb_interface->altsetting = NULL;
    199         }
    200 
     206                        free((void *) ifp->endpoint);
     207                }
     208        }
     209        free((void *) usb_interface->altsetting);
     210        usb_interface->altsetting = NULL;
    201211}
    202212
     
    209219        int r;
    210220        int parsed = 0;
    211         size_t tmp;
     221        int interface_number = -1;
    212222        struct usb_descriptor_header header;
    213223        struct libusb_interface_descriptor *ifp;
     
    219229                struct libusb_interface_descriptor *altsetting =
    220230                        (struct libusb_interface_descriptor *) usb_interface->altsetting;
    221                 altsetting = realloc(altsetting,
     231                altsetting = usbi_reallocf(altsetting,
    222232                        sizeof(struct libusb_interface_descriptor) *
    223233                        (usb_interface->num_altsetting + 1));
     
    229239
    230240                ifp = altsetting + usb_interface->num_altsetting;
     241                usbi_parse_descriptor(buffer, "bbbbbbbbb", ifp, 0);
     242                if (ifp->bDescriptorType != LIBUSB_DT_INTERFACE) {
     243                        usbi_err(ctx, "unexpected descriptor %x (expected %x)",
     244                                 ifp->bDescriptorType, LIBUSB_DT_INTERFACE);
     245                        return parsed;
     246                }
     247                if (ifp->bLength < INTERFACE_DESC_LENGTH) {
     248                        usbi_err(ctx, "invalid interface bLength (%d)",
     249                                 ifp->bLength);
     250                        r = LIBUSB_ERROR_IO;
     251                        goto err;
     252                }
     253                if (ifp->bLength > size) {
     254                        usbi_warn(ctx, "short intf descriptor read %d/%d",
     255                                 size, ifp->bLength);
     256                        return parsed;
     257                }
     258                if (ifp->bNumEndpoints > USB_MAXENDPOINTS) {
     259                        usbi_err(ctx, "too many endpoints (%d)", ifp->bNumEndpoints);
     260                        r = LIBUSB_ERROR_IO;
     261                        goto err;
     262                }
     263
    231264                usb_interface->num_altsetting++;
    232                 usbi_parse_descriptor(buffer, "bbbbbbbbb", ifp, 0);
    233265                ifp->extra = NULL;
    234266                ifp->extra_length = 0;
    235267                ifp->endpoint = NULL;
     268
     269                if (interface_number == -1)
     270                        interface_number = ifp->bInterfaceNumber;
    236271
    237272                /* Skip over the interface */
     
    245280                while (size >= DESC_HEADER_LENGTH) {
    246281                        usbi_parse_descriptor(buffer, "bb", &header, 0);
    247                         if (header.bLength < 2) {
    248                                 usbi_err(ctx, "invalid descriptor of length %d",
    249                                         header.bLength);
     282                        if (header.bLength < DESC_HEADER_LENGTH) {
     283                                usbi_err(ctx,
     284                                         "invalid extra intf desc len (%d)",
     285                                         header.bLength);
    250286                                r = LIBUSB_ERROR_IO;
    251287                                goto err;
     288                        } else if (header.bLength > size) {
     289                                usbi_warn(ctx,
     290                                          "short extra intf desc read %d/%d",
     291                                          size, header.bLength);
     292                                return parsed;
    252293                        }
    253294
    254295                        /* If we find another "proper" descriptor then we're done */
    255296                        if ((header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
    256                             (header.bDescriptorType == LIBUSB_DT_ENDPOINT) ||
    257                             (header.bDescriptorType == LIBUSB_DT_CONFIG) ||
    258                             (header.bDescriptorType == LIBUSB_DT_DEVICE) ||
    259                             (header.bDescriptorType ==
    260                              LIBUSB_DT_SS_ENDPOINT_COMPANION))
     297                                        (header.bDescriptorType == LIBUSB_DT_ENDPOINT) ||
     298                                        (header.bDescriptorType == LIBUSB_DT_CONFIG) ||
     299                                        (header.bDescriptorType == LIBUSB_DT_DEVICE))
    261300                                break;
    262301
     
    279318                }
    280319
    281                 /* Did we hit an unexpected descriptor? */
    282                 if (size >= DESC_HEADER_LENGTH) {
    283                         usbi_parse_descriptor(buffer, "bb", &header, 0);
    284                         if ((header.bDescriptorType == LIBUSB_DT_CONFIG) ||
    285                             (header.bDescriptorType == LIBUSB_DT_DEVICE)) {
    286                                 return parsed;
    287                         }
    288                 }
    289 
    290                 if (ifp->bNumEndpoints > USB_MAXENDPOINTS) {
    291                         usbi_err(ctx, "too many endpoints (%d)", ifp->bNumEndpoints);
    292                         r = LIBUSB_ERROR_IO;
    293                         goto err;
    294                 }
    295 
    296320                if (ifp->bNumEndpoints > 0) {
    297321                        struct libusb_endpoint_descriptor *endpoint;
    298                         tmp = ifp->bNumEndpoints * sizeof(struct libusb_endpoint_descriptor);
    299                         endpoint = malloc(tmp);
     322                        endpoint = calloc(ifp->bNumEndpoints, sizeof(struct libusb_endpoint_descriptor));
    300323                        ifp->endpoint = endpoint;
    301324                        if (!endpoint) {
     
    304327                        }
    305328
    306                         memset(endpoint, 0, tmp);
    307329                        for (i = 0; i < ifp->bNumEndpoints; i++) {
    308                                 usbi_parse_descriptor(buffer, "bb", &header, 0);
    309 
    310                                 if (header.bLength > size) {
    311                                         usbi_err(ctx, "ran out of descriptors parsing");
    312                                         r = LIBUSB_ERROR_IO;
    313                                         goto err;
    314                                 }
    315 
    316330                                r = parse_endpoint(ctx, endpoint + i, buffer, size,
    317331                                        host_endian);
    318332                                if (r < 0)
    319333                                        goto err;
     334                                if (r == 0) {
     335                                        ifp->bNumEndpoints = (uint8_t)i;
     336                                        break;;
     337                                }
    320338
    321339                                buffer += r;
     
    329347                if (size < LIBUSB_DT_INTERFACE_SIZE ||
    330348                                ifp->bDescriptorType != LIBUSB_DT_INTERFACE ||
    331                                 !ifp->bAlternateSetting)
     349                                ifp->bInterfaceNumber != interface_number)
    332350                        return parsed;
    333351        }
     
    341359static void clear_configuration(struct libusb_config_descriptor *config)
    342360{
     361        int i;
    343362        if (config->interface) {
    344                 int i;
    345363                for (i = 0; i < config->bNumInterfaces; i++)
    346364                        clear_interface((struct libusb_interface *)
    347                                 config->interface + i);
    348                 free((void *) config->interface);
    349         }
    350         if (config->extra)
    351                 free((void *) config->extra);
     365                                        config->interface + i);
     366        }
     367        free((void *) config->interface);
     368        free((void *) config->extra);
    352369}
    353370
    354371static int parse_configuration(struct libusb_context *ctx,
    355372        struct libusb_config_descriptor *config, unsigned char *buffer,
    356         int host_endian)
     373        int size, int host_endian)
    357374{
    358375        int i;
    359376        int r;
    360         int size;
    361         size_t tmp;
    362377        struct usb_descriptor_header header;
    363378        struct libusb_interface *usb_interface;
    364379
     380        if (size < LIBUSB_DT_CONFIG_SIZE) {
     381                usbi_err(ctx, "short config descriptor read %d/%d",
     382                         size, LIBUSB_DT_CONFIG_SIZE);
     383                return LIBUSB_ERROR_IO;
     384        }
     385
    365386        usbi_parse_descriptor(buffer, "bbwbbbbb", config, host_endian);
    366         size = config->wTotalLength;
    367 
     387        if (config->bDescriptorType != LIBUSB_DT_CONFIG) {
     388                usbi_err(ctx, "unexpected descriptor %x (expected %x)",
     389                         config->bDescriptorType, LIBUSB_DT_CONFIG);
     390                return LIBUSB_ERROR_IO;
     391        }
     392        if (config->bLength < LIBUSB_DT_CONFIG_SIZE) {
     393                usbi_err(ctx, "invalid config bLength (%d)", config->bLength);
     394                return LIBUSB_ERROR_IO;
     395        }
     396        if (config->bLength > size) {
     397                usbi_err(ctx, "short config descriptor read %d/%d",
     398                         size, config->bLength);
     399                return LIBUSB_ERROR_IO;
     400        }
    368401        if (config->bNumInterfaces > USB_MAXINTERFACES) {
    369402                usbi_err(ctx, "too many interfaces (%d)", config->bNumInterfaces);
     
    371404        }
    372405
    373         tmp = config->bNumInterfaces * sizeof(struct libusb_interface);
    374         usb_interface = malloc(tmp);
     406        usb_interface = calloc(config->bNumInterfaces, sizeof(struct libusb_interface));
    375407        config->interface = usb_interface;
    376         if (!config->interface)
     408        if (!usb_interface)
    377409                return LIBUSB_ERROR_NO_MEM;
    378410
    379         memset(usb_interface, 0, tmp);
    380411        buffer += config->bLength;
    381412        size -= config->bLength;
     
    394425                        usbi_parse_descriptor(buffer, "bb", &header, 0);
    395426
    396                         if ((header.bLength > size) ||
    397                                         (header.bLength < DESC_HEADER_LENGTH)) {
    398                                 usbi_err(ctx, "invalid descriptor length of %d",
    399                                         header.bLength);
     427                        if (header.bLength < DESC_HEADER_LENGTH) {
     428                                usbi_err(ctx,
     429                                         "invalid extra config desc len (%d)",
     430                                         header.bLength);
    400431                                r = LIBUSB_ERROR_IO;
    401432                                goto err;
     433                        } else if (header.bLength > size) {
     434                                usbi_warn(ctx,
     435                                          "short extra config desc read %d/%d",
     436                                          size, header.bLength);
     437                                config->bNumInterfaces = (uint8_t)i;
     438                                return size;
    402439                        }
    403440
    404441                        /* If we find another "proper" descriptor then we're done */
    405442                        if ((header.bDescriptorType == LIBUSB_DT_ENDPOINT) ||
    406                             (header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
    407                             (header.bDescriptorType == LIBUSB_DT_CONFIG) ||
    408                             (header.bDescriptorType == LIBUSB_DT_DEVICE) ||
    409                             (header.bDescriptorType ==
    410                              LIBUSB_DT_SS_ENDPOINT_COMPANION))
     443                                        (header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
     444                                        (header.bDescriptorType == LIBUSB_DT_CONFIG) ||
     445                                        (header.bDescriptorType == LIBUSB_DT_DEVICE))
    411446                                break;
    412447
    413                         usbi_dbg("skipping descriptor 0x%x\n", header.bDescriptorType);
     448                        usbi_dbg("skipping descriptor 0x%x", header.bDescriptorType);
    414449                        buffer += header.bLength;
    415450                        size -= header.bLength;
     
    436471                if (r < 0)
    437472                        goto err;
     473                if (r == 0) {
     474                        config->bNumInterfaces = (uint8_t)i;
     475                        break;
     476                }
    438477
    439478                buffer += r;
     
    448487}
    449488
     489static int raw_desc_to_config(struct libusb_context *ctx,
     490        unsigned char *buf, int size, int host_endian,
     491        struct libusb_config_descriptor **config)
     492{
     493        struct libusb_config_descriptor *_config = malloc(sizeof(*_config));
     494        int r;
     495       
     496        if (!_config)
     497                return LIBUSB_ERROR_NO_MEM;
     498
     499        r = parse_configuration(ctx, _config, buf, size, host_endian);
     500        if (r < 0) {
     501                usbi_err(ctx, "parse_configuration failed with error %d", r);
     502                free(_config);
     503                return r;
     504        } else if (r > 0) {
     505                usbi_warn(ctx, "still %d bytes of descriptor data left", r);
     506        }
     507       
     508        *config = _config;
     509        return LIBUSB_SUCCESS;
     510}
     511
    450512int usbi_device_cache_descriptor(libusb_device *dev)
    451513{
    452         int r, host_endian;
     514        int r, host_endian = 0;
    453515
    454516        r = usbi_backend->get_device_descriptor(dev, (unsigned char *) &dev->device_descriptor,
     
    467529}
    468530
    469 /** \ingroup desc
     531/** \ingroup libusb_desc
    470532 * Get the USB device descriptor for a given device.
    471533 *
    472534 * This is a non-blocking function; the device descriptor is cached in memory.
     535 *
     536 * Note since libusb-1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102, this
     537 * function always succeeds.
    473538 *
    474539 * \param dev the device
     
    485550}
    486551
    487 /** \ingroup desc
     552/** \ingroup libusb_desc
    488553 * Get the USB configuration descriptor for the currently active configuration.
    489554 * This is a non-blocking function which does not involve any requests being
     
    502567        struct libusb_config_descriptor **config)
    503568{
    504         struct libusb_config_descriptor *_config = malloc(sizeof(*_config));
    505         unsigned char tmp[8];
     569        struct libusb_config_descriptor _config;
     570        unsigned char tmp[LIBUSB_DT_CONFIG_SIZE];
    506571        unsigned char *buf = NULL;
    507572        int host_endian = 0;
    508573        int r;
    509574
    510         usbi_dbg("");
    511         if (!_config)
     575        r = usbi_backend->get_active_config_descriptor(dev, tmp,
     576                LIBUSB_DT_CONFIG_SIZE, &host_endian);
     577        if (r < 0)
     578                return r;
     579        if (r < LIBUSB_DT_CONFIG_SIZE) {
     580                usbi_err(dev->ctx, "short config descriptor read %d/%d",
     581                         r, LIBUSB_DT_CONFIG_SIZE);
     582                return LIBUSB_ERROR_IO;
     583        }
     584
     585        usbi_parse_descriptor(tmp, "bbw", &_config, host_endian);
     586        buf = malloc(_config.wTotalLength);
     587        if (!buf)
    512588                return LIBUSB_ERROR_NO_MEM;
    513589
    514         r = usbi_backend->get_active_config_descriptor(dev, tmp, sizeof(tmp),
    515                 &host_endian);
    516         if (r < 0)
    517                 goto err;
    518 
    519         usbi_parse_descriptor(tmp, "bbw", _config, host_endian);
    520         buf = malloc(_config->wTotalLength);
    521         if (!buf) {
    522                 r = LIBUSB_ERROR_NO_MEM;
    523                 goto err;
    524         }
    525 
    526590        r = usbi_backend->get_active_config_descriptor(dev, buf,
    527                 _config->wTotalLength, &host_endian);
    528         if (r < 0)
    529                 goto err;
    530 
    531         r = parse_configuration(dev->ctx, _config, buf, host_endian);
    532         if (r < 0) {
    533                 usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
    534                 goto err;
    535         } else if (r > 0) {
    536                 usbi_warn(dev->ctx, "descriptor data still left");
    537         }
     591                _config.wTotalLength, &host_endian);
     592        if (r >= 0)
     593                r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
    538594
    539595        free(buf);
    540         *config = _config;
    541         return 0;
    542 
    543 err:
    544         free(_config);
    545         if (buf)
    546                 free(buf);
    547596        return r;
    548597}
    549598
    550 /** \ingroup desc
     599/** \ingroup libusb_desc
    551600 * Get a USB configuration descriptor based on its index.
    552601 * This is a non-blocking function which does not involve any requests being
     
    567616        uint8_t config_index, struct libusb_config_descriptor **config)
    568617{
    569         struct libusb_config_descriptor *_config;
    570         unsigned char tmp[8];
     618        struct libusb_config_descriptor _config;
     619        unsigned char tmp[LIBUSB_DT_CONFIG_SIZE];
    571620        unsigned char *buf = NULL;
    572621        int host_endian = 0;
     
    577626                return LIBUSB_ERROR_NOT_FOUND;
    578627
    579         _config = malloc(sizeof(*_config));
    580         if (!_config)
     628        r = usbi_backend->get_config_descriptor(dev, config_index, tmp,
     629                LIBUSB_DT_CONFIG_SIZE, &host_endian);
     630        if (r < 0)
     631                return r;
     632        if (r < LIBUSB_DT_CONFIG_SIZE) {
     633                usbi_err(dev->ctx, "short config descriptor read %d/%d",
     634                         r, LIBUSB_DT_CONFIG_SIZE);
     635                return LIBUSB_ERROR_IO;
     636        }
     637
     638        usbi_parse_descriptor(tmp, "bbw", &_config, host_endian);
     639        buf = malloc(_config.wTotalLength);
     640        if (!buf)
    581641                return LIBUSB_ERROR_NO_MEM;
    582642
    583         r = usbi_backend->get_config_descriptor(dev, config_index, tmp,
    584                 sizeof(tmp), &host_endian);
    585         if (r < 0)
    586                 goto err;
    587 
    588         usbi_parse_descriptor(tmp, "bbw", _config, host_endian);
    589         buf = malloc(_config->wTotalLength);
    590         if (!buf) {
    591                 r = LIBUSB_ERROR_NO_MEM;
    592                 goto err;
    593         }
    594 
    595         host_endian = 0;
    596643        r = usbi_backend->get_config_descriptor(dev, config_index, buf,
    597                 _config->wTotalLength, &host_endian);
    598         if (r < 0)
    599                 goto err;
    600 
    601         r = parse_configuration(dev->ctx, _config, buf, host_endian);
    602         if (r < 0) {
    603                 usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
    604                 goto err;
    605         } else if (r > 0) {
    606                 usbi_warn(dev->ctx, "descriptor data still left");
    607         }
     644                _config.wTotalLength, &host_endian);
     645        if (r >= 0)
     646                r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
    608647
    609648        free(buf);
    610         *config = _config;
    611         return 0;
    612 
    613 err:
    614         free(_config);
    615         if (buf)
    616                 free(buf);
    617649        return r;
    618650}
     
    621653 * matching a specific bConfigurationValue in the idx output parameter, or -1
    622654 * if the config was not found.
    623  * returns 0 or a LIBUSB_ERROR code
     655 * returns 0 on success or a LIBUSB_ERROR code
    624656 */
    625657int usbi_get_config_index_by_value(struct libusb_device *dev,
     
    634666                int r = usbi_backend->get_config_descriptor(dev, i, tmp, sizeof(tmp),
    635667                        &host_endian);
    636                 if (r < 0)
     668                if (r < 0) {
     669                        *idx = -1;
    637670                        return r;
     671                }
    638672                if (tmp[5] == bConfigurationValue) {
    639673                        *idx = i;
     
    646680}
    647681
    648 /** \ingroup desc
     682/** \ingroup libusb_desc
    649683 * Get a USB configuration descriptor with a specific bConfigurationValue.
    650684 * This is a non-blocking function which does not involve any requests being
     
    666700        uint8_t bConfigurationValue, struct libusb_config_descriptor **config)
    667701{
    668         int idx;
    669         int r = usbi_get_config_index_by_value(dev, bConfigurationValue, &idx);
     702        int r, idx, host_endian;
     703        unsigned char *buf = NULL;
     704
     705        if (usbi_backend->get_config_descriptor_by_value) {
     706                r = usbi_backend->get_config_descriptor_by_value(dev,
     707                        bConfigurationValue, &buf, &host_endian);
     708                if (r < 0)
     709                        return r;
     710                return raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
     711        }
     712
     713        r = usbi_get_config_index_by_value(dev, bConfigurationValue, &idx);
    670714        if (r < 0)
    671715                return r;
     
    676720}
    677721
    678 /** \ingroup desc
     722/** \ingroup libusb_desc
    679723 * Free a configuration descriptor obtained from
    680724 * libusb_get_active_config_descriptor() or libusb_get_config_descriptor().
     
    694738}
    695739
    696 /** \ingroup desc
     740/** \ingroup libusb_desc
     741 * Get an endpoints superspeed endpoint companion descriptor (if any)
     742 *
     743 * \param ctx the context to operate on, or NULL for the default context
     744 * \param endpoint endpoint descriptor from which to get the superspeed
     745 * endpoint companion descriptor
     746 * \param ep_comp output location for the superspeed endpoint companion
     747 * descriptor. Only valid if 0 was returned. Must be freed with
     748 * libusb_free_ss_endpoint_companion_descriptor() after use.
     749 * \returns 0 on success
     750 * \returns LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
     751 * \returns another LIBUSB_ERROR code on error
     752 */
     753int API_EXPORTED libusb_get_ss_endpoint_companion_descriptor(
     754        struct libusb_context *ctx,
     755        const struct libusb_endpoint_descriptor *endpoint,
     756        struct libusb_ss_endpoint_companion_descriptor **ep_comp)
     757{
     758        struct usb_descriptor_header header;
     759        int size = endpoint->extra_length;
     760        const unsigned char *buffer = endpoint->extra;
     761
     762        *ep_comp = NULL;
     763
     764        while (size >= DESC_HEADER_LENGTH) {
     765                usbi_parse_descriptor(buffer, "bb", &header, 0);
     766                if (header.bLength < 2 || header.bLength > size) {
     767                        usbi_err(ctx, "invalid descriptor length %d",
     768                                 header.bLength);
     769                        return LIBUSB_ERROR_IO;
     770                }
     771                if (header.bDescriptorType != LIBUSB_DT_SS_ENDPOINT_COMPANION) {
     772                        buffer += header.bLength;
     773                        size -= header.bLength;
     774                        continue;
     775                }
     776                if (header.bLength < LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE) {
     777                        usbi_err(ctx, "invalid ss-ep-comp-desc length %d",
     778                                 header.bLength);
     779                        return LIBUSB_ERROR_IO;
     780                }
     781                *ep_comp = malloc(sizeof(**ep_comp));
     782                if (*ep_comp == NULL)
     783                        return LIBUSB_ERROR_NO_MEM;
     784                usbi_parse_descriptor(buffer, "bbbbw", *ep_comp, 0);
     785                return LIBUSB_SUCCESS;
     786        }
     787        return LIBUSB_ERROR_NOT_FOUND;
     788}
     789
     790/** \ingroup libusb_desc
     791 * Free a superspeed endpoint companion descriptor obtained from
     792 * libusb_get_ss_endpoint_companion_descriptor().
     793 * It is safe to call this function with a NULL ep_comp parameter, in which
     794 * case the function simply returns.
     795 *
     796 * \param ep_comp the superspeed endpoint companion descriptor to free
     797 */
     798void API_EXPORTED libusb_free_ss_endpoint_companion_descriptor(
     799        struct libusb_ss_endpoint_companion_descriptor *ep_comp)
     800{
     801        free(ep_comp);
     802}
     803
     804static int parse_bos(struct libusb_context *ctx,
     805        struct libusb_bos_descriptor **bos,
     806        unsigned char *buffer, int size, int host_endian)
     807{
     808        struct libusb_bos_descriptor bos_header, *_bos;
     809        struct libusb_bos_dev_capability_descriptor dev_cap;
     810        int i;
     811
     812        if (size < LIBUSB_DT_BOS_SIZE) {
     813                usbi_err(ctx, "short bos descriptor read %d/%d",
     814                         size, LIBUSB_DT_BOS_SIZE);
     815                return LIBUSB_ERROR_IO;
     816        }
     817
     818        usbi_parse_descriptor(buffer, "bbwb", &bos_header, host_endian);
     819        if (bos_header.bDescriptorType != LIBUSB_DT_BOS) {
     820                usbi_err(ctx, "unexpected descriptor %x (expected %x)",
     821                         bos_header.bDescriptorType, LIBUSB_DT_BOS);
     822                return LIBUSB_ERROR_IO;
     823        }
     824        if (bos_header.bLength < LIBUSB_DT_BOS_SIZE) {
     825                usbi_err(ctx, "invalid bos bLength (%d)", bos_header.bLength);
     826                return LIBUSB_ERROR_IO;
     827        }
     828        if (bos_header.bLength > size) {
     829                usbi_err(ctx, "short bos descriptor read %d/%d",
     830                         size, bos_header.bLength);
     831                return LIBUSB_ERROR_IO;
     832        }
     833
     834        _bos = calloc (1,
     835                sizeof(*_bos) + bos_header.bNumDeviceCaps * sizeof(void *));
     836        if (!_bos)
     837                return LIBUSB_ERROR_NO_MEM;
     838
     839        usbi_parse_descriptor(buffer, "bbwb", _bos, host_endian);
     840        buffer += bos_header.bLength;
     841        size -= bos_header.bLength;
     842
     843        /* Get the device capability descriptors */
     844        for (i = 0; i < bos_header.bNumDeviceCaps; i++) {
     845                if (size < LIBUSB_DT_DEVICE_CAPABILITY_SIZE) {
     846                        usbi_warn(ctx, "short dev-cap descriptor read %d/%d",
     847                                  size, LIBUSB_DT_DEVICE_CAPABILITY_SIZE);
     848                        break;
     849                }
     850                usbi_parse_descriptor(buffer, "bbb", &dev_cap, host_endian);
     851                if (dev_cap.bDescriptorType != LIBUSB_DT_DEVICE_CAPABILITY) {
     852                        usbi_warn(ctx, "unexpected descriptor %x (expected %x)",
     853                                  dev_cap.bDescriptorType, LIBUSB_DT_DEVICE_CAPABILITY);
     854                        break;
     855                }
     856                if (dev_cap.bLength < LIBUSB_DT_DEVICE_CAPABILITY_SIZE) {
     857                        usbi_err(ctx, "invalid dev-cap bLength (%d)",
     858                                 dev_cap.bLength);
     859                        libusb_free_bos_descriptor(_bos);
     860                        return LIBUSB_ERROR_IO;
     861                }
     862                if (dev_cap.bLength > size) {
     863                        usbi_warn(ctx, "short dev-cap descriptor read %d/%d",
     864                                  size, dev_cap.bLength);
     865                        break;
     866                }
     867
     868                _bos->dev_capability[i] = malloc(dev_cap.bLength);
     869                if (!_bos->dev_capability[i]) {
     870                        libusb_free_bos_descriptor(_bos);
     871                        return LIBUSB_ERROR_NO_MEM;
     872                }
     873                memcpy(_bos->dev_capability[i], buffer, dev_cap.bLength);
     874                buffer += dev_cap.bLength;
     875                size -= dev_cap.bLength;
     876        }
     877        _bos->bNumDeviceCaps = (uint8_t)i;
     878        *bos = _bos;
     879
     880        return LIBUSB_SUCCESS;
     881}
     882
     883/** \ingroup libusb_desc
     884 * Get a Binary Object Store (BOS) descriptor
     885 * This is a BLOCKING function, which will send requests to the device.
     886 *
     887 * \param dev_handle the handle of an open libusb device
     888 * \param bos output location for the BOS descriptor. Only valid if 0 was returned.
     889 * Must be freed with \ref libusb_free_bos_descriptor() after use.
     890 * \returns 0 on success
     891 * \returns LIBUSB_ERROR_NOT_FOUND if the device doesn't have a BOS descriptor
     892 * \returns another LIBUSB_ERROR code on error
     893 */
     894int API_EXPORTED libusb_get_bos_descriptor(libusb_device_handle *dev_handle,
     895        struct libusb_bos_descriptor **bos)
     896{
     897        struct libusb_bos_descriptor _bos;
     898        uint8_t bos_header[LIBUSB_DT_BOS_SIZE] = {0};
     899        unsigned char *bos_data = NULL;
     900        const int host_endian = 0;
     901        int r;
     902
     903        /* Read the BOS. This generates 2 requests on the bus,
     904         * one for the header, and one for the full BOS */
     905        r = libusb_get_descriptor(dev_handle, LIBUSB_DT_BOS, 0, bos_header,
     906                                  LIBUSB_DT_BOS_SIZE);
     907        if (r < 0) {
     908                if (r != LIBUSB_ERROR_PIPE)
     909                        usbi_err(HANDLE_CTX(dev_handle), "failed to read BOS (%d)", r);
     910                return r;
     911        }
     912        if (r < LIBUSB_DT_BOS_SIZE) {
     913                usbi_err(HANDLE_CTX(dev_handle), "short BOS read %d/%d",
     914                         r, LIBUSB_DT_BOS_SIZE);
     915                return LIBUSB_ERROR_IO;
     916        }
     917
     918        usbi_parse_descriptor(bos_header, "bbwb", &_bos, host_endian);
     919        usbi_dbg("found BOS descriptor: size %d bytes, %d capabilities",
     920                 _bos.wTotalLength, _bos.bNumDeviceCaps);
     921        bos_data = calloc(_bos.wTotalLength, 1);
     922        if (bos_data == NULL)
     923                return LIBUSB_ERROR_NO_MEM;
     924
     925        r = libusb_get_descriptor(dev_handle, LIBUSB_DT_BOS, 0, bos_data,
     926                                  _bos.wTotalLength);
     927        if (r >= 0)
     928                r = parse_bos(HANDLE_CTX(dev_handle), bos, bos_data, r, host_endian);
     929        else
     930                usbi_err(HANDLE_CTX(dev_handle), "failed to read BOS (%d)", r);
     931
     932        free(bos_data);
     933        return r;
     934}
     935
     936/** \ingroup libusb_desc
     937 * Free a BOS descriptor obtained from libusb_get_bos_descriptor().
     938 * It is safe to call this function with a NULL bos parameter, in which
     939 * case the function simply returns.
     940 *
     941 * \param bos the BOS descriptor to free
     942 */
     943void API_EXPORTED libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos)
     944{
     945        int i;
     946
     947        if (!bos)
     948                return;
     949
     950        for (i = 0; i < bos->bNumDeviceCaps; i++)
     951                free(bos->dev_capability[i]);
     952        free(bos);
     953}
     954
     955/** \ingroup libusb_desc
     956 * Get an USB 2.0 Extension descriptor
     957 *
     958 * \param ctx the context to operate on, or NULL for the default context
     959 * \param dev_cap Device Capability descriptor with a bDevCapabilityType of
     960 * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION
     961 * LIBUSB_BT_USB_2_0_EXTENSION
     962 * \param usb_2_0_extension output location for the USB 2.0 Extension
     963 * descriptor. Only valid if 0 was returned. Must be freed with
     964 * libusb_free_usb_2_0_extension_descriptor() after use.
     965 * \returns 0 on success
     966 * \returns a LIBUSB_ERROR code on error
     967 */
     968int API_EXPORTED libusb_get_usb_2_0_extension_descriptor(
     969        struct libusb_context *ctx,
     970        struct libusb_bos_dev_capability_descriptor *dev_cap,
     971        struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension)
     972{
     973        struct libusb_usb_2_0_extension_descriptor *_usb_2_0_extension;
     974        const int host_endian = 0;
     975
     976        if (dev_cap->bDevCapabilityType != LIBUSB_BT_USB_2_0_EXTENSION) {
     977                usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
     978                         dev_cap->bDevCapabilityType,
     979                         LIBUSB_BT_USB_2_0_EXTENSION);
     980                return LIBUSB_ERROR_INVALID_PARAM;
     981        }
     982        if (dev_cap->bLength < LIBUSB_BT_USB_2_0_EXTENSION_SIZE) {
     983                usbi_err(ctx, "short dev-cap descriptor read %d/%d",
     984                         dev_cap->bLength, LIBUSB_BT_USB_2_0_EXTENSION_SIZE);
     985                return LIBUSB_ERROR_IO;
     986        }
     987
     988        _usb_2_0_extension = malloc(sizeof(*_usb_2_0_extension));
     989        if (!_usb_2_0_extension)
     990                return LIBUSB_ERROR_NO_MEM;
     991
     992        usbi_parse_descriptor((unsigned char *)dev_cap, "bbbd",
     993                              _usb_2_0_extension, host_endian);
     994
     995        *usb_2_0_extension = _usb_2_0_extension;
     996        return LIBUSB_SUCCESS;
     997}
     998
     999/** \ingroup libusb_desc
     1000 * Free a USB 2.0 Extension descriptor obtained from
     1001 * libusb_get_usb_2_0_extension_descriptor().
     1002 * It is safe to call this function with a NULL usb_2_0_extension parameter,
     1003 * in which case the function simply returns.
     1004 *
     1005 * \param usb_2_0_extension the USB 2.0 Extension descriptor to free
     1006 */
     1007void API_EXPORTED libusb_free_usb_2_0_extension_descriptor(
     1008        struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension)
     1009{
     1010        free(usb_2_0_extension);
     1011}
     1012
     1013/** \ingroup libusb_desc
     1014 * Get a SuperSpeed USB Device Capability descriptor
     1015 *
     1016 * \param ctx the context to operate on, or NULL for the default context
     1017 * \param dev_cap Device Capability descriptor with a bDevCapabilityType of
     1018 * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
     1019 * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
     1020 * \param ss_usb_device_cap output location for the SuperSpeed USB Device
     1021 * Capability descriptor. Only valid if 0 was returned. Must be freed with
     1022 * libusb_free_ss_usb_device_capability_descriptor() after use.
     1023 * \returns 0 on success
     1024 * \returns a LIBUSB_ERROR code on error
     1025 */
     1026int API_EXPORTED libusb_get_ss_usb_device_capability_descriptor(
     1027        struct libusb_context *ctx,
     1028        struct libusb_bos_dev_capability_descriptor *dev_cap,
     1029        struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap)
     1030{
     1031        struct libusb_ss_usb_device_capability_descriptor *_ss_usb_device_cap;
     1032        const int host_endian = 0;
     1033
     1034        if (dev_cap->bDevCapabilityType != LIBUSB_BT_SS_USB_DEVICE_CAPABILITY) {
     1035                usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
     1036                         dev_cap->bDevCapabilityType,
     1037                         LIBUSB_BT_SS_USB_DEVICE_CAPABILITY);
     1038                return LIBUSB_ERROR_INVALID_PARAM;
     1039        }
     1040        if (dev_cap->bLength < LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) {
     1041                usbi_err(ctx, "short dev-cap descriptor read %d/%d",
     1042                         dev_cap->bLength, LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE);
     1043                return LIBUSB_ERROR_IO;
     1044        }
     1045
     1046        _ss_usb_device_cap = malloc(sizeof(*_ss_usb_device_cap));
     1047        if (!_ss_usb_device_cap)
     1048                return LIBUSB_ERROR_NO_MEM;
     1049
     1050        usbi_parse_descriptor((unsigned char *)dev_cap, "bbbbwbbw",
     1051                              _ss_usb_device_cap, host_endian);
     1052
     1053        *ss_usb_device_cap = _ss_usb_device_cap;
     1054        return LIBUSB_SUCCESS;
     1055}
     1056
     1057/** \ingroup libusb_desc
     1058 * Free a SuperSpeed USB Device Capability descriptor obtained from
     1059 * libusb_get_ss_usb_device_capability_descriptor().
     1060 * It is safe to call this function with a NULL ss_usb_device_cap
     1061 * parameter, in which case the function simply returns.
     1062 *
     1063 * \param ss_usb_device_cap the USB 2.0 Extension descriptor to free
     1064 */
     1065void API_EXPORTED libusb_free_ss_usb_device_capability_descriptor(
     1066        struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap)
     1067{
     1068        free(ss_usb_device_cap);
     1069}
     1070
     1071/** \ingroup libusb_desc
     1072 * Get a Container ID descriptor
     1073 *
     1074 * \param ctx the context to operate on, or NULL for the default context
     1075 * \param dev_cap Device Capability descriptor with a bDevCapabilityType of
     1076 * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID
     1077 * LIBUSB_BT_CONTAINER_ID
     1078 * \param container_id output location for the Container ID descriptor.
     1079 * Only valid if 0 was returned. Must be freed with
     1080 * libusb_free_container_id_descriptor() after use.
     1081 * \returns 0 on success
     1082 * \returns a LIBUSB_ERROR code on error
     1083 */
     1084int API_EXPORTED libusb_get_container_id_descriptor(struct libusb_context *ctx,
     1085        struct libusb_bos_dev_capability_descriptor *dev_cap,
     1086        struct libusb_container_id_descriptor **container_id)
     1087{
     1088        struct libusb_container_id_descriptor *_container_id;
     1089        const int host_endian = 0;
     1090
     1091        if (dev_cap->bDevCapabilityType != LIBUSB_BT_CONTAINER_ID) {
     1092                usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
     1093                         dev_cap->bDevCapabilityType,
     1094                         LIBUSB_BT_CONTAINER_ID);
     1095                return LIBUSB_ERROR_INVALID_PARAM;
     1096        }
     1097        if (dev_cap->bLength < LIBUSB_BT_CONTAINER_ID_SIZE) {
     1098                usbi_err(ctx, "short dev-cap descriptor read %d/%d",
     1099                         dev_cap->bLength, LIBUSB_BT_CONTAINER_ID_SIZE);
     1100                return LIBUSB_ERROR_IO;
     1101        }
     1102
     1103        _container_id = malloc(sizeof(*_container_id));
     1104        if (!_container_id)
     1105                return LIBUSB_ERROR_NO_MEM;
     1106
     1107        usbi_parse_descriptor((unsigned char *)dev_cap, "bbbbu",
     1108                              _container_id, host_endian);
     1109
     1110        *container_id = _container_id;
     1111        return LIBUSB_SUCCESS;
     1112}
     1113
     1114/** \ingroup libusb_desc
     1115 * Free a Container ID descriptor obtained from
     1116 * libusb_get_container_id_descriptor().
     1117 * It is safe to call this function with a NULL container_id parameter,
     1118 * in which case the function simply returns.
     1119 *
     1120 * \param container_id the USB 2.0 Extension descriptor to free
     1121 */
     1122void API_EXPORTED libusb_free_container_id_descriptor(
     1123        struct libusb_container_id_descriptor *container_id)
     1124{
     1125        free(container_id);
     1126}
     1127
     1128/** \ingroup libusb_desc
    6971129 * Retrieve a string descriptor in C style ASCII.
    6981130 *
     
    7001132 * supported by the device.
    7011133 *
    702  * \param dev a device handle
     1134 * \param dev_handle a device handle
    7031135 * \param desc_index the index of the descriptor to retrieve
    7041136 * \param data output buffer for ASCII string descriptor
     
    7061138 * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure
    7071139 */
    708 int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev,
     1140int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle,
    7091141        uint8_t desc_index, unsigned char *data, int length)
    7101142{
     
    7251157                return LIBUSB_ERROR_INVALID_PARAM;
    7261158
    727         r = libusb_get_string_descriptor(dev, 0, 0, tbuf, sizeof(tbuf));
     1159        r = libusb_get_string_descriptor(dev_handle, 0, 0, tbuf, sizeof(tbuf));
    7281160        if (r < 0)
    7291161                return r;
     
    7341166        langid = tbuf[2] | (tbuf[3] << 8);
    7351167
    736         r = libusb_get_string_descriptor(dev, desc_index, langid, tbuf,
     1168        r = libusb_get_string_descriptor(dev_handle, desc_index, langid, tbuf,
    7371169                sizeof(tbuf));
    7381170        if (r < 0)
     
    7491181                        break;
    7501182
    751                 if (tbuf[si + 1]) /* high byte */
     1183                if ((tbuf[si] & 0x80) || (tbuf[si + 1])) /* non-ASCII */
    7521184                        data[di++] = '?';
    7531185                else
     
    7581190        return di;
    7591191}
    760 
    761 int API_EXPORTED libusb_parse_ss_endpoint_comp(const void *buf, int len,
    762                                                struct libusb_ss_endpoint_companion_descriptor **ep_comp)
    763 {
    764         struct libusb_ss_endpoint_companion_descriptor *ep_comp_desc;
    765         struct usb_descriptor_header header;
    766 
    767         usbi_parse_descriptor(buf, "bb", &header, 0);
    768 
    769         /* Everything should be fine being passed into here, but we sanity */
    770         /*  check JIC */
    771         if (header.bLength > len) {
    772                 usbi_err(NULL, "ran out of descriptors parsing");
    773                 return LIBUSB_ERROR_NO_MEM;
    774         }
    775 
    776         if (header.bDescriptorType != LIBUSB_DT_SS_ENDPOINT_COMPANION) {
    777                 usbi_err(NULL, "unexpected descriptor %x (expected %x)",
    778                         header.bDescriptorType, LIBUSB_DT_SS_ENDPOINT_COMPANION);
    779                 return LIBUSB_ERROR_INVALID_PARAM;
    780         }
    781 
    782         ep_comp_desc = calloc(1, sizeof (*ep_comp_desc));
    783         if (!ep_comp_desc) {
    784                 return LIBUSB_ERROR_NO_MEM;
    785         }
    786 
    787         if (header.bLength >= LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE)
    788                 usbi_parse_descriptor(buf, "bbbbw", ep_comp_desc, 0);
    789 
    790         *ep_comp = ep_comp_desc;
    791 
    792         return LIBUSB_SUCCESS;
    793 }
    794 
    795 void API_EXPORTED libusb_free_ss_endpoint_comp(struct libusb_ss_endpoint_companion_descriptor *ep_comp)
    796 {
    797         assert(ep_comp);
    798         free(ep_comp);
    799 }
    800 
    801 int API_EXPORTED libusb_parse_bos_descriptor(const void *buf, int len,
    802                                              struct libusb_bos_descriptor **bos)
    803 {
    804         const unsigned char *buffer = (const unsigned char *) buf;
    805         struct libusb_bos_descriptor *bos_desc;
    806         int i;
    807 
    808         bos_desc = calloc (1, sizeof (*bos_desc));
    809         if (!bos_desc) {
    810                 return LIBUSB_ERROR_NO_MEM;
    811         }
    812 
    813         usbi_parse_descriptor(buffer, "bbwb", bos_desc, 0);
    814         buffer += LIBUSB_DT_BOS_SIZE;
    815 
    816         /* Get the device capability descriptors */
    817         for (i = 0; i < bos_desc->bNumDeviceCaps; ++i) {
    818                 if (buffer[2] == LIBUSB_USB_CAP_TYPE_EXT) {
    819                         if (!bos_desc->usb_2_0_ext_cap) {
    820                                 bos_desc->usb_2_0_ext_cap =
    821                                         (struct libusb_usb_2_0_device_capability_descriptor *)
    822                                         malloc(sizeof(*bos_desc->usb_2_0_ext_cap));
    823                                 usbi_parse_descriptor(buffer, "bbbd",
    824                                                       bos_desc->usb_2_0_ext_cap, 0);
    825                         } else
    826                                 usbi_warn(NULL,
    827                                           "usb_2_0_ext_cap was already allocated");
    828 
    829                         /* move to the next device capability descriptor */
    830                         buffer += LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE;
    831                 } else if (buffer[2] == LIBUSB_SS_USB_CAP_TYPE) {
    832                         if (!bos_desc->ss_usb_cap) {
    833                                 bos_desc->ss_usb_cap =
    834                                         (struct libusb_ss_usb_device_capability_descriptor *)
    835                                         malloc(sizeof(*bos_desc->ss_usb_cap));
    836                                 usbi_parse_descriptor(buffer, "bbbbwbbw",
    837                                                       bos_desc->ss_usb_cap, 0);
    838                         } else
    839                                 usbi_warn(NULL,
    840                                           "ss_usb_cap was already allocated");
    841 
    842                         /* move to the next device capability descriptor */
    843                         buffer += LIBUSB_SS_USB_DEVICE_CAPABILITY_SIZE;
    844                 } else {
    845                         usbi_info(NULL, "wireless/container_id capability "
    846                                   "descriptor");
    847 
    848                         /* move to the next device capability descriptor */
    849                         buffer += buffer[0];
    850                 }
    851         }
    852 
    853         *bos = bos_desc;
    854 
    855         return LIBUSB_SUCCESS;
    856 }
    857 
    858 void API_EXPORTED libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos)
    859 {
    860         assert(bos);
    861 
    862         if (bos->usb_2_0_ext_cap) {
    863                 free(bos->usb_2_0_ext_cap);
    864         }
    865 
    866         if (bos->ss_usb_cap) {
    867                 free(bos->ss_usb_cap);
    868         }
    869 
    870         free(bos);
    871 }
  • TabularUnified libusb1/trunk/libusb/hotplug.c

    r1876 r1882  
    1 /* -*- Mode: C; indent-tabs-mode:nil ; c-basic-offset:8 -*- */
     1/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
    22/*
    33 * Hotplug functions for libusb
    4  * Copyright (C) 2012-2013 Nathan Hjelm <hjelmn@mac.com>
    5  * Copyright (C) 2012-2013 Peter Stuge <peter@stuge.se>
     4 * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
     5 * Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    2626#include <stdlib.h>
    2727#include <string.h>
     28#ifdef HAVE_SYS_TYPES_H
    2829#include <sys/types.h>
     30#endif
    2931#include <assert.h>
    3032
     
    3335
    3436/**
    35  * @defgroup hotplug  Device hotplug event notification
    36  * This page details how to use the libusb hotplug interface.
    37  *
    38  * \page hotplug Device hotplug event notification
    39  *
    40  * \section intro Introduction
    41  *
    42  * Releases of libusb 1.0 newer than 1.X have added support for hotplug
    43  * events. This interface allows you to request notification for the
    44  * arrival and departure of matching USB devices.
     37 * @defgroup libusb_hotplug Device hotplug event notification
     38 * This page details how to use the libusb hotplug interface, where available.
     39 *
     40 * Be mindful that not all platforms currently implement hotplug notification and
     41 * that you should first call on \ref libusb_has_capability() with parameter
     42 * \ref LIBUSB_CAP_HAS_HOTPLUG to confirm that hotplug support is available.
     43 *
     44 * \page libusb_hotplug Device hotplug event notification
     45 *
     46 * \section hotplug_intro Introduction
     47 *
     48 * Version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102, has added support
     49 * for hotplug events on <b>some</b> platforms (you should test if your platform
     50 * supports hotplug notification by calling \ref libusb_has_capability() with
     51 * parameter \ref LIBUSB_CAP_HAS_HOTPLUG).
     52 *
     53 * This interface allows you to request notification for the arrival and departure
     54 * of matching USB devices.
    4555 *
    4656 * To receive hotplug notification you register a callback by calling
    47  * libusb_hotplug_register_callback(). This function will optionally return
    48  * a handle that can be passed to libusb_hotplug_deregister_callback().
     57 * \ref libusb_hotplug_register_callback(). This function will optionally return
     58 * a callback handle that can be passed to \ref libusb_hotplug_deregister_callback().
    4959 *
    5060 * A callback function must return an int (0 or 1) indicating whether the callback is
    5161 * expecting additional events. Returning 0 will rearm the callback and 1 will cause
    52  * the callback to be deregistered.
    53  *
    54  * Callbacks for a particulat context are automatically deregistered by libusb_exit().
    55  *
    56  * As of 1.X there are two supported hotplug events:
     62 * the callback to be deregistered. Note that when callbacks are called from
     63 * libusb_hotplug_register_callback() because of the \ref LIBUSB_HOTPLUG_ENUMERATE
     64 * flag, the callback return value is ignored, iow you cannot cause a callback
     65 * to be deregistered by returning 1 when it is called from
     66 * libusb_hotplug_register_callback().
     67 *
     68 * Callbacks for a particular context are automatically deregistered by libusb_exit().
     69 *
     70 * As of 1.0.16 there are two supported hotplug events:
    5771 *  - LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED: A device has arrived and is ready to use
    5872 *  - LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT: A device has left and is no longer available
     
    6276 * Note: If you receive notification that a device has left and you have any
    6377 * a libusb_device_handles for the device it is up to you to call libusb_close()
    64  * on each handle to free up any remaining resources associated with the device.
     78 * on each device handle to free up any remaining resources associated with the device.
    6579 * Once a device has left any libusb_device_handle associated with the device
    6680 * are invalid and will remain so even if the device comes back.
    6781 *
    6882 * When handling a LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED event it is considered
    69  * safe to call any libusb function that takes a libusb_device. On the other hand,
    70  * when handling a LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT event the only safe function
     83 * safe to call any libusb function that takes a libusb_device. It also safe to
     84 * open a device and submit asynchronous transfers. However, most other functions
     85 * that take a libusb_device_handle are <b>not</b> safe to call. Examples of such
     86 * functions are any of the \ref libusb_syncio "synchronous API" functions or the blocking
     87 * functions that retrieve various \ref libusb_desc "USB descriptors". These functions must
     88 * be used outside of the context of the hotplug callback.
     89 *
     90 * When handling a LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT event the only safe function
    7191 * is libusb_get_device_descriptor().
    7292 *
    7393 * The following code provides an example of the usage of the hotplug interface:
    7494\code
     95#include <stdio.h>
     96#include <stdlib.h>
     97#include <time.h>
     98#include <libusb.h>
     99
    75100static int count = 0;
    76101
    77102int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
    78103                     libusb_hotplug_event event, void *user_data) {
    79   static libusb_device_handle *handle = NULL;
     104  static libusb_device_handle *dev_handle = NULL;
    80105  struct libusb_device_descriptor desc;
    81106  int rc;
     
    84109
    85110  if (LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED == event) {
    86     rc = libusb_open(dev, &handle);
     111    rc = libusb_open(dev, &dev_handle);
    87112    if (LIBUSB_SUCCESS != rc) {
    88113      printf("Could not open USB device\n");
    89114    }
    90115  } else if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event) {
    91     if (handle) {
    92       libusb_close(handle);
    93       handle = NULL;
     116    if (dev_handle) {
     117      libusb_close(dev_handle);
     118      dev_handle = NULL;
    94119    }
    95120  } else {
     
    102127
    103128int main (void) {
    104   libusb_hotplug_callback_handle handle;
     129  libusb_hotplug_callback_handle callback_handle;
    105130  int rc;
    106131
     
    110135                                        LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, 0x045a, 0x5005,
    111136                                        LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, NULL,
    112                                         &handle);
     137                                        &callback_handle);
    113138  if (LIBUSB_SUCCESS != rc) {
    114139    printf("Error creating a hotplug callback\n");
     
    118143
    119144  while (count < 2) {
    120     usleep(10000);
     145    libusb_handle_events_completed(NULL, NULL);
     146    nanosleep(&(struct timespec){0, 10000000UL}, NULL);
    121147  }
    122148
    123   libusb_hotplug_deregister_callback(handle);
     149  libusb_hotplug_deregister_callback(NULL, callback_handle);
    124150  libusb_exit(NULL);
    125151
     
    129155 */
    130156
    131 static int usbi_hotplug_match_cb (struct libusb_device *dev, libusb_hotplug_event event,
    132                                    struct libusb_hotplug_callback *hotplug_cb) {
    133         struct libusb_context *ctx = dev->ctx;
    134 
    135         /* Handle lazy deregistration of callback */
    136         if (hotplug_cb->needs_free) {
    137                 /* Free callback */
    138                 return 1;
    139         }
    140 
    141         if (!(hotplug_cb->events & event)) {
    142                 return 0;
    143         }
    144 
    145         if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->vendor_id &&
    146             hotplug_cb->vendor_id != dev->device_descriptor.idVendor) {
    147                 return 0;
    148         }
    149 
    150         if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->product_id &&
    151             hotplug_cb->product_id != dev->device_descriptor.idProduct) {
    152                 return 0;
    153         }
    154 
    155         if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->dev_class &&
    156             hotplug_cb->dev_class != dev->device_descriptor.bDeviceClass) {
    157                 return 0;
    158         }
    159 
    160         return hotplug_cb->cb (ctx == usbi_default_context ? NULL : ctx,
    161                              dev, event, hotplug_cb->user_data);
    162 }
    163 
    164 void usbi_hotplug_match(struct libusb_device *dev, libusb_hotplug_event event) {
     157static int usbi_hotplug_match_cb (struct libusb_context *ctx,
     158        struct libusb_device *dev, libusb_hotplug_event event,
     159        struct libusb_hotplug_callback *hotplug_cb)
     160{
     161        /* Handle lazy deregistration of callback */
     162        if (hotplug_cb->needs_free) {
     163                /* Free callback */
     164                return 1;
     165        }
     166
     167        if (!(hotplug_cb->events & event)) {
     168                return 0;
     169        }
     170
     171        if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->vendor_id &&
     172            hotplug_cb->vendor_id != dev->device_descriptor.idVendor) {
     173                return 0;
     174        }
     175
     176        if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->product_id &&
     177            hotplug_cb->product_id != dev->device_descriptor.idProduct) {
     178                return 0;
     179        }
     180
     181        if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->dev_class &&
     182            hotplug_cb->dev_class != dev->device_descriptor.bDeviceClass) {
     183                return 0;
     184        }
     185
     186        return hotplug_cb->cb (ctx, dev, event, hotplug_cb->user_data);
     187}
     188
     189void usbi_hotplug_match(struct libusb_context *ctx, struct libusb_device *dev,
     190        libusb_hotplug_event event)
     191{
    165192        struct libusb_hotplug_callback *hotplug_cb, *next;
    166         struct libusb_context *ctx = dev->ctx;
     193        int ret;
    167194
    168195        usbi_mutex_lock(&ctx->hotplug_cbs_lock);
    169196
    170197        list_for_each_entry_safe(hotplug_cb, next, &ctx->hotplug_cbs, list, struct libusb_hotplug_callback) {
    171                 usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
    172                 int ret = usbi_hotplug_match_cb (dev, event, hotplug_cb);
    173                 usbi_mutex_lock(&ctx->hotplug_cbs_lock);
    174 
    175                 if (ret) {
    176                         list_del(&hotplug_cb->list);
    177                         free(hotplug_cb);
    178                 }
     198                usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
     199                ret = usbi_hotplug_match_cb (ctx, dev, event, hotplug_cb);
     200                usbi_mutex_lock(&ctx->hotplug_cbs_lock);
     201
     202                if (ret) {
     203                        list_del(&hotplug_cb->list);
     204                        free(hotplug_cb);
     205                }
    179206        }
    180207
    181208        usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
    182209
    183         /* loop through and disconnect all open handles for this device */
    184         if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event) {
    185                 struct libusb_device_handle *handle;
    186 
    187                 usbi_mutex_lock(&ctx->open_devs_lock);
    188                 list_for_each_entry(handle, &ctx->open_devs, list, struct libusb_device_handle) {
    189                         if (dev == handle->dev) {
    190                                 usbi_handle_disconnect (handle);
    191                         }
    192                 }
    193                 usbi_mutex_unlock(&ctx->open_devs_lock);
    194         }
     210        /* the backend is expected to call the callback for each active transfer */
     211}
     212
     213void usbi_hotplug_notification(struct libusb_context *ctx, struct libusb_device *dev,
     214        libusb_hotplug_event event)
     215{
     216        int pending_events;
     217        libusb_hotplug_message *message = calloc(1, sizeof(*message));
     218
     219        if (!message) {
     220                usbi_err(ctx, "error allocating hotplug message");
     221                return;
     222        }
     223
     224        message->event = event;
     225        message->device = dev;
     226
     227        /* Take the event data lock and add this message to the list.
     228         * Only signal an event if there are no prior pending events. */
     229        usbi_mutex_lock(&ctx->event_data_lock);
     230        pending_events = usbi_pending_events(ctx);
     231        list_add_tail(&message->list, &ctx->hotplug_msgs);
     232        if (!pending_events)
     233                usbi_signal_event(ctx);
     234        usbi_mutex_unlock(&ctx->event_data_lock);
    195235}
    196236
    197237int API_EXPORTED libusb_hotplug_register_callback(libusb_context *ctx,
    198                                                   libusb_hotplug_event events,
    199                                                   libusb_hotplug_flag flags,
    200                                                   int vendor_id, int product_id,
    201                                                   int dev_class,
    202                                                   libusb_hotplug_callback_fn cb_fn,
    203                                                   void *user_data, libusb_hotplug_callback_handle *handle) {
    204         libusb_hotplug_callback *new_callback;
    205         static int handle_id = 1;
    206 
    207         /* check for hotplug support */
    208         if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
    209                 return LIBUSB_ERROR_NOT_SUPPORTED;
    210         }
    211 
    212         /* check for sane values */
    213         if ((LIBUSB_HOTPLUG_MATCH_ANY != vendor_id && (~0xffff & vendor_id)) ||
    214             (LIBUSB_HOTPLUG_MATCH_ANY != product_id && (~0xffff & product_id)) ||
    215             (LIBUSB_HOTPLUG_MATCH_ANY != dev_class && (~0xff & dev_class)) ||
    216             !cb_fn) {
    217                 return LIBUSB_ERROR_INVALID_PARAM;
    218         }
    219 
    220         USBI_GET_CONTEXT(ctx);
    221 
    222         new_callback = (libusb_hotplug_callback *)calloc(1, sizeof (*new_callback));
    223         if (!new_callback) {
    224                 return LIBUSB_ERROR_NO_MEM;
    225         }
    226 
    227         new_callback->ctx = ctx;
    228         new_callback->vendor_id = vendor_id;
    229         new_callback->product_id = product_id;
    230         new_callback->dev_class = dev_class;
    231         new_callback->flags = flags;
    232         new_callback->events = events;
    233         new_callback->cb = cb_fn;
    234         new_callback->user_data = user_data;
    235         new_callback->needs_free = 0;
     238        libusb_hotplug_event events, libusb_hotplug_flag flags,
     239        int vendor_id, int product_id, int dev_class,
     240        libusb_hotplug_callback_fn cb_fn, void *user_data,
     241        libusb_hotplug_callback_handle *callback_handle)
     242{
     243        libusb_hotplug_callback *new_callback;
     244        static int handle_id = 1;
     245
     246        /* check for hotplug support */
     247        if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
     248                return LIBUSB_ERROR_NOT_SUPPORTED;
     249        }
     250
     251        /* check for sane values */
     252        if ((LIBUSB_HOTPLUG_MATCH_ANY != vendor_id && (~0xffff & vendor_id)) ||
     253            (LIBUSB_HOTPLUG_MATCH_ANY != product_id && (~0xffff & product_id)) ||
     254            (LIBUSB_HOTPLUG_MATCH_ANY != dev_class && (~0xff & dev_class)) ||
     255            !cb_fn) {
     256                return LIBUSB_ERROR_INVALID_PARAM;
     257        }
     258
     259        USBI_GET_CONTEXT(ctx);
     260
     261        new_callback = (libusb_hotplug_callback *)calloc(1, sizeof (*new_callback));
     262        if (!new_callback) {
     263                return LIBUSB_ERROR_NO_MEM;
     264        }
     265
     266        new_callback->ctx = ctx;
     267        new_callback->vendor_id = vendor_id;
     268        new_callback->product_id = product_id;
     269        new_callback->dev_class = dev_class;
     270        new_callback->flags = flags;
     271        new_callback->events = events;
     272        new_callback->cb = cb_fn;
     273        new_callback->user_data = user_data;
     274        new_callback->needs_free = 0;
    236275
    237276        usbi_mutex_lock(&ctx->hotplug_cbs_lock);
    238277
    239         /* protect the handle by the context hotplug lock. it doesn't matter if the same handle is used for different
    240           contexts only that the handle is unique for this context */
    241         new_callback->handle = handle_id++;
     278        /* protect the handle by the context hotplug lock. it doesn't matter if the same handle
     279         * is used for different contexts only that the handle is unique for this context */
     280        new_callback->handle = handle_id++;
    242281
    243282        list_add(&new_callback->list, &ctx->hotplug_cbs);
    244283
    245         if (flags & LIBUSB_HOTPLUG_ENUMERATE) {
    246                 struct libusb_device *dev;
    247 
    248                 usbi_mutex_lock(&ctx->usb_devs_lock);
    249 
    250                 list_for_each_entry(dev, &ctx->usb_devs, list, struct libusb_device) {
    251                         (void) usbi_hotplug_match_cb (dev, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, new_callback);
    252                 }
    253 
    254                 usbi_mutex_unlock(&ctx->usb_devs_lock);
    255         }
    256 
    257284        usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
    258285
    259         if (handle) {
    260                 *handle = new_callback->handle;
    261         }
    262 
    263         return LIBUSB_SUCCESS;
    264 }
    265 
    266 void API_EXPORTED libusb_hotplug_deregister_callback (struct libusb_context *ctx, libusb_hotplug_callback_handle handle) {
    267         struct libusb_hotplug_callback *hotplug_cb;
    268 
    269         /* check for hotplug support */
    270         if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
    271                 return;
    272         }
    273 
    274         USBI_GET_CONTEXT(ctx);
    275 
    276         usbi_mutex_lock(&ctx->hotplug_cbs_lock);
    277         list_for_each_entry(hotplug_cb, &ctx->hotplug_cbs, list,
    278                             struct libusb_hotplug_callback) {
    279                 if (handle == hotplug_cb->handle) {
    280                         /* Mark this callback for deregistration */
    281                         hotplug_cb->needs_free = 1;
    282                 }
    283         }
    284         usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
     286
     287        if (flags & LIBUSB_HOTPLUG_ENUMERATE) {
     288                int i, len;
     289                struct libusb_device **devs;
     290
     291                len = (int) libusb_get_device_list(ctx, &devs);
     292                if (len < 0) {
     293                        libusb_hotplug_deregister_callback(ctx,
     294                                                        new_callback->handle);
     295                        return len;
     296                }
     297
     298                for (i = 0; i < len; i++) {
     299                        usbi_hotplug_match_cb(ctx, devs[i],
     300                                        LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED,
     301                                        new_callback);
     302                }
     303
     304                libusb_free_device_list(devs, 1);
     305        }
     306
     307
     308        if (callback_handle)
     309                *callback_handle = new_callback->handle;
     310
     311        return LIBUSB_SUCCESS;
     312}
     313
     314void API_EXPORTED libusb_hotplug_deregister_callback (struct libusb_context *ctx,
     315        libusb_hotplug_callback_handle callback_handle)
     316{
     317        struct libusb_hotplug_callback *hotplug_cb;
     318
     319        /* check for hotplug support */
     320        if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
     321                return;
     322        }
     323
     324        USBI_GET_CONTEXT(ctx);
     325
     326        usbi_mutex_lock(&ctx->hotplug_cbs_lock);
     327        list_for_each_entry(hotplug_cb, &ctx->hotplug_cbs, list,
     328                            struct libusb_hotplug_callback) {
     329                if (callback_handle == hotplug_cb->handle) {
     330                        /* Mark this callback for deregistration */
     331                        hotplug_cb->needs_free = 1;
     332                }
     333        }
     334        usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
     335
     336        usbi_hotplug_notification(ctx, NULL, 0);
    285337}
    286338
     
    292344                                 struct libusb_hotplug_callback) {
    293345                list_del(&hotplug_cb->list);
    294                 free(hotplug_cb);
     346                free(hotplug_cb);
    295347        }
    296348
  • TabularUnified libusb1/trunk/libusb/hotplug.h

    r1876 r1882  
    1 /* -*- Mode: C; indent-tabs-mode:nil ; c-basic-offset:8 -*- */
     1/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
    22/*
    3  * Hotplug support for libusb 1.0
    4  * Copyright (C) 2012      Nathan Hjelm <hjelmn@users.sourceforge.net>
    5  * Copyright (C) 2012      Peter Stuge <peter@stuge.se>
     3 * Hotplug support for libusb
     4 * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
     5 * Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    2222#if !defined(USBI_HOTPLUG_H)
    2323#define USBI_HOTPLUG_H
     24
     25#ifndef LIBUSBI_H
     26#include "libusbi.h"
     27#endif
    2428
    2529/** \ingroup hotplug
     
    4246
    4347        /** Hotplug callback flags */
    44         libusb_hotplug_flag flags;
     48        libusb_hotplug_flag flags;
    4549
    4650        /** Event(s) that will trigger this callback */
     
    5054        libusb_hotplug_callback_fn cb;
    5155
    52         /** Handle for this callback (used to match on deregister) */
    53         libusb_hotplug_callback_handle handle;
     56        /** Handle for this callback (used to match on deregister) */
     57        libusb_hotplug_callback_handle handle;
    5458
    5559        /** User data that will be passed to the callback function */
    5660        void *user_data;
    5761
    58         /** Callback is marked for deletion */
    59         int needs_free;
     62        /** Callback is marked for deletion */
     63        int needs_free;
    6064
    6165        /** List this callback is registered in (ctx->hotplug_cbs) */
    62         struct list_head list;
     66        struct list_head list;
    6367};
    6468
     
    6670
    6771struct libusb_hotplug_message {
    68         libusb_hotplug_event event;
    69         struct libusb_device *device;
     72        /** The hotplug event that occurred */
     73        libusb_hotplug_event event;
     74
     75        /** The device for which this hotplug event occurred */
     76        struct libusb_device *device;
     77
     78        /** List this message is contained in (ctx->hotplug_msgs) */
     79        struct list_head list;
    7080};
    7181
     
    7383
    7484void usbi_hotplug_deregister_all(struct libusb_context *ctx);
    75 void usbi_hotplug_match(struct libusb_device *dev, libusb_hotplug_event event);
     85void usbi_hotplug_match(struct libusb_context *ctx, struct libusb_device *dev,
     86                        libusb_hotplug_event event);
     87void usbi_hotplug_notification(struct libusb_context *ctx, struct libusb_device *dev,
     88                        libusb_hotplug_event event);
    7689
    7790#endif
  • TabularUnified libusb1/trunk/libusb/io.c

    r1879 r1882  
     1/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
    12/*
    23 * I/O functions for libusb
    3  * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
    4  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
     4 * Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
     5 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    2021
    2122#include <config.h>
     23
     24#include <assert.h>
    2225#include <errno.h>
    23 #include <signal.h>
    2426#include <stdint.h>
    2527#include <stdlib.h>
    2628#include <string.h>
    2729#include <time.h>
    28 #include <fcntl.h>
    29 
     30#ifdef HAVE_SIGNAL_H
     31#include <signal.h>
     32#endif
    3033#ifdef HAVE_SYS_TIME_H
    3134#include <sys/time.h>
    3235#endif
    33 
    3436#ifdef USBI_TIMERFD_AVAILABLE
    3537#include <sys/timerfd.h>
     
    4042
    4143/**
    42  * \page io Synchronous and asynchronous device I/O
    43  *
    44  * \section intro Introduction
     44 * \page libusb_io Synchronous and asynchronous device I/O
     45 *
     46 * \section io_intro Introduction
    4547 *
    4648 * If you're using libusb in your application, you're probably wanting to
     
    5456 * Once you have read through the following discussion, you should consult the
    5557 * detailed API documentation pages for the details:
    56  * - \ref syncio
    57  * - \ref asyncio
     58 * - \ref libusb_syncio
     59 * - \ref libusb_asyncio
    5860 *
    5961 * \section theory Transfers at a logical level
     
    9698unsigned char data[4];
    9799int actual_length;
    98 int r = libusb_bulk_transfer(handle, LIBUSB_ENDPOINT_IN, data, sizeof(data), &actual_length, 0);
     100int r = libusb_bulk_transfer(dev_handle, LIBUSB_ENDPOINT_IN, data, sizeof(data), &actual_length, 0);
    99101if (r == 0 && actual_length == sizeof(data)) {
    100102        // results of the transaction can now be found in the data buffer
     
    123125 *
    124126 * For details on how to use the synchronous API, see the
    125  * \ref syncio "synchronous I/O API documentation" pages.
     127 * \ref libusb_syncio "synchronous I/O API documentation" pages.
    126128 *
    127129 * \section async The asynchronous interface
     
    164166 *
    165167 * For details on how to use the asynchronous API, see the
    166  * \ref asyncio "asynchronous I/O API" documentation pages.
     168 * \ref libusb_asyncio "asynchronous I/O API" documentation pages.
    167169 */
    168170
    169171
    170172/**
    171  * \page packetoverflow Packets and overflows
     173 * \page libusb_packetoverflow Packets and overflows
    172174 *
    173175 * \section packets Packet abstraction
     
    211213
    212214/**
    213  * @defgroup asyncio Asynchronous device I/O
     215 * @defgroup libusb_asyncio Asynchronous device I/O
    214216 *
    215217 * This page details libusb's asynchronous (non-blocking) API for USB device
     
    217219 * need to read this page carefully to understand the necessary considerations
    218220 * and issues surrounding use of this interface. Simplistic applications
    219  * may wish to consider the \ref syncio "synchronous I/O API" instead.
     221 * may wish to consider the \ref libusb_syncio "synchronous I/O API" instead.
    220222 *
    221223 * The asynchronous interface is built around the idea of separating transfer
     
    292294 * the libusb_transfer structure documentation for more information.
    293295 *
     296 * <b>Important Note</b>: The user-specified callback is called from an event
     297 * handling context. It is therefore important that no calls are made into
     298 * libusb that will attempt to perform any event handling. Examples of such
     299 * functions are any listed in the \ref libusb_syncio "synchronous API" and any of
     300 * the blocking functions that retrieve \ref libusb_desc "USB descriptors".
     301 *
    294302 * \subsection Deallocation
    295303 *
     
    336344 * smaller than the data that the device wishes to send. In some circumstances
    337345 * this will cause an overflow, which is a nasty condition to deal with. See
    338  * the \ref packetoverflow page for discussion.
     346 * the \ref libusb_packetoverflow page for discussion.
    339347 *
    340348 * \section asyncctrl Considerations for control transfers
     
    465473 * functions may help you here.
    466474 *
     475 * <b>Note</b>: Some operating systems (e.g. Linux) may impose limits on the
     476 * length of individual isochronous packets and/or the total length of the
     477 * isochronous transfer. Such limits can be difficult for libusb to detect,
     478 * so the library will simply try and submit the transfer as set up by you.
     479 * If the transfer fails to submit because it is too large,
     480 * libusb_submit_transfer() will return
     481 * \ref libusb_error::LIBUSB_ERROR_INVALID_PARAM "LIBUSB_ERROR_INVALID_PARAM".
     482 *
    467483 * \section asyncmem Memory caveats
    468484 *
     
    497513 * \section asyncevent Event handling
    498514 *
    499  * In accordance of the aim of being a lightweight library, libusb does not
    500  * create threads internally. This means that libusb code does not execute
    501  * at any time other than when your application is calling a libusb function.
    502  * However, an asynchronous model requires that libusb perform work at various
     515 * An asynchronous model requires that libusb perform work at various
    503516 * points in time - namely processing the results of previously-submitted
    504517 * transfers and invoking the user-supplied callback function.
     
    508521 * the opportunity to reap pending transfers, invoke callbacks, etc.
    509522 *
    510  * The first issue to discuss here is how your application can figure out
    511  * when libusb has work to do. In fact, there are two naive options which
    512  * do not actually require your application to know this:
    513  * -# Periodically call libusb_handle_events() in non-blocking mode at fixed
    514  *    short intervals from your main loop
     523 * There are 2 different approaches to dealing with libusb_handle_events:
     524 *
    515525 * -# Repeatedly call libusb_handle_events() in blocking mode from a dedicated
    516526 *    thread.
    517  *
    518  * The first option is plainly not very nice, and will cause unnecessary
    519  * CPU wakeups leading to increased power usage and decreased battery life.
    520  * The second option is not very nice either, but may be the nicest option
    521  * available to you if the "proper" approach can not be applied to your
    522  * application (read on...).
    523  *
    524  * The recommended option is to integrate libusb with your application main
    525  * event loop. libusb exposes a set of file descriptors which allow you to do
    526  * this. Your main loop is probably already calling poll() or select() or a
     527 * -# Integrate libusb with your application's main event loop. libusb
     528 *    exposes a set of file descriptors which allow you to do this.
     529 *
     530 * The first approach has the big advantage that it will also work on Windows
     531 * were libusb' poll API for select / poll integration is not available. So
     532 * if you want to support Windows and use the async API, you must use this
     533 * approach, see the \ref eventthread "Using an event handling thread" section
     534 * below for details.
     535 *
     536 * If you prefer a single threaded approach with a single central event loop,
     537 * see the \ref libusb_poll "polling and timing" section for how to integrate libusb
     538 * into your application's main event loop.
     539 *
     540 * \section eventthread Using an event handling thread
     541 *
     542 * Lets begin with stating the obvious: If you're going to use a separate
     543 * thread for libusb event handling, your callback functions MUST be
     544 * threadsafe.
     545 *
     546 * Other then that doing event handling from a separate thread, is mostly
     547 * simple. You can use an event thread function as follows:
     548\code
     549void *event_thread_func(void *ctx)
     550{
     551    while (event_thread_run)
     552        libusb_handle_events(ctx);
     553
     554    return NULL;
     555}
     556\endcode
     557 *
     558 * There is one caveat though, stopping this thread requires setting the
     559 * event_thread_run variable to 0, and after that libusb_handle_events() needs
     560 * to return control to event_thread_func. But unless some event happens,
     561 * libusb_handle_events() will not return.
     562 *
     563 * There are 2 different ways of dealing with this, depending on if your
     564 * application uses libusb' \ref libusb_hotplug "hotplug" support or not.
     565 *
     566 * Applications which do not use hotplug support, should not start the event
     567 * thread until after their first call to libusb_open(), and should stop the
     568 * thread when closing the last open device as follows:
     569\code
     570void my_close_handle(libusb_device_handle *dev_handle)
     571{
     572    if (open_devs == 1)
     573        event_thread_run = 0;
     574
     575    libusb_close(dev_handle); // This wakes up libusb_handle_events()
     576
     577    if (open_devs == 1)
     578        pthread_join(event_thread);
     579
     580    open_devs--;
     581}
     582\endcode
     583 *
     584 * Applications using hotplug support should start the thread at program init,
     585 * after having successfully called libusb_hotplug_register_callback(), and
     586 * should stop the thread at program exit as follows:
     587\code
     588void my_libusb_exit(void)
     589{
     590    event_thread_run = 0;
     591    libusb_hotplug_deregister_callback(ctx, hotplug_cb_handle); // This wakes up libusb_handle_events()
     592    pthread_join(event_thread);
     593    libusb_exit(ctx);
     594}
     595\endcode
     596 */
     597
     598/**
     599 * @defgroup libusb_poll Polling and timing
     600 *
     601 * This page documents libusb's functions for polling events and timing.
     602 * These functions are only necessary for users of the
     603 * \ref libusb_asyncio "asynchronous API". If you are only using the simpler
     604 * \ref libusb_syncio "synchronous API" then you do not need to ever call these
     605 * functions.
     606 *
     607 * The justification for the functionality described here has already been
     608 * discussed in the \ref asyncevent "event handling" section of the
     609 * asynchronous API documentation. In summary, libusb does not create internal
     610 * threads for event processing and hence relies on your application calling
     611 * into libusb at certain points in time so that pending events can be handled.
     612 *
     613 * Your main loop is probably already calling poll() or select() or a
    527614 * variant on a set of file descriptors for other event sources (e.g. keyboard
    528615 * button presses, mouse movements, network sockets, etc). You then add
     
    532619 *
    533620 * There is one final event handling complication. libusb supports
    534  * asynchronous transfers which time out after a specified time period, and
    535  * this requires that libusb is called into at or after the timeout so that
    536  * the timeout can be handled. So, in addition to considering libusb's file
     621 * asynchronous transfers which time out after a specified time period.
     622 *
     623 * On some platforms a timerfd is used, so the timeout handling is just another
     624 * fd, on other platforms this requires that libusb is called into at or after
     625 * the timeout to handle it. So, in addition to considering libusb's file
    537626 * descriptors in your main event loop, you must also consider that libusb
    538627 * sometimes needs to be called into at fixed points in time even when there
    539  * is no file descriptor activity.
    540  *
    541  * For the details on retrieving the set of file descriptors and determining
    542  * the next timeout, see the \ref poll "polling and timing" API documentation.
    543  */
    544 
    545 /**
    546  * @defgroup poll Polling and timing
    547  *
    548  * This page documents libusb's functions for polling events and timing.
    549  * These functions are only necessary for users of the
    550  * \ref asyncio "asynchronous API". If you are only using the simpler
    551  * \ref syncio "synchronous API" then you do not need to ever call these
    552  * functions.
    553  *
    554  * The justification for the functionality described here has already been
    555  * discussed in the \ref asyncevent "event handling" section of the
    556  * asynchronous API documentation. In summary, libusb does not create internal
    557  * threads for event processing and hence relies on your application calling
    558  * into libusb at certain points in time so that pending events can be handled.
     628 * is no file descriptor activity, see \ref polltime details.
     629 *
    559630 * In order to know precisely when libusb needs to be called into, libusb
    560631 * offers you a set of pollable file descriptors and information about when
     
    583654 * handle those details internally.
    584655 *
    585  * \section pollmain The more advanced option
     656 * \section libusb_pollmain The more advanced option
    586657 *
    587658 * \note This functionality is currently only available on Unix-like platforms.
    588  * On Windows, libusb_get_pollfds() simply returns NULL. Exposing event sources
    589  * on Windows will require some further thought and design.
     659 * On Windows, libusb_get_pollfds() simply returns NULL. Applications which
     660 * want to support Windows are advised to use an \ref eventthread
     661 * "event handling thread" instead.
    590662 *
    591663 * In more advanced applications, you will already have a main loop which
     
    697769 * with these entities otherwise.
    698770 *
    699  * See the extra documentation: \ref mtasync
    700  */
    701 
    702 /** \page mtasync Multi-threaded applications and asynchronous I/O
     771 * See the extra documentation: \ref libusb_mtasync
     772 */
     773
     774/** \page libusb_mtasync Multi-threaded applications and asynchronous I/O
    703775 *
    704776 * libusb is a thread-safe library, but extra considerations must be applied
     
    708780 * revolves around monitoring file descriptors through the poll()/select()
    709781 * system calls. This is directly exposed at the
    710  * \ref asyncio "asynchronous interface" but it is important to note that the
    711  * \ref syncio "synchronous interface" is implemented on top of the
     782 * \ref libusb_asyncio "asynchronous interface" but it is important to note that the
     783 * \ref libusb_syncio "synchronous interface" is implemented on top of the
    712784 * asynchonrous interface, therefore the same considerations apply.
    713785 *
     
    732804void myfunc() {
    733805        struct libusb_transfer *transfer;
    734         unsigned char buffer[LIBUSB_CONTROL_SETUP_SIZE];
     806        unsigned char buffer[LIBUSB_CONTROL_SETUP_SIZE] __attribute__ ((aligned (2)));
    735807        int completed = 0;
    736808
     
    9751047 * -# During initialization, libusb opens an internal pipe, and it adds the read
    9761048 *    end of this pipe to the set of file descriptors to be polled.
    977  * -# During libusb_close(), libusb writes some dummy data on this control pipe.
     1049 * -# During libusb_close(), libusb writes some dummy data on this event pipe.
    9781050 *    This immediately interrupts the event handler. libusb also records
    9791051 *    internally that it is trying to interrupt event handlers for this
     
    10081080 *
    10091081 * -# The device is opened and a file descriptor is added to the poll set.
    1010  * -# libusb sends some dummy data on the control pipe, and records that it
     1082 * -# libusb sends some dummy data on the event pipe, and records that it
    10111083 *    is trying to modify the poll descriptor set.
    10121084 * -# The event handler is interrupted, and the same behaviour change as for
     
    10361108 * and another trying to send a synchronous USB transfer, you will end up with
    10371109 * two threads monitoring the same descriptors, and the above-described
    1038  * undesirable behaviour occuring. The solution is for your polling thread to
     1110 * undesirable behaviour occurring. The solution is for your polling thread to
    10391111 * play by the rules; the synchronous I/O functions do so, and this will result
    10401112 * in them getting along in perfect harmony.
     
    10531125        int r;
    10541126
    1055         usbi_mutex_init(&ctx->flying_transfers_lock, NULL);
    1056         usbi_mutex_init(&ctx->pollfds_lock, NULL);
    1057         usbi_mutex_init(&ctx->pollfd_modify_lock, NULL);
    1058         usbi_mutex_init_recursive(&ctx->events_lock, NULL);
    1059         usbi_mutex_init(&ctx->event_waiters_lock, NULL);
    1060         usbi_cond_init(&ctx->event_waiters_cond, NULL);
     1127        usbi_mutex_init(&ctx->flying_transfers_lock);
     1128        usbi_mutex_init(&ctx->events_lock);
     1129        usbi_mutex_init(&ctx->event_waiters_lock);
     1130        usbi_cond_init(&ctx->event_waiters_cond);
     1131        usbi_mutex_init(&ctx->event_data_lock);
     1132        usbi_tls_key_create(&ctx->event_handling_key);
    10611133        list_init(&ctx->flying_transfers);
    1062         list_init(&ctx->pollfds);
     1134        list_init(&ctx->ipollfds);
     1135        list_init(&ctx->hotplug_msgs);
     1136        list_init(&ctx->completed_transfers);
    10631137
    10641138        /* FIXME should use an eventfd on kernels that support it */
    1065 
    1066         r = usbi_pipe(ctx->ctrl_pipe);
    1067 
     1139        r = usbi_pipe(ctx->event_pipe);
    10681140        if (r < 0) {
    10691141                r = LIBUSB_ERROR_OTHER;
     
    10711143        }
    10721144
    1073         r = usbi_add_pollfd(ctx, ctx->ctrl_pipe[0], POLLIN);
     1145        r = usbi_add_pollfd(ctx, ctx->event_pipe[0], POLLIN);
    10741146        if (r < 0)
    10751147                goto err_close_pipe;
    1076 
    1077         /* create hotplug pipe */
    1078         r = usbi_pipe(ctx->hotplug_pipe);
    1079         if (r < 0) {
    1080                 r = LIBUSB_ERROR_OTHER;
    1081                 goto err;
    1082         }
    1083 
    1084 #ifndef OS_WINDOWS
    1085         fcntl (ctx->hotplug_pipe[1], F_SETFD, O_NONBLOCK);
    1086 #endif
    1087         r = usbi_add_pollfd(ctx, ctx->hotplug_pipe[0], POLLIN);
    1088         if (r < 0)
    1089                 goto err_close_hp_pipe;
    10901148
    10911149#ifdef USBI_TIMERFD_AVAILABLE
     
    10951153                usbi_dbg("using timerfd for timeouts");
    10961154                r = usbi_add_pollfd(ctx, ctx->timerfd, POLLIN);
    1097                 if (r < 0) {
    1098                         usbi_remove_pollfd(ctx, ctx->ctrl_pipe[0]);
    1099                         close(ctx->timerfd);
    1100                         goto err_close_hp_pipe;
    1101                 }
     1155                if (r < 0)
     1156                        goto err_close_timerfd;
    11021157        } else {
    11031158                usbi_dbg("timerfd not available (code %d error %d)", ctx->timerfd, errno);
     
    11081163        return 0;
    11091164
    1110 err_close_hp_pipe:
    1111         usbi_close(ctx->hotplug_pipe[0]);
    1112         usbi_close(ctx->hotplug_pipe[1]);
     1165#ifdef USBI_TIMERFD_AVAILABLE
     1166err_close_timerfd:
     1167        close(ctx->timerfd);
     1168        usbi_remove_pollfd(ctx, ctx->event_pipe[0]);
     1169#endif
    11131170err_close_pipe:
    1114         usbi_close(ctx->ctrl_pipe[0]);
    1115         usbi_close(ctx->ctrl_pipe[1]);
     1171        usbi_close(ctx->event_pipe[0]);
     1172        usbi_close(ctx->event_pipe[1]);
    11161173err:
    11171174        usbi_mutex_destroy(&ctx->flying_transfers_lock);
    1118         usbi_mutex_destroy(&ctx->pollfds_lock);
    1119         usbi_mutex_destroy(&ctx->pollfd_modify_lock);
    11201175        usbi_mutex_destroy(&ctx->events_lock);
    11211176        usbi_mutex_destroy(&ctx->event_waiters_lock);
    11221177        usbi_cond_destroy(&ctx->event_waiters_cond);
     1178        usbi_mutex_destroy(&ctx->event_data_lock);
     1179        usbi_tls_key_delete(ctx->event_handling_key);
    11231180        return r;
    11241181}
     
    11261183void usbi_io_exit(struct libusb_context *ctx)
    11271184{
    1128         usbi_remove_pollfd(ctx, ctx->ctrl_pipe[0]);
    1129         usbi_close(ctx->ctrl_pipe[0]);
    1130         usbi_close(ctx->ctrl_pipe[1]);
    1131         usbi_remove_pollfd(ctx, ctx->hotplug_pipe[0]);
    1132         usbi_close(ctx->hotplug_pipe[0]);
    1133         usbi_close(ctx->hotplug_pipe[1]);
     1185        usbi_remove_pollfd(ctx, ctx->event_pipe[0]);
     1186        usbi_close(ctx->event_pipe[0]);
     1187        usbi_close(ctx->event_pipe[1]);
    11341188#ifdef USBI_TIMERFD_AVAILABLE
    11351189        if (usbi_using_timerfd(ctx)) {
     
    11391193#endif
    11401194        usbi_mutex_destroy(&ctx->flying_transfers_lock);
    1141         usbi_mutex_destroy(&ctx->pollfds_lock);
    1142         usbi_mutex_destroy(&ctx->pollfd_modify_lock);
    11431195        usbi_mutex_destroy(&ctx->events_lock);
    11441196        usbi_mutex_destroy(&ctx->event_waiters_lock);
    11451197        usbi_cond_destroy(&ctx->event_waiters_cond);
     1198        usbi_mutex_destroy(&ctx->event_data_lock);
     1199        usbi_tls_key_delete(ctx->event_handling_key);
     1200        if (ctx->pollfds)
     1201                free(ctx->pollfds);
    11461202}
    11471203
     
    11751231}
    11761232
    1177 /* add a transfer to the (timeout-sorted) active transfers list.
    1178  * returns 1 if the transfer has a timeout and it is the timeout next to
    1179  * expire */
    1180 static int add_to_flying_list(struct usbi_transfer *transfer)
    1181 {
    1182         struct usbi_transfer *cur;
    1183         struct timeval *timeout = &transfer->timeout;
    1184         struct libusb_context *ctx = ITRANSFER_CTX(transfer);
    1185         int r = 0;
    1186         int first = 1;
    1187 
    1188         usbi_mutex_lock(&ctx->flying_transfers_lock);
    1189 
    1190         /* if we have no other flying transfers, start the list with this one */
    1191         if (list_empty(&ctx->flying_transfers)) {
    1192                 list_add(&transfer->list, &ctx->flying_transfers);
    1193                 if (timerisset(timeout))
    1194                         r = 1;
    1195                 goto out;
    1196         }
    1197 
    1198         /* if we have infinite timeout, append to end of list */
    1199         if (!timerisset(timeout)) {
    1200                 list_add_tail(&transfer->list, &ctx->flying_transfers);
    1201                 goto out;
    1202         }
    1203 
    1204         /* otherwise, find appropriate place in list */
    1205         list_for_each_entry(cur, &ctx->flying_transfers, list, struct usbi_transfer) {
    1206                 /* find first timeout that occurs after the transfer in question */
    1207                 struct timeval *cur_tv = &cur->timeout;
    1208 
    1209                 if (!timerisset(cur_tv) || (cur_tv->tv_sec > timeout->tv_sec) ||
    1210                                 (cur_tv->tv_sec == timeout->tv_sec &&
    1211                                         cur_tv->tv_usec > timeout->tv_usec)) {
    1212                         list_add_tail(&transfer->list, &cur->list);
    1213                         r = first;
    1214                         goto out;
    1215                 }
    1216                 first = 0;
    1217         }
    1218 
    1219         /* otherwise we need to be inserted at the end */
    1220         list_add_tail(&transfer->list, &ctx->flying_transfers);
    1221 out:
    1222         usbi_mutex_unlock(&ctx->flying_transfers_lock);
    1223         return r;
    1224 }
    1225 
    1226 /** \ingroup asyncio
     1233/** \ingroup libusb_asyncio
    12271234 * Allocate a libusb transfer with a specified number of isochronous packet
    12281235 * descriptors. The returned transfer is pre-initialized for you. When the new
     
    12511258        int iso_packets)
    12521259{
    1253         size_t os_alloc_size = usbi_backend->transfer_priv_size
    1254                 + (usbi_backend->add_iso_packet_size * iso_packets);
     1260        struct libusb_transfer *transfer;
     1261        size_t os_alloc_size = usbi_backend->transfer_priv_size;
    12551262        size_t alloc_size = sizeof(struct usbi_transfer)
    12561263                + sizeof(struct libusb_transfer)
     
    12581265                + os_alloc_size;
    12591266#ifndef __OS2__
    1260         struct usbi_transfer *itransfer = malloc(alloc_size);
     1267        struct usbi_transfer *itransfer = calloc(1, alloc_size);
    12611268#else
    12621269        /* ensure memory is allocated in low memory arena */
     
    12661273                return NULL;
    12671274
    1268         memset(itransfer, 0, alloc_size);
    12691275        itransfer->num_iso_packets = iso_packets;
    1270         usbi_mutex_init(&itransfer->lock, NULL);
    1271         return USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    1272 }
    1273 
    1274 /** \ingroup asyncio
     1276        usbi_mutex_init(&itransfer->lock);
     1277        transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
     1278        usbi_dbg("transfer %p", transfer);
     1279        return transfer;
     1280}
     1281
     1282/** \ingroup libusb_asyncio
    12751283 * Free a transfer structure. This should be called for all transfers
    12761284 * allocated with libusb_alloc_transfer().
     
    12951303                return;
    12961304
     1305        usbi_dbg("transfer %p", transfer);
    12971306        if (transfer->flags & LIBUSB_TRANSFER_FREE_BUFFER && transfer->buffer)
    12981307                free(transfer->buffer);
     
    13011310        usbi_mutex_destroy(&itransfer->lock);
    13021311        free(itransfer);
    1303 }
    1304 
    1305 /** \ingroup asyncio
    1306  * Submit a transfer. This function will fire off the USB transfer and then
    1307  * return immediately.
    1308  *
    1309  * \param transfer the transfer to submit
    1310  * \returns 0 on success
    1311  * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
    1312  * \returns LIBUSB_ERROR_BUSY if the transfer has already been submitted.
    1313  * \returns LIBUSB_ERROR_NOT_SUPPORTED if the transfer flags are not supported
    1314  * by the operating system.
    1315  * \returns another LIBUSB_ERROR code on other failure
    1316  */
    1317 int API_EXPORTED libusb_submit_transfer(struct libusb_transfer *transfer)
    1318 {
    1319         struct libusb_context *ctx = TRANSFER_CTX(transfer);
    1320         struct usbi_transfer *itransfer =
    1321                 LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer);
    1322         int r;
    1323         int first;
    1324         int updated_fds;
    1325 
    1326         usbi_mutex_lock(&itransfer->lock);
    1327         itransfer->transferred = 0;
    1328         itransfer->flags = 0;
    1329         r = calculate_timeout(itransfer);
    1330         if (r < 0) {
    1331                 r = LIBUSB_ERROR_OTHER;
    1332                 goto out;
    1333         }
    1334 
    1335         first = add_to_flying_list(itransfer);
    1336         r = usbi_backend->submit_transfer(itransfer);
    1337         if (r) {
    1338                 usbi_mutex_lock(&ctx->flying_transfers_lock);
    1339                 list_del(&itransfer->list);
    1340                 usbi_mutex_unlock(&ctx->flying_transfers_lock);
    1341         }
    1342 #ifdef USBI_TIMERFD_AVAILABLE
    1343         else if (first && usbi_using_timerfd(ctx)) {
    1344                 /* if this transfer has the lowest timeout of all active transfers,
    1345                  * rearm the timerfd with this transfer's timeout */
    1346                 const struct itimerspec it = { {0, 0},
    1347                         { itransfer->timeout.tv_sec, itransfer->timeout.tv_usec * 1000 } };
    1348                 usbi_dbg("arm timerfd for timeout in %dms (first in line)", transfer->timeout);
    1349                 r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
    1350                 if (r < 0)
    1351                         r = LIBUSB_ERROR_OTHER;
    1352         }
    1353 #else
    1354         (void)first;
    1355 #endif
    1356 
    1357 out:
    1358         updated_fds = (itransfer->flags & USBI_TRANSFER_UPDATED_FDS);
    1359         usbi_mutex_unlock(&itransfer->lock);
    1360         if (updated_fds)
    1361                 usbi_fd_notification(ctx);
    1362         return r;
    1363 }
    1364 
    1365 /** \ingroup asyncio
    1366  * Asynchronously cancel a previously submitted transfer.
    1367  * This function returns immediately, but this does not indicate cancellation
    1368  * is complete. Your callback function will be invoked at some later time
    1369  * with a transfer status of
    1370  * \ref libusb_transfer_status::LIBUSB_TRANSFER_CANCELLED
    1371  * "LIBUSB_TRANSFER_CANCELLED."
    1372  *
    1373  * \param transfer the transfer to cancel
    1374  * \returns 0 on success
    1375  * \returns LIBUSB_ERROR_NOT_FOUND if the transfer is already complete or
    1376  * cancelled.
    1377  * \returns a LIBUSB_ERROR code on failure
    1378  */
    1379 int API_EXPORTED libusb_cancel_transfer(struct libusb_transfer *transfer)
    1380 {
    1381         struct usbi_transfer *itransfer =
    1382                 LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer);
    1383         int r;
    1384 
    1385         usbi_dbg("");
    1386         usbi_mutex_lock(&itransfer->lock);
    1387         r = usbi_backend->cancel_transfer(itransfer);
    1388         if (r < 0) {
    1389                 if (r != LIBUSB_ERROR_NOT_FOUND)
    1390                         usbi_err(TRANSFER_CTX(transfer),
    1391                                 "cancel transfer failed error %d", r);
    1392                 else
    1393                         usbi_dbg("cancel transfer failed error %d", r);
    1394 
    1395                 if (r == LIBUSB_ERROR_NO_DEVICE)
    1396                         itransfer->flags |= USBI_TRANSFER_DEVICE_DISAPPEARED;
    1397         }
    1398 
    1399         itransfer->flags |= USBI_TRANSFER_CANCELLING;
    1400 
    1401         usbi_mutex_unlock(&itransfer->lock);
    1402         return r;
    14031312}
    14041313
     
    14201329 * next upcoming timeout.
    14211330 * must be called with flying_list locked.
    1422  * returns 0 if there was no timeout to arm, 1 if the next timeout was armed,
    1423  * or a LIBUSB_ERROR code on failure.
     1331 * returns 0 on success or a LIBUSB_ERROR code on failure.
    14241332 */
    14251333static int arm_timerfd_for_next_timeout(struct libusb_context *ctx)
     
    14331341                 * arming to do */
    14341342                if (!timerisset(cur_tv))
    1435                         return 0;
    1436 
    1437                 /* act on first transfer that is not already cancelled */
    1438                 if (!(transfer->flags & USBI_TRANSFER_TIMED_OUT)) {
     1343                        goto disarm;
     1344
     1345                /* act on first transfer that has not already been handled */
     1346                if (!(transfer->timeout_flags & (USBI_TRANSFER_TIMEOUT_HANDLED | USBI_TRANSFER_OS_HANDLES_TIMEOUT))) {
    14391347                        int r;
    14401348                        const struct itimerspec it = { {0, 0},
     
    14441352                        if (r < 0)
    14451353                                return LIBUSB_ERROR_OTHER;
    1446                         return 1;
     1354                        return 0;
    14471355                }
    14481356        }
    14491357
     1358disarm:
     1359        return disarm_timerfd(ctx);
     1360}
     1361#else
     1362static int arm_timerfd_for_next_timeout(struct libusb_context *ctx)
     1363{
     1364        UNUSED(ctx);
    14501365        return 0;
    14511366}
     1367#endif
     1368
     1369/* add a transfer to the (timeout-sorted) active transfers list.
     1370 * This function will return non 0 if fails to update the timer,
     1371 * in which case the transfer is *not* on the flying_transfers list. */
     1372static int add_to_flying_list(struct usbi_transfer *transfer)
     1373{
     1374        struct usbi_transfer *cur;
     1375        struct timeval *timeout = &transfer->timeout;
     1376        struct libusb_context *ctx = ITRANSFER_CTX(transfer);
     1377        int r;
     1378        int first = 1;
     1379
     1380        r = calculate_timeout(transfer);
     1381        if (r)
     1382                return r;
     1383
     1384        /* if we have no other flying transfers, start the list with this one */
     1385        if (list_empty(&ctx->flying_transfers)) {
     1386                list_add(&transfer->list, &ctx->flying_transfers);
     1387                goto out;
     1388        }
     1389
     1390        /* if we have infinite timeout, append to end of list */
     1391        if (!timerisset(timeout)) {
     1392                list_add_tail(&transfer->list, &ctx->flying_transfers);
     1393                /* first is irrelevant in this case */
     1394                goto out;
     1395        }
     1396
     1397        /* otherwise, find appropriate place in list */
     1398        list_for_each_entry(cur, &ctx->flying_transfers, list, struct usbi_transfer) {
     1399                /* find first timeout that occurs after the transfer in question */
     1400                struct timeval *cur_tv = &cur->timeout;
     1401
     1402                if (!timerisset(cur_tv) || (cur_tv->tv_sec > timeout->tv_sec) ||
     1403                                (cur_tv->tv_sec == timeout->tv_sec &&
     1404                                        cur_tv->tv_usec > timeout->tv_usec)) {
     1405                        list_add_tail(&transfer->list, &cur->list);
     1406                        goto out;
     1407                }
     1408                first = 0;
     1409        }
     1410        /* first is 0 at this stage (list not empty) */
     1411
     1412        /* otherwise we need to be inserted at the end */
     1413        list_add_tail(&transfer->list, &ctx->flying_transfers);
     1414out:
     1415#ifdef USBI_TIMERFD_AVAILABLE
     1416        if (first && usbi_using_timerfd(ctx) && timerisset(timeout)) {
     1417                /* if this transfer has the lowest timeout of all active transfers,
     1418                 * rearm the timerfd with this transfer's timeout */
     1419                const struct itimerspec it = { {0, 0},
     1420                        { timeout->tv_sec, timeout->tv_usec * 1000 } };
     1421                usbi_dbg("arm timerfd for timeout in %dms (first in line)",
     1422                        USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)->timeout);
     1423                r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
     1424                if (r < 0) {
     1425                        usbi_warn(ctx, "failed to arm first timerfd (errno %d)", errno);
     1426                        r = LIBUSB_ERROR_OTHER;
     1427                }
     1428        }
    14521429#else
    1453 static int disarm_timerfd(struct libusb_context *ctx)
    1454 {
    1455         (void)ctx;
    1456         return 0;
    1457 }
    1458 static int arm_timerfd_for_next_timeout(struct libusb_context *ctx)
    1459 {
    1460         (void)ctx;
    1461         return 0;
    1462 }
     1430        UNUSED(first);
    14631431#endif
     1432
     1433        if (r)
     1434                list_del(&transfer->list);
     1435
     1436        return r;
     1437}
     1438
     1439/* remove a transfer from the active transfers list.
     1440 * This function will *always* remove the transfer from the
     1441 * flying_transfers list. It will return a LIBUSB_ERROR code
     1442 * if it fails to update the timer for the next timeout. */
     1443static int remove_from_flying_list(struct usbi_transfer *transfer)
     1444{
     1445        struct libusb_context *ctx = ITRANSFER_CTX(transfer);
     1446        int rearm_timerfd;
     1447        int r = 0;
     1448
     1449        usbi_mutex_lock(&ctx->flying_transfers_lock);
     1450        rearm_timerfd = (timerisset(&transfer->timeout) &&
     1451                list_first_entry(&ctx->flying_transfers, struct usbi_transfer, list) == transfer);
     1452        list_del(&transfer->list);
     1453        if (usbi_using_timerfd(ctx) && rearm_timerfd)
     1454                r = arm_timerfd_for_next_timeout(ctx);
     1455        usbi_mutex_unlock(&ctx->flying_transfers_lock);
     1456
     1457        return r;
     1458}
     1459
     1460/** \ingroup libusb_asyncio
     1461 * Submit a transfer. This function will fire off the USB transfer and then
     1462 * return immediately.
     1463 *
     1464 * \param transfer the transfer to submit
     1465 * \returns 0 on success
     1466 * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
     1467 * \returns LIBUSB_ERROR_BUSY if the transfer has already been submitted.
     1468 * \returns LIBUSB_ERROR_NOT_SUPPORTED if the transfer flags are not supported
     1469 * by the operating system.
     1470 * \returns LIBUSB_ERROR_INVALID_PARAM if the transfer size is larger than
     1471 * the operating system and/or hardware can support
     1472 * \returns another LIBUSB_ERROR code on other failure
     1473 */
     1474int API_EXPORTED libusb_submit_transfer(struct libusb_transfer *transfer)
     1475{
     1476        struct usbi_transfer *itransfer =
     1477                LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer);
     1478        struct libusb_context *ctx = TRANSFER_CTX(transfer);
     1479        int r;
     1480
     1481        usbi_dbg("transfer %p", transfer);
     1482
     1483        /*
     1484         * Important note on locking, this function takes / releases locks
     1485         * in the following order:
     1486         *  take flying_transfers_lock
     1487         *  take itransfer->lock
     1488         *  clear transfer
     1489         *  add to flying_transfers list
     1490         *  release flying_transfers_lock
     1491         *  submit transfer
     1492         *  release itransfer->lock
     1493         *  if submit failed:
     1494         *   take flying_transfers_lock
     1495         *   remove from flying_transfers list
     1496         *   release flying_transfers_lock
     1497         *
     1498         * Note that it takes locks in the order a-b and then releases them
     1499         * in the same order a-b. This is somewhat unusual but not wrong,
     1500         * release order is not important as long as *all* locks are released
     1501         * before re-acquiring any locks.
     1502         *
     1503         * This means that the ordering of first releasing itransfer->lock
     1504         * and then re-acquiring the flying_transfers_list on error is
     1505         * important and must not be changed!
     1506         *
     1507         * This is done this way because when we take both locks we must always
     1508         * take flying_transfers_lock first to avoid ab-ba style deadlocks with
     1509         * the timeout handling and usbi_handle_disconnect paths.
     1510         *
     1511         * And we cannot release itransfer->lock before the submission is
     1512         * complete otherwise timeout handling for transfers with short
     1513         * timeouts may run before submission.
     1514         */
     1515        usbi_mutex_lock(&ctx->flying_transfers_lock);
     1516        usbi_mutex_lock(&itransfer->lock);
     1517        if (itransfer->state_flags & USBI_TRANSFER_IN_FLIGHT) {
     1518                usbi_mutex_unlock(&ctx->flying_transfers_lock);
     1519                usbi_mutex_unlock(&itransfer->lock);
     1520                return LIBUSB_ERROR_BUSY;
     1521        }
     1522        itransfer->transferred = 0;
     1523        itransfer->state_flags = 0;
     1524        itransfer->timeout_flags = 0;
     1525        r = add_to_flying_list(itransfer);
     1526        if (r) {
     1527                usbi_mutex_unlock(&ctx->flying_transfers_lock);
     1528                usbi_mutex_unlock(&itransfer->lock);
     1529                return r;
     1530        }
     1531        /*
     1532         * We must release the flying transfers lock here, because with
     1533         * some backends the submit_transfer method is synchroneous.
     1534         */
     1535        usbi_mutex_unlock(&ctx->flying_transfers_lock);
     1536
     1537        r = usbi_backend->submit_transfer(itransfer);
     1538        if (r == LIBUSB_SUCCESS) {
     1539                itransfer->state_flags |= USBI_TRANSFER_IN_FLIGHT;
     1540                /* keep a reference to this device */
     1541                libusb_ref_device(transfer->dev_handle->dev);
     1542        }
     1543        usbi_mutex_unlock(&itransfer->lock);
     1544
     1545        if (r != LIBUSB_SUCCESS)
     1546                remove_from_flying_list(itransfer);
     1547
     1548        return r;
     1549}
     1550
     1551/** \ingroup libusb_asyncio
     1552 * Asynchronously cancel a previously submitted transfer.
     1553 * This function returns immediately, but this does not indicate cancellation
     1554 * is complete. Your callback function will be invoked at some later time
     1555 * with a transfer status of
     1556 * \ref libusb_transfer_status::LIBUSB_TRANSFER_CANCELLED
     1557 * "LIBUSB_TRANSFER_CANCELLED."
     1558 *
     1559 * \param transfer the transfer to cancel
     1560 * \returns 0 on success
     1561 * \returns LIBUSB_ERROR_NOT_FOUND if the transfer is not in progress,
     1562 * already complete, or already cancelled.
     1563 * \returns a LIBUSB_ERROR code on failure
     1564 */
     1565int API_EXPORTED libusb_cancel_transfer(struct libusb_transfer *transfer)
     1566{
     1567        struct usbi_transfer *itransfer =
     1568                LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer);
     1569        int r;
     1570
     1571        usbi_dbg("transfer %p", transfer );
     1572        usbi_mutex_lock(&itransfer->lock);
     1573        if (!(itransfer->state_flags & USBI_TRANSFER_IN_FLIGHT)
     1574                        || (itransfer->state_flags & USBI_TRANSFER_CANCELLING)) {
     1575                r = LIBUSB_ERROR_NOT_FOUND;
     1576                goto out;
     1577        }
     1578        r = usbi_backend->cancel_transfer(itransfer);
     1579        if (r < 0) {
     1580                if (r != LIBUSB_ERROR_NOT_FOUND &&
     1581                    r != LIBUSB_ERROR_NO_DEVICE)
     1582                        usbi_err(TRANSFER_CTX(transfer),
     1583                                "cancel transfer failed error %d", r);
     1584                else
     1585                        usbi_dbg("cancel transfer failed error %d", r);
     1586
     1587                if (r == LIBUSB_ERROR_NO_DEVICE)
     1588                        itransfer->state_flags |= USBI_TRANSFER_DEVICE_DISAPPEARED;
     1589        }
     1590
     1591        itransfer->state_flags |= USBI_TRANSFER_CANCELLING;
     1592
     1593out:
     1594        usbi_mutex_unlock(&itransfer->lock);
     1595        return r;
     1596}
     1597
     1598/** \ingroup libusb_asyncio
     1599 * Set a transfers bulk stream id. Note users are advised to use
     1600 * libusb_fill_bulk_stream_transfer() instead of calling this function
     1601 * directly.
     1602 *
     1603 * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103
     1604 *
     1605 * \param transfer the transfer to set the stream id for
     1606 * \param stream_id the stream id to set
     1607 * \see libusb_alloc_streams()
     1608 */
     1609void API_EXPORTED libusb_transfer_set_stream_id(
     1610        struct libusb_transfer *transfer, uint32_t stream_id)
     1611{
     1612        struct usbi_transfer *itransfer =
     1613                LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer);
     1614
     1615        itransfer->stream_id = stream_id;
     1616}
     1617
     1618/** \ingroup libusb_asyncio
     1619 * Get a transfers bulk stream id.
     1620 *
     1621 * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103
     1622 *
     1623 * \param transfer the transfer to get the stream id for
     1624 * \returns the stream id for the transfer
     1625 */
     1626uint32_t API_EXPORTED libusb_transfer_get_stream_id(
     1627        struct libusb_transfer *transfer)
     1628{
     1629        struct usbi_transfer *itransfer =
     1630                LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer);
     1631
     1632        return itransfer->stream_id;
     1633}
    14641634
    14651635/* Handle completion of a transfer (completion might be an error condition).
     
    14761646        struct libusb_transfer *transfer =
    14771647                USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    1478         struct libusb_context *ctx = TRANSFER_CTX(transfer);
     1648        struct libusb_device_handle *dev_handle = transfer->dev_handle;
    14791649        uint8_t flags;
    1480         int r = 0;
    1481 
    1482         /* FIXME: could be more intelligent with the timerfd here. we don't need
    1483          * to disarm the timerfd if there was no timer running, and we only need
    1484          * to rearm the timerfd if the transfer that expired was the one with
    1485          * the shortest timeout. */
    1486 
    1487         usbi_mutex_lock(&ctx->flying_transfers_lock);
    1488         list_del(&itransfer->list);
    1489         if (usbi_using_timerfd(ctx)) {
    1490                 r = arm_timerfd_for_next_timeout(ctx);
    1491                 if (0 == r)
    1492                         r = disarm_timerfd(ctx);
    1493         }
    1494         usbi_mutex_unlock(&ctx->flying_transfers_lock);
     1650        int r;
     1651
     1652        r = remove_from_flying_list(itransfer);
    14951653        if (r < 0)
    1496                 return r;
     1654                usbi_err(ITRANSFER_CTX(itransfer), "failed to set timer for next timeout, errno=%d", errno);
     1655
     1656        usbi_mutex_lock(&itransfer->lock);
     1657        itransfer->state_flags &= ~USBI_TRANSFER_IN_FLIGHT;
     1658        usbi_mutex_unlock(&itransfer->lock);
    14971659
    14981660        if (status == LIBUSB_TRANSFER_COMPLETED
     
    15171679        if (flags & LIBUSB_TRANSFER_FREE_TRANSFER)
    15181680                libusb_free_transfer(transfer);
    1519         usbi_mutex_lock(&ctx->event_waiters_lock);
    1520         usbi_cond_broadcast(&ctx->event_waiters_cond);
    1521         usbi_mutex_unlock(&ctx->event_waiters_lock);
    1522         return 0;
     1681        libusb_unref_device(dev_handle->dev);
     1682        return r;
    15231683}
    15241684
     
    15311691int usbi_handle_transfer_cancellation(struct usbi_transfer *transfer)
    15321692{
     1693        struct libusb_context *ctx = ITRANSFER_CTX(transfer);
     1694        uint8_t timed_out;
     1695
     1696        usbi_mutex_lock(&ctx->flying_transfers_lock);
     1697        timed_out = transfer->timeout_flags & USBI_TRANSFER_TIMED_OUT;
     1698        usbi_mutex_unlock(&ctx->flying_transfers_lock);
     1699
    15331700        /* if the URB was cancelled due to timeout, report timeout to the user */
    1534         if (transfer->flags & USBI_TRANSFER_TIMED_OUT) {
     1701        if (timed_out) {
    15351702                usbi_dbg("detected timeout cancellation");
    15361703                return usbi_handle_transfer_completion(transfer, LIBUSB_TRANSFER_TIMED_OUT);
     
    15411708}
    15421709
    1543 /** \ingroup poll
     1710/* Add a completed transfer to the completed_transfers list of the
     1711 * context and signal the event. The backend's handle_transfer_completion()
     1712 * function will be called the next time an event handler runs. */
     1713void usbi_signal_transfer_completion(struct usbi_transfer *transfer)
     1714{
     1715        struct libusb_context *ctx = ITRANSFER_CTX(transfer);
     1716        int pending_events;
     1717
     1718        usbi_mutex_lock(&ctx->event_data_lock);
     1719        pending_events = usbi_pending_events(ctx);
     1720        list_add_tail(&transfer->completed_list, &ctx->completed_transfers);
     1721        if (!pending_events)
     1722                usbi_signal_event(ctx);
     1723        usbi_mutex_unlock(&ctx->event_data_lock);
     1724}
     1725
     1726/** \ingroup libusb_poll
    15441727 * Attempt to acquire the event handling lock. This lock is used to ensure that
    15451728 * only one thread is monitoring libusb event sources at any one time.
     
    15581741 * \returns 0 if the lock was obtained successfully
    15591742 * \returns 1 if the lock was not obtained (i.e. another thread holds the lock)
    1560  * \see \ref mtasync
     1743 * \ref libusb_mtasync
    15611744 */
    15621745int API_EXPORTED libusb_try_lock_events(libusb_context *ctx)
    15631746{
    15641747        int r;
     1748        unsigned int ru;
    15651749        USBI_GET_CONTEXT(ctx);
    15661750
    1567         /* is someone else waiting to modify poll fds? if so, don't let this thread
     1751        /* is someone else waiting to close a device? if so, don't let this thread
    15681752         * start event handling */
    1569         usbi_mutex_lock(&ctx->pollfd_modify_lock);
    1570         r = ctx->pollfd_modify;
    1571         usbi_mutex_unlock(&ctx->pollfd_modify_lock);
    1572         if (r) {
    1573                 usbi_dbg("someone else is modifying poll fds");
     1753        usbi_mutex_lock(&ctx->event_data_lock);
     1754        ru = ctx->device_close;
     1755        usbi_mutex_unlock(&ctx->event_data_lock);
     1756        if (ru) {
     1757                usbi_dbg("someone else is closing a device");
    15741758                return 1;
    15751759        }
     
    15831767}
    15841768
    1585 /** \ingroup poll
     1769/** \ingroup libusb_poll
    15861770 * Acquire the event handling lock, blocking until successful acquisition if
    15871771 * it is contended. This lock is used to ensure that only one thread is
     
    15991783 *
    16001784 * \param ctx the context to operate on, or NULL for the default context
    1601  * \see \ref mtasync
     1785 * \ref libusb_mtasync
    16021786 */
    16031787void API_EXPORTED libusb_lock_events(libusb_context *ctx)
     
    16081792}
    16091793
    1610 /** \ingroup poll
     1794/** \ingroup libusb_poll
    16111795 * Release the lock previously acquired with libusb_try_lock_events() or
    16121796 * libusb_lock_events(). Releasing this lock will wake up any threads blocked
     
    16141798 *
    16151799 * \param ctx the context to operate on, or NULL for the default context
    1616  * \see \ref mtasync
     1800 * \ref libusb_mtasync
    16171801 */
    16181802void API_EXPORTED libusb_unlock_events(libusb_context *ctx)
     
    16241808        /* FIXME: perhaps we should be a bit more efficient by not broadcasting
    16251809         * the availability of the events lock when we are modifying pollfds
    1626          * (check ctx->pollfd_modify)? */
     1810         * (check ctx->device_close)? */
    16271811        usbi_mutex_lock(&ctx->event_waiters_lock);
    16281812        usbi_cond_broadcast(&ctx->event_waiters_cond);
     
    16301814}
    16311815
    1632 /** \ingroup poll
     1816/** \ingroup libusb_poll
    16331817 * Determine if it is still OK for this thread to be doing event handling.
    16341818 *
     
    16381822 *
    16391823 * If this function instructs your thread to give up the events lock, you
    1640  * should just continue the usual logic that is documented in \ref mtasync.
     1824 * should just continue the usual logic that is documented in \ref libusb_mtasync.
    16411825 * On the next iteration, your thread will fail to obtain the events lock,
    16421826 * and will hence become an event waiter.
     
    16491833 * \returns 1 if event handling can start or continue
    16501834 * \returns 0 if this thread must give up the events lock
    1651  * \see \ref fullstory "Multi-threaded I/O: the full story"
     1835 * \ref fullstory "Multi-threaded I/O: the full story"
    16521836 */
    16531837int API_EXPORTED libusb_event_handling_ok(libusb_context *ctx)
    16541838{
    1655         int r;
     1839        unsigned int r;
    16561840        USBI_GET_CONTEXT(ctx);
    16571841
    1658         /* is someone else waiting to modify poll fds? if so, don't let this thread
     1842        /* is someone else waiting to close a device? if so, don't let this thread
    16591843         * continue event handling */
    1660         usbi_mutex_lock(&ctx->pollfd_modify_lock);
    1661         r = ctx->pollfd_modify;
    1662         usbi_mutex_unlock(&ctx->pollfd_modify_lock);
     1844        usbi_mutex_lock(&ctx->event_data_lock);
     1845        r = ctx->device_close;
     1846        usbi_mutex_unlock(&ctx->event_data_lock);
    16631847        if (r) {
    1664                 usbi_dbg("someone else is modifying poll fds");
     1848                usbi_dbg("someone else is closing a device");
    16651849                return 0;
    16661850        }
     
    16701854
    16711855
    1672 /** \ingroup poll
     1856/** \ingroup libusb_poll
    16731857 * Determine if an active thread is handling events (i.e. if anyone is holding
    16741858 * the event handling lock).
     
    16771861 * \returns 1 if a thread is handling events
    16781862 * \returns 0 if there are no threads currently handling events
    1679  * \see \ref mtasync
     1863 * \ref libusb_mtasync
    16801864 */
    16811865int API_EXPORTED libusb_event_handler_active(libusb_context *ctx)
    16821866{
    1683         int r;
     1867        unsigned int r;
    16841868        USBI_GET_CONTEXT(ctx);
    16851869
    1686         /* is someone else waiting to modify poll fds? if so, don't let this thread
     1870        /* is someone else waiting to close a device? if so, don't let this thread
    16871871         * start event handling -- indicate that event handling is happening */
    1688         usbi_mutex_lock(&ctx->pollfd_modify_lock);
    1689         r = ctx->pollfd_modify;
    1690         usbi_mutex_unlock(&ctx->pollfd_modify_lock);
     1872        usbi_mutex_lock(&ctx->event_data_lock);
     1873        r = ctx->device_close;
     1874        usbi_mutex_unlock(&ctx->event_data_lock);
    16911875        if (r) {
    1692                 usbi_dbg("someone else is modifying poll fds");
     1876                usbi_dbg("someone else is closing a device");
    16931877                return 1;
    16941878        }
     
    16971881}
    16981882
    1699 /** \ingroup poll
     1883/** \ingroup libusb_poll
     1884 * Interrupt any active thread that is handling events. This is mainly useful
     1885 * for interrupting a dedicated event handling thread when an application
     1886 * wishes to call libusb_exit().
     1887 *
     1888 * Since version 1.0.21, \ref LIBUSB_API_VERSION >= 0x01000105
     1889 *
     1890 * \param ctx the context to operate on, or NULL for the default context
     1891 * \ref libusb_mtasync
     1892 */
     1893void API_EXPORTED libusb_interrupt_event_handler(libusb_context *ctx)
     1894{
     1895        USBI_GET_CONTEXT(ctx);
     1896
     1897        usbi_dbg("");
     1898        usbi_mutex_lock(&ctx->event_data_lock);
     1899        if (!usbi_pending_events(ctx)) {
     1900                ctx->event_flags |= USBI_EVENT_USER_INTERRUPT;
     1901                usbi_signal_event(ctx);
     1902        }
     1903        usbi_mutex_unlock(&ctx->event_data_lock);
     1904}
     1905
     1906/** \ingroup libusb_poll
    17001907 * Acquire the event waiters lock. This lock is designed to be obtained under
    17011908 * the situation where you want to be aware when events are completed, but
     
    17141921 *
    17151922 * \param ctx the context to operate on, or NULL for the default context
    1716  * \see \ref mtasync
     1923 * \ref libusb_mtasync
    17171924 */
    17181925void API_EXPORTED libusb_lock_event_waiters(libusb_context *ctx)
     
    17221929}
    17231930
    1724 /** \ingroup poll
     1931/** \ingroup libusb_poll
    17251932 * Release the event waiters lock.
    17261933 * \param ctx the context to operate on, or NULL for the default context
    1727  * \see \ref mtasync
     1934 * \ref libusb_mtasync
    17281935 */
    17291936void API_EXPORTED libusb_unlock_event_waiters(libusb_context *ctx)
     
    17331940}
    17341941
    1735 /** \ingroup poll
     1942/** \ingroup libusb_poll
    17361943 * Wait for another thread to signal completion of an event. Must be called
    17371944 * with the event waiters lock held, see libusb_lock_event_waiters().
     
    17561963 * \returns 0 after a transfer completes or another thread stops event handling
    17571964 * \returns 1 if the timeout expired
    1758  * \see \ref mtasync
     1965 * \ref libusb_mtasync
    17591966 */
    17601967int API_EXPORTED libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
    17611968{
    1762         struct timespec timeout;
    17631969        int r;
    17641970
     
    17691975        }
    17701976
    1771         r = usbi_backend->clock_gettime(USBI_CLOCK_REALTIME, &timeout);
    1772         if (r < 0) {
    1773                 usbi_err(ctx, "failed to read realtime clock, error %d", errno);
    1774                 return LIBUSB_ERROR_OTHER;
    1775         }
    1776 
    1777         timeout.tv_sec += tv->tv_sec;
    1778         timeout.tv_nsec += tv->tv_usec * 1000;
    1779         while (timeout.tv_nsec >= 1000000000) {
    1780                 timeout.tv_nsec -= 1000000000;
    1781                 timeout.tv_sec++;
    1782         }
    1783 
    17841977        r = usbi_cond_timedwait(&ctx->event_waiters_cond,
    1785                 &ctx->event_waiters_lock, &timeout);
    1786         return (r == ETIMEDOUT);
     1978                &ctx->event_waiters_lock, tv);
     1979
     1980        if (r < 0)
     1981                return r;
     1982        else
     1983                return (r == ETIMEDOUT);
    17871984}
    17881985
     
    17931990        int r;
    17941991
    1795         itransfer->flags |= USBI_TRANSFER_TIMED_OUT;
     1992        itransfer->timeout_flags |= USBI_TRANSFER_TIMEOUT_HANDLED;
    17961993        r = libusb_cancel_transfer(transfer);
    1797         if (r < 0)
     1994        if (r == LIBUSB_SUCCESS)
     1995                itransfer->timeout_flags |= USBI_TRANSFER_TIMED_OUT;
     1996        else
    17981997                usbi_warn(TRANSFER_CTX(transfer),
    17991998                        "async cancel failed %d errno=%d", r, errno);
     
    18272026
    18282027                /* ignore timeouts we've already handled */
    1829                 if (transfer->flags & (USBI_TRANSFER_TIMED_OUT | USBI_TRANSFER_OS_HANDLES_TIMEOUT))
     2028                if (transfer->timeout_flags & (USBI_TRANSFER_TIMEOUT_HANDLED | USBI_TRANSFER_OS_HANDLES_TIMEOUT))
    18302029                        continue;
    18312030
     
    18572056        int r;
    18582057
    1859         r = disarm_timerfd(ctx);
    1860         if (r < 0)
    1861                 return r;
    1862 
    18632058        usbi_mutex_lock(&ctx->flying_transfers_lock);
    18642059
     
    18842079        struct usbi_pollfd *ipollfd;
    18852080        POLL_NFDS_TYPE nfds = 0;
    1886         struct pollfd *fds;
     2081        POLL_NFDS_TYPE internal_nfds;
     2082        struct pollfd *fds = NULL;
    18872083        int i = -1;
    18882084        int timeout_ms;
    1889 
    1890         usbi_mutex_lock(&ctx->pollfds_lock);
    1891         list_for_each_entry(ipollfd, &ctx->pollfds, list, struct usbi_pollfd)
    1892                 nfds++;
    1893 
    1894         /* TODO: malloc when number of fd's changes, not on every poll */
    1895         fds = malloc(sizeof(*fds) * nfds);
    1896         if (!fds) {
    1897                 usbi_mutex_unlock(&ctx->pollfds_lock);
    1898                 return LIBUSB_ERROR_NO_MEM;
    1899         }
    1900 
    1901         list_for_each_entry(ipollfd, &ctx->pollfds, list, struct usbi_pollfd) {
    1902                 struct libusb_pollfd *pollfd = &ipollfd->pollfd;
    1903                 int fd = pollfd->fd;
    1904                 i++;
    1905                 fds[i].fd = fd;
    1906                 fds[i].events = pollfd->events;
    1907                 fds[i].revents = 0;
    1908         }
    1909         usbi_mutex_unlock(&ctx->pollfds_lock);
    1910 
    1911         timeout_ms = (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
     2085        int special_event;
     2086
     2087        /* prevent attempts to recursively handle events (e.g. calling into
     2088         * libusb_handle_events() from within a hotplug or transfer callback) */
     2089        if (usbi_handling_events(ctx))
     2090                return LIBUSB_ERROR_BUSY;
     2091        usbi_start_event_handling(ctx);
     2092
     2093        /* there are certain fds that libusb uses internally, currently:
     2094         *
     2095         *   1) event pipe
     2096         *   2) timerfd
     2097         *
     2098         * the backend will never need to attempt to handle events on these fds, so
     2099         * we determine how many fds are in use internally for this context and when
     2100         * handle_events() is called in the backend, the pollfd list and count will
     2101         * be adjusted to skip over these internal fds */
     2102        if (usbi_using_timerfd(ctx))
     2103                internal_nfds = 2;
     2104        else
     2105                internal_nfds = 1;
     2106
     2107        /* only reallocate the poll fds when the list of poll fds has been modified
     2108         * since the last poll, otherwise reuse them to save the additional overhead */
     2109        usbi_mutex_lock(&ctx->event_data_lock);
     2110        if (ctx->event_flags & USBI_EVENT_POLLFDS_MODIFIED) {
     2111                usbi_dbg("poll fds modified, reallocating");
     2112
     2113                if (ctx->pollfds) {
     2114                        free(ctx->pollfds);
     2115                        ctx->pollfds = NULL;
     2116                }
     2117
     2118                /* sanity check - it is invalid for a context to have fewer than the
     2119                 * required internal fds (memory corruption?) */
     2120                assert(ctx->pollfds_cnt >= internal_nfds);
     2121
     2122                ctx->pollfds = calloc(ctx->pollfds_cnt, sizeof(*ctx->pollfds));
     2123                if (!ctx->pollfds) {
     2124                        usbi_mutex_unlock(&ctx->event_data_lock);
     2125                        r = LIBUSB_ERROR_NO_MEM;
     2126                        goto done;
     2127                }
     2128
     2129                list_for_each_entry(ipollfd, &ctx->ipollfds, list, struct usbi_pollfd) {
     2130                        struct libusb_pollfd *pollfd = &ipollfd->pollfd;
     2131                        i++;
     2132                        ctx->pollfds[i].fd = pollfd->fd;
     2133                        ctx->pollfds[i].events = pollfd->events;
     2134                }
     2135
     2136                /* reset the flag now that we have the updated list */
     2137                ctx->event_flags &= ~USBI_EVENT_POLLFDS_MODIFIED;
     2138
     2139                /* if no further pending events, clear the event pipe so that we do
     2140                 * not immediately return from poll */
     2141                if (!usbi_pending_events(ctx))
     2142                        usbi_clear_event(ctx);
     2143        }
     2144        fds = ctx->pollfds;
     2145        nfds = ctx->pollfds_cnt;
     2146        usbi_mutex_unlock(&ctx->event_data_lock);
     2147
     2148        timeout_ms = (int)(tv->tv_sec * 1000) + (tv->tv_usec / 1000);
    19122149
    19132150        /* round up to next millisecond */
     
    19152152                timeout_ms++;
    19162153
     2154redo_poll:
    19172155        usbi_dbg("poll() %d fds with timeout in %dms", nfds, timeout_ms);
    19182156        r = usbi_poll(fds, nfds, timeout_ms);
    19192157        usbi_dbg("poll() returned %d", r);
    19202158        if (r == 0) {
    1921                 free(fds);
    1922                 return handle_timeouts(ctx);
    1923         } else if (r == -1 && errno == EINTR) {
    1924                 free(fds);
    1925                 return LIBUSB_ERROR_INTERRUPTED;
    1926         } else if (r < 0) {
    1927                 free(fds);
    1928                 usbi_err(ctx, "poll failed %d err=%d\n", r, errno);
    1929                 return LIBUSB_ERROR_IO;
    1930         }
    1931 
    1932         /* fd[0] is always the ctrl pipe */
     2159                r = handle_timeouts(ctx);
     2160                goto done;
     2161        }
     2162        else if (r == -1 && errno == EINTR) {
     2163                r = LIBUSB_ERROR_INTERRUPTED;
     2164                goto done;
     2165        }
     2166        else if (r < 0) {
     2167                usbi_err(ctx, "poll failed %d err=%d", r, errno);
     2168                r = LIBUSB_ERROR_IO;
     2169                goto done;
     2170        }
     2171
     2172        special_event = 0;
     2173
     2174        /* fds[0] is always the event pipe */
    19332175        if (fds[0].revents) {
    1934                 /* another thread wanted to interrupt event handling, and it succeeded!
    1935                  * handle any other events that cropped up at the same time, and
    1936                  * simply return */
    1937                 usbi_dbg("caught a fish on the control pipe");
    1938 
    1939                 if (r == 1) {
    1940                         r = 0;
     2176                libusb_hotplug_message *message = NULL;
     2177                struct usbi_transfer *itransfer;
     2178                int ret = 0;
     2179
     2180                usbi_dbg("caught a fish on the event pipe");
     2181
     2182                /* take the the event data lock while processing events */
     2183                usbi_mutex_lock(&ctx->event_data_lock);
     2184
     2185                /* check if someone added a new poll fd */
     2186                if (ctx->event_flags & USBI_EVENT_POLLFDS_MODIFIED)
     2187                        usbi_dbg("someone updated the poll fds");
     2188
     2189                if (ctx->event_flags & USBI_EVENT_USER_INTERRUPT) {
     2190                        usbi_dbg("someone purposely interrupted");
     2191                        ctx->event_flags &= ~USBI_EVENT_USER_INTERRUPT;
     2192                }
     2193
     2194                /* check if someone is closing a device */
     2195                if (ctx->device_close)
     2196                        usbi_dbg("someone is closing a device");
     2197
     2198                /* check for any pending hotplug messages */
     2199                if (!list_empty(&ctx->hotplug_msgs)) {
     2200                        usbi_dbg("hotplug message received");
     2201                        special_event = 1;
     2202                        message = list_first_entry(&ctx->hotplug_msgs, libusb_hotplug_message, list);
     2203                        list_del(&message->list);
     2204                }
     2205
     2206                /* complete any pending transfers */
     2207                while (ret == 0 && !list_empty(&ctx->completed_transfers)) {
     2208                        itransfer = list_first_entry(&ctx->completed_transfers, struct usbi_transfer, completed_list);
     2209                        list_del(&itransfer->completed_list);
     2210                        usbi_mutex_unlock(&ctx->event_data_lock);
     2211                        ret = usbi_backend->handle_transfer_completion(itransfer);
     2212                        if (ret)
     2213                                usbi_err(ctx, "backend handle_transfer_completion failed with error %d", ret);
     2214                        usbi_mutex_lock(&ctx->event_data_lock);
     2215                }
     2216
     2217                /* if no further pending events, clear the event pipe */
     2218                if (!usbi_pending_events(ctx))
     2219                        usbi_clear_event(ctx);
     2220
     2221                usbi_mutex_unlock(&ctx->event_data_lock);
     2222
     2223                /* process the hotplug message, if any */
     2224                if (message) {
     2225                        usbi_hotplug_match(ctx, message->device, message->event);
     2226
     2227                        /* the device left, dereference the device */
     2228                        if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == message->event)
     2229                                libusb_unref_device(message->device);
     2230
     2231                        free(message);
     2232                }
     2233
     2234                if (ret) {
     2235                        /* return error code */
     2236                        r = ret;
     2237                        goto done;
     2238                }
     2239
     2240                if (0 == --r)
    19412241                        goto handled;
    1942                 } else {
    1943                         /* prevent OS backend from trying to handle events on ctrl pipe */
    1944                         fds[0].revents = 0;
    1945                         r--;
    1946                 }
    1947         }
    1948 
    1949         /* fd[1] is always the hotplug pipe */
    1950         if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && fds[1].revents) {
    1951                 libusb_hotplug_message message;
    1952                 int ret;
    1953 
    1954                 /* read the message from the hotplug thread */
    1955                 ret = read(ctx->hotplug_pipe[0], &message, sizeof (message));
    1956                 if (ret < sizeof(message)) {
    1957                         ret = LIBUSB_ERROR_OTHER;
    1958                         goto handled;
    1959                 }
    1960 
    1961                 usbi_hotplug_match(message.device, message.event);
    1962 
    1963                 /* the device left. dereference the device */
    1964                 if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == message.event)
    1965                         libusb_unref_device(message.device);
    1966                
    1967                 fds[1].revents = 0;
    1968                 if (1 == r--)
    1969                         goto handled;
    1970         } /* else there shouldn't be anything on this pipe */
     2242        }
    19712243
    19722244#ifdef USBI_TIMERFD_AVAILABLE
    1973         /* on timerfd configurations, fds[2] is the timerfd */
    1974         if (usbi_using_timerfd(ctx) && fds[2].revents) {
     2245        /* on timerfd configurations, fds[1] is the timerfd */
     2246        if (usbi_using_timerfd(ctx) && fds[1].revents) {
    19752247                /* timerfd indicates that a timeout has expired */
    19762248                int ret;
    19772249                usbi_dbg("timerfd triggered");
     2250                special_event = 1;
    19782251
    19792252                ret = handle_timerfd_trigger(ctx);
     
    19812254                        /* return error code */
    19822255                        r = ret;
     2256                        goto done;
     2257                }
     2258
     2259                if (0 == --r)
    19832260                        goto handled;
    1984                 } else if (r == 1) {
    1985                         /* no more active file descriptors, nothing more to do */
    1986                         r = 0;
    1987                         goto handled;
    1988                 } else {
    1989                         /* more events pending...
    1990                          * prevent OS backend from trying to handle events on timerfd */
    1991                         fds[2].revents = 0;
    1992                         r--;
    1993                 }
    19942261        }
    19952262#endif
    19962263
    1997         r = usbi_backend->handle_events(ctx, fds, nfds, r);
     2264        r = usbi_backend->handle_events(ctx, fds + internal_nfds, nfds - internal_nfds, r);
    19982265        if (r)
    19992266                usbi_err(ctx, "backend handle_events failed with error %d", r);
    20002267
    20012268handled:
    2002         free(fds);
     2269        if (r == 0 && special_event) {
     2270                timeout_ms = 0;
     2271                goto redo_poll;
     2272        }
     2273
     2274done:
     2275        usbi_end_event_handling(ctx);
    20032276        return r;
    20042277}
     
    20312304}
    20322305
    2033 /** \ingroup poll
     2306/** \ingroup libusb_poll
    20342307 * Handle any pending events.
    20352308 *
     
    20552328 * \param completed pointer to completion integer to check, or NULL
    20562329 * \returns 0 on success, or a LIBUSB_ERROR code on failure
    2057  * \see \ref mtasync
     2330 * \ref libusb_mtasync
    20582331 */
    20592332int API_EXPORTED libusb_handle_events_timeout_completed(libusb_context *ctx,
     
    21102383}
    21112384
    2112 /** \ingroup poll
     2385/** \ingroup libusb_poll
    21132386 * Handle any pending events
    21142387 *
     
    21322405}
    21332406
    2134 /** \ingroup poll
     2407/** \ingroup libusb_poll
    21352408 * Handle any pending events in blocking mode. There is currently a timeout
    21362409 * hardcoded at 60 seconds but we plan to make it unlimited in future. For
     
    21542427}
    21552428
    2156 /** \ingroup poll
     2429/** \ingroup libusb_poll
    21572430 * Handle any pending events in blocking mode.
    21582431 *
     
    21662439 * \param completed pointer to completion integer to check, or NULL
    21672440 * \returns 0 on success, or a LIBUSB_ERROR code on failure
    2168  * \see \ref mtasync
     2441 * \ref libusb_mtasync
    21692442 */
    21702443int API_EXPORTED libusb_handle_events_completed(libusb_context *ctx,
     
    21772450}
    21782451
    2179 /** \ingroup poll
     2452/** \ingroup libusb_poll
    21802453 * Handle any pending events by polling file descriptors, without checking if
    21812454 * any other threads are already doing so. Must be called with the event lock
     
    21922465 * non-blocking mode
    21932466 * \returns 0 on success, or a LIBUSB_ERROR code on failure
    2194  * \see \ref mtasync
     2467 * \ref libusb_mtasync
    21952468 */
    21962469int API_EXPORTED libusb_handle_events_locked(libusb_context *ctx,
     
    22102483}
    22112484
    2212 /** \ingroup poll
     2485/** \ingroup libusb_poll
    22132486 * Determines whether your application must apply special timing considerations
    22142487 * when monitoring libusb's file descriptors.
    22152488 *
    22162489 * This function is only useful for applications which retrieve and poll
    2217  * libusb's file descriptors in their own main loop (\ref pollmain).
     2490 * libusb's file descriptors in their own main loop (\ref libusb_pollmain).
    22182491 *
    22192492 * Ordinarily, libusb's event handler needs to be called into at specific
     
    22362509 * libusb_get_next_timeout(), or 1 if all timeout events are handled internally
    22372510 * or through regular activity on the file descriptors.
    2238  * \see \ref pollmain "Polling libusb file descriptors for event handling"
     2511 * \ref libusb_pollmain "Polling libusb file descriptors for event handling"
    22392512 */
    22402513int API_EXPORTED libusb_pollfds_handle_timeouts(libusb_context *ctx)
     
    22442517        return usbi_using_timerfd(ctx);
    22452518#else
    2246         (void)ctx;
     2519        UNUSED(ctx);
    22472520        return 0;
    22482521#endif
    22492522}
    22502523
    2251 /** \ingroup poll
     2524/** \ingroup libusb_poll
    22522525 * Determine the next internal timeout that libusb needs to handle. You only
    22532526 * need to use this function if you are calling poll() or select() or similar
     
    22832556        struct timespec cur_ts;
    22842557        struct timeval cur_tv;
    2285         struct timeval *next_timeout;
     2558        struct timeval next_timeout = { 0, 0 };
    22862559        int r;
    2287         int found = 0;
    22882560
    22892561        USBI_GET_CONTEXT(ctx);
     
    23002572        /* find next transfer which hasn't already been processed as timed out */
    23012573        list_for_each_entry(transfer, &ctx->flying_transfers, list, struct usbi_transfer) {
    2302                 if (transfer->flags & (USBI_TRANSFER_TIMED_OUT | USBI_TRANSFER_OS_HANDLES_TIMEOUT))
     2574                if (transfer->timeout_flags & (USBI_TRANSFER_TIMEOUT_HANDLED | USBI_TRANSFER_OS_HANDLES_TIMEOUT))
    23032575                        continue;
    23042576
    2305                 /* no timeout for this transfer? */
     2577                /* if we've reached transfers of infinte timeout, we're done looking */
    23062578                if (!timerisset(&transfer->timeout))
    2307                         continue;
    2308 
    2309                 found = 1;
     2579                        break;
     2580
     2581                next_timeout = transfer->timeout;
    23102582                break;
    23112583        }
    23122584        usbi_mutex_unlock(&ctx->flying_transfers_lock);
    23132585
    2314         if (!found) {
     2586        if (!timerisset(&next_timeout)) {
    23152587                usbi_dbg("no URB with timeout or all handled by OS; no timeout!");
    23162588                return 0;
    23172589        }
    2318 
    2319         next_timeout = &transfer->timeout;
    23202590
    23212591        r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &cur_ts);
    23222592        if (r < 0) {
    23232593                usbi_err(ctx, "failed to read monotonic clock, errno=%d", errno);
    2324                 return LIBUSB_ERROR_OTHER;
     2594                return 0;
    23252595        }
    23262596        TIMESPEC_TO_TIMEVAL(&cur_tv, &cur_ts);
    23272597
    2328         if (!timercmp(&cur_tv, next_timeout, <)) {
     2598        if (!timercmp(&cur_tv, &next_timeout, <)) {
    23292599                usbi_dbg("first timeout already expired");
    23302600                timerclear(tv);
    23312601        } else {
    2332                 timersub(next_timeout, &cur_tv, tv);
     2602                timersub(&next_timeout, &cur_tv, tv);
    23332603                usbi_dbg("next timeout in %d.%06ds", tv->tv_sec, tv->tv_usec);
    23342604        }
     
    23372607}
    23382608
    2339 /** \ingroup poll
     2609/** \ingroup libusb_poll
    23402610 * Register notification functions for file descriptor additions/removals.
    23412611 * These functions will be invoked for every new or removed file descriptor
     
    23682638}
    23692639
     2640/*
     2641 * Interrupt the iteration of the event handling thread, so that it picks
     2642 * up the fd change. Callers of this function must hold the event_data_lock.
     2643 */
     2644static void usbi_fd_notification(struct libusb_context *ctx)
     2645{
     2646        int pending_events;
     2647
     2648        /* Record that there is a new poll fd.
     2649         * Only signal an event if there are no prior pending events. */
     2650        pending_events = usbi_pending_events(ctx);
     2651        ctx->event_flags |= USBI_EVENT_POLLFDS_MODIFIED;
     2652        if (!pending_events)
     2653                usbi_signal_event(ctx);
     2654}
     2655
    23702656/* Add a file descriptor to the list of file descriptors to be monitored.
    23712657 * events should be specified as a bitmask of events passed to poll(), e.g.
     
    23802666        ipollfd->pollfd.fd = fd;
    23812667        ipollfd->pollfd.events = events;
    2382         usbi_mutex_lock(&ctx->pollfds_lock);
    2383         list_add_tail(&ipollfd->list, &ctx->pollfds);
    2384         usbi_mutex_unlock(&ctx->pollfds_lock);
     2668        usbi_mutex_lock(&ctx->event_data_lock);
     2669        list_add_tail(&ipollfd->list, &ctx->ipollfds);
     2670        ctx->pollfds_cnt++;
     2671        usbi_fd_notification(ctx);
     2672        usbi_mutex_unlock(&ctx->event_data_lock);
    23852673
    23862674        if (ctx->fd_added_cb)
     
    23962684
    23972685        usbi_dbg("remove fd %d", fd);
    2398         usbi_mutex_lock(&ctx->pollfds_lock);
    2399         list_for_each_entry(ipollfd, &ctx->pollfds, list, struct usbi_pollfd)
     2686        usbi_mutex_lock(&ctx->event_data_lock);
     2687        list_for_each_entry(ipollfd, &ctx->ipollfds, list, struct usbi_pollfd)
    24002688                if (ipollfd->pollfd.fd == fd) {
    24012689                        found = 1;
     
    24052693        if (!found) {
    24062694                usbi_dbg("couldn't find fd %d to remove", fd);
    2407                 usbi_mutex_unlock(&ctx->pollfds_lock);
     2695                usbi_mutex_unlock(&ctx->event_data_lock);
    24082696                return;
    24092697        }
    24102698
    24112699        list_del(&ipollfd->list);
    2412         usbi_mutex_unlock(&ctx->pollfds_lock);
     2700        ctx->pollfds_cnt--;
     2701        usbi_fd_notification(ctx);
     2702        usbi_mutex_unlock(&ctx->event_data_lock);
    24132703        free(ipollfd);
    24142704        if (ctx->fd_removed_cb)
     
    24162706}
    24172707
    2418 /** \ingroup poll
     2708/** \ingroup libusb_poll
    24192709 * Retrieve a list of file descriptors that should be polled by your main loop
    24202710 * as libusb event sources.
    24212711 *
    2422  * The returned list is NULL-terminated and should be freed with free() when
    2423  * done. The actual list contents must not be touched.
     2712 * The returned list is NULL-terminated and should be freed with libusb_free_pollfds()
     2713 * when done. The actual list contents must not be touched.
    24242714 *
    24252715 * As file descriptors are a Unix-specific concept, this function is not
     
    24392729        struct usbi_pollfd *ipollfd;
    24402730        size_t i = 0;
    2441         size_t cnt = 0;
    24422731        USBI_GET_CONTEXT(ctx);
    24432732
    2444         usbi_mutex_lock(&ctx->pollfds_lock);
    2445         list_for_each_entry(ipollfd, &ctx->pollfds, list, struct usbi_pollfd)
    2446                 cnt++;
    2447 
    2448         ret = calloc(cnt + 1, sizeof(struct libusb_pollfd *));
     2733        usbi_mutex_lock(&ctx->event_data_lock);
     2734
     2735        ret = calloc(ctx->pollfds_cnt + 1, sizeof(struct libusb_pollfd *));
    24492736        if (!ret)
    24502737                goto out;
    24512738
    2452         list_for_each_entry(ipollfd, &ctx->pollfds, list, struct usbi_pollfd)
     2739        list_for_each_entry(ipollfd, &ctx->ipollfds, list, struct usbi_pollfd)
    24532740                ret[i++] = (struct libusb_pollfd *) ipollfd;
    2454         ret[cnt] = NULL;
     2741        ret[ctx->pollfds_cnt] = NULL;
    24552742
    24562743out:
    2457         usbi_mutex_unlock(&ctx->pollfds_lock);
     2744        usbi_mutex_unlock(&ctx->event_data_lock);
    24582745        return (const struct libusb_pollfd **) ret;
    24592746#else
     
    24642751}
    24652752
    2466 /* Backends call this from handle_events to report disconnection of a device.
    2467  * The transfers get cancelled appropriately.
    2468  */
    2469 void usbi_handle_disconnect(struct libusb_device_handle *handle)
     2753/** \ingroup libusb_poll
     2754 * Free a list of libusb_pollfd structures. This should be called for all
     2755 * pollfd lists allocated with libusb_get_pollfds().
     2756 *
     2757 * Since version 1.0.20, \ref LIBUSB_API_VERSION >= 0x01000104
     2758 *
     2759 * It is legal to call this function with a NULL pollfd list. In this case,
     2760 * the function will simply return safely.
     2761 *
     2762 * \param pollfds the list of libusb_pollfd structures to free
     2763 */
     2764void API_EXPORTED libusb_free_pollfds(const struct libusb_pollfd **pollfds)
     2765{
     2766        if (!pollfds)
     2767                return;
     2768
     2769        free((void *)pollfds);
     2770}
     2771
     2772/* Backends may call this from handle_events to report disconnection of a
     2773 * device. This function ensures transfers get cancelled appropriately.
     2774 * Callers of this function must hold the events_lock.
     2775 */
     2776void usbi_handle_disconnect(struct libusb_device_handle *dev_handle)
    24702777{
    24712778        struct usbi_transfer *cur;
     
    24732780
    24742781        usbi_dbg("device %d.%d",
    2475                 handle->dev->bus_number, handle->dev->device_address);
     2782                dev_handle->dev->bus_number, dev_handle->dev->device_address);
    24762783
    24772784        /* terminate all pending transfers with the LIBUSB_TRANSFER_NO_DEVICE
    24782785         * status code.
    24792786         *
    2480          * this is a bit tricky because:
    2481          * 1. we can't do transfer completion while holding flying_transfers_lock
    2482          * 2. the transfers list can change underneath us - if we were to build a
    2483          *    list of transfers to complete (while holding look), the situation
    2484          *    might be different by the time we come to free them
    2485          *
    2486          * so we resort to a loop-based approach as below
    2487          * FIXME: is this still potentially racy?
     2787         * when we find a transfer for this device on the list, there are two
     2788         * possible scenarios:
     2789         * 1. the transfer is currently in-flight, in which case we terminate the
     2790         *    transfer here
     2791         * 2. the transfer has been added to the flying transfer list by
     2792         *    libusb_submit_transfer, has failed to submit and
     2793         *    libusb_submit_transfer is waiting for us to release the
     2794         *    flying_transfers_lock to remove it, so we ignore it
    24882795         */
    24892796
    24902797        while (1) {
    2491                 usbi_mutex_lock(&HANDLE_CTX(handle)->flying_transfers_lock);
    24922798                to_cancel = NULL;
    2493                 list_for_each_entry(cur, &HANDLE_CTX(handle)->flying_transfers, list, struct usbi_transfer)
    2494                         if (USBI_TRANSFER_TO_LIBUSB_TRANSFER(cur)->dev_handle == handle) {
    2495                                 to_cancel = cur;
    2496                                 break;
     2799                usbi_mutex_lock(&HANDLE_CTX(dev_handle)->flying_transfers_lock);
     2800                list_for_each_entry(cur, &HANDLE_CTX(dev_handle)->flying_transfers, list, struct usbi_transfer)
     2801                        if (USBI_TRANSFER_TO_LIBUSB_TRANSFER(cur)->dev_handle == dev_handle) {
     2802                                usbi_mutex_lock(&cur->lock);
     2803                                if (cur->state_flags & USBI_TRANSFER_IN_FLIGHT)
     2804                                        to_cancel = cur;
     2805                                usbi_mutex_unlock(&cur->lock);
     2806
     2807                                if (to_cancel)
     2808                                        break;
    24972809                        }
    2498                 usbi_mutex_unlock(&HANDLE_CTX(handle)->flying_transfers_lock);
     2810                usbi_mutex_unlock(&HANDLE_CTX(dev_handle)->flying_transfers_lock);
    24992811
    25002812                if (!to_cancel)
    25012813                        break;
    25022814
     2815                usbi_dbg("cancelling transfer %p from disconnect",
     2816                         USBI_TRANSFER_TO_LIBUSB_TRANSFER(to_cancel));
     2817
     2818                usbi_mutex_lock(&to_cancel->lock);
    25032819                usbi_backend->clear_transfer_priv(to_cancel);
     2820                usbi_mutex_unlock(&to_cancel->lock);
    25042821                usbi_handle_transfer_completion(to_cancel, LIBUSB_TRANSFER_NO_DEVICE);
    25052822        }
  • TabularUnified libusb1/trunk/libusb/libusb-1.0.def

    r1876 r1882  
    1 LIBRARY
     1LIBRARY "libusb-1.0.dll"
    22EXPORTS
     3  libusb_alloc_streams
     4  libusb_alloc_streams@16 = libusb_alloc_streams
    35  libusb_alloc_transfer
    46  libusb_alloc_transfer@4 = libusb_alloc_transfer
     
    1921  libusb_detach_kernel_driver
    2022  libusb_detach_kernel_driver@8 = libusb_detach_kernel_driver
     23  libusb_dev_mem_alloc
     24  libusb_dev_mem_alloc@8 = libusb_dev_mem_alloc
     25  libusb_dev_mem_free
     26  libusb_dev_mem_free@12 = libusb_dev_mem_free
    2127  libusb_error_name
    2228  libusb_error_name@4 = libusb_error_name
     
    2733  libusb_exit
    2834  libusb_exit@4 = libusb_exit
     35  libusb_free_bos_descriptor
     36  libusb_free_bos_descriptor@4 = libusb_free_bos_descriptor
    2937  libusb_free_config_descriptor
    3038  libusb_free_config_descriptor@4 = libusb_free_config_descriptor
     39  libusb_free_container_id_descriptor
     40  libusb_free_container_id_descriptor@4 = libusb_free_container_id_descriptor
    3141  libusb_free_device_list
    3242  libusb_free_device_list@8 = libusb_free_device_list
     43  libusb_free_pollfds
     44  libusb_free_pollfds@4 = libusb_free_pollfds
     45  libusb_free_ss_endpoint_companion_descriptor
     46  libusb_free_ss_endpoint_companion_descriptor@4 = libusb_free_ss_endpoint_companion_descriptor
     47  libusb_free_ss_usb_device_capability_descriptor
     48  libusb_free_ss_usb_device_capability_descriptor@4 = libusb_free_ss_usb_device_capability_descriptor
     49  libusb_free_streams
     50  libusb_free_streams@12 = libusb_free_streams
    3351  libusb_free_transfer
    3452  libusb_free_transfer@4 = libusb_free_transfer
     53  libusb_free_usb_2_0_extension_descriptor
     54  libusb_free_usb_2_0_extension_descriptor@4 = libusb_free_usb_2_0_extension_descriptor
    3555  libusb_get_active_config_descriptor
    3656  libusb_get_active_config_descriptor@8 = libusb_get_active_config_descriptor
     57  libusb_get_bos_descriptor
     58  libusb_get_bos_descriptor@8 = libusb_get_bos_descriptor
    3759  libusb_get_bus_number
    3860  libusb_get_bus_number@4 = libusb_get_bus_number
     
    4365  libusb_get_configuration
    4466  libusb_get_configuration@8 = libusb_get_configuration
     67  libusb_get_container_id_descriptor
     68  libusb_get_container_id_descriptor@12 = libusb_get_container_id_descriptor
    4569  libusb_get_device
    4670  libusb_get_device@4 = libusb_get_device
     
    5983  libusb_get_next_timeout
    6084  libusb_get_next_timeout@8 = libusb_get_next_timeout
     85  libusb_get_parent
     86  libusb_get_parent@4 = libusb_get_parent
    6187  libusb_get_pollfds
    6288  libusb_get_pollfds@4 = libusb_get_pollfds
     89  libusb_get_port_number
     90  libusb_get_port_number@4 = libusb_get_port_number
     91  libusb_get_port_numbers
     92  libusb_get_port_numbers@12 = libusb_get_port_numbers
     93  libusb_get_port_path
     94  libusb_get_port_path@16 = libusb_get_port_path
     95  libusb_get_ss_endpoint_companion_descriptor
     96  libusb_get_ss_endpoint_companion_descriptor@12 = libusb_get_ss_endpoint_companion_descriptor
     97  libusb_get_ss_usb_device_capability_descriptor
     98  libusb_get_ss_usb_device_capability_descriptor@12 = libusb_get_ss_usb_device_capability_descriptor
    6399  libusb_get_string_descriptor_ascii
    64100  libusb_get_string_descriptor_ascii@16 = libusb_get_string_descriptor_ascii
     101  libusb_get_usb_2_0_extension_descriptor
     102  libusb_get_usb_2_0_extension_descriptor@12 = libusb_get_usb_2_0_extension_descriptor
    65103  libusb_get_version
    66104  libusb_get_version@0 = libusb_get_version
     
    77115  libusb_has_capability
    78116  libusb_has_capability@4 = libusb_has_capability
     117  libusb_hotplug_deregister_callback
     118  libusb_hotplug_deregister_callback@8 = libusb_hotplug_deregister_callback
     119  libusb_hotplug_register_callback
     120  libusb_hotplug_register_callback@36 = libusb_hotplug_register_callback
    79121  libusb_init
    80122  libusb_init@4 = libusb_init
     123  libusb_interrupt_event_handler
     124  libusb_interrupt_event_handler@4 = libusb_interrupt_event_handler
    81125  libusb_interrupt_transfer
    82126  libusb_interrupt_transfer@24 = libusb_interrupt_transfer
    83127  libusb_kernel_driver_active
    84128  libusb_kernel_driver_active@8 = libusb_kernel_driver_active
     129  libusb_lock_events
     130  libusb_lock_events@4 = libusb_lock_events
    85131  libusb_lock_event_waiters
    86132  libusb_lock_event_waiters@4 = libusb_lock_event_waiters
    87   libusb_lock_events
    88   libusb_lock_events@4 = libusb_lock_events
    89133  libusb_open
    90134  libusb_open@8 = libusb_open
     
    99143  libusb_reset_device
    100144  libusb_reset_device@4 = libusb_reset_device
     145  libusb_set_auto_detach_kernel_driver
     146  libusb_set_auto_detach_kernel_driver@8 = libusb_set_auto_detach_kernel_driver
    101147  libusb_set_configuration
    102148  libusb_set_configuration@8 = libusb_set_configuration
     
    105151  libusb_set_interface_alt_setting
    106152  libusb_set_interface_alt_setting@12 = libusb_set_interface_alt_setting
     153  libusb_setlocale
     154  libusb_setlocale@4 = libusb_setlocale
    107155  libusb_set_pollfd_notifiers
    108156  libusb_set_pollfd_notifiers@16 = libusb_set_pollfd_notifiers
     157  libusb_strerror
     158  libusb_strerror@4 = libusb_strerror
    109159  libusb_submit_transfer
    110160  libusb_submit_transfer@4 = libusb_submit_transfer
     161  libusb_transfer_get_stream_id
     162  libusb_transfer_get_stream_id@4 = libusb_transfer_get_stream_id
     163  libusb_transfer_set_stream_id
     164  libusb_transfer_set_stream_id@8 = libusb_transfer_set_stream_id
    111165  libusb_try_lock_events
    112166  libusb_try_lock_events@4 = libusb_try_lock_events
     167  libusb_unlock_events
     168  libusb_unlock_events@4 = libusb_unlock_events
    113169  libusb_unlock_event_waiters
    114170  libusb_unlock_event_waiters@4 = libusb_unlock_event_waiters
    115   libusb_unlock_events
    116   libusb_unlock_events@4 = libusb_unlock_events
    117171  libusb_unref_device
    118172  libusb_unref_device@4 = libusb_unref_device
  • TabularUnified libusb1/trunk/libusb/libusb-1.0.rc

    r1876 r1882  
    66 * viewed with utilities such as Windows Explorer.
    77 */
     8#ifndef _WIN32_WCE
    89#include "winresrc.h"
     10#endif
    911
    1012#include "version.h"
     
    1315#define LU_XSTR(s) LU_STR(s)
    1416#if LIBUSB_NANO > 0
    15 #define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0"
     17#define LIBUSB_VERSIONSTRING \
     18        LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \
     19        LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0"
    1620#else
    17 #define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0"
     21#define LIBUSB_VERSIONSTRING \
     22        LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \
     23        LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0"
    1824#endif
    1925#endif
     
    3642                BLOCK "040904b0"
    3743                BEGIN
    38                         VALUE "Comments", "\0"
    39                         VALUE "CompanyName", "libusb.org\0"
     44                        VALUE "CompanyName", "libusb.info\0"
    4045                        VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0"
    4146                        VALUE "FileVersion", LIBUSB_VERSIONSTRING
  • TabularUnified libusb1/trunk/libusb/libusb.h

    r1876 r1882  
    11/*
    22 * Public libusb header file
    3  * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
    4  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
    5  * Copyright (C) 2012-2013 Nathan Hjelm <hjelmn@cs.unm.edu>
    6  * Copyright (C) 2012 Peter Stuge <peter@stuge.se>
     3 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
     4 * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
     5 * Copyright © 2012 Pete Batard <pete@akeo.ie>
     6 * Copyright © 2012 Nathan Hjelm <hjelmn@cs.unm.edu>
     7 * For more information, please visit: http://libusb.info
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    2627#ifdef _MSC_VER
    2728/* on MS environments, the inline keyword is available in C++ only */
     29#if !defined(__cplusplus)
    2830#define inline __inline
     31#endif
    2932/* ssize_t is also not available (copy/paste from MinGW) */
    3033#ifndef _SSIZE_T_DEFINED
     
    3942#endif /* _MSC_VER */
    4043
    41 /* stdint.h is also not usually available on MS */
     44/* stdint.h is not available on older MSVC */
    4245#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
    4346typedef unsigned __int8   uint8_t;
     
    4851#endif
    4952
     53#if !defined(_WIN32_WCE)
    5054#include <sys/types.h>
     55#endif
     56
     57#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__HAIKU__)
     58#include <sys/time.h>
     59#endif
     60
    5161#include <time.h>
    5262#include <limits.h>
    53 
    54 #if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
    55 #include <sys/time.h>
    56 #endif
    5763
    5864/* 'interface' might be defined as a macro on Windows, so we need to
     
    6167 * As this can be problematic if you include windows.h after libusb.h
    6268 * in your sources, we force windows.h to be included first. */
    63 #if defined(_WIN32) || defined(__CYGWIN__)
     69#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
    6470#include <windows.h>
    6571#if defined(interface)
    6672#undef interface
    6773#endif
     74#if !defined(__CYGWIN__)
     75#include <winsock.h>
    6876#endif
     77#endif
     78
     79#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
     80#define LIBUSB_DEPRECATED_FOR(f) \
     81  __attribute__((deprecated("Use " #f " instead")))
     82#else
     83#define LIBUSB_DEPRECATED_FOR(f)
     84#endif /* __GNUC__ */
    6985
    7086/** \def LIBUSB_CALL
    71  * \ingroup misc
     87 * \ingroup libusb_misc
    7288 * libusb's Windows calling convention.
    7389 *
     
    7591 * means that, unlike other platforms, there is not <em>one true calling
    7692 * convention</em> (calling convention: the manner in which parameters are
    77  * passed to funcions in the generated assembly code).
     93 * passed to functions in the generated assembly code).
    7894 *
    7995 * Matching the Windows API itself, libusb uses the WINAPI convention (which
     
    100116 * API_EXPORTED.
    101117 */
    102 #if defined(_WIN32) || defined(__CYGWIN__)
     118#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
    103119#define LIBUSB_CALL WINAPI
    104120#else
     
    106122#endif
    107123
     124/** \def LIBUSB_API_VERSION
     125 * \ingroup libusb_misc
     126 * libusb's API version.
     127 *
     128 * Since version 1.0.13, to help with feature detection, libusb defines
     129 * a LIBUSB_API_VERSION macro that gets increased every time there is a
     130 * significant change to the API, such as the introduction of a new call,
     131 * the definition of a new macro/enum member, or any other element that
     132 * libusb applications may want to detect at compilation time.
     133 *
     134 * The macro is typically used in an application as follows:
     135 * \code
     136 * #if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01001234)
     137 * // Use one of the newer features from the libusb API
     138 * #endif
     139 * \endcode
     140 *
     141 * Internally, LIBUSB_API_VERSION is defined as follows:
     142 * (libusb major << 24) | (libusb minor << 16) | (16 bit incremental)
     143 */
     144#define LIBUSB_API_VERSION 0x01000105
     145
     146/* The following is kept for compatibility, but will be deprecated in the future */
     147#define LIBUSBX_API_VERSION LIBUSB_API_VERSION
     148
    108149#ifdef __cplusplus
    109150extern "C" {
    110151#endif
    111152
    112 /** \def libusb_cpu_to_le16
    113  * \ingroup misc
     153/**
     154 * \ingroup libusb_misc
    114155 * Convert a 16-bit value from host-endian to little-endian format. On
    115156 * little endian systems, this function does nothing. On big endian systems,
     
    124165                uint16_t b16;
    125166        } _tmp;
    126         _tmp.b8[1] = x >> 8;
    127         _tmp.b8[0] = x & 0xff;
     167        _tmp.b8[1] = (uint8_t) (x >> 8);
     168        _tmp.b8[0] = (uint8_t) (x & 0xff);
    128169        return _tmp.b16;
    129170}
    130171
    131172/** \def libusb_le16_to_cpu
    132  * \ingroup misc
     173 * \ingroup libusb_misc
    133174 * Convert a 16-bit value from little-endian to host-endian format. On
    134175 * little endian systems, this function does nothing. On big endian systems,
     
    141182/* standard USB stuff */
    142183
    143 /** \ingroup desc
     184/** \ingroup libusb_desc
    144185 * Device and/or Interface Class codes */
    145186enum libusb_class_code {
     
    203244};
    204245
    205 /** \ingroup desc
     246/** \ingroup libusb_desc
    206247 * Descriptor types as defined by the USB specification. */
    207248enum libusb_descriptor_type {
     
    221262        LIBUSB_DT_ENDPOINT = 0x05,
    222263
     264        /** BOS descriptor */
     265        LIBUSB_DT_BOS = 0x0f,
     266
     267        /** Device Capability descriptor */
     268        LIBUSB_DT_DEVICE_CAPABILITY = 0x10,
     269
    223270        /** HID descriptor */
    224271        LIBUSB_DT_HID = 0x21,
     
    233280        LIBUSB_DT_HUB = 0x29,
    234281
    235         /** BOS descriptor */
    236         LIBUSB_DT_BOS = 0x0f,
    237 
    238         /** Device Capability descriptor */
    239         LIBUSB_DT_DEVICE_CAPABILITY = 0x10,
     282        /** SuperSpeed Hub descriptor */
     283        LIBUSB_DT_SUPERSPEED_HUB = 0x2a,
    240284
    241285        /** SuperSpeed Endpoint Companion descriptor */
     
    247291#define LIBUSB_DT_CONFIG_SIZE                   9
    248292#define LIBUSB_DT_INTERFACE_SIZE                9
    249 #define LIBUSB_DT_ENDPOINT_SIZE         7
    250 #define LIBUSB_DT_ENDPOINT_AUDIO_SIZE   9       /* Audio extension */
     293#define LIBUSB_DT_ENDPOINT_SIZE                 7
     294#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE           9       /* Audio extension */
    251295#define LIBUSB_DT_HUB_NONVAR_SIZE               7
    252 #define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE    6
     296#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE    6
    253297#define LIBUSB_DT_BOS_SIZE                      5
    254 #define LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE 7
    255 #define LIBUSB_SS_USB_DEVICE_CAPABILITY_SIZE    10
    256 #define LIBUSB_DT_BOS_MAX_SIZE          ((LIBUSB_DT_BOS_SIZE) + \
    257                                         (LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE) + \
    258                                         (LIBUSB_SS_USB_DEVICE_CAPABILITY_SIZE))
     298#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE        3
     299
     300/* BOS descriptor sizes */
     301#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE        7
     302#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
     303#define LIBUSB_BT_CONTAINER_ID_SIZE             20
     304
     305/* We unwrap the BOS => define its max size */
     306#define LIBUSB_DT_BOS_MAX_SIZE          ((LIBUSB_DT_BOS_SIZE)     +\
     307                                        (LIBUSB_BT_USB_2_0_EXTENSION_SIZE)       +\
     308                                        (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\
     309                                        (LIBUSB_BT_CONTAINER_ID_SIZE))
    259310
    260311#define LIBUSB_ENDPOINT_ADDRESS_MASK    0x0f    /* in bEndpointAddress */
    261312#define LIBUSB_ENDPOINT_DIR_MASK                0x80
    262313
    263 /** \ingroup desc
     314/** \ingroup libusb_desc
    264315 * Endpoint direction. Values for bit 7 of the
    265316 * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme.
     
    275326#define LIBUSB_TRANSFER_TYPE_MASK                       0x03    /* in bmAttributes */
    276327
    277 /** \ingroup desc
     328/** \ingroup libusb_desc
    278329 * Endpoint transfer type. Values for bits 0:1 of the
    279330 * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field.
     
    290341
    291342        /** Interrupt endpoint */
    292         LIBUSB_TRANSFER_TYPE_INTERRUPT = 3
    293 };
    294 
    295 /** \ingroup misc
    296  * Standard requests, as defined in table 9-3 of the USB2 specifications */
     343        LIBUSB_TRANSFER_TYPE_INTERRUPT = 3,
     344
     345        /** Stream endpoint */
     346        LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4,
     347};
     348
     349/** \ingroup libusb_misc
     350 * Standard requests, as defined in table 9-5 of the USB 3.0 specifications */
    297351enum libusb_standard_request {
    298352        /** Request status of the specific recipient */
     
    332386        /** Set then report an endpoint's synchronization frame */
    333387        LIBUSB_REQUEST_SYNCH_FRAME = 0x0C,
    334 };
    335 
    336 /** \ingroup misc
     388
     389        /** Sets both the U1 and U2 Exit Latency */
     390        LIBUSB_REQUEST_SET_SEL = 0x30,
     391
     392        /** Delay from the time a host transmits a packet to the time it is
     393          * received by the device. */
     394        LIBUSB_SET_ISOCH_DELAY = 0x31,
     395};
     396
     397/** \ingroup libusb_misc
    337398 * Request type bits of the
    338399 * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control
     
    352413};
    353414
    354 /** \ingroup misc
     415/** \ingroup libusb_misc
    355416 * Recipient bits of the
    356417 * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control
     
    372433#define LIBUSB_ISO_SYNC_TYPE_MASK               0x0C
    373434
    374 /** \ingroup desc
     435/** \ingroup libusb_desc
    375436 * Synchronization type for isochronous endpoints. Values for bits 2:3 of the
    376437 * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in
     
    393454#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
    394455
    395 /** \ingroup desc
     456/** \ingroup libusb_desc
    396457 * Usage type for isochronous endpoints. Values for bits 4:5 of the
    397458 * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in
     
    409470};
    410471
    411 /** \ingroup desc
     472/** \ingroup libusb_desc
    412473 * A structure representing the standard USB device descriptor. This
    413  * descriptor is documented in section 9.6.1 of the USB 2.0 specification.
     474 * descriptor is documented in section 9.6.1 of the USB 3.0 specification.
    414475 * All multiple-byte fields are represented in host-endian format.
    415476 */
     
    463524};
    464525
    465 /** \ingroup desc
    466  * A structure representing the superspeed endpoint companion
    467  * descriptor. This descriptor is documented in section 9.6.7 of
    468  * the USB 3.0 specification. All ultiple-byte fields are represented in
    469  * host-endian format.
    470  */
    471 struct libusb_ss_endpoint_companion_descriptor {
    472 
    473         /** Size of this descriptor (in bytes) */
    474         uint8_t  bLength;
    475 
    476         /** Descriptor type. Will have value
    477          * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in
    478          * this context. */
    479         uint8_t  bDescriptorType;
    480 
    481 
    482         /** The maximum number of packets the endpoint can send or
    483          *  recieve as part of a burst. */
    484         uint8_t  bMaxBurst;
    485 
    486         /** In bulk EP: bits 4:0 represents the maximum number of
    487          *  streams the EP supports. In isochronous EP: bits 1:0
    488          *  represents the Mult - a zero based value that determines
    489          *  the maximum number of packets within a service interval  */
    490         uint8_t  bmAttributes;
    491 
    492         /** The total number of bytes this EP will transfer every
    493          *  service interval. valid only for periodic EPs. */
    494         uint16_t wBytesPerInterval;
    495 };
    496 
    497 /** \ingroup desc
     526/** \ingroup libusb_desc
    498527 * A structure representing the standard USB endpoint descriptor. This
    499  * descriptor is documented in section 9.6.3 of the USB 2.0 specification.
     528 * descriptor is documented in section 9.6.6 of the USB 3.0 specification.
    500529 * All multiple-byte fields are represented in host-endian format.
    501530 */
     
    545574};
    546575
    547 
    548 /** \ingroup desc
     576/** \ingroup libusb_desc
    549577 * A structure representing the standard USB interface descriptor. This
    550  * descriptor is documented in section 9.6.5 of the USB 2.0 specification.
     578 * descriptor is documented in section 9.6.5 of the USB 3.0 specification.
    551579 * All multiple-byte fields are represented in host-endian format.
    552580 */
     
    596624};
    597625
    598 /** \ingroup desc
     626/** \ingroup libusb_desc
    599627 * A collection of alternate settings for a particular USB interface.
    600628 */
     
    608636};
    609637
    610 /** \ingroup desc
     638/** \ingroup libusb_desc
    611639 * A structure representing the standard USB configuration descriptor. This
    612  * descriptor is documented in section 9.6.3 of the USB 2.0 specification.
     640 * descriptor is documented in section 9.6.3 of the USB 3.0 specification.
    613641 * All multiple-byte fields are represented in host-endian format.
    614642 */
     
    638666
    639667        /** Maximum power consumption of the USB device from this bus in this
    640          * configuration when the device is fully opreation. Expressed in units
    641          * of 2 mA. */
     668         * configuration when the device is fully operation. Expressed in units
     669         * of 2 mA when the device is operating in high-speed mode and in units
     670         * of 8 mA when the device is operating in super-speed mode. */
    642671        uint8_t  MaxPower;
    643672
     
    654683};
    655684
    656 /** \ingroup desc
    657  * A structure representing the BOS descriptor. This
    658  * descriptor is documented in section 9.6.2 of the USB 3.0
    659  * specification. All multiple-byte fields are represented in
     685/** \ingroup libusb_desc
     686 * A structure representing the superspeed endpoint companion
     687 * descriptor. This descriptor is documented in section 9.6.7 of
     688 * the USB 3.0 specification. All multiple-byte fields are represented in
    660689 * host-endian format.
     690 */
     691struct libusb_ss_endpoint_companion_descriptor {
     692
     693        /** Size of this descriptor (in bytes) */
     694        uint8_t  bLength;
     695
     696        /** Descriptor type. Will have value
     697         * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in
     698         * this context. */
     699        uint8_t  bDescriptorType;
     700
     701
     702        /** The maximum number of packets the endpoint can send or
     703         *  receive as part of a burst. */
     704        uint8_t  bMaxBurst;
     705
     706        /** In bulk EP: bits 4:0 represents the maximum number of
     707         *  streams the EP supports. In isochronous EP: bits 1:0
     708         *  represents the Mult - a zero based value that determines
     709         *  the maximum number of packets within a service interval  */
     710        uint8_t  bmAttributes;
     711
     712        /** The total number of bytes this EP will transfer every
     713         *  service interval. valid only for periodic EPs. */
     714        uint16_t wBytesPerInterval;
     715};
     716
     717/** \ingroup libusb_desc
     718 * A generic representation of a BOS Device Capability descriptor. It is
     719 * advised to check bDevCapabilityType and call the matching
     720 * libusb_get_*_descriptor function to get a structure fully matching the type.
     721 */
     722struct libusb_bos_dev_capability_descriptor {
     723        /** Size of this descriptor (in bytes) */
     724        uint8_t bLength;
     725        /** Descriptor type. Will have value
     726         * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
     727         * LIBUSB_DT_DEVICE_CAPABILITY in this context. */
     728        uint8_t bDescriptorType;
     729        /** Device Capability type */
     730        uint8_t bDevCapabilityType;
     731        /** Device Capability data (bLength - 3 bytes) */
     732        uint8_t dev_capability_data
     733#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
     734        [] /* valid C99 code */
     735#else
     736        [0] /* non-standard, but usually working code */
     737#endif
     738        ;
     739};
     740
     741/** \ingroup libusb_desc
     742 * A structure representing the Binary Device Object Store (BOS) descriptor.
     743 * This descriptor is documented in section 9.6.2 of the USB 3.0 specification.
     744 * All multiple-byte fields are represented in host-endian format.
    661745 */
    662746struct libusb_bos_descriptor {
     
    676760        uint8_t  bNumDeviceCaps;
    677761
    678         /** USB 2.0 extension capability descriptor */
    679         struct libusb_usb_2_0_device_capability_descriptor *usb_2_0_ext_cap;
    680 
    681         /** SuperSpeed capabilty descriptor */
    682         struct libusb_ss_usb_device_capability_descriptor *ss_usb_cap;
    683 };
    684 
    685 /** \ingroup desc
    686  * A structure representing the device capability descriptor for
    687  * USB 2.0. This descriptor is documented in section 9.6.2.1 of
    688  * the USB 3.0 specification. All mutiple-byte fields are represented
    689  * in host-endian format.
    690  */
    691 struct libusb_usb_2_0_device_capability_descriptor {
     762        /** bNumDeviceCap Device Capability Descriptors */
     763        struct libusb_bos_dev_capability_descriptor *dev_capability
     764#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
     765        [] /* valid C99 code */
     766#else
     767        [0] /* non-standard, but usually working code */
     768#endif
     769        ;
     770};
     771
     772/** \ingroup libusb_desc
     773 * A structure representing the USB 2.0 Extension descriptor
     774 * This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification.
     775 * All multiple-byte fields are represented in host-endian format.
     776 */
     777struct libusb_usb_2_0_extension_descriptor {
    692778        /** Size of this descriptor (in bytes) */
    693779        uint8_t  bLength;
     
    699785
    700786        /** Capability type. Will have value
    701          * \ref libusb_capability_type::LIBUSB_USB_CAP_TYPE_EXT
    702          * LIBUSB_USB_CAP_TYPE_EXT in this context. */
     787         * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION
     788         * LIBUSB_BT_USB_2_0_EXTENSION in this context. */
    703789        uint8_t  bDevCapabilityType;
    704790
     
    706792         * A value of one in a bit location indicates a feature is
    707793         * supported; a value of zero indicates it is not supported.
    708          * See \ref libusb_capability_attributes. */
     794         * See \ref libusb_usb_2_0_extension_attributes. */
    709795        uint32_t  bmAttributes;
    710796};
    711797
    712 /** \ingroup desc
    713  * A structure representing the device capability descriptor for
    714  * USB 3.0. This descriptor is documented in section 9.6.2.2 of
    715  * the USB 3.0 specification. All mutiple-byte fields are represented
    716  * in host-endian format.
     798/** \ingroup libusb_desc
     799 * A structure representing the SuperSpeed USB Device Capability descriptor
     800 * This descriptor is documented in section 9.6.2.2 of the USB 3.0 specification.
     801 * All multiple-byte fields are represented in host-endian format.
    717802 */
    718803struct libusb_ss_usb_device_capability_descriptor {
     
    726811
    727812        /** Capability type. Will have value
    728          * \ref libusb_capability_type::LIBUSB_SS_USB_CAP_TYPE
    729          * LIBUSB_SS_USB_CAP_TYPE in this context. */
     813         * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
     814         * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. */
    730815        uint8_t  bDevCapabilityType;
    731816
     
    733818         * A value of one in a bit location indicates a feature is
    734819         * supported; a value of zero indicates it is not supported.
    735          * See \ref libusb_capability_attributes. */
     820         * See \ref libusb_ss_usb_device_capability_attributes. */
    736821        uint8_t  bmAttributes;
    737822
     
    753838};
    754839
    755 
    756 /** \ingroup asyncio
     840/** \ingroup libusb_desc
     841 * A structure representing the Container ID descriptor.
     842 * This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification.
     843 * All multiple-byte fields, except UUIDs, are represented in host-endian format.
     844 */
     845struct libusb_container_id_descriptor {
     846        /** Size of this descriptor (in bytes) */
     847        uint8_t  bLength;
     848
     849        /** Descriptor type. Will have value
     850         * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
     851         * LIBUSB_DT_DEVICE_CAPABILITY in this context. */
     852        uint8_t  bDescriptorType;
     853
     854        /** Capability type. Will have value
     855         * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID
     856         * LIBUSB_BT_CONTAINER_ID in this context. */
     857        uint8_t  bDevCapabilityType;
     858
     859        /** Reserved field */
     860        uint8_t bReserved;
     861
     862        /** 128 bit UUID */
     863        uint8_t  ContainerID[16];
     864};
     865
     866/** \ingroup libusb_asyncio
    757867 * Setup packet for control transfers. */
    758868struct libusb_control_setup {
     
    789899struct libusb_device;
    790900struct libusb_device_handle;
    791 struct libusb_hotplug_callback;
    792 
    793 /** \ingroup lib
    794  * Structure representing the libusb version.
     901
     902/** \ingroup libusb_lib
     903 * Structure providing the version of the libusb runtime
    795904 */
    796905struct libusb_version {
     
    804913        const uint16_t micro;
    805914
    806         /** Library nano version. This field is only nonzero on Windows. */
     915        /** Library nano version. */
    807916        const uint16_t nano;
    808917
     
    810919        const char *rc;
    811920
    812         /** Output of `git describe --tags` at library build time. */
    813         const char *describe;
    814 };
    815 
    816 /** \ingroup lib
     921        /** For ABI compatibility only. */
     922        const char* describe;
     923};
     924
     925/** \ingroup libusb_lib
    817926 * Structure representing a libusb session. The concept of individual libusb
    818927 * sessions allows for your program to use two libraries (or dynamically
     
    829938 * will be used.
    830939 *
    831  * For more information, see \ref contexts.
     940 * For more information, see \ref libusb_contexts.
    832941 */
    833942typedef struct libusb_context libusb_context;
    834943
    835 /** \ingroup dev
     944/** \ingroup libusb_dev
    836945 * Structure representing a USB device detected on the system. This is an
    837946 * opaque type for which you are only ever provided with a pointer, usually
     
    851960
    852961
    853 /** \ingroup dev
     962/** \ingroup libusb_dev
    854963 * Structure representing a handle on a USB device. This is an opaque type for
    855964 * which you are only ever provided with a pointer, usually originating from
     
    861970typedef struct libusb_device_handle libusb_device_handle;
    862971
    863 /** \ingroup dev
     972/** \ingroup libusb_dev
    864973 * Speed codes. Indicates the speed at which the device is operating.
    865974 */
    866975enum libusb_speed {
    867     /** The OS doesn't report or know the device speed. */
    868     LIBUSB_SPEED_UNKNOWN = 0,
    869 
    870     /** The device is operating at low speed (1.5MBit/s). */
    871     LIBUSB_SPEED_LOW = 1,
    872 
    873     /** The device is operating at full speed (12MBit/s). */
    874     LIBUSB_SPEED_FULL = 2,
    875 
    876     /** The device is operating at high speed (480MBit/s). */
    877     LIBUSB_SPEED_HIGH = 3,
    878 
    879     /** The device is operating at super speed (5000MBit/s). */
    880     LIBUSB_SPEED_SUPER = 4,
    881 };
    882 
    883 /** \ingroup dev
     976        /** The OS doesn't report or know the device speed. */
     977        LIBUSB_SPEED_UNKNOWN = 0,
     978
     979        /** The device is operating at low speed (1.5MBit/s). */
     980        LIBUSB_SPEED_LOW = 1,
     981
     982        /** The device is operating at full speed (12MBit/s). */
     983        LIBUSB_SPEED_FULL = 2,
     984
     985        /** The device is operating at high speed (480MBit/s). */
     986        LIBUSB_SPEED_HIGH = 3,
     987
     988        /** The device is operating at super speed (5000MBit/s). */
     989        LIBUSB_SPEED_SUPER = 4,
     990};
     991
     992/** \ingroup libusb_dev
    884993 * Supported speeds (wSpeedSupported) bitfield. Indicates what
    885994 * speeds the device supports.
     
    887996enum libusb_supported_speed {
    888997        /** Low speed operation supported (1.5MBit/s). */
    889         LIBUSB_LOW_SPEED_OPERATION  = 1,
     998        LIBUSB_LOW_SPEED_OPERATION   = 1,
    890999
    8911000        /** Full speed operation supported (12MBit/s). */
    892         LIBUSB_FULL_SPEED_OPERATION = 2,
     1001        LIBUSB_FULL_SPEED_OPERATION  = 2,
    8931002
    8941003        /** High speed operation supported (480MBit/s). */
    895         LIBUSB_HIGH_SPEED_OPERATION = 4,
     1004        LIBUSB_HIGH_SPEED_OPERATION  = 4,
    8961005
    8971006        /** Superspeed operation supported (5000MBit/s). */
    898         LIBUSB_5GBPS_OPERATION      = 8,
    899 };
    900 
    901 /** \ingroup dev
    902  * Capability attributes
    903  */
    904 enum libusb_capability_attributes {
     1007        LIBUSB_SUPER_SPEED_OPERATION = 8,
     1008};
     1009
     1010/** \ingroup libusb_dev
     1011 * Masks for the bits of the
     1012 * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field
     1013 * of the USB 2.0 Extension descriptor.
     1014 */
     1015enum libusb_usb_2_0_extension_attributes {
    9051016        /** Supports Link Power Management (LPM) */
    906         LIBUSB_LPM_SUPPORT = 2,
    907 };
    908 
    909 /** \ingroup dev
     1017        LIBUSB_BM_LPM_SUPPORT = 2,
     1018};
     1019
     1020/** \ingroup libusb_dev
     1021 * Masks for the bits of the
     1022 * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field
     1023 * field of the SuperSpeed USB Device Capability descriptor.
     1024 */
     1025enum libusb_ss_usb_device_capability_attributes {
     1026        /** Supports Latency Tolerance Messages (LTM) */
     1027        LIBUSB_BM_LTM_SUPPORT = 2,
     1028};
     1029
     1030/** \ingroup libusb_dev
    9101031 * USB capability types
    9111032 */
    912 enum libusb_capability_type {
    913         /** USB 2.0 extension capability type */
    914         LIBUSB_USB_CAP_TYPE_EXT = 2,
    915 
    916         /** SuperSpeed capability type */
    917         LIBUSB_SS_USB_CAP_TYPE  = 3,
    918 };
    919 
    920 /** \ingroup misc
     1033enum libusb_bos_type {
     1034        /** Wireless USB device capability */
     1035        LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY        = 1,
     1036
     1037        /** USB 2.0 extensions */
     1038        LIBUSB_BT_USB_2_0_EXTENSION                     = 2,
     1039
     1040        /** SuperSpeed USB device capability */
     1041        LIBUSB_BT_SS_USB_DEVICE_CAPABILITY              = 3,
     1042
     1043        /** Container ID type */
     1044        LIBUSB_BT_CONTAINER_ID                          = 4,
     1045};
     1046
     1047/** \ingroup libusb_misc
    9211048 * Error codes. Most libusb functions return 0 on success or one of these
    9221049 * codes on failure.
    923  * You can call \ref libusb_error_name() to retrieve a string representation
    924  * of an error code.
     1050 * You can call libusb_error_name() to retrieve a string representation of an
     1051 * error code or libusb_strerror() to get an end-user suitable description of
     1052 * an error code.
    9251053 */
    9261054enum libusb_error {
     
    9641092        LIBUSB_ERROR_NOT_SUPPORTED = -12,
    9651093
    966         /* NB! Remember to update libusb_error_name()
    967            when adding new error codes here. */
     1094        /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the
     1095           message strings in strerror.c when adding new error codes here. */
    9681096
    9691097        /** Other error */
     
    9711099};
    9721100
    973 /** \ingroup asyncio
     1101/* Total number of error codes in enum libusb_error */
     1102#define LIBUSB_ERROR_COUNT 14
     1103
     1104/** \ingroup libusb_asyncio
    9741105 * Transfer status codes */
    9751106enum libusb_transfer_status {
     
    9961127        /** Device sent more data than requested */
    9971128        LIBUSB_TRANSFER_OVERFLOW,
    998 };
    999 
    1000 /** \ingroup asyncio
     1129
     1130        /* NB! Remember to update libusb_error_name()
     1131           when adding new status codes here. */
     1132};
     1133
     1134/** \ingroup libusb_asyncio
    10011135 * libusb_transfer.flags values */
    10021136enum libusb_transfer_flags {
     
    10041138        LIBUSB_TRANSFER_SHORT_NOT_OK = 1<<0,
    10051139
    1006         /** Automatically free() transfer buffer during libusb_free_transfer() */
     1140        /** Automatically free() transfer buffer during libusb_free_transfer().
     1141         * Note that buffers allocated with libusb_dev_mem_alloc() should not
     1142         * be attempted freed in this way, since free() is not an appropriate
     1143         * way to release such memory. */
    10071144        LIBUSB_TRANSFER_FREE_BUFFER = 1<<1,
    10081145
     
    10391176};
    10401177
    1041 /** \ingroup asyncio
     1178/** \ingroup libusb_asyncio
    10421179 * Isochronous packet descriptor. */
    10431180struct libusb_iso_packet_descriptor {
     
    10541191struct libusb_transfer;
    10551192
    1056 /** \ingroup asyncio
     1193/** \ingroup libusb_asyncio
    10571194 * Asynchronous transfer callback function type. When submitting asynchronous
    10581195 * transfers, you pass a pointer to a callback function of this type via the
    10591196 * \ref libusb_transfer::callback "callback" member of the libusb_transfer
    10601197 * structure. libusb will call this function later, when the transfer has
    1061  * completed or failed. See \ref asyncio for more information.
     1198 * completed or failed. See \ref libusb_asyncio for more information.
    10621199 * \param transfer The libusb_transfer struct the callback function is being
    10631200 * notified about.
     
    10651202typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer);
    10661203
    1067 /** \ingroup asyncio
     1204/** \ingroup libusb_asyncio
    10681205 * The generic USB transfer structure. The user populates this structure and
    10691206 * then submits it in order to request a transfer. After the transfer has
     
    11291266};
    11301267
    1131 /** \ingroup misc
    1132  * Capabilities supported by this instance of libusb. Test if the loaded
    1133  * library supports a given capability by calling
     1268/** \ingroup libusb_misc
     1269 * Capabilities supported by an instance of libusb on the current running
     1270 * platform. Test if the loaded library supports a given capability by calling
    11341271 * \ref libusb_has_capability().
    11351272 */
    11361273enum libusb_capability {
    11371274        /** The libusb_has_capability() API is available. */
    1138         LIBUSB_CAP_HAS_CAPABILITY = 0,
    1139         /** The libusb hotplug API is available. */
    1140         LIBUSB_CAP_HAS_HOTPLUG    = 1,
     1275        LIBUSB_CAP_HAS_CAPABILITY = 0x0000,
     1276        /** Hotplug support is available on this platform. */
     1277        LIBUSB_CAP_HAS_HOTPLUG = 0x0001,
     1278        /** The library can access HID devices without requiring user intervention.
     1279         * Note that before being able to actually access an HID device, you may
     1280         * still have to call additional libusb functions such as
     1281         * \ref libusb_detach_kernel_driver(). */
     1282        LIBUSB_CAP_HAS_HID_ACCESS = 0x0100,
     1283        /** The library supports detaching of the default USB driver, using
     1284         * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */
     1285        LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101
     1286};
     1287
     1288/** \ingroup libusb_lib
     1289 *  Log message levels.
     1290 *  - LIBUSB_LOG_LEVEL_NONE (0)    : no messages ever printed by the library (default)
     1291 *  - LIBUSB_LOG_LEVEL_ERROR (1)   : error messages are printed to stderr
     1292 *  - LIBUSB_LOG_LEVEL_WARNING (2) : warning and error messages are printed to stderr
     1293 *  - LIBUSB_LOG_LEVEL_INFO (3)    : informational messages are printed to stdout, warning
     1294 *    and error messages are printed to stderr
     1295 *  - LIBUSB_LOG_LEVEL_DEBUG (4)   : debug and informational messages are printed to stdout,
     1296 *    warnings and errors to stderr
     1297 */
     1298enum libusb_log_level {
     1299        LIBUSB_LOG_LEVEL_NONE = 0,
     1300        LIBUSB_LOG_LEVEL_ERROR,
     1301        LIBUSB_LOG_LEVEL_WARNING,
     1302        LIBUSB_LOG_LEVEL_INFO,
     1303        LIBUSB_LOG_LEVEL_DEBUG,
    11411304};
    11421305
     
    11471310int LIBUSB_CALL libusb_has_capability(uint32_t capability);
    11481311const char * LIBUSB_CALL libusb_error_name(int errcode);
     1312int LIBUSB_CALL libusb_setlocale(const char *locale);
     1313const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode);
    11491314
    11501315ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
     
    11671332void LIBUSB_CALL libusb_free_config_descriptor(
    11681333        struct libusb_config_descriptor *config);
     1334int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor(
     1335        struct libusb_context *ctx,
     1336        const struct libusb_endpoint_descriptor *endpoint,
     1337        struct libusb_ss_endpoint_companion_descriptor **ep_comp);
     1338void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor(
     1339        struct libusb_ss_endpoint_companion_descriptor *ep_comp);
     1340int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle,
     1341        struct libusb_bos_descriptor **bos);
     1342void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
     1343int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor(
     1344        struct libusb_context *ctx,
     1345        struct libusb_bos_dev_capability_descriptor *dev_cap,
     1346        struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
     1347void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor(
     1348        struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
     1349int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
     1350        struct libusb_context *ctx,
     1351        struct libusb_bos_dev_capability_descriptor *dev_cap,
     1352        struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
     1353void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
     1354        struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
     1355int LIBUSB_CALL libusb_get_container_id_descriptor(struct libusb_context *ctx,
     1356        struct libusb_bos_dev_capability_descriptor *dev_cap,
     1357        struct libusb_container_id_descriptor **container_id);
     1358void LIBUSB_CALL libusb_free_container_id_descriptor(
     1359        struct libusb_container_id_descriptor *container_id);
    11691360uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
     1361uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
     1362int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
     1363LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
     1364int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t* path, uint8_t path_length);
     1365libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev);
    11701366uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
    11711367int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev);
     
    11751371        unsigned char endpoint);
    11761372
    1177 int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **handle);
     1373int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **dev_handle);
    11781374void LIBUSB_CALL libusb_close(libusb_device_handle *dev_handle);
    11791375libusb_device * LIBUSB_CALL libusb_get_device(libusb_device_handle *dev_handle);
    11801376
    1181 int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev,
     1377int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev_handle,
    11821378        int configuration);
    1183 int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev,
     1379int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev_handle,
    11841380        int interface_number);
    1185 int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev,
     1381int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev_handle,
    11861382        int interface_number);
    11871383
     
    11891385        libusb_context *ctx, uint16_t vendor_id, uint16_t product_id);
    11901386
    1191 int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev,
     1387int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev_handle,
    11921388        int interface_number, int alternate_setting);
    1193 int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev,
     1389int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev_handle,
    11941390        unsigned char endpoint);
    1195 int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev);
    1196 
    1197 int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev,
     1391int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev_handle);
     1392
     1393int LIBUSB_CALL libusb_alloc_streams(libusb_device_handle *dev_handle,
     1394        uint32_t num_streams, unsigned char *endpoints, int num_endpoints);
     1395int LIBUSB_CALL libusb_free_streams(libusb_device_handle *dev_handle,
     1396        unsigned char *endpoints, int num_endpoints);
     1397
     1398unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle,
     1399        size_t length);
     1400int LIBUSB_CALL libusb_dev_mem_free(libusb_device_handle *dev_handle,
     1401        unsigned char *buffer, size_t length);
     1402
     1403int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev_handle,
    11981404        int interface_number);
    1199 int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev,
     1405int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev_handle,
    12001406        int interface_number);
    1201 int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev,
     1407int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev_handle,
    12021408        int interface_number);
     1409int LIBUSB_CALL libusb_set_auto_detach_kernel_driver(
     1410        libusb_device_handle *dev_handle, int enable);
    12031411
    12041412/* async I/O */
    12051413
    1206 /** \ingroup asyncio
     1414/** \ingroup libusb_asyncio
    12071415 * Get the data section of a control transfer. This convenience function is here
    12081416 * to remind you that the data does not start until 8 bytes into the actual
     
    12221430}
    12231431
    1224 /** \ingroup asyncio
     1432/** \ingroup libusb_asyncio
    12251433 * Get the control setup packet of a control transfer. This convenience
    12261434 * function is here to remind you that the control setup occupies the first
     
    12371445        struct libusb_transfer *transfer)
    12381446{
    1239         return (struct libusb_control_setup *) transfer->buffer;
     1447        return (struct libusb_control_setup *)(void *) transfer->buffer;
    12401448}
    12411449
    1242 /** \ingroup asyncio
     1450/** \ingroup libusb_asyncio
    12431451 * Helper function to populate the setup packet (first 8 bytes of the data
    12441452 * buffer) for a control transfer. The wIndex, wValue and wLength values should
     
    12461454 *
    12471455 * \param buffer buffer to output the setup packet into
     1456 * This pointer must be aligned to at least 2 bytes boundary.
    12481457 * \param bmRequestType see the
    12491458 * \ref libusb_control_setup::bmRequestType "bmRequestType" field of
     
    12661475        uint16_t wLength)
    12671476{
    1268         struct libusb_control_setup *setup = (struct libusb_control_setup *) buffer;
     1477        struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
    12691478        setup->bmRequestType = bmRequestType;
    12701479        setup->bRequest = bRequest;
     
    12781487int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer);
    12791488void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer);
    1280 
    1281 /** \ingroup asyncio
     1489void LIBUSB_CALL libusb_transfer_set_stream_id(
     1490        struct libusb_transfer *transfer, uint32_t stream_id);
     1491uint32_t LIBUSB_CALL libusb_transfer_get_stream_id(
     1492        struct libusb_transfer *transfer);
     1493
     1494/** \ingroup libusb_asyncio
    12821495 * Helper function to populate the required \ref libusb_transfer fields
    12831496 * for a control transfer.
     
    13021515 * \param buffer data buffer. If provided, this function will interpret the
    13031516 * first 8 bytes as a setup packet and infer the transfer length from that.
     1517 * This pointer must be aligned to at least 2 bytes boundary.
    13041518 * \param callback callback function to be invoked on transfer completion
    13051519 * \param user_data user data to pass to callback function
     
    13111525        unsigned int timeout)
    13121526{
    1313         struct libusb_control_setup *setup = (struct libusb_control_setup *) buffer;
     1527        struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
    13141528        transfer->dev_handle = dev_handle;
    13151529        transfer->endpoint = 0;
     
    13181532        transfer->buffer = buffer;
    13191533        if (setup)
    1320                 transfer->length = LIBUSB_CONTROL_SETUP_SIZE
    1321                         + libusb_le16_to_cpu(setup->wLength);
     1534                transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE
     1535                        + libusb_le16_to_cpu(setup->wLength));
    13221536        transfer->user_data = user_data;
    13231537        transfer->callback = callback;
    13241538}
    13251539
    1326 /** \ingroup asyncio
     1540/** \ingroup libusb_asyncio
    13271541 * Helper function to populate the required \ref libusb_transfer fields
    13281542 * for a bulk transfer.
     
    13521566}
    13531567
    1354 /** \ingroup asyncio
     1568/** \ingroup libusb_asyncio
     1569 * Helper function to populate the required \ref libusb_transfer fields
     1570 * for a bulk transfer using bulk streams.
     1571 *
     1572 * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103
     1573 *
     1574 * \param transfer the transfer to populate
     1575 * \param dev_handle handle of the device that will handle the transfer
     1576 * \param endpoint address of the endpoint where this transfer will be sent
     1577 * \param stream_id bulk stream id for this transfer
     1578 * \param buffer data buffer
     1579 * \param length length of data buffer
     1580 * \param callback callback function to be invoked on transfer completion
     1581 * \param user_data user data to pass to callback function
     1582 * \param timeout timeout for the transfer in milliseconds
     1583 */
     1584static inline void libusb_fill_bulk_stream_transfer(
     1585        struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
     1586        unsigned char endpoint, uint32_t stream_id,
     1587        unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
     1588        void *user_data, unsigned int timeout)
     1589{
     1590        libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer,
     1591                                  length, callback, user_data, timeout);
     1592        transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM;
     1593        libusb_transfer_set_stream_id(transfer, stream_id);
     1594}
     1595
     1596/** \ingroup libusb_asyncio
    13551597 * Helper function to populate the required \ref libusb_transfer fields
    13561598 * for an interrupt transfer.
     
    13801622}
    13811623
    1382 /** \ingroup asyncio
     1624/** \ingroup libusb_asyncio
    13831625 * Helper function to populate the required \ref libusb_transfer fields
    13841626 * for an isochronous transfer.
     
    14101652}
    14111653
    1412 /** \ingroup asyncio
     1654/** \ingroup libusb_asyncio
    14131655 * Convenience function to set the length of all packets in an isochronous
    14141656 * transfer, based on the num_iso_packets field in the transfer structure.
     
    14261668}
    14271669
    1428 /** \ingroup asyncio
     1670/** \ingroup libusb_asyncio
    14291671 * Convenience function to locate the position of an isochronous packet
    14301672 * within the buffer of an isochronous transfer.
     
    14541696        if (packet > INT_MAX)
    14551697                return NULL;
    1456         _packet = packet;
     1698        _packet = (int) packet;
    14571699
    14581700        if (_packet >= transfer->num_iso_packets)
     
    14651707}
    14661708
    1467 /** \ingroup asyncio
     1709/** \ingroup libusb_asyncio
    14681710 * Convenience function to locate the position of an isochronous packet
    14691711 * within the buffer of an isochronous transfer, for transfers where each
     
    14941736        if (packet > INT_MAX)
    14951737                return NULL;
    1496         _packet = packet;
     1738        _packet = (int) packet;
    14971739
    14981740        if (_packet >= transfer->num_iso_packets)
    14991741                return NULL;
    15001742
    1501         return transfer->buffer + (transfer->iso_packet_desc[0].length * _packet);
     1743        return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet);
    15021744}
    15031745
     
    15161758        int *actual_length, unsigned int timeout);
    15171759
    1518 /** \ingroup desc
     1760/** \ingroup libusb_desc
    15191761 * Retrieve a descriptor from the default control pipe.
    15201762 * This is a convenience function which formulates the appropriate control
    15211763 * message to retrieve the descriptor.
    15221764 *
    1523  * \param dev a device handle
     1765 * \param dev_handle a device handle
    15241766 * \param desc_type the descriptor type, see \ref libusb_descriptor_type
    15251767 * \param desc_index the index of the descriptor to retrieve
     
    15281770 * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure
    15291771 */
    1530 static inline int libusb_get_descriptor(libusb_device_handle *dev,
     1772static inline int libusb_get_descriptor(libusb_device_handle *dev_handle,
    15311773        uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
    15321774{
    1533         return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN,
    1534                 LIBUSB_REQUEST_GET_DESCRIPTOR, (desc_type << 8) | desc_index, 0, data,
    1535                 (uint16_t) length, 1000);
     1775        return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
     1776                LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index),
     1777                0, data, (uint16_t) length, 1000);
    15361778}
    15371779
    1538 /** \ingroup desc
     1780/** \ingroup libusb_desc
    15391781 * Retrieve a descriptor from a device.
    15401782 * This is a convenience function which formulates the appropriate control
     
    15421784 * detailed in the USB specifications.
    15431785 *
    1544  * \param dev a device handle
     1786 * \param dev_handle a device handle
    15451787 * \param desc_index the index of the descriptor to retrieve
    15461788 * \param langid the language ID for the string descriptor
     
    15501792 * \see libusb_get_string_descriptor_ascii()
    15511793 */
    1552 static inline int libusb_get_string_descriptor(libusb_device_handle *dev,
     1794static inline int libusb_get_string_descriptor(libusb_device_handle *dev_handle,
    15531795        uint8_t desc_index, uint16_t langid, unsigned char *data, int length)
    15541796{
    1555         return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN,
     1797        return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
    15561798                LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index),
    15571799                langid, data, (uint16_t) length, 1000);
    15581800}
    15591801
    1560 int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev,
     1802int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle,
    15611803        uint8_t desc_index, unsigned char *data, int length);
    15621804
     
    15681810int LIBUSB_CALL libusb_event_handling_ok(libusb_context *ctx);
    15691811int LIBUSB_CALL libusb_event_handler_active(libusb_context *ctx);
     1812void LIBUSB_CALL libusb_interrupt_event_handler(libusb_context *ctx);
    15701813void LIBUSB_CALL libusb_lock_event_waiters(libusb_context *ctx);
    15711814void LIBUSB_CALL libusb_unlock_event_waiters(libusb_context *ctx);
     
    15841827        struct timeval *tv);
    15851828
    1586 /** \ingroup poll
     1829/** \ingroup libusb_poll
    15871830 * File descriptor for polling
    15881831 */
     
    15981841};
    15991842
    1600 /** \ingroup poll
     1843/** \ingroup libusb_poll
    16011844 * Callback function, invoked when a new file descriptor should be added
    16021845 * to the set of file descriptors monitored for events.
     
    16111854        void *user_data);
    16121855
    1613 /** \ingroup poll
     1856/** \ingroup libusb_poll
    16141857 * Callback function, invoked when a file descriptor should be removed from
    16151858 * the set of file descriptors being monitored for events. After returning
     
    16241867const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds(
    16251868        libusb_context *ctx);
     1869void LIBUSB_CALL libusb_free_pollfds(const struct libusb_pollfd **pollfds);
    16261870void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
    16271871        libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
    16281872        void *user_data);
    16291873
    1630 /** \ingroup desc
    1631  * Parse a USB 3.0 endpoint companion descriptor.
    1632  *
    1633  * \param[in] buf the buffer containing the endpoint companion descriptor
    1634  * \param[in] len the length of the buffer
    1635  * \param[out] ep_comp a parsed endpoint companion descriptor. must be freed by
    1636  * libusb_free_ss_endpoint_comp()
    1637  *
    1638  * \returns LIBUSB_SUCCESS on success
    1639  * \returns LIBUSB_ERROR code on error
    1640  */
    1641 int LIBUSB_CALL libusb_parse_ss_endpoint_comp(const void *buf, int len,
    1642                                               struct libusb_ss_endpoint_companion_descriptor **ep_comp);
    1643 
    1644 /** \ingroup desc
    1645  * Free a USB 3.0 endpoint companion descriptor.
    1646  *
    1647  * \param[in] ep_comp the descriptor to free
    1648  */
    1649 void LIBUSB_CALL libusb_free_ss_endpoint_comp(struct libusb_ss_endpoint_companion_descriptor *ep_comp);
    1650 
    1651 /** \ingroup desc
    1652  * Parse a Binary Object Store (BOS) descriptor.
    1653  *
    1654  * \param[in] buf the buffer containing the BOS descriptor
    1655  * \param[in] len the length of the buffer
    1656  * \param[out] bos a parsed BOS descriptor. must be freed by
    1657  * libusb_free_bos_descriptor()
    1658  *
    1659  * \returns LIBUSB_SUCCESS on success
    1660  * \returns LIBUSB_ERROR code on error
    1661  */
    1662 int LIBUSB_CALL libusb_parse_bos_descriptor(const void *buf, int len,
    1663                                             struct libusb_bos_descriptor **bos);
    1664 
    1665 /** \ingroup desc
    1666  * Free a Binary Object Store (BOS) descriptor.
    1667  *
    1668  * \param[in] bos the descriptor to free
    1669  */
    1670 void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
    1671 
    1672 /** \ingroup hotplug
     1874/** \ingroup libusb_hotplug
    16731875 * Callback handle.
    16741876 *
     
    16781880 * on an already deregisted callback.
    16791881 *
    1680  * For more information, see \ref hotplug.
     1882 * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
     1883 *
     1884 * For more information, see \ref libusb_hotplug.
    16811885 */
    16821886typedef int libusb_hotplug_callback_handle;
    16831887
    1684 /** \ingroup hotplug
     1888/** \ingroup libusb_hotplug
     1889 *
     1890 * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
     1891 *
    16851892 * Flags for hotplug events */
    16861893typedef enum {
     1894        /** Default value when not using any flags. */
     1895        LIBUSB_HOTPLUG_NO_FLAGS = 0,
     1896
    16871897        /** Arm the callback and fire it for all matching currently attached devices. */
    1688         LIBUSB_HOTPLUG_ENUMERATE = 1,
     1898        LIBUSB_HOTPLUG_ENUMERATE = 1<<0,
    16891899} libusb_hotplug_flag;
    16901900
    1691 /** \ingroup hotplug
     1901/** \ingroup libusb_hotplug
     1902 *
     1903 * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
     1904 *
    16921905 * Hotplug events */
    16931906typedef enum {
     
    17011914} libusb_hotplug_event;
    17021915
    1703 /** \ingroup hotplug
     1916/** \ingroup libusb_hotplug
    17041917 * Wildcard matching for hotplug events */
    17051918#define LIBUSB_HOTPLUG_MATCH_ANY -1
    17061919
    1707 /** \ingroup hotplug
     1920/** \ingroup libusb_hotplug
    17081921 * Hotplug callback function type. When requesting hotplug event notifications,
    17091922 * you pass a pointer to a callback function of this type.
     
    17131926 *
    17141927 * libusb will call this function later, when a matching event had happened on
    1715  * a matching device. See \ref hotplug for more information.
     1928 * a matching device. See \ref libusb_hotplug for more information.
    17161929 *
    17171930 * It is safe to call either libusb_hotplug_register_callback() or
    17181931 * libusb_hotplug_deregister_callback() from within a callback function.
    17191932 *
    1720  * \param libusb_context context of this notification
     1933 * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
     1934 *
     1935 * \param ctx            context of this notification
    17211936 * \param device         libusb_device this event occurred on
    17221937 * \param event          event that occurred
     
    17261941 */
    17271942typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
    1728                                                       libusb_device *device,
    1729                                                       libusb_hotplug_event event,
    1730                                                       void *user_data);
    1731 
    1732 /** \ingroup hotplug
     1943                                                libusb_device *device,
     1944                                                libusb_hotplug_event event,
     1945                                                void *user_data);
     1946
     1947/** \ingroup libusb_hotplug
    17331948 * Register a hotplug callback function
    17341949 *
     
    17371952 * armed until either it is deregistered with libusb_hotplug_deregister_callback()
    17381953 * or the supplied callback returns 1 to indicate it is finished processing events.
     1954 *
     1955 * If the \ref LIBUSB_HOTPLUG_ENUMERATE is passed the callback will be
     1956 * called with a \ref LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED for all devices
     1957 * already plugged into the machine. Note that libusb modifies its internal
     1958 * device list from a separate thread, while calling hotplug callbacks from
     1959 * libusb_handle_events(), so it is possible for a device to already be present
     1960 * on, or removed from, its internal device list, while the hotplug callbacks
     1961 * still need to be dispatched. This means that when using \ref
     1962 * LIBUSB_HOTPLUG_ENUMERATE, your callback may be called twice for the arrival
     1963 * of the same device, once from libusb_hotplug_register_callback() and once
     1964 * from libusb_handle_events(); and/or your callback may be called for the
     1965 * removal of a device for which an arrived call was never made.
     1966 *
     1967 * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
    17391968 *
    17401969 * \param[in] ctx context to register this callback with
     
    17471976 * \param[in] cb_fn the function to be invoked on a matching event/device
    17481977 * \param[in] user_data user data to pass to the callback function
    1749  * \param[out] handle pointer to store the handle of the allocated callback (can be NULL)
     1978 * \param[out] callback_handle pointer to store the handle of the allocated callback (can be NULL)
    17501979 * \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure
    17511980 */
    17521981int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
    1753                                                  libusb_hotplug_event events,
    1754                                                  libusb_hotplug_flag flags,
    1755                                                  int vendor_id, int product_id,
    1756                                                  int dev_class,
    1757                                                  libusb_hotplug_callback_fn cb_fn,
    1758                                                  void *user_data,
    1759                                                  libusb_hotplug_callback_handle *handle);
    1760 
    1761 /** \ingroup hotplug
     1982                                                libusb_hotplug_event events,
     1983                                                libusb_hotplug_flag flags,
     1984                                                int vendor_id, int product_id,
     1985                                                int dev_class,
     1986                                                libusb_hotplug_callback_fn cb_fn,
     1987                                                void *user_data,
     1988                                                libusb_hotplug_callback_handle *callback_handle);
     1989
     1990/** \ingroup libusb_hotplug
    17621991 * Deregisters a hotplug callback.
    17631992 *
     
    17651994 * a hotplug callback.
    17661995 *
     1996 * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
     1997 *
    17671998 * \param[in] ctx context this callback is registered with
    1768  * \param[in] handle the handle of the callback to deregister
     1999 * \param[in] callback_handle the handle of the callback to deregister
    17692000 */
    17702001void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
    1771                                                     libusb_hotplug_callback_handle handle);
     2002                                                libusb_hotplug_callback_handle callback_handle);
    17722003
    17732004#ifdef __cplusplus
  • TabularUnified libusb1/trunk/libusb/libusbi.h

    r1879 r1882  
    11/*
    22 * Internal header for libusb
    3  * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
    4  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
     3 * Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
     4 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2424#include <config.h>
    2525
     26#include <stdlib.h>
     27
    2628#include <stddef.h>
    2729#include <stdint.h>
    2830#include <time.h>
    29 #include <sys/time.h>
    3031#include <stdarg.h>
    3132#ifdef HAVE_POLL_H
    3233#include <poll.h>
    3334#endif
    34 
    35 #include <libusb.h>
    36 #include <version.h>
     35#ifdef HAVE_MISSING_H
     36#include <missing.h>
     37#endif
     38
     39#include "libusb.h"
     40#include "version.h"
    3741
    3842/* Inside the libusb code, mark all public functions as follows:
     
    4549#define API_EXPORTED LIBUSB_CALL DEFAULT_VISIBILITY
    4650
    47 #define DEVICE_DESC_LENGTH              18
     51#ifdef __cplusplus
     52extern "C" {
     53#endif
     54
     55#define DEVICE_DESC_LENGTH      18
    4856
    4957#define USB_MAXENDPOINTS        32
     
    5159#define USB_MAXCONFIG           8
    5260
     61/* Backend specific capabilities */
     62#define USBI_CAP_HAS_HID_ACCESS                 0x00010000
     63#define USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER  0x00020000
     64
     65/* Maximum number of bytes in a log line */
     66#define USBI_MAX_LOG_LEN        1024
     67/* Terminator for log lines */
     68#define USBI_LOG_LINE_END       "\n"
     69
     70/* The following is used to silence warnings for unused variables */
     71#define UNUSED(var)             do { (void)(var); } while(0)
     72
     73#if !defined(ARRAYSIZE)
     74#define ARRAYSIZE(array) (sizeof(array) / sizeof(array[0]))
     75#endif
     76
    5377struct list_head {
    5478        struct list_head *prev, *next;
     
    5680
    5781/* Get an entry from the list
    58  *      ptr - the address of this list_head element in "type"
    59  *      type - the data type that contains "member"
    60  *      member - the list_head element in "type"
     82 *  ptr - the address of this list_head element in "type"
     83 *  type - the data type that contains "member"
     84 *  member - the list_head element in "type"
    6185 */
    6286#define list_entry(ptr, type, member) \
    63         ((type *)((uintptr_t)(ptr) - (uintptr_t)(&((type *)0L)->member)))
     87        ((type *)((uintptr_t)(ptr) - (uintptr_t)offsetof(type, member)))
     88
     89#define list_first_entry(ptr, type, member) \
     90        list_entry((ptr)->next, type, member)
    6491
    6592/* Get each entry from a list
    66  *      pos - A structure pointer has a "member" element
    67  *      head - list head
    68  *      member - the list_head element in "pos"
    69  *      type - the type of the first parameter
     93 *  pos - A structure pointer has a "member" element
     94 *  head - list head
     95 *  member - the list_head element in "pos"
     96 *  type - the type of the first parameter
    7097 */
    7198#define list_for_each_entry(pos, head, member, type)                    \
    7299        for (pos = list_entry((head)->next, type, member);              \
    73              &pos->member != (head);                                    \
    74             pos = list_entry(pos->member.next, type, member))
     100                 &pos->member != (head);                                \
     101                pos = list_entry(pos->member.next, type, member))
    75102
    76103#define list_for_each_entry_safe(pos, n, head, member, type)            \
    77104        for (pos = list_entry((head)->next, type, member),              \
    78                n = list_entry(pos->member.next, type, member);          \
    79              &pos->member != (head);                                    \
    80             pos = n, n = list_entry(n->member.next, type, member))
     105                 n = list_entry(pos->member.next, type, member);        \
     106                 &pos->member != (head);                                \
     107                pos = n, n = list_entry(n->member.next, type, member))
    81108
    82109#define list_empty(entry) ((entry)->next == (entry))
     
    110137        entry->next->prev = entry->prev;
    111138        entry->prev->next = entry->next;
     139        entry->next = entry->prev = NULL;
    112140}
    113141
    114 #define container_of(ptr, type, member) ({                      \
    115         const typeof( ((type *)0)->member ) *mptr = (ptr);    \
    116         (type *)( (char *)mptr - offsetof(type,member) );})
    117 
     142static inline void *usbi_reallocf(void *ptr, size_t size)
     143{
     144        void *ret = realloc(ptr, size);
     145        if (!ret)
     146                free(ptr);
     147        return ret;
     148}
     149
     150#define container_of(ptr, type, member) ({                      \
     151        const typeof( ((type *)0)->member ) *mptr = (ptr);      \
     152        (type *)( (char *)mptr - offsetof(type,member) );})
     153
     154#ifndef MIN
    118155#define MIN(a, b)       ((a) < (b) ? (a) : (b))
     156#endif
     157#ifndef MAX
    119158#define MAX(a, b)       ((a) > (b) ? (a) : (b))
     159#endif
    120160
    121161#define TIMESPEC_IS_SET(ts) ((ts)->tv_sec != 0 || (ts)->tv_nsec != 0)
    122162
    123 enum usbi_log_level {
    124         LOG_LEVEL_DEBUG,
    125         LOG_LEVEL_INFO,
    126         LOG_LEVEL_WARNING,
    127         LOG_LEVEL_ERROR,
    128 };
    129 
    130 void usbi_log(struct libusb_context *ctx, enum usbi_log_level level,
     163#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
     164#define TIMEVAL_TV_SEC_TYPE     long
     165#else
     166#define TIMEVAL_TV_SEC_TYPE     time_t
     167#endif
     168
     169/* Some platforms don't have this define */
     170#ifndef TIMESPEC_TO_TIMEVAL
     171#define TIMESPEC_TO_TIMEVAL(tv, ts)                                     \
     172        do {                                                            \
     173                (tv)->tv_sec = (TIMEVAL_TV_SEC_TYPE) (ts)->tv_sec;      \
     174                (tv)->tv_usec = (ts)->tv_nsec / 1000;                   \
     175        } while (0)
     176#endif
     177
     178void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
    131179        const char *function, const char *format, ...);
    132180
    133 void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level,
     181void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
    134182        const char *function, const char *format, va_list args);
    135183
     
    138186#ifdef ENABLE_LOGGING
    139187#define _usbi_log(ctx, level, ...) usbi_log(ctx, level, __FUNCTION__, __VA_ARGS__)
     188#define usbi_dbg(...) _usbi_log(NULL, LIBUSB_LOG_LEVEL_DEBUG, __VA_ARGS__)
    140189#else
    141190#define _usbi_log(ctx, level, ...) do { (void)(ctx); } while(0)
    142 #endif
    143 
    144 #ifdef ENABLE_DEBUG_LOGGING
    145 #define usbi_dbg(...) _usbi_log(NULL, LOG_LEVEL_DEBUG, __VA_ARGS__)
     191#define usbi_dbg(...) do {} while(0)
     192#endif
     193
     194#define usbi_info(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_INFO, __VA_ARGS__)
     195#define usbi_warn(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_WARNING, __VA_ARGS__)
     196#define usbi_err(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_ERROR, __VA_ARGS__)
     197
     198#else /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
     199
     200#ifdef ENABLE_LOGGING
     201#define LOG_BODY(ctxt, level)                           \
     202{                                                       \
     203        va_list args;                                   \
     204        va_start(args, format);                         \
     205        usbi_log_v(ctxt, level, "", format, args);      \
     206        va_end(args);                                   \
     207}
    146208#else
    147 #define usbi_dbg(...) do {} while(0)
    148 #endif
    149 
    150 #define usbi_info(ctx, ...) _usbi_log(ctx, LOG_LEVEL_INFO, __VA_ARGS__)
    151 #define usbi_warn(ctx, ...) _usbi_log(ctx, LOG_LEVEL_WARNING, __VA_ARGS__)
    152 #define usbi_err(ctx, ...) _usbi_log(ctx, LOG_LEVEL_ERROR, __VA_ARGS__)
    153 
    154 #else /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
    155 
    156 /* Old MS compilers don't support variadic macros. The code is simple, so we
    157  * repeat it for each loglevel. Note that the debug case is special.
    158  *
    159  * Support for variadic macros was introduced in Visual C++ 2005.
    160  * http://msdn.microsoft.com/en-us/library/ms177415%28v=VS.80%29.aspx
    161  */
    162 
    163 static inline void usbi_info(struct libusb_context *ctx, const char *fmt, ...)
    164 {
    165 #ifdef ENABLE_LOGGING
    166         va_list args;
    167         va_start(args, fmt);
    168         usbi_log_v(ctx, LOG_LEVEL_INFO, "", fmt, args);
    169         va_end(args);
    170 #else
    171         (void)ctx;
    172 #endif
     209#define LOG_BODY(ctxt, level)                           \
     210{                                                       \
     211        (void)(ctxt);                                   \
    173212}
    174 
    175 static inline void usbi_warn(struct libusb_context *ctx, const char *fmt, ...)
    176 {
    177 #ifdef ENABLE_LOGGING
    178         va_list args;
    179         va_start(args, fmt);
    180         usbi_log_v(ctx, LOG_LEVEL_WARNING, "", fmt, args);
    181         va_end(args);
    182 #else
    183         (void)ctx;
    184 #endif
    185 }
    186 
    187 static inline void usbi_err(struct libusb_context *ctx, const char *fmt, ...)
    188 {
    189 #ifdef ENABLE_LOGGING
    190         va_list args;
    191         va_start(args, fmt);
    192         usbi_log_v(ctx, LOG_LEVEL_ERROR, "", fmt, args);
    193         va_end(args);
    194 #else
    195         (void)ctx;
    196 #endif
    197 }
    198 
    199 static inline void usbi_dbg(const char *fmt, ...)
    200 {
    201 #ifdef ENABLE_DEBUG_LOGGING
    202         va_list args;
    203         va_start(args, fmt);
    204         usbi_log_v(NULL, LOG_LEVEL_DEBUG, "", fmt, args);
    205         va_end(args);
    206 #else
    207         (void)fmt;
    208 #endif
    209 }
     213#endif
     214
     215static inline void usbi_info(struct libusb_context *ctx, const char *format, ...)
     216        LOG_BODY(ctx, LIBUSB_LOG_LEVEL_INFO)
     217static inline void usbi_warn(struct libusb_context *ctx, const char *format, ...)
     218        LOG_BODY(ctx, LIBUSB_LOG_LEVEL_WARNING)
     219static inline void usbi_err(struct libusb_context *ctx, const char *format, ...)
     220        LOG_BODY(ctx, LIBUSB_LOG_LEVEL_ERROR)
     221
     222static inline void usbi_dbg(const char *format, ...)
     223        LOG_BODY(NULL, LIBUSB_LOG_LEVEL_DEBUG)
    210224
    211225#endif /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
    212226
    213 #define USBI_GET_CONTEXT(ctx) if (!(ctx)) (ctx) = usbi_default_context
    214 #define DEVICE_CTX(dev) ((dev)->ctx)
    215 #define HANDLE_CTX(handle) (DEVICE_CTX((handle)->dev))
    216 #define TRANSFER_CTX(transfer) (HANDLE_CTX((transfer)->dev_handle))
     227#define USBI_GET_CONTEXT(ctx)                           \
     228        do {                                            \
     229                if (!(ctx))                             \
     230                        (ctx) = usbi_default_context;   \
     231        } while(0)
     232
     233#define DEVICE_CTX(dev)         ((dev)->ctx)
     234#define HANDLE_CTX(handle)      (DEVICE_CTX((handle)->dev))
     235#define TRANSFER_CTX(transfer)  (HANDLE_CTX((transfer)->dev_handle))
    217236#define ITRANSFER_CTX(transfer) \
    218237        (TRANSFER_CTX(USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)))
    219238
    220 #define IS_EPIN(ep) (0 != ((ep) & LIBUSB_ENDPOINT_IN))
    221 #define IS_EPOUT(ep) (!IS_EPIN(ep))
    222 #define IS_XFERIN(xfer) (0 != ((xfer)->endpoint & LIBUSB_ENDPOINT_IN))
    223 #define IS_XFEROUT(xfer) (!IS_XFERIN(xfer))
    224 
    225 /* Internal abstractions for thread synchronization and poll */
     239#define IS_EPIN(ep)             (0 != ((ep) & LIBUSB_ENDPOINT_IN))
     240#define IS_EPOUT(ep)            (!IS_EPIN(ep))
     241#define IS_XFERIN(xfer)         (0 != ((xfer)->endpoint & LIBUSB_ENDPOINT_IN))
     242#define IS_XFEROUT(xfer)        (!IS_XFERIN(xfer))
     243
     244/* Internal abstraction for thread synchronization */
    226245#if defined(THREADS_POSIX)
    227 #include <os/threads_posix.h>
    228 #elif defined(OS_WINDOWS)
    229 #include <os/threads_windows.h>
    230 #endif
    231 
    232 #if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD)
    233 #include <unistd.h>
    234 #include <os/poll_posix.h>
    235 #elif defined(OS_WINDOWS)
    236 #include <os/poll_windows.h>
    237 #elif defined(OS_OS2)
    238 #include <os/poll_os2.h>
    239 #endif
    240 
    241 #if defined(OS_WINDOWS) && !defined(__GCC__)
    242 #undef HAVE_GETTIMEOFDAY
    243 int usbi_gettimeofday(struct timeval *tp, void *tzp);
    244 #define LIBUSB_GETTIMEOFDAY_WIN32
    245 #define HAVE_USBI_GETTIMEOFDAY
    246 #else
    247 #ifdef HAVE_GETTIMEOFDAY
    248 #define usbi_gettimeofday(tv, tz) gettimeofday((tv), (tz))
    249 #define HAVE_USBI_GETTIMEOFDAY
    250 #endif
     246#include "os/threads_posix.h"
     247#elif defined(OS_WINDOWS) || defined(OS_WINCE)
     248#include "os/threads_windows.h"
    251249#endif
    252250
    253251extern struct libusb_context *usbi_default_context;
     252
     253/* Forward declaration for use in context (fully defined inside poll abstraction) */
     254struct pollfd;
    254255
    255256struct libusb_context {
     
    257258        int debug_fixed;
    258259
    259         /* internal control pipe, used for interrupting event handling when
    260          * something needs to modify poll fds. */
    261         int ctrl_pipe[2];
     260        /* internal event pipe, used for signalling occurrence of an internal event. */
     261        int event_pipe[2];
    262262
    263263        struct list_head usb_devs;
     
    272272        struct list_head hotplug_cbs;
    273273        usbi_mutex_t hotplug_cbs_lock;
    274         int hotplug_pipe[2];
    275274
    276275        /* this is a list of in-flight transfer handles, sorted by timeout
     
    279278         * infinite timeout are always placed at the very end. */
    280279        struct list_head flying_transfers;
     280        /* Note paths taking both this and usbi_transfer->lock must always
     281         * take this lock first */
    281282        usbi_mutex_t flying_transfers_lock;
    282 
    283         /* list of poll fds */
    284         struct list_head pollfds;
    285         usbi_mutex_t pollfds_lock;
    286 
    287         /* a counter that is set when we want to interrupt event handling, in order
    288          * to modify the poll fd set. and a lock to protect it. */
    289         unsigned int pollfd_modify;
    290         usbi_mutex_t pollfd_modify_lock;
    291283
    292284        /* user callbacks for pollfd changes */
     
    301293        int event_handler_active;
    302294
     295        /* A thread-local storage key to track which thread is performing event
     296         * handling */
     297        usbi_tls_key_t event_handling_key;
     298
    303299        /* used to wait for event completion in threads other than the one that is
    304300         * event handling */
     
    306302        usbi_cond_t event_waiters_cond;
    307303
     304        /* A lock to protect internal context event data. */
     305        usbi_mutex_t event_data_lock;
     306
     307        /* A bitmask of flags that are set to indicate specific events that need to
     308         * be handled. Protected by event_data_lock. */
     309        unsigned int event_flags;
     310
     311        /* A counter that is set when we want to interrupt and prevent event handling,
     312         * in order to safely close a device. Protected by event_data_lock. */
     313        unsigned int device_close;
     314
     315        /* list and count of poll fds and an array of poll fd structures that is
     316         * (re)allocated as necessary prior to polling. Protected by event_data_lock. */
     317        struct list_head ipollfds;
     318        struct pollfd *pollfds;
     319        POLL_NFDS_TYPE pollfds_cnt;
     320
     321        /* A list of pending hotplug messages. Protected by event_data_lock. */
     322        struct list_head hotplug_msgs;
     323
     324        /* A list of pending completed transfers. Protected by event_data_lock. */
     325        struct list_head completed_transfers;
     326
    308327#ifdef USBI_TIMERFD_AVAILABLE
    309328        /* used for timeout handling, if supported by OS.
     
    312331#endif
    313332
    314         struct list_head list;
    315 };
     333        struct list_head list;
     334};
     335
     336enum usbi_event_flags {
     337        /* The list of pollfds has been modified */
     338        USBI_EVENT_POLLFDS_MODIFIED = 1 << 0,
     339
     340        /* The user has interrupted the event handler */
     341        USBI_EVENT_USER_INTERRUPT = 1 << 1,
     342};
     343
     344/* Macros for managing event handling state */
     345#define usbi_handling_events(ctx) \
     346        (usbi_tls_key_get((ctx)->event_handling_key) != NULL)
     347
     348#define usbi_start_event_handling(ctx) \
     349        usbi_tls_key_set((ctx)->event_handling_key, ctx)
     350
     351#define usbi_end_event_handling(ctx) \
     352        usbi_tls_key_set((ctx)->event_handling_key, NULL)
     353
     354/* Update the following macro if new event sources are added */
     355#define usbi_pending_events(ctx) \
     356        ((ctx)->event_flags || (ctx)->device_close \
     357         || !list_empty(&(ctx)->hotplug_msgs) || !list_empty(&(ctx)->completed_transfers))
    316358
    317359#ifdef USBI_TIMERFD_AVAILABLE
     
    330372
    331373        uint8_t bus_number;
     374        uint8_t port_number;
     375        struct libusb_device* parent_dev;
    332376        uint8_t device_address;
    333377        uint8_t num_configurations;
     
    340384        int attached;
    341385
    342         unsigned char os_priv[0];
     386        unsigned char os_priv
     387#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
     388        [] /* valid C99 code */
     389#else
     390        [0] /* non-standard, but usually working code */
     391#endif
     392#if defined(OS_SUNOS)
     393        __attribute__ ((aligned (8)));
     394#else
     395        ;
     396#endif
    343397};
    344398
     
    350404        struct list_head list;
    351405        struct libusb_device *dev;
    352         unsigned char os_priv[0];
     406        int auto_detach_kernel_driver;
     407        unsigned char os_priv
     408#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
     409        [] /* valid C99 code */
     410#else
     411        [0] /* non-standard, but usually working code */
     412#endif
     413#if defined(OS_SUNOS)
     414        __attribute__ ((aligned (8)));
     415#else
     416        ;
     417#endif
    353418};
    354419
    355420enum {
    356   USBI_CLOCK_MONOTONIC,
    357   USBI_CLOCK_REALTIME
     421        USBI_CLOCK_MONOTONIC,
     422        USBI_CLOCK_REALTIME
    358423};
    359424
     
    374439        int num_iso_packets;
    375440        struct list_head list;
     441        struct list_head completed_list;
    376442        struct timeval timeout;
    377443        int transferred;
    378         uint8_t flags;
     444        uint32_t stream_id;
     445        uint8_t state_flags;   /* Protected by usbi_transfer->lock */
     446        uint8_t timeout_flags; /* Protected by the flying_stransfers_lock */
    379447
    380448        /* this lock is held during libusb_submit_transfer() and
     
    384452         * cancelling the transfer from another thread while you are processing
    385453         * its completion (presumably there would be races within your OS backend
    386          * if this were possible). */
     454         * if this were possible).
     455         * Note paths taking both this and the flying_transfers_lock must
     456         * always take the flying_transfers_lock first */
    387457        usbi_mutex_t lock;
    388458};
    389459
    390 enum usbi_transfer_flags {
    391         /* The transfer has timed out */
    392         USBI_TRANSFER_TIMED_OUT = 1 << 0,
    393 
     460enum usbi_transfer_state_flags {
     461        /* Transfer successfully submitted by backend */
     462        USBI_TRANSFER_IN_FLIGHT = 1 << 0,
     463
     464        /* Cancellation was requested via libusb_cancel_transfer() */
     465        USBI_TRANSFER_CANCELLING = 1 << 1,
     466
     467        /* Operation on the transfer failed because the device disappeared */
     468        USBI_TRANSFER_DEVICE_DISAPPEARED = 1 << 2,
     469};
     470
     471enum usbi_transfer_timeout_flags {
    394472        /* Set by backend submit_transfer() if the OS handles timeout */
    395         USBI_TRANSFER_OS_HANDLES_TIMEOUT = 1 << 1,
    396 
    397         /* Cancellation was requested via libusb_cancel_transfer() */
    398         USBI_TRANSFER_CANCELLING = 1 << 2,
    399 
    400         /* Operation on the transfer failed because the device disappeared */
    401         USBI_TRANSFER_DEVICE_DISAPPEARED = 1 << 3,
    402 
    403         /* Set by backend submit_transfer() if the fds in use were updated */
    404         USBI_TRANSFER_UPDATED_FDS = 1 << 4,
    405 };
    406 
    407 #define USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer) \
    408         ((struct libusb_transfer *)(((unsigned char *)(transfer)) \
     473        USBI_TRANSFER_OS_HANDLES_TIMEOUT = 1 << 0,
     474
     475        /* The transfer timeout has been handled */
     476        USBI_TRANSFER_TIMEOUT_HANDLED = 1 << 1,
     477
     478        /* The transfer timeout was successfully processed */
     479        USBI_TRANSFER_TIMED_OUT = 1 << 2,
     480};
     481
     482#define USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)                      \
     483        ((struct libusb_transfer *)(((unsigned char *)(transfer))       \
    409484                + sizeof(struct usbi_transfer)))
    410 #define LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer) \
    411         ((struct usbi_transfer *)(((unsigned char *)(transfer)) \
     485#define LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer)                      \
     486        ((struct usbi_transfer *)(((unsigned char *)(transfer))         \
    412487                - sizeof(struct usbi_transfer)))
    413488
     
    424499/* All standard descriptors have these 2 fields in common */
    425500struct usb_descriptor_header {
    426         uint8_t  bLength;
    427         uint8_t  bDescriptorType;
     501        uint8_t bLength;
     502        uint8_t bDescriptorType;
    428503};
    429504
     
    438513        unsigned long session_id);
    439514int usbi_sanitize_device(struct libusb_device *dev);
    440 void usbi_handle_disconnect(struct libusb_device_handle *handle);
     515void usbi_handle_disconnect(struct libusb_device_handle *dev_handle);
    441516
    442517int usbi_handle_transfer_completion(struct usbi_transfer *itransfer,
    443518        enum libusb_transfer_status status);
    444519int usbi_handle_transfer_cancellation(struct usbi_transfer *transfer);
     520void usbi_signal_transfer_completion(struct usbi_transfer *transfer);
    445521
    446522int usbi_parse_descriptor(const unsigned char *source, const char *descriptor,
     
    453529void usbi_disconnect_device (struct libusb_device *dev);
    454530
    455 /* polling */
     531int usbi_signal_event(struct libusb_context *ctx);
     532int usbi_clear_event(struct libusb_context *ctx);
     533
     534/* Internal abstraction for poll (needs struct usbi_transfer on Windows) */
     535#if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD) || defined(OS_NETBSD) ||\
     536        defined(OS_HAIKU) || defined(OS_SUNOS)
     537#include <unistd.h>
     538#include "os/poll_posix.h"
     539#elif defined(OS_WINDOWS) || defined(OS_WINCE)
     540#include "os/poll_windows.h"
     541#endif
     542
     543#if (defined(OS_WINDOWS) || defined(OS_WINCE)) && !defined(__GNUC__)
     544#define snprintf _snprintf
     545#define vsnprintf _vsnprintf
     546int usbi_gettimeofday(struct timeval *tp, void *tzp);
     547#define LIBUSB_GETTIMEOFDAY_WIN32
     548#define HAVE_USBI_GETTIMEOFDAY
     549#else
     550#ifdef HAVE_GETTIMEOFDAY
     551#define usbi_gettimeofday(tv, tz) gettimeofday((tv), (tz))
     552#define HAVE_USBI_GETTIMEOFDAY
     553#endif
     554#endif
    456555
    457556struct usbi_pollfd {
     
    464563int usbi_add_pollfd(struct libusb_context *ctx, int fd, short events);
    465564void usbi_remove_pollfd(struct libusb_context *ctx, int fd);
    466 void usbi_fd_notification(struct libusb_context *ctx);
    467565
    468566/* device discovery */
     
    476574        size_t len;
    477575        size_t capacity;
    478         struct libusb_device *devices[0];
     576        struct libusb_device *devices
     577#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
     578        [] /* valid C99 code */
     579#else
     580        [0] /* non-standard, but usually working code */
     581#endif
     582        ;
    479583};
    480584
     
    489593        /* A human-readable name for your backend, e.g. "Linux usbfs" */
    490594        const char *name;
     595
     596        /* Binary mask for backend specific capabilities */
     597        uint32_t caps;
    491598
    492599        /* Perform initialization of your backend. You might use this function
     
    525632         * After computing a session ID for a device, call
    526633         * usbi_get_device_by_session_id(). This function checks if libusb already
    527          * knows about the device, and if so, it provides you with a libusb_device
    528          * structure for it.
     634         * knows about the device, and if so, it provides you with a reference
     635         * to a libusb_device structure for it.
    529636         *
    530637         * If usbi_get_device_by_session_id() returns NULL, it is time to allocate
     
    555662         * of USB devices connected to the system.
    556663         *
     664         * If the backend has hotplug support, this function is not used!
     665         *
    557666         * Return 0 on success, or a LIBUSB_ERROR code on failure.
    558667         */
    559668        int (*get_device_list)(struct libusb_context *ctx,
    560669                struct discovered_devs **discdevs);
     670
     671        /* Apps which were written before hotplug support, may listen for
     672         * hotplug events on their own and call libusb_get_device_list on
     673         * device addition. In this case libusb_get_device_list will likely
     674         * return a list without the new device in there, as the hotplug
     675         * event thread will still be busy enumerating the device, which may
     676         * take a while, or may not even have seen the event yet.
     677         *
     678         * To avoid this libusb_get_device_list will call this optional
     679         * function for backends with hotplug support before copying
     680         * ctx->usb_devs to the user. In this function the backend should
     681         * ensure any pending hotplug events are fully processed before
     682         * returning.
     683         *
     684         * Optional, should be implemented by backends with hotplug support.
     685         */
     686        void (*hotplug_poll)(void);
    561687
    562688        /* Open a device for I/O and other USB operations. The device handle
     
    585711         * do this for you.
    586712         */
    587         int (*open)(struct libusb_device_handle *handle);
     713        int (*open)(struct libusb_device_handle *dev_handle);
    588714
    589715        /* Close a device such that the handle cannot be used again. Your backend
     
    595721         * This function is called when the user closes a device handle.
    596722         */
    597         void (*close)(struct libusb_device_handle *handle);
     723        void (*close)(struct libusb_device_handle *dev_handle);
    598724
    599725        /* Retrieve the device descriptor from a device.
     
    663789         * set the host_endian output parameter to "1".
    664790         *
    665          * Return 0 on success or a LIBUSB_ERROR code on failure.
     791         * Return the length read on success or a LIBUSB_ERROR code on failure.
    666792         */
    667793        int (*get_config_descriptor)(struct libusb_device *device,
    668794                uint8_t config_index, unsigned char *buffer, size_t len,
     795                int *host_endian);
     796
     797        /* Like get_config_descriptor but then by bConfigurationValue instead
     798         * of by index.
     799         *
     800         * Optional, if not present the core will call get_config_descriptor
     801         * for all configs until it finds the desired bConfigurationValue.
     802         *
     803         * Returns a pointer to the raw-descriptor in *buffer, this memory
     804         * is valid as long as device is valid.
     805         *
     806         * Returns the length of the returned raw-descriptor on success,
     807         * or a LIBUSB_ERROR code on failure.
     808         */
     809        int (*get_config_descriptor_by_value)(struct libusb_device *device,
     810                uint8_t bConfigurationValue, unsigned char **buffer,
    669811                int *host_endian);
    670812
     
    686828         * - another LIBUSB_ERROR code on other failure.
    687829         */
    688         int (*get_configuration)(struct libusb_device_handle *handle, int *config);
     830        int (*get_configuration)(struct libusb_device_handle *dev_handle, int *config);
    689831
    690832        /* Set the active configuration for a device.
     
    703845         * - another LIBUSB_ERROR code on other failure.
    704846         */
    705         int (*set_configuration)(struct libusb_device_handle *handle, int config);
     847        int (*set_configuration)(struct libusb_device_handle *dev_handle, int config);
    706848
    707849        /* Claim an interface. When claimed, the application can then perform
     
    711853         * Interface claiming is a logical operation that simply ensures that
    712854         * no other drivers/applications are using the interface, and after
    713          * claiming, no other drivers/applicatiosn can use the interface because
     855         * claiming, no other drivers/applications can use the interface because
    714856         * we now "own" it.
    715857         *
     
    722864         * - another LIBUSB_ERROR code on other failure
    723865         */
    724         int (*claim_interface)(struct libusb_device_handle *handle, int interface_number);
     866        int (*claim_interface)(struct libusb_device_handle *dev_handle, int interface_number);
    725867
    726868        /* Release a previously claimed interface.
     
    739881         * - another LIBUSB_ERROR code on other failure
    740882         */
    741         int (*release_interface)(struct libusb_device_handle *handle, int interface_number);
     883        int (*release_interface)(struct libusb_device_handle *dev_handle, int interface_number);
    742884
    743885        /* Set the alternate setting for an interface.
     
    755897         * - another LIBUSB_ERROR code on other failure
    756898         */
    757         int (*set_interface_altsetting)(struct libusb_device_handle *handle,
     899        int (*set_interface_altsetting)(struct libusb_device_handle *dev_handle,
    758900                int interface_number, int altsetting);
    759901
     
    769911         * - another LIBUSB_ERROR code on other failure
    770912         */
    771         int (*clear_halt)(struct libusb_device_handle *handle,
     913        int (*clear_halt)(struct libusb_device_handle *dev_handle,
    772914                unsigned char endpoint);
    773915
    774916        /* Perform a USB port reset to reinitialize a device.
    775917         *
    776          * If possible, the handle should still be usable after the reset
     918         * If possible, the device handle should still be usable after the reset
    777919         * completes, assuming that the device descriptors did not change during
    778920         * reset and all previous interface state can be restored.
     
    788930         * - another LIBUSB_ERROR code on other failure
    789931         */
    790         int (*reset_device)(struct libusb_device_handle *handle);
     932        int (*reset_device)(struct libusb_device_handle *dev_handle);
     933
     934        /* Alloc num_streams usb3 bulk streams on the passed in endpoints */
     935        int (*alloc_streams)(struct libusb_device_handle *dev_handle,
     936                uint32_t num_streams, unsigned char *endpoints, int num_endpoints);
     937
     938        /* Free usb3 bulk streams allocated with alloc_streams */
     939        int (*free_streams)(struct libusb_device_handle *dev_handle,
     940                unsigned char *endpoints, int num_endpoints);
     941
     942        /* Allocate persistent DMA memory for the given device, suitable for
     943         * zerocopy. May return NULL on failure. Optional to implement.
     944         */
     945        unsigned char *(*dev_mem_alloc)(struct libusb_device_handle *handle,
     946                size_t len);
     947
     948        /* Free memory allocated by dev_mem_alloc. */
     949        int (*dev_mem_free)(struct libusb_device_handle *handle,
     950                unsigned char *buffer, size_t len);
    791951
    792952        /* Determine if a kernel driver is active on an interface. Optional.
     
    802962         * - another LIBUSB_ERROR code on other failure
    803963         */
    804         int (*kernel_driver_active)(struct libusb_device_handle *handle,
     964        int (*kernel_driver_active)(struct libusb_device_handle *dev_handle,
    805965                int interface_number);
    806966
     
    818978         * - another LIBUSB_ERROR code on other failure
    819979         */
    820         int (*detach_kernel_driver)(struct libusb_device_handle *handle,
     980        int (*detach_kernel_driver)(struct libusb_device_handle *dev_handle,
    821981                int interface_number);
    822982
     
    835995         * - another LIBUSB_ERROR code on other failure
    836996         */
    837         int (*attach_kernel_driver)(struct libusb_device_handle *handle,
     997        int (*attach_kernel_driver)(struct libusb_device_handle *dev_handle,
    838998                int interface_number);
    839999
     
    8511011         *
    8521012         * This function must not block.
     1013         *
     1014         * This function gets called with the flying_transfers_lock locked!
    8531015         *
    8541016         * Return:
     
    8791041        void (*clear_transfer_priv)(struct usbi_transfer *itransfer);
    8801042
    881         /* Handle any pending events. This involves monitoring any active
    882          * transfers and processing their completion or cancellation.
     1043        /* Handle any pending events on file descriptors. Optional.
     1044         *
     1045         * Provide this function when file descriptors directly indicate device
     1046         * or transfer activity. If your backend does not have such file descriptors,
     1047         * implement the handle_transfer_completion function below.
     1048         *
     1049         * This involves monitoring any active transfers and processing their
     1050         * completion or cancellation.
    8831051         *
    8841052         * The function is passed an array of pollfd structures (size nfds)
     
    9081076                struct pollfd *fds, POLL_NFDS_TYPE nfds, int num_ready);
    9091077
     1078        /* Handle transfer completion. Optional.
     1079         *
     1080         * Provide this function when there are no file descriptors available
     1081         * that directly indicate device or transfer activity. If your backend does
     1082         * have such file descriptors, implement the handle_events function above.
     1083         *
     1084         * Your backend must tell the library when a transfer has completed by
     1085         * calling usbi_signal_transfer_completion(). You should store any private
     1086         * information about the transfer and its completion status in the transfer's
     1087         * private backend data.
     1088         *
     1089         * During event handling, this function will be called on each transfer for
     1090         * which usbi_signal_transfer_completion() was called.
     1091         *
     1092         * For any cancelled transfers, call usbi_handle_transfer_cancellation().
     1093         * For completed transfers, call usbi_handle_transfer_completion().
     1094         * For control/bulk/interrupt transfers, populate the "transferred"
     1095         * element of the appropriate usbi_transfer structure before calling the
     1096         * above functions. For isochronous transfers, populate the status and
     1097         * transferred fields of the iso packet descriptors of the transfer.
     1098         *
     1099         * Return 0 on success, or a LIBUSB_ERROR code on failure.
     1100         */
     1101        int (*handle_transfer_completion)(struct usbi_transfer *itransfer);
     1102
    9101103        /* Get time from specified clock. At least two clocks must be implemented
    9111104           by the backend: USBI_CLOCK_REALTIME, and USBI_CLOCK_MONOTONIC.
     
    9381131         */
    9391132        size_t transfer_priv_size;
    940 
    941         /* Mumber of additional bytes for os_priv for each iso packet.
    942          * Can your backend use this? */
    943         /* FIXME: linux can't use this any more. if other OS's cannot either,
    944          * then remove this */
    945         size_t add_iso_packet_size;
    9461133};
    9471134
     
    9521139extern const struct usbi_os_backend openbsd_backend;
    9531140extern const struct usbi_os_backend os2_backend;
     1141extern const struct usbi_os_backend netbsd_backend;
    9541142extern const struct usbi_os_backend windows_backend;
     1143extern const struct usbi_os_backend usbdk_backend;
     1144extern const struct usbi_os_backend wince_backend;
     1145extern const struct usbi_os_backend haiku_usb_raw_backend;
     1146extern const struct usbi_os_backend sunos_backend;
    9551147
    9561148extern struct list_head active_contexts_list;
    9571149extern usbi_mutex_static_t active_contexts_lock;
    9581150
    959 #endif
    960 
     1151#ifdef __cplusplus
     1152}
     1153#endif
     1154
     1155#endif
  • TabularUnified libusb1/trunk/libusb/os/darwin_usb.c

    r1876 r1882  
    22/*
    33 * darwin backend for libusb 1.0
    4  * Copyright (C) 2008-2013 Nathan Hjelm <hjelmn@users.sourceforge.net>
     4 * Copyright © 2008-2016 Nathan Hjelm <hjelmn@users.sourceforge.net>
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    1919 */
    2020
    21 #include <config.h>
     21#include "config.h"
     22#include <time.h>
    2223#include <ctype.h>
    2324#include <errno.h>
     
    2930#include <unistd.h>
    3031#include <fcntl.h>
    31 #include <libkern/OSAtomic.h>
     32#include <sys/sysctl.h>
    3233
    3334#include <mach/clock.h>
     
    3738
    3839#include <AvailabilityMacros.h>
    39 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     40#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 && MAC_OS_X_VERSION_MIN_REQUIRED < 101200
    4041  #include <objc/objc-auto.h>
     42#endif
     43
     44#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     45/* Apple deprecated the darwin atomics in 10.12 in favor of C11 atomics */
     46#include <stdatomic.h>
     47#define libusb_darwin_atomic_fetch_add(x, y) atomic_fetch_add(x, y)
     48
     49_Atomic int32_t initCount = ATOMIC_VAR_INIT(0);
     50#else
     51/* use darwin atomics if the target is older than 10.12 */
     52#include <libkern/OSAtomic.h>
     53
     54/* OSAtomicAdd32Barrier returns the new value */
     55#define libusb_darwin_atomic_fetch_add(x, y) (OSAtomicAdd32Barrier(y, x) - y)
     56
     57static volatile int32_t initCount = 0;
    4158#endif
    4259
     
    4764static pthread_cond_t  libusb_darwin_at_cond = PTHREAD_COND_INITIALIZER;
    4865
     66static pthread_once_t darwin_init_once = PTHREAD_ONCE_INIT;
     67
    4968static clock_serv_t clock_realtime;
    5069static clock_serv_t clock_monotonic;
    5170
    5271static CFRunLoopRef libusb_darwin_acfl = NULL; /* event cf loop */
    53 static volatile int32_t initCount = 0;
     72static CFRunLoopSourceRef libusb_darwin_acfls = NULL; /* shutdown signal for event cf loop */
     73
     74static usbi_mutex_t darwin_cached_devices_lock = PTHREAD_MUTEX_INITIALIZER;
     75static struct list_head darwin_cached_devices = {&darwin_cached_devices, &darwin_cached_devices};
     76static char *darwin_device_class = kIOUSBDeviceClassName;
     77
     78#define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
    5479
    5580/* async event thread */
     
    6388
    6489static int darwin_scan_devices(struct libusb_context *ctx);
    65 static int process_new_device (struct libusb_context *ctx, usb_device_t **device, UInt32 locationID);
     90static int process_new_device (struct libusb_context *ctx, io_service_t service);
    6691
    6792#if defined(ENABLE_LOGGING)
    6893static const char *darwin_error_str (int result) {
     94  static char string_buffer[50];
    6995  switch (result) {
    7096  case kIOReturnSuccess:
     
    94120  case kIOReturnCannotWire:
    95121    return "physical memory can not be wired down";
     122  case kIOReturnNoResources:
     123    return "out of resources";
     124  case kIOUSBHighSpeedSplitError:
     125    return "high speed split error";
    96126  default:
    97     return "unknown error";
     127    snprintf(string_buffer, sizeof(string_buffer), "unknown error (0x%x)", result);
     128    return string_buffer;
    98129  }
    99130}
     
    125156}
    126157
    127 
    128 static int ep_to_pipeRef(struct libusb_device_handle *dev_handle, uint8_t ep, uint8_t *pipep, uint8_t *ifcp) {
     158/* this function must be called with the darwin_cached_devices_lock held */
     159static void darwin_deref_cached_device(struct darwin_cached_device *cached_dev) {
     160  cached_dev->refcount--;
     161  /* free the device and remove it from the cache */
     162  if (0 == cached_dev->refcount) {
     163    list_del(&cached_dev->list);
     164
     165    (*(cached_dev->device))->Release(cached_dev->device);
     166    free (cached_dev);
     167  }
     168}
     169
     170static void darwin_ref_cached_device(struct darwin_cached_device *cached_dev) {
     171  cached_dev->refcount++;
     172}
     173
     174static int ep_to_pipeRef(struct libusb_device_handle *dev_handle, uint8_t ep, uint8_t *pipep, uint8_t *ifcp, struct darwin_interface **interface_out) {
    129175  struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
    130176
     
    134180  int8_t i, iface;
    135181
    136   usbi_info (HANDLE_CTX(dev_handle), "converting ep address 0x%02x to pipeRef and interface", ep);
     182  usbi_dbg ("converting ep address 0x%02x to pipeRef and interface", ep);
    137183
    138184  for (iface = 0 ; iface < USB_MAXINTERFACES ; iface++) {
     
    143189        if (cInterface->endpoint_addrs[i] == ep) {
    144190          *pipep = i + 1;
    145           *ifcp = iface;
    146           usbi_info (HANDLE_CTX(dev_handle), "pipe %d on interface %d matches", *pipep, *ifcp);
     191
     192          if (ifcp)
     193            *ifcp = iface;
     194
     195          if (interface_out)
     196            *interface_out = cInterface;
     197
     198          usbi_dbg ("pipe %d on interface %d matches", *pipep, iface);
    147199          return 0;
    148200        }
     
    154206  usbi_warn (HANDLE_CTX(dev_handle), "no pipeRef found with endpoint address 0x%02x.", ep);
    155207
    156   return -1;
     208  return LIBUSB_ERROR_NOT_FOUND;
    157209}
    158210
    159211static int usb_setup_device_iterator (io_iterator_t *deviceIterator, UInt32 location) {
    160   CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOUSBDeviceClassName);
     212  CFMutableDictionaryRef matchingDict = IOServiceMatching(darwin_device_class);
    161213
    162214  if (!matchingDict)
     
    187239}
    188240
    189 static usb_device_t **usb_get_next_device (io_iterator_t deviceIterator, UInt32 *locationp) {
     241/* Returns 1 on success, 0 on failure. */
     242static int get_ioregistry_value_number (io_service_t service, CFStringRef property, CFNumberType type, void *p) {
     243  CFTypeRef cfNumber = IORegistryEntryCreateCFProperty (service, property, kCFAllocatorDefault, 0);
     244  int ret = 0;
     245
     246  if (cfNumber) {
     247    if (CFGetTypeID(cfNumber) == CFNumberGetTypeID()) {
     248      ret = CFNumberGetValue(cfNumber, type, p);
     249    }
     250
     251    CFRelease (cfNumber);
     252  }
     253
     254  return ret;
     255}
     256
     257static int get_ioregistry_value_data (io_service_t service, CFStringRef property, ssize_t size, void *p) {
     258  CFTypeRef cfData = IORegistryEntryCreateCFProperty (service, property, kCFAllocatorDefault, 0);
     259  int ret = 0;
     260
     261  if (cfData) {
     262    if (CFGetTypeID (cfData) == CFDataGetTypeID ()) {
     263      CFIndex length = CFDataGetLength (cfData);
     264      if (length < size) {
     265        size = length;
     266      }
     267
     268      CFDataGetBytes (cfData, CFRangeMake(0, size), p);
     269      ret = 1;
     270    }
     271
     272    CFRelease (cfData);
     273  }
     274
     275  return ret;
     276}
     277
     278static usb_device_t **darwin_device_from_service (io_service_t service)
     279{
    190280  io_cf_plugin_ref_t *plugInInterface = NULL;
    191281  usb_device_t **device;
    192   io_service_t usbDevice;
    193   long result;
     282  kern_return_t result;
    194283  SInt32 score;
    195284
    196   if (!IOIteratorIsValid (deviceIterator))
     285  result = IOCreatePlugInInterfaceForService(service, kIOUSBDeviceUserClientTypeID,
     286                                             kIOCFPlugInInterfaceID, &plugInInterface,
     287                                             &score);
     288
     289  if (kIOReturnSuccess != result || !plugInInterface) {
     290    usbi_dbg ("could not set up plugin for service: %s", darwin_error_str (result));
    197291    return NULL;
    198 
    199 
    200   while ((usbDevice = IOIteratorNext(deviceIterator))) {
    201     result = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID,
    202                                                kIOCFPlugInInterfaceID, &plugInInterface,
    203                                                &score);
    204 
    205     /* we are done with the usb_device_t */
    206     (void)IOObjectRelease(usbDevice);
    207     if (kIOReturnSuccess == result && plugInInterface)
    208       break;
    209 
    210     usbi_dbg ("libusb/darwin.c usb_get_next_device: could not set up plugin for service: %s\n", darwin_error_str (result));
    211   }
    212 
    213   if (!usbDevice)
    214     return NULL;
     292  }
    215293
    216294  (void)(*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(DeviceInterfaceID),
     
    219297  (*plugInInterface)->Release (plugInInterface);
    220298
    221   /* get the location from the device */
    222   if (locationp)
    223     (*(device))->GetLocationID(device, locationp);
    224 
    225299  return device;
    226300}
     
    228302static void darwin_devices_attached (void *ptr, io_iterator_t add_devices) {
    229303  struct libusb_context *ctx;
    230   usb_device_t **device;
    231   UInt32 location;
     304  io_service_t service;
    232305
    233306  usbi_mutex_lock(&active_contexts_lock);
    234307
    235   while ((device = usb_get_next_device (add_devices, &location))) {
     308  while ((service = IOIteratorNext(add_devices))) {
    236309    /* add this device to each active context's device list */
    237310    list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
    238       process_new_device (ctx, device, location);
    239     }
    240 
    241     /* release extra reference */
    242     (*device)->Release (device);
     311      process_new_device (ctx, service);;
     312    }
     313
     314    IOObjectRelease(service);
    243315  }
    244316
     
    249321  struct libusb_device *dev = NULL;
    250322  struct libusb_context *ctx;
    251   struct darwin_device_priv *dpriv;
     323  struct darwin_cached_device *old_device;
    252324
    253325  io_service_t device;
    254   bool locationValid;
    255   UInt32 location;
    256   CFTypeRef locationCF;
     326  UInt64 session;
     327  int ret;
     328
     329  usbi_mutex_lock(&active_contexts_lock);
    257330
    258331  while ((device = IOIteratorNext (rem_devices)) != 0) {
    259332    /* get the location from the i/o registry */
    260     locationCF = IORegistryEntryCreateCFProperty (device, CFSTR(kUSBDevicePropertyLocationID), kCFAllocatorDefault, 0);
    261 
     333    ret = get_ioregistry_value_number (device, CFSTR("sessionID"), kCFNumberSInt64Type, &session);
    262334    IOObjectRelease (device);
    263 
    264     if (!locationCF)
     335    if (!ret)
    265336      continue;
    266337
    267     locationValid = CFGetTypeID(locationCF) == CFNumberGetTypeID() &&
    268             CFNumberGetValue(locationCF, kCFNumberSInt32Type, &location);
    269 
    270     CFRelease (locationCF);
    271 
    272     if (!locationValid)
    273       continue;
    274 
    275     usbi_mutex_lock(&active_contexts_lock);
     338    /* we need to match darwin_ref_cached_device call made in darwin_get_cached_device function
     339       otherwise no cached device will ever get freed */
     340    usbi_mutex_lock(&darwin_cached_devices_lock);
     341    list_for_each_entry(old_device, &darwin_cached_devices, list, struct darwin_cached_device) {
     342      if (old_device->session == session) {
     343        darwin_deref_cached_device (old_device);
     344        break;
     345      }
     346    }
     347    usbi_mutex_unlock(&darwin_cached_devices_lock);
    276348
    277349    list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
    278       usbi_dbg ("libusb/darwin.c darwin_devices_detached: notifying context %p of device disconnect", ctx);
    279 
    280       dev = usbi_get_device_by_session_id (ctx, location);
    281       if (!dev) {
    282         continue;
     350      usbi_dbg ("notifying context %p of device disconnect", ctx);
     351
     352      dev = usbi_get_device_by_session_id(ctx, (unsigned long) session);
     353      if (dev) {
     354        /* signal the core that this device has been disconnected. the core will tear down this device
     355           when the reference count reaches 0 */
     356        usbi_disconnect_device(dev);
     357        libusb_unref_device(dev);
    283358      }
    284       dpriv = (struct darwin_device_priv *) dev->os_priv;
    285 
    286       /* signal the core that this device has been disconnected. the core will tear down this device
    287          when the reference count reaches 0 */
    288       usbi_disconnect_device (dev);
    289     }
    290 
    291     usbi_mutex_unlock(&active_contexts_lock);
    292   }
     359    }
     360  }
     361
     362  usbi_mutex_unlock(&active_contexts_lock);
     363}
     364
     365static void darwin_hotplug_poll (void)
     366{
     367  /* not sure if 5 seconds will be too long/short but it should work ok */
     368  mach_timespec_t timeout = {.tv_sec = 5, .tv_nsec = 0};
     369
     370  /* since a kernel thread may nodify the IOInterators used for
     371   * hotplug notidication we can't just clear the iterators.
     372   * instead just wait until all IOService providers are quiet */
     373  (void) IOKitWaitQuiet (kIOMasterPortDefault, &timeout);
    293374}
    294375
     
    305386  CFRunLoopRef runloop;
    306387
     388#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    307389  /* Set this thread's name, so it can be seen in the debugger
    308390     and crash reports. */
    309 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    310391  pthread_setname_np ("org.libusb.device-hotplug");
    311392#endif
    312393
     394#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 && MAC_OS_X_VERSION_MIN_REQUIRED < 101200
    313395  /* Tell the Objective-C garbage collector about this thread.
    314396     This is required because, unlike NSThreads, pthreads are
    315397     not automatically registered. Although we don't use
    316      Objective-C, we use CoreFoundation, which does. */
    317 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     398     Objective-C, we use CoreFoundation, which does.
     399     Garbage collection support was entirely removed in 10.12,
     400     so don't bother there. */
    318401  objc_registerThreadWithCollector();
    319402#endif
    320403
    321404  /* hotplug (device arrival/removal) sources */
     405  CFRunLoopSourceContext libusb_shutdown_cfsourcectx;
    322406  CFRunLoopSourceRef     libusb_notification_cfsource;
    323407  io_notification_port_t libusb_notification_port;
     
    325409  io_iterator_t          libusb_add_device_iterator;
    326410
    327   usbi_info (ctx, "creating hotplug event source");
     411  usbi_dbg ("creating hotplug event source");
    328412
    329413  runloop = CFRunLoopGetCurrent ();
    330414  CFRetain (runloop);
     415
     416  /* add the shutdown cfsource to the run loop */
     417  memset(&libusb_shutdown_cfsourcectx, 0, sizeof(libusb_shutdown_cfsourcectx));
     418  libusb_shutdown_cfsourcectx.info = runloop;
     419  libusb_shutdown_cfsourcectx.perform = (void (*)(void *))CFRunLoopStop;
     420  libusb_darwin_acfls = CFRunLoopSourceCreate(NULL, 0, &libusb_shutdown_cfsourcectx);
     421  CFRunLoopAddSource(runloop, libusb_darwin_acfls, kCFRunLoopDefaultMode);
    331422
    332423  /* add the notification port to the run loop */
     
    337428  /* create notifications for removed devices */
    338429  kresult = IOServiceAddMatchingNotification (libusb_notification_port, kIOTerminatedNotification,
    339                                               IOServiceMatching(kIOUSBDeviceClassName),
    340                                               (IOServiceMatchingCallback)darwin_devices_detached,
    341                                               (void *)ctx, &libusb_rem_device_iterator);
     430                                              IOServiceMatching(darwin_device_class),
     431                                              darwin_devices_detached,
     432                                              ctx, &libusb_rem_device_iterator);
    342433
    343434  if (kresult != kIOReturnSuccess) {
     
    348439
    349440  /* create notifications for attached devices */
    350   kresult = IOServiceAddMatchingNotification (libusb_notification_port, kIOFirstMatchNotification,
    351                                               IOServiceMatching(kIOUSBDeviceClassName),
    352                                               (IOServiceMatchingCallback)darwin_devices_attached,
    353                                               (void *)ctx, &libusb_add_device_iterator);
     441  kresult = IOServiceAddMatchingNotification(libusb_notification_port, kIOFirstMatchNotification,
     442                                              IOServiceMatching(darwin_device_class),
     443                                              darwin_devices_attached,
     444                                              ctx, &libusb_add_device_iterator);
    354445
    355446  if (kresult != kIOReturnSuccess) {
     
    363454  darwin_clear_iterator (libusb_add_device_iterator);
    364455
    365   usbi_info (ctx, "darwin event thread ready to receive events");
     456  usbi_dbg ("darwin event thread ready to receive events");
    366457
    367458  /* signal the main thread that the hotplug runloop has been created. */
     
    374465  CFRunLoopRun();
    375466
    376   usbi_info (ctx, "darwin event thread exiting");
     467  usbi_dbg ("darwin event thread exiting");
     468
     469  /* remove the notification cfsource */
     470  CFRunLoopRemoveSource(runloop, libusb_notification_cfsource, kCFRunLoopDefaultMode);
     471
     472  /* remove the shutdown cfsource */
     473  CFRunLoopRemoveSource(runloop, libusb_darwin_acfls, kCFRunLoopDefaultMode);
    377474
    378475  /* delete notification port */
     
    383480  IOObjectRelease (libusb_add_device_iterator);
    384481
     482  CFRelease (libusb_darwin_acfls);
    385483  CFRelease (runloop);
    386484
     485  libusb_darwin_acfls = NULL;
    387486  libusb_darwin_acfl = NULL;
    388487
    389488  pthread_exit (NULL);
     489}
     490
     491/* cleanup function to destroy cached devices */
     492static void __attribute__((destructor)) _darwin_finalize(void) {
     493  struct darwin_cached_device *dev, *next;
     494
     495  usbi_mutex_lock(&darwin_cached_devices_lock);
     496  list_for_each_entry_safe(dev, next, &darwin_cached_devices, list, struct darwin_cached_device) {
     497    darwin_deref_cached_device(dev);
     498  }
     499  usbi_mutex_unlock(&darwin_cached_devices_lock);
     500}
     501
     502static void darwin_check_version (void) {
     503  /* adjust for changes in the USB stack in xnu 15 */
     504  int sysctl_args[] = {CTL_KERN, KERN_OSRELEASE};
     505  long version;
     506  char version_string[256] = {'\0',};
     507  size_t length = 256;
     508
     509  sysctl(sysctl_args, 2, version_string, &length, NULL, 0);
     510
     511  errno = 0;
     512  version = strtol (version_string, NULL, 10);
     513  if (0 == errno && version >= 15) {
     514    darwin_device_class = "IOUSBHostDevice";
     515  }
    390516}
    391517
     
    394520  int rc;
    395521
     522  rc = pthread_once (&darwin_init_once, darwin_check_version);
     523  if (rc) {
     524    return LIBUSB_ERROR_OTHER;
     525  }
     526
    396527  rc = darwin_scan_devices (ctx);
    397528  if (LIBUSB_SUCCESS != rc) {
     
    399530  }
    400531
    401   if (OSAtomicIncrement32Barrier(&initCount) == 1) {
     532  if (libusb_darwin_atomic_fetch_add (&initCount, 1) == 0) {
    402533    /* create the clocks that will be used */
    403534
     
    407538    mach_port_deallocate(mach_task_self(), host_self);
    408539
    409     pthread_create (&libusb_darwin_at, NULL, darwin_event_thread_main, (void *)ctx);
     540    pthread_create (&libusb_darwin_at, NULL, darwin_event_thread_main, ctx);
    410541
    411542    pthread_mutex_lock (&libusb_darwin_at_mutex);
    412543    while (!libusb_darwin_acfl)
    413544      pthread_cond_wait (&libusb_darwin_at_cond, &libusb_darwin_at_mutex);
    414   }
    415 
    416   return 0;
     545    pthread_mutex_unlock (&libusb_darwin_at_mutex);
     546  }
     547
     548  return rc;
    417549}
    418550
    419551static void darwin_exit (void) {
    420   if (OSAtomicDecrement32Barrier(&initCount) == 0) {
     552  if (libusb_darwin_atomic_fetch_add (&initCount, -1) == 1) {
    421553    mach_port_deallocate(mach_task_self(), clock_realtime);
    422554    mach_port_deallocate(mach_task_self(), clock_monotonic);
    423555
    424556    /* stop the event runloop and wait for the thread to terminate. */
    425     CFRunLoopStop (libusb_darwin_acfl);
     557    CFRunLoopSourceSignal(libusb_darwin_acfls);
     558    CFRunLoopWakeUp (libusb_darwin_acfl);
    426559    pthread_join (libusb_darwin_at, NULL);
    427560  }
     
    429562
    430563static int darwin_get_device_descriptor(struct libusb_device *dev, unsigned char *buffer, int *host_endian) {
    431   struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
     564  struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
    432565
    433566  /* return cached copy */
     
    440573
    441574static int get_configuration_index (struct libusb_device *dev, int config_value) {
    442   struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
     575  struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
    443576  UInt8 i, numConfig;
    444577  IOUSBConfigurationDescriptorPtr desc;
     
    458591
    459592  /* configuration not found */
    460   return LIBUSB_ERROR_OTHER;
     593  return LIBUSB_ERROR_NOT_FOUND;
    461594}
    462595
    463596static int darwin_get_active_config_descriptor(struct libusb_device *dev, unsigned char *buffer, size_t len, int *host_endian) {
    464   struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
     597  struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
    465598  int config_index;
    466599
    467600  if (0 == priv->active_config)
    468     return LIBUSB_ERROR_INVALID_PARAM;
     601    return LIBUSB_ERROR_NOT_FOUND;
    469602
    470603  config_index = get_configuration_index (dev, priv->active_config);
     
    476609
    477610static int darwin_get_config_descriptor(struct libusb_device *dev, uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian) {
    478   struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
     611  struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
    479612  IOUSBConfigurationDescriptorPtr desc;
    480613  IOReturn kresult;
     614  int ret;
    481615
    482616  if (!priv || !priv->device)
     
    495629  }
    496630
    497   return darwin_to_libusb (kresult);
     631  ret = darwin_to_libusb (kresult);
     632  if (ret != LIBUSB_SUCCESS)
     633    return ret;
     634
     635  return (int) len;
    498636}
    499637
    500638/* check whether the os has configured the device */
    501 static int darwin_check_configuration (struct libusb_context *ctx, struct libusb_device *dev, usb_device_t **darwin_device) {
    502   struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
     639static int darwin_check_configuration (struct libusb_context *ctx, struct darwin_cached_device *dev) {
     640  usb_device_t **darwin_device = dev->device;
    503641
    504642  IOUSBConfigurationDescriptorPtr configDesc;
     
    508646  io_service_t              firstInterface;
    509647
    510   if (priv->dev_descriptor.bNumConfigurations < 1) {
     648  if (dev->dev_descriptor.bNumConfigurations < 1) {
    511649    usbi_err (ctx, "device has no configurations");
    512650    return LIBUSB_ERROR_OTHER; /* no configurations at this speed so we can't use it */
    513651  }
    514652
     653  /* checking the configuration of a root hub simulation takes ~1 s in 10.11. the device is
     654     not usable anyway */
     655  if (0x05ac == dev->dev_descriptor.idVendor && 0x8005 == dev->dev_descriptor.idProduct) {
     656    usbi_dbg ("ignoring configuration on root hub simulation");
     657    dev->active_config = 0;
     658    return 0;
     659  }
     660
    515661  /* find the first configuration */
    516662  kresult = (*darwin_device)->GetConfigurationDescriptorPtr (darwin_device, 0, &configDesc);
    517   priv->first_config = (kIOReturnSuccess == kresult) ? configDesc->bConfigurationValue : 1;
     663  dev->first_config = (kIOReturnSuccess == kresult) ? configDesc->bConfigurationValue : 1;
    518664
    519665  /* check if the device is already configured. there is probably a better way than iterating over the
     
    541687
    542688    /* device is configured */
    543     if (priv->dev_descriptor.bNumConfigurations == 1)
     689    if (dev->dev_descriptor.bNumConfigurations == 1)
    544690      /* to avoid problems with some devices get the configurations value from the configuration descriptor */
    545       priv->active_config = priv->first_config;
     691      dev->active_config = dev->first_config;
    546692    else
    547693      /* devices with more than one configuration should work with GetConfiguration */
    548       (*darwin_device)->GetConfiguration (darwin_device, &priv->active_config);
     694      (*darwin_device)->GetConfiguration (darwin_device, &dev->active_config);
    549695  } else
    550696    /* not configured */
    551     priv->active_config = 0;
     697    dev->active_config = 0;
    552698 
    553   usbi_info (ctx, "active config: %u, first config: %u", priv->active_config, priv->first_config);
     699  usbi_dbg ("active config: %u, first config: %u", dev->active_config, dev->first_config);
    554700
    555701  return 0;
     
    557703
    558704static int darwin_request_descriptor (usb_device_t **device, UInt8 desc, UInt8 desc_index, void *buffer, size_t buffer_size) {
    559   IOUSBDevRequest req;
     705  IOUSBDevRequestTO req;
    560706
    561707  memset (buffer, 0, buffer_size);
     
    568714  req.wLength       = buffer_size;
    569715  req.pData         = buffer;
    570 
    571   return (*device)->DeviceRequest (device, &req);
    572 }
    573 
    574 static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct libusb_device *dev, usb_device_t **device) {
    575   struct darwin_device_priv *priv;
    576   int retries = 2, delay = 30000;
     716  req.noDataTimeout = 20;
     717  req.completionTimeout = 100;
     718
     719  return (*device)->DeviceRequestTO (device, &req);
     720}
     721
     722static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct darwin_cached_device *dev) {
     723  usb_device_t **device = dev->device;
     724  int retries = 1, delay = 30000;
    577725  int unsuspended = 0, try_unsuspend = 1, try_reconfigure = 1;
    578726  int is_open = 0;
     
    581729  UInt16 idProduct, idVendor;
    582730
     731  dev->can_enumerate = 0;
     732
    583733  (*device)->GetDeviceClass (device, &bDeviceClass);
    584734  (*device)->GetDeviceProduct (device, &idProduct);
    585735  (*device)->GetDeviceVendor (device, &idVendor);
    586736
    587   priv = (struct darwin_device_priv *)dev->os_priv;
    588 
    589   /* try to open the device (we can usually continue even if this fails) */
     737  /* According to Apple's documentation the device must be open for DeviceRequest but we may not be able to open some
     738   * devices and Apple's USB Prober doesn't bother to open the device before issuing a descriptor request.  Still,
     739   * to follow the spec as closely as possible, try opening the device */
    590740  is_open = ((*device)->USBDeviceOpenSeize(device) == kIOReturnSuccess);
    591741
    592   /**** retrieve device descriptor ****/
    593742  do {
    594     /* according to Apple's documentation the device must be open for DeviceRequest but we may not be able to open some
    595      * devices and Apple's USB Prober doesn't bother to open the device before issuing a descriptor request.  Still,
    596      * to follow the spec as closely as possible, try opening the device */
    597     ret = darwin_request_descriptor (device, kUSBDeviceDesc, 0, &priv->dev_descriptor, sizeof(priv->dev_descriptor));
    598 
    599 
    600     if (kIOReturnOverrun == ret && kUSBDeviceDesc == priv->dev_descriptor.bDescriptorType)
     743    /**** retrieve device descriptor ****/
     744    ret = darwin_request_descriptor (device, kUSBDeviceDesc, 0, &dev->dev_descriptor, sizeof(dev->dev_descriptor));
     745
     746    if (kIOReturnOverrun == ret && kUSBDeviceDesc == dev->dev_descriptor.bDescriptorType)
    601747      /* received an overrun error but we still received a device descriptor */
    602748      ret = kIOReturnSuccess;
     
    607753    }
    608754
    609     if (kIOReturnSuccess == ret && (0 == priv->dev_descriptor.bNumConfigurations ||
    610                                     0 == priv->dev_descriptor.bcdUSB)) {
     755    if (kIOReturnSuccess == ret && (0 == dev->dev_descriptor.bNumConfigurations ||
     756                                    0 == dev->dev_descriptor.bcdUSB)) {
    611757      /* work around for incorrectly configured devices */
    612758      if (try_reconfigure && is_open) {
     
    626772      /* device may be suspended. unsuspend it and try again */
    627773#if DeviceVersion >= 320
    628       UInt32 info;
     774      UInt32 info = 0;
    629775
    630776      /* IOUSBFamily 320+ provides a way to detect device suspension but earlier versions do not */
    631777      (void)(*device)->GetUSBDeviceInformation (device, &info);
    632778
    633       try_unsuspend = info & (1 << kUSBInformationDeviceIsSuspendedBit);
     779      /* note that the device was suspended */
     780      if (info & (1 << kUSBInformationDeviceIsSuspendedBit) || 0 == info)
     781        try_unsuspend = 1;
    634782#endif
    635783
    636784      if (try_unsuspend) {
    637         /* resume the device */
     785        /* try to unsuspend the device */
    638786        ret2 = (*device)->USBDeviceSuspend (device, 0);
    639787        if (kIOReturnSuccess != ret2) {
     
    651799      usbi_dbg("kernel responded with code: 0x%08x. sleeping for %d ms before trying again", ret, delay/1000);
    652800      /* sleep for a little while before trying again */
    653       usleep (delay);
     801      nanosleep(&(struct timespec){delay / 1000000, (delay * 1000) % 1000000000UL}, NULL);
    654802    }
    655803  } while (kIOReturnSuccess != ret && retries--);
     
    665813    /* a debug message was already printed out for this error */
    666814    if (LIBUSB_CLASS_HUB == bDeviceClass)
    667       usbi_dbg ("could not retrieve device descriptor %.4x:%.4x: %s. skipping device", idVendor, idProduct, darwin_error_str (ret));
     815      usbi_dbg ("could not retrieve device descriptor %.4x:%.4x: %s (%x). skipping device",
     816                idVendor, idProduct, darwin_error_str (ret), ret);
    668817    else
    669       usbi_warn (ctx, "could not retrieve device descriptor %.4x:%.4x: %s. skipping device", idVendor, idProduct, darwin_error_str (ret));
    670 
    671     return -1;
    672   }
    673 
    674   usbi_dbg ("device descriptor:");
    675   usbi_dbg (" bDescriptorType:    0x%02x", priv->dev_descriptor.bDescriptorType);
    676   usbi_dbg (" bcdUSB:             0x%04x", priv->dev_descriptor.bcdUSB);
    677   usbi_dbg (" bDeviceClass:       0x%02x", priv->dev_descriptor.bDeviceClass);
    678   usbi_dbg (" bDeviceSubClass:    0x%02x", priv->dev_descriptor.bDeviceSubClass);
    679   usbi_dbg (" bDeviceProtocol:    0x%02x", priv->dev_descriptor.bDeviceProtocol);
    680   usbi_dbg (" bMaxPacketSize0:    0x%02x", priv->dev_descriptor.bMaxPacketSize0);
    681   usbi_dbg (" idVendor:           0x%04x", priv->dev_descriptor.idVendor);
    682   usbi_dbg (" idProduct:          0x%04x", priv->dev_descriptor.idProduct);
    683   usbi_dbg (" bcdDevice:          0x%04x", priv->dev_descriptor.bcdDevice);
    684   usbi_dbg (" iManufacturer:      0x%02x", priv->dev_descriptor.iManufacturer);
    685   usbi_dbg (" iProduct:           0x%02x", priv->dev_descriptor.iProduct);
    686   usbi_dbg (" iSerialNumber:      0x%02x", priv->dev_descriptor.iSerialNumber);
    687   usbi_dbg (" bNumConfigurations: 0x%02x", priv->dev_descriptor.bNumConfigurations);
     818      usbi_warn (ctx, "could not retrieve device descriptor %.4x:%.4x: %s (%x). skipping device",
     819                 idVendor, idProduct, darwin_error_str (ret), ret);
     820    return darwin_to_libusb (ret);
     821  }
    688822
    689823  /* catch buggy hubs (which appear to be virtual). Apple's own USB prober has problems with these devices. */
    690   if (libusb_le16_to_cpu (priv->dev_descriptor.idProduct) != idProduct) {
     824  if (libusb_le16_to_cpu (dev->dev_descriptor.idProduct) != idProduct) {
    691825    /* not a valid device */
    692826    usbi_warn (ctx, "idProduct from iokit (%04x) does not match idProduct in descriptor (%04x). skipping device",
    693                idProduct, libusb_le16_to_cpu (priv->dev_descriptor.idProduct));
    694     return -1;
    695   }
    696 
    697   return 0;
    698 }
    699 
    700 static int process_new_device (struct libusb_context *ctx, usb_device_t **device, UInt32 locationID) {
     827               idProduct, libusb_le16_to_cpu (dev->dev_descriptor.idProduct));
     828    return LIBUSB_ERROR_NO_DEVICE;
     829  }
     830
     831  usbi_dbg ("cached device descriptor:");
     832  usbi_dbg ("  bDescriptorType:    0x%02x", dev->dev_descriptor.bDescriptorType);
     833  usbi_dbg ("  bcdUSB:             0x%04x", dev->dev_descriptor.bcdUSB);
     834  usbi_dbg ("  bDeviceClass:       0x%02x", dev->dev_descriptor.bDeviceClass);
     835  usbi_dbg ("  bDeviceSubClass:    0x%02x", dev->dev_descriptor.bDeviceSubClass);
     836  usbi_dbg ("  bDeviceProtocol:    0x%02x", dev->dev_descriptor.bDeviceProtocol);
     837  usbi_dbg ("  bMaxPacketSize0:    0x%02x", dev->dev_descriptor.bMaxPacketSize0);
     838  usbi_dbg ("  idVendor:           0x%04x", dev->dev_descriptor.idVendor);
     839  usbi_dbg ("  idProduct:          0x%04x", dev->dev_descriptor.idProduct);
     840  usbi_dbg ("  bcdDevice:          0x%04x", dev->dev_descriptor.bcdDevice);
     841  usbi_dbg ("  iManufacturer:      0x%02x", dev->dev_descriptor.iManufacturer);
     842  usbi_dbg ("  iProduct:           0x%02x", dev->dev_descriptor.iProduct);
     843  usbi_dbg ("  iSerialNumber:      0x%02x", dev->dev_descriptor.iSerialNumber);
     844  usbi_dbg ("  bNumConfigurations: 0x%02x", dev->dev_descriptor.bNumConfigurations);
     845
     846  dev->can_enumerate = 1;
     847
     848  return LIBUSB_SUCCESS;
     849}
     850
     851static int get_device_port (io_service_t service, UInt8 *port) {
     852  kern_return_t result;
     853  io_service_t parent;
     854  int ret = 0;
     855
     856  if (get_ioregistry_value_number (service, CFSTR("PortNum"), kCFNumberSInt8Type, port)) {
     857    return 1;
     858  }
     859
     860  result = IORegistryEntryGetParentEntry (service, kIOServicePlane, &parent);
     861  if (kIOReturnSuccess == result) {
     862    ret = get_ioregistry_value_data (parent, CFSTR("port"), 1, port);
     863    IOObjectRelease (parent);
     864  }
     865
     866  return ret;
     867}
     868
     869static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t service,
     870                                    struct darwin_cached_device **cached_out) {
     871  struct darwin_cached_device *new_device;
     872  UInt64 sessionID = 0, parent_sessionID = 0;
     873  int ret = LIBUSB_SUCCESS;
     874  usb_device_t **device;
     875  io_service_t parent;
     876  kern_return_t result;
     877  UInt8 port = 0;
     878
     879  /* get some info from the io registry */
     880  (void) get_ioregistry_value_number (service, CFSTR("sessionID"), kCFNumberSInt64Type, &sessionID);
     881  if (!get_device_port (service, &port)) {
     882    usbi_dbg("could not get connected port number");
     883  }
     884
     885  usbi_dbg("finding cached device for sessionID 0x%" PRIx64, sessionID);
     886
     887  result = IORegistryEntryGetParentEntry (service, kIOUSBPlane, &parent);
     888
     889  if (kIOReturnSuccess == result) {
     890    (void) get_ioregistry_value_number (parent, CFSTR("sessionID"), kCFNumberSInt64Type, &parent_sessionID);
     891    IOObjectRelease(parent);
     892  }
     893
     894  usbi_mutex_lock(&darwin_cached_devices_lock);
     895  do {
     896    *cached_out = NULL;
     897
     898    list_for_each_entry(new_device, &darwin_cached_devices, list, struct darwin_cached_device) {
     899      usbi_dbg("matching sessionID 0x%" PRIx64 " against cached device with sessionID 0x%" PRIx64, sessionID, new_device->session);
     900      if (new_device->session == sessionID) {
     901        usbi_dbg("using cached device for device");
     902        *cached_out = new_device;
     903        break;
     904      }
     905    }
     906
     907    if (*cached_out)
     908      break;
     909
     910    usbi_dbg("caching new device with sessionID 0x%" PRIx64, sessionID);
     911
     912    device = darwin_device_from_service (service);
     913    if (!device) {
     914      ret = LIBUSB_ERROR_NO_DEVICE;
     915      break;
     916    }
     917
     918    new_device = calloc (1, sizeof (*new_device));
     919    if (!new_device) {
     920      ret = LIBUSB_ERROR_NO_MEM;
     921      break;
     922    }
     923
     924    /* add this device to the cached device list */
     925    list_add(&new_device->list, &darwin_cached_devices);
     926
     927    (*device)->GetDeviceAddress (device, (USBDeviceAddress *)&new_device->address);
     928
     929    /* keep a reference to this device */
     930    darwin_ref_cached_device(new_device);
     931
     932    new_device->device = device;
     933    new_device->session = sessionID;
     934    (*device)->GetLocationID (device, &new_device->location);
     935    new_device->port = port;
     936    new_device->parent_session = parent_sessionID;
     937
     938    /* cache the device descriptor */
     939    ret = darwin_cache_device_descriptor(ctx, new_device);
     940    if (ret)
     941      break;
     942
     943    if (new_device->can_enumerate) {
     944      snprintf(new_device->sys_path, 20, "%03i-%04x-%04x-%02x-%02x", new_device->address,
     945               new_device->dev_descriptor.idVendor, new_device->dev_descriptor.idProduct,
     946               new_device->dev_descriptor.bDeviceClass, new_device->dev_descriptor.bDeviceSubClass);
     947    }
     948  } while (0);
     949
     950  usbi_mutex_unlock(&darwin_cached_devices_lock);
     951
     952  /* keep track of devices regardless of if we successfully enumerate them to
     953     prevent them from being enumerated multiple times */
     954
     955  *cached_out = new_device;
     956
     957  return ret;
     958}
     959
     960static int process_new_device (struct libusb_context *ctx, io_service_t service) {
     961  struct darwin_device_priv *priv;
    701962  struct libusb_device *dev = NULL;
    702   struct darwin_device_priv *priv;
     963  struct darwin_cached_device *cached_device;
    703964  UInt8 devSpeed;
    704   UInt16 address;
    705965  int ret = 0;
    706966
    707967  do {
    708     usbi_info (ctx, "allocating new device for location 0x%08x", locationID);
    709 
    710     dev = usbi_alloc_device(ctx, locationID);
     968    ret = darwin_get_cached_device (ctx, service, &cached_device);
     969
     970    if (ret < 0 || !cached_device->can_enumerate) {
     971      return ret;
     972    }
     973
     974    /* check current active configuration (and cache the first configuration value--
     975       which may be used by claim_interface) */
     976    ret = darwin_check_configuration (ctx, cached_device);
     977    if (ret)
     978      break;
     979
     980    usbi_dbg ("allocating new device in context %p for with session 0x%" PRIx64,
     981              ctx, cached_device->session);
     982
     983    dev = usbi_alloc_device(ctx, (unsigned long) cached_device->session);
    711984    if (!dev) {
    712985      return LIBUSB_ERROR_NO_MEM;
     
    714987
    715988    priv = (struct darwin_device_priv *)dev->os_priv;
    716     priv->device = device;
    717 
    718     /* increment the device's reference count (it is decremented in darwin_destroy_device) */
    719     (*device)->AddRef (device);
    720 
    721     (*device)->GetDeviceAddress (device, (USBDeviceAddress *)&address);
    722 
    723     ret = darwin_cache_device_descriptor (ctx, dev, device);
    724     if (ret < 0)
    725       break;
    726 
    727     /* check current active configuration (and cache the first configuration value-- which may be used by claim_interface) */
    728     ret = darwin_check_configuration (ctx, dev, device);
    729     if (ret < 0)
    730       break;
    731 
    732     dev->bus_number     = locationID >> 24;
    733     dev->device_address = address;
    734 
    735     (*device)->GetDeviceSpeed (device, &devSpeed);
     989
     990    priv->dev = cached_device;
     991    darwin_ref_cached_device (priv->dev);
     992
     993    if (cached_device->parent_session > 0) {
     994      dev->parent_dev = usbi_get_device_by_session_id (ctx, (unsigned long) cached_device->parent_session);
     995    } else {
     996      dev->parent_dev = NULL;
     997    }
     998    dev->port_number    = cached_device->port;
     999    dev->bus_number     = cached_device->location >> 24;
     1000    dev->device_address = cached_device->address;
     1001
     1002    (*(priv->dev->device))->GetDeviceSpeed (priv->dev->device, &devSpeed);
    7361003
    7371004    switch (devSpeed) {
     
    7461013    }
    7471014
    748     /* save our location, we'll need this later */
    749     priv->location = locationID;
    750     snprintf(priv->sys_path, 20, "%03i-%04x-%04x-%02x-%02x", address, priv->dev_descriptor.idVendor, priv->dev_descriptor.idProduct,
    751              priv->dev_descriptor.bDeviceClass, priv->dev_descriptor.bDeviceSubClass);
    752 
    7531015    ret = usbi_sanitize_device (dev);
    7541016    if (ret < 0)
    7551017      break;
    7561018
    757     usbi_info (ctx, "found device with address %d at %s", dev->device_address, priv->sys_path);
     1019    usbi_dbg ("found device with address %d port = %d parent = %p at %p", dev->device_address,
     1020              dev->port_number, (void *) dev->parent_dev, priv->dev->sys_path);
    7581021  } while (0);
    7591022
     
    7681031
    7691032static int darwin_scan_devices(struct libusb_context *ctx) {
    770   io_iterator_t        deviceIterator;
    771   usb_device_t         **device;
    772   kern_return_t        kresult;
    773   UInt32               location;
     1033  io_iterator_t deviceIterator;
     1034  io_service_t service;
     1035  kern_return_t kresult;
    7741036
    7751037  kresult = usb_setup_device_iterator (&deviceIterator, 0);
     
    7771039    return darwin_to_libusb (kresult);
    7781040
    779   while ((device = usb_get_next_device (deviceIterator, &location)) != NULL) {
    780     (void) process_new_device (ctx, device, location);
    781 
    782     /* process_new_device added a reference so we need to release the one
    783        from QueryInterface */
    784     (*device)->Release (device);
     1041  while ((service = IOIteratorNext (deviceIterator))) {
     1042    (void) process_new_device (ctx, service);
     1043
     1044    IOObjectRelease(service);
    7851045  }
    7861046
     
    7921052static int darwin_open (struct libusb_device_handle *dev_handle) {
    7931053  struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
    794   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
     1054  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
    7951055  IOReturn kresult;
    7961056
     
    7991059    kresult = (*(dpriv->device))->USBDeviceOpenSeize (dpriv->device);
    8001060    if (kresult != kIOReturnSuccess) {
    801       usbi_err (HANDLE_CTX (dev_handle), "USBDeviceOpen: %s", darwin_error_str(kresult));
     1061      usbi_warn (HANDLE_CTX (dev_handle), "USBDeviceOpen: %s", darwin_error_str(kresult));
    8021062
    8031063      if (kIOReturnExclusiveAccess != kresult) {
     
    8251085    }
    8261086
     1087    CFRetain (libusb_darwin_acfl);
     1088
    8271089    /* add the cfSource to the aync run loop */
    8281090    CFRunLoopAddSource(libusb_darwin_acfl, priv->cfSource, kCFRunLoopCommonModes);
     
    8321094  dpriv->open_count++;
    8331095
    834   /* create a file descriptor for notifications */
    835   pipe (priv->fds);
    836 
    837   /* set the pipe to be non-blocking */
    838   fcntl (priv->fds[1], F_SETFD, O_NONBLOCK);
    839 
    840   usbi_add_pollfd(HANDLE_CTX(dev_handle), priv->fds[0], POLLIN);
    841 
    842   usbi_info (HANDLE_CTX (dev_handle), "device open for access");
     1096  usbi_dbg ("device open for access");
    8431097
    8441098  return 0;
     
    8471101static void darwin_close (struct libusb_device_handle *dev_handle) {
    8481102  struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
    849   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
     1103  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
    8501104  IOReturn kresult;
    8511105  int i;
     
    8531107  if (dpriv->open_count == 0) {
    8541108    /* something is probably very wrong if this is the case */
    855     usbi_err (HANDLE_CTX (dev_handle), "Close called on a device that was not open!\n");
     1109    usbi_err (HANDLE_CTX (dev_handle), "Close called on a device that was not open!");
    8561110    return;
    8571111  }
     
    8701124      CFRelease (priv->cfSource);
    8711125      priv->cfSource = NULL;
     1126      CFRelease (libusb_darwin_acfl);
    8721127    }
    8731128
     
    8781133        /* Log the fact that we had a problem closing the file, however failing a
    8791134         * close isn't really an error, so return success anyway */
    880         usbi_err (HANDLE_CTX (dev_handle), "USBDeviceClose: %s", darwin_error_str(kresult));
     1135        usbi_warn (HANDLE_CTX (dev_handle), "USBDeviceClose: %s", darwin_error_str(kresult));
    8811136      }
    8821137    }
    8831138  }
    884 
    885   /* file descriptors are maintained per-instance */
    886   usbi_remove_pollfd (HANDLE_CTX (dev_handle), priv->fds[0]);
    887   close (priv->fds[1]);
    888   close (priv->fds[0]);
    889 
    890   priv->fds[0] = priv->fds[1] = -1;
    8911139}
    8921140
    8931141static int darwin_get_configuration(struct libusb_device_handle *dev_handle, int *config) {
    894   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
     1142  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
    8951143
    8961144  *config = (int) dpriv->active_config;
     
    9001148
    9011149static int darwin_set_configuration(struct libusb_device_handle *dev_handle, int config) {
    902   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
     1150  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
    9031151  IOReturn kresult;
    9041152  int i;
     
    9281176  kern_return_t             kresult;
    9291177  io_iterator_t             interface_iterator;
    930   CFTypeRef                 bInterfaceNumberCF;
    931   int                       bInterfaceNumber;
     1178  UInt8                     bInterfaceNumber;
     1179  int                       ret;
    9321180
    9331181  *usbInterfacep = IO_OBJECT_NULL;
     
    9451193  while ((*usbInterfacep = IOIteratorNext(interface_iterator))) {
    9461194    /* find the interface number */
    947     bInterfaceNumberCF = IORegistryEntryCreateCFProperty (*usbInterfacep, CFSTR("bInterfaceNumber"),
    948                                                           kCFAllocatorDefault, 0);
    949     if (!bInterfaceNumberCF) {
    950       continue;
    951     }
    952 
    953     CFNumberGetValue(bInterfaceNumberCF, kCFNumberIntType, &bInterfaceNumber);
    954 
    955     if ((uint8_t) bInterfaceNumber == ifc) {
     1195    ret = get_ioregistry_value_number (*usbInterfacep, CFSTR("bInterfaceNumber"), kCFNumberSInt8Type,
     1196                                       &bInterfaceNumber);
     1197
     1198    if (ret && bInterfaceNumber == ifc) {
    9561199      break;
    9571200    }
     
    9771220  u_int8_t dont_care1, dont_care3;
    9781221  u_int16_t dont_care2;
    979   int i;
    980 
    981   usbi_info (HANDLE_CTX (dev_handle), "building table of endpoints.");
     1222  int rc;
     1223
     1224  usbi_dbg ("building table of endpoints.");
    9821225
    9831226  /* retrieve the total number of endpoints on this interface */
     
    9891232
    9901233  /* iterate through pipe references */
    991   for (i = 1 ; i <= numep ; i++) {
     1234  for (int i = 1 ; i <= numep ; i++) {
    9921235    kresult = (*(cInterface->interface))->GetPipeProperties(cInterface->interface, i, &direction, &number, &dont_care1,
    9931236                                                            &dont_care2, &dont_care3);
    9941237
    9951238    if (kresult != kIOReturnSuccess) {
    996       usbi_err (HANDLE_CTX (dev_handle), "error getting pipe information for pipe %d: %s", i, darwin_error_str(kresult));
    997 
    998       return darwin_to_libusb (kresult);
    999     }
    1000 
    1001     usbi_info (HANDLE_CTX (dev_handle), "interface: %i pipe %i: dir: %i number: %i", iface, i, direction, number);
    1002 
    1003     cInterface->endpoint_addrs[i - 1] = ((direction << 7 & LIBUSB_ENDPOINT_DIR_MASK) | (number & LIBUSB_ENDPOINT_ADDRESS_MASK));
     1239      /* probably a buggy device. try to get the endpoint address from the descriptors */
     1240      struct libusb_config_descriptor *config;
     1241      const struct libusb_endpoint_descriptor *endpoint_desc;
     1242      UInt8 alt_setting;
     1243
     1244      kresult = (*(cInterface->interface))->GetAlternateSetting (cInterface->interface, &alt_setting);
     1245      if (kresult) {
     1246        usbi_err (HANDLE_CTX (dev_handle), "can't get alternate setting for interface");
     1247        return darwin_to_libusb (kresult);
     1248      }
     1249
     1250      rc = libusb_get_active_config_descriptor (dev_handle->dev, &config);
     1251      if (LIBUSB_SUCCESS != rc) {
     1252        return rc;
     1253      }
     1254
     1255      endpoint_desc = config->interface[iface].altsetting[alt_setting].endpoint + i - 1;
     1256
     1257      cInterface->endpoint_addrs[i - 1] = endpoint_desc->bEndpointAddress;
     1258    } else {
     1259      cInterface->endpoint_addrs[i - 1] = (((kUSBIn == direction) << kUSBRqDirnShift) | (number & LIBUSB_ENDPOINT_ADDRESS_MASK));
     1260    }
     1261
     1262    usbi_dbg ("interface: %i pipe %i: dir: %i number: %i", iface, i, cInterface->endpoint_addrs[i - 1] >> kUSBRqDirnShift,
     1263              cInterface->endpoint_addrs[i - 1] & LIBUSB_ENDPOINT_ADDRESS_MASK);
    10041264  }
    10051265
     
    10101270
    10111271static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int iface) {
    1012   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
     1272  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
    10131273  struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
    10141274  io_service_t          usbInterface = IO_OBJECT_NULL;
     
    11081368  CFRunLoopAddSource(libusb_darwin_acfl, cInterface->cfSource, kCFRunLoopDefaultMode);
    11091369
    1110   usbi_info (HANDLE_CTX (dev_handle), "interface opened");
     1370  usbi_dbg ("interface opened");
    11111371
    11121372  return 0;
     
    11351395  kresult = (*(cInterface->interface))->USBInterfaceClose(cInterface->interface);
    11361396  if (kresult)
    1137     usbi_err (HANDLE_CTX (dev_handle), "USBInterfaceClose: %s", darwin_error_str(kresult));
     1397    usbi_warn (HANDLE_CTX (dev_handle), "USBInterfaceClose: %s", darwin_error_str(kresult));
    11381398
    11391399  kresult = (*(cInterface->interface))->Release(cInterface->interface);
    11401400  if (kresult != kIOReturnSuccess)
    1141     usbi_err (HANDLE_CTX (dev_handle), "Release: %s", darwin_error_str(kresult));
    1142 
    1143   cInterface->interface = IO_OBJECT_NULL;
     1401    usbi_warn (HANDLE_CTX (dev_handle), "Release: %s", darwin_error_str(kresult));
     1402
     1403  cInterface->interface = (usb_interface_t **) IO_OBJECT_NULL;
    11441404
    11451405  return darwin_to_libusb (kresult);
     
    11731433
    11741434static int darwin_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint) {
    1175   struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
    1176 
    11771435  /* current interface */
    11781436  struct darwin_interface *cInterface;
    1179   uint8_t pipeRef, iface;
    11801437  IOReturn kresult;
     1438  uint8_t pipeRef;
    11811439
    11821440  /* determine the interface/endpoint to use */
    1183   if (ep_to_pipeRef (dev_handle, endpoint, &pipeRef, &iface) != 0) {
     1441  if (ep_to_pipeRef (dev_handle, endpoint, &pipeRef, NULL, &cInterface) != 0) {
    11841442    usbi_err (HANDLE_CTX (dev_handle), "endpoint not found on any open interface");
    11851443
     
    11871445  }
    11881446
    1189   cInterface = &priv->interfaces[iface];
    1190 
    1191 #if (InterfaceVersion < 190)
    1192   kresult = (*(cInterface->interface))->ClearPipeStall(cInterface->interface, pipeRef);
    1193 #else
    11941447  /* newer versions of darwin support clearing additional bits on the device's endpoint */
    11951448  kresult = (*(cInterface->interface))->ClearPipeStallBothEnds(cInterface->interface, pipeRef);
    1196 #endif
    11971449  if (kresult)
    1198     usbi_err (HANDLE_CTX (dev_handle), "ClearPipeStall: %s", darwin_error_str (kresult));
     1450    usbi_warn (HANDLE_CTX (dev_handle), "ClearPipeStall: %s", darwin_error_str (kresult));
    11991451
    12001452  return darwin_to_libusb (kresult);
     
    12021454
    12031455static int darwin_reset_device(struct libusb_device_handle *dev_handle) {
    1204   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
     1456  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
    12051457  IOUSBDeviceDescriptor descriptor;
    12061458  IOUSBConfigurationDescriptorPtr cached_configuration;
     
    12541506
    12551507static int darwin_kernel_driver_active(struct libusb_device_handle *dev_handle, int interface) {
    1256   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
     1508  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
    12571509  io_service_t usbInterface;
    12581510  CFTypeRef driver;
     
    12811533/* attaching/detaching kernel drivers is not currently supported (maybe in the future?) */
    12821534static int darwin_attach_kernel_driver (struct libusb_device_handle *dev_handle, int interface) {
    1283   (void)dev_handle;
    1284   (void)interface;
     1535  UNUSED(dev_handle);
     1536  UNUSED(interface);
    12851537  return LIBUSB_ERROR_NOT_SUPPORTED;
    12861538}
    12871539
    12881540static int darwin_detach_kernel_driver (struct libusb_device_handle *dev_handle, int interface) {
    1289   (void)dev_handle;
    1290   (void)interface;
     1541  UNUSED(dev_handle);
     1542  UNUSED(interface);
    12911543  return LIBUSB_ERROR_NOT_SUPPORTED;
    12921544}
     
    12951547  struct darwin_device_priv *dpriv = (struct darwin_device_priv *) dev->os_priv;
    12961548
    1297   if (dpriv->device) {
    1298     /* it is an internal error if the reference count of a device is < 0 after release */
    1299     assert(0 <= (*(dpriv->device))->Release(dpriv->device));
    1300 
    1301     dpriv->device = NULL;
     1549  if (dpriv->dev) {
     1550    /* need to hold the lock in case this is the last reference to the device */
     1551    usbi_mutex_lock(&darwin_cached_devices_lock);
     1552    darwin_deref_cached_device (dpriv->dev);
     1553    dpriv->dev = NULL;
     1554    usbi_mutex_unlock(&darwin_cached_devices_lock);
    13021555  }
    13031556}
     
    13051558static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
    13061559  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    1307   struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
    13081560
    13091561  IOReturn               ret;
    13101562  uint8_t                transferType;
    1311   /* None of the values below are used in libusb for bulk transfers */
    1312   uint8_t                direction, number, interval, pipeRef, iface;
     1563  /* None of the values below are used in libusbx for bulk transfers */
     1564  uint8_t                direction, number, interval, pipeRef;
    13131565  uint16_t               maxPacketSize;
    13141566
    13151567  struct darwin_interface *cInterface;
    13161568
    1317   if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface) != 0) {
     1569  if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, NULL, &cInterface) != 0) {
    13181570    usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
    13191571
     
    13211573  }
    13221574
    1323   cInterface = &priv->interfaces[iface];
    1324 
    1325   (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
    1326                                                  &transferType, &maxPacketSize, &interval);
     1575  ret = (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
     1576                                                       &transferType, &maxPacketSize, &interval);
     1577
     1578  if (ret) {
     1579    usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", IS_XFERIN(transfer) ? "In" : "Out",
     1580              darwin_error_str(ret), ret);
     1581    return darwin_to_libusb (ret);
     1582  }
    13271583
    13281584  if (0 != (transfer->length % maxPacketSize)) {
     
    13411597                                                       transfer->length, darwin_async_io_callback, itransfer);
    13421598  } else {
    1343     itransfer->flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
     1599    itransfer->timeout_flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
    13441600
    13451601    if (IS_XFERIN(transfer))
     
    13601616}
    13611617
     1618#if InterfaceVersion >= 550
     1619static int submit_stream_transfer(struct usbi_transfer *itransfer) {
     1620  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
     1621  struct darwin_interface *cInterface;
     1622  uint8_t pipeRef;
     1623  IOReturn ret;
     1624
     1625  if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, NULL, &cInterface) != 0) {
     1626    usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
     1627
     1628    return LIBUSB_ERROR_NOT_FOUND;
     1629  }
     1630
     1631  itransfer->timeout_flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
     1632
     1633  if (IS_XFERIN(transfer))
     1634    ret = (*(cInterface->interface))->ReadStreamsPipeAsyncTO(cInterface->interface, pipeRef, itransfer->stream_id,
     1635                                                             transfer->buffer, transfer->length, transfer->timeout,
     1636                                                             transfer->timeout, darwin_async_io_callback, (void *)itransfer);
     1637  else
     1638    ret = (*(cInterface->interface))->WriteStreamsPipeAsyncTO(cInterface->interface, pipeRef, itransfer->stream_id,
     1639                                                              transfer->buffer, transfer->length, transfer->timeout,
     1640                                                              transfer->timeout, darwin_async_io_callback, (void *)itransfer);
     1641
     1642  if (ret)
     1643    usbi_err (TRANSFER_CTX (transfer), "bulk stream transfer failed (dir = %s): %s (code = 0x%08x)", IS_XFERIN(transfer) ? "In" : "Out",
     1644               darwin_error_str(ret), ret);
     1645
     1646  return darwin_to_libusb (ret);
     1647}
     1648#endif
     1649
    13621650static int submit_iso_transfer(struct usbi_transfer *itransfer) {
    13631651  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    13641652  struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
    1365   struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
    13661653
    13671654  IOReturn kresult;
    1368   uint8_t direction, number, interval, pipeRef, iface, transferType;
     1655  uint8_t direction, number, interval, pipeRef, transferType;
    13691656  uint16_t maxPacketSize;
    13701657  UInt64 frame;
     
    13921679
    13931680  /* determine the interface/endpoint to use */
    1394   if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface) != 0) {
     1681  if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, NULL, &cInterface) != 0) {
    13951682    usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
    13961683
     
    13981685  }
    13991686
    1400   cInterface = &priv->interfaces[iface];
     1687  /* determine the properties of this endpoint and the speed of the device */
     1688  (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
     1689                                                 &transferType, &maxPacketSize, &interval);
    14011690
    14021691  /* Last but not least we need the bus frame number */
     
    14291718                                                              itransfer);
    14301719
    1431   cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1)) / 8;
     1720  if (LIBUSB_SPEED_FULL == transfer->dev_handle->dev->speed)
     1721    /* Full speed */
     1722    cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1));
     1723  else
     1724    /* High/super speed */
     1725    cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1)) / 8;
    14321726
    14331727  if (kresult != kIOReturnSuccess) {
     
    14441738  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    14451739  struct libusb_control_setup *setup = (struct libusb_control_setup *) transfer->buffer;
    1446   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)transfer->dev_handle->dev->os_priv;
    1447   struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
     1740  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
    14481741  struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
    14491742
     
    14521745  bzero(&tpriv->req, sizeof(tpriv->req));
    14531746
    1454   /* IOUSBDeviceInterface expects the request in cpu endianess */
     1747  /* IOUSBDeviceInterface expects the request in cpu endianness */
    14551748  tpriv->req.bmRequestType     = setup->bmRequestType;
    14561749  tpriv->req.bRequest          = setup->bRequest;
     
    14641757  tpriv->req.noDataTimeout     = transfer->timeout;
    14651758
    1466   itransfer->flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
     1759  itransfer->timeout_flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
    14671760
    14681761  /* all transfers in libusb-1.0 are async */
     
    14701763  if (transfer->endpoint) {
    14711764    struct darwin_interface *cInterface;
    1472     uint8_t                 pipeRef, iface;
    1473 
    1474     if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface) != 0) {
     1765    uint8_t                 pipeRef;
     1766
     1767    if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, NULL, &cInterface) != 0) {
    14751768      usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
    14761769
    14771770      return LIBUSB_ERROR_NOT_FOUND;
    14781771    }
    1479 
    1480     cInterface = &priv->interfaces[iface];
    14811772
    14821773    kresult = (*(cInterface->interface))->ControlRequestAsyncTO (cInterface->interface, pipeRef, &(tpriv->req), darwin_async_io_callback, itransfer);
     
    15021793  case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
    15031794    return submit_iso_transfer(itransfer);
     1795  case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
     1796#if InterfaceVersion >= 550
     1797    return submit_stream_transfer(itransfer);
     1798#else
     1799    usbi_err (TRANSFER_CTX(transfer), "IOUSBFamily version does not support bulk stream transfers");
     1800    return LIBUSB_ERROR_NOT_SUPPORTED;
     1801#endif
    15041802  default:
    15051803    usbi_err (TRANSFER_CTX(transfer), "unknown endpoint type %d", transfer->type);
     
    15101808static int cancel_control_transfer(struct usbi_transfer *itransfer) {
    15111809  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    1512   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)transfer->dev_handle->dev->os_priv;
     1810  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
    15131811  IOReturn kresult;
    15141812
    1515   usbi_info (ITRANSFER_CTX (itransfer), "WARNING: aborting all transactions control pipe");
     1813  usbi_warn (ITRANSFER_CTX (itransfer), "aborting all transactions control pipe");
    15161814
    15171815  if (!dpriv->device)
     
    15251823static int darwin_abort_transfers (struct usbi_transfer *itransfer) {
    15261824  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    1527   struct darwin_device_priv *dpriv = (struct darwin_device_priv *)transfer->dev_handle->dev->os_priv;
    1528   struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
     1825  struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
    15291826  struct darwin_interface *cInterface;
    15301827  uint8_t pipeRef, iface;
    15311828  IOReturn kresult;
    15321829
    1533   if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface) != 0) {
     1830  if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface, &cInterface) != 0) {
    15341831    usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
    15351832
    15361833    return LIBUSB_ERROR_NOT_FOUND;
    15371834  }
    1538 
    1539   cInterface = &priv->interfaces[iface];
    15401835
    15411836  if (!dpriv->device)
    15421837    return LIBUSB_ERROR_NO_DEVICE;
    15431838
    1544   usbi_info (ITRANSFER_CTX (itransfer), "WARNING: aborting all transactions on interface %d pipe %d", iface, pipeRef);
     1839  usbi_warn (ITRANSFER_CTX (itransfer), "aborting all transactions on interface %d pipe %d", iface, pipeRef);
    15451840
    15461841  /* abort transactions */
    1547   (*(cInterface->interface))->AbortPipe (cInterface->interface, pipeRef);
    1548 
    1549   usbi_info (ITRANSFER_CTX (itransfer), "calling clear pipe stall to clear the data toggle bit");
    1550 
    1551   /* clear the data toggle bit */
    1552 #if (InterfaceVersion < 190)
    1553   kresult = (*(cInterface->interface))->ClearPipeStall(cInterface->interface, pipeRef);
    1554 #else
     1842#if InterfaceVersion >= 550
     1843  if (LIBUSB_TRANSFER_TYPE_BULK_STREAM == transfer->type)
     1844    (*(cInterface->interface))->AbortStreamsPipe (cInterface->interface, pipeRef, itransfer->stream_id);
     1845  else
     1846#endif
     1847    (*(cInterface->interface))->AbortPipe (cInterface->interface, pipeRef);
     1848
     1849  usbi_dbg ("calling clear pipe stall to clear the data toggle bit");
     1850
    15551851  /* newer versions of darwin support clearing additional bits on the device's endpoint */
    15561852  kresult = (*(cInterface->interface))->ClearPipeStallBothEnds(cInterface->interface, pipeRef);
    1557 #endif
    15581853
    15591854  return darwin_to_libusb (kresult);
     
    15891884  struct usbi_transfer *itransfer = (struct usbi_transfer *)refcon;
    15901885  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    1591   struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
    1592   UInt32 message, size;
    1593 
    1594   usbi_info (ITRANSFER_CTX (itransfer), "an async io operation has completed");
     1886  struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
     1887
     1888  usbi_dbg ("an async io operation has completed");
    15951889
    15961890  /* if requested write a zero packet */
    15971891  if (kIOReturnSuccess == result && IS_XFEROUT(transfer) && transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) {
    15981892    struct darwin_interface *cInterface;
    1599     uint8_t iface, pipeRef;
    1600 
    1601     (void) ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface);
    1602     cInterface = &priv->interfaces[iface];
     1893    uint8_t pipeRef;
     1894
     1895    (void) ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, NULL, &cInterface);
    16031896
    16041897    (*(cInterface->interface))->WritePipe (cInterface->interface, pipeRef, transfer->buffer, 0);
    16051898  }
    16061899
    1607   size = (UInt32) (uintptr_t) arg0;
    1608 
    1609   /* send a completion message to the device's file descriptor */
    1610   message = MESSAGE_ASYNC_IO_COMPLETE;
    1611   write (priv->fds[1], &message, sizeof (message));
    1612   write (priv->fds[1], &itransfer, sizeof (itransfer));
    1613   write (priv->fds[1], &result, sizeof (IOReturn));
    1614   write (priv->fds[1], &size, sizeof (size));
     1900  tpriv->result = result;
     1901  tpriv->size = (UInt32) (uintptr_t) arg0;
     1902
     1903  /* signal the core that this transfer is complete */
     1904  usbi_signal_transfer_completion(itransfer);
    16151905}
    16161906
    16171907static int darwin_transfer_status (struct usbi_transfer *itransfer, kern_return_t result) {
    1618   if (itransfer->flags & USBI_TRANSFER_TIMED_OUT)
     1908  if (itransfer->timeout_flags & USBI_TRANSFER_TIMED_OUT)
    16191909    result = kIOUSBTransactionTimeout;
    16201910
     
    16261916    return LIBUSB_TRANSFER_CANCELLED;
    16271917  case kIOUSBPipeStalled:
    1628     usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: pipe is stalled");
     1918    usbi_dbg ("transfer error: pipe is stalled");
    16291919    return LIBUSB_TRANSFER_STALL;
    16301920  case kIOReturnOverrun:
    1631     usbi_err (ITRANSFER_CTX (itransfer), "transfer error: data overrun");
     1921    usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: data overrun");
    16321922    return LIBUSB_TRANSFER_OVERFLOW;
    16331923  case kIOUSBTransactionTimeout:
    1634     usbi_err (ITRANSFER_CTX (itransfer), "transfer error: timed out");
    1635     itransfer->flags |= USBI_TRANSFER_TIMED_OUT;
     1924    usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: timed out");
     1925    itransfer->timeout_flags |= USBI_TRANSFER_TIMED_OUT;
    16361926    return LIBUSB_TRANSFER_TIMED_OUT;
    16371927  default:
    1638     usbi_err (ITRANSFER_CTX (itransfer), "transfer error: %s (value = 0x%08x)", darwin_error_str (result), result);
     1928    usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: %s (value = 0x%08x)", darwin_error_str (result), result);
    16391929    return LIBUSB_TRANSFER_ERROR;
    16401930  }
    16411931}
    16421932
    1643 static void darwin_handle_callback (struct usbi_transfer *itransfer, kern_return_t result, UInt32 io_size) {
     1933static int darwin_handle_transfer_completion (struct usbi_transfer *itransfer) {
    16441934  struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
    16451935  struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
     
    16521942  if (!isIsoc && !isBulk && !isControl && !isInterrupt) {
    16531943    usbi_err (TRANSFER_CTX(transfer), "unknown endpoint type %d", transfer->type);
    1654     return;
    1655   }
    1656 
    1657   usbi_info (ITRANSFER_CTX (itransfer), "handling %s completion with kernel status %d",
    1658              isControl ? "control" : isBulk ? "bulk" : isIsoc ? "isoc" : "interrupt", result);
    1659 
    1660   if (kIOReturnSuccess == result || kIOReturnUnderrun == result) {
     1944    return LIBUSB_ERROR_INVALID_PARAM;
     1945  }
     1946
     1947  usbi_dbg ("handling %s completion with kernel status %d",
     1948             isControl ? "control" : isBulk ? "bulk" : isIsoc ? "isoc" : "interrupt", tpriv->result);
     1949
     1950  if (kIOReturnSuccess == tpriv->result || kIOReturnUnderrun == tpriv->result) {
    16611951    if (isIsoc && tpriv->isoc_framelist) {
    16621952      /* copy isochronous results back */
     
    16681958      }
    16691959    } else if (!isIsoc)
    1670       itransfer->transferred += io_size;
     1960      itransfer->transferred += tpriv->size;
    16711961  }
    16721962
    16731963  /* it is ok to handle cancelled transfers without calling usbi_handle_transfer_cancellation (we catch timeout transfers) */
    1674   usbi_handle_transfer_completion (itransfer, darwin_transfer_status (itransfer, result));
    1675 }
    1676 
    1677 static int op_handle_events(struct libusb_context *ctx, struct pollfd *fds, POLL_NFDS_TYPE nfds, int num_ready) {
    1678   struct usbi_transfer *itransfer;
    1679   UInt32 io_size;
    1680   IOReturn kresult;
    1681   POLL_NFDS_TYPE i = 0;
    1682   ssize_t ret;
    1683   UInt32 message;
    1684 
    1685   usbi_mutex_lock(&ctx->open_devs_lock);
    1686   for (i = 0; i < nfds && num_ready > 0; i++) {
    1687     struct pollfd *pollfd = &fds[i];
    1688     struct libusb_device_handle *handle;
    1689     struct darwin_device_handle_priv *hpriv = NULL;
    1690 
    1691     usbi_info (ctx, "checking fd %i with revents = %x", fds[i], pollfd->revents);
    1692 
    1693     if (!pollfd->revents)
    1694       continue;
    1695 
    1696     num_ready--;
    1697     list_for_each_entry(handle, &ctx->open_devs, list, struct libusb_device_handle) {
    1698       hpriv =  (struct darwin_device_handle_priv *)handle->os_priv;
    1699       if (hpriv->fds[0] == pollfd->fd)
    1700         break;
    1701     }
    1702 
    1703     if (!(pollfd->revents & POLLERR)) {
    1704       ret = read (hpriv->fds[0], &message, sizeof (message));
    1705       if (ret < (ssize_t)sizeof (message))
    1706         continue;
    1707     } else {
    1708       /* could not poll the device-- response is to delete the device (this seems a little heavy-handed) */
    1709       /* remove the device's async port from the runloop */
    1710       if (hpriv->cfSource) {
    1711         if (libusb_darwin_acfl)
    1712           CFRunLoopRemoveSource (libusb_darwin_acfl, hpriv->cfSource, kCFRunLoopDefaultMode);
    1713         CFRelease (hpriv->cfSource);
    1714         hpriv->cfSource = NULL;
    1715       }
    1716 
    1717       usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->fds[0]);
    1718       usbi_handle_disconnect(handle);
    1719 
    1720       /* done with this device */
    1721     }
    1722 
    1723     switch (message) {
    1724     case MESSAGE_ASYNC_IO_COMPLETE:
    1725       read (hpriv->fds[0], &itransfer, sizeof (itransfer));
    1726       read (hpriv->fds[0], &kresult, sizeof (IOReturn));
    1727       read (hpriv->fds[0], &io_size, sizeof (UInt32));
    1728 
    1729       darwin_handle_callback (itransfer, kresult, io_size);
    1730       break;
    1731     default:
    1732       usbi_err (ctx, "unknown message received from device pipe");
    1733     }
    1734   }
    1735 
    1736   usbi_mutex_unlock(&ctx->open_devs_lock);
    1737 
    1738   return 0;
     1964  return usbi_handle_transfer_completion (itransfer, darwin_transfer_status (itransfer, tpriv->result));
    17391965}
    17401966
     
    17641990}
    17651991
     1992#if InterfaceVersion >= 550
     1993static int darwin_alloc_streams (struct libusb_device_handle *dev_handle, uint32_t num_streams, unsigned char *endpoints,
     1994                                 int num_endpoints) {
     1995  struct darwin_interface *cInterface;
     1996  UInt32 supportsStreams;
     1997  uint8_t pipeRef;
     1998  int rc, i;
     1999
     2000  /* find the mimimum number of supported streams on the endpoint list */
     2001  for (i = 0 ; i < num_endpoints ; ++i) {
     2002    if (0 != (rc = ep_to_pipeRef (dev_handle, endpoints[i], &pipeRef, NULL, &cInterface))) {
     2003      return rc;
     2004    }
     2005
     2006    (*(cInterface->interface))->SupportsStreams (cInterface->interface, pipeRef, &supportsStreams);
     2007    if (num_streams > supportsStreams)
     2008      num_streams = supportsStreams;
     2009  }
     2010
     2011  /* it is an error if any endpoint in endpoints does not support streams */
     2012  if (0 == num_streams)
     2013    return LIBUSB_ERROR_INVALID_PARAM;
     2014
     2015  /* create the streams */
     2016  for (i = 0 ; i < num_endpoints ; ++i) {
     2017    (void) ep_to_pipeRef (dev_handle, endpoints[i], &pipeRef, NULL, &cInterface);
     2018
     2019    rc = (*(cInterface->interface))->CreateStreams (cInterface->interface, pipeRef, num_streams);
     2020    if (kIOReturnSuccess != rc)
     2021      return darwin_to_libusb(rc);
     2022  }
     2023
     2024  return num_streams;
     2025}
     2026
     2027static int darwin_free_streams (struct libusb_device_handle *dev_handle, unsigned char *endpoints, int num_endpoints) {
     2028  struct darwin_interface *cInterface;
     2029  UInt32 supportsStreams;
     2030  uint8_t pipeRef;
     2031  int rc;
     2032
     2033  for (int i = 0 ; i < num_endpoints ; ++i) {
     2034    if (0 != (rc = ep_to_pipeRef (dev_handle, endpoints[i], &pipeRef, NULL, &cInterface)))
     2035      return rc;
     2036
     2037    (*(cInterface->interface))->SupportsStreams (cInterface->interface, pipeRef, &supportsStreams);
     2038    if (0 == supportsStreams)
     2039      return LIBUSB_ERROR_INVALID_PARAM;
     2040
     2041    rc = (*(cInterface->interface))->CreateStreams (cInterface->interface, pipeRef, 0);
     2042    if (kIOReturnSuccess != rc)
     2043      return darwin_to_libusb(rc);
     2044  }
     2045
     2046  return LIBUSB_SUCCESS;
     2047}
     2048#endif
     2049
    17662050const struct usbi_os_backend darwin_backend = {
    17672051        .name = "Darwin",
     2052        .caps = 0,
    17682053        .init = darwin_init,
    17692054        .exit = darwin_exit,
     
    17722057        .get_active_config_descriptor = darwin_get_active_config_descriptor,
    17732058        .get_config_descriptor = darwin_get_config_descriptor,
     2059        .hotplug_poll = darwin_hotplug_poll,
    17742060
    17752061        .open = darwin_open,
     
    17842070        .reset_device = darwin_reset_device,
    17852071
     2072#if InterfaceVersion >= 550
     2073        .alloc_streams = darwin_alloc_streams,
     2074        .free_streams = darwin_free_streams,
     2075#endif
     2076
    17862077        .kernel_driver_active = darwin_kernel_driver_active,
    17872078        .detach_kernel_driver = darwin_detach_kernel_driver,
     
    17942085        .clear_transfer_priv = darwin_clear_transfer_priv,
    17952086
    1796         .handle_events = op_handle_events,
     2087        .handle_transfer_completion = darwin_handle_transfer_completion,
    17972088
    17982089        .clock_gettime = darwin_clock_gettime,
     
    18012092        .device_handle_priv_size = sizeof(struct darwin_device_handle_priv),
    18022093        .transfer_priv_size = sizeof(struct darwin_transfer_priv),
    1803         .add_iso_packet_size = 0,
    18042094};
    1805 
  • TabularUnified libusb1/trunk/libusb/os/darwin_usb.h

    r1876 r1882  
    11/*
    22 * darwin backend for libusb 1.0
    3  * Copyright (C) 2008-2009 Nathan Hjelm <hjelmn@users.sourceforge.net>
     3 * Copyright © 2008-2015 Nathan Hjelm <hjelmn@users.sourceforge.net>
    44 *
    55 * This library is free software; you can redistribute it and/or
     
    2929
    3030/* IOUSBInterfaceInferface */
    31 #if defined (kIOUSBInterfaceInterfaceID300)
     31#if defined (kIOUSBInterfaceInterfaceID700) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
     32
     33#define usb_interface_t IOUSBInterfaceInterface700
     34#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID700
     35#define InterfaceVersion 700
     36
     37#elif defined (kIOUSBInterfaceInterfaceID550) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
     38
     39#define usb_interface_t IOUSBInterfaceInterface550
     40#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID550
     41#define InterfaceVersion 550
     42
     43#elif defined (kIOUSBInterfaceInterfaceID500)
     44
     45#define usb_interface_t IOUSBInterfaceInterface500
     46#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID500
     47#define InterfaceVersion 500
     48
     49#elif defined (kIOUSBInterfaceInterfaceID300)
    3250
    3351#define usb_interface_t IOUSBInterfaceInterface300
     
    4765#define InterfaceVersion 220
    4866
    49 #elif defined (kIOUSBInterfaceInterfaceID197)
    50 
    51 #define usb_interface_t IOUSBInterfaceInterface197
    52 #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID197
    53 #define InterfaceVersion 197
    54 
    55 #elif defined (kIOUSBInterfaceInterfaceID190)
    56 
    57 #define usb_interface_t IOUSBInterfaceInterface190
    58 #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID190
    59 #define InterfaceVersion 190
    60 
    61 #elif defined (kIOUSBInterfaceInterfaceID182)
    62 
    63 #define usb_interface_t IOUSBInterfaceInterface182
    64 #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID182
    65 #define InterfaceVersion 182
    66 
    6767#else
    6868
     
    7272
    7373/* IOUSBDeviceInterface */
    74 #if defined (kIOUSBDeviceInterfaceID500)
     74#if defined (kIOUSBDeviceInterfaceID500) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
    7575
    7676#define usb_device_t    IOUSBDeviceInterface500
     
    9696#define DeviceVersion 245
    9797
    98 #elif defined (kIOUSBDeviceInterfaceID197)
    99 
     98#elif defined (kIOUSBDeviceInterfaceID220)
    10099#define usb_device_t    IOUSBDeviceInterface197
    101100#define DeviceInterfaceID kIOUSBDeviceInterfaceID197
    102101#define DeviceVersion 197
    103 
    104 #elif defined (kIOUSBDeviceInterfaceID187)
    105 
    106 #define usb_device_t    IOUSBDeviceInterface187
    107 #define DeviceInterfaceID kIOUSBDeviceInterfaceID187
    108 #define DeviceVersion 187
    109 
    110 #elif defined (kIOUSBDeviceInterfaceID182)
    111 
    112 #define usb_device_t    IOUSBDeviceInterface182
    113 #define DeviceInterfaceID kIOUSBDeviceInterfaceID182
    114 #define DeviceVersion 182
    115102
    116103#else
     
    128115
    129116/* private structures */
    130 struct darwin_device_priv {
     117struct darwin_cached_device {
     118  struct list_head      list;
    131119  IOUSBDeviceDescriptor dev_descriptor;
    132120  UInt32                location;
     121  UInt64                parent_session;
     122  UInt64                session;
     123  UInt16                address;
    133124  char                  sys_path[21];
    134125  usb_device_t        **device;
    135126  int                   open_count;
    136   UInt8                 first_config, active_config;
     127  UInt8                 first_config, active_config, port; 
     128  int                   can_enumerate;
     129  int                   refcount;
     130};
     131
     132struct darwin_device_priv {
     133  struct darwin_cached_device *dev;
    137134};
    138135
     
    140137  int                  is_open;
    141138  CFRunLoopSourceRef   cfSource;
    142   int                  fds[2];
    143139
    144140  struct darwin_interface {
     
    147143    CFRunLoopSourceRef   cfSource;
    148144    uint64_t             frames[256];
    149     uint8_t            endpoint_addrs[USB_MAXENDPOINTS];
     145    uint8_t              endpoint_addrs[USB_MAXENDPOINTS];
    150146  } interfaces[USB_MAXINTERFACES];
    151147};
     
    157153
    158154  /* Control */
    159 #if !defined (LIBUSB_NO_TIMEOUT_DEVICE)
    160155  IOUSBDevRequestTO req;
    161 #else
    162   IOUSBDevRequest req;
    163 #endif
    164156
    165157  /* Bulk */
    166 };
    167158
    168 enum {
    169   MESSAGE_ASYNC_IO_COMPLETE
     159  /* Completion status */
     160  IOReturn result;
     161  UInt32 size;
    170162};
    171163
  • TabularUnified libusb1/trunk/libusb/os/linux_netlink.c

    r1876 r1882  
    55 * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
    66 * Copyright (c) 2013 Nathan Hjelm <hjelmn@mac.com>
     7 * Copyright (c) 2016 Chris Dickens <christopher.a.dickens@gmail.com>
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    2122 */
    2223
    23 #include "config.h"
    24 #include <ctype.h>
    25 #include <dirent.h>
     24#include <config.h>
     25
     26#include <assert.h>
    2627#include <errno.h>
    2728#include <fcntl.h>
     
    3031#include <stdlib.h>
    3132#include <string.h>
     33#include <unistd.h>
    3234#include <sys/types.h>
     35
     36#ifdef HAVE_ASM_TYPES_H
     37#include <asm/types.h>
     38#endif
     39
    3340#include <sys/socket.h>
    34 #include <arpa/inet.h>
    35 
    36 #include "libusb.h"
     41#include <linux/netlink.h>
     42
    3743#include "libusbi.h"
    3844#include "linux_usbfs.h"
    3945
    40 #include <linux/netlink.h>
    41 #include <linux/filter.h>
    42 
    43 #define KERNEL 1
     46#define NL_GROUP_KERNEL 1
    4447
    4548static int linux_netlink_socket = -1;
     49static int netlink_control_pipe[2] = { -1, -1 };
    4650static pthread_t libusb_linux_event_thread;
    4751
    4852static void *linux_netlink_event_thread_main(void *arg);
    4953
    50 struct sockaddr_nl snl = { .nl_family=AF_NETLINK, .nl_groups=KERNEL };
     54static int set_fd_cloexec_nb(int fd)
     55{
     56        int flags;
     57
     58#if defined(FD_CLOEXEC)
     59        flags = fcntl(fd, F_GETFD);
     60        if (flags == -1) {
     61                usbi_err(NULL, "failed to get netlink fd flags (%d)", errno);
     62                return -1;
     63        }
     64
     65        if (!(flags & FD_CLOEXEC)) {
     66                if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
     67                        usbi_err(NULL, "failed to set netlink fd flags (%d)", errno);
     68                        return -1;
     69                }
     70        }
     71#endif
     72
     73        flags = fcntl(fd, F_GETFL);
     74        if (flags == -1) {
     75                usbi_err(NULL, "failed to get netlink fd status flags (%d)", errno);
     76                return -1;
     77        }
     78
     79        if (!(flags & O_NONBLOCK)) {
     80                if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
     81                        usbi_err(NULL, "failed to set netlink fd status flags (%d)", errno);
     82                        return -1;
     83                }
     84        }
     85
     86        return 0;
     87}
    5188
    5289int linux_netlink_start_event_monitor(void)
    5390{
     91        struct sockaddr_nl sa_nl = { .nl_family = AF_NETLINK, .nl_groups = NL_GROUP_KERNEL };
     92        int socktype = SOCK_RAW;
     93        int opt = 1;
    5494        int ret;
    5595
    56         snl.nl_groups = KERNEL;
    57 
    58         linux_netlink_socket = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT);
    59         if (-1 == linux_netlink_socket) {
    60                 return LIBUSB_ERROR_OTHER;
    61         }
    62 
    63         ret = bind(linux_netlink_socket, (struct sockaddr *) &snl, sizeof(snl));
    64         if (0 != ret) {
    65                 return LIBUSB_ERROR_OTHER;
    66         }
    67 
    68         /* TODO -- add authentication */
    69         /* setsockopt(linux_netlink_socket, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); */
     96#if defined(SOCK_CLOEXEC)
     97        socktype |= SOCK_CLOEXEC;
     98#endif
     99#if defined(SOCK_NONBLOCK)
     100        socktype |= SOCK_NONBLOCK;
     101#endif
     102
     103        linux_netlink_socket = socket(PF_NETLINK, socktype, NETLINK_KOBJECT_UEVENT);
     104        if (linux_netlink_socket == -1 && errno == EINVAL) {
     105                usbi_dbg("failed to create netlink socket of type %d, attempting SOCK_RAW", socktype);
     106                linux_netlink_socket = socket(PF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
     107        }
     108
     109        if (linux_netlink_socket == -1) {
     110                usbi_err(NULL, "failed to create netlink socket (%d)", errno);
     111                goto err;
     112        }
     113
     114        ret = set_fd_cloexec_nb(linux_netlink_socket);
     115        if (ret == -1)
     116                goto err_close_socket;
     117
     118        ret = bind(linux_netlink_socket, (struct sockaddr *)&sa_nl, sizeof(sa_nl));
     119        if (ret == -1) {
     120                usbi_err(NULL, "failed to bind netlink socket (%d)", errno);
     121                goto err_close_socket;
     122        }
     123
     124        ret = setsockopt(linux_netlink_socket, SOL_SOCKET, SO_PASSCRED, &opt, sizeof(opt));
     125        if (ret == -1) {
     126                usbi_err(NULL, "failed to set netlink socket SO_PASSCRED option (%d)", errno);
     127                goto err_close_socket;
     128        }
     129
     130        ret = usbi_pipe(netlink_control_pipe);
     131        if (ret) {
     132                usbi_err(NULL, "failed to create netlink control pipe");
     133                goto err_close_socket;
     134        }
    70135
    71136        ret = pthread_create(&libusb_linux_event_thread, NULL, linux_netlink_event_thread_main, NULL);
    72         if (0 != ret) {
    73                 return LIBUSB_ERROR_OTHER;
     137        if (ret != 0) {
     138                usbi_err(NULL, "failed to create netlink event thread (%d)", ret);
     139                goto err_close_pipe;
    74140        }
    75141
    76142        return LIBUSB_SUCCESS;
     143
     144err_close_pipe:
     145        close(netlink_control_pipe[0]);
     146        close(netlink_control_pipe[1]);
     147        netlink_control_pipe[0] = -1;
     148        netlink_control_pipe[1] = -1;
     149err_close_socket:
     150        close(linux_netlink_socket);
     151        linux_netlink_socket = -1;
     152err:
     153        return LIBUSB_ERROR_OTHER;
    77154}
    78155
    79156int linux_netlink_stop_event_monitor(void)
    80157{
    81         int r;
    82 
    83         if (-1 == linux_netlink_socket) {
    84                 /* already closed. nothing to do */
    85                 return LIBUSB_SUCCESS;
    86         }
    87 
    88         r = close(linux_netlink_socket);
    89         if (0 > r) {
    90                 usbi_err(NULL, "error closing netlink socket. %s", strerror(errno));
    91                 return LIBUSB_ERROR_OTHER;
    92         }
    93 
    94         pthread_cancel(libusb_linux_event_thread);
    95 
     158        char dummy = 1;
     159        ssize_t r;
     160
     161        assert(linux_netlink_socket != -1);
     162
     163        /* Write some dummy data to the control pipe and
     164         * wait for the thread to exit */
     165        r = usbi_write(netlink_control_pipe[1], &dummy, sizeof(dummy));
     166        if (r <= 0)
     167                usbi_warn(NULL, "netlink control pipe signal failed");
     168
     169        pthread_join(libusb_linux_event_thread, NULL);
     170
     171        close(linux_netlink_socket);
    96172        linux_netlink_socket = -1;
    97173
     174        /* close and reset control pipe */
     175        close(netlink_control_pipe[0]);
     176        close(netlink_control_pipe[1]);
     177        netlink_control_pipe[0] = -1;
     178        netlink_control_pipe[1] = -1;
     179
    98180        return LIBUSB_SUCCESS;
    99181}
    100182
    101 static const char *netlink_message_parse (const char *buffer, size_t len, const char *key)
    102 {
     183static const char *netlink_message_parse(const char *buffer, size_t len, const char *key)
     184{
     185        const char *end = buffer + len;
    103186        size_t keylen = strlen(key);
    104         size_t offset;
    105 
    106         for (offset = 0 ; offset < len && '\0' != buffer[offset] ; offset += strlen(buffer + offset) + 1) {
    107                 if (0 == strncmp(buffer + offset, key, keylen) &&
    108                     '=' == buffer[offset + keylen]) {
    109                         return buffer + offset + keylen + 1;
    110                 }
     187
     188        while (buffer < end && *buffer) {
     189                if (strncmp(buffer, key, keylen) == 0 && buffer[keylen] == '=')
     190                        return buffer + keylen + 1;
     191                buffer += strlen(buffer) + 1;
    111192        }
    112193
     
    115196
    116197/* parse parts of netlink message common to both libudev and the kernel */
    117 static int linux_netlink_parse(char *buffer, size_t len, int *detached, const char **sys_name,
    118                                uint8_t *busnum, uint8_t *devaddr) {
    119         const char *tmp;
    120         int i;
     198static int linux_netlink_parse(const char *buffer, size_t len, int *detached,
     199        const char **sys_name, uint8_t *busnum, uint8_t *devaddr)
     200{
     201        const char *tmp, *slash;
    121202
    122203        errno = 0;
     
    127208        *devaddr  = 0;
    128209
    129         tmp = netlink_message_parse((const char *) buffer, len, "ACTION");
    130         if (0 == strcmp(tmp, "remove")) {
     210        tmp = netlink_message_parse(buffer, len, "ACTION");
     211        if (!tmp) {
     212                return -1;
     213        } else if (strcmp(tmp, "remove") == 0) {
    131214                *detached = 1;
    132         } else if (0 != strcmp(tmp, "add")) {
    133                 usbi_dbg("unknown device action");
     215        } else if (strcmp(tmp, "add") != 0) {
     216                usbi_dbg("unknown device action %s", tmp);
    134217                return -1;
    135218        }
     
    137220        /* check that this is a usb message */
    138221        tmp = netlink_message_parse(buffer, len, "SUBSYSTEM");
    139         if (NULL == tmp || 0 != strcmp(tmp, "usb")) {
     222        if (!tmp || strcmp(tmp, "usb") != 0) {
    140223                /* not usb. ignore */
    141224                return -1;
    142225        }
    143226
     227        /* check that this is an actual usb device */
     228        tmp = netlink_message_parse(buffer, len, "DEVTYPE");
     229        if (!tmp || strcmp(tmp, "usb_device") != 0) {
     230                /* not usb. ignore */
     231                return -1;
     232        }
     233
    144234        tmp = netlink_message_parse(buffer, len, "BUSNUM");
    145         if (NULL == tmp) {
    146                 /* no bus number (likely a usb interface). ignore*/
    147                 return -1;
    148         }
    149 
    150         *busnum = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
    151         if (errno) {
    152                 errno = 0;
    153                 return -1;
    154         }
    155 
    156         tmp = netlink_message_parse(buffer, len, "DEVNUM");
    157         if (NULL == tmp) {
    158                 return -1;
    159         }
    160 
    161         *devaddr = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
    162         if (errno) {
    163                 errno = 0;
    164                 return -1;
     235        if (tmp) {
     236                *busnum = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
     237                if (errno) {
     238                        errno = 0;
     239                        return -1;
     240                }
     241
     242                tmp = netlink_message_parse(buffer, len, "DEVNUM");
     243                if (NULL == tmp)
     244                        return -1;
     245
     246                *devaddr = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
     247                if (errno) {
     248                        errno = 0;
     249                        return -1;
     250                }
     251        } else {
     252                /* no bus number. try "DEVICE" */
     253                tmp = netlink_message_parse(buffer, len, "DEVICE");
     254                if (!tmp) {
     255                        /* not usb. ignore */
     256                        return -1;
     257                }
     258
     259                /* Parse a device path such as /dev/bus/usb/003/004 */
     260                slash = strrchr(tmp, '/');
     261                if (!slash)
     262                        return -1;
     263
     264                *busnum = (uint8_t)(strtoul(slash - 3, NULL, 10) & 0xff);
     265                if (errno) {
     266                        errno = 0;
     267                        return -1;
     268                }
     269
     270                *devaddr = (uint8_t)(strtoul(slash + 1, NULL, 10) & 0xff);
     271                if (errno) {
     272                        errno = 0;
     273                        return -1;
     274                }
     275
     276                return 0;
    165277        }
    166278
    167279        tmp = netlink_message_parse(buffer, len, "DEVPATH");
    168         if (NULL == tmp) {
    169                 return -1;
    170         }
    171 
    172         for (i = strlen(tmp) - 1 ; i ; --i) {
    173                 if ('/' ==tmp[i]) {
    174                         *sys_name = tmp + i + 1;
    175                         break;
    176                 }
    177         }
     280        if (!tmp)
     281                return -1;
     282
     283        slash = strrchr(tmp, '/');
     284        if (slash)
     285                *sys_name = slash + 1;
    178286
    179287        /* found a usb device */
     
    181289}
    182290
    183 static void *linux_netlink_event_thread_main(void *arg)
    184 {
    185         struct pollfd fds = {.fd = linux_netlink_socket,
    186                              .events = POLLIN};
    187         unsigned char buffer[1024];
    188         struct iovec iov = {.iov_base = buffer, .iov_len = sizeof(buffer)};
    189         struct msghdr meh = { .msg_iov=&iov, .msg_iovlen=1,
    190                              .msg_name=&snl, .msg_namelen=sizeof(snl) };
     291static int linux_netlink_read_message(void)
     292{
     293        char cred_buffer[CMSG_SPACE(sizeof(struct ucred))];
     294        char msg_buffer[2048];
     295        const char *sys_name = NULL;
    191296        uint8_t busnum, devaddr;
    192297        int detached, r;
    193         size_t len;
    194 
    195         /* silence compiler warning */
    196         (void) arg;
    197 
    198         while (1 == poll(&fds, 1, -1)) {
    199                 const char *sys_name = NULL;
    200 
    201                 if (POLLIN != fds.revents) {
     298        ssize_t len;
     299        struct cmsghdr *cmsg;
     300        struct ucred *cred;
     301        struct sockaddr_nl sa_nl;
     302        struct iovec iov = { .iov_base = msg_buffer, .iov_len = sizeof(msg_buffer) };
     303        struct msghdr msg = {
     304                .msg_iov = &iov, .msg_iovlen = 1,
     305                .msg_control = cred_buffer, .msg_controllen = sizeof(cred_buffer),
     306                .msg_name = &sa_nl, .msg_namelen = sizeof(sa_nl)
     307        };
     308
     309        /* read netlink message */
     310        len = recvmsg(linux_netlink_socket, &msg, 0);
     311        if (len == -1) {
     312                if (errno != EAGAIN && errno != EINTR)
     313                        usbi_err(NULL, "error receiving message from netlink (%d)", errno);
     314                return -1;
     315        }
     316
     317        if (len < 32 || (msg.msg_flags & MSG_TRUNC)) {
     318                usbi_err(NULL, "invalid netlink message length");
     319                return -1;
     320        }
     321
     322        if (sa_nl.nl_groups != NL_GROUP_KERNEL || sa_nl.nl_pid != 0) {
     323                usbi_dbg("ignoring netlink message from unknown group/PID (%u/%u)",
     324                         (unsigned int)sa_nl.nl_groups, (unsigned int)sa_nl.nl_pid);
     325                return -1;
     326        }
     327
     328        cmsg = CMSG_FIRSTHDR(&msg);
     329        if (!cmsg || cmsg->cmsg_type != SCM_CREDENTIALS) {
     330                usbi_dbg("ignoring netlink message with no sender credentials");
     331                return -1;
     332        }
     333
     334        cred = (struct ucred *)CMSG_DATA(cmsg);
     335        if (cred->uid != 0) {
     336                usbi_dbg("ignoring netlink message with non-zero sender UID %u", (unsigned int)cred->uid);
     337                return -1;
     338        }
     339
     340        r = linux_netlink_parse(msg_buffer, (size_t)len, &detached, &sys_name, &busnum, &devaddr);
     341        if (r)
     342                return r;
     343
     344        usbi_dbg("netlink hotplug found device busnum: %hhu, devaddr: %hhu, sys_name: %s, removed: %s",
     345                 busnum, devaddr, sys_name, detached ? "yes" : "no");
     346
     347        /* signal device is available (or not) to all contexts */
     348        if (detached)
     349                linux_device_disconnected(busnum, devaddr);
     350        else
     351                linux_hotplug_enumerate(busnum, devaddr, sys_name);
     352
     353        return 0;
     354}
     355
     356static void *linux_netlink_event_thread_main(void *arg)
     357{
     358        char dummy;
     359        ssize_t r;
     360        struct pollfd fds[] = {
     361                { .fd = netlink_control_pipe[0],
     362                  .events = POLLIN },
     363                { .fd = linux_netlink_socket,
     364                  .events = POLLIN },
     365        };
     366
     367        UNUSED(arg);
     368
     369        usbi_dbg("netlink event thread entering");
     370
     371        while (poll(fds, 2, -1) >= 0) {
     372                if (fds[0].revents & POLLIN) {
     373                        /* activity on control pipe, read the byte and exit */
     374                        r = usbi_read(netlink_control_pipe[0], &dummy, sizeof(dummy));
     375                        if (r <= 0)
     376                                usbi_warn(NULL, "netlink control pipe read failed");
    202377                        break;
    203378                }
    204 
    205                 /* read netlink message */
    206                 memset(buffer, 0, sizeof(buffer));
    207                 len = recvmsg(linux_netlink_socket, &meh, 0);
    208                 if (len < 32) {
    209                         usbi_dbg("error recieving message from netlink");
    210                         continue;
    211                 }
    212 
    213                 /* TODO -- authenticate this message is from the kernel or udevd */
    214 
    215                 r = linux_netlink_parse(buffer, len, &detached, &sys_name,
    216                                         &busnum, &devaddr);
    217                 if (r)
    218                         continue;
    219 
    220                 usbi_dbg("netlink hotplug found device busnum: %hhu, devaddr: %hhu, sys_name: %s, removed: %s",
    221                          busnum, devaddr, sys_name, detached ? "yes" : "no");
    222 
    223                 /* signal device is available (or not) to all contexts */
    224                 if (detached)
    225                         linux_hotplug_disconnected(busnum, devaddr, sys_name);
    226                 else
    227                         linux_hotplug_enumerate(busnum, devaddr, sys_name);
    228         }
    229 
    230         return NULL;   
    231 }
     379                if (fds[1].revents & POLLIN) {
     380                        usbi_mutex_static_lock(&linux_hotplug_lock);
     381                        linux_netlink_read_message();
     382                        usbi_mutex_static_unlock(&linux_hotplug_lock);
     383                }
     384        }
     385
     386        usbi_dbg("netlink event thread exiting");
     387
     388        return NULL;
     389}
     390
     391void linux_netlink_hotplug_poll(void)
     392{
     393        int r;
     394
     395        usbi_mutex_static_lock(&linux_hotplug_lock);
     396        do {
     397                r = linux_netlink_read_message();
     398        } while (r == 0);
     399        usbi_mutex_static_unlock(&linux_hotplug_lock);
     400}
  • TabularUnified libusb1/trunk/libusb/os/linux_udev.c

    r1876 r1882  
    2222
    2323#include <config.h>
     24
     25#include <assert.h>
    2426#include <ctype.h>
    2527#include <dirent.h>
     
    3840#include <libudev.h>
    3941
    40 #include "libusb.h"
    4142#include "libusbi.h"
    4243#include "linux_usbfs.h"
     
    4546static struct udev *udev_ctx = NULL;
    4647static int udev_monitor_fd = -1;
     48static int udev_control_pipe[2] = {-1, -1};
    4749static struct udev_monitor *udev_monitor = NULL;
    4850static pthread_t linux_event_thread;
    4951
    50 static void udev_hotplug_event(void);
     52static void udev_hotplug_event(struct udev_device* udev_dev);
    5153static void *linux_udev_event_thread_main(void *arg);
    5254
     
    5557        int r;
    5658
    57         if (NULL == udev_ctx) {
    58                 udev_ctx = udev_new();
    59                 if (!udev_ctx) {
    60                         return LIBUSB_ERROR_OTHER;
    61                 }
    62         }
    63 
    64         udev_monitor = udev_monitor_new_from_netlink(udev_ctx, "udev");
    65         if (!udev_monitor) {
    66                 usbi_err(NULL, "could not initialize udev monitor");
    67                 return LIBUSB_ERROR_OTHER;
    68         }
    69 
    70         r = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", 0);
    71         if (r) {
    72                 usbi_err(NULL, "could not initialize udev monitor filter for \"usb\" subsystem");
    73                 return LIBUSB_ERROR_OTHER;
    74         }
    75 
    76         if (udev_monitor_enable_receiving(udev_monitor)) {
    77                 usbi_err(NULL, "failed to enable the udev monitor");
    78                 return LIBUSB_ERROR_OTHER;
    79         }
    80 
    81         udev_monitor_fd = udev_monitor_get_fd(udev_monitor);
    82 
    83         pthread_create(&linux_event_thread, NULL, linux_udev_event_thread_main, NULL);
    84 
    85         return LIBUSB_SUCCESS;
     59        assert(udev_ctx == NULL);
     60        udev_ctx = udev_new();
     61        if (!udev_ctx) {
     62                usbi_err(NULL, "could not create udev context");
     63                goto err;
     64        }
     65
     66        udev_monitor = udev_monitor_new_from_netlink(udev_ctx, "udev");
     67        if (!udev_monitor) {
     68                usbi_err(NULL, "could not initialize udev monitor");
     69                goto err_free_ctx;
     70        }
     71
     72        r = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device");
     73        if (r) {
     74                usbi_err(NULL, "could not initialize udev monitor filter for \"usb\" subsystem");
     75                goto err_free_monitor;
     76        }
     77
     78        if (udev_monitor_enable_receiving(udev_monitor)) {
     79                usbi_err(NULL, "failed to enable the udev monitor");
     80                goto err_free_monitor;
     81        }
     82
     83        udev_monitor_fd = udev_monitor_get_fd(udev_monitor);
     84
     85        /* Some older versions of udev are not non-blocking by default,
     86         * so make sure this is set */
     87        r = fcntl(udev_monitor_fd, F_GETFL);
     88        if (r == -1) {
     89                usbi_err(NULL, "getting udev monitor fd flags (%d)", errno);
     90                goto err_free_monitor;
     91        }
     92        r = fcntl(udev_monitor_fd, F_SETFL, r | O_NONBLOCK);
     93        if (r) {
     94                usbi_err(NULL, "setting udev monitor fd flags (%d)", errno);
     95                goto err_free_monitor;
     96        }
     97
     98        r = usbi_pipe(udev_control_pipe);
     99        if (r) {
     100                usbi_err(NULL, "could not create udev control pipe");
     101                goto err_free_monitor;
     102        }
     103
     104        r = pthread_create(&linux_event_thread, NULL, linux_udev_event_thread_main, NULL);
     105        if (r) {
     106                usbi_err(NULL, "creating hotplug event thread (%d)", r);
     107                goto err_close_pipe;
     108        }
     109
     110        return LIBUSB_SUCCESS;
     111
     112err_close_pipe:
     113        close(udev_control_pipe[0]);
     114        close(udev_control_pipe[1]);
     115err_free_monitor:
     116        udev_monitor_unref(udev_monitor);
     117        udev_monitor = NULL;
     118        udev_monitor_fd = -1;
     119err_free_ctx:
     120        udev_unref(udev_ctx);
     121err:
     122        udev_ctx = NULL;
     123        return LIBUSB_ERROR_OTHER;
    86124}
    87125
    88126int linux_udev_stop_event_monitor(void)
    89127{
    90         if (-1 == udev_monitor_fd) {
    91                 /* this should never happen */
    92                 return LIBUSB_ERROR_OTHER;
    93         }
    94 
    95         /* Cancel the event thread. This is the only way to garauntee the thread
    96            exits since closing the monitor fd won't necessarily cause poll
    97            to return. */
    98         pthread_cancel(linux_event_thread);
     128        char dummy = 1;
     129        int r;
     130
     131        assert(udev_ctx != NULL);
     132        assert(udev_monitor != NULL);
     133        assert(udev_monitor_fd != -1);
     134
     135        /* Write some dummy data to the control pipe and
     136         * wait for the thread to exit */
     137        r = usbi_write(udev_control_pipe[1], &dummy, sizeof(dummy));
     138        if (r <= 0) {
     139                usbi_warn(NULL, "udev control pipe signal failed");
     140        }
     141        pthread_join(linux_event_thread, NULL);
    99142
    100143        /* Release the udev monitor */
    101         udev_monitor_unref(udev_monitor);
     144        udev_monitor_unref(udev_monitor);
    102145        udev_monitor = NULL;
    103         udev_monitor_fd = -1;
     146        udev_monitor_fd = -1;
    104147
    105148        /* Clean up the udev context */
     
    107150        udev_ctx = NULL;
    108151
    109         return LIBUSB_SUCCESS;
     152        /* close and reset control pipe */
     153        close(udev_control_pipe[0]);
     154        close(udev_control_pipe[1]);
     155        udev_control_pipe[0] = -1;
     156        udev_control_pipe[1] = -1;
     157
     158        return LIBUSB_SUCCESS;
    110159}
    111160
    112161static void *linux_udev_event_thread_main(void *arg)
    113162{
    114         struct pollfd fds = {.fd = udev_monitor_fd,
    115                              .events = POLLIN};
     163        char dummy;
     164        int r;
     165        struct udev_device* udev_dev;
     166        struct pollfd fds[] = {
     167                {.fd = udev_control_pipe[0],
     168                 .events = POLLIN},
     169                {.fd = udev_monitor_fd,
     170                 .events = POLLIN},
     171        };
    116172
    117173        usbi_dbg("udev event thread entering.");
    118174
    119         while (1 == poll(&fds, 1, -1)) {
    120                 if (NULL == udev_monitor || POLLIN != fds.revents) {
     175        while (poll(fds, 2, -1) >= 0) {
     176                if (fds[0].revents & POLLIN) {
     177                        /* activity on control pipe, read the byte and exit */
     178                        r = usbi_read(udev_control_pipe[0], &dummy, sizeof(dummy));
     179                        if (r <= 0) {
     180                                usbi_warn(NULL, "udev control pipe read failed");
     181                        }
    121182                        break;
    122183                }
    123 
    124                 udev_hotplug_event();
     184                if (fds[1].revents & POLLIN) {
     185                        usbi_mutex_static_lock(&linux_hotplug_lock);
     186                        udev_dev = udev_monitor_receive_device(udev_monitor);
     187                        if (udev_dev)
     188                                udev_hotplug_event(udev_dev);
     189                        usbi_mutex_static_unlock(&linux_hotplug_lock);
     190                }
    125191        }
    126192
     
    145211        }
    146212
    147         return linux_get_device_address(ctx, detached, busnum, devaddr,
     213        return linux_get_device_address(ctx, detached, busnum, devaddr,
    148214                                        dev_node, *sys_name);
    149215}
    150216
    151 static void udev_hotplug_event(void)
    152 {
    153         struct udev_device* udev_dev;
     217static void udev_hotplug_event(struct udev_device* udev_dev)
     218{
    154219        const char* udev_action;
    155220        const char* sys_name = NULL;
     
    158223        int r;
    159224
    160         if (NULL == udev_monitor) {
    161                 return;
    162         }
    163 
    164225        do {
    165                 udev_dev = udev_monitor_receive_device(udev_monitor);
    166                 if (!udev_dev) {
    167                         usbi_err(NULL, "failed to read data from udev monitor socket.");
    168                         return;
    169                 }
    170 
    171226                udev_action = udev_device_get_action(udev_dev);
    172227                if (!udev_action) {
     
    186241                        linux_hotplug_enumerate(busnum, devaddr, sys_name);
    187242                } else if (detached) {
    188                         linux_hotplug_disconnected(busnum, devaddr, sys_name);
     243                        linux_device_disconnected(busnum, devaddr);
    189244                } else {
    190245                        usbi_err(NULL, "ignoring udev action %s", udev_action);
     
    203258        int r;
    204259
    205         if (NULL == udev_ctx) {
    206                 udev_ctx = udev_new();
    207                 if (!udev_ctx) {
    208                         return LIBUSB_ERROR_OTHER;
    209                 }
    210         }
     260        assert(udev_ctx != NULL);
    211261
    212262        enumerator = udev_enumerate_new(udev_ctx);
     
    217267
    218268        udev_enumerate_add_match_subsystem(enumerator, "usb");
     269        udev_enumerate_add_match_property(enumerator, "DEVTYPE", "usb_device");
    219270        udev_enumerate_scan_devices(enumerator);
    220271        devices = udev_enumerate_get_list_entry(enumerator);
     
    238289        udev_enumerate_unref(enumerator);
    239290
    240         return LIBUSB_SUCCESS;
    241 }
    242 
     291        return LIBUSB_SUCCESS;
     292}
     293
     294void linux_udev_hotplug_poll(void)
     295{
     296        struct udev_device* udev_dev;
     297
     298        usbi_mutex_static_lock(&linux_hotplug_lock);
     299        do {
     300                udev_dev = udev_monitor_receive_device(udev_monitor);
     301                if (udev_dev) {
     302                        usbi_dbg("Handling hotplug event from hotplug_poll");
     303                        udev_hotplug_event(udev_dev);
     304                }
     305        } while (udev_dev);
     306        usbi_mutex_static_unlock(&linux_hotplug_lock);
     307}
  • TabularUnified libusb1/trunk/libusb/os/linux_usbfs.c

    r1876 r1882  
    22/*
    33 * Linux usbfs backend for libusb
    4  * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
    5  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
    6  * Copyright (c) 2013 Nathan Hjelm <hjelmn@mac.com>
     4 * Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
     5 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
     6 * Copyright © 2013 Nathan Hjelm <hjelmn@mac.com>
     7 * Copyright © 2012-2013 Hans de Goede <hdegoede@redhat.com>
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    2122 */
    2223
    23 #include <config.h>
     24#include "config.h"
     25
     26#include <assert.h>
    2427#include <ctype.h>
    2528#include <dirent.h>
     
    3134#include <string.h>
    3235#include <sys/ioctl.h>
     36#include <sys/mman.h>
    3337#include <sys/stat.h>
    3438#include <sys/types.h>
    3539#include <sys/utsname.h>
    36 #include <unistd.h>
    37 
    38 #include "libusb.h"
     40#include <time.h>
     41
    3942#include "libusbi.h"
    4043#include "linux_usbfs.h"
     
    4649 * sysfs allows us to read the kernel's in-memory copies of device descriptors
    4750 * and so forth, avoiding the need to open the device:
    48  *  - The binary "descriptors" file was added in 2.6.23.
    49  *  - The "busnum" file was added in 2.6.22
     51 *  - The binary "descriptors" file contains all config descriptors since
     52 *    2.6.26, commit 217a9081d8e69026186067711131b77f0ce219ed
     53 *  - The binary "descriptors" file was added in 2.6.23, commit
     54 *    69d42a78f935d19384d1f6e4f94b65bb162b36df, but it only contains the
     55 *    active config descriptors
     56 *  - The "busnum" file was added in 2.6.22, commit
     57 *    83f7d958eab2fbc6b159ee92bf1493924e1d0f72
    5058 *  - The "devnum" file has been present since pre-2.6.18
    5159 *  - the "bConfigurationValue" file has been present since pre-2.6.18
     
    5361 * If we have bConfigurationValue, busnum, and devnum, then we can determine
    5462 * the active configuration without having to open the usbfs node in RDWR mode.
    55  * We assume this is the case if we see the busnum file (indicates 2.6.22+).
    5663 * The busnum file is important as that is the only way we can relate sysfs
    5764 * devices to usbfs nodes.
    5865 *
    59  * If we also have descriptors, we can obtain the device descriptor and active
     66 * If we also have all descriptors, we can obtain the device descriptor and
    6067 * configuration without touching usbfs at all.
    61  *
    62  * The descriptors file originally only contained the active configuration
    63  * descriptor alongside the device descriptor, but all configurations are
    64  * included as of Linux 2.6.26.
    6568 */
    6669
     
    7073 * descriptor as host endian. Multi-byte fields in the other descriptors are
    7174 * bus-endian. The kernel documentation says otherwise, but it is wrong.
     75 *
     76 * In sysfs all descriptors are bus-endian.
    7277 */
    7378
    74 const char *usbfs_path = NULL;
     79static const char *usbfs_path = NULL;
    7580
    7681/* use usbdev*.* device names in /dev instead of the usbfs bus directories */
     
    104109static clockid_t monotonic_clkid = -1;
    105110
    106 /* do we have a busnum to relate devices? this also implies that we can read
     111/* Linux 2.6.22 (commit 83f7d958eab2fbc6b159ee92bf1493924e1d0f72) adds a busnum
     112 * to sysfs, so we can relate devices. This also implies that we can read
    107113 * the active configuration through bConfigurationValue */
    108 static int sysfs_can_relate_devices = 0;
    109 
    110 /* do we have a descriptors file? */
    111 static int sysfs_has_descriptors = 0;
     114static int sysfs_can_relate_devices = -1;
     115
     116/* Linux 2.6.26 (commit 217a9081d8e69026186067711131b77f0ce219ed) adds all
     117 * config descriptors (rather then just the active config) to the sysfs
     118 * descriptors file, so from then on we can use them. */
     119static int sysfs_has_descriptors = -1;
    112120
    113121/* how many times have we initted (and not exited) ? */
    114 static volatile int init_count = 0;
    115 
    116 /* lock for init_count */
    117 static pthread_mutex_t hotplug_lock = PTHREAD_MUTEX_INITIALIZER;
     122static int init_count = 0;
     123
     124/* Serialize hotplug start/stop */
     125static usbi_mutex_static_t linux_hotplug_startstop_lock = USBI_MUTEX_INITIALIZER;
     126/* Serialize scan-devices, event-thread, and poll */
     127usbi_mutex_static_t linux_hotplug_lock = USBI_MUTEX_INITIALIZER;
    118128
    119129static int linux_start_event_monitor(void);
    120130static int linux_stop_event_monitor(void);
    121131static int linux_scan_devices(struct libusb_context *ctx);
     132static int sysfs_scan_device(struct libusb_context *ctx, const char *devname);
     133static int detach_kernel_driver_and_claim(struct libusb_device_handle *, int);
    122134
    123135#if !defined(USE_UDEV)
     
    127139struct linux_device_priv {
    128140        char *sysfs_dir;
    129         unsigned char *dev_descriptor;
    130         unsigned char *config_descriptor;
     141        unsigned char *descriptors;
     142        int descriptors_len;
     143        int active_config; /* cache val for !sysfs_can_relate_devices  */
    131144};
    132145
    133146struct linux_device_handle_priv {
    134147        int fd;
     148        int fd_removed;
    135149        uint32_t caps;
    136150};
     
    167181};
    168182
    169 static void _get_usbfs_path(struct libusb_device *dev, char *path)
    170 {
     183static int _get_usbfs_fd(struct libusb_device *dev, mode_t mode, int silent)
     184{
     185        struct libusb_context *ctx = DEVICE_CTX(dev);
     186        char path[PATH_MAX];
     187        int fd;
     188        int delay = 10000;
     189
    171190        if (usbdev_names)
    172191                snprintf(path, PATH_MAX, "%s/usbdev%d.%d",
     
    175194                snprintf(path, PATH_MAX, "%s/%03d/%03d",
    176195                        usbfs_path, dev->bus_number, dev->device_address);
     196
     197        fd = open(path, mode);
     198        if (fd != -1)
     199                return fd; /* Success */
     200
     201        if (errno == ENOENT) {
     202                if (!silent)
     203                        usbi_err(ctx, "File doesn't exist, wait %d ms and try again", delay/1000);
     204   
     205                /* Wait 10ms for USB device path creation.*/
     206                nanosleep(&(struct timespec){delay / 1000000, (delay * 1000) % 1000000000UL}, NULL);
     207
     208                fd = open(path, mode);
     209                if (fd != -1)
     210                        return fd; /* Success */
     211        }
     212       
     213        if (!silent) {
     214                usbi_err(ctx, "libusb couldn't open USB device %s: %s",
     215                         path, strerror(errno));
     216                if (errno == EACCES && mode == O_RDWR)
     217                        usbi_err(ctx, "libusb requires write access to USB "
     218                                      "device nodes.");
     219        }
     220
     221        if (errno == EACCES)
     222                return LIBUSB_ERROR_ACCESS;
     223        if (errno == ENOENT)
     224                return LIBUSB_ERROR_NO_DEVICE;
     225        return LIBUSB_ERROR_IO;
    177226}
    178227
     
    261310        }
    262311
     312/* On udev based systems without any usb-devices /dev/bus/usb will not
     313 * exist. So if we've not found anything and we're using udev for hotplug
     314 * simply assume /dev/bus/usb rather then making libusb_init fail. */
     315#if defined(USE_UDEV)
     316        if (ret == NULL)
     317                ret = "/dev/bus/usb";
     318#endif
     319
    263320        if (ret != NULL)
    264321                usbi_dbg("found usbfs at %s", ret);
     
    317374}
    318375
    319 /* Return 1 if filename exists inside dirname in sysfs.
    320    SYSFS_DEVICE_PATH is assumed to be the beginning of the path. */
    321 static int sysfs_has_file(const char *dirname, const char *filename)
    322 {
    323         struct stat statbuf;
    324         char path[PATH_MAX];
    325         int r;
    326 
    327         snprintf(path, PATH_MAX, "%s/%s/%s", SYSFS_DEVICE_PATH, dirname, filename);
    328         r = stat(path, &statbuf);
    329         if (r == 0 && S_ISREG(statbuf.st_mode))
    330                 return 1;
    331 
    332         return 0;
    333 }
    334 
    335376static int op_init(struct libusb_context *ctx)
    336377{
     
    371412                usbi_dbg("zero length packet flag supported");
    372413
    373         r = stat(SYSFS_DEVICE_PATH, &statbuf);
    374         if (r == 0 && S_ISDIR(statbuf.st_mode)) {
    375                 DIR *devices = opendir(SYSFS_DEVICE_PATH);
    376                 struct dirent *entry;
    377 
    378                 usbi_dbg("found usb devices in sysfs");
    379 
    380                 if (!devices) {
    381                         usbi_err(ctx, "opendir devices failed errno=%d", errno);
    382                         return LIBUSB_ERROR_IO;
    383                 }
    384 
    385                 /* Make sure sysfs supports all the required files. If it
    386                  * does not, then usbfs will be used instead.  Determine
    387                  * this by looping through the directories in
    388                  * SYSFS_DEVICE_PATH.  With the assumption that there will
    389                  * always be subdirectories of the name usbN (usb1, usb2,
    390                  * etc) representing the root hubs, check the usbN
    391                  * subdirectories to see if they have all the needed files.
    392                  * This algorithm uses the usbN subdirectories (root hubs)
    393                  * because a device disconnection will cause a race
    394                  * condition regarding which files are available, sometimes
    395                  * causing an incorrect result.  The root hubs are used
    396                  * because it is assumed that they will always be present.
    397                  * See the "sysfs vs usbfs" comment at the top of this file
    398                  * for more details.  */
    399                 while ((entry = readdir(devices))) {
    400                         int has_busnum=0, has_devnum=0, has_descriptors=0;
    401                         int has_configuration_value=0;
    402 
    403                         /* Only check the usbN directories. */
    404                         if (strncmp(entry->d_name, "usb", 3) != 0)
    405                                 continue;
    406 
    407                         /* Check for the files libusb needs from sysfs. */
    408                         has_busnum = sysfs_has_file(entry->d_name, "busnum");
    409                         has_devnum = sysfs_has_file(entry->d_name, "devnum");
    410                         has_descriptors = sysfs_has_file(entry->d_name, "descriptors");
    411                         has_configuration_value = sysfs_has_file(entry->d_name, "bConfigurationValue");
    412 
    413                         if (has_busnum && has_devnum && has_configuration_value)
    414                                 sysfs_can_relate_devices = 1;
    415                         if (has_descriptors)
    416                                 sysfs_has_descriptors = 1;
    417 
    418                         /* Only need to check until we've found ONE device which
    419                            has all the attributes. */
    420                         if (sysfs_has_descriptors && sysfs_can_relate_devices)
    421                                 break;
    422                 }
    423                 closedir(devices);
    424 
    425                 /* Only use sysfs descriptors if the rest of
    426                    sysfs will work for libusb. */
    427                 if (!sysfs_can_relate_devices)
     414        if (-1 == sysfs_has_descriptors) {
     415                /* sysfs descriptors has all descriptors since Linux 2.6.26 */
     416                sysfs_has_descriptors = kernel_version_ge(2,6,26);
     417                if (-1 == sysfs_has_descriptors) {
     418                        usbi_err(ctx, "error checking for sysfs descriptors");
     419                        return LIBUSB_ERROR_OTHER;
     420                }
     421        }
     422
     423        if (-1 == sysfs_can_relate_devices) {
     424                /* sysfs has busnum since Linux 2.6.22 */
     425                sysfs_can_relate_devices = kernel_version_ge(2,6,22);
     426                if (-1 == sysfs_can_relate_devices) {
     427                        usbi_err(ctx, "error checking for sysfs busnum");
     428                        return LIBUSB_ERROR_OTHER;
     429                }
     430        }
     431
     432        if (sysfs_can_relate_devices || sysfs_has_descriptors) {
     433                r = stat(SYSFS_DEVICE_PATH, &statbuf);
     434                if (r != 0 || !S_ISDIR(statbuf.st_mode)) {
     435                        usbi_warn(ctx, "sysfs not mounted");
     436                        sysfs_can_relate_devices = 0;
    428437                        sysfs_has_descriptors = 0;
    429         } else {
    430                 usbi_dbg("sysfs usb info not available");
    431                 sysfs_has_descriptors = 0;
    432                 sysfs_can_relate_devices = 0;
    433         }
    434 
    435         pthread_mutex_lock(&hotplug_lock);
    436         if (!init_count++) {
    437                 /* start up hotplug event handler */
    438                 r = linux_start_event_monitor();
    439                 if (LIBUSB_SUCCESS != r) {
    440                         usbi_err(ctx, "error starting hotplug event monitor");
    441                         return r;
    442                 }
    443         }
    444         pthread_mutex_unlock(&hotplug_lock);
    445 
    446         r = linux_scan_devices(ctx);
    447         if (LIBUSB_SUCCESS != r) {
    448                 return r;
    449         }
     438                }
     439        }
     440
     441        if (sysfs_can_relate_devices)
     442                usbi_dbg("sysfs can relate devices");
     443
     444        if (sysfs_has_descriptors)
     445                usbi_dbg("sysfs has complete descriptors");
     446
     447        usbi_mutex_static_lock(&linux_hotplug_startstop_lock);
     448        r = LIBUSB_SUCCESS;
     449        if (init_count == 0) {
     450                /* start up hotplug event handler */
     451                r = linux_start_event_monitor();
     452        }
     453        if (r == LIBUSB_SUCCESS) {
     454                r = linux_scan_devices(ctx);
     455                if (r == LIBUSB_SUCCESS)
     456                        init_count++;
     457                else if (init_count == 0)
     458                        linux_stop_event_monitor();
     459        } else
     460                usbi_err(ctx, "error starting hotplug event monitor");
     461        usbi_mutex_static_unlock(&linux_hotplug_startstop_lock);
    450462
    451463        return r;
     
    454466static void op_exit(void)
    455467{
    456         if (!init_count) {
    457                 /* should not happen */
    458                 return;
    459         }
    460 
    461         pthread_mutex_lock(&hotplug_lock);
    462         if (!--init_count) {
    463                 /* tear down event handler */
    464                 (void)linux_stop_event_monitor();
    465         }
    466         pthread_mutex_unlock(&hotplug_lock);
     468        usbi_mutex_static_lock(&linux_hotplug_startstop_lock);
     469        assert(init_count != 0);
     470        if (!--init_count) {
     471                /* tear down event handler */
     472                (void)linux_stop_event_monitor();
     473        }
     474        usbi_mutex_static_unlock(&linux_hotplug_startstop_lock);
    467475}
    468476
     
    470478{
    471479#if defined(USE_UDEV)
    472         return linux_udev_start_event_monitor();
     480        return linux_udev_start_event_monitor();
    473481#else
    474         return linux_netlink_start_event_monitor();
     482        return linux_netlink_start_event_monitor();
    475483#endif
    476484}
     
    479487{
    480488#if defined(USE_UDEV)
    481         return linux_udev_stop_event_monitor();
     489        return linux_udev_stop_event_monitor();
    482490#else
    483         return linux_netlink_stop_event_monitor();
     491        return linux_netlink_stop_event_monitor();
    484492#endif
    485493}
     
    487495static int linux_scan_devices(struct libusb_context *ctx)
    488496{
     497        int ret;
     498
     499        usbi_mutex_static_lock(&linux_hotplug_lock);
     500
    489501#if defined(USE_UDEV)
    490         return linux_udev_scan_devices(ctx);
     502        ret = linux_udev_scan_devices(ctx);
    491503#else
    492         return linux_default_scan_devices(ctx);
     504        ret = linux_default_scan_devices(ctx);
    493505#endif
    494 }
    495 
    496 static int usbfs_get_device_descriptor(struct libusb_device *dev,
    497         unsigned char *buffer)
    498 {
    499         struct linux_device_priv *priv = _device_priv(dev);
    500 
    501         /* return cached copy */
    502         memcpy(buffer, priv->dev_descriptor, DEVICE_DESC_LENGTH);
    503         return 0;
     506
     507        usbi_mutex_static_unlock(&linux_hotplug_lock);
     508
     509        return ret;
     510}
     511
     512static void op_hotplug_poll(void)
     513{
     514#if defined(USE_UDEV)
     515        linux_udev_hotplug_poll();
     516#else
     517        linux_netlink_hotplug_poll();
     518#endif
    504519}
    505520
     
    557572}
    558573
    559 static int sysfs_get_device_descriptor(struct libusb_device *dev,
    560         unsigned char *buffer)
    561 {
    562         int fd;
    563         ssize_t r;
    564 
    565         /* sysfs provides access to an in-memory copy of the device descriptor,
    566          * so we use that rather than keeping our own copy */
    567 
    568         fd = _open_sysfs_attr(dev, "descriptors");
    569         if (fd < 0)
    570                 return fd;
    571 
    572         r = read(fd, buffer, DEVICE_DESC_LENGTH);;
    573         close(fd);
    574         if (r < 0) {
    575                 usbi_err(DEVICE_CTX(dev), "read failed, ret=%d errno=%d", fd, errno);
    576                 return LIBUSB_ERROR_IO;
    577         } else if (r < DEVICE_DESC_LENGTH) {
    578                 usbi_err(DEVICE_CTX(dev), "short read %d/%d", r, DEVICE_DESC_LENGTH);
    579                 return LIBUSB_ERROR_IO;
    580         }
    581 
    582         return 0;
    583 }
    584 
    585574static int op_get_device_descriptor(struct libusb_device *dev,
    586575        unsigned char *buffer, int *host_endian)
    587576{
    588         if (sysfs_has_descriptors) {
    589                 *host_endian = 0;
    590                 return sysfs_get_device_descriptor(dev, buffer);
    591         } else {
    592                 *host_endian = 1;
    593                 return usbfs_get_device_descriptor(dev, buffer);
    594         }
    595 }
    596 
    597 static int usbfs_get_active_config_descriptor(struct libusb_device *dev,
    598         unsigned char *buffer, size_t len)
    599 {
    600577        struct linux_device_priv *priv = _device_priv(dev);
    601         if (!priv->config_descriptor)
    602                 return LIBUSB_ERROR_NOT_FOUND; /* device is unconfigured */
    603 
    604         /* retrieve cached copy */
    605         memcpy(buffer, priv->config_descriptor, len);
     578
     579        *host_endian = sysfs_has_descriptors ? 0 : 1;
     580        memcpy(buffer, priv->descriptors, DEVICE_DESC_LENGTH);
     581
    606582        return 0;
    607583}
     
    611587{
    612588        char *endptr;
    613         char tmp[4] = {0, 0, 0, 0};
     589        char tmp[5] = {0, 0, 0, 0, 0};
    614590        long num;
    615591        int fd;
     
    623599        close(fd);
    624600        if (r < 0) {
    625                 usbi_err(DEVICE_CTX(dev), 
     601                usbi_err(DEVICE_CTX(dev),
    626602                        "read bConfigurationValue failed ret=%d errno=%d", r, errno);
    627603                return LIBUSB_ERROR_IO;
     
    650626}
    651627
    652 /* takes a usbfs/descriptors fd seeked to the start of a configuration, and
    653  * seeks to the next one. */
    654 static int seek_to_next_config(struct libusb_context *ctx, int fd,
    655         int host_endian)
     628int linux_get_device_address (struct libusb_context *ctx, int detached,
     629        uint8_t *busnum, uint8_t *devaddr,const char *dev_node,
     630        const char *sys_name)
     631{
     632        int sysfs_attr;
     633
     634        usbi_dbg("getting address for device: %s detached: %d", sys_name, detached);
     635        /* can't use sysfs to read the bus and device number if the
     636         * device has been detached */
     637        if (!sysfs_can_relate_devices || detached || NULL == sys_name) {
     638                if (NULL == dev_node) {
     639                        return LIBUSB_ERROR_OTHER;
     640                }
     641
     642                /* will this work with all supported kernel versions? */
     643                if (!strncmp(dev_node, "/dev/bus/usb", 12)) {
     644                        sscanf (dev_node, "/dev/bus/usb/%hhu/%hhu", busnum, devaddr);
     645                } else if (!strncmp(dev_node, "/proc/bus/usb", 13)) {
     646                        sscanf (dev_node, "/proc/bus/usb/%hhu/%hhu", busnum, devaddr);
     647                }
     648
     649                return LIBUSB_SUCCESS;
     650        }
     651
     652        usbi_dbg("scan %s", sys_name);
     653
     654        sysfs_attr = __read_sysfs_attr(ctx, sys_name, "busnum");
     655        if (0 > sysfs_attr)
     656                return sysfs_attr;
     657        if (sysfs_attr > 255)
     658                return LIBUSB_ERROR_INVALID_PARAM;
     659        *busnum = (uint8_t) sysfs_attr;
     660
     661        sysfs_attr = __read_sysfs_attr(ctx, sys_name, "devnum");
     662        if (0 > sysfs_attr)
     663                return sysfs_attr;
     664        if (sysfs_attr > 255)
     665                return LIBUSB_ERROR_INVALID_PARAM;
     666
     667        *devaddr = (uint8_t) sysfs_attr;
     668
     669        usbi_dbg("bus=%d dev=%d", *busnum, *devaddr);
     670
     671        return LIBUSB_SUCCESS;
     672}
     673
     674/* Return offset of the next descriptor with the given type */
     675static int seek_to_next_descriptor(struct libusb_context *ctx,
     676        uint8_t descriptor_type, unsigned char *buffer, int size)
     677{
     678        struct usb_descriptor_header header;
     679        int i;
     680
     681        for (i = 0; size >= 0; i += header.bLength, size -= header.bLength) {
     682                if (size == 0)
     683                        return LIBUSB_ERROR_NOT_FOUND;
     684
     685                if (size < 2) {
     686                        usbi_err(ctx, "short descriptor read %d/2", size);
     687                        return LIBUSB_ERROR_IO;
     688                }
     689                usbi_parse_descriptor(buffer + i, "bb", &header, 0);
     690
     691                if (i && header.bDescriptorType == descriptor_type)
     692                        return i;
     693        }
     694        usbi_err(ctx, "bLength overflow by %d bytes", -size);
     695        return LIBUSB_ERROR_IO;
     696}
     697
     698/* Return offset to next config */
     699static int seek_to_next_config(struct libusb_context *ctx,
     700        unsigned char *buffer, int size)
    656701{
    657702        struct libusb_config_descriptor config;
    658         unsigned char tmp[6];
    659         off_t off;
    660         ssize_t r;
    661 
    662         /* read first 6 bytes of descriptor */
    663         r = read(fd, tmp, sizeof(tmp));
    664         if (r < 0) {
    665                 usbi_err(ctx, "read failed ret=%d errno=%d", r, errno);
     703
     704        if (size == 0)
     705                return LIBUSB_ERROR_NOT_FOUND;
     706
     707        if (size < LIBUSB_DT_CONFIG_SIZE) {
     708                usbi_err(ctx, "short descriptor read %d/%d",
     709                         size, LIBUSB_DT_CONFIG_SIZE);
    666710                return LIBUSB_ERROR_IO;
    667         } else if (r < sizeof(tmp)) {
    668                 usbi_err(ctx, "short descriptor read %d/%d", r, sizeof(tmp));
     711        }
     712
     713        usbi_parse_descriptor(buffer, "bbwbbbbb", &config, 0);
     714        if (config.bDescriptorType != LIBUSB_DT_CONFIG) {
     715                usbi_err(ctx, "descriptor is not a config desc (type 0x%02x)",
     716                         config.bDescriptorType);
    669717                return LIBUSB_ERROR_IO;
    670718        }
    671719
    672         /* seek forward to end of config */
    673         usbi_parse_descriptor(tmp, "bbwbb", &config, host_endian);
    674         off = lseek(fd, config.wTotalLength - sizeof(tmp), SEEK_CUR);
    675         if (off < 0) {
    676                 usbi_err(ctx, "seek failed ret=%d errno=%d", off, errno);
    677                 return LIBUSB_ERROR_IO;
    678         }
    679 
    680         return 0;
    681 }
    682 
    683 static int sysfs_get_active_config_descriptor(struct libusb_device *dev,
    684         unsigned char *buffer, size_t len)
    685 {
    686         int fd;
    687         ssize_t r;
    688         off_t off;
    689         int to_copy;
    690         int config;
    691         unsigned char tmp[6];
    692 
    693         r = sysfs_get_active_config(dev, &config);
     720        /*
     721         * In usbfs the config descriptors are config.wTotalLength bytes apart,
     722         * with any short reads from the device appearing as holes in the file.
     723         *
     724         * In sysfs wTotalLength is ignored, instead the kernel returns a
     725         * config descriptor with verified bLength fields, with descriptors
     726         * with an invalid bLength removed.
     727         */
     728        if (sysfs_has_descriptors) {
     729                int next = seek_to_next_descriptor(ctx, LIBUSB_DT_CONFIG,
     730                                                   buffer, size);
     731                if (next == LIBUSB_ERROR_NOT_FOUND)
     732                        next = size;
     733                if (next < 0)
     734                        return next;
     735
     736                if (next != config.wTotalLength)
     737                        usbi_warn(ctx, "config length mismatch wTotalLength "
     738                                  "%d real %d", config.wTotalLength, next);
     739                return next;
     740        } else {
     741                if (config.wTotalLength < LIBUSB_DT_CONFIG_SIZE) {
     742                        usbi_err(ctx, "invalid wTotalLength %d",
     743                                 config.wTotalLength);
     744                        return LIBUSB_ERROR_IO;
     745                } else if (config.wTotalLength > size) {
     746                        usbi_warn(ctx, "short descriptor read %d/%d",
     747                                  size, config.wTotalLength);
     748                        return size;
     749                } else
     750                        return config.wTotalLength;
     751        }
     752}
     753
     754static int op_get_config_descriptor_by_value(struct libusb_device *dev,
     755        uint8_t value, unsigned char **buffer, int *host_endian)
     756{
     757        struct libusb_context *ctx = DEVICE_CTX(dev);
     758        struct linux_device_priv *priv = _device_priv(dev);
     759        unsigned char *descriptors = priv->descriptors;
     760        int size = priv->descriptors_len;
     761        struct libusb_config_descriptor *config;
     762
     763        *buffer = NULL;
     764        /* Unlike the device desc. config descs. are always in raw format */
     765        *host_endian = 0;
     766
     767        /* Skip device header */
     768        descriptors += DEVICE_DESC_LENGTH;
     769        size -= DEVICE_DESC_LENGTH;
     770
     771        /* Seek till the config is found, or till "EOF" */
     772        while (1) {
     773                int next = seek_to_next_config(ctx, descriptors, size);
     774                if (next < 0)
     775                        return next;
     776                config = (struct libusb_config_descriptor *)descriptors;
     777                if (config->bConfigurationValue == value) {
     778                        *buffer = descriptors;
     779                        return next;
     780                }
     781                size -= next;
     782                descriptors += next;
     783        }
     784}
     785
     786static int op_get_active_config_descriptor(struct libusb_device *dev,
     787        unsigned char *buffer, size_t len, int *host_endian)
     788{
     789        int r, config;
     790        unsigned char *config_desc;
     791
     792        if (sysfs_can_relate_devices) {
     793                r = sysfs_get_active_config(dev, &config);
     794                if (r < 0)
     795                        return r;
     796        } else {
     797                /* Use cached bConfigurationValue */
     798                struct linux_device_priv *priv = _device_priv(dev);
     799                config = priv->active_config;
     800        }
     801        if (config == -1)
     802                return LIBUSB_ERROR_NOT_FOUND;
     803
     804        r = op_get_config_descriptor_by_value(dev, config, &config_desc,
     805                                              host_endian);
    694806        if (r < 0)
    695807                return r;
    696         if (config == -1)
    697                 return LIBUSB_ERROR_NOT_FOUND;
    698 
    699         usbi_dbg("active configuration %d", config);
    700 
    701         /* sysfs provides access to an in-memory copy of the device descriptor,
    702          * so we use that rather than keeping our own copy */
    703 
    704         fd = _open_sysfs_attr(dev, "descriptors");
    705         if (fd < 0)
    706                 return fd;
    707 
    708         /* device might have been unconfigured since we read bConfigurationValue,
    709          * so first check that there is any config descriptor data at all... */
    710         off = lseek(fd, 0, SEEK_END);
    711         if (off < 1) {
    712                 usbi_err(DEVICE_CTX(dev), "end seek failed, ret=%d errno=%d",
    713                         off, errno);
    714                 close(fd);
    715                 return LIBUSB_ERROR_IO;
    716         } else if (off == DEVICE_DESC_LENGTH) {
    717                 close(fd);
    718                 return LIBUSB_ERROR_NOT_FOUND;
    719         }
    720 
    721         off = lseek(fd, DEVICE_DESC_LENGTH, SEEK_SET);
    722         if (off < 0) {
    723                 usbi_err(DEVICE_CTX(dev), "seek failed, ret=%d errno=%d", off, errno);
    724                 close(fd);
    725                 return LIBUSB_ERROR_IO;
    726         }
    727 
    728         /* unbounded loop: we expect the descriptor to be present under all
    729          * circumstances */
    730         while (1) {
    731                 r = read(fd, tmp, sizeof(tmp));
    732                 if (r < 0) {
    733                         usbi_err(DEVICE_CTX(dev), "read failed, ret=%d errno=%d",
    734                                 fd, errno);
    735                         return LIBUSB_ERROR_IO;
    736                 } else if (r < sizeof(tmp)) {
    737                         usbi_err(DEVICE_CTX(dev), "short read %d/%d", r, sizeof(tmp));
    738                         return LIBUSB_ERROR_IO;
    739                 }
    740 
    741                 /* check bConfigurationValue */
    742                 if (tmp[5] == config)
    743                         break;
    744 
    745                 /* try the next descriptor */
    746                 off = lseek(fd, 0 - sizeof(tmp), SEEK_CUR);
    747                 if (off < 0)
    748                         return LIBUSB_ERROR_IO;
    749 
    750                 r = seek_to_next_config(DEVICE_CTX(dev), fd, 0);
     808
     809        len = MIN(len, r);
     810        memcpy(buffer, config_desc, len);
     811        return len;
     812}
     813
     814static int op_get_config_descriptor(struct libusb_device *dev,
     815        uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian)
     816{
     817        struct linux_device_priv *priv = _device_priv(dev);
     818        unsigned char *descriptors = priv->descriptors;
     819        int i, r, size = priv->descriptors_len;
     820
     821        /* Unlike the device desc. config descs. are always in raw format */
     822        *host_endian = 0;
     823
     824        /* Skip device header */
     825        descriptors += DEVICE_DESC_LENGTH;
     826        size -= DEVICE_DESC_LENGTH;
     827
     828        /* Seek till the config is found, or till "EOF" */
     829        for (i = 0; ; i++) {
     830                r = seek_to_next_config(DEVICE_CTX(dev), descriptors, size);
    751831                if (r < 0)
    752832                        return r;
    753         }
    754 
    755         to_copy = (len < sizeof(tmp)) ? len : sizeof(tmp);
    756         memcpy(buffer, tmp, to_copy);
    757         if (len > sizeof(tmp)) {
    758                 r = read(fd, buffer + sizeof(tmp), len - sizeof(tmp));
    759                 if (r < 0) {
    760                         usbi_err(DEVICE_CTX(dev), "read failed, ret=%d errno=%d",
    761                                 fd, errno);
    762                         r = LIBUSB_ERROR_IO;
    763                 } else if (r == 0) {
    764                         usbi_dbg("device is unconfigured");
    765                         r = LIBUSB_ERROR_NOT_FOUND;
    766                 } else if (r < len - sizeof(tmp)) {
    767                         usbi_err(DEVICE_CTX(dev), "short read %d/%d", r, len);
    768                         r = LIBUSB_ERROR_IO;
    769                 }
    770         } else {
    771                 r = 0;
    772         }
    773 
    774         close(fd);
    775         return r;
    776 }
    777 
    778 int linux_get_device_address (struct libusb_context *ctx, int detached,
    779                               uint8_t *busnum, uint8_t *devaddr,
    780                               const char *dev_node, const char *sys_name)
    781 {
    782         usbi_dbg("getting address for device: %s detached: %d",
    783                  sys_name, detached);
    784         /* can't use sysfs to read the bus and device number if the
    785            device has been detached */
    786         if (!sysfs_can_relate_devices || detached || NULL == sys_name) {
    787                 if (NULL == dev_node) {
    788                         return LIBUSB_ERROR_OTHER;
    789                 }
    790 
    791                 /* will this work with all supported kernel versions? */
    792                 if (!strncmp(dev_node, "/dev/bus/usb", 12)) {
    793                         sscanf (dev_node, "/dev/bus/usb/%hhd/%hhd", busnum, devaddr);
    794                 } else if (!strncmp(dev_node, "/proc/bus/usb", 13)) {
    795                         sscanf (dev_node, "/proc/bus/usb/%hhd/%hhd", busnum, devaddr);
    796                 }
    797 
    798                 return LIBUSB_SUCCESS;
    799         }
    800 
    801         usbi_dbg("scan %s", sys_name);
    802 
    803         *busnum = __read_sysfs_attr(ctx, sys_name, "busnum");
    804         if (0 > *busnum)
    805                 return *busnum;
    806                
    807         *devaddr = __read_sysfs_attr(ctx, sys_name, "devnum");
    808         if (0 > *devaddr)
    809                 return *devaddr;
    810 
    811         usbi_dbg("bus=%d dev=%d", *busnum, *devaddr);
    812         if (*busnum > 255 || *devaddr > 255)
    813                 return LIBUSB_ERROR_INVALID_PARAM;
    814 
    815         return LIBUSB_SUCCESS;
    816 }
    817 
    818 static int op_get_active_config_descriptor(struct libusb_device *dev,
    819         unsigned char *buffer, size_t len, int *host_endian)
    820 {
    821         if (sysfs_has_descriptors) {
    822                 return sysfs_get_active_config_descriptor(dev, buffer, len);
    823         } else {
    824                 return usbfs_get_active_config_descriptor(dev, buffer, len);
    825         }
    826 }
    827 
    828 /* takes a usbfs fd, attempts to find the requested config and copy a certain
    829  * amount of it into an output buffer. */
    830 static int get_config_descriptor(struct libusb_context *ctx, int fd,
    831         uint8_t config_index, unsigned char *buffer, size_t len)
    832 {
    833         off_t off;
    834         ssize_t r;
    835 
    836         off = lseek(fd, DEVICE_DESC_LENGTH, SEEK_SET);
    837         if (off < 0) {
    838                 usbi_err(ctx, "seek failed ret=%d errno=%d", off, errno);
    839                 return LIBUSB_ERROR_IO;
    840         }
    841 
    842         /* might need to skip some configuration descriptors to reach the
    843          * requested configuration */
    844         while (config_index > 0) {
    845                 r = seek_to_next_config(ctx, fd, 1);
    846                 if (r < 0)
    847                         return r;
    848                 config_index--;
    849         }
    850 
    851         /* read the rest of the descriptor */
    852         r = read(fd, buffer, len);
    853         if (r < 0) {
    854                 usbi_err(ctx, "read failed ret=%d errno=%d", r, errno);
    855                 return LIBUSB_ERROR_IO;
    856         } else if (r < len) {
    857                 usbi_err(ctx, "short output read %d/%d", r, len);
    858                 return LIBUSB_ERROR_IO;
    859         }
    860 
    861         return 0;
    862 }
    863 
    864 static int op_get_config_descriptor(struct libusb_device *dev,
    865         uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian)
    866 {
    867         char filename[PATH_MAX];
    868         int fd;
    869         int r;
    870 
    871         /* always read from usbfs: sysfs only has the active descriptor
    872          * this will involve waking the device up, but oh well! */
    873 
    874         /* FIXME: the above is no longer true, new kernels have all descriptors
    875          * in the descriptors file. but its kinda hard to detect if the kernel
    876          * is sufficiently new. */
    877 
    878         _get_usbfs_path(dev, filename);
    879         fd = open(filename, O_RDONLY);
    880         if (fd < 0) {
    881                 usbi_err(DEVICE_CTX(dev),
    882                         "open '%s' failed, ret=%d errno=%d", filename, fd, errno);
    883                 return LIBUSB_ERROR_IO;
    884         }
    885 
    886         r = get_config_descriptor(DEVICE_CTX(dev), fd, config_index, buffer, len);
    887         close(fd);
    888         return r;
    889 }
    890 
    891 /* cache the active config descriptor in memory. a value of -1 means that
    892  * we aren't sure which one is active, so just assume the first one.
    893  * only for usbfs. */
    894 static int cache_active_config(struct libusb_device *dev, int fd,
    895         int active_config)
    896 {
    897         struct linux_device_priv *priv = _device_priv(dev);
    898         struct libusb_config_descriptor config;
    899         unsigned char tmp[8];
    900         unsigned char *buf;
    901         int idx;
    902         int r;
    903 
    904         if (active_config == -1) {
    905                 idx = 0;
    906         } else {
    907                 r = usbi_get_config_index_by_value(dev, active_config, &idx);
    908                 if (r < 0)
    909                         return r;
    910                 if (idx == -1)
    911                         return LIBUSB_ERROR_NOT_FOUND;
    912         }
    913 
    914         r = get_config_descriptor(DEVICE_CTX(dev), fd, idx, tmp, sizeof(tmp));
    915         if (r < 0) {
    916                 usbi_err(DEVICE_CTX(dev), "first read error %d", r);
    917                 return r;
    918         }
    919 
    920         usbi_parse_descriptor(tmp, "bbw", &config, 0);
    921         buf = malloc(config.wTotalLength);
    922         if (!buf)
    923                 return LIBUSB_ERROR_NO_MEM;
    924 
    925         r = get_config_descriptor(DEVICE_CTX(dev), fd, idx, buf,
    926                 config.wTotalLength);
    927         if (r < 0) {
    928                 free(buf);
    929                 return r;
    930         }
    931 
    932         if (priv->config_descriptor)
    933                 free(priv->config_descriptor);
    934         priv->config_descriptor = buf;
    935         return 0;
     833                if (i == config_index)
     834                        break;
     835                size -= r;
     836                descriptors += r;
     837        }
     838
     839        len = MIN(len, r);
     840        memcpy(buffer, descriptors, len);
     841        return len;
    936842}
    937843
     
    939845static int usbfs_get_active_config(struct libusb_device *dev, int fd)
    940846{
     847        struct linux_device_priv *priv = _device_priv(dev);
    941848        unsigned char active_config = 0;
    942849        int r;
     
    960867                usbi_warn(DEVICE_CTX(dev),
    961868                        "get_configuration failed ret=%d errno=%d", r, errno);
    962                 return LIBUSB_ERROR_IO;
    963         }
    964 
    965         return active_config;
     869                priv->active_config = -1;
     870        } else {
     871                if (active_config > 0) {
     872                        priv->active_config = active_config;
     873                } else {
     874                        /* some buggy devices have a configuration 0, but we're
     875                         * reaching into the corner of a corner case here, so let's
     876                         * not support buggy devices in these circumstances.
     877                         * stick to the specs: a configuration value of 0 means
     878                         * unconfigured. */
     879                        usbi_warn(DEVICE_CTX(dev),
     880                                "active cfg 0? assuming unconfigured device");
     881                        priv->active_config = -1;
     882                }
     883        }
     884
     885        return LIBUSB_SUCCESS;
    966886}
    967887
     
    970890{
    971891        struct linux_device_priv *priv = _device_priv(dev);
    972         unsigned char *dev_buf;
    973         char path[PATH_MAX];
     892        struct libusb_context *ctx = DEVICE_CTX(dev);
     893        int descriptors_size = 512; /* Begin with a 1024 byte alloc */
    974894        int fd, speed;
    975         int active_config = 0;
    976         int device_configured = 1;
    977895        ssize_t r;
    978896
     
    981899
    982900        if (sysfs_dir) {
    983                 priv->sysfs_dir = malloc(strlen(sysfs_dir) + 1);
     901                priv->sysfs_dir = strdup(sysfs_dir);
    984902                if (!priv->sysfs_dir)
    985903                        return LIBUSB_ERROR_NO_MEM;
    986                 strcpy(priv->sysfs_dir, sysfs_dir);
    987904
    988905                /* Note speed can contain 1.5, in this case __read_sysfs_attr
     
    1001918        }
    1002919
     920        /* cache descriptors in memory */
    1003921        if (sysfs_has_descriptors)
    1004                 return 0;
    1005 
    1006         /* cache device descriptor in memory so that we can retrieve it later
    1007          * without waking the device up (op_get_device_descriptor) */
    1008 
    1009         priv->dev_descriptor = NULL;
    1010         priv->config_descriptor = NULL;
    1011 
    1012         if (sysfs_can_relate_devices) {
    1013                 int tmp = sysfs_get_active_config(dev, &active_config);
    1014                 if (tmp < 0)
    1015                         return tmp;
    1016                 if (active_config == -1)
    1017                         device_configured = 0;
    1018         }
    1019 
    1020         _get_usbfs_path(dev, path);
    1021         fd = open(path, O_RDWR);
    1022         if (fd < 0 && errno == EACCES) {
    1023                 fd = open(path, O_RDONLY);
    1024                 /* if we only have read-only access to the device, we cannot
    1025                  * send a control message to determine the active config. just
    1026                  * assume the first one is active. */
    1027                 active_config = -1;
    1028         }
    1029 
     922                fd = _open_sysfs_attr(dev, "descriptors");
     923        else
     924                fd = _get_usbfs_fd(dev, O_RDONLY, 0);
     925        if (fd < 0)
     926                return fd;
     927
     928        do {
     929                descriptors_size *= 2;
     930                priv->descriptors = usbi_reallocf(priv->descriptors,
     931                                                  descriptors_size);
     932                if (!priv->descriptors) {
     933                        close(fd);
     934                        return LIBUSB_ERROR_NO_MEM;
     935                }
     936                /* usbfs has holes in the file */
     937                if (!sysfs_has_descriptors) {
     938                        memset(priv->descriptors + priv->descriptors_len,
     939                               0, descriptors_size - priv->descriptors_len);
     940                }
     941                r = read(fd, priv->descriptors + priv->descriptors_len,
     942                         descriptors_size - priv->descriptors_len);
     943                if (r < 0) {
     944                        usbi_err(ctx, "read descriptor failed ret=%d errno=%d",
     945                                 fd, errno);
     946                        close(fd);
     947                        return LIBUSB_ERROR_IO;
     948                }
     949                priv->descriptors_len += r;
     950        } while (priv->descriptors_len == descriptors_size);
     951
     952        close(fd);
     953
     954        if (priv->descriptors_len < DEVICE_DESC_LENGTH) {
     955                usbi_err(ctx, "short descriptor read (%d)",
     956                         priv->descriptors_len);
     957                return LIBUSB_ERROR_IO;
     958        }
     959
     960        if (sysfs_can_relate_devices)
     961                return LIBUSB_SUCCESS;
     962
     963        /* cache active config */
     964        fd = _get_usbfs_fd(dev, O_RDWR, 1);
    1030965        if (fd < 0) {
    1031                 usbi_err(DEVICE_CTX(dev), "open failed, ret=%d errno=%d", fd, errno);
    1032                 return LIBUSB_ERROR_IO;
    1033         }
    1034 
    1035         if (!sysfs_can_relate_devices) {
    1036                 if (active_config == -1) {
    1037                         /* if we only have read-only access to the device, we cannot
    1038                          * send a control message to determine the active config. just
    1039                          * assume the first one is active. */
    1040                         usbi_warn(DEVICE_CTX(dev), "access to %s is read-only; cannot "
    1041                                 "determine active configuration descriptor", path);
    1042                 } else {
    1043                         active_config = usbfs_get_active_config(dev, fd);
    1044                         if (active_config == LIBUSB_ERROR_IO) {
    1045                                 /* buggy devices sometimes fail to report their active config.
    1046                                  * assume unconfigured and continue the probing */
    1047                                 usbi_warn(DEVICE_CTX(dev), "couldn't query active "
    1048                                         "configuration, assumung unconfigured");
    1049                                 device_configured = 0;
    1050                         } else if (active_config < 0) {
    1051                                 close(fd);
    1052                                 return active_config;
    1053                         } else if (active_config == 0) {
    1054                                 /* some buggy devices have a configuration 0, but we're
    1055                                  * reaching into the corner of a corner case here, so let's
    1056                                  * not support buggy devices in these circumstances.
    1057                                  * stick to the specs: a configuration value of 0 means
    1058                                  * unconfigured. */
    1059                                 usbi_dbg("active cfg 0? assuming unconfigured device");
    1060                                 device_configured = 0;
    1061                         }
    1062                 }
    1063         }
    1064 
    1065         dev_buf = malloc(DEVICE_DESC_LENGTH);
    1066         if (!dev_buf) {
    1067                 close(fd);
     966                /* cannot send a control message to determine the active
     967                 * config. just assume the first one is active. */
     968                usbi_warn(ctx, "Missing rw usbfs access; cannot determine "
     969                               "active configuration descriptor");
     970                if (priv->descriptors_len >=
     971                                (DEVICE_DESC_LENGTH + LIBUSB_DT_CONFIG_SIZE)) {
     972                        struct libusb_config_descriptor config;
     973                        usbi_parse_descriptor(
     974                                priv->descriptors + DEVICE_DESC_LENGTH,
     975                                "bbwbbbbb", &config, 0);
     976                        priv->active_config = config.bConfigurationValue;
     977                } else
     978                        priv->active_config = -1; /* No config dt */
     979
     980                return LIBUSB_SUCCESS;
     981        }
     982
     983        r = usbfs_get_active_config(dev, fd);
     984        close(fd);
     985
     986        return r;
     987}
     988
     989static int linux_get_parent_info(struct libusb_device *dev, const char *sysfs_dir)
     990{
     991        struct libusb_context *ctx = DEVICE_CTX(dev);
     992        struct libusb_device *it;
     993        char *parent_sysfs_dir, *tmp;
     994        int ret, add_parent = 1;
     995
     996        /* XXX -- can we figure out the topology when using usbfs? */
     997        if (NULL == sysfs_dir || 0 == strncmp(sysfs_dir, "usb", 3)) {
     998                /* either using usbfs or finding the parent of a root hub */
     999                return LIBUSB_SUCCESS;
     1000        }
     1001
     1002        parent_sysfs_dir = strdup(sysfs_dir);
     1003        if (NULL == parent_sysfs_dir) {
    10681004                return LIBUSB_ERROR_NO_MEM;
    10691005        }
    1070 
    1071         r = read(fd, dev_buf, DEVICE_DESC_LENGTH);
    1072         if (r < 0) {
    1073                 usbi_err(DEVICE_CTX(dev),
    1074                         "read descriptor failed ret=%d errno=%d", fd, errno);
    1075                 free(dev_buf);
    1076                 close(fd);
    1077                 return LIBUSB_ERROR_IO;
    1078         } else if (r < DEVICE_DESC_LENGTH) {
    1079                 usbi_err(DEVICE_CTX(dev), "short descriptor read (%d)", r);
    1080                 free(dev_buf);
    1081                 close(fd);
    1082                 return LIBUSB_ERROR_IO;
    1083         }
    1084 
    1085         /* bit of a hack: set num_configurations now because cache_active_config()
    1086          * calls usbi_get_config_index_by_value() which uses it */
    1087         dev->num_configurations = dev_buf[DEVICE_DESC_LENGTH - 1];
    1088 
    1089         if (device_configured) {
    1090                 r = cache_active_config(dev, fd, active_config);
    1091                 if (r < 0) {
    1092                         close(fd);
    1093                         free(dev_buf);
    1094                         return r;
    1095                 }
    1096         }
    1097 
    1098         close(fd);
    1099         priv->dev_descriptor = dev_buf;
    1100         return 0;
     1006        if (NULL != (tmp = strrchr(parent_sysfs_dir, '.')) ||
     1007            NULL != (tmp = strrchr(parent_sysfs_dir, '-'))) {
     1008                dev->port_number = atoi(tmp + 1);
     1009                *tmp = '\0';
     1010        } else {
     1011                usbi_warn(ctx, "Can not parse sysfs_dir: %s, no parent info",
     1012                          parent_sysfs_dir);
     1013                free (parent_sysfs_dir);
     1014                return LIBUSB_SUCCESS;
     1015        }
     1016
     1017        /* is the parent a root hub? */
     1018        if (NULL == strchr(parent_sysfs_dir, '-')) {
     1019                tmp = parent_sysfs_dir;
     1020                ret = asprintf (&parent_sysfs_dir, "usb%s", tmp);
     1021                free (tmp);
     1022                if (0 > ret) {
     1023                        return LIBUSB_ERROR_NO_MEM;
     1024                }
     1025        }
     1026
     1027retry:
     1028        /* find the parent in the context */
     1029        usbi_mutex_lock(&ctx->usb_devs_lock);
     1030        list_for_each_entry(it, &ctx->usb_devs, list, struct libusb_device) {
     1031                struct linux_device_priv *priv = _device_priv(it);
     1032                if (0 == strcmp (priv->sysfs_dir, parent_sysfs_dir)) {
     1033                        dev->parent_dev = libusb_ref_device(it);
     1034                        break;
     1035                }
     1036        }
     1037        usbi_mutex_unlock(&ctx->usb_devs_lock);
     1038
     1039        if (!dev->parent_dev && add_parent) {
     1040                usbi_dbg("parent_dev %s not enumerated yet, enumerating now",
     1041                         parent_sysfs_dir);
     1042                sysfs_scan_device(ctx, parent_sysfs_dir);
     1043                add_parent = 0;
     1044                goto retry;
     1045        }
     1046
     1047        usbi_dbg("Dev %p (%s) has parent %p (%s) port %d", dev, sysfs_dir,
     1048                 dev->parent_dev, parent_sysfs_dir, dev->port_number);
     1049
     1050        free (parent_sysfs_dir);
     1051
     1052        return LIBUSB_SUCCESS;
    11011053}
    11021054
    11031055int linux_enumerate_device(struct libusb_context *ctx,
    1104                      uint8_t busnum, uint8_t devaddr,
    1105                      const char *sysfs_dir)
     1056        uint8_t busnum, uint8_t devaddr, const char *sysfs_dir)
    11061057{
    11071058        unsigned long session_id;
     
    11161067                session_id);
    11171068
     1069        dev = usbi_get_device_by_session_id(ctx, session_id);
     1070        if (dev) {
     1071                /* device already exists in the context */
     1072                usbi_dbg("session_id %ld already exists", session_id);
     1073                libusb_unref_device(dev);
     1074                return LIBUSB_SUCCESS;
     1075        }
     1076
    11181077        usbi_dbg("allocating new device for %d/%d (session %ld)",
    11191078                 busnum, devaddr, session_id);
     
    11261085                goto out;
    11271086        r = usbi_sanitize_device(dev);
     1087        if (r < 0)
     1088                goto out;
     1089
     1090        r = linux_get_parent_info(dev, sysfs_dir);
    11281091        if (r < 0)
    11291092                goto out;
     
    11411104        struct libusb_context *ctx;
    11421105
     1106        usbi_mutex_static_lock(&active_contexts_lock);
    11431107        list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
    1144                 if (usbi_get_device_by_session_id(ctx, busnum << 8 | devaddr)) {
    1145                         /* device already exists in the context */
    1146                         usbi_dbg("device already exists in context");
    1147                         continue;
    1148                 }
    1149 
    11501108                linux_enumerate_device(ctx, busnum, devaddr, sys_name);
    11511109        }
    1152 }
    1153 
    1154 void linux_hotplug_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys_name)
     1110        usbi_mutex_static_unlock(&active_contexts_lock);
     1111}
     1112
     1113void linux_device_disconnected(uint8_t busnum, uint8_t devaddr)
    11551114{
    11561115        struct libusb_context *ctx;
    11571116        struct libusb_device *dev;
    1158 
     1117        unsigned long session_id = busnum << 8 | devaddr;
     1118
     1119        usbi_mutex_static_lock(&active_contexts_lock);
    11591120        list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
    1160                 dev = usbi_get_device_by_session_id (ctx, busnum << 8 | devaddr);
     1121                dev = usbi_get_device_by_session_id (ctx, session_id);
    11611122                if (NULL != dev) {
    11621123                        usbi_disconnect_device (dev);
     1124                        libusb_unref_device(dev);
    11631125                } else {
    1164                         usbi_err(ctx, "device not found for session %x", busnum << 8 | devaddr);
    1165                 }
    1166         }
     1126                        usbi_dbg("device not found for session %x", session_id);
     1127                }
     1128        }
     1129        usbi_mutex_static_unlock(&active_contexts_lock);
    11671130}
    11681131
     
    12541217
    12551218}
     1219#endif
    12561220
    12571221static int sysfs_scan_device(struct libusb_context *ctx, const char *devname)
     
    12691233}
    12701234
     1235#if !defined(USE_UDEV)
    12711236static int sysfs_get_device_list(struct libusb_context *ctx)
    12721237{
     
    13191284{
    13201285        struct linux_device_handle_priv *hpriv = _device_handle_priv(handle);
    1321         char filename[PATH_MAX];
    13221286        int r;
    13231287
    1324         _get_usbfs_path(handle->dev, filename);
    1325         usbi_dbg("opening %s", filename);
    1326         hpriv->fd = open(filename, O_RDWR);
     1288        hpriv->fd = _get_usbfs_fd(handle->dev, O_RDWR, 0);
    13271289        if (hpriv->fd < 0) {
    1328                 if (errno == EACCES) {
    1329                         usbi_err(HANDLE_CTX(handle), "libusb couldn't open USB device %s: "
    1330                                 "Permission denied.", filename);
    1331                         usbi_err(HANDLE_CTX(handle),
    1332                                 "libusb requires write access to USB device nodes.");
    1333                         return LIBUSB_ERROR_ACCESS;
    1334                 } else if (errno == ENOENT) {
    1335                         usbi_err(HANDLE_CTX(handle), "libusb couldn't open USB device %s: "
    1336                                 "No such file or directory.", filename);
    1337                         return LIBUSB_ERROR_NO_DEVICE;
    1338                 } else {
    1339                         usbi_err(HANDLE_CTX(handle),
    1340                                 "open failed, code %d errno %d", hpriv->fd, errno);
    1341                         return LIBUSB_ERROR_IO;
    1342                 }
     1290                if (hpriv->fd == LIBUSB_ERROR_NO_DEVICE) {
     1291                        /* device will still be marked as attached if hotplug monitor thread
     1292                         * hasn't processed remove event yet */
     1293                        usbi_mutex_static_lock(&linux_hotplug_lock);
     1294                        if (handle->dev->attached) {
     1295                                usbi_dbg("open failed with no device, but device still attached");
     1296                                linux_device_disconnected(handle->dev->bus_number,
     1297                                                handle->dev->device_address);
     1298                        }
     1299                        usbi_mutex_static_unlock(&linux_hotplug_lock);
     1300                }
     1301                return hpriv->fd;
    13431302        }
    13441303
     
    13461305        if (r < 0) {
    13471306                if (errno == ENOTTY)
    1348                         usbi_dbg("%s: getcap not available", filename);
     1307                        usbi_dbg("getcap not available");
    13491308                else
    1350                         usbi_err(HANDLE_CTX(handle),
    1351                                  "%s: getcap failed (%d)", filename, errno);
     1309                        usbi_err(HANDLE_CTX(handle), "getcap failed (%d)", errno);
    13521310                hpriv->caps = 0;
    13531311                if (supports_flag_zero_packet)
     
    13571315        }
    13581316
    1359         return usbi_add_pollfd(HANDLE_CTX(handle), hpriv->fd, POLLOUT);
     1317        r = usbi_add_pollfd(HANDLE_CTX(handle), hpriv->fd, POLLOUT);
     1318        if (r < 0)
     1319                close(hpriv->fd);
     1320
     1321        return r;
    13601322}
    13611323
    13621324static void op_close(struct libusb_device_handle *dev_handle)
    13631325{
    1364         int fd = _device_handle_priv(dev_handle)->fd;
    1365         usbi_remove_pollfd(HANDLE_CTX(dev_handle), fd);
    1366         close(fd);
     1326        struct linux_device_handle_priv *hpriv = _device_handle_priv(dev_handle);
     1327        /* fd may have already been removed by POLLERR condition in op_handle_events() */
     1328        if (!hpriv->fd_removed)
     1329                usbi_remove_pollfd(HANDLE_CTX(dev_handle), hpriv->fd);
     1330        close(hpriv->fd);
    13671331}
    13681332
     
    13711335{
    13721336        int r;
    1373         if (sysfs_can_relate_devices != 1)
    1374                 return LIBUSB_ERROR_NOT_SUPPORTED;
    1375 
    1376         r = sysfs_get_active_config(handle->dev, config);
     1337
     1338        if (sysfs_can_relate_devices) {
     1339                r = sysfs_get_active_config(handle->dev, config);
     1340        } else {
     1341                r = usbfs_get_active_config(handle->dev,
     1342                                            _device_handle_priv(handle)->fd);
     1343                if (r == LIBUSB_SUCCESS)
     1344                        *config = _device_priv(handle->dev)->active_config;
     1345        }
    13771346        if (r < 0)
    13781347                return r;
     
    14031372        }
    14041373
    1405         if (!sysfs_has_descriptors) {
    1406                 /* update our cached active config descriptor */
    1407                 if (config == -1) {
    1408                         if (priv->config_descriptor) {
    1409                                 free(priv->config_descriptor);
    1410                                 priv->config_descriptor = NULL;
    1411                         }
    1412                 } else {
    1413                         r = cache_active_config(handle->dev, fd, config);
    1414                         if (r < 0)
    1415                                 usbi_warn(HANDLE_CTX(handle),
    1416                                         "failed to update cached config descriptor, error %d", r);
    1417                 }
    1418         }
    1419 
    1420         return 0;
    1421 }
    1422 
    1423 static int op_claim_interface(struct libusb_device_handle *handle, int iface)
     1374        /* update our cached active config descriptor */
     1375        priv->active_config = config;
     1376
     1377        return LIBUSB_SUCCESS;
     1378}
     1379
     1380static int claim_interface(struct libusb_device_handle *handle, int iface)
    14241381{
    14251382        int fd = _device_handle_priv(handle)->fd;
     
    14401397}
    14411398
    1442 static int op_release_interface(struct libusb_device_handle *handle, int iface)
     1399static int release_interface(struct libusb_device_handle *handle, int iface)
    14431400{
    14441401        int fd = _device_handle_priv(handle)->fd;
     
    15111468        for (i = 0; i < USB_MAXINTERFACES; i++) {
    15121469                if (handle->claimed_interfaces & (1L << i)) {
    1513                         op_release_interface(handle, i);
     1470                        release_interface(handle, i);
    15141471                }
    15151472        }
     
    15321489        for (i = 0; i < USB_MAXINTERFACES; i++) {
    15331490                if (handle->claimed_interfaces & (1L << i)) {
    1534                         r = op_claim_interface(handle, i);
     1491                        /*
     1492                         * A driver may have completed modprobing during
     1493                         * IOCTL_USBFS_RESET, and bound itself as soon as
     1494                         * IOCTL_USBFS_RESET released the device lock
     1495                         */
     1496                        r = detach_kernel_driver_and_claim(handle, i);
    15351497                        if (r) {
    15361498                                usbi_warn(HANDLE_CTX(handle),
    1537                                         "failed to re-claim interface %d after reset", i);
     1499                                        "failed to re-claim interface %d after reset: %s",
     1500                                        i, libusb_error_name(r));
    15381501                                handle->claimed_interfaces &= ~(1L << i);
     1502                                ret = LIBUSB_ERROR_NOT_FOUND;
    15391503                        }
    15401504                }
     
    15431507        usbi_mutex_unlock(&handle->lock);
    15441508        return ret;
     1509}
     1510
     1511static int do_streams_ioctl(struct libusb_device_handle *handle, long req,
     1512        uint32_t num_streams, unsigned char *endpoints, int num_endpoints)
     1513{
     1514        int r, fd = _device_handle_priv(handle)->fd;
     1515        struct usbfs_streams *streams;
     1516
     1517        if (num_endpoints > 30) /* Max 15 in + 15 out eps */
     1518                return LIBUSB_ERROR_INVALID_PARAM;
     1519
     1520        streams = malloc(sizeof(struct usbfs_streams) + num_endpoints);
     1521        if (!streams)
     1522                return LIBUSB_ERROR_NO_MEM;
     1523
     1524        streams->num_streams = num_streams;
     1525        streams->num_eps = num_endpoints;
     1526        memcpy(streams->eps, endpoints, num_endpoints);
     1527
     1528        r = ioctl(fd, req, streams);
     1529
     1530        free(streams);
     1531
     1532        if (r < 0) {
     1533                if (errno == ENOTTY)
     1534                        return LIBUSB_ERROR_NOT_SUPPORTED;
     1535                else if (errno == EINVAL)
     1536                        return LIBUSB_ERROR_INVALID_PARAM;
     1537                else if (errno == ENODEV)
     1538                        return LIBUSB_ERROR_NO_DEVICE;
     1539
     1540                usbi_err(HANDLE_CTX(handle),
     1541                        "streams-ioctl failed error %d errno %d", r, errno);
     1542                return LIBUSB_ERROR_OTHER;
     1543        }
     1544        return r;
     1545}
     1546
     1547static int op_alloc_streams(struct libusb_device_handle *handle,
     1548        uint32_t num_streams, unsigned char *endpoints, int num_endpoints)
     1549{
     1550        return do_streams_ioctl(handle, IOCTL_USBFS_ALLOC_STREAMS,
     1551                                num_streams, endpoints, num_endpoints);
     1552}
     1553
     1554static int op_free_streams(struct libusb_device_handle *handle,
     1555                unsigned char *endpoints, int num_endpoints)
     1556{
     1557        return do_streams_ioctl(handle, IOCTL_USBFS_FREE_STREAMS, 0,
     1558                                endpoints, num_endpoints);
     1559}
     1560
     1561static unsigned char *op_dev_mem_alloc(struct libusb_device_handle *handle,
     1562        size_t len)
     1563{
     1564        struct linux_device_handle_priv *hpriv = _device_handle_priv(handle);
     1565        unsigned char *buffer = (unsigned char *)mmap(NULL, len,
     1566                PROT_READ | PROT_WRITE, MAP_SHARED, hpriv->fd, 0);
     1567        if (buffer == MAP_FAILED) {
     1568                usbi_err(HANDLE_CTX(handle), "alloc dev mem failed errno %d",
     1569                        errno);
     1570                return NULL;
     1571        }
     1572        return buffer;
     1573}
     1574
     1575static int op_dev_mem_free(struct libusb_device_handle *handle,
     1576        unsigned char *buffer, size_t len)
     1577{
     1578        if (munmap(buffer, len) != 0) {
     1579                usbi_err(HANDLE_CTX(handle), "free dev mem failed errno %d",
     1580                        errno);
     1581                return LIBUSB_ERROR_OTHER;
     1582        } else {
     1583                return LIBUSB_SUCCESS;
     1584        }
    15451585}
    15461586
     
    15651605        }
    15661606
    1567         return 1;
     1607        return (strcmp(getdrv.driver, "usbfs") == 0) ? 0 : 1;
    15681608}
    15691609
     
    15731613        int fd = _device_handle_priv(handle)->fd;
    15741614        struct usbfs_ioctl command;
     1615        struct usbfs_getdriver getdrv;
    15751616        int r;
    15761617
     
    15781619        command.ioctl_code = IOCTL_USBFS_DISCONNECT;
    15791620        command.data = NULL;
     1621
     1622        getdrv.interface = interface;
     1623        r = ioctl(fd, IOCTL_USBFS_GETDRIVER, &getdrv);
     1624        if (r == 0 && strcmp(getdrv.driver, "usbfs") == 0)
     1625                return LIBUSB_ERROR_NOT_FOUND;
    15801626
    15811627        r = ioctl(fd, IOCTL_USBFS_IOCTL, &command);
     
    16281674}
    16291675
     1676static int detach_kernel_driver_and_claim(struct libusb_device_handle *handle,
     1677        int interface)
     1678{
     1679        struct usbfs_disconnect_claim dc;
     1680        int r, fd = _device_handle_priv(handle)->fd;
     1681
     1682        dc.interface = interface;
     1683        strcpy(dc.driver, "usbfs");
     1684        dc.flags = USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER;
     1685        r = ioctl(fd, IOCTL_USBFS_DISCONNECT_CLAIM, &dc);
     1686        if (r == 0 || (r != 0 && errno != ENOTTY)) {
     1687                if (r == 0)
     1688                        return 0;
     1689
     1690                switch (errno) {
     1691                case EBUSY:
     1692                        return LIBUSB_ERROR_BUSY;
     1693                case EINVAL:
     1694                        return LIBUSB_ERROR_INVALID_PARAM;
     1695                case ENODEV:
     1696                        return LIBUSB_ERROR_NO_DEVICE;
     1697                }
     1698                usbi_err(HANDLE_CTX(handle),
     1699                        "disconnect-and-claim failed errno %d", errno);
     1700                return LIBUSB_ERROR_OTHER;
     1701        }
     1702
     1703        /* Fallback code for kernels which don't support the
     1704           disconnect-and-claim ioctl */
     1705        r = op_detach_kernel_driver(handle, interface);
     1706        if (r != 0 && r != LIBUSB_ERROR_NOT_FOUND)
     1707                return r;
     1708
     1709        return claim_interface(handle, interface);
     1710}
     1711
     1712static int op_claim_interface(struct libusb_device_handle *handle, int iface)
     1713{
     1714        if (handle->auto_detach_kernel_driver)
     1715                return detach_kernel_driver_and_claim(handle, iface);
     1716        else
     1717                return claim_interface(handle, iface);
     1718}
     1719
     1720static int op_release_interface(struct libusb_device_handle *handle, int iface)
     1721{
     1722        int r;
     1723
     1724        r = release_interface(handle, iface);
     1725        if (r)
     1726                return r;
     1727
     1728        if (handle->auto_detach_kernel_driver)
     1729                op_attach_kernel_driver(handle, iface);
     1730
     1731        return 0;
     1732}
     1733
    16301734static void op_destroy_device(struct libusb_device *dev)
    16311735{
    16321736        struct linux_device_priv *priv = _device_priv(dev);
    1633         if (!sysfs_has_descriptors) {
    1634                 if (priv->dev_descriptor)
    1635                         free(priv->dev_descriptor);
    1636                 if (priv->config_descriptor)
    1637                         free(priv->config_descriptor);
    1638         }
     1737        if (priv->descriptors)
     1738                free(priv->descriptors);
    16391739        if (priv->sysfs_dir)
    16401740                free(priv->sysfs_dir);
     
    16921792}
    16931793
    1694 static int submit_bulk_transfer(struct usbi_transfer *itransfer,
    1695         unsigned char urb_type)
     1794static int submit_bulk_transfer(struct usbi_transfer *itransfer)
    16961795{
    16971796        struct libusb_transfer *transfer =
     
    17061805        int r;
    17071806        int i;
    1708         size_t alloc_size;
    1709 
    1710         if (tpriv->urbs)
    1711                 return LIBUSB_ERROR_BUSY;
    17121807
    17131808        if (is_out && (transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) &&
     
    17681863        usbi_dbg("need %d urbs for new transfer with length %d", num_urbs,
    17691864                transfer->length);
    1770         alloc_size = num_urbs * sizeof(struct usbfs_urb);
    1771         urbs = malloc(alloc_size);
     1865        urbs = calloc(num_urbs, sizeof(struct usbfs_urb));
    17721866        if (!urbs)
    17731867                return LIBUSB_ERROR_NO_MEM;
    1774         memset(urbs, 0, alloc_size);
    17751868        tpriv->urbs = urbs;
    17761869        tpriv->num_urbs = num_urbs;
     
    17821875                struct usbfs_urb *urb = &urbs[i];
    17831876                urb->usercontext = itransfer;
    1784                 urb->type = urb_type;
     1877                switch (transfer->type) {
     1878                case LIBUSB_TRANSFER_TYPE_BULK:
     1879                        urb->type = USBFS_URB_TYPE_BULK;
     1880                        urb->stream_id = 0;
     1881                        break;
     1882                case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
     1883                        urb->type = USBFS_URB_TYPE_BULK;
     1884                        urb->stream_id = itransfer->stream_id;
     1885                        break;
     1886                case LIBUSB_TRANSFER_TYPE_INTERRUPT:
     1887                        urb->type = USBFS_URB_TYPE_INTERRUPT;
     1888                        break;
     1889                }
    17851890                urb->endpoint = transfer->endpoint;
    17861891                urb->buffer = transfer->buffer + (i * bulk_buffer_len);
    1787                 /* don't set the short not ok flag for the last URB */
    1788                 if (use_bulk_continuation && !is_out && i < num_urbs - 1)
     1892                /* don't set the short not ok flag for the last URB */
     1893                if (use_bulk_continuation && !is_out && (i < num_urbs - 1))
    17891894                        urb->flags = USBFS_URB_SHORT_NOT_OK;
    17901895                if (i == num_urbs - 1 && last_urb_partial)
     
    18121917                                r = LIBUSB_ERROR_IO;
    18131918                        }
    1814        
     1919
    18151920                        /* if the first URB submission fails, we can simply free up and
    18161921                         * return failure immediately. */
     
    18761981        unsigned char *urb_buffer = transfer->buffer;
    18771982
    1878         if (tpriv->iso_urbs)
    1879                 return LIBUSB_ERROR_BUSY;
    1880 
    1881         /* usbfs places a 32kb limit on iso URBs. we divide up larger requests
    1882          * into smaller units to meet such restriction, then fire off all the
    1883          * units at once. it would be simpler if we just fired one unit at a time,
    1884          * but there is a big performance gain through doing it this way.
    1885          *
    1886          * Newer kernels lift the 32k limit (USBFS_CAP_NO_PACKET_SIZE_LIM),
    1887          * using arbritary large transfers is still be a bad idea though, as
    1888          * the kernel needs to allocate physical contiguous memory for this,
    1889          * which may fail for large buffers.
     1983        /* usbfs places arbitrary limits on iso URBs. this limit has changed
     1984         * at least three times, and it's difficult to accurately detect which
     1985         * limit this running kernel might impose. so we attempt to submit
     1986         * whatever the user has provided. if the kernel rejects the request
     1987         * due to its size, we return an error indicating such to the user.
    18901988         */
    18911989
     
    18981996                        num_urbs++;
    18991997                        this_urb_len = packet_len;
     1998                        /* check that we can actually support this packet length */
     1999                        if (this_urb_len > MAX_ISO_BUFFER_LENGTH)
     2000                                return LIBUSB_ERROR_INVALID_PARAM;
    19002001                } else {
    19012002                        this_urb_len += packet_len;
    19022003                }
    19032004        }
    1904         usbi_dbg("need %d 32k URBs for transfer", num_urbs);
    1905 
    1906         alloc_size = num_urbs * sizeof(*urbs);
    1907         urbs = malloc(alloc_size);
     2005        usbi_dbg("need %d %dk URBs for transfer", num_urbs, MAX_ISO_BUFFER_LENGTH / 1024);
     2006
     2007        urbs = calloc(num_urbs, sizeof(*urbs));
    19082008        if (!urbs)
    19092009                return LIBUSB_ERROR_NO_MEM;
    1910         memset(urbs, 0, alloc_size);
    19112010
    19122011        tpriv->iso_urbs = urbs;
     
    19422041                alloc_size = sizeof(*urb)
    19432042                        + (urb_packet_offset * sizeof(struct usbfs_iso_packet_desc));
    1944                 urb = malloc(alloc_size);
     2043                urb = calloc(1, alloc_size);
    19452044                if (!urb) {
    19462045                        free_iso_urbs(tpriv);
    19472046                        return LIBUSB_ERROR_NO_MEM;
    19482047                }
    1949                 memset(urb, 0, alloc_size);
    19502048                urbs[i] = urb;
    19512049
     
    19722070                        if (errno == ENODEV) {
    19732071                                r = LIBUSB_ERROR_NO_DEVICE;
     2072                        } else if (errno == EINVAL) {
     2073                                usbi_warn(TRANSFER_CTX(transfer),
     2074                                        "submiturb failed, transfer too large");
     2075                                r = LIBUSB_ERROR_INVALID_PARAM;
    19742076                        } else {
    19752077                                usbi_err(TRANSFER_CTX(transfer),
     
    20252127        int r;
    20262128
    2027         if (tpriv->urbs)
    2028                 return LIBUSB_ERROR_BUSY;
    2029 
    20302129        if (transfer->length - LIBUSB_CONTROL_SETUP_SIZE > MAX_CTRL_BUFFER_LENGTH)
    20312130                return LIBUSB_ERROR_INVALID_PARAM;
    20322131
    2033         urb = malloc(sizeof(struct usbfs_urb));
     2132        urb = calloc(1, sizeof(struct usbfs_urb));
    20342133        if (!urb)
    20352134                return LIBUSB_ERROR_NO_MEM;
    2036         memset(urb, 0, sizeof(struct usbfs_urb));
    20372135        tpriv->urbs = urb;
    20382136        tpriv->num_urbs = 1;
     
    20682166                return submit_control_transfer(itransfer);
    20692167        case LIBUSB_TRANSFER_TYPE_BULK:
    2070                 return submit_bulk_transfer(itransfer, USBFS_URB_TYPE_BULK);
     2168        case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
     2169                return submit_bulk_transfer(itransfer);
    20712170        case LIBUSB_TRANSFER_TYPE_INTERRUPT:
    2072                 return submit_bulk_transfer(itransfer, USBFS_URB_TYPE_INTERRUPT);
     2171                return submit_bulk_transfer(itransfer);
    20732172        case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
    20742173                return submit_iso_transfer(itransfer);
     
    20852184        struct libusb_transfer *transfer =
    20862185                USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
     2186        int r;
     2187
     2188        if (!tpriv->urbs)
     2189                return LIBUSB_ERROR_NOT_FOUND;
     2190
     2191        r = discard_urbs(itransfer, 0, tpriv->num_urbs);
     2192        if (r != 0)
     2193                return r;
    20872194
    20882195        switch (transfer->type) {
    20892196        case LIBUSB_TRANSFER_TYPE_BULK:
     2197        case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
    20902198                if (tpriv->reap_action == ERROR)
    20912199                        break;
    20922200                /* else, fall through */
    2093         case LIBUSB_TRANSFER_TYPE_CONTROL:
    2094         case LIBUSB_TRANSFER_TYPE_INTERRUPT:
    2095         case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
     2201        default:
    20962202                tpriv->reap_action = CANCELLED;
    2097                 break;
    2098         default:
    2099                 usbi_err(TRANSFER_CTX(transfer),
    2100                         "unknown endpoint type %d", transfer->type);
    2101                 return LIBUSB_ERROR_INVALID_PARAM;
    2102         }
    2103 
    2104         if (!tpriv->urbs)
    2105                 return LIBUSB_ERROR_NOT_FOUND;
    2106 
    2107         return discard_urbs(itransfer, 0, tpriv->num_urbs);
     2203        }
     2204
     2205        return 0;
    21082206}
    21092207
     
    21182216        case LIBUSB_TRANSFER_TYPE_CONTROL:
    21192217        case LIBUSB_TRANSFER_TYPE_BULK:
     2218        case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
    21202219        case LIBUSB_TRANSFER_TYPE_INTERRUPT:
    2121                 usbi_mutex_lock(&itransfer->lock);
    2122                 if (tpriv->urbs)
     2220                if (tpriv->urbs) {
    21232221                        free(tpriv->urbs);
    2124                 tpriv->urbs = NULL;
    2125                 usbi_mutex_unlock(&itransfer->lock);
     2222                        tpriv->urbs = NULL;
     2223                }
    21262224                break;
    21272225        case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
    2128                 usbi_mutex_lock(&itransfer->lock);
    2129                 if (tpriv->iso_urbs)
     2226                if (tpriv->iso_urbs) {
    21302227                        free_iso_urbs(tpriv);
    2131                 usbi_mutex_unlock(&itransfer->lock);
     2228                        tpriv->iso_urbs = NULL;
     2229                }
    21322230                break;
    21332231        default:
     
    24862584                return handle_iso_completion(itransfer, urb);
    24872585        case LIBUSB_TRANSFER_TYPE_BULK:
     2586        case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
    24882587        case LIBUSB_TRANSFER_TYPE_INTERRUPT:
    24892588                return handle_bulk_completion(itransfer, urb);
     
    25192618                }
    25202619
     2620                if (!hpriv || hpriv->fd != pollfd->fd) {
     2621                        usbi_err(ctx, "cannot find handle for fd %d",
     2622                                 pollfd->fd);
     2623                        continue;
     2624                }
     2625
    25212626                if (pollfd->revents & POLLERR) {
     2627                        /* remove the fd from the pollfd set so that it doesn't continuously
     2628                         * trigger an event, and flag that it has been removed so op_close()
     2629                         * doesn't try to remove it a second time */
    25222630                        usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->fd);
     2631                        hpriv->fd_removed = 1;
     2632
     2633                        /* device will still be marked as attached if hotplug monitor thread
     2634                         * hasn't processed remove event yet */
     2635                        usbi_mutex_static_lock(&linux_hotplug_lock);
     2636                        if (handle->dev->attached)
     2637                                linux_device_disconnected(handle->dev->bus_number,
     2638                                                handle->dev->device_address);
     2639                        usbi_mutex_static_unlock(&linux_hotplug_lock);
     2640
     2641                        if (hpriv->caps & USBFS_CAP_REAP_AFTER_DISCONNECT) {
     2642                                do {
     2643                                        r = reap_for_handle(handle);
     2644                                } while (r == 0);
     2645                        }
     2646
    25232647                        usbi_handle_disconnect(handle);
    25242648                        continue;
    25252649                }
    25262650
    2527                 r = reap_for_handle(handle);
     2651                do {
     2652                        r = reap_for_handle(handle);
     2653                } while (r == 0);
    25282654                if (r == 1 || r == LIBUSB_ERROR_NO_DEVICE)
    25292655                        continue;
     
    25602686const struct usbi_os_backend linux_usbfs_backend = {
    25612687        .name = "Linux usbfs",
     2688        .caps = USBI_CAP_HAS_HID_ACCESS|USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER,
    25622689        .init = op_init,
    25632690        .exit = op_exit,
    25642691        .get_device_list = NULL,
     2692        .hotplug_poll = op_hotplug_poll,
    25652693        .get_device_descriptor = op_get_device_descriptor,
    25662694        .get_active_config_descriptor = op_get_active_config_descriptor,
    25672695        .get_config_descriptor = op_get_config_descriptor,
     2696        .get_config_descriptor_by_value = op_get_config_descriptor_by_value,
    25682697
    25692698        .open = op_open,
     
    25782707        .reset_device = op_reset_device,
    25792708
     2709        .alloc_streams = op_alloc_streams,
     2710        .free_streams = op_free_streams,
     2711
     2712        .dev_mem_alloc = op_dev_mem_alloc,
     2713        .dev_mem_free = op_dev_mem_free,
     2714
    25802715        .kernel_driver_active = op_kernel_driver_active,
    25812716        .detach_kernel_driver = op_detach_kernel_driver,
     
    25992734        .device_handle_priv_size = sizeof(struct linux_device_handle_priv),
    26002735        .transfer_priv_size = sizeof(struct linux_transfer_priv),
    2601         .add_iso_packet_size = 0,
    26022736};
    2603 
  • TabularUnified libusb1/trunk/libusb/os/linux_usbfs.h

    r1876 r1882  
    11/*
    22 * usbfs header structures
    3  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
    4  * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
     3 * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
     4 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    8282};
    8383
    84 #define MAX_ISO_BUFFER_LENGTH           32768
     84#define MAX_ISO_BUFFER_LENGTH           49152 * 128
    8585#define MAX_BULK_BUFFER_LENGTH          16384
    8686#define MAX_CTRL_BUFFER_LENGTH          4096
     
    9595        int actual_length;
    9696        int start_frame;
    97         int number_of_packets;
     97        union {
     98                int number_of_packets;  /* Only used for isoc urbs */
     99                unsigned int stream_id; /* Only used with bulk streams */
     100        };
    98101        int error_count;
    99102        unsigned int signr;
     
    123126#define USBFS_CAP_NO_PACKET_SIZE_LIM    0x04
    124127#define USBFS_CAP_BULK_SCATTER_GATHER   0x08
     128#define USBFS_CAP_REAP_AFTER_DISCONNECT 0x10
     129
     130#define USBFS_DISCONNECT_CLAIM_IF_DRIVER        0x01
     131#define USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER    0x02
     132
     133struct usbfs_disconnect_claim {
     134        unsigned int interface;
     135        unsigned int flags;
     136        char driver[USBFS_MAXDRIVERNAME + 1];
     137};
     138
     139struct usbfs_streams {
     140        unsigned int num_streams; /* Not used by USBDEVFS_FREE_STREAMS */
     141        unsigned int num_eps;
     142        unsigned char eps[0];
     143};
    125144
    126145#define IOCTL_USBFS_CONTROL     _IOWR('U', 0, struct usbfs_ctrltransfer)
     
    146165#define IOCTL_USBFS_RELEASE_PORT        _IOR('U', 25, unsigned int)
    147166#define IOCTL_USBFS_GET_CAPABILITIES    _IOR('U', 26, __u32)
     167#define IOCTL_USBFS_DISCONNECT_CLAIM    _IOR('U', 27, struct usbfs_disconnect_claim)
     168#define IOCTL_USBFS_ALLOC_STREAMS       _IOR('U', 28, struct usbfs_streams)
     169#define IOCTL_USBFS_FREE_STREAMS        _IOR('U', 29, struct usbfs_streams)
     170
     171extern usbi_mutex_static_t linux_hotplug_lock;
    148172
    149173#if defined(HAVE_LIBUDEV)
     
    151175int linux_udev_stop_event_monitor(void);
    152176int linux_udev_scan_devices(struct libusb_context *ctx);
     177void linux_udev_hotplug_poll(void);
    153178#else
    154179int linux_netlink_start_event_monitor(void);
    155180int linux_netlink_stop_event_monitor(void);
     181void linux_netlink_hotplug_poll(void);
    156182#endif
    157183
    158184void linux_hotplug_enumerate(uint8_t busnum, uint8_t devaddr, const char *sys_name);
    159 void linux_hotplug_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys_name);
     185void linux_device_disconnected(uint8_t busnum, uint8_t devaddr);
    160186
    161187int linux_get_device_address (struct libusb_context *ctx, int detached,
    162                               uint8_t *busnum, uint8_t *devaddr,
    163                               const char *dev_node, const char *sys_name);
     188        uint8_t *busnum, uint8_t *devaddr, const char *dev_node,
     189        const char *sys_name);
    164190int linux_enumerate_device(struct libusb_context *ctx,
    165                            uint8_t busnum, uint8_t devaddr,
    166                            const char *sysfs_dir);
     191        uint8_t busnum, uint8_t devaddr, const char *sysfs_dir);
    167192
    168193#endif
  • TabularUnified libusb1/trunk/libusb/os/openbsd_usb.c

    r1876 r1882  
    11/*
    2  * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
     2 * Copyright © 2011-2013 Martin Pieuchot <mpi@openbsd.org>
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    1717 */
    1818
     19#include <config.h>
     20
    1921#include <sys/time.h>
    2022#include <sys/types.h>
     
    2931#include <dev/usb/usb.h>
    3032
    31 #include "libusb.h"
    3233#include "libusbi.h"
    3334
    3435struct device_priv {
    35         char devnode[16];
    36         int fd;
     36        char *devname;                          /* name of the ugen(4) node */
     37        int fd;                                 /* device file descriptor */
    3738
    3839        unsigned char *cdesc;                   /* active config descriptor */
     
    4142
    4243struct handle_priv {
    43         int pipe[2];                            /* for event notification */
    4444        int endpoints[USB_MAX_ENDPOINTS];
    4545};
     
    7575static int obsd_cancel_transfer(struct usbi_transfer *);
    7676static void obsd_clear_transfer_priv(struct usbi_transfer *);
    77 static int obsd_handle_events(struct libusb_context *ctx, struct pollfd *,
    78     nfds_t, int);
     77static int obsd_handle_transfer_completion(struct usbi_transfer *);
    7978static int obsd_clock_gettime(int, struct timespec *);
    8079
     
    8382 */
    8483static int _errno_to_libusb(int);
    85 static int _cache_active_config_descriptor(struct libusb_device *, int);
     84static int _cache_active_config_descriptor(struct libusb_device *);
    8685static int _sync_control_transfer(struct usbi_transfer *);
    8786static int _sync_gen_transfer(struct usbi_transfer *);
    8887static int _access_endpoint(struct libusb_transfer *);
    8988
     89static int _bus_open(int);
     90
     91
    9092const struct usbi_os_backend openbsd_backend = {
    9193        "Synchronous OpenBSD backend",
     94        0,
    9295        NULL,                           /* init() */
    9396        NULL,                           /* exit() */
    9497        obsd_get_device_list,
     98        NULL,                           /* hotplug_poll */
    9599        obsd_open,
    96100        obsd_close,
     
    99103        obsd_get_active_config_descriptor,
    100104        obsd_get_config_descriptor,
     105        NULL,                           /* get_config_descriptor_by_value() */
    101106
    102107        obsd_get_configuration,
     
    110115        obsd_reset_device,
    111116
     117        NULL,                           /* alloc_streams */
     118        NULL,                           /* free_streams */
     119
     120        NULL,                           /* dev_mem_alloc() */
     121        NULL,                           /* dev_mem_free() */
     122
    112123        NULL,                           /* kernel_driver_active() */
    113124        NULL,                           /* detach_kernel_driver() */
     
    120131        obsd_clear_transfer_priv,
    121132
    122         obsd_handle_events,
     133        NULL,                           /* handle_events() */
     134        obsd_handle_transfer_completion,
    123135
    124136        obsd_clock_gettime,
     
    126138        sizeof(struct handle_priv),
    127139        0,                              /* transfer_priv_size */
    128         0,                              /* add_iso_packet_size */
    129140};
     141
     142#define DEVPATH "/dev/"
     143#define USBDEV  DEVPATH "usb"
    130144
    131145int
     
    133147        struct discovered_devs **discdevs)
    134148{
     149        struct discovered_devs *ddd;
    135150        struct libusb_device *dev;
    136151        struct device_priv *dpriv;
    137152        struct usb_device_info di;
     153        struct usb_device_ddesc dd;
    138154        unsigned long session_id;
    139         char devnode[16];
    140         int fd, err, i;
     155        char devices[USB_MAX_DEVICES];
     156        char busnode[16];
     157        char *udevname;
     158        int fd, addr, i, j;
    141159
    142160        usbi_dbg("");
    143161
    144         /* Only ugen(4) is supported */
    145         for (i = 0; i < USB_MAX_DEVICES; i++) {
    146                 /* Control endpoint is always .00 */
    147                 snprintf(devnode, sizeof(devnode), "/dev/ugen%d.00", i);
    148 
    149                 if ((fd = open(devnode, O_RDONLY)) < 0) {
     162        for (i = 0; i < 8; i++) {
     163                snprintf(busnode, sizeof(busnode), USBDEV "%d", i);
     164
     165                if ((fd = open(busnode, O_RDWR)) < 0) {
    150166                        if (errno != ENOENT && errno != ENXIO)
    151                                 usbi_err(ctx, "could not open %s", devnode);
     167                                usbi_err(ctx, "could not open %s", busnode);
    152168                        continue;
    153169                }
    154170
    155                 if (ioctl(fd, USB_GET_DEVICEINFO, &di) < 0)
    156                         continue;
    157 
    158                 session_id = (di.udi_bus << 8 | di.udi_addr);
    159                 dev = usbi_get_device_by_session_id(ctx, session_id);
    160 
    161                 if (dev == NULL) {
    162                         dev = usbi_alloc_device(ctx, session_id);
    163                         if (dev == NULL)
     171                bzero(devices, sizeof(devices));
     172                for (addr = 1; addr < USB_MAX_DEVICES; addr++) {
     173                        if (devices[addr])
     174                                continue;
     175
     176                        di.udi_addr = addr;
     177                        if (ioctl(fd, USB_DEVICEINFO, &di) < 0)
     178                                continue;
     179
     180                        /*
     181                         * XXX If ugen(4) is attached to the USB device
     182                         * it will be used.
     183                         */
     184                        udevname = NULL;
     185                        for (j = 0; j < USB_MAX_DEVNAMES; j++)
     186                                if (!strncmp("ugen", di.udi_devnames[j], 4)) {
     187                                        udevname = strdup(di.udi_devnames[j]);
     188                                        break;
     189                                }
     190
     191                        session_id = (di.udi_bus << 8 | di.udi_addr);
     192                        dev = usbi_get_device_by_session_id(ctx, session_id);
     193
     194                        if (dev == NULL) {
     195                                dev = usbi_alloc_device(ctx, session_id);
     196                                if (dev == NULL) {
     197                                        close(fd);
     198                                        return (LIBUSB_ERROR_NO_MEM);
     199                                }
     200
     201                                dev->bus_number = di.udi_bus;
     202                                dev->device_address = di.udi_addr;
     203                                dev->speed = di.udi_speed;
     204
     205                                dpriv = (struct device_priv *)dev->os_priv;
     206                                dpriv->fd = -1;
     207                                dpriv->cdesc = NULL;
     208                                dpriv->devname = udevname;
     209
     210                                dd.udd_bus = di.udi_bus;
     211                                dd.udd_addr = di.udi_addr;
     212                                if (ioctl(fd, USB_DEVICE_GET_DDESC, &dd) < 0) {
     213                                        libusb_unref_device(dev);
     214                                        continue;
     215                                }
     216                                dpriv->ddesc = dd.udd_desc;
     217
     218                                if (_cache_active_config_descriptor(dev)) {
     219                                        libusb_unref_device(dev);
     220                                        continue;
     221                                }
     222
     223                                if (usbi_sanitize_device(dev)) {
     224                                        libusb_unref_device(dev);
     225                                        continue;
     226                                }
     227                        }
     228
     229                        ddd = discovered_devs_append(*discdevs, dev);
     230                        if (ddd == NULL) {
     231                                close(fd);
    164232                                return (LIBUSB_ERROR_NO_MEM);
    165 
    166                         dev->bus_number = di.udi_bus;
    167                         dev->device_address = di.udi_addr;
    168                         dev->speed = di.udi_speed;
    169 
    170                         dpriv = (struct device_priv *)dev->os_priv;
    171                         strlcpy(dpriv->devnode, devnode, sizeof(devnode));
    172                         dpriv->fd = -1;
    173 
    174                         if (ioctl(fd, USB_GET_DEVICE_DESC, &dpriv->ddesc) < 0) {
    175                                 err = errno;
    176                                 goto error;
    177233                        }
    178 
    179                         dpriv->cdesc = NULL;
    180                         if (_cache_active_config_descriptor(dev, fd)) {
    181                                 err = errno;
    182                                 goto error;
    183                         }
    184 
    185                         if ((err = usbi_sanitize_device(dev)))
    186                                 goto error;
     234                        libusb_unref_device(dev);
     235
     236                        *discdevs = ddd;
     237                        devices[addr] = 1;
    187238                }
     239
    188240                close(fd);
    189 
    190                 if (discovered_devs_append(*discdevs, dev) == NULL)
    191                         return (LIBUSB_ERROR_NO_MEM);
    192         }
    193 
    194         return (LIBUSB_SUCCESS);
    195 
    196 error:
    197         close(fd);
    198         libusb_unref_device(dev);
    199         return _errno_to_libusb(err);
     241        }
     242
     243        return (LIBUSB_SUCCESS);
    200244}
    201245
     
    205249        struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
    206250        struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
    207 
    208         dpriv->fd = open(dpriv->devnode, O_RDWR);
    209         if (dpriv->fd < 0) {
    210                 dpriv->fd = open(dpriv->devnode, O_RDONLY);
     251        char devnode[16];
     252
     253        if (dpriv->devname) {
     254                /*
     255                 * Only open ugen(4) attached devices read-write, all
     256                 * read-only operations are done through the bus node.
     257                 */
     258                snprintf(devnode, sizeof(devnode), DEVPATH "%s.00",
     259                    dpriv->devname);
     260                dpriv->fd = open(devnode, O_RDWR);
    211261                if (dpriv->fd < 0)
    212262                        return _errno_to_libusb(errno);
    213         }
    214 
    215         usbi_dbg("open %s: fd %d", dpriv->devnode, dpriv->fd);
    216 
    217         if (pipe(hpriv->pipe) < 0)
    218                 return _errno_to_libusb(errno);
    219 
    220         return usbi_add_pollfd(HANDLE_CTX(handle), hpriv->pipe[0], POLLIN);
     263
     264                usbi_dbg("open %s: fd %d", devnode, dpriv->fd);
     265        }
     266
     267        return (LIBUSB_SUCCESS);
    221268}
    222269
     
    227274        struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
    228275
    229         usbi_dbg("close: fd %d", dpriv->fd);
    230 
    231         close(dpriv->fd);
    232         dpriv->fd = -1;
    233 
    234         usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->pipe[0]);
    235 
    236         close(hpriv->pipe[0]);
    237         close(hpriv->pipe[1]);
     276        if (dpriv->devname) {
     277                usbi_dbg("close: fd %d", dpriv->fd);
     278
     279                close(dpriv->fd);
     280                dpriv->fd = -1;
     281        }
    238282}
    239283
     
    258302{
    259303        struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
    260         usb_config_descriptor_t *ucd;
    261 
    262         ucd = (usb_config_descriptor_t *) dpriv->cdesc;
     304        usb_config_descriptor_t *ucd = (usb_config_descriptor_t *)dpriv->cdesc;
     305
    263306        len = MIN(len, UGETW(ucd->wTotalLength));
    264307
     
    269312        *host_endian = 0;
    270313
    271         return (LIBUSB_SUCCESS);
     314        return (len);
    272315}
    273316
     
    276319    unsigned char *buf, size_t len, int *host_endian)
    277320{
    278         struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
    279         struct usb_full_desc ufd;
     321        struct usb_device_fdesc udf;
    280322        int fd, err;
    281323
    282         usbi_dbg("index %d, len %d", idx, len);
    283 
    284         /* A config descriptor may be requested before opening the device */
    285         if (dpriv->fd >= 0) {
    286                 fd = dpriv->fd;
    287         } else {
    288                 fd = open(dpriv->devnode, O_RDONLY);
    289                 if (fd < 0)
    290                         return _errno_to_libusb(errno);
    291         }
    292 
    293         ufd.ufd_config_index = idx;
    294         ufd.ufd_size = len;
    295         ufd.ufd_data = buf;
    296 
    297         if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
     324        if ((fd = _bus_open(dev->bus_number)) < 0)
     325                return _errno_to_libusb(errno);
     326
     327        udf.udf_bus = dev->bus_number;
     328        udf.udf_addr = dev->device_address;
     329        udf.udf_config_index = idx;
     330        udf.udf_size = len;
     331        udf.udf_data = buf;
     332
     333        usbi_dbg("index %d, len %d", udf.udf_config_index, len);
     334
     335        if (ioctl(fd, USB_DEVICE_GET_FDESC, &udf) < 0) {
    298336                err = errno;
    299                 if (dpriv->fd < 0)
    300                         close(fd);
     337                close(fd);
    301338                return _errno_to_libusb(err);
    302339        }
    303 
    304         if (dpriv->fd < 0)
    305                 close(fd);
     340        close(fd);
    306341
    307342        *host_endian = 0;
    308343
    309         return (LIBUSB_SUCCESS);
     344        return (len);
    310345}
    311346
     
    314349{
    315350        struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
    316 
    317         usbi_dbg("");
    318 
    319         if (ioctl(dpriv->fd, USB_GET_CONFIG, config) < 0)
    320                 return _errno_to_libusb(errno);
    321 
    322         usbi_dbg("configuration %d", *config);
     351        usb_config_descriptor_t *ucd = (usb_config_descriptor_t *)dpriv->cdesc;
     352
     353        *config = ucd->bConfigurationValue;
     354
     355        usbi_dbg("bConfigurationValue %d", *config);
    323356
    324357        return (LIBUSB_SUCCESS);
     
    330363        struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
    331364
    332         usbi_dbg("configuration %d", config);
     365        if (dpriv->devname == NULL)
     366                return (LIBUSB_ERROR_NOT_SUPPORTED);
     367
     368        usbi_dbg("bConfigurationValue %d", config);
    333369
    334370        if (ioctl(dpriv->fd, USB_SET_CONFIG, &config) < 0)
    335371                return _errno_to_libusb(errno);
    336372
    337         return _cache_active_config_descriptor(handle->dev, dpriv->fd);
     373        return _cache_active_config_descriptor(handle->dev);
    338374}
    339375
     
    370406        struct usb_alt_interface intf;
    371407
     408        if (dpriv->devname == NULL)
     409                return (LIBUSB_ERROR_NOT_SUPPORTED);
     410
    372411        usbi_dbg("iface %d, setting %d", iface, altsetting);
    373412
     
    386425obsd_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
    387426{
    388         struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
    389427        struct usb_ctl_request req;
     428        int fd, err;
     429
     430        if ((fd = _bus_open(handle->dev->bus_number)) < 0)
     431                return _errno_to_libusb(errno);
    390432
    391433        usbi_dbg("");
    392434
     435        req.ucr_addr = handle->dev->device_address;
    393436        req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT;
    394437        req.ucr_request.bRequest = UR_CLEAR_FEATURE;
     
    397440        USETW(req.ucr_request.wLength, 0);
    398441
    399         if (ioctl(dpriv->fd, USB_DO_REQUEST, &req) < 0)
    400                 return _errno_to_libusb(errno);
     442        if (ioctl(fd, USB_REQUEST, &req) < 0) {
     443                err = errno;
     444                close(fd);
     445                return _errno_to_libusb(err);
     446        }
     447        close(fd);
    401448
    402449        return (LIBUSB_SUCCESS);
     
    419466
    420467        free(dpriv->cdesc);
     468        free(dpriv->devname);
    421469}
    422470
     
    454502                err = _sync_gen_transfer(itransfer);
    455503                break;
     504        case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
     505                err = LIBUSB_ERROR_NOT_SUPPORTED;
     506                break;
    456507        }
    457508
     
    459510                return (err);
    460511
    461         if (write(hpriv->pipe[1], &itransfer, sizeof(itransfer)) < 0)
    462                 return _errno_to_libusb(errno);
     512        usbi_signal_transfer_completion(itransfer);
    463513
    464514        return (LIBUSB_SUCCESS);
     
    482532
    483533int
    484 obsd_handle_events(struct libusb_context *ctx, struct pollfd *fds, nfds_t nfds,
    485     int num_ready)
    486 {
    487         struct libusb_device_handle *handle;
    488         struct handle_priv *hpriv = NULL;
    489         struct usbi_transfer *itransfer;
    490         struct pollfd *pollfd;
    491         int i, err = 0;
    492 
    493         usbi_dbg("");
    494 
    495         pthread_mutex_lock(&ctx->open_devs_lock);
    496         for (i = 0; i < nfds && num_ready > 0; i++) {
    497                 pollfd = &fds[i];
    498 
    499                 if (!pollfd->revents)
    500                         continue;
    501 
    502                 hpriv = NULL;
    503                 num_ready--;
    504                 list_for_each_entry(handle, &ctx->open_devs, list,
    505                     struct libusb_device_handle) {
    506                         hpriv = (struct handle_priv *)handle->os_priv;
    507 
    508                         if (hpriv->pipe[0] == pollfd->fd)
    509                                 break;
    510 
    511                         hpriv = NULL;
    512                 }
    513 
    514                 if (NULL == hpriv) {
    515                         usbi_dbg("fd %d is not an event pipe!", pollfd->fd);
    516                         err = ENOENT;
    517                         break;
    518                 }
    519 
    520                 if (pollfd->revents & POLLERR) {
    521                         usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->pipe[0]);
    522                         usbi_handle_disconnect(handle);
    523                         continue;
    524                 }
    525 
    526                 if (read(hpriv->pipe[0], &itransfer, sizeof(itransfer)) < 0) {
    527                         err = errno;
    528                         break;
    529                 }
    530 
    531                 if ((err = usbi_handle_transfer_completion(itransfer,
    532                     LIBUSB_TRANSFER_COMPLETED)))
    533                         break;
    534         }
    535         pthread_mutex_unlock(&ctx->open_devs_lock);
    536 
    537         if (err)
    538                 return _errno_to_libusb(err);
    539 
    540         return (LIBUSB_SUCCESS);
     534obsd_handle_transfer_completion(struct usbi_transfer *itransfer)
     535{
     536        return usbi_handle_transfer_completion(itransfer, LIBUSB_TRANSFER_COMPLETED);
    541537}
    542538
     
    558554_errno_to_libusb(int err)
    559555{
     556        usbi_dbg("error: %s (%d)", strerror(err), err);
     557
    560558        switch (err) {
    561559        case EIO:
     
    567565        case ENOMEM:
    568566                return (LIBUSB_ERROR_NO_MEM);
    569         }
    570 
    571         usbi_dbg("error: %s", strerror(err));
     567        case ETIMEDOUT:
     568                return (LIBUSB_ERROR_TIMEOUT);
     569        }
    572570
    573571        return (LIBUSB_ERROR_OTHER);
     
    575573
    576574int
    577 _cache_active_config_descriptor(struct libusb_device *dev, int fd)
     575_cache_active_config_descriptor(struct libusb_device *dev)
    578576{
    579577        struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
    580         struct usb_config_desc ucd;
    581         struct usb_full_desc ufd;
     578        struct usb_device_cdesc udc;
     579        struct usb_device_fdesc udf;
    582580        unsigned char* buf;
    583         int len;
    584 
    585         usbi_dbg("fd %d", fd);
    586 
    587         ucd.ucd_config_index = USB_CURRENT_CONFIG_INDEX;
    588 
    589         if ((ioctl(fd, USB_GET_CONFIG_DESC, &ucd)) < 0)
    590                 return _errno_to_libusb(errno);
    591 
    592         usbi_dbg("active bLength %d", ucd.ucd_desc.bLength);
    593 
    594         len = UGETW(ucd.ucd_desc.wTotalLength);
     581        int fd, len, err;
     582
     583        if ((fd = _bus_open(dev->bus_number)) < 0)
     584                return _errno_to_libusb(errno);
     585
     586        usbi_dbg("fd %d, addr %d", fd, dev->device_address);
     587
     588        udc.udc_bus = dev->bus_number;
     589        udc.udc_addr = dev->device_address;
     590        udc.udc_config_index = USB_CURRENT_CONFIG_INDEX;
     591        if (ioctl(fd, USB_DEVICE_GET_CDESC, &udc) < 0) {
     592                err = errno;
     593                close(fd);
     594                return _errno_to_libusb(errno);
     595        }
     596
     597        usbi_dbg("active bLength %d", udc.udc_desc.bLength);
     598
     599        len = UGETW(udc.udc_desc.wTotalLength);
    595600        buf = malloc(len);
    596601        if (buf == NULL)
    597602                return (LIBUSB_ERROR_NO_MEM);
    598603
    599         ufd.ufd_config_index = ucd.ucd_config_index;
    600         ufd.ufd_size = len;
    601         ufd.ufd_data = buf;
    602 
    603         usbi_dbg("index %d, len %d", ufd.ufd_config_index, len);
    604 
    605         if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
     604        udf.udf_bus = dev->bus_number;
     605        udf.udf_addr = dev->device_address;
     606        udf.udf_config_index = udc.udc_config_index;
     607        udf.udf_size = len;
     608        udf.udf_data = buf;
     609
     610        usbi_dbg("index %d, len %d", udf.udf_config_index, len);
     611
     612        if (ioctl(fd, USB_DEVICE_GET_FDESC, &udf) < 0) {
     613                err = errno;
     614                close(fd);
    606615                free(buf);
    607                 return _errno_to_libusb(errno);
    608         }
     616                return _errno_to_libusb(err);
     617        }
     618        close(fd);
    609619
    610620        if (dpriv->cdesc)
     
    612622        dpriv->cdesc = buf;
    613623
    614         return (0);
     624        return (LIBUSB_SUCCESS);
    615625}
    616626
     
    627637        setup = (struct libusb_control_setup *)transfer->buffer;
    628638
    629         usbi_dbg("type %d request %d value %d index %d length %d timeout %d",
     639        usbi_dbg("type %x request %x value %x index %d length %d timeout %d",
    630640            setup->bmRequestType, setup->bRequest,
    631641            libusb_le16_to_cpu(setup->wValue),
     
    633643            libusb_le16_to_cpu(setup->wLength), transfer->timeout);
    634644
     645        req.ucr_addr = transfer->dev_handle->dev->device_address;
    635646        req.ucr_request.bmRequestType = setup->bmRequestType;
    636647        req.ucr_request.bRequest = setup->bRequest;
     
    644655                req.ucr_flags = USBD_SHORT_XFER_OK;
    645656
    646         if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
    647                 return _errno_to_libusb(errno);
    648 
    649         if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
    650                 return _errno_to_libusb(errno);
     657        if (dpriv->devname == NULL) {
     658                /*
     659                 * XXX If the device is not attached to ugen(4) it is
     660                 * XXX still possible to submit a control transfer but
     661                 * XXX with the default timeout only.
     662                 */
     663                int fd, err;
     664
     665                if ((fd = _bus_open(transfer->dev_handle->dev->bus_number)) < 0)
     666                        return _errno_to_libusb(errno);
     667
     668                if ((ioctl(fd, USB_REQUEST, &req)) < 0) {
     669                        err = errno;
     670                        close(fd);
     671                        return _errno_to_libusb(err);
     672                }
     673                close(fd);
     674        } else {
     675                if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
     676                        return _errno_to_libusb(errno);
     677
     678                if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
     679                        return _errno_to_libusb(errno);
     680        }
    651681
    652682        itransfer->transferred = req.ucr_actlen;
     
    662692        struct handle_priv *hpriv;
    663693        struct device_priv *dpriv;
    664         char *s, devnode[16];
     694        char devnode[16];
    665695        int fd, endpt;
    666696        mode_t mode;
     
    675705
    676706        if (hpriv->endpoints[endpt] < 0) {
    677                 /* Pick the right node given the control one */
    678                 strlcpy(devnode, dpriv->devnode, sizeof(devnode));
    679                 s = strchr(devnode, '.');
    680                 snprintf(s, 4, ".%02d", endpt);
     707                /* Pick the right endpoint node */
     708                snprintf(devnode, sizeof(devnode), DEVPATH "%s.%02d",
     709                    dpriv->devname, endpt);
    681710
    682711                /* We may need to read/write to the same endpoint later. */
     
    695724{
    696725        struct libusb_transfer *transfer;
     726        struct device_priv *dpriv;
    697727        int fd, nr = 1;
    698728
    699729        transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
     730        dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
     731
     732        if (dpriv->devname == NULL)
     733                return (LIBUSB_ERROR_NOT_SUPPORTED);
    700734
    701735        /*
     
    726760        return (0);
    727761}
     762
     763int
     764_bus_open(int number)
     765{
     766        char busnode[16];
     767
     768        snprintf(busnode, sizeof(busnode), USBDEV "%d", number);
     769
     770        return open(busnode, O_RDWR);
     771}
  • TabularUnified libusb1/trunk/libusb/os/poll_posix.h

    r1876 r1882  
    55#define usbi_read read
    66#define usbi_close close
    7 #define usbi_pipe pipe
    87#define usbi_poll poll
    98
     9int usbi_pipe(int pipefd[2]);
     10
    1011#endif /* LIBUSB_POLL_POSIX_H */
  • TabularUnified libusb1/trunk/libusb/os/poll_windows.c

    r1876 r1882  
    11/*
    22 * poll_windows: poll compatibility wrapper for Windows
    3  * Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
     3 * Copyright © 2012-2013 RealVNC Ltd.
     4 * Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
    45 * With contributions from Michael Plante, Orin Eman et al.
    56 * Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
     
    3233 * - call usbi_create_fd with this handle to obtain a custom fd.
    3334 *   Note that if you need simultaneous R/W access, you need to call create_fd
    34  *   twice, once in _O_RDONLY and once in _O_WRONLY mode to obtain 2 separate
     35 *   twice, once in RW_READ and once in RW_WRITE mode to obtain 2 separate
    3536 *   pollable fds
    3637 * - leave the core functions call the poll routine and flag POLLIN/POLLOUT
     
    4041 * context.
    4142 */
     43#include <config.h>
     44
    4245#include <errno.h>
    43 #include <fcntl.h>
    4446#include <stdio.h>
    4547#include <stdlib.h>
    46 #include <io.h>
    47 
    48 #include <libusbi.h>
     48
     49#include "libusbi.h"
    4950
    5051// Uncomment to debug the polling layer
     
    5556// MSVC++ < 2005 cannot use a variadic argument and non MSVC
    5657// compilers produce warnings if parenthesis are omitted.
    57 #if defined(_MSC_VER) && _MSC_VER < 1400
     58#if defined(_MSC_VER) && (_MSC_VER < 1400)
    5859#define poll_dbg
    5960#else
     
    6667#endif
    6768
    68 #if defined(__CYGWIN__)
    69 // cygwin produces a warning unless these prototypes are defined
    70 extern int _open(char* name, int flags);
    71 extern int _close(int fd);
    72 extern int _snprintf(char *buffer, size_t count, const char *format, ...);
    73 #define NUL_DEVICE "/dev/null"
    74 #else
    75 #define NUL_DEVICE "NUL"
    76 #endif
    77 
    7869#define CHECK_INIT_POLLING do {if(!is_polling_set) init_polling();} while(0)
    7970
    8071// public fd data
    81 const struct winfd INVALID_WINFD = {-1, INVALID_HANDLE_VALUE, NULL, RW_NONE};
     72const struct winfd INVALID_WINFD = {-1, INVALID_HANDLE_VALUE, NULL, NULL, NULL, RW_NONE};
    8273struct winfd poll_fd[MAX_FDS];
    8374// internal fd data
     
    9485static volatile LONG compat_spinlock = 0;
    9586
     87#if !defined(_WIN32_WCE)
    9688// CancelIoEx, available on Vista and later only, provides the ability to cancel
    9789// a single transfer (OVERLAPPED) when used. As it may not be part of any of the
    9890// platform headers, we hook into the Kernel32 system DLL directly to seek it.
    9991static BOOL (__stdcall *pCancelIoEx)(HANDLE, LPOVERLAPPED) = NULL;
    100 #define CancelIoEx_Available (pCancelIoEx != NULL)
    101 static __inline BOOL cancel_io(int _index)
     92#define Use_Duplicate_Handles (pCancelIoEx == NULL)
     93
     94static inline void setup_cancel_io(void)
     95{
     96        HMODULE hKernel32 = GetModuleHandleA("KERNEL32");
     97        if (hKernel32 != NULL) {
     98                pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED))
     99                        GetProcAddress(hKernel32, "CancelIoEx");
     100        }
     101        usbi_dbg("Will use CancelIo%s for I/O cancellation",
     102                Use_Duplicate_Handles?"":"Ex");
     103}
     104
     105static inline BOOL cancel_io(int _index)
    102106{
    103107        if ((_index < 0) || (_index >= MAX_FDS)) {
     
    109113                return TRUE;
    110114        }
    111         if (CancelIoEx_Available) {
     115        if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
     116                // Cancel outstanding transfer via the specific callback
     117                (*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
     118                return TRUE;
     119        }
     120        if (pCancelIoEx != NULL) {
    112121                return (*pCancelIoEx)(poll_fd[_index].handle, poll_fd[_index].overlapped);
    113122        }
     
    118127        return FALSE;
    119128}
     129#else
     130#define Use_Duplicate_Handles FALSE
     131
     132static __inline void setup_cancel_io()
     133{
     134        // No setup needed on WinCE
     135}
     136
     137static __inline BOOL cancel_io(int _index)
     138{
     139        if ((_index < 0) || (_index >= MAX_FDS)) {
     140                return FALSE;
     141        }
     142        if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
     143          || (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
     144                return TRUE;
     145        }
     146        if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
     147                // Cancel outstanding transfer via the specific callback
     148                (*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
     149        }
     150        return TRUE;
     151}
     152#endif
    120153
    121154// Init
     
    128161        }
    129162        if (!is_polling_set) {
    130                 pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED))
    131                         GetProcAddress(GetModuleHandleA("KERNEL32"), "CancelIoEx");
    132                 usbi_dbg("Will use CancelIo%s for I/O cancellation",
    133                         CancelIoEx_Available?"Ex":"");
     163                setup_cancel_io();
    134164                for (i=0; i<MAX_FDS; i++) {
    135165                        poll_fd[i] = INVALID_WINFD;
     
    140170                is_polling_set = TRUE;
    141171        }
    142         compat_spinlock = 0;
     172        InterlockedExchange((LONG *)&compat_spinlock, 0);
    143173}
    144174
    145175// Internal function to retrieve the table index (and lock the fd mutex)
    146 int _fd_to_index_and_lock(int fd)
     176static int _fd_to_index_and_lock(int fd)
    147177{
    148178        int i;
    149179
    150         if (fd <= 0)
     180        if (fd < 0)
    151181                return -1;
    152182
     
    165195}
    166196
    167 OVERLAPPED *create_overlapped(void)
     197static OVERLAPPED *create_overlapped(void)
    168198{
    169199        OVERLAPPED *overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
     
    179209}
    180210
    181 void free_overlapped(OVERLAPPED *overlapped)
     211static void free_overlapped(OVERLAPPED *overlapped)
    182212{
    183213        if (overlapped == NULL)
     
    189219        }
    190220        free(overlapped);
    191 }
    192 
    193 void reset_overlapped(OVERLAPPED *overlapped)
    194 {
    195         HANDLE event_handle;
    196         if (overlapped == NULL)
    197                 return;
    198 
    199         event_handle = overlapped->hEvent;
    200         if (event_handle != NULL) {
    201                 ResetEvent(event_handle);
    202         }
    203         memset(overlapped, 0, sizeof(OVERLAPPED));
    204         overlapped->hEvent = event_handle;
    205221}
    206222
     
    222238                        // mutex lock before too long
    223239                        EnterCriticalSection(&_poll_fd[i].mutex);
    224                         if ( (poll_fd[i].fd > 0) && (poll_fd[i].handle != INVALID_HANDLE_VALUE) && (poll_fd[i].handle != 0)
    225                           && (GetFileType(poll_fd[i].handle) == FILE_TYPE_UNKNOWN) ) {
    226                                 _close(poll_fd[i].fd);
    227                         }
    228240                        free_overlapped(poll_fd[i].overlapped);
    229                         if (!CancelIoEx_Available) {
     241                        if (Use_Duplicate_Handles) {
    230242                                // Close duplicate handle
    231243                                if (_poll_fd[i].original_handle != INVALID_HANDLE_VALUE) {
     
    238250                }
    239251        }
    240         compat_spinlock = 0;
     252        InterlockedExchange((LONG *)&compat_spinlock, 0);
    241253}
    242254
     
    254266        CHECK_INIT_POLLING;
    255267
    256         overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
     268        overlapped = create_overlapped();
     269
    257270        if (overlapped == NULL) {
    258271                return -1;
     
    261274        overlapped->Internal = STATUS_PENDING;
    262275        overlapped->InternalHigh = 0;
    263 
    264         // Read end of the "pipe"
    265         filedes[0] = _open(NUL_DEVICE, _O_WRONLY);
    266         if (filedes[0] < 0) {
    267                 usbi_err(NULL, "could not create pipe: errno %d", errno);
    268                 goto out1;
    269         }
    270         // We can use the same handle for both ends
    271         filedes[1] = filedes[0];
    272         poll_dbg("pipe filedes = %d", filedes[0]);
    273 
    274         // Note: manual reset must be true (second param) as the reset occurs in read
    275         overlapped->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
    276         if(!overlapped->hEvent) {
    277                 goto out2;
    278         }
    279276
    280277        for (i=0; i<MAX_FDS; i++) {
     
    287284                        }
    288285
    289                         poll_fd[i].fd = filedes[0];
     286                        // Use index as the unique fd number
     287                        poll_fd[i].fd = i;
     288                        // Read end of the "pipe"
     289                        filedes[0] = poll_fd[i].fd;
     290                        // We can use the same handle for both ends
     291                        filedes[1] = filedes[0];
     292
    290293                        poll_fd[i].handle = DUMMY_HANDLE;
    291294                        poll_fd[i].overlapped = overlapped;
     
    297300                }
    298301        }
    299 
    300         CloseHandle(overlapped->hEvent);
    301 out2:
    302         _close(filedes[0]);
    303 out1:
    304         free(overlapped);
     302        free_overlapped(overlapped);
    305303        return -1;
    306304}
     
    320318 * produce unexpected results
    321319 */
    322 struct winfd usbi_create_fd(HANDLE handle, int access_mode)
    323 {
    324         int i, fd;
     320struct winfd usbi_create_fd(HANDLE handle, int access_mode, struct usbi_transfer *itransfer, cancel_transfer *cancel_fn)
     321{
     322        int i;
    325323        struct winfd wfd = INVALID_WINFD;
    326324        OVERLAPPED* overlapped = NULL;
     
    332330        }
    333331
    334         if ((access_mode != _O_RDONLY) && (access_mode != _O_WRONLY)) {
    335                 usbi_warn(NULL, "only one of _O_RDONLY or _O_WRONLY are supported.\n"
     332        wfd.itransfer = itransfer;
     333        wfd.cancel_fn = cancel_fn;
     334
     335        if ((access_mode != RW_READ) && (access_mode != RW_WRITE)) {
     336                usbi_warn(NULL, "only one of RW_READ or RW_WRITE are supported. "
    336337                        "If you want to poll for R/W simultaneously, create multiple fds from the same handle.");
    337338                return INVALID_WINFD;
    338339        }
    339         if (access_mode == _O_RDONLY) {
     340        if (access_mode == RW_READ) {
    340341                wfd.rw = RW_READ;
    341342        } else {
     
    343344        }
    344345
    345         // Ensure that we get a non system conflicting unique fd, using
    346         // the same fd attribution system as the pipe ends
    347         fd = _open(NUL_DEVICE, _O_WRONLY);
    348         if (fd < 0) {
    349                 return INVALID_WINFD;
    350         }
    351 
    352346        overlapped = create_overlapped();
    353347        if(overlapped == NULL) {
    354                 _close(fd);
    355348                return INVALID_WINFD;
    356349        }
     
    364357                                continue;
    365358                        }
    366                         wfd.fd = fd;
     359                        // Use index as the unique fd number
     360                        wfd.fd = i;
    367361                        // Attempt to emulate some of the CancelIoEx behaviour on platforms
    368362                        // that don't have it
    369                         if (!CancelIoEx_Available) {
     363                        if (Use_Duplicate_Handles) {
    370364                                _poll_fd[i].thread_id = GetCurrentThreadId();
    371365                                if (!DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(),
     
    388382        }
    389383        free_overlapped(overlapped);
    390         _close(fd);
    391384        return INVALID_WINFD;
    392385}
    393386
    394 void _free_index(int _index)
     387static void _free_index(int _index)
    395388{
    396389        // Cancel any async IO (Don't care about the validity of our handles for this)
    397390        cancel_io(_index);
    398         // close fake handle for devices
    399         if ( (poll_fd[_index].handle != INVALID_HANDLE_VALUE) && (poll_fd[_index].handle != 0)
    400           && (GetFileType(poll_fd[_index].handle) == FILE_TYPE_UNKNOWN) ) {
    401                 _close(poll_fd[_index].fd);
    402         }
    403391        // close the duplicate handle (if we have an actual duplicate)
    404         if (!CancelIoEx_Available) {
     392        if (Use_Duplicate_Handles) {
    405393                if (_poll_fd[_index].original_handle != INVALID_HANDLE_VALUE) {
    406394                        CloseHandle(poll_fd[_index].handle);
     
    418406 * Note that the associated Windows handle is not closed by this call
    419407 */
    420 void usbi_free_fd(int fd)
     408void usbi_free_fd(struct winfd *wfd)
    421409{
    422410        int _index;
     
    424412        CHECK_INIT_POLLING;
    425413
    426         _index = _fd_to_index_and_lock(fd);
     414        _index = _fd_to_index_and_lock(wfd->fd);
    427415        if (_index < 0) {
    428416                return;
    429417        }
    430418        _free_index(_index);
     419        *wfd = INVALID_WINFD;
    431420        LeaveCriticalSection(&_poll_fd[_index].mutex);
    432421}
     
    442431        CHECK_INIT_POLLING;
    443432
    444         if (fd <= 0)
     433        if (fd < 0)
    445434                return INVALID_WINFD;
    446435
     
    602591        if ((timeout != 0) && (triggered == 0) && (nb_handles_to_wait_on != 0)) {
    603592                if (timeout < 0) {
    604                         poll_dbg("starting infinite wait for %d handles...", (int)nb_handles_to_wait_on);
     593                        poll_dbg("starting infinite wait for %u handles...", (unsigned int)nb_handles_to_wait_on);
    605594                } else {
    606                         poll_dbg("starting %d ms wait for %d handles...", timeout, (int)nb_handles_to_wait_on);
     595                        poll_dbg("starting %d ms wait for %u handles...", timeout, (unsigned int)nb_handles_to_wait_on);
    607596                }
    608597                ret = WaitForMultipleObjects(nb_handles_to_wait_on, handles_to_wait_on,
     
    652641                errno = EBADF;
    653642        } else {
    654                 if (poll_fd[_index].overlapped != NULL) {
    655                         // Must be a different event for each end of the pipe
    656                         CloseHandle(poll_fd[_index].overlapped->hEvent);
    657                         free(poll_fd[_index].overlapped);
    658                 }
    659                 r = _close(poll_fd[_index].fd);
    660                 if (r != 0) {
    661                         errno = EIO;
    662                 }
     643                free_overlapped(poll_fd[_index].overlapped);
    663644                poll_fd[_index] = INVALID_WINFD;
    664645                LeaveCriticalSection(&_poll_fd[_index].mutex);
     
    673654{
    674655        int _index;
     656        UNUSED(buf);
    675657
    676658        CHECK_INIT_POLLING;
     
    691673        }
    692674
    693         poll_dbg("set pipe event (fd = %d, thread = %08X)", _index, GetCurrentThreadId());
     675        poll_dbg("set pipe event (fd = %d, thread = %08X)", _index, (unsigned int)GetCurrentThreadId());
    694676        SetEvent(poll_fd[_index].overlapped->hEvent);
    695677        poll_fd[_index].overlapped->Internal = STATUS_WAIT_0;
     
    709691        int _index;
    710692        ssize_t r = -1;
     693        UNUSED(buf);
    711694
    712695        CHECK_INIT_POLLING;
     
    725708
    726709        if (WaitForSingleObject(poll_fd[_index].overlapped->hEvent, INFINITE) != WAIT_OBJECT_0) {
    727                 usbi_warn(NULL, "waiting for event failed: %d", (int)GetLastError());
     710                usbi_warn(NULL, "waiting for event failed: %u", (unsigned int)GetLastError());
    728711                errno = EIO;
    729712                goto out;
    730713        }
    731714
    732         poll_dbg("clr pipe event (fd = %d, thread = %08X)", _index, GetCurrentThreadId());
     715        poll_dbg("clr pipe event (fd = %d, thread = %08X)", _index, (unsigned int)GetCurrentThreadId());
    733716        poll_fd[_index].overlapped->InternalHigh--;
    734717        // Don't reset unless we don't have any more events to process
  • TabularUnified libusb1/trunk/libusb/os/poll_windows.h

    r1876 r1882  
    11/*
    22 * Windows compat: POSIX compatibility wrapper
    3  * Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
     3 * Copyright © 2012-2013 RealVNC Ltd.
     4 * Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
    45 * With contributions from Michael Plante, Orin Eman et al.
    56 * Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
     
    2223#pragma once
    2324
    24 #include <windows.h>
    25 
    2625#if defined(_MSC_VER)
    2726// disable /W4 MSVC warnings that are benign
     
    3433#endif
    3534#define STATUS_COMPLETED_SYNCHRONOUSLY  STATUS_REPARSE
     35#if defined(_WIN32_WCE)
     36// WinCE doesn't have a HasOverlappedIoCompleted() macro, so attempt to emulate it
     37#define HasOverlappedIoCompleted(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) != STATUS_PENDING)
     38#endif
    3639#define HasOverlappedIoCompletedSync(lpOverlapped)      (((DWORD)(lpOverlapped)->Internal) == STATUS_COMPLETED_SYNCHRONOUSLY)
    3740
    3841#define DUMMY_HANDLE ((HANDLE)(LONG_PTR)-2)
    3942
     43/* Windows versions */
    4044enum windows_version {
    41         WINDOWS_UNSUPPORTED,
    42         WINDOWS_XP,
    43         WINDOWS_2003,   // also includes XP 64
    44         WINDOWS_VISTA_AND_LATER,
     45        WINDOWS_CE = -2,
     46        WINDOWS_UNDEFINED = -1,
     47        WINDOWS_UNSUPPORTED = 0,
     48        WINDOWS_XP = 0x51,
     49        WINDOWS_2003 = 0x52,    // Also XP x64
     50        WINDOWS_VISTA = 0x60,
     51        WINDOWS_7 = 0x61,
     52        WINDOWS_8 = 0x62,
     53        WINDOWS_8_1_OR_LATER = 0x63,
     54        WINDOWS_MAX
    4555};
    46 extern enum windows_version windows_version;
     56extern int windows_version;
    4757
    4858#define MAX_FDS     256
     
    6979
    7080// fd struct that can be used for polling on Windows
     81typedef int cancel_transfer(struct usbi_transfer *itransfer);
     82
    7183struct winfd {
    7284        int fd;                                                 // what's exposed to libusb core
    7385        HANDLE handle;                                  // what we need to attach overlapped to the I/O op, so we can poll it
    7486        OVERLAPPED* overlapped;                 // what will report our I/O status
     87        struct usbi_transfer *itransfer;                // Associated transfer, or NULL if completed
     88        cancel_transfer *cancel_fn;             // Function pointer to cancel transfer API
    7589        enum rw_type rw;                                // I/O transfer direction: read *XOR* write (NOT BOTH)
    7690};
     
    8599void init_polling(void);
    86100void exit_polling(void);
    87 struct winfd usbi_create_fd(HANDLE handle, int access_mode);
    88 void usbi_free_fd(int fd);
     101struct winfd usbi_create_fd(HANDLE handle, int access_mode,
     102        struct usbi_transfer *transfer, cancel_transfer *cancel_fn);
     103void usbi_free_fd(struct winfd* winfd);
    89104struct winfd fd_to_winfd(int fd);
    90105struct winfd handle_to_winfd(HANDLE handle);
     
    115130} while (0)
    116131#endif
    117 
  • TabularUnified libusb1/trunk/libusb/os/threads_posix.c

    r1876 r1882  
    22 * libusb synchronization using POSIX Threads
    33 *
    4  * Copyright (C) 2011 Vitali Lovich <vlovich@aliph.com>
    5  * Copyright (C) 2011 Peter Stuge <peter@stuge.se>
     4 * Copyright © 2011 Vitali Lovich <vlovich@aliph.com>
     5 * Copyright © 2011 Peter Stuge <peter@stuge.se>
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    2020 */
    2121
    22 #ifdef _XOPEN_SOURCE
    23 # if _XOPEN_SOURCE < 500
    24 #  undef _XOPEN_SOURCE
    25 #  define _XOPEN_SOURCE 500
     22#include <config.h>
     23
     24#include <time.h>
     25#if defined(__linux__) || defined(__OpenBSD__)
     26# if defined(__OpenBSD__)
     27#  define _BSD_SOURCE
    2628# endif
    27 #else
    28 #define _XOPEN_SOURCE 500
    29 #endif /* _XOPEN_SOURCE */
     29# include <unistd.h>
     30# include <sys/syscall.h>
     31#elif defined(__APPLE__)
     32# include <mach/mach.h>
     33#elif defined(__CYGWIN__)
     34# include <windows.h>
     35#endif
    3036
    3137#include "threads_posix.h"
     38#include "libusbi.h"
    3239
    33 int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
     40int usbi_cond_timedwait(pthread_cond_t *cond,
     41        pthread_mutex_t *mutex, const struct timeval *tv)
    3442{
    35         int err;
    36         pthread_mutexattr_t stack_attr;
    37         if (!attr) {
    38                 attr = &stack_attr;
    39                 err = pthread_mutexattr_init(&stack_attr);
    40                 if (err != 0)
    41                         return err;
     43        struct timespec timeout;
     44        int r;
     45
     46        r = usbi_backend->clock_gettime(USBI_CLOCK_REALTIME, &timeout);
     47        if (r < 0)
     48                return r;
     49
     50        timeout.tv_sec += tv->tv_sec;
     51        timeout.tv_nsec += tv->tv_usec * 1000;
     52        while (timeout.tv_nsec >= 1000000000L) {
     53                timeout.tv_nsec -= 1000000000L;
     54                timeout.tv_sec++;
    4255        }
    4356
    44         err = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
    45         if (err != 0)
    46                 goto finish;
     57        return pthread_cond_timedwait(cond, mutex, &timeout);
     58}
    4759
    48         err = pthread_mutex_init(mutex, attr);
    49 
    50 finish:
    51         if (attr == &stack_attr)
    52                 pthread_mutexattr_destroy(&stack_attr);
    53 
    54         return err;
     60int usbi_get_tid(void)
     61{
     62        int ret = -1;
     63#if defined(__ANDROID__)
     64        ret = gettid();
     65#elif defined(__linux__)
     66        ret = syscall(SYS_gettid);
     67#elif defined(__OpenBSD__)
     68        /* The following only works with OpenBSD > 5.1 as it requires
     69           real thread support. For 5.1 and earlier, -1 is returned. */
     70        ret = syscall(SYS_getthrid);
     71#elif defined(__APPLE__)
     72        ret = mach_thread_self();
     73        mach_port_deallocate(mach_task_self(), ret);
     74#elif defined(__CYGWIN__)
     75        ret = GetCurrentThreadId();
     76#endif
     77/* TODO: NetBSD thread ID support */
     78        return ret;
    5579}
  • TabularUnified libusb1/trunk/libusb/os/threads_posix.h

    r1876 r1882  
    22 * libusb synchronization using POSIX Threads
    33 *
    4  * Copyright (C) 2010 Peter Stuge <peter@stuge.se>
     4 * Copyright © 2010 Peter Stuge <peter@stuge.se>
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2323
    2424#include <pthread.h>
     25#ifdef HAVE_SYS_TIME_H
     26#include <sys/time.h>
     27#endif
    2528
    2629#define usbi_mutex_static_t             pthread_mutex_t
     
    3033
    3134#define usbi_mutex_t                    pthread_mutex_t
    32 #define usbi_mutex_init                 pthread_mutex_init
     35#define usbi_mutex_init(mutex)          pthread_mutex_init((mutex), NULL)
    3336#define usbi_mutex_lock                 pthread_mutex_lock
    3437#define usbi_mutex_unlock               pthread_mutex_unlock
     
    3740
    3841#define usbi_cond_t                     pthread_cond_t
    39 #define usbi_cond_init                  pthread_cond_init
     42#define usbi_cond_init(cond)            pthread_cond_init((cond), NULL)
    4043#define usbi_cond_wait                  pthread_cond_wait
    41 #define usbi_cond_timedwait             pthread_cond_timedwait
    4244#define usbi_cond_broadcast             pthread_cond_broadcast
    4345#define usbi_cond_destroy               pthread_cond_destroy
    44 #define usbi_cond_signal                pthread_cond_signal
    4546
    46 extern int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
     47#define usbi_tls_key_t                  pthread_key_t
     48#define usbi_tls_key_create(key)        pthread_key_create((key), NULL)
     49#define usbi_tls_key_get                pthread_getspecific
     50#define usbi_tls_key_set                pthread_setspecific
     51#define usbi_tls_key_delete             pthread_key_delete
     52
     53int usbi_cond_timedwait(pthread_cond_t *cond,
     54        pthread_mutex_t *mutex, const struct timeval *tv);
     55
     56int usbi_get_tid(void);
    4757
    4858#endif /* LIBUSB_THREADS_POSIX_H */
  • TabularUnified libusb1/trunk/libusb/os/threads_windows.c

    r1876 r1882  
    22 * libusb synchronization on Microsoft Windows
    33 *
    4  * Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
     4 * Copyright © 2010 Michael Plante <michael.plante@gmail.com>
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2020
    2121#include <config.h>
     22
    2223#include <objbase.h>
    2324#include <errno.h>
    24 #include <stdarg.h>
    2525
    2626#include "libusbi.h"
    2727
    28 
    29 int usbi_mutex_init(usbi_mutex_t *mutex,
    30                                         const usbi_mutexattr_t *attr) {
    31         if(! mutex) return ((errno=EINVAL));
     28struct usbi_cond_perthread {
     29        struct list_head list;
     30        DWORD tid;
     31        HANDLE event;
     32};
     33
     34int usbi_mutex_static_lock(usbi_mutex_static_t *mutex)
     35{
     36        if (!mutex)
     37                return EINVAL;
     38        while (InterlockedExchange(mutex, 1) == 1)
     39                SleepEx(0, TRUE);
     40        return 0;
     41}
     42
     43int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex)
     44{
     45        if (!mutex)
     46                return EINVAL;
     47        InterlockedExchange(mutex, 0);
     48        return 0;
     49}
     50
     51int usbi_mutex_init(usbi_mutex_t *mutex)
     52{
     53        if (!mutex)
     54                return EINVAL;
    3255        *mutex = CreateMutex(NULL, FALSE, NULL);
    33         if(!*mutex) return ((errno=ENOMEM));
    34         return 0;
    35 }
    36 int usbi_mutex_destroy(usbi_mutex_t *mutex) {
     56        if (!*mutex)
     57                return ENOMEM;
     58        return 0;
     59}
     60
     61int usbi_mutex_lock(usbi_mutex_t *mutex)
     62{
     63        DWORD result;
     64
     65        if (!mutex)
     66                return EINVAL;
     67        result = WaitForSingleObject(*mutex, INFINITE);
     68        if (result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
     69                return 0; // acquired (ToDo: check that abandoned is ok)
     70        else
     71                return EINVAL; // don't know how this would happen
     72                               //   so don't know proper errno
     73}
     74
     75int usbi_mutex_unlock(usbi_mutex_t *mutex)
     76{
     77        if (!mutex)
     78                return EINVAL;
     79        if (ReleaseMutex(*mutex))
     80                return 0;
     81        else
     82                return EPERM;
     83}
     84
     85int usbi_mutex_trylock(usbi_mutex_t *mutex)
     86{
     87        DWORD result;
     88
     89        if (!mutex)
     90                return EINVAL;
     91        result = WaitForSingleObject(*mutex, 0);
     92        if (result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
     93                return 0; // acquired (ToDo: check that abandoned is ok)
     94        else if (result == WAIT_TIMEOUT)
     95                return EBUSY;
     96        else
     97                return EINVAL; // don't know how this would happen
     98                               //   so don't know proper error
     99}
     100
     101int usbi_mutex_destroy(usbi_mutex_t *mutex)
     102{
    37103        // It is not clear if CloseHandle failure is due to failure to unlock.
    38104        //   If so, this should be errno=EBUSY.
    39         if(!mutex || !CloseHandle(*mutex)) return ((errno=EINVAL));
     105        if (!mutex || !CloseHandle(*mutex))
     106                return EINVAL;
    40107        *mutex = NULL;
    41108        return 0;
    42109}
    43 int usbi_mutex_trylock(usbi_mutex_t *mutex) {
    44         DWORD result;
    45         if(!mutex) return ((errno=EINVAL));
    46         result = WaitForSingleObject(*mutex, 0);
    47         if(result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
    48                 return 0; // acquired (ToDo: check that abandoned is ok)
    49         if(result == WAIT_TIMEOUT)
    50                 return ((errno=EBUSY));
    51         return ((errno=EINVAL)); // don't know how this would happen
    52                                                          //   so don't know proper errno
    53 }
    54 int usbi_mutex_lock(usbi_mutex_t *mutex) {
    55         DWORD result;
    56         if(!mutex) return ((errno=EINVAL));
    57         result = WaitForSingleObject(*mutex, INFINITE);
    58         if(result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
    59                 return 0; // acquired (ToDo: check that abandoned is ok)
    60         return ((errno=EINVAL)); // don't know how this would happen
    61                                                          //   so don't know proper errno
    62 }
    63 int usbi_mutex_unlock(usbi_mutex_t *mutex) {
    64         if(!mutex)                return ((errno=EINVAL));
    65         if(!ReleaseMutex(*mutex)) return ((errno=EPERM ));
    66         return 0;
    67 }
    68 
    69 int usbi_mutex_static_lock(usbi_mutex_static_t *mutex) {
    70         if(!mutex)               return ((errno=EINVAL));
    71         while (InterlockedExchange((LONG *)mutex, 1) == 1) {
    72                 SleepEx(0, TRUE);
    73         }
    74         return 0;
    75 }
    76 int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex) {
    77         if(!mutex)               return ((errno=EINVAL));
    78         *mutex = 0;
    79         return 0;
    80 }
    81 
    82 
    83 
    84 int usbi_cond_init(usbi_cond_t *cond,
    85                                    const usbi_condattr_t *attr) {
    86         if(!cond)           return ((errno=EINVAL));
    87         list_init(&cond->waiters    );
     110
     111int usbi_cond_init(usbi_cond_t *cond)
     112{
     113        if (!cond)
     114                return EINVAL;
     115        list_init(&cond->waiters);
    88116        list_init(&cond->not_waiting);
    89117        return 0;
    90118}
    91 int usbi_cond_destroy(usbi_cond_t *cond) {
     119
     120int usbi_cond_destroy(usbi_cond_t *cond)
     121{
    92122        // This assumes no one is using this anymore.  The check MAY NOT BE safe.
    93         struct usbi_cond_perthread *pos, *prev_pos = NULL;
    94         if(!cond) return ((errno=EINVAL));
    95         if(!list_empty(&cond->waiters)) return ((errno=EBUSY )); // (!see above!)
    96         list_for_each_entry(pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
    97                 free(prev_pos);
     123        struct usbi_cond_perthread *pos, *next_pos;
     124
     125        if(!cond)
     126                return EINVAL;
     127        if (!list_empty(&cond->waiters))
     128                return EBUSY; // (!see above!)
     129        list_for_each_entry_safe(pos, next_pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
    98130                CloseHandle(pos->event);
    99131                list_del(&pos->list);
    100                 prev_pos = pos;
    101         }
    102         free(prev_pos);
    103 
    104         return 0;
    105 }
    106 
    107 int usbi_cond_broadcast(usbi_cond_t *cond) {
     132                free(pos);
     133        }
     134        return 0;
     135}
     136
     137int usbi_cond_broadcast(usbi_cond_t *cond)
     138{
    108139        // Assumes mutex is locked; this is not in keeping with POSIX spec, but
    109140        //   libusb does this anyway, so we simplify by not adding more sync
     
    111142        int fail = 0;
    112143        struct usbi_cond_perthread *pos;
    113         if(!cond)                      return ((errno=EINVAL));
     144
     145        if (!cond)
     146                return EINVAL;
    114147        list_for_each_entry(pos, &cond->waiters, list, struct usbi_cond_perthread) {
    115                 if(!SetEvent(pos->event))
     148                if (!SetEvent(pos->event))
    116149                        fail = 1;
    117150        }
    118151        // The wait function will remove its respective item from the list.
    119         return fail ? ((errno=EINVAL)) : 0;
    120 }
    121 int usbi_cond_signal(usbi_cond_t *cond) {
    122         // Assumes mutex is locked; this is not in keeping with POSIX spec, but
    123         //   libusb does this anyway, so we simplify by not adding more sync
    124         //   primitives to the CV definition!
     152        return fail ? EINVAL : 0;
     153}
     154
     155__inline static int usbi_cond_intwait(usbi_cond_t *cond,
     156        usbi_mutex_t *mutex, DWORD timeout_ms)
     157{
    125158        struct usbi_cond_perthread *pos;
    126         if(!cond)                      return ((errno=EINVAL));
    127         if(list_empty(&cond->waiters)) return 0; // no one to wakeup.
    128         pos = list_entry(&cond->waiters.next, struct usbi_cond_perthread, list);
    129         // The wait function will remove its respective item from the list.
    130         return SetEvent(pos->event) ? 0 : ((errno=EINVAL));
    131 }
    132 static int __inline usbi_cond_intwait(usbi_cond_t *cond,
    133                                                                           usbi_mutex_t *mutex,
    134                                                                           DWORD timeout_ms) {
    135         struct usbi_cond_perthread *pos;
    136         int found = 0, r;
    137         DWORD r2,tid = GetCurrentThreadId();
    138         if(!cond || !mutex) return ((errno=EINVAL));
     159        int r, found = 0;
     160        DWORD r2, tid = GetCurrentThreadId();
     161
     162        if (!cond || !mutex)
     163                return EINVAL;
    139164        list_for_each_entry(pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
    140165                if(tid == pos->tid) {
     
    143168                }
    144169        }
    145         if(!found) {
    146                 pos      = (struct usbi_cond_perthread*) calloc(1, sizeof(struct usbi_cond_perthread));
    147                 if(!pos) return ((errno=ENOMEM)); // This errno is not POSIX-allowed.
     170
     171        if (!found) {
     172                pos = calloc(1, sizeof(struct usbi_cond_perthread));
     173                if (!pos)
     174                        return ENOMEM; // This errno is not POSIX-allowed.
    148175                pos->tid = tid;
    149176                pos->event = CreateEvent(NULL, FALSE, FALSE, NULL); // auto-reset.
    150                 if(!pos->event) {
     177                if (!pos->event) {
    151178                        free(pos);
    152                         return      ((errno=ENOMEM));
     179                        return ENOMEM;
    153180                }
    154181                list_add(&pos->list, &cond->not_waiting);
     
    159186
    160187        r  = usbi_mutex_unlock(mutex);
    161         if(r) return r;
     188        if (r)
     189                return r;
     190
    162191        r2 = WaitForSingleObject(pos->event, timeout_ms);
    163         r  = usbi_mutex_lock(mutex);
    164         if(r) return r;
     192        r = usbi_mutex_lock(mutex);
     193        if (r)
     194                return r;
    165195
    166196        list_del(&pos->list);
    167197        list_add(&pos->list, &cond->not_waiting);
    168198
    169         if(r2 == WAIT_TIMEOUT) return ((errno=ETIMEDOUT));
    170 
    171         return 0;
     199        if (r2 == WAIT_OBJECT_0)
     200                return 0;
     201        else if (r2 == WAIT_TIMEOUT)
     202                return ETIMEDOUT;
     203        else
     204                return EINVAL;
    172205}
    173206// N.B.: usbi_cond_*wait() can also return ENOMEM, even though pthread_cond_*wait cannot!
    174 int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex) {
     207int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex)
     208{
    175209        return usbi_cond_intwait(cond, mutex, INFINITE);
    176210}
     211
    177212int usbi_cond_timedwait(usbi_cond_t *cond,
    178                                                 usbi_mutex_t *mutex,
    179                                                 const struct timespec *abstime) {
    180         FILETIME filetime;
    181         ULARGE_INTEGER rtime;
    182         struct timeval targ_time, cur_time, delta_time;
    183         struct timespec cur_time_ns;
     213        usbi_mutex_t *mutex, const struct timeval *tv)
     214{
    184215        DWORD millis;
    185         extern const uint64_t epoch_time;
    186 
    187         GetSystemTimeAsFileTime(&filetime);
    188         rtime.LowPart   = filetime.dwLowDateTime;
    189         rtime.HighPart  = filetime.dwHighDateTime;
    190         rtime.QuadPart -= epoch_time;
    191         cur_time_ns.tv_sec = (long)(rtime.QuadPart / 10000000);
    192         cur_time_ns.tv_nsec = (long)((rtime.QuadPart % 10000000)*100);
    193         TIMESPEC_TO_TIMEVAL(&cur_time, &cur_time_ns);
    194 
    195         TIMESPEC_TO_TIMEVAL(&targ_time, abstime);
    196         timersub(&targ_time, &cur_time, &delta_time);
    197         if(delta_time.tv_sec < 0) // abstime already passed?
    198                 millis = 0;
    199         else {
    200                 millis  = delta_time.tv_usec/1000;
    201                 millis += delta_time.tv_sec *1000;
    202                 if (delta_time.tv_usec % 1000) // round up to next millisecond
    203                         millis++;
    204         }
    205 
     216
     217        millis = (DWORD)(tv->tv_sec * 1000) + (tv->tv_usec / 1000);
     218        /* round up to next millisecond */
     219        if (tv->tv_usec % 1000)
     220                millis++;
    206221        return usbi_cond_intwait(cond, mutex, millis);
    207222}
    208223
     224int usbi_tls_key_create(usbi_tls_key_t *key)
     225{
     226        if (!key)
     227                return EINVAL;
     228        *key = TlsAlloc();
     229        if (*key == TLS_OUT_OF_INDEXES)
     230                return ENOMEM;
     231        else
     232                return 0;
     233}
     234
     235void *usbi_tls_key_get(usbi_tls_key_t key)
     236{
     237        return TlsGetValue(key);
     238}
     239
     240int usbi_tls_key_set(usbi_tls_key_t key, void *value)
     241{
     242        if (TlsSetValue(key, value))
     243                return 0;
     244        else
     245                return EINVAL;
     246}
     247
     248int usbi_tls_key_delete(usbi_tls_key_t key)
     249{
     250        if (TlsFree(key))
     251                return 0;
     252        else
     253                return EINVAL;
     254}
     255
     256int usbi_get_tid(void)
     257{
     258        return (int)GetCurrentThreadId();
     259}
  • TabularUnified libusb1/trunk/libusb/os/threads_windows.h

    r1876 r1882  
    22 * libusb synchronization on Microsoft Windows
    33 *
    4  * Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
     4 * Copyright © 2010 Michael Plante <michael.plante@gmail.com>
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2222#define LIBUSB_THREADS_WINDOWS_H
    2323
    24 #include <windows.h>
     24#define usbi_mutex_static_t     volatile LONG
     25#define USBI_MUTEX_INITIALIZER  0
    2526
    26 #define usbi_mutex_static_t     volatile LONG
    27 #define USBI_MUTEX_INITIALIZER  0
     27#define usbi_mutex_t            HANDLE
    2828
    29 #define usbi_mutex_t            HANDLE
    30 
    31 struct usbi_cond_perthread {
    32         struct list_head list;
    33         DWORD            tid;
    34         HANDLE           event;
    35 };
    36 struct usbi_cond_t_ {
     29typedef struct usbi_cond {
    3730        // Every time a thread touches the CV, it winds up in one of these lists.
    38         //   It stays there until the CV is destroyed, even if the thread
    39         //   terminates.
     31        //   It stays there until the CV is destroyed, even if the thread terminates.
    4032        struct list_head waiters;
    4133        struct list_head not_waiting;
    42 };
    43 typedef struct usbi_cond_t_ usbi_cond_t;
     34} usbi_cond_t;
    4435
    4536// We *were* getting timespec from pthread.h:
     
    4839#define _TIMESPEC_DEFINED 1
    4940struct timespec {
    50                 long tv_sec;
    51                 long tv_nsec;
     41        long tv_sec;
     42        long tv_nsec;
    5243};
    5344#endif /* HAVE_STRUCT_TIMESPEC | _TIMESPEC_DEFINED */
     
    5849#endif
    5950
    60 #define usbi_mutexattr_t void
    61 #define usbi_condattr_t  void
    62 
    63 // all Windows mutexes are recursive
    64 #define usbi_mutex_init_recursive(mutex, attr) usbi_mutex_init((mutex), (attr))
     51#define usbi_tls_key_t          DWORD
    6552
    6653int usbi_mutex_static_lock(usbi_mutex_static_t *mutex);
    6754int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex);
    6855
    69 
    70 int usbi_mutex_init(usbi_mutex_t *mutex,
    71                                         const usbi_mutexattr_t *attr);
     56int usbi_mutex_init(usbi_mutex_t *mutex);
    7257int usbi_mutex_lock(usbi_mutex_t *mutex);
    7358int usbi_mutex_unlock(usbi_mutex_t *mutex);
     
    7560int usbi_mutex_destroy(usbi_mutex_t *mutex);
    7661
    77 int usbi_cond_init(usbi_cond_t *cond,
    78                                    const usbi_condattr_t *attr);
    79 int usbi_cond_destroy(usbi_cond_t *cond);
     62int usbi_cond_init(usbi_cond_t *cond);
    8063int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex);
    8164int usbi_cond_timedwait(usbi_cond_t *cond,
    82                                                 usbi_mutex_t *mutex,
    83                                                 const struct timespec *abstime);
     65        usbi_mutex_t *mutex, const struct timeval *tv);
    8466int usbi_cond_broadcast(usbi_cond_t *cond);
    85 int usbi_cond_signal(usbi_cond_t *cond);
     67int usbi_cond_destroy(usbi_cond_t *cond);
     68
     69int usbi_tls_key_create(usbi_tls_key_t *key);
     70void *usbi_tls_key_get(usbi_tls_key_t key);
     71int usbi_tls_key_set(usbi_tls_key_t key, void *value);
     72int usbi_tls_key_delete(usbi_tls_key_t key);
     73
     74int usbi_get_tid(void);
    8675
    8776#endif /* LIBUSB_THREADS_WINDOWS_H */
    88 
  • TabularUnified libusb1/trunk/libusb/sync.c

    r1879 r1882  
    11/*
    22 * Synchronous I/O functions for libusb
    3  * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
     3 * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
    44 *
    55 * This library is free software; you can redistribute it and/or
     
    1919
    2020#include <config.h>
     21
    2122#include <errno.h>
    2223#include <stdint.h>
     
    2728
    2829/**
    29  * @defgroup syncio Synchronous device I/O
     30 * @defgroup libusb_syncio Synchronous device I/O
    3031 *
    3132 * This page documents libusb's synchronous (blocking) API for USB device I/O.
    3233 * This interface is easy to use but has some limitations. More advanced users
    33  * may wish to consider using the \ref asyncio "asynchronous I/O API" instead.
    34  */
    35 
    36 static void LIBUSB_CALL ctrl_transfer_cb(struct libusb_transfer *transfer)
     34 * may wish to consider using the \ref libusb_asyncio "asynchronous I/O API" instead.
     35 */
     36
     37static void LIBUSB_CALL sync_transfer_cb(struct libusb_transfer *transfer)
    3738{
    3839        int *completed = transfer->user_data;
     
    4243}
    4344
    44 /** \ingroup syncio
     45static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
     46{
     47        int r, *completed = transfer->user_data;
     48        struct libusb_context *ctx = HANDLE_CTX(transfer->dev_handle);
     49
     50        while (!*completed) {
     51                r = libusb_handle_events_completed(ctx, completed);
     52                if (r < 0) {
     53                        if (r == LIBUSB_ERROR_INTERRUPTED)
     54                                continue;
     55                        usbi_err(ctx, "libusb_handle_events failed: %s, cancelling transfer and retrying",
     56                                 libusb_error_name(r));
     57                        libusb_cancel_transfer(transfer);
     58                        continue;
     59                }
     60        }
     61}
     62
     63/** \ingroup libusb_syncio
    4564 * Perform a USB control transfer.
    4665 *
     
    6887 * device
    6988 * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
     89 * \returns LIBUSB_ERROR_BUSY if called from event handling context
     90 * \returns LIBUSB_ERROR_INVALID_PARAM if the transfer size is larger than
     91 * the operating system and/or hardware can support
    7092 * \returns another LIBUSB_ERROR code on other failures
    7193 */
     
    7496        unsigned char *data, uint16_t wLength, unsigned int timeout)
    7597{
    76         struct libusb_transfer *transfer = libusb_alloc_transfer(0);
     98        struct libusb_transfer *transfer;
    7799        unsigned char *buffer;
    78100        int completed = 0;
    79101        int r;
    80102
     103        if (usbi_handling_events(HANDLE_CTX(dev_handle)))
     104                return LIBUSB_ERROR_BUSY;
     105
     106        transfer = libusb_alloc_transfer(0);
    81107        if (!transfer)
    82108                return LIBUSB_ERROR_NO_MEM;
    83109
    84110#ifndef __OS2__
    85         buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
     111        buffer = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
    86112#else
    87         buffer = _tmalloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
     113        buffer = (unsigned char*)_tmalloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
    88114#endif
    89115        if (!buffer) {
     
    98124
    99125        libusb_fill_control_transfer(transfer, dev_handle, buffer,
    100                 ctrl_transfer_cb, &completed, timeout);
     126                sync_transfer_cb, &completed, timeout);
    101127        transfer->flags = LIBUSB_TRANSFER_FREE_BUFFER;
    102128        r = libusb_submit_transfer(transfer);
     
    106132        }
    107133
    108         while (!completed) {
    109                 r = libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed);
    110                 if (r < 0) {
    111                         if (r == LIBUSB_ERROR_INTERRUPTED)
    112                                 continue;
    113                         libusb_cancel_transfer(transfer);
    114                         while (!completed)
    115                                 if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < 0)
    116                                         break;
    117                         libusb_free_transfer(transfer);
    118                         return r;
    119                 }
    120         }
     134        sync_transfer_wait_for_completion(transfer);
    121135
    122136        if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
     
    154168}
    155169
    156 static void LIBUSB_CALL bulk_transfer_cb(struct libusb_transfer *transfer)
    157 {
    158         int *completed = transfer->user_data;
    159         *completed = 1;
    160         usbi_dbg("actual_length=%d", transfer->actual_length);
    161         /* caller interprets results and frees transfer */
    162 }
    163 
    164170static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
    165171        unsigned char endpoint, unsigned char *buffer, int length,
    166172        int *transferred, unsigned int timeout, unsigned char type)
    167173{
    168         struct libusb_transfer *transfer = libusb_alloc_transfer(0);
     174        struct libusb_transfer *transfer;
    169175        int completed = 0;
    170176        int r;
    171177
     178        if (usbi_handling_events(HANDLE_CTX(dev_handle)))
     179                return LIBUSB_ERROR_BUSY;
     180
     181        transfer = libusb_alloc_transfer(0);
    172182        if (!transfer)
    173183                return LIBUSB_ERROR_NO_MEM;
    174184
    175185        libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, length,
    176                 bulk_transfer_cb, &completed, timeout);
     186                sync_transfer_cb, &completed, timeout);
    177187        transfer->type = type;
    178188
     
    183193        }
    184194
    185         while (!completed) {
    186                 r = libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed);
    187                 if (r < 0) {
    188                         if (r == LIBUSB_ERROR_INTERRUPTED)
    189                                 continue;
    190                         libusb_cancel_transfer(transfer);
    191                         while (!completed)
    192                                 if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < 0)
    193                                         break;
    194                         libusb_free_transfer(transfer);
    195                         return r;
    196                 }
    197         }
    198 
    199         *transferred = transfer->actual_length;
     195        sync_transfer_wait_for_completion(transfer);
     196
     197        if (transferred)
     198                *transferred = transfer->actual_length;
     199
    200200        switch (transfer->status) {
    201201        case LIBUSB_TRANSFER_COMPLETED:
     
    228228}
    229229
    230 /** \ingroup syncio
     230/** \ingroup libusb_syncio
    231231 * Perform a USB bulk transfer. The direction of the transfer is inferred from
    232232 * the direction bits of the endpoint address.
     
    254254 * bulk reads, the maximum number of bytes to receive into the data buffer.
    255255 * \param transferred output location for the number of bytes actually
    256  * transferred.
     256 * transferred. Since version 1.0.21 (\ref LIBUSB_API_VERSION >= 0x01000105),
     257 * it is legal to pass a NULL pointer if you do not wish to receive this
     258 * information.
    257259 * \param timeout timeout (in millseconds) that this function should wait
    258260 * before giving up due to no response being received. For an unlimited
     
    264266 * \returns LIBUSB_ERROR_PIPE if the endpoint halted
    265267 * \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
    266  * \ref packetoverflow
     268 * \ref libusb_packetoverflow
    267269 * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
     270 * \returns LIBUSB_ERROR_BUSY if called from event handling context
    268271 * \returns another LIBUSB_ERROR code on other failures
    269272 */
     
    276279}
    277280
    278 /** \ingroup syncio
     281/** \ingroup libusb_syncio
    279282 * Perform a USB interrupt transfer. The direction of the transfer is inferred
    280283 * from the direction bits of the endpoint address.
     
    304307 * bulk reads, the maximum number of bytes to receive into the data buffer.
    305308 * \param transferred output location for the number of bytes actually
    306  * transferred.
     309 * transferred. Since version 1.0.21 (\ref LIBUSB_API_VERSION >= 0x01000105),
     310 * it is legal to pass a NULL pointer if you do not wish to receive this
     311 * information.
    307312 * \param timeout timeout (in millseconds) that this function should wait
    308313 * before giving up due to no response being received. For an unlimited
     
    313318 * \returns LIBUSB_ERROR_PIPE if the endpoint halted
    314319 * \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
    315  * \ref packetoverflow
     320 * \ref libusb_packetoverflow
    316321 * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
     322 * \returns LIBUSB_ERROR_BUSY if called from event handling context
    317323 * \returns another LIBUSB_ERROR code on other error
    318324 */
     
    324330                transferred, timeout, LIBUSB_TRANSFER_TYPE_INTERRUPT);
    325331}
    326 
  • TabularUnified libusb1/trunk/libusb/version.h

    r1876 r1882  
    11/* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */
     2#include "version_nano.h"
    23#ifndef LIBUSB_MAJOR
    34#define LIBUSB_MAJOR 1
     
    78#endif
    89#ifndef LIBUSB_MICRO
    9 #define LIBUSB_MICRO 16
     10#define LIBUSB_MICRO 21
    1011#endif
    11 /* LIBUSB_NANO may be used for Windows internal versioning. 0 means unused. */
    1212#ifndef LIBUSB_NANO
    1313#define LIBUSB_NANO 0
     
    1515/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
    1616#ifndef LIBUSB_RC
    17 #define LIBUSB_RC "-rc6"
     17#define LIBUSB_RC ""
    1818#endif
  • TabularUnified libusb1/trunk/missing

    r1876 r1882  
    22# Common wrapper for a few potentially missing GNU programs.
    33
    4 scriptversion=2012-06-26.16; # UTC
     4scriptversion=2013-10-28.13; # UTC
    55
    66# Copyright (C) 1996-2013 Free Software Foundation, Inc.
     
    161161   autom4te*)
    162162      echo "You might have modified some maintainer files that require"
    163       echo "the 'automa4te' program to be rebuilt."
     163      echo "the 'autom4te' program to be rebuilt."
    164164      program_details 'autom4te'
    165165      ;;
  • TabularUnified libusb1/trunk/msvc/config.h

    r1876 r1882  
    66#endif
    77
     8/* Visual Studio 2015 and later defines timespec */
     9#if defined(_MSC_VER) && (_MSC_VER >= 1900)
     10#define _TIMESPEC_DEFINED 1
     11#endif
     12
     13/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
     14#pragma warning(disable:4200)
     15/* Disable: warning C6258: Using TerminateThread does not allow proper thread clean up */
     16#pragma warning(disable: 6258)
     17/* Disable: warning C4996: 'GetVersionA': was declared deprecated */
     18#pragma warning(disable: 4996)
     19
     20#if defined(_PREFAST_)
     21/* Disable "Banned API" errors when using the MS's WDK OACR/Prefast */
     22#pragma warning(disable:28719)
     23/* Disable "The function 'InitializeCriticalSection' must be called from within a try/except block" */
     24#pragma warning(disable:28125)
     25#endif
     26
    827/* Default visibility */
    928#define DEFAULT_VISIBILITY /**/
    1029
    11 /* Debug message logging */
    12 //#define ENABLE_DEBUG_LOGGING 1
    13 
    14 /* Message logging */
     30/* Enable global message logging */
    1531#define ENABLE_LOGGING 1
    1632
    17 /* Windows backend */
    18 #define OS_WINDOWS 1
     33/* Uncomment to start with debug message logging enabled */
     34// #define ENABLE_DEBUG_LOGGING 1
     35
     36/* Uncomment to enabling logging to system log */
     37// #define USE_SYSTEM_LOGGING_FACILITY
    1938
    2039/* type of second poll() argument */
    2140#define POLL_NFDS_TYPE unsigned int
    2241
    23 /* no way to run git describe from MSVC? */
    24 #define LIBUSB_DESCRIBE ""
     42/* Windows/WinCE backend */
     43#if defined(_WIN32_WCE)
     44#define OS_WINCE 1
     45#define HAVE_MISSING_H
     46#else
     47#define OS_WINDOWS 1
     48#define HAVE_SIGNAL_H 1
     49#define HAVE_SYS_TYPES_H 1
     50#endif
  • TabularUnified libusb1/trunk/msvc/ddk_build.cmd

    r1876 r1882  
    1 @rem default builds static library.
    2 @rem you can pass the following arguments (case insensitive):
    3 @rem - "DLL" to build a DLL instead of a static library
    4 @rem - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
    51@echo off
     2::# default builds static library.
     3::# you can pass the following arguments (case insensitive):
     4::# - "DLL" to build a DLL instead of a static library
     5::# - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
     6::# - "USBDK" to build with UsbDk backend
    67
    78if Test%BUILD_ALT_DIR%==Test goto usage
    89
    9 rem process commandline parameters
     10::# process commandline parameters
    1011set TARGET=LIBRARY
    1112set STATIC_LIBC=
     13set WITH_USBDK=
    1214set version=1.0
     15set PWD=%~dp0
     16set BUILD_CMD=build -bcwgZ -M2
     17
     18:more_args
    1319
    1420if "%1" == "" goto no_more_args
    15 rem /I for case insensitive
     21::# /I for case insensitive
    1622if /I Test%1==TestDLL set TARGET=DYNLINK
    1723if /I Test%1==Test/MT set STATIC_LIBC=1
     24if /I Test%1==TestUSBDK set WITH_USBDK=1
     25
     26shift
     27goto more_args
     28
    1829:no_more_args
    1930
     
    2334del target
    2435@echo on
    25 build -cwgZ
     36%BUILD_CMD%
    2637@echo off
    2738if errorlevel 1 goto builderror
     
    7485copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
    7586@echo on
    76 build -cwgZ
     87%BUILD_CMD%
    7788@echo off
    78 if errorlevel 1 goto buildlistdevserror
     89if errorlevel 1 goto builderror
    7990cd ..\..
    8091
     
    8596copy %srcPath%\listdevs.pdb %dstPath%\examples
    8697
     98@echo off
     99
     100if exist examples\xusb_ddkbuild goto md8
     101md examples\xusb_ddkbuild
     102:md8
     103
     104cd examples\xusb_ddkbuild
     105copy ..\..\msvc\xusb_sources sources >NUL 2>&1
     106@echo on
     107%BUILD_CMD%
     108@echo off
     109if errorlevel 1 goto builderror
     110cd ..\..
     111
     112set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
     113@echo on
     114
     115copy %srcPath%\xusb.exe %dstPath%\examples
     116copy %srcPath%\xusb.pdb %dstPath%\examples
     117
     118@echo off
     119
     120if exist examples\getopt\getopt_ddkbuild goto md9
     121md examples\getopt\getopt_ddkbuild
     122:md9
     123
     124cd examples\getopt\getopt_ddkbuild
     125copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
     126@echo on
     127%BUILD_CMD%
     128@echo off
     129if errorlevel 1 goto builderror
     130cd ..\..\..
     131
     132if exist examples\fxload_ddkbuild goto md10
     133md examples\fxload_ddkbuild
     134:md10
     135
     136cd examples\fxload_ddkbuild
     137copy ..\..\msvc\fxload_sources sources >NUL 2>&1
     138@echo on
     139%BUILD_CMD%
     140@echo off
     141if errorlevel 1 goto builderror
     142cd ..\..
     143
     144set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
     145@echo on
     146
     147copy %srcPath%\fxload.exe %dstPath%\examples
     148copy %srcPath%\fxload.pdb %dstPath%\examples
     149
     150@echo off
     151
     152if exist examples\hotplugtest_ddkbuild goto md11
     153md examples\hotplugtest_ddkbuild
     154:md11
     155
     156cd examples\hotplugtest_ddkbuild
     157copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1
     158@echo on
     159%BUILD_CMD%
     160@echo off
     161if errorlevel 1 goto builderror
     162cd ..\..
     163
     164set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
     165@echo on
     166
     167copy %srcPath%\hotplugtest.exe %dstPath%\examples
     168copy %srcPath%\hotplugtest.pdb %dstPath%\examples
     169
     170@echo off
     171
    87172cd msvc
    88 goto done
    89 
    90 
    91 :builderror
    92 cd ..\..\msvc
    93 echo Build failed
    94 goto done
    95 
    96 :buildlistdevserror
    97 cd ..\..\msvc
    98 echo listdevs build failed
    99173goto done
    100174
     
    104178goto done
    105179
     180:builderror
     181echo Build failed
     182
    106183:done
     184cd %PWD%
  • TabularUnified libusb1/trunk/msvc/libusb.dsw

    r1876 r1882  
    4343###############################################################################
    4444
     45Project: "xusb"=".\xusb.dsp" - Package Owner=<4>
     46
     47Package=<5>
     48{{{
     49}}}
     50
     51Package=<4>
     52{{{
     53    Begin Project Dependency
     54    Project_Dep_Name libusb_static
     55    End Project Dependency
     56}}}
     57
     58###############################################################################
     59
    4560Global:
    4661
  • TabularUnified libusb1/trunk/msvc/libusb_dll.dsp

    r1876 r1882  
    136136# Begin Source File
    137137
    138 SOURCE=..\libusb\os\windows_usb.c
     138SOURCE=..\libusb\os\windows_winusb.c
    139139# End Source File
    140140# End Group
     
    180180# Begin Source File
    181181
    182 SOURCE=..\libusb\os\windows_usb.h
     182SOURCE=..\libusb\os\windows_winusb.h
     183# End Source File
     184# Begin Source File
     185
     186SOURCE=..\libusb\os\windows_common.h
    183187# End Source File
    184188# End Group
  • TabularUnified libusb1/trunk/msvc/libusb_sources

    r1876 r1882  
    1313!ENDIF
    1414
     15!IFDEF WITH_USBDK
     16BACKEND_DEFINES="/DUSE_USBDK"
     17!ENDIF
     18
    1519INCLUDES=..;..\..\msvc;$(DDK_INC_PATH)
    16 C_DEFINES= $(C_DEFINES) $(LIBUSB_DEFINES) /DDDKBUILD
     20C_DEFINES= $(C_DEFINES) $(LIBUSB_DEFINES) $(BACKEND_DEFINES) /DDDKBUILD
    1721
    1822# http://jpassing.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/
     
    3034        ..\descriptor.c \
    3135        ..\io.c \
     36        ..\strerror.c \
    3237        ..\sync.c \
     38        ..\hotplug.c \
    3339        threads_windows.c \
    3440        poll_windows.c \
    35         windows_usb.c \
     41        windows_winusb.c \
     42        windows_usbdk.c \
     43        windows_nt_common.c \
    3644        ..\libusb-1.0.rc
  • TabularUnified libusb1/trunk/msvc/libusb_static.dsp

    r1876 r1882  
    120120# Begin Source File
    121121
    122 SOURCE=..\libusb\os\windows_usb.c
     122SOURCE=..\libusb\os\windows_winusb.c
    123123# End Source File
    124124# End Group
     
    164164# Begin Source File
    165165
    166 SOURCE=..\libusb\os\windows_usb.h
     166SOURCE=..\libusb\os\windows_winusb.h
     167# End Source File
     168# Begin Source File
     169
     170SOURCE=..\libusb\os\windows_common.h
    167171# End Source File
    168172# End Group
Note: See TracChangeset for help on using the changeset viewer.