Upgrade libusb to 1.0.16
This commit is contained in:
parent
3c53f2e5e0
commit
d261dfaf46
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,60 @@
|
|||
Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
Copyright © 2010-2012 Peter Stuge <peter@stuge.se>
|
||||
Copyright © 2008-2011 Nathan Hjelm <hjelmn@users.sourceforge.net>
|
||||
Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
|
||||
Copyright © 2009-2012 Ludovic Rousseau <ludovic.rousseau@gmail.com>
|
||||
Copyright © 2010-2012 Michael Plante <michael.plante@gmail.com>
|
||||
Copyright © 2011-2012 Hans de Goede <hdegoede@redhat.com>
|
||||
Copyright © 2012 Martin Pieuchot <mpi@openbsd.org>
|
||||
Copyright © 2012-2013 Toby Gray <toby.gray@realvnc.com>
|
||||
|
||||
Other contributors:
|
||||
Alan Ott
|
||||
Alan Stern
|
||||
Alex Vatchenko
|
||||
Anthony Clay
|
||||
Artem Egorkine
|
||||
Aurelien Jarno
|
||||
Bastien Nocera
|
||||
Benjamin Dobell
|
||||
Chris Dickens
|
||||
Colin Walters
|
||||
Dave Camarillo
|
||||
David Engraf
|
||||
David Moore
|
||||
Davidlohr Bueso
|
||||
Federico Manzan
|
||||
Felipe Balbi
|
||||
Francesco Montorsi
|
||||
Graeme Gill
|
||||
Hans Ulrich Niedermann
|
||||
Hector Martin
|
||||
Hoi-Ho Chan
|
||||
Ilya Konstantinov
|
||||
James Hanko
|
||||
Konrad Rzepecki
|
||||
Lars Wirzenius
|
||||
Luca Longinotti
|
||||
Martin Koegler
|
||||
Matthias Bolte
|
||||
Mike Frysinger
|
||||
Mikhail Gusarov
|
||||
Nicholas Corgan
|
||||
Orin Eman
|
||||
Pekka Nikander
|
||||
Rob Walker
|
||||
Sean McBride
|
||||
Sebastian Pipping
|
||||
Simon Haggett
|
||||
Thomas Röfer
|
||||
Tim Roberts
|
||||
Toby Peterson
|
||||
Trygve Laugstøl
|
||||
Uri Lublin
|
||||
Vasily Khoruzhick
|
||||
Vegard Storheil Eriksen
|
||||
Vitali Lovich
|
||||
Xiaofan Chen
|
||||
Zoltán Kovács
|
||||
Роман Донченко
|
|
@ -0,0 +1,504 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
For detailed information about the changes below, please see the git log or
|
||||
visit: http://log.libusbx.org
|
||||
|
||||
2013-07-11: v1.0.16
|
||||
* Add hotplug support for Darwin and Linux (#9)
|
||||
* Add superspeed endpoint companion descriptor support (#15)
|
||||
* Add BOS descriptor support (#15)
|
||||
* Make descriptor parsing code more robust
|
||||
* New libusb_get_port_numbers API, this is libusb_get_port_path without
|
||||
the unnecessary context parameter, libusb_get_port_path is now deprecated
|
||||
* New libusb_strerror API (#14)
|
||||
* New libusb_set_auto_detach_kernel_driver API (#17)
|
||||
* Improve topology API docs (#95)
|
||||
* Logging now use a single write call per log-message, avoiding log-message
|
||||
"interlacing" when using multiple threads.
|
||||
* Android: use Android logging when building on Android (#101)
|
||||
* Darwin: make libusb_reset reenumerate device on descriptors change (#89)
|
||||
* Darwin: add support for the LIBUSB_TRANSFER_ADD_ZERO_PACKET flag (#91)
|
||||
* Darwin: add a device cache (#112, #114)
|
||||
* Examples: Add sam3u_benchmark isochronous example by Harald Welte (#109)
|
||||
* Many other bug fixes and improvements
|
||||
The (#xx) numbers are libusbx issue numbers, see ie:
|
||||
https://github.com/libusbx/libusbx/issues/9
|
||||
|
||||
2013-04-15: v1.0.15
|
||||
* Improve transfer cancellation and avoid short read failures on broken descriptors
|
||||
* Filter out 8-bit characters in libusb_get_string_descriptor_ascii()
|
||||
* Add WinCE support
|
||||
* Add library stress tests
|
||||
* Add Cypress FX3 firmware upload support for fxload sample
|
||||
* Add HID and kernel driver detach support capabilities detection
|
||||
* Add SuperSpeed detection on OS X
|
||||
* Fix bInterval value interpretation on OS X
|
||||
* Fix issues with autoclaim, composite HID devices, interface autoclaim and
|
||||
early abort in libusb_close() on Windows. Also add VS2012 solution files.
|
||||
* Improve fd event handling on Linux
|
||||
* Other bug fixes and improvements
|
||||
|
||||
2012-09-26: v1.0.14
|
||||
* Reverts the previous API change with regards to bMaxPower.
|
||||
If this doesn't matter to you, you are encouraged to keep using v1.0.13,
|
||||
as it will use the same attribute as v2.0, to be released soon.
|
||||
* Note that LIBUSBX_API_VERSION is *decreased* to 0x010000FF and the previous
|
||||
guidelines with regards to concurrent use of MaxPower/bMaxPower still apply.
|
||||
|
||||
2012-09-20: v1.0.13
|
||||
* [MAJOR] Fix a typo in the API with struct libusb_config_descriptor where
|
||||
MaxPower was used instead of bMaxPower, as defined in the specs. If your
|
||||
application was accessing the MaxPower attribute, and you need to maintain
|
||||
compatibility with libusb or older versions, see APPENDIX A below.
|
||||
* Fix broken support for the 0.1 -> 1.0 libusb-compat layer
|
||||
* Fix unwanted cancellation of pending timeouts as well as major timeout related bugs
|
||||
* Fix handling of HID and composite devices on Windows
|
||||
* Introduce LIBUSBX_API_VERSION macro
|
||||
* Add Cypress FX/FX2 firmware upload sample, based on fxload from
|
||||
http://linux-hotplug.sourceforge.net
|
||||
* Add libusb0 (libusb-win32) and libusbK driver support on Windows. Note that while
|
||||
the drivers allow it, isochronous transfers are not supported yet in libusbx. Also
|
||||
not supported yet is the use of libusb-win32 filter drivers on composite interfaces
|
||||
* Add support for the new get_capabilities ioctl on Linux and avoid unnecessary
|
||||
splitting of bulk transfers
|
||||
* Improve support for newer Intel and Renesas USB 3.0 controllers on Windows
|
||||
* Harmonize the device number for root hubs across platforms
|
||||
* Other bug fixes and improvements
|
||||
|
||||
2012-06-15: v1.0.12
|
||||
* Fix a potential major regression with pthread on Linux
|
||||
* Fix missing thread ID from debug log output on cygwin
|
||||
* Fix possible crash when using longjmp and MinGW's gcc 4.6
|
||||
* Add topology calls: libusb_get_port_number(), libusb_get_parent() & libusb_get_port_path()
|
||||
* Add toggleable debug, using libusb_set_debug() or the LIBUSB_DEBUG environment variable
|
||||
* Define log levels in libusb.h and set timestamp origin to first libusb_init() call
|
||||
* All logging is now sent to to stderr (info was sent to stdout previously)
|
||||
* Update log messages severity and avoid polluting log output on OS-X
|
||||
* Add HID driver support on Windows
|
||||
* Enable interchangeability of MSVC and MinGW DLLs
|
||||
* Additional bug fixes and improvements
|
||||
|
||||
2012-05-08: v1.0.11
|
||||
* Revert removal of critical Windows event handling that was introduced in 1.0.10
|
||||
* Fix a possible deadlock in Windows when submitting transfers
|
||||
* Add timestamped logging
|
||||
* Add NetBSD support (experimental) and BSD libusb_get_device_speed() data
|
||||
* Add bootstrap.sh alongside autogen.sh (bootstrap.sh doesn't invoke configure)
|
||||
* Search for device nodes in /dev for Android support
|
||||
* Other bug fixes
|
||||
|
||||
2012-04-17: v1.0.10
|
||||
* Public release
|
||||
* Add libusb_get_version
|
||||
* Add Visual Studio 2010 project files
|
||||
* Some Windows code cleanup
|
||||
* Fix xusb sample warnings
|
||||
|
||||
2012-04-02: v1.0.9
|
||||
* First libusbx release
|
||||
* Add libusb_get_device_speed (all, except BSD) and libusb_error_name
|
||||
* Add Windows support (WinUSB driver only)
|
||||
* Add OpenBSD support
|
||||
* Add xusb sample
|
||||
* Tons of bug fixes
|
||||
|
||||
2010-05-07: v1.0.8
|
||||
* Bug fixes
|
||||
|
||||
2010-04-19: v1.0.7
|
||||
* Bug fixes and documentation tweaks
|
||||
* Add more interface class definitions
|
||||
|
||||
2009-11-22: v1.0.6
|
||||
* Bug fixes
|
||||
* Increase libusb_handle_events() timeout to 60s for powersaving
|
||||
|
||||
2009-11-15: v1.0.5
|
||||
* Use timerfd when available for timer management
|
||||
* Small fixes/updates
|
||||
|
||||
2009-11-06: v1.0.4 release
|
||||
* Bug fixes including transfer locking to fix some potential threading races
|
||||
* More flexibility with clock types on Linux
|
||||
* Use new bulk continuation tracking in Linux 2.6.32 for improved handling
|
||||
of short/failed transfers
|
||||
|
||||
2009-08-27: v1.0.3 release
|
||||
* Bug fixes
|
||||
* Add libusb_get_max_iso_packet_size()
|
||||
|
||||
2009-06-13: v1.0.2 release
|
||||
* Bug fixes
|
||||
|
||||
2009-05-12: v1.0.1 release
|
||||
* Bug fixes
|
||||
* Darwin backend
|
||||
|
||||
2008-12-13: v1.0.0 release
|
||||
* Bug fixes
|
||||
|
||||
2008-11-21: v0.9.4 release
|
||||
* Bug fixes
|
||||
* Add libusb_attach_kernel_driver()
|
||||
|
||||
2008-08-23: v0.9.3 release
|
||||
* Bug fixes
|
||||
|
||||
2008-07-19: v0.9.2 release
|
||||
* Bug fixes
|
||||
|
||||
2008-06-28: v0.9.1 release
|
||||
* Bug fixes
|
||||
* Introduce contexts to the API
|
||||
* Compatibility with new Linux kernel features
|
||||
|
||||
2008-05-25: v0.9.0 release
|
||||
* First libusb-1.0 beta release
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
APPENDIX A - How to maintain code compatibility with versions of libusb and
|
||||
libusbx that use MaxPower:
|
||||
|
||||
If you must to maintain compatibility with versions of the library that aren't
|
||||
using the bMaxPower attribute in struct libusb_config_descriptor, the
|
||||
recommended way is to use the new LIBUSBX_API_VERSION macro with an #ifdef.
|
||||
For instance, if your code was written as follows:
|
||||
|
||||
if (dev->config[0].MaxPower < 250)
|
||||
|
||||
Then you should modify it to have:
|
||||
|
||||
#if defined(LIBUSBX_API_VERSION) && (LIBUSBX_API_VERSION >= 0x01000100)
|
||||
if (dev->config[0].bMaxPower < 250)
|
||||
#else
|
||||
if (dev->config[0].MaxPower < 250)
|
||||
#endif
|
|
@ -0,0 +1,234 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that the
|
||||
`configure' script does not know about. Run `./configure --help' for
|
||||
details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out automatically,
|
||||
but needs to determine by the type of machine the package will run on.
|
||||
Usually, assuming the package is built to be run on the _same_
|
||||
architectures, `configure' can figure that out, but if it prints a
|
||||
message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share, you
|
||||
can create a site shell script called `config.site' that gives default
|
||||
values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
DISTCLEANFILES = libusb-1.0.pc
|
||||
EXTRA_DIST = TODO PORTING msvc libusb/libusb-1.0.def libusb/version_nano.h \
|
||||
examples/getopt/getopt.c examples/getopt/getopt1.c examples/getopt/getopt.h
|
||||
SUBDIRS = libusb doc
|
||||
|
||||
if BUILD_EXAMPLES
|
||||
SUBDIRS += examples
|
||||
endif
|
||||
|
||||
if BUILD_TESTS
|
||||
SUBDIRS += tests
|
||||
endif
|
||||
|
||||
pkgconfigdir=$(libdir)/pkgconfig
|
||||
pkgconfig_DATA=libusb-1.0.pc
|
||||
|
||||
.PHONY: dist-up
|
||||
|
||||
reldir = .release/$(distdir)
|
||||
dist-up: dist
|
||||
rm -rf $(reldir)
|
||||
mkdir -p $(reldir)
|
||||
cp $(distdir).tar.bz2 $(reldir)
|
||||
rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
|
||||
rm -rf $(reldir)
|
|
@ -0,0 +1,875 @@
|
|||
# Makefile.in generated by automake 1.13.4 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@BUILD_EXAMPLES_TRUE@am__append_1 = examples
|
||||
@BUILD_TESTS_TRUE@am__append_2 = tests
|
||||
subdir = .
|
||||
DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
|
||||
$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) \
|
||||
$(srcdir)/config.h.in $(srcdir)/libusb-1.0.pc.in COPYING \
|
||||
THANKS TODO compile config.guess config.sub depcomp install-sh \
|
||||
missing ltmain.sh
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/libusb/version.h $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = libusb-1.0.pc
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
|
||||
DATA = $(pkgconfig_DATA)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
|
||||
$(LISP)config.h.in
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = libusb doc examples tests
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
GZIP_ENV = --best
|
||||
DIST_ARCHIVES = $(distdir).tar.bz2
|
||||
DIST_TARGETS = dist-bzip2
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLDFLAGS = @LTLDFLAGS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OS_DARWIN = @OS_DARWIN@
|
||||
OS_LINUX = @OS_LINUX@
|
||||
OS_OPENBSD = @OS_OPENBSD@
|
||||
OS_WINDOWS = @OS_WINDOWS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_UDEV = @USE_UDEV@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
DISTCLEANFILES = libusb-1.0.pc
|
||||
EXTRA_DIST = TODO PORTING msvc libusb/libusb-1.0.def libusb/version_nano.h \
|
||||
examples/getopt/getopt.c examples/getopt/getopt1.c examples/getopt/getopt.h
|
||||
|
||||
SUBDIRS = libusb doc $(am__append_1) $(am__append_2)
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libusb-1.0.pc
|
||||
reldir = .release/$(distdir)
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then rm -f stamp-h1; else :; fi
|
||||
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
libusb-1.0.pc: $(top_builddir)/config.status $(srcdir)/libusb-1.0.pc.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
install-pkgconfigDATA: $(pkgconfig_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgconfigDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscope: cscope.files
|
||||
test ! -s cscope.files \
|
||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
||||
clean-cscope:
|
||||
-rm -f cscope.files
|
||||
cscope.files: clean-cscope cscopelist
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist dist-all:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__post_remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(DATA) config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-pkgconfigDATA
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-pkgconfigDATA
|
||||
|
||||
.MAKE: $(am__recursive_targets) all install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
clean-libtool cscope cscopelist-am ctags ctags-am dist \
|
||||
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
|
||||
dist-xz dist-zip distcheck distclean distclean-generic \
|
||||
distclean-hdr distclean-libtool distclean-tags distcleancheck \
|
||||
distdir distuninstallcheck dvi dvi-am html html-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
install-dvi install-dvi-am install-exec install-exec-am \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
install-man install-pdf install-pdf-am install-pkgconfigDATA \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am uninstall-pkgconfigDATA
|
||||
|
||||
|
||||
.PHONY: dist-up
|
||||
dist-up: dist
|
||||
rm -rf $(reldir)
|
||||
mkdir -p $(reldir)
|
||||
cp $(distdir).tar.bz2 $(reldir)
|
||||
rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
|
||||
rm -rf $(reldir)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,2 @@
|
|||
For the latest libusbx news, please refer to the ChangeLog file, or visit:
|
||||
http://libusbx.org
|
|
@ -0,0 +1,94 @@
|
|||
PORTING LIBUSBX TO OTHER PLATFORMS
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This document is aimed at developers wishing to port libusbx to unsupported
|
||||
platforms. I believe the libusbx API is OS-independent, so by supporting
|
||||
multiple operating systems we pave the way for cross-platform USB device
|
||||
drivers.
|
||||
|
||||
Implementation-wise, the basic idea is that you provide an interface to
|
||||
libusbx's internal "backend" API, which performs the appropriate operations on
|
||||
your target platform.
|
||||
|
||||
In terms of USB I/O, your backend provides functionality to submit
|
||||
asynchronous transfers (synchronous transfers are implemented in the higher
|
||||
layers, based on the async interface). Your backend must also provide
|
||||
functionality to cancel those transfers.
|
||||
|
||||
Your backend must also provide an event handling function to "reap" ongoing
|
||||
transfers and process their results.
|
||||
|
||||
The backend must also provide standard functions for other USB operations,
|
||||
e.g. setting configuration, obtaining descriptors, etc.
|
||||
|
||||
|
||||
File descriptors for I/O polling
|
||||
================================
|
||||
|
||||
For libusbx to work, your event handling function obviously needs to be called
|
||||
at various points in time. Your backend must provide a set of file descriptors
|
||||
which libusbx and its users can pass to poll() or select() to determine when
|
||||
it is time to call the event handling function.
|
||||
|
||||
On Linux, this is easy: the usbfs kernel interface exposes a file descriptor
|
||||
which can be passed to poll(). If something similar is not true for your
|
||||
platform, you can emulate this using an internal library thread to reap I/O as
|
||||
necessary, and a pipe() with the main library to raise events. The file
|
||||
descriptor of the pipe can then be provided to libusbx as an event source.
|
||||
|
||||
|
||||
Interface semantics and documentation
|
||||
=====================================
|
||||
|
||||
Documentation of the backend interface can be found in libusbi.h inside the
|
||||
usbi_os_backend structure definition.
|
||||
|
||||
Your implementations of these functions will need to call various internal
|
||||
libusbx functions, prefixed with "usbi_". Documentation for these functions
|
||||
can be found in the .c files where they are implemented.
|
||||
|
||||
You probably want to skim over *all* the documentation before starting your
|
||||
implementation. For example, you probably need to allocate and store private
|
||||
OS-specific data for device handles, but the documentation for the mechanism
|
||||
for doing so is probably not the first thing you will see.
|
||||
|
||||
The Linux backend acts as a good example - view it as a reference
|
||||
implementation which you should try to match the behaviour of.
|
||||
|
||||
|
||||
Getting started
|
||||
===============
|
||||
|
||||
1. Modify configure.ac to detect your platform appropriately (see the OS_LINUX
|
||||
stuff for an example).
|
||||
|
||||
2. Implement your backend in the libusb/os/ directory, modifying
|
||||
libusb/os/Makefile.am appropriately.
|
||||
|
||||
3. Add preprocessor logic to the top of libusb/core.c to statically assign the
|
||||
right usbi_backend for your platform.
|
||||
|
||||
4. Produce and test your implementation.
|
||||
|
||||
5. Send your implementation to libusbx-devel mailing list.
|
||||
|
||||
|
||||
Implementation difficulties? Questions?
|
||||
=======================================
|
||||
|
||||
If you encounter difficulties porting libusbx to your platform, please raise
|
||||
these issues on the libusbx-devel mailing list. Where possible and sensible, I
|
||||
am interested in solving problems preventing libusbx from operating on other
|
||||
platforms.
|
||||
|
||||
The libusbx-devel mailing list is also a good place to ask questions and
|
||||
make suggestions about the internal API. Hopefully we can produce some
|
||||
better documentation based on your questions and other input.
|
||||
|
||||
You are encouraged to get involved in the process; if the library needs
|
||||
some infrastructure additions/modifications to better support your platform,
|
||||
you are encouraged to make such changes (in cleanly distinct patch
|
||||
submissions). Even if you do not make such changes yourself, please do raise
|
||||
the issues on the mailing list at the very minimum.
|
|
@ -0,0 +1,28 @@
|
|||
libusbx
|
||||
=======
|
||||
|
||||
libusbx is a library for USB device access from Linux, Mac OS X,
|
||||
Windows and OpenBSD/NetBSD userspace, with OpenBSD/NetBSD, and to a
|
||||
lesser extent some of the newest features of Windows (such as libusbK
|
||||
and libusb-win32 driver support) being EXPERIMENTAL.
|
||||
It is written in C and licensed under the GNU Lesser General Public
|
||||
License version 2.1 or, at your option, any later version (see COPYING).
|
||||
|
||||
libusbx is abstracted internally in such a way that it can hopefully
|
||||
be ported to other operating systems. Please see the PORTING file
|
||||
for more information.
|
||||
|
||||
libusbx homepage:
|
||||
http://libusbx.org/
|
||||
|
||||
Developers will wish to consult the API documentation:
|
||||
http://api.libusbx.org
|
||||
|
||||
Use the mailing list for questions, comments, etc:
|
||||
http://mailing-list.libusbx.org
|
||||
|
||||
- Pete Batard <pete@akeo.ie>
|
||||
- Hans de Goede <hdegoede@redhat.com>
|
||||
- Xiaofan Chen <xiaofanc@gmail.com>
|
||||
- Ludovic Rousseau <ludovic.rousseau@gmail.com>
|
||||
(use the mailing list rather than mailing developers directly)
|
|
@ -0,0 +1,7 @@
|
|||
Development contributors are listed in the AUTHORS file. Community members who
|
||||
have also made significant contributions in other areas are listed below:
|
||||
|
||||
Alan Stern
|
||||
Ludovic Rousseau
|
||||
Tim Roberts
|
||||
Xiaofan Chen
|
|
@ -0,0 +1,2 @@
|
|||
Please see the libusbx roadmap by visiting:
|
||||
https://github.com/libusbx/libusbx/issues/milestones?direction=asc&sort=due_date
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,347 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,134 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Default visibility */
|
||||
#undef DEFAULT_VISIBILITY
|
||||
|
||||
/* Start with debug message logging enabled */
|
||||
#undef ENABLE_DEBUG_LOGGING
|
||||
|
||||
/* Message logging */
|
||||
#undef ENABLE_LOGGING
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `udev' library (-ludev). */
|
||||
#undef HAVE_LIBUDEV
|
||||
|
||||
/* Define to 1 if you have the <libudev.h> header file. */
|
||||
#undef HAVE_LIBUDEV_H
|
||||
|
||||
/* Define to 1 if you have the <linux/filter.h> header file. */
|
||||
#undef HAVE_LINUX_FILTER_H
|
||||
|
||||
/* Define to 1 if you have the <linux/netlink.h> header file. */
|
||||
#undef HAVE_LINUX_NETLINK_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#undef HAVE_POLL_H
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#undef HAVE_SIGNAL_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if the system has the type `struct timespec'. */
|
||||
#undef HAVE_STRUCT_TIMESPEC
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Darwin backend */
|
||||
#undef OS_DARWIN
|
||||
|
||||
/* Linux backend */
|
||||
#undef OS_LINUX
|
||||
|
||||
/* OpenBSD/NetBSD backend */
|
||||
#undef OS_OPENBSD
|
||||
|
||||
/* Windows backend */
|
||||
#undef OS_WINDOWS
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* type of second poll() argument */
|
||||
#undef POLL_NFDS_TYPE
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Use POSIX Threads */
|
||||
#undef THREADS_POSIX
|
||||
|
||||
/* timerfd headers available */
|
||||
#undef USBI_TIMERFD_AVAILABLE
|
||||
|
||||
/* Use udev for device enumeration/hotplug */
|
||||
#undef USE_UDEV
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Use GNU extensions */
|
||||
#undef _GNU_SOURCE
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,249 @@
|
|||
dnl These m4 macros are whitespace sensitive and break if moved around much.
|
||||
m4_define([LU_VERSION_H], m4_include([libusb/version.h]))
|
||||
m4_define([LU_DEFINE_VERSION_ATOM],
|
||||
[m4_define([$1], m4_bregexp(LU_VERSION_H,
|
||||
[^#define\s*$1\s*\([0-9]*\).*], [\1]))])
|
||||
m4_define([LU_DEFINE_VERSION_RC_ATOM],
|
||||
[m4_define([$1], m4_bregexp(LU_VERSION_H,
|
||||
[^#define\s*$1\s*"\(-rc[0-9]*\)".*], [\1]))])
|
||||
dnl The m4_bregexp() returns (only) the numbers following the #define named
|
||||
dnl in the first macro parameter. m4_define() then defines the name for use
|
||||
dnl in AC_INIT.
|
||||
|
||||
LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR])
|
||||
LU_DEFINE_VERSION_ATOM([LIBUSB_MINOR])
|
||||
LU_DEFINE_VERSION_ATOM([LIBUSB_MICRO])
|
||||
LU_DEFINE_VERSION_RC_ATOM([LIBUSB_RC])
|
||||
|
||||
AC_INIT([libusbx],[LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC],[libusbx-devel@lists.sourceforge.net],[libusbx],[http://libusbx.org])
|
||||
|
||||
# Library versioning
|
||||
# These numbers should be tweaked on every release. Read carefully:
|
||||
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
# http://sourceware.org/autobook/autobook/autobook_91.html
|
||||
lt_current="1"
|
||||
lt_revision="0"
|
||||
lt_age="1"
|
||||
LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_CONFIG_SRCDIR([libusb/core.c])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||
|
||||
AC_PREREQ([2.50])
|
||||
AC_PROG_CC
|
||||
LT_INIT
|
||||
LT_LANG([Windows Resource])
|
||||
AC_C_INLINE
|
||||
AM_PROG_CC_C_O
|
||||
AC_DEFINE([_GNU_SOURCE], 1, [Use GNU extensions])
|
||||
|
||||
LTLDFLAGS="${LTLDFLAGS} -no-undefined"
|
||||
|
||||
AC_MSG_CHECKING([operating system])
|
||||
|
||||
case $host in
|
||||
*-linux*)
|
||||
AC_MSG_RESULT([Linux])
|
||||
backend="linux"
|
||||
threads="posix"
|
||||
;;
|
||||
*-darwin*)
|
||||
AC_MSG_RESULT([Darwin/Mac OS X])
|
||||
backend="darwin"
|
||||
threads="posix"
|
||||
;;
|
||||
*-openbsd*)
|
||||
AC_MSG_RESULT([OpenBSD])
|
||||
backend="bsd"
|
||||
threads="posix"
|
||||
;;
|
||||
*-netbsd*)
|
||||
AC_MSG_RESULT([NetBSD (using OpenBSD backend)])
|
||||
backend="bsd"
|
||||
threads="posix"
|
||||
;;
|
||||
*-mingw*)
|
||||
AC_MSG_RESULT([Windows])
|
||||
backend="windows"
|
||||
threads="windows"
|
||||
create_import_lib="yes"
|
||||
AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
|
||||
;;
|
||||
*-cygwin*)
|
||||
AC_MSG_RESULT([Cygwin (using Windows backend)])
|
||||
backend="windows"
|
||||
threads="posix"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([unsupported operating system])
|
||||
esac
|
||||
|
||||
case $backend in
|
||||
linux)
|
||||
AC_DEFINE(OS_LINUX, 1, [Linux backend])
|
||||
AC_SUBST(OS_LINUX)
|
||||
AC_SEARCH_LIBS(clock_gettime, rt, [], [], -pthread)
|
||||
AC_ARG_ENABLE([udev],
|
||||
[AC_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended, default: yes)])],
|
||||
[], [enable_udev="yes"])
|
||||
if test "x$enable_udev" = "xyes" ; then
|
||||
# system has udev. use it or fail!
|
||||
AC_CHECK_HEADERS([libudev.h],[],[AC_ERROR(["udev support requested but libudev not installed"])])
|
||||
AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])])
|
||||
AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug])
|
||||
else
|
||||
AC_CHECK_HEADERS([linux/netlink.h linux/filter.h], [], [AC_ERROR(["Linux netlink headers not found"])])
|
||||
fi
|
||||
AC_SUBST(USE_UDEV)
|
||||
THREAD_CFLAGS="-pthread"
|
||||
LIBS="${LIBS} -pthread"
|
||||
AC_CHECK_HEADERS([poll.h])
|
||||
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
|
||||
;;
|
||||
darwin)
|
||||
AC_DEFINE(OS_DARWIN, 1, [Darwin backend])
|
||||
AC_SUBST(OS_DARWIN)
|
||||
LIBS="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
|
||||
LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
|
||||
AC_CHECK_HEADERS([poll.h])
|
||||
AC_CHECK_TYPE([nfds_t],
|
||||
[AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])],
|
||||
[AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])],
|
||||
[#include <poll.h>])
|
||||
;;
|
||||
bsd)
|
||||
AC_DEFINE(OS_OPENBSD, 1, [OpenBSD/NetBSD backend])
|
||||
AC_SUBST(OS_OPENBSD)
|
||||
THREAD_CFLAGS="-pthread"
|
||||
LIBS="-pthread"
|
||||
AC_CHECK_HEADERS([poll.h])
|
||||
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
|
||||
;;
|
||||
windows)
|
||||
AC_DEFINE(OS_WINDOWS, 1, [Windows backend])
|
||||
AC_SUBST(OS_WINDOWS)
|
||||
LIBS=""
|
||||
LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
|
||||
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(LIBS)
|
||||
|
||||
AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
|
||||
AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
|
||||
AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xbsd)
|
||||
AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
|
||||
AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
|
||||
AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes")
|
||||
AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes)
|
||||
if test "$threads" = posix; then
|
||||
AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
|
||||
fi
|
||||
|
||||
# timerfd
|
||||
AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=1], [timerfd_h=0])
|
||||
AC_ARG_ENABLE([timerfd],
|
||||
[AS_HELP_STRING([--enable-timerfd],
|
||||
[use timerfd for timing (default auto)])],
|
||||
[use_timerfd=$enableval], [use_timerfd='auto'])
|
||||
|
||||
if test "x$use_timerfd" = "xyes" -a "x$timerfd_h" = "x0"; then
|
||||
AC_MSG_ERROR([timerfd header not available; glibc 2.9+ required])
|
||||
fi
|
||||
|
||||
AC_CHECK_DECL([TFD_NONBLOCK], [tfd_hdr_ok=yes], [tfd_hdr_ok=no], [#include <sys/timerfd.h>])
|
||||
if test "x$use_timerfd" = "xyes" -a "x$tfd_hdr_ok" = "xno"; then
|
||||
AC_MSG_ERROR([timerfd header not usable; glibc 2.9+ required])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to use timerfd for timing])
|
||||
if test "x$use_timerfd" = "xno"; then
|
||||
AC_MSG_RESULT([no (disabled by user)])
|
||||
else
|
||||
if test "x$timerfd_h" = "x1" -a "x$tfd_hdr_ok" = "xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(USBI_TIMERFD_AVAILABLE, 1, [timerfd headers available])
|
||||
else
|
||||
AC_MSG_RESULT([no (header not available)])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CHECK_TYPES(struct timespec)
|
||||
|
||||
# Message logging
|
||||
AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
|
||||
[log_enabled=$enableval],
|
||||
[log_enabled='yes'])
|
||||
if test "x$log_enabled" != "xno"; then
|
||||
AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
|
||||
[start with debug message logging enabled (default n)])],
|
||||
[debug_log_enabled=$enableval],
|
||||
[debug_log_enabled='no'])
|
||||
if test "x$debug_log_enabled" != "xno"; then
|
||||
AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Start with debug message logging enabled])
|
||||
fi
|
||||
|
||||
# Examples build
|
||||
AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
|
||||
[build example applications (default n)])],
|
||||
[build_examples=$enableval],
|
||||
[build_examples='no'])
|
||||
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
|
||||
|
||||
# Tests build
|
||||
AC_ARG_ENABLE([tests-build], [AS_HELP_STRING([--enable-tests-build],
|
||||
[build test applications (default n)])],
|
||||
[build_tests=$enableval],
|
||||
[build_tests='no'])
|
||||
AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != "xno"])
|
||||
|
||||
# check for -fvisibility=hidden compiler support (GCC >= 3.4)
|
||||
saved_cflags="$CFLAGS"
|
||||
# -Werror required for cygwin
|
||||
CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
||||
[VISIBILITY_CFLAGS="-fvisibility=hidden"
|
||||
AC_DEFINE([DEFAULT_VISIBILITY], [__attribute__((visibility("default")))], [Default visibility]) ],
|
||||
[ VISIBILITY_CFLAGS=""
|
||||
AC_DEFINE([DEFAULT_VISIBILITY], [], [Default visibility]) ],
|
||||
])
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
# check for -Wno-pointer-sign compiler support (GCC >= 4)
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wno-pointer-sign"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
||||
nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
# sigaction not available on MinGW
|
||||
AC_CHECK_FUNC([sigaction], [have_sigaction=yes], [have_sigaction=no])
|
||||
AM_CONDITIONAL([HAVE_SIGACTION], [test "x$have_sigaction" = "xyes"])
|
||||
|
||||
# headers not available on all platforms but required on others
|
||||
AC_CHECK_HEADERS([sys/time.h])
|
||||
AC_CHECK_FUNCS(gettimeofday)
|
||||
AC_CHECK_HEADERS([signal.h])
|
||||
|
||||
AM_CFLAGS="${AM_CFLAGS} -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow ${THREAD_CFLAGS} ${VISIBILITY_CFLAGS}"
|
||||
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
AC_SUBST(LTLDFLAGS)
|
||||
|
||||
AC_CONFIG_FILES([libusb-1.0.pc])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_FILES([libusb/Makefile])
|
||||
AC_CONFIG_FILES([examples/Makefile])
|
||||
AC_CONFIG_FILES([tests/Makefile])
|
||||
AC_CONFIG_FILES([doc/Makefile])
|
||||
AC_CONFIG_FILES([doc/doxygen.cfg])
|
||||
AC_OUTPUT
|
|
@ -0,0 +1,790 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2012-10-18.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,527 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2011-11-20.07; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libusbx-1.0
|
||||
Description: C API for USB device access from Linux, Mac OS X, Windows and OpenBSD/NetBSD userspace
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lusb-1.0
|
||||
Libs.private: @LIBS@
|
||||
Cflags: -I${includedir}/libusb-1.0
|
|
@ -0,0 +1,68 @@
|
|||
all: libusb-1.0.la libusb-1.0.dll
|
||||
|
||||
lib_LTLIBRARIES = libusb-1.0.la
|
||||
|
||||
POSIX_POLL_SRC = os/poll_posix.c
|
||||
LINUX_USBFS_SRC = os/linux_usbfs.c
|
||||
DARWIN_USB_SRC = os/darwin_usb.c
|
||||
OPENBSD_USB_SRC = os/openbsd_usb.c
|
||||
WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc libusb-1.0.def
|
||||
WINCE_USB_SRC = os/wince_usb.c os/wince_usb.h
|
||||
|
||||
EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
|
||||
$(WINDOWS_USB_SRC) $(WINCE_USB_SRC) \
|
||||
$(POSIX_POLL_SRC) \
|
||||
os/threads_posix.c os/threads_windows.c \
|
||||
os/linux_udev.c os/linux_netlink.c
|
||||
|
||||
if OS_LINUX
|
||||
|
||||
if USE_UDEV
|
||||
OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \
|
||||
os/linux_udev.c
|
||||
else
|
||||
OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \
|
||||
os/linux_netlink.c
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if OS_DARWIN
|
||||
OS_SRC = $(DARWIN_USB_SRC) $(POSIX_POLL_SRC)
|
||||
AM_CFLAGS_EXT = -no-cpp-precomp
|
||||
endif
|
||||
|
||||
if OS_OPENBSD
|
||||
OS_SRC = $(OPENBSD_USB_SRC) $(POSIX_POLL_SRC)
|
||||
endif
|
||||
|
||||
if OS_WINDOWS
|
||||
OS_SRC = $(WINDOWS_USB_SRC)
|
||||
|
||||
.rc.lo:
|
||||
$(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
|
||||
|
||||
libusb-1.0.rc: version.h version_nano.h
|
||||
endif
|
||||
|
||||
libusb-1.0.dll: libusb-1.0.def
|
||||
if CREATE_IMPORT_LIB
|
||||
# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
|
||||
$(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
|
||||
endif
|
||||
|
||||
if THREADS_POSIX
|
||||
THREADS_SRC = os/threads_posix.h os/threads_posix.c
|
||||
else
|
||||
THREADS_SRC = os/threads_windows.h os/threads_windows.c
|
||||
endif
|
||||
|
||||
libusb_1_0_la_CFLAGS = $(AM_CFLAGS)
|
||||
libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
|
||||
libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c strerror.c sync.c \
|
||||
os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h os/windows_common.h \
|
||||
hotplug.h hotplug.c $(THREADS_SRC) $(OS_SRC) \
|
||||
os/poll_posix.h os/poll_windows.h
|
||||
|
||||
hdrdir = $(includedir)/libusb-1.0
|
||||
hdr_HEADERS = libusb.h
|
|
@ -0,0 +1,860 @@
|
|||
# Makefile.in generated by automake 1.13.4 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = libusb
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/depcomp $(hdr_HEADERS)
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/libusb/version.h $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libusb_1_0_la_LIBADD =
|
||||
am__libusb_1_0_la_SOURCES_DIST = libusbi.h core.c descriptor.c io.c \
|
||||
strerror.c sync.c os/linux_usbfs.h os/darwin_usb.h \
|
||||
os/windows_usb.h os/windows_common.h hotplug.h hotplug.c \
|
||||
os/threads_windows.h os/threads_windows.c os/threads_posix.h \
|
||||
os/threads_posix.c os/darwin_usb.c os/poll_posix.c \
|
||||
os/linux_usbfs.c os/linux_netlink.c os/linux_udev.c \
|
||||
os/openbsd_usb.c os/poll_windows.c os/windows_usb.c \
|
||||
libusb-1.0.rc libusb-1.0.def os/poll_posix.h os/poll_windows.h
|
||||
@THREADS_POSIX_FALSE@am__objects_1 = libusb_1_0_la-threads_windows.lo
|
||||
@THREADS_POSIX_TRUE@am__objects_1 = libusb_1_0_la-threads_posix.lo
|
||||
am__objects_2 = libusb_1_0_la-darwin_usb.lo
|
||||
am__objects_3 = libusb_1_0_la-poll_posix.lo
|
||||
am__objects_4 = libusb_1_0_la-linux_usbfs.lo
|
||||
am__objects_5 = libusb_1_0_la-openbsd_usb.lo
|
||||
am__objects_6 = libusb_1_0_la-poll_windows.lo \
|
||||
libusb_1_0_la-windows_usb.lo libusb-1.0.lo
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_FALSE@@OS_WINDOWS_TRUE@am__objects_7 = $(am__objects_6)
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_TRUE@am__objects_7 = $(am__objects_5) \
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_TRUE@ $(am__objects_3)
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_FALSE@am__objects_7 = $(am__objects_4) \
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_FALSE@ $(am__objects_3) \
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_FALSE@ libusb_1_0_la-linux_netlink.lo
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_TRUE@am__objects_7 = $(am__objects_4) \
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_TRUE@ $(am__objects_3) \
|
||||
@OS_DARWIN_FALSE@@OS_LINUX_TRUE@@USE_UDEV_TRUE@ libusb_1_0_la-linux_udev.lo
|
||||
@OS_DARWIN_TRUE@am__objects_7 = $(am__objects_2) $(am__objects_3)
|
||||
am_libusb_1_0_la_OBJECTS = libusb_1_0_la-core.lo \
|
||||
libusb_1_0_la-descriptor.lo libusb_1_0_la-io.lo \
|
||||
libusb_1_0_la-strerror.lo libusb_1_0_la-sync.lo \
|
||||
libusb_1_0_la-hotplug.lo $(am__objects_1) $(am__objects_7)
|
||||
libusb_1_0_la_OBJECTS = $(am_libusb_1_0_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
libusb_1_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libusb_1_0_la_CFLAGS) \
|
||||
$(CFLAGS) $(libusb_1_0_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libusb_1_0_la_SOURCES)
|
||||
DIST_SOURCES = $(am__libusb_1_0_la_SOURCES_DIST)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
HEADERS = $(hdr_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLDFLAGS = @LTLDFLAGS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OS_DARWIN = @OS_DARWIN@
|
||||
OS_LINUX = @OS_LINUX@
|
||||
OS_OPENBSD = @OS_OPENBSD@
|
||||
OS_WINDOWS = @OS_WINDOWS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_UDEV = @USE_UDEV@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
lib_LTLIBRARIES = libusb-1.0.la
|
||||
POSIX_POLL_SRC = os/poll_posix.c
|
||||
LINUX_USBFS_SRC = os/linux_usbfs.c
|
||||
DARWIN_USB_SRC = os/darwin_usb.c
|
||||
OPENBSD_USB_SRC = os/openbsd_usb.c
|
||||
WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc libusb-1.0.def
|
||||
WINCE_USB_SRC = os/wince_usb.c os/wince_usb.h
|
||||
EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
|
||||
$(WINDOWS_USB_SRC) $(WINCE_USB_SRC) \
|
||||
$(POSIX_POLL_SRC) \
|
||||
os/threads_posix.c os/threads_windows.c \
|
||||
os/linux_udev.c os/linux_netlink.c
|
||||
|
||||
@OS_DARWIN_TRUE@OS_SRC = $(DARWIN_USB_SRC) $(POSIX_POLL_SRC)
|
||||
@OS_LINUX_TRUE@@USE_UDEV_FALSE@OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \
|
||||
@OS_LINUX_TRUE@@USE_UDEV_FALSE@ os/linux_netlink.c
|
||||
|
||||
@OS_LINUX_TRUE@@USE_UDEV_TRUE@OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \
|
||||
@OS_LINUX_TRUE@@USE_UDEV_TRUE@ os/linux_udev.c
|
||||
|
||||
@OS_OPENBSD_TRUE@OS_SRC = $(OPENBSD_USB_SRC) $(POSIX_POLL_SRC)
|
||||
@OS_WINDOWS_TRUE@OS_SRC = $(WINDOWS_USB_SRC)
|
||||
@OS_DARWIN_TRUE@AM_CFLAGS_EXT = -no-cpp-precomp
|
||||
@THREADS_POSIX_FALSE@THREADS_SRC = os/threads_windows.h os/threads_windows.c
|
||||
@THREADS_POSIX_TRUE@THREADS_SRC = os/threads_posix.h os/threads_posix.c
|
||||
libusb_1_0_la_CFLAGS = $(AM_CFLAGS)
|
||||
libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
|
||||
libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c strerror.c sync.c \
|
||||
os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h os/windows_common.h \
|
||||
hotplug.h hotplug.c $(THREADS_SRC) $(OS_SRC) \
|
||||
os/poll_posix.h os/poll_windows.h
|
||||
|
||||
hdrdir = $(includedir)/libusb-1.0
|
||||
hdr_HEADERS = libusb.h
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj .rc
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libusb/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu libusb/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libusb-1.0.la: $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_DEPENDENCIES) $(EXTRA_libusb_1_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libusb_1_0_la_LINK) -rpath $(libdir) $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-core.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-darwin_usb.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-descriptor.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-hotplug.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-io.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-linux_netlink.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-linux_udev.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-poll_posix.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-poll_windows.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-sync.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-threads_posix.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-threads_windows.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-windows_usb.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
libusb_1_0_la-core.lo: core.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-core.Tpo $(DEPDIR)/libusb_1_0_la-core.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='core.c' object='libusb_1_0_la-core.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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
|
||||
|
||||
libusb_1_0_la-descriptor.lo: descriptor.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-descriptor.Tpo $(DEPDIR)/libusb_1_0_la-descriptor.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='descriptor.c' object='libusb_1_0_la-descriptor.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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
|
||||
|
||||
libusb_1_0_la-io.lo: io.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-io.Tpo $(DEPDIR)/libusb_1_0_la-io.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='io.c' object='libusb_1_0_la-io.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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
|
||||
|
||||
libusb_1_0_la-strerror.lo: strerror.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-strerror.Tpo $(DEPDIR)/libusb_1_0_la-strerror.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='strerror.c' object='libusb_1_0_la-strerror.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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
|
||||
|
||||
libusb_1_0_la-sync.lo: sync.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-sync.Tpo $(DEPDIR)/libusb_1_0_la-sync.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sync.c' object='libusb_1_0_la-sync.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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
|
||||
|
||||
libusb_1_0_la-hotplug.lo: hotplug.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-hotplug.Tpo $(DEPDIR)/libusb_1_0_la-hotplug.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hotplug.c' object='libusb_1_0_la-hotplug.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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
|
||||
|
||||
libusb_1_0_la-threads_windows.lo: os/threads_windows.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_windows.Tpo $(DEPDIR)/libusb_1_0_la-threads_windows.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/threads_windows.c' object='libusb_1_0_la-threads_windows.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
|
||||
|
||||
libusb_1_0_la-threads_posix.lo: os/threads_posix.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_posix.Tpo $(DEPDIR)/libusb_1_0_la-threads_posix.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/threads_posix.c' object='libusb_1_0_la-threads_posix.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
|
||||
|
||||
libusb_1_0_la-darwin_usb.lo: os/darwin_usb.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo $(DEPDIR)/libusb_1_0_la-darwin_usb.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/darwin_usb.c' object='libusb_1_0_la-darwin_usb.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
|
||||
|
||||
libusb_1_0_la-poll_posix.lo: os/poll_posix.c
|
||||
@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_posix.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-poll_posix.Tpo -c -o libusb_1_0_la-poll_posix.lo `test -f 'os/poll_posix.c' || echo '$(srcdir)/'`os/poll_posix.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-poll_posix.Tpo $(DEPDIR)/libusb_1_0_la-poll_posix.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/poll_posix.c' object='libusb_1_0_la-poll_posix.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-poll_posix.lo `test -f 'os/poll_posix.c' || echo '$(srcdir)/'`os/poll_posix.c
|
||||
|
||||
libusb_1_0_la-linux_usbfs.lo: os/linux_usbfs.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo $(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/linux_usbfs.c' object='libusb_1_0_la-linux_usbfs.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
|
||||
|
||||
libusb_1_0_la-linux_netlink.lo: os/linux_netlink.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_netlink.Tpo $(DEPDIR)/libusb_1_0_la-linux_netlink.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/linux_netlink.c' object='libusb_1_0_la-linux_netlink.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-linux_netlink.lo `test -f 'os/linux_netlink.c' || echo '$(srcdir)/'`os/linux_netlink.c
|
||||
|
||||
libusb_1_0_la-linux_udev.lo: os/linux_udev.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_udev.Tpo $(DEPDIR)/libusb_1_0_la-linux_udev.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/linux_udev.c' object='libusb_1_0_la-linux_udev.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-linux_udev.lo `test -f 'os/linux_udev.c' || echo '$(srcdir)/'`os/linux_udev.c
|
||||
|
||||
libusb_1_0_la-openbsd_usb.lo: os/openbsd_usb.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo $(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/openbsd_usb.c' object='libusb_1_0_la-openbsd_usb.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
|
||||
|
||||
libusb_1_0_la-poll_windows.lo: os/poll_windows.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-poll_windows.Tpo $(DEPDIR)/libusb_1_0_la-poll_windows.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/poll_windows.c' object='libusb_1_0_la-poll_windows.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
|
||||
|
||||
libusb_1_0_la-windows_usb.lo: os/windows_usb.c
|
||||
@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
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-windows_usb.Tpo $(DEPDIR)/libusb_1_0_la-windows_usb.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/windows_usb.c' object='libusb_1_0_la-windows_usb.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@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-windows_usb.lo `test -f 'os/windows_usb.c' || echo '$(srcdir)/'`os/windows_usb.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-hdrHEADERS: $(hdr_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(hdrdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(hdrdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(hdrdir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(hdrdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-hdrHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(hdrdir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-hdrHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-hdrHEADERS uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
|
||||
ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-hdrHEADERS install-html \
|
||||
install-html-am install-info install-info-am \
|
||||
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-hdrHEADERS \
|
||||
uninstall-libLTLIBRARIES
|
||||
|
||||
all: libusb-1.0.la libusb-1.0.dll
|
||||
|
||||
@OS_WINDOWS_TRUE@.rc.lo:
|
||||
@OS_WINDOWS_TRUE@ $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
|
||||
|
||||
@OS_WINDOWS_TRUE@libusb-1.0.rc: version.h version_nano.h
|
||||
|
||||
libusb-1.0.dll: libusb-1.0.def
|
||||
# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
|
||||
@CREATE_IMPORT_LIB_TRUE@ $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,320 @@
|
|||
/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
|
||||
/*
|
||||
* Hotplug functions for libusbx
|
||||
* Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
|
||||
* Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include "libusbi.h"
|
||||
#include "hotplug.h"
|
||||
|
||||
/**
|
||||
* @defgroup hotplug Device hotplug event notification
|
||||
* This page details how to use the libusb hotplug interface, where available.
|
||||
*
|
||||
* Be mindful that not all platforms currently implement hotplug notification and
|
||||
* that you should first call on \ref libusb_has_capability() with parameter
|
||||
* \ref LIBUSB_CAP_HAS_HOTPLUG to confirm that hotplug support is available.
|
||||
*
|
||||
* \page hotplug Device hotplug event notification
|
||||
*
|
||||
* \section intro Introduction
|
||||
*
|
||||
* Version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102, has added support
|
||||
* for hotplug events on <b>some</b> platforms (you should test if your platform
|
||||
* supports hotplug notification by calling \ref libusb_has_capability() with
|
||||
* parameter \ref LIBUSB_CAP_HAS_HOTPLUG).
|
||||
*
|
||||
* This interface allows you to request notification for the arrival and departure
|
||||
* of matching USB devices.
|
||||
*
|
||||
* To receive hotplug notification you register a callback by calling
|
||||
* \ref libusb_hotplug_register_callback(). This function will optionally return
|
||||
* a handle that can be passed to \ref libusb_hotplug_deregister_callback().
|
||||
*
|
||||
* A callback function must return an int (0 or 1) indicating whether the callback is
|
||||
* expecting additional events. Returning 0 will rearm the callback and 1 will cause
|
||||
* the callback to be deregistered.
|
||||
*
|
||||
* Callbacks for a particular context are automatically deregistered by libusb_exit().
|
||||
*
|
||||
* As of 1.0.16 there are two supported hotplug events:
|
||||
* - LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED: A device has arrived and is ready to use
|
||||
* - LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT: A device has left and is no longer available
|
||||
*
|
||||
* A hotplug event can listen for either or both of these events.
|
||||
*
|
||||
* Note: If you receive notification that a device has left and you have any
|
||||
* a libusb_device_handles for the device it is up to you to call libusb_close()
|
||||
* on each handle to free up any remaining resources associated with the device.
|
||||
* Once a device has left any libusb_device_handle associated with the device
|
||||
* are invalid and will remain so even if the device comes back.
|
||||
*
|
||||
* When handling a LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED event it is considered
|
||||
* safe to call any libusbx function that takes a libusb_device. On the other hand,
|
||||
* when handling a LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT event the only safe function
|
||||
* is libusb_get_device_descriptor().
|
||||
*
|
||||
* The following code provides an example of the usage of the hotplug interface:
|
||||
\code
|
||||
static int count = 0;
|
||||
|
||||
int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
|
||||
libusb_hotplug_event event, void *user_data) {
|
||||
static libusb_device_handle *handle = NULL;
|
||||
struct libusb_device_descriptor desc;
|
||||
int rc;
|
||||
|
||||
(void)libusb_get_device_descriptor(dev, &desc);
|
||||
|
||||
if (LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED == event) {
|
||||
rc = libusb_open(dev, &handle);
|
||||
if (LIBUSB_SUCCESS != rc) {
|
||||
printf("Could not open USB device\n");
|
||||
}
|
||||
} else if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event) {
|
||||
if (handle) {
|
||||
libusb_close(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
} else {
|
||||
printf("Unhandled event %d\n", event);
|
||||
}
|
||||
count++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (void) {
|
||||
libusb_hotplug_callback_handle handle;
|
||||
int rc;
|
||||
|
||||
libusb_init(NULL);
|
||||
|
||||
rc = libusb_hotplug_register_callback(NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
|
||||
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, 0x045a, 0x5005,
|
||||
LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, NULL,
|
||||
&handle);
|
||||
if (LIBUSB_SUCCESS != rc) {
|
||||
printf("Error creating a hotplug callback\n");
|
||||
libusb_exit(NULL);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while (count < 2) {
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
libusb_hotplug_deregister_callback(handle);
|
||||
libusb_exit(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
|
||||
static int usbi_hotplug_match_cb (struct libusb_context *ctx,
|
||||
struct libusb_device *dev, libusb_hotplug_event event,
|
||||
struct libusb_hotplug_callback *hotplug_cb)
|
||||
{
|
||||
/* Handle lazy deregistration of callback */
|
||||
if (hotplug_cb->needs_free) {
|
||||
/* Free callback */
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(hotplug_cb->events & event)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->vendor_id &&
|
||||
hotplug_cb->vendor_id != dev->device_descriptor.idVendor) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->product_id &&
|
||||
hotplug_cb->product_id != dev->device_descriptor.idProduct) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->dev_class &&
|
||||
hotplug_cb->dev_class != dev->device_descriptor.bDeviceClass) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return hotplug_cb->cb (ctx == usbi_default_context ? NULL : ctx,
|
||||
dev, event, hotplug_cb->user_data);
|
||||
}
|
||||
|
||||
void usbi_hotplug_match(struct libusb_context *ctx, struct libusb_device *dev,
|
||||
libusb_hotplug_event event)
|
||||
{
|
||||
struct libusb_hotplug_callback *hotplug_cb, *next;
|
||||
int ret;
|
||||
|
||||
usbi_mutex_lock(&ctx->hotplug_cbs_lock);
|
||||
|
||||
list_for_each_entry_safe(hotplug_cb, next, &ctx->hotplug_cbs, list, struct libusb_hotplug_callback) {
|
||||
usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
|
||||
ret = usbi_hotplug_match_cb (ctx, dev, event, hotplug_cb);
|
||||
usbi_mutex_lock(&ctx->hotplug_cbs_lock);
|
||||
|
||||
if (ret) {
|
||||
list_del(&hotplug_cb->list);
|
||||
free(hotplug_cb);
|
||||
}
|
||||
}
|
||||
|
||||
usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
|
||||
|
||||
/* loop through and disconnect all open handles for this device */
|
||||
if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event) {
|
||||
struct libusb_device_handle *handle;
|
||||
|
||||
usbi_mutex_lock(&ctx->open_devs_lock);
|
||||
list_for_each_entry(handle, &ctx->open_devs, list, struct libusb_device_handle) {
|
||||
if (dev == handle->dev) {
|
||||
usbi_handle_disconnect (handle);
|
||||
}
|
||||
}
|
||||
usbi_mutex_unlock(&ctx->open_devs_lock);
|
||||
}
|
||||
}
|
||||
|
||||
int API_EXPORTED libusb_hotplug_register_callback(libusb_context *ctx,
|
||||
libusb_hotplug_event events, libusb_hotplug_flag flags,
|
||||
int vendor_id, int product_id, int dev_class,
|
||||
libusb_hotplug_callback_fn cb_fn, void *user_data,
|
||||
libusb_hotplug_callback_handle *handle)
|
||||
{
|
||||
libusb_hotplug_callback *new_callback;
|
||||
static int handle_id = 1;
|
||||
|
||||
/* check for hotplug support */
|
||||
if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
|
||||
return LIBUSB_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* check for sane values */
|
||||
if ((LIBUSB_HOTPLUG_MATCH_ANY != vendor_id && (~0xffff & vendor_id)) ||
|
||||
(LIBUSB_HOTPLUG_MATCH_ANY != product_id && (~0xffff & product_id)) ||
|
||||
(LIBUSB_HOTPLUG_MATCH_ANY != dev_class && (~0xff & dev_class)) ||
|
||||
!cb_fn) {
|
||||
return LIBUSB_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
USBI_GET_CONTEXT(ctx);
|
||||
|
||||
new_callback = (libusb_hotplug_callback *)calloc(1, sizeof (*new_callback));
|
||||
if (!new_callback) {
|
||||
return LIBUSB_ERROR_NO_MEM;
|
||||
}
|
||||
|
||||
new_callback->ctx = ctx;
|
||||
new_callback->vendor_id = vendor_id;
|
||||
new_callback->product_id = product_id;
|
||||
new_callback->dev_class = dev_class;
|
||||
new_callback->flags = flags;
|
||||
new_callback->events = events;
|
||||
new_callback->cb = cb_fn;
|
||||
new_callback->user_data = user_data;
|
||||
new_callback->needs_free = 0;
|
||||
|
||||
usbi_mutex_lock(&ctx->hotplug_cbs_lock);
|
||||
|
||||
/* protect the handle by the context hotplug lock. it doesn't matter if the same handle
|
||||
* is used for different contexts only that the handle is unique for this context */
|
||||
new_callback->handle = handle_id++;
|
||||
|
||||
list_add(&new_callback->list, &ctx->hotplug_cbs);
|
||||
|
||||
if (flags & LIBUSB_HOTPLUG_ENUMERATE) {
|
||||
struct libusb_device *dev;
|
||||
|
||||
usbi_mutex_lock(&ctx->usb_devs_lock);
|
||||
|
||||
list_for_each_entry(dev, &ctx->usb_devs, list, struct libusb_device) {
|
||||
(void) usbi_hotplug_match_cb (ctx, dev, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, new_callback);
|
||||
}
|
||||
|
||||
usbi_mutex_unlock(&ctx->usb_devs_lock);
|
||||
}
|
||||
|
||||
usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
|
||||
|
||||
if (handle) {
|
||||
*handle = new_callback->handle;
|
||||
}
|
||||
|
||||
return LIBUSB_SUCCESS;
|
||||
}
|
||||
|
||||
void API_EXPORTED libusb_hotplug_deregister_callback (struct libusb_context *ctx,
|
||||
libusb_hotplug_callback_handle handle)
|
||||
{
|
||||
struct libusb_hotplug_callback *hotplug_cb;
|
||||
libusb_hotplug_message message;
|
||||
ssize_t ret;
|
||||
|
||||
/* check for hotplug support */
|
||||
if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
|
||||
return;
|
||||
}
|
||||
|
||||
USBI_GET_CONTEXT(ctx);
|
||||
|
||||
usbi_mutex_lock(&ctx->hotplug_cbs_lock);
|
||||
list_for_each_entry(hotplug_cb, &ctx->hotplug_cbs, list,
|
||||
struct libusb_hotplug_callback) {
|
||||
if (handle == hotplug_cb->handle) {
|
||||
/* Mark this callback for deregistration */
|
||||
hotplug_cb->needs_free = 1;
|
||||
}
|
||||
}
|
||||
usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
|
||||
|
||||
/* wakeup handle_events to do the actual free */
|
||||
memset(&message, 0, sizeof(message));
|
||||
ret = usbi_write(ctx->hotplug_pipe[1], &message, sizeof(message));
|
||||
if (sizeof(message) != ret) {
|
||||
usbi_err(ctx, "error writing hotplug message");
|
||||
}
|
||||
}
|
||||
|
||||
void usbi_hotplug_deregister_all(struct libusb_context *ctx) {
|
||||
struct libusb_hotplug_callback *hotplug_cb, *next;
|
||||
|
||||
usbi_mutex_lock(&ctx->hotplug_cbs_lock);
|
||||
list_for_each_entry_safe(hotplug_cb, next, &ctx->hotplug_cbs, list,
|
||||
struct libusb_hotplug_callback) {
|
||||
list_del(&hotplug_cb->list);
|
||||
free(hotplug_cb);
|
||||
}
|
||||
|
||||
usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
|
||||
/*
|
||||
* Hotplug support for libusbx
|
||||
* Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
|
||||
* Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(USBI_HOTPLUG_H)
|
||||
#define USBI_HOTPLUG_H
|
||||
|
||||
#ifndef LIBUSBI_H
|
||||
#include "libusbi.h"
|
||||
#endif
|
||||
|
||||
/** \ingroup hotplug
|
||||
* The hotplug callback structure. The user populates this structure with
|
||||
* libusb_hotplug_prepare_callback() and then calls libusb_hotplug_register_callback()
|
||||
* to receive notification of hotplug events.
|
||||
*/
|
||||
struct libusb_hotplug_callback {
|
||||
/** Context this callback is associated with */
|
||||
struct libusb_context *ctx;
|
||||
|
||||
/** Vendor ID to match or LIBUSB_HOTPLUG_MATCH_ANY */
|
||||
int vendor_id;
|
||||
|
||||
/** Product ID to match or LIBUSB_HOTPLUG_MATCH_ANY */
|
||||
int product_id;
|
||||
|
||||
/** Device class to match or LIBUSB_HOTPLUG_MATCH_ANY */
|
||||
int dev_class;
|
||||
|
||||
/** Hotplug callback flags */
|
||||
libusb_hotplug_flag flags;
|
||||
|
||||
/** Event(s) that will trigger this callback */
|
||||
libusb_hotplug_event events;
|
||||
|
||||
/** Callback function to invoke for matching event/device */
|
||||
libusb_hotplug_callback_fn cb;
|
||||
|
||||
/** Handle for this callback (used to match on deregister) */
|
||||
libusb_hotplug_callback_handle handle;
|
||||
|
||||
/** User data that will be passed to the callback function */
|
||||
void *user_data;
|
||||
|
||||
/** Callback is marked for deletion */
|
||||
int needs_free;
|
||||
|
||||
/** List this callback is registered in (ctx->hotplug_cbs) */
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
typedef struct libusb_hotplug_callback libusb_hotplug_callback;
|
||||
|
||||
struct libusb_hotplug_message {
|
||||
libusb_hotplug_event event;
|
||||
struct libusb_device *device;
|
||||
};
|
||||
|
||||
typedef struct libusb_hotplug_message libusb_hotplug_message;
|
||||
|
||||
void usbi_hotplug_deregister_all(struct libusb_context *ctx);
|
||||
void usbi_hotplug_match(struct libusb_context *ctx, struct libusb_device *dev,
|
||||
libusb_hotplug_event event);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,158 @@
|
|||
LIBRARY "libusb-1.0.dll"
|
||||
EXPORTS
|
||||
libusb_alloc_transfer
|
||||
libusb_alloc_transfer@4 = libusb_alloc_transfer
|
||||
libusb_attach_kernel_driver
|
||||
libusb_attach_kernel_driver@8 = libusb_attach_kernel_driver
|
||||
libusb_bulk_transfer
|
||||
libusb_bulk_transfer@24 = libusb_bulk_transfer
|
||||
libusb_cancel_transfer
|
||||
libusb_cancel_transfer@4 = libusb_cancel_transfer
|
||||
libusb_claim_interface
|
||||
libusb_claim_interface@8 = libusb_claim_interface
|
||||
libusb_clear_halt
|
||||
libusb_clear_halt@8 = libusb_clear_halt
|
||||
libusb_close
|
||||
libusb_close@4 = libusb_close
|
||||
libusb_control_transfer
|
||||
libusb_control_transfer@32 = libusb_control_transfer
|
||||
libusb_detach_kernel_driver
|
||||
libusb_detach_kernel_driver@8 = libusb_detach_kernel_driver
|
||||
libusb_error_name
|
||||
libusb_error_name@4 = libusb_error_name
|
||||
libusb_event_handler_active
|
||||
libusb_event_handler_active@4 = libusb_event_handler_active
|
||||
libusb_event_handling_ok
|
||||
libusb_event_handling_ok@4 = libusb_event_handling_ok
|
||||
libusb_exit
|
||||
libusb_exit@4 = libusb_exit
|
||||
libusb_free_bos_descriptor
|
||||
libusb_free_bos_descriptor@4 = libusb_free_bos_descriptor
|
||||
libusb_free_config_descriptor
|
||||
libusb_free_config_descriptor@4 = libusb_free_config_descriptor
|
||||
libusb_free_container_id_descriptor
|
||||
libusb_free_container_id_descriptor@4 = libusb_free_container_id_descriptor
|
||||
libusb_free_device_list
|
||||
libusb_free_device_list@8 = libusb_free_device_list
|
||||
libusb_free_ss_endpoint_companion_descriptor
|
||||
libusb_free_ss_endpoint_companion_descriptor@4 = libusb_free_ss_endpoint_companion_descriptor
|
||||
libusb_free_ss_usb_device_capability_descriptor
|
||||
libusb_free_ss_usb_device_capability_descriptor@4 = libusb_free_ss_usb_device_capability_descriptor
|
||||
libusb_free_transfer
|
||||
libusb_free_transfer@4 = libusb_free_transfer
|
||||
libusb_free_usb_2_0_extension_descriptor
|
||||
libusb_free_usb_2_0_extension_descriptor@4 = libusb_free_usb_2_0_extension_descriptor
|
||||
libusb_get_active_config_descriptor
|
||||
libusb_get_active_config_descriptor@8 = libusb_get_active_config_descriptor
|
||||
libusb_get_bos_descriptor
|
||||
libusb_get_bos_descriptor@8 = libusb_get_bos_descriptor
|
||||
libusb_get_bus_number
|
||||
libusb_get_bus_number@4 = libusb_get_bus_number
|
||||
libusb_get_config_descriptor
|
||||
libusb_get_config_descriptor@12 = libusb_get_config_descriptor
|
||||
libusb_get_config_descriptor_by_value
|
||||
libusb_get_config_descriptor_by_value@12 = libusb_get_config_descriptor_by_value
|
||||
libusb_get_configuration
|
||||
libusb_get_configuration@8 = libusb_get_configuration
|
||||
libusb_get_container_id_descriptor
|
||||
libusb_get_container_id_descriptor@12 = libusb_get_container_id_descriptor
|
||||
libusb_get_device
|
||||
libusb_get_device@4 = libusb_get_device
|
||||
libusb_get_device_address
|
||||
libusb_get_device_address@4 = libusb_get_device_address
|
||||
libusb_get_device_descriptor
|
||||
libusb_get_device_descriptor@8 = libusb_get_device_descriptor
|
||||
libusb_get_device_list
|
||||
libusb_get_device_list@8 = libusb_get_device_list
|
||||
libusb_get_device_speed
|
||||
libusb_get_device_speed@4 = libusb_get_device_speed
|
||||
libusb_get_max_iso_packet_size
|
||||
libusb_get_max_iso_packet_size@8 = libusb_get_max_iso_packet_size
|
||||
libusb_get_max_packet_size
|
||||
libusb_get_max_packet_size@8 = libusb_get_max_packet_size
|
||||
libusb_get_next_timeout
|
||||
libusb_get_next_timeout@8 = libusb_get_next_timeout
|
||||
libusb_get_parent
|
||||
libusb_get_parent@4 = libusb_get_parent
|
||||
libusb_get_pollfds
|
||||
libusb_get_pollfds@4 = libusb_get_pollfds
|
||||
libusb_get_port_number
|
||||
libusb_get_port_number@4 = libusb_get_port_number
|
||||
libusb_get_port_numbers
|
||||
libusb_get_port_numbers@12 = libusb_get_port_numbers
|
||||
libusb_get_port_path
|
||||
libusb_get_port_path@16 = libusb_get_port_path
|
||||
libusb_get_ss_endpoint_companion_descriptor
|
||||
libusb_get_ss_endpoint_companion_descriptor@12 = libusb_get_ss_endpoint_companion_descriptor
|
||||
libusb_get_ss_usb_device_capability_descriptor
|
||||
libusb_get_ss_usb_device_capability_descriptor@12 = libusb_get_ss_usb_device_capability_descriptor
|
||||
libusb_get_string_descriptor_ascii
|
||||
libusb_get_string_descriptor_ascii@16 = libusb_get_string_descriptor_ascii
|
||||
libusb_get_usb_2_0_extension_descriptor
|
||||
libusb_get_usb_2_0_extension_descriptor@12 = libusb_get_usb_2_0_extension_descriptor
|
||||
libusb_get_version
|
||||
libusb_get_version@0 = libusb_get_version
|
||||
libusb_handle_events
|
||||
libusb_handle_events@4 = libusb_handle_events
|
||||
libusb_handle_events_completed
|
||||
libusb_handle_events_completed@8 = libusb_handle_events_completed
|
||||
libusb_handle_events_locked
|
||||
libusb_handle_events_locked@8 = libusb_handle_events_locked
|
||||
libusb_handle_events_timeout
|
||||
libusb_handle_events_timeout@8 = libusb_handle_events_timeout
|
||||
libusb_handle_events_timeout_completed
|
||||
libusb_handle_events_timeout_completed@12 = libusb_handle_events_timeout_completed
|
||||
libusb_has_capability
|
||||
libusb_has_capability@4 = libusb_has_capability
|
||||
libusb_hotplug_deregister_callback
|
||||
libusb_hotplug_deregister_callback@8 = libusb_hotplug_deregister_callback
|
||||
libusb_hotplug_register_callback
|
||||
libusb_hotplug_register_callback@36 = libusb_hotplug_register_callback
|
||||
libusb_init
|
||||
libusb_init@4 = libusb_init
|
||||
libusb_interrupt_transfer
|
||||
libusb_interrupt_transfer@24 = libusb_interrupt_transfer
|
||||
libusb_kernel_driver_active
|
||||
libusb_kernel_driver_active@8 = libusb_kernel_driver_active
|
||||
libusb_lock_event_waiters
|
||||
libusb_lock_event_waiters@4 = libusb_lock_event_waiters
|
||||
libusb_lock_events
|
||||
libusb_lock_events@4 = libusb_lock_events
|
||||
libusb_open
|
||||
libusb_open@8 = libusb_open
|
||||
libusb_open_device_with_vid_pid
|
||||
libusb_open_device_with_vid_pid@12 = libusb_open_device_with_vid_pid
|
||||
libusb_pollfds_handle_timeouts
|
||||
libusb_pollfds_handle_timeouts@4 = libusb_pollfds_handle_timeouts
|
||||
libusb_ref_device
|
||||
libusb_ref_device@4 = libusb_ref_device
|
||||
libusb_release_interface
|
||||
libusb_release_interface@8 = libusb_release_interface
|
||||
libusb_reset_device
|
||||
libusb_reset_device@4 = libusb_reset_device
|
||||
libusb_set_auto_detach_kernel_driver
|
||||
libusb_set_auto_detach_kernel_driver@8 = libusb_set_auto_detach_kernel_driver
|
||||
libusb_set_configuration
|
||||
libusb_set_configuration@8 = libusb_set_configuration
|
||||
libusb_set_debug
|
||||
libusb_set_debug@8 = libusb_set_debug
|
||||
libusb_set_interface_alt_setting
|
||||
libusb_set_interface_alt_setting@12 = libusb_set_interface_alt_setting
|
||||
libusb_set_pollfd_notifiers
|
||||
libusb_set_pollfd_notifiers@16 = libusb_set_pollfd_notifiers
|
||||
libusb_setlocale
|
||||
libusb_setlocale@4 = libusb_setlocale
|
||||
libusb_strerror
|
||||
libusb_strerror@4 = libusb_strerror
|
||||
libusb_submit_transfer
|
||||
libusb_submit_transfer@4 = libusb_submit_transfer
|
||||
libusb_try_lock_events
|
||||
libusb_try_lock_events@4 = libusb_try_lock_events
|
||||
libusb_unlock_event_waiters
|
||||
libusb_unlock_event_waiters@4 = libusb_unlock_event_waiters
|
||||
libusb_unlock_events
|
||||
libusb_unlock_events@4 = libusb_unlock_events
|
||||
libusb_unref_device
|
||||
libusb_unref_device@4 = libusb_unref_device
|
||||
libusb_wait_for_event
|
||||
libusb_wait_for_event@8 = libusb_wait_for_event
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* For Windows: input this file to the Resoure Compiler to produce a binary
|
||||
* .res file. This is then embedded in the resultant library (like any other
|
||||
* compilation object).
|
||||
* The information can then be queried using standard APIs and can also be
|
||||
* viewed with utilities such as Windows Explorer.
|
||||
*/
|
||||
#ifndef _WIN32_WCE
|
||||
#include "winresrc.h"
|
||||
#endif
|
||||
|
||||
#include "version.h"
|
||||
#ifndef LIBUSB_VERSIONSTRING
|
||||
#define LU_STR(s) #s
|
||||
#define LU_XSTR(s) LU_STR(s)
|
||||
#if LIBUSB_NANO > 0
|
||||
#define LIBUSB_VERSIONSTRING \
|
||||
LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \
|
||||
LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0"
|
||||
#else
|
||||
#define LIBUSB_VERSIONSTRING \
|
||||
LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \
|
||||
LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO
|
||||
PRODUCTVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "libusbx.org\0"
|
||||
VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0"
|
||||
VALUE "FileVersion", LIBUSB_VERSIONSTRING
|
||||
VALUE "InternalName", "libusb\0"
|
||||
VALUE "LegalCopyright", "See individual source files, GNU LGPL v2.1 or later.\0"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/licenses/lgpl-2.1.html\0"
|
||||
VALUE "OriginalFilename", "libusb-1.0.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "libusb-1.0\0"
|
||||
VALUE "ProductVersion", LIBUSB_VERSIONSTRING
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
|
@ -1,7 +1,10 @@
|
|||
/*
|
||||
* Public libusb header file
|
||||
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Public libusbx header file
|
||||
* Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright © 2012 Pete Batard <pete@akeo.ie>
|
||||
* Copyright © 2012 Nathan Hjelm <hjelmn@cs.unm.edu>
|
||||
* For more information, please visit: http://libusbx.org
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -23,7 +26,7 @@
|
|||
|
||||
#ifdef _MSC_VER
|
||||
/* on MS environments, the inline keyword is available in C++ only */
|
||||
#if !defined(inline)
|
||||
#if !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
#endif
|
||||
/* ssize_t is also not available (copy/paste from MinGW) */
|
||||
|
@ -38,7 +41,7 @@
|
|||
#endif /* _SSIZE_T_DEFINED */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* stdint.h is also not usually available on MS */
|
||||
/* stdint.h is not available on older MSVC */
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
|
@ -47,36 +50,49 @@ typedef unsigned __int32 uint32_t;
|
|||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32_WCE)
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* 'interface' might be defined as a macro on Windows, so we need to
|
||||
* undefine it so as not to break the current libusb API, because
|
||||
* undefine it so as not to break the current libusbx API, because
|
||||
* libusb_config_descriptor has an 'interface' member
|
||||
* As this can be problematic if you include windows.h after libusb.h
|
||||
* in your sources, we force windows.h to be included first. */
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
|
||||
#include <windows.h>
|
||||
#if defined(interface)
|
||||
#undef interface
|
||||
#endif
|
||||
#if !defined(__CYGWIN__)
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
#define LIBUSB_DEPRECATED_FOR(f) \
|
||||
__attribute__((deprecated("Use " #f " instead")))
|
||||
#else
|
||||
#define LIBUSB_DEPRECATED_FOR(f)
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/** \def LIBUSB_CALL
|
||||
* \ingroup misc
|
||||
* libusb's Windows calling convention.
|
||||
* libusbx's Windows calling convention.
|
||||
*
|
||||
* Under Windows, the selection of available compilers and configurations
|
||||
* means that, unlike other platforms, there is not <em>one true calling
|
||||
* convention</em> (calling convention: the manner in which parameters are
|
||||
* passed to funcions in the generated assembly code).
|
||||
*
|
||||
* Matching the Windows API itself, libusb uses the WINAPI convention (which
|
||||
* Matching the Windows API itself, libusbx uses the WINAPI convention (which
|
||||
* translates to the <tt>stdcall</tt> convention) and guarantees that the
|
||||
* library is compiled in this way. The public header file also includes
|
||||
* appropriate annotations so that your own software will use the right
|
||||
|
@ -84,7 +100,7 @@ typedef unsigned __int32 uint32_t;
|
|||
* your codebase.
|
||||
*
|
||||
* The one consideration that you must apply in your software is to mark
|
||||
* all functions which you use as libusb callbacks with this LIBUSB_CALL
|
||||
* all functions which you use as libusbx callbacks with this LIBUSB_CALL
|
||||
* annotation, so that they too get compiled for the correct calling
|
||||
* convention.
|
||||
*
|
||||
|
@ -92,19 +108,44 @@ typedef unsigned __int32 uint32_t;
|
|||
* means that you can apply it to your code without worrying about
|
||||
* cross-platform compatibility.
|
||||
*/
|
||||
/* LIBUSB_CALL must be defined on both definition and declaration of libusb
|
||||
/* LIBUSB_CALL must be defined on both definition and declaration of libusbx
|
||||
* functions. You'd think that declaration would be enough, but cygwin will
|
||||
* complain about conflicting types unless both are marked this way.
|
||||
* The placement of this macro is important too; it must appear after the
|
||||
* return type, before the function name. See internal documentation for
|
||||
* API_EXPORTED.
|
||||
*/
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
|
||||
#define LIBUSB_CALL WINAPI
|
||||
#else
|
||||
#define LIBUSB_CALL
|
||||
#endif
|
||||
|
||||
/** \def LIBUSBX_API_VERSION
|
||||
* \ingroup misc
|
||||
* libusbx's API version.
|
||||
*
|
||||
* Since version 1.0.13, to help with feature detection, libusbx defines
|
||||
* a LIBUSBX_API_VERSION macro that gets increased every time there is a
|
||||
* significant change to the API, such as the introduction of a new call,
|
||||
* the definition of a new macro/enum member, or any other element that
|
||||
* libusbx applications may want to detect at compilation time.
|
||||
*
|
||||
* The macro is typically used in an application as follows:
|
||||
* \code
|
||||
* #if defined(LIBUSBX_API_VERSION) && (LIBUSBX_API_VERSION >= 0x01001234)
|
||||
* // Use one of the newer features from the libusbx API
|
||||
* #endif
|
||||
* \endcode
|
||||
*
|
||||
* Another feature of LIBUSBX_API_VERSION is that it can be used to detect
|
||||
* whether you are compiling against the libusb or the libusbx library.
|
||||
*
|
||||
* Internally, LIBUSBX_API_VERSION is defined as follows:
|
||||
* (libusbx major << 24) | (libusbx minor << 16) | (16 bit incremental)
|
||||
*/
|
||||
#define LIBUSBX_API_VERSION 0x01000102
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -123,8 +164,8 @@ static inline uint16_t libusb_cpu_to_le16(const uint16_t x)
|
|||
uint8_t b8[2];
|
||||
uint16_t b16;
|
||||
} _tmp;
|
||||
_tmp.b8[1] = x >> 8;
|
||||
_tmp.b8[0] = x & 0xff;
|
||||
_tmp.b8[1] = (uint8_t) (x >> 8);
|
||||
_tmp.b8[0] = (uint8_t) (x & 0xff);
|
||||
return _tmp.b16;
|
||||
}
|
||||
|
||||
|
@ -220,6 +261,12 @@ enum libusb_descriptor_type {
|
|||
/** Endpoint descriptor. See libusb_endpoint_descriptor. */
|
||||
LIBUSB_DT_ENDPOINT = 0x05,
|
||||
|
||||
/** BOS descriptor */
|
||||
LIBUSB_DT_BOS = 0x0f,
|
||||
|
||||
/** Device Capability descriptor */
|
||||
LIBUSB_DT_DEVICE_CAPABILITY = 0x10,
|
||||
|
||||
/** HID descriptor */
|
||||
LIBUSB_DT_HID = 0x21,
|
||||
|
||||
|
@ -231,15 +278,35 @@ enum libusb_descriptor_type {
|
|||
|
||||
/** Hub descriptor */
|
||||
LIBUSB_DT_HUB = 0x29,
|
||||
|
||||
/** SuperSpeed Hub descriptor */
|
||||
LIBUSB_DT_SUPERSPEED_HUB = 0x2a,
|
||||
|
||||
/** SuperSpeed Endpoint Companion descriptor */
|
||||
LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30
|
||||
};
|
||||
|
||||
/* Descriptor sizes per descriptor type */
|
||||
#define LIBUSB_DT_DEVICE_SIZE 18
|
||||
#define LIBUSB_DT_CONFIG_SIZE 9
|
||||
#define LIBUSB_DT_INTERFACE_SIZE 9
|
||||
#define LIBUSB_DT_ENDPOINT_SIZE 7
|
||||
#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
|
||||
#define LIBUSB_DT_ENDPOINT_SIZE 7
|
||||
#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
|
||||
#define LIBUSB_DT_HUB_NONVAR_SIZE 7
|
||||
#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
|
||||
#define LIBUSB_DT_BOS_SIZE 5
|
||||
#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
|
||||
|
||||
/* BOS descriptor sizes */
|
||||
#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
|
||||
#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
|
||||
#define LIBUSB_BT_CONTAINER_ID_SIZE 20
|
||||
|
||||
/* We unwrap the BOS => define its max size */
|
||||
#define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\
|
||||
(LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\
|
||||
(LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\
|
||||
(LIBUSB_BT_CONTAINER_ID_SIZE))
|
||||
|
||||
#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
|
||||
#define LIBUSB_ENDPOINT_DIR_MASK 0x80
|
||||
|
@ -277,7 +344,7 @@ enum libusb_transfer_type {
|
|||
};
|
||||
|
||||
/** \ingroup misc
|
||||
* Standard requests, as defined in table 9-3 of the USB2 specifications */
|
||||
* Standard requests, as defined in table 9-5 of the USB 3.0 specifications */
|
||||
enum libusb_standard_request {
|
||||
/** Request status of the specific recipient */
|
||||
LIBUSB_REQUEST_GET_STATUS = 0x00,
|
||||
|
@ -315,6 +382,13 @@ enum libusb_standard_request {
|
|||
|
||||
/** Set then report an endpoint's synchronization frame */
|
||||
LIBUSB_REQUEST_SYNCH_FRAME = 0x0C,
|
||||
|
||||
/** Sets both the U1 and U2 Exit Latency */
|
||||
LIBUSB_REQUEST_SET_SEL = 0x30,
|
||||
|
||||
/** Delay from the time a host transmits a packet to the time it is
|
||||
* received by the device. */
|
||||
LIBUSB_SET_ISOCH_DELAY = 0x31,
|
||||
};
|
||||
|
||||
/** \ingroup misc
|
||||
|
@ -394,7 +468,7 @@ enum libusb_iso_usage_type {
|
|||
|
||||
/** \ingroup desc
|
||||
* A structure representing the standard USB device descriptor. This
|
||||
* descriptor is documented in section 9.6.1 of the USB 2.0 specification.
|
||||
* descriptor is documented in section 9.6.1 of the USB 3.0 specification.
|
||||
* All multiple-byte fields are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_device_descriptor {
|
||||
|
@ -448,7 +522,7 @@ struct libusb_device_descriptor {
|
|||
|
||||
/** \ingroup desc
|
||||
* A structure representing the standard USB endpoint descriptor. This
|
||||
* descriptor is documented in section 9.6.3 of the USB 2.0 specification.
|
||||
* descriptor is documented in section 9.6.6 of the USB 3.0 specification.
|
||||
* All multiple-byte fields are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_endpoint_descriptor {
|
||||
|
@ -488,7 +562,7 @@ struct libusb_endpoint_descriptor {
|
|||
/** For audio devices only: the address if the synch endpoint */
|
||||
uint8_t bSynchAddress;
|
||||
|
||||
/** Extra descriptors. If libusb encounters unknown endpoint descriptors,
|
||||
/** Extra descriptors. If libusbx encounters unknown endpoint descriptors,
|
||||
* it will store them here, should you wish to parse them. */
|
||||
const unsigned char *extra;
|
||||
|
||||
|
@ -498,7 +572,7 @@ struct libusb_endpoint_descriptor {
|
|||
|
||||
/** \ingroup desc
|
||||
* A structure representing the standard USB interface descriptor. This
|
||||
* descriptor is documented in section 9.6.5 of the USB 2.0 specification.
|
||||
* descriptor is documented in section 9.6.5 of the USB 3.0 specification.
|
||||
* All multiple-byte fields are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_interface_descriptor {
|
||||
|
@ -538,7 +612,7 @@ struct libusb_interface_descriptor {
|
|||
* by the bNumEndpoints field. */
|
||||
const struct libusb_endpoint_descriptor *endpoint;
|
||||
|
||||
/** Extra descriptors. If libusb encounters unknown interface descriptors,
|
||||
/** Extra descriptors. If libusbx encounters unknown interface descriptors,
|
||||
* it will store them here, should you wish to parse them. */
|
||||
const unsigned char *extra;
|
||||
|
||||
|
@ -560,7 +634,7 @@ struct libusb_interface {
|
|||
|
||||
/** \ingroup desc
|
||||
* A structure representing the standard USB configuration descriptor. This
|
||||
* descriptor is documented in section 9.6.3 of the USB 2.0 specification.
|
||||
* descriptor is documented in section 9.6.3 of the USB 3.0 specification.
|
||||
* All multiple-byte fields are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_config_descriptor {
|
||||
|
@ -596,7 +670,7 @@ struct libusb_config_descriptor {
|
|||
* this array is determined by the bNumInterfaces field. */
|
||||
const struct libusb_interface *interface;
|
||||
|
||||
/** Extra descriptors. If libusb encounters unknown configuration
|
||||
/** Extra descriptors. If libusbx encounters unknown configuration
|
||||
* descriptors, it will store them here, should you wish to parse them. */
|
||||
const unsigned char *extra;
|
||||
|
||||
|
@ -604,6 +678,187 @@ struct libusb_config_descriptor {
|
|||
int extra_length;
|
||||
};
|
||||
|
||||
/** \ingroup desc
|
||||
* A structure representing the superspeed endpoint companion
|
||||
* descriptor. This descriptor is documented in section 9.6.7 of
|
||||
* the USB 3.0 specification. All multiple-byte fields are represented in
|
||||
* host-endian format.
|
||||
*/
|
||||
struct libusb_ss_endpoint_companion_descriptor {
|
||||
|
||||
/** Size of this descriptor (in bytes) */
|
||||
uint8_t bLength;
|
||||
|
||||
/** Descriptor type. Will have value
|
||||
* \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in
|
||||
* this context. */
|
||||
uint8_t bDescriptorType;
|
||||
|
||||
|
||||
/** The maximum number of packets the endpoint can send or
|
||||
* recieve as part of a burst. */
|
||||
uint8_t bMaxBurst;
|
||||
|
||||
/** In bulk EP: bits 4:0 represents the maximum number of
|
||||
* streams the EP supports. In isochronous EP: bits 1:0
|
||||
* represents the Mult - a zero based value that determines
|
||||
* the maximum number of packets within a service interval */
|
||||
uint8_t bmAttributes;
|
||||
|
||||
/** The total number of bytes this EP will transfer every
|
||||
* service interval. valid only for periodic EPs. */
|
||||
uint16_t wBytesPerInterval;
|
||||
};
|
||||
|
||||
/** \ingroup desc
|
||||
* A generic representation of a BOS Device Capability descriptor. It is
|
||||
* advised to check bDevCapabilityType and call the matching
|
||||
* libusb_get_*_descriptor function to get a structure fully matching the type.
|
||||
*/
|
||||
struct libusb_bos_dev_capability_descriptor {
|
||||
/** Size of this descriptor (in bytes) */
|
||||
uint8_t bLength;
|
||||
/** Descriptor type. Will have value
|
||||
* \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
|
||||
* LIBUSB_DT_DEVICE_CAPABILITY in this context. */
|
||||
uint8_t bDescriptorType;
|
||||
/** Device Capability type */
|
||||
uint8_t bDevCapabilityType;
|
||||
/** Device Capability data (bLength - 3 bytes) */
|
||||
uint8_t dev_capability_data
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
[] /* valid C99 code */
|
||||
#else
|
||||
[0] /* non-standard, but usually working code */
|
||||
#endif
|
||||
;
|
||||
};
|
||||
|
||||
/** \ingroup desc
|
||||
* A structure representing the Binary Device Object Store (BOS) descriptor.
|
||||
* This descriptor is documented in section 9.6.2 of the USB 3.0 specification.
|
||||
* All multiple-byte fields are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_bos_descriptor {
|
||||
/** Size of this descriptor (in bytes) */
|
||||
uint8_t bLength;
|
||||
|
||||
/** Descriptor type. Will have value
|
||||
* \ref libusb_descriptor_type::LIBUSB_DT_BOS LIBUSB_DT_BOS
|
||||
* in this context. */
|
||||
uint8_t bDescriptorType;
|
||||
|
||||
/** Length of this descriptor and all of its sub descriptors */
|
||||
uint16_t wTotalLength;
|
||||
|
||||
/** The number of separate device capability descriptors in
|
||||
* the BOS */
|
||||
uint8_t bNumDeviceCaps;
|
||||
|
||||
/** bNumDeviceCap Device Capability Descriptors */
|
||||
struct libusb_bos_dev_capability_descriptor *dev_capability
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
[] /* valid C99 code */
|
||||
#else
|
||||
[0] /* non-standard, but usually working code */
|
||||
#endif
|
||||
;
|
||||
};
|
||||
|
||||
/** \ingroup desc
|
||||
* A structure representing the USB 2.0 Extension descriptor
|
||||
* This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification.
|
||||
* All multiple-byte fields are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_usb_2_0_extension_descriptor {
|
||||
/** Size of this descriptor (in bytes) */
|
||||
uint8_t bLength;
|
||||
|
||||
/** Descriptor type. Will have value
|
||||
* \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
|
||||
* LIBUSB_DT_DEVICE_CAPABILITY in this context. */
|
||||
uint8_t bDescriptorType;
|
||||
|
||||
/** Capability type. Will have value
|
||||
* \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION
|
||||
* LIBUSB_BT_USB_2_0_EXTENSION in this context. */
|
||||
uint8_t bDevCapabilityType;
|
||||
|
||||
/** Bitmap encoding of supported device level features.
|
||||
* A value of one in a bit location indicates a feature is
|
||||
* supported; a value of zero indicates it is not supported.
|
||||
* See \ref libusb_usb_2_0_extension_attributes. */
|
||||
uint32_t bmAttributes;
|
||||
};
|
||||
|
||||
/** \ingroup desc
|
||||
* A structure representing the SuperSpeed USB Device Capability descriptor
|
||||
* This descriptor is documented in section 9.6.2.2 of the USB 3.0 specification.
|
||||
* All multiple-byte fields are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_ss_usb_device_capability_descriptor {
|
||||
/** Size of this descriptor (in bytes) */
|
||||
uint8_t bLength;
|
||||
|
||||
/** Descriptor type. Will have value
|
||||
* \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
|
||||
* LIBUSB_DT_DEVICE_CAPABILITY in this context. */
|
||||
uint8_t bDescriptorType;
|
||||
|
||||
/** Capability type. Will have value
|
||||
* \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
|
||||
* LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. */
|
||||
uint8_t bDevCapabilityType;
|
||||
|
||||
/** Bitmap encoding of supported device level features.
|
||||
* A value of one in a bit location indicates a feature is
|
||||
* supported; a value of zero indicates it is not supported.
|
||||
* See \ref libusb_ss_usb_device_capability_attributes. */
|
||||
uint8_t bmAttributes;
|
||||
|
||||
/** Bitmap encoding of the speed supported by this device when
|
||||
* operating in SuperSpeed mode. See \ref libusb_supported_speed. */
|
||||
uint16_t wSpeedSupported;
|
||||
|
||||
/** The lowest speed at which all the functionality supported
|
||||
* by the device is available to the user. For example if the
|
||||
* device supports all its functionality when connected at
|
||||
* full speed and above then it sets this value to 1. */
|
||||
uint8_t bFunctionalitySupport;
|
||||
|
||||
/** U1 Device Exit Latency. */
|
||||
uint8_t bU1DevExitLat;
|
||||
|
||||
/** U2 Device Exit Latency. */
|
||||
uint16_t bU2DevExitLat;
|
||||
};
|
||||
|
||||
/** \ingroup desc
|
||||
* A structure representing the Container ID descriptor.
|
||||
* This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification.
|
||||
* All multiple-byte fields, except UUIDs, are represented in host-endian format.
|
||||
*/
|
||||
struct libusb_container_id_descriptor {
|
||||
/** Size of this descriptor (in bytes) */
|
||||
uint8_t bLength;
|
||||
|
||||
/** Descriptor type. Will have value
|
||||
* \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
|
||||
* LIBUSB_DT_DEVICE_CAPABILITY in this context. */
|
||||
uint8_t bDescriptorType;
|
||||
|
||||
/** Capability type. Will have value
|
||||
* \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID
|
||||
* LIBUSB_BT_CONTAINER_ID in this context. */
|
||||
uint8_t bDevCapabilityType;
|
||||
|
||||
/** Reserved field */
|
||||
uint8_t bReserved;
|
||||
|
||||
/** 128 bit UUID */
|
||||
uint8_t ContainerID[16];
|
||||
};
|
||||
|
||||
/** \ingroup asyncio
|
||||
* Setup packet for control transfers. */
|
||||
struct libusb_control_setup {
|
||||
|
@ -634,14 +889,15 @@ struct libusb_control_setup {
|
|||
|
||||
#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
|
||||
|
||||
/* libusb */
|
||||
/* libusbx */
|
||||
|
||||
struct libusb_context;
|
||||
struct libusb_device;
|
||||
struct libusb_device_handle;
|
||||
struct libusb_hotplug_callback;
|
||||
|
||||
/** \ingroup lib
|
||||
* Structure representing the libusb version.
|
||||
* Structure providing the version of the libusbx runtime
|
||||
*/
|
||||
struct libusb_version {
|
||||
/** Library major version. */
|
||||
|
@ -653,27 +909,27 @@ struct libusb_version {
|
|||
/** Library micro version. */
|
||||
const uint16_t micro;
|
||||
|
||||
/** Library nano version. This field is only nonzero on Windows. */
|
||||
/** Library nano version. */
|
||||
const uint16_t nano;
|
||||
|
||||
/** Library release candidate suffix string, e.g. "-rc4". */
|
||||
const char *rc;
|
||||
|
||||
/** Output of `git describe --tags` at library build time. */
|
||||
const char *describe;
|
||||
/** For ABI compatibility only. */
|
||||
const char* describe;
|
||||
};
|
||||
|
||||
/** \ingroup lib
|
||||
* Structure representing a libusb session. The concept of individual libusb
|
||||
* Structure representing a libusbx session. The concept of individual libusbx
|
||||
* sessions allows for your program to use two libraries (or dynamically
|
||||
* load two modules) which both independently use libusb. This will prevent
|
||||
* interference between the individual libusb users - for example
|
||||
* interference between the individual libusbx users - for example
|
||||
* libusb_set_debug() will not affect the other user of the library, and
|
||||
* libusb_exit() will not destroy resources that the other user is still
|
||||
* using.
|
||||
*
|
||||
* Sessions are created by libusb_init() and destroyed through libusb_exit().
|
||||
* If your application is guaranteed to only ever include a single libusb
|
||||
* If your application is guaranteed to only ever include a single libusbx
|
||||
* user (i.e. you), you do not have to worry about contexts: pass NULL in
|
||||
* every function call where a context is required. The default context
|
||||
* will be used.
|
||||
|
@ -690,8 +946,8 @@ typedef struct libusb_context libusb_context;
|
|||
* Certain operations can be performed on a device, but in order to do any
|
||||
* I/O you will have to first obtain a device handle using libusb_open().
|
||||
*
|
||||
* Devices are reference counted with libusb_device_ref() and
|
||||
* libusb_device_unref(), and are freed when the reference count reaches 0.
|
||||
* Devices are reference counted with libusb_ref_device() and
|
||||
* libusb_unref_device(), and are freed when the reference count reaches 0.
|
||||
* New devices presented by libusb_get_device_list() have a reference count of
|
||||
* 1, and libusb_free_device_list() can optionally decrease the reference count
|
||||
* on all devices in the list. libusb_open() adds another reference which is
|
||||
|
@ -714,27 +970,83 @@ typedef struct libusb_device_handle libusb_device_handle;
|
|||
* Speed codes. Indicates the speed at which the device is operating.
|
||||
*/
|
||||
enum libusb_speed {
|
||||
/** The OS doesn't report or know the device speed. */
|
||||
LIBUSB_SPEED_UNKNOWN = 0,
|
||||
/** The OS doesn't report or know the device speed. */
|
||||
LIBUSB_SPEED_UNKNOWN = 0,
|
||||
|
||||
/** The device is operating at low speed (1.5MBit/s). */
|
||||
LIBUSB_SPEED_LOW = 1,
|
||||
/** The device is operating at low speed (1.5MBit/s). */
|
||||
LIBUSB_SPEED_LOW = 1,
|
||||
|
||||
/** The device is operating at full speed (12MBit/s). */
|
||||
LIBUSB_SPEED_FULL = 2,
|
||||
/** The device is operating at full speed (12MBit/s). */
|
||||
LIBUSB_SPEED_FULL = 2,
|
||||
|
||||
/** The device is operating at high speed (480MBit/s). */
|
||||
LIBUSB_SPEED_HIGH = 3,
|
||||
/** The device is operating at high speed (480MBit/s). */
|
||||
LIBUSB_SPEED_HIGH = 3,
|
||||
|
||||
/** The device is operating at super speed (5000MBit/s). */
|
||||
LIBUSB_SPEED_SUPER = 4,
|
||||
/** The device is operating at super speed (5000MBit/s). */
|
||||
LIBUSB_SPEED_SUPER = 4,
|
||||
};
|
||||
|
||||
/** \ingroup dev
|
||||
* Supported speeds (wSpeedSupported) bitfield. Indicates what
|
||||
* speeds the device supports.
|
||||
*/
|
||||
enum libusb_supported_speed {
|
||||
/** Low speed operation supported (1.5MBit/s). */
|
||||
LIBUSB_LOW_SPEED_OPERATION = 1,
|
||||
|
||||
/** Full speed operation supported (12MBit/s). */
|
||||
LIBUSB_FULL_SPEED_OPERATION = 2,
|
||||
|
||||
/** High speed operation supported (480MBit/s). */
|
||||
LIBUSB_HIGH_SPEED_OPERATION = 4,
|
||||
|
||||
/** Superspeed operation supported (5000MBit/s). */
|
||||
LIBUSB_SUPER_SPEED_OPERATION = 8,
|
||||
};
|
||||
|
||||
/** \ingroup dev
|
||||
* Masks for the bits of the
|
||||
* \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field
|
||||
* of the USB 2.0 Extension descriptor.
|
||||
*/
|
||||
enum libusb_usb_2_0_extension_attributes {
|
||||
/** Supports Link Power Management (LPM) */
|
||||
LIBUSB_BM_LPM_SUPPORT = 2,
|
||||
};
|
||||
|
||||
/** \ingroup dev
|
||||
* Masks for the bits of the
|
||||
* \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field
|
||||
* field of the SuperSpeed USB Device Capability descriptor.
|
||||
*/
|
||||
enum libusb_ss_usb_device_capability_attributes {
|
||||
/** Supports Latency Tolerance Messages (LTM) */
|
||||
LIBUSB_BM_LTM_SUPPORT = 2,
|
||||
};
|
||||
|
||||
/** \ingroup dev
|
||||
* USB capability types
|
||||
*/
|
||||
enum libusb_bos_type {
|
||||
/** Wireless USB device capability */
|
||||
LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 1,
|
||||
|
||||
/** USB 2.0 extensions */
|
||||
LIBUSB_BT_USB_2_0_EXTENSION = 2,
|
||||
|
||||
/** SuperSpeed USB device capability */
|
||||
LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 3,
|
||||
|
||||
/** Container ID type */
|
||||
LIBUSB_BT_CONTAINER_ID = 4,
|
||||
};
|
||||
|
||||
/** \ingroup misc
|
||||
* Error codes. Most libusb functions return 0 on success or one of these
|
||||
* Error codes. Most libusbx functions return 0 on success or one of these
|
||||
* codes on failure.
|
||||
* You can call \ref libusb_error_name() to retrieve a string representation
|
||||
* of an error code.
|
||||
* You can call libusb_error_name() to retrieve a string representation of an
|
||||
* error code or libusb_strerror() to get an end-user suitable description of
|
||||
* an error code.
|
||||
*/
|
||||
enum libusb_error {
|
||||
/** Success (no error) */
|
||||
|
@ -776,13 +1088,16 @@ enum libusb_error {
|
|||
/** Operation not supported or unimplemented on this platform */
|
||||
LIBUSB_ERROR_NOT_SUPPORTED = -12,
|
||||
|
||||
/* NB! Remember to update libusb_error_name()
|
||||
when adding new error codes here. */
|
||||
/* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the
|
||||
message strings in strerror.c when adding new error codes here. */
|
||||
|
||||
/** Other error */
|
||||
LIBUSB_ERROR_OTHER = -99,
|
||||
};
|
||||
|
||||
/* Total number of error codes in enum libusb_error */
|
||||
#define LIBUSB_ERROR_COUNT 14
|
||||
|
||||
/** \ingroup asyncio
|
||||
* Transfer status codes */
|
||||
enum libusb_transfer_status {
|
||||
|
@ -808,6 +1123,9 @@ enum libusb_transfer_status {
|
|||
|
||||
/** Device sent more data than requested */
|
||||
LIBUSB_TRANSFER_OVERFLOW,
|
||||
|
||||
/* NB! Remember to update libusb_error_name()
|
||||
when adding new status codes here. */
|
||||
};
|
||||
|
||||
/** \ingroup asyncio
|
||||
|
@ -870,7 +1188,7 @@ struct libusb_transfer;
|
|||
* Asynchronous transfer callback function type. When submitting asynchronous
|
||||
* transfers, you pass a pointer to a callback function of this type via the
|
||||
* \ref libusb_transfer::callback "callback" member of the libusb_transfer
|
||||
* structure. libusb will call this function later, when the transfer has
|
||||
* structure. libusbx will call this function later, when the transfer has
|
||||
* completed or failed. See \ref asyncio for more information.
|
||||
* \param transfer The libusb_transfer struct the callback function is being
|
||||
* notified about.
|
||||
|
@ -942,13 +1260,41 @@ struct libusb_transfer {
|
|||
};
|
||||
|
||||
/** \ingroup misc
|
||||
* Capabilities supported by this instance of libusb. Test if the loaded
|
||||
* library supports a given capability by calling
|
||||
* Capabilities supported by an instance of libusb on the current running
|
||||
* platform. Test if the loaded library supports a given capability by calling
|
||||
* \ref libusb_has_capability().
|
||||
*/
|
||||
enum libusb_capability {
|
||||
/** The libusb_has_capability() API is available. */
|
||||
LIBUSB_CAP_HAS_CAPABILITY = 0,
|
||||
LIBUSB_CAP_HAS_CAPABILITY = 0x0000,
|
||||
/** Hotplug support is available on this platform. */
|
||||
LIBUSB_CAP_HAS_HOTPLUG = 0x0001,
|
||||
/** The library can access HID devices without requiring user intervention.
|
||||
* Note that before being able to actually access an HID device, you may
|
||||
* still have to call additional libusbx functions such as
|
||||
* \ref libusb_detach_kernel_driver(). */
|
||||
LIBUSB_CAP_HAS_HID_ACCESS = 0x0100,
|
||||
/** The library supports detaching of the default USB driver, using
|
||||
* \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */
|
||||
LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101
|
||||
};
|
||||
|
||||
/** \ingroup lib
|
||||
* Log message levels.
|
||||
* - LIBUSB_LOG_LEVEL_NONE (0) : no messages ever printed by the library (default)
|
||||
* - LIBUSB_LOG_LEVEL_ERROR (1) : error messages are printed to stderr
|
||||
* - LIBUSB_LOG_LEVEL_WARNING (2) : warning and error messages are printed to stderr
|
||||
* - LIBUSB_LOG_LEVEL_INFO (3) : informational messages are printed to stdout, warning
|
||||
* and error messages are printed to stderr
|
||||
* - LIBUSB_LOG_LEVEL_DEBUG (4) : debug and informational messages are printed to stdout,
|
||||
* warnings and errors to stderr
|
||||
*/
|
||||
enum libusb_log_level {
|
||||
LIBUSB_LOG_LEVEL_NONE = 0,
|
||||
LIBUSB_LOG_LEVEL_ERROR,
|
||||
LIBUSB_LOG_LEVEL_WARNING,
|
||||
LIBUSB_LOG_LEVEL_INFO,
|
||||
LIBUSB_LOG_LEVEL_DEBUG,
|
||||
};
|
||||
|
||||
int LIBUSB_CALL libusb_init(libusb_context **ctx);
|
||||
|
@ -957,6 +1303,8 @@ void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
|
|||
const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
|
||||
int LIBUSB_CALL libusb_has_capability(uint32_t capability);
|
||||
const char * LIBUSB_CALL libusb_error_name(int errcode);
|
||||
int LIBUSB_CALL libusb_setlocale(const char *locale);
|
||||
const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode);
|
||||
|
||||
ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
|
||||
libusb_device ***list);
|
||||
|
@ -977,7 +1325,38 @@ int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev,
|
|||
uint8_t bConfigurationValue, struct libusb_config_descriptor **config);
|
||||
void LIBUSB_CALL libusb_free_config_descriptor(
|
||||
struct libusb_config_descriptor *config);
|
||||
int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor(
|
||||
struct libusb_context *ctx,
|
||||
const struct libusb_endpoint_descriptor *endpoint,
|
||||
struct libusb_ss_endpoint_companion_descriptor **ep_comp);
|
||||
void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor(
|
||||
struct libusb_ss_endpoint_companion_descriptor *ep_comp);
|
||||
int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *handle,
|
||||
struct libusb_bos_descriptor **bos);
|
||||
void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
|
||||
int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor(
|
||||
struct libusb_context *ctx,
|
||||
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
||||
struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
|
||||
void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor(
|
||||
struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
|
||||
int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
|
||||
struct libusb_context *ctx,
|
||||
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
||||
struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
|
||||
void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
|
||||
struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
|
||||
int LIBUSB_CALL libusb_get_container_id_descriptor(struct libusb_context *ctx,
|
||||
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
||||
struct libusb_container_id_descriptor **container_id);
|
||||
void LIBUSB_CALL libusb_free_container_id_descriptor(
|
||||
struct libusb_container_id_descriptor *container_id);
|
||||
uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
|
||||
uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
|
||||
int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
|
||||
LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
|
||||
int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t* path, uint8_t path_length);
|
||||
libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev);
|
||||
uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
|
||||
int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev);
|
||||
int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev,
|
||||
|
@ -1011,6 +1390,8 @@ int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev,
|
|||
int interface_number);
|
||||
int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev,
|
||||
int interface_number);
|
||||
int LIBUSB_CALL libusb_set_auto_detach_kernel_driver(
|
||||
libusb_device_handle *dev, int enable);
|
||||
|
||||
/* async I/O */
|
||||
|
||||
|
@ -1128,8 +1509,8 @@ static inline void libusb_fill_control_transfer(
|
|||
transfer->timeout = timeout;
|
||||
transfer->buffer = buffer;
|
||||
if (setup)
|
||||
transfer->length = LIBUSB_CONTROL_SETUP_SIZE
|
||||
+ libusb_le16_to_cpu(setup->wLength);
|
||||
transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE
|
||||
+ libusb_le16_to_cpu(setup->wLength));
|
||||
transfer->user_data = user_data;
|
||||
transfer->callback = callback;
|
||||
}
|
||||
|
@ -1264,7 +1645,7 @@ static inline unsigned char *libusb_get_iso_packet_buffer(
|
|||
* signed to avoid compiler warnings. FIXME for libusb-2. */
|
||||
if (packet > INT_MAX)
|
||||
return NULL;
|
||||
_packet = packet;
|
||||
_packet = (int) packet;
|
||||
|
||||
if (_packet >= transfer->num_iso_packets)
|
||||
return NULL;
|
||||
|
@ -1304,12 +1685,12 @@ static inline unsigned char *libusb_get_iso_packet_buffer_simple(
|
|||
* signed to avoid compiler warnings. FIXME for libusb-2. */
|
||||
if (packet > INT_MAX)
|
||||
return NULL;
|
||||
_packet = packet;
|
||||
_packet = (int) packet;
|
||||
|
||||
if (_packet >= transfer->num_iso_packets)
|
||||
return NULL;
|
||||
|
||||
return transfer->buffer + (transfer->iso_packet_desc[0].length * _packet);
|
||||
return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet);
|
||||
}
|
||||
|
||||
/* sync I/O */
|
||||
|
@ -1342,8 +1723,8 @@ static inline int libusb_get_descriptor(libusb_device_handle *dev,
|
|||
uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
|
||||
{
|
||||
return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN,
|
||||
LIBUSB_REQUEST_GET_DESCRIPTOR, (desc_type << 8) | desc_index, 0, data,
|
||||
(uint16_t) length, 1000);
|
||||
LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index),
|
||||
0, data, (uint16_t) length, 1000);
|
||||
}
|
||||
|
||||
/** \ingroup desc
|
||||
|
@ -1438,6 +1819,121 @@ void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
|
|||
libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
|
||||
void *user_data);
|
||||
|
||||
/** \ingroup hotplug
|
||||
* Callback handle.
|
||||
*
|
||||
* Callbacks handles are generated by libusb_hotplug_register_callback()
|
||||
* and can be used to deregister callbacks. Callback handles are unique
|
||||
* per libusb_context and it is safe to call libusb_hotplug_deregister_callback()
|
||||
* on an already deregisted callback.
|
||||
*
|
||||
* Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
|
||||
*
|
||||
* For more information, see \ref hotplug.
|
||||
*/
|
||||
typedef int libusb_hotplug_callback_handle;
|
||||
|
||||
/** \ingroup hotplug
|
||||
*
|
||||
* Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
|
||||
*
|
||||
* Flags for hotplug events */
|
||||
typedef enum {
|
||||
/** Arm the callback and fire it for all matching currently attached devices. */
|
||||
LIBUSB_HOTPLUG_ENUMERATE = 1,
|
||||
} libusb_hotplug_flag;
|
||||
|
||||
/** \ingroup hotplug
|
||||
*
|
||||
* Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
|
||||
*
|
||||
* Hotplug events */
|
||||
typedef enum {
|
||||
/** A device has been plugged in and is ready to use */
|
||||
LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 0x01,
|
||||
|
||||
/** A device has left and is no longer available.
|
||||
* It is the user's responsibility to call libusb_close on any handle associated with a disconnected device.
|
||||
* It is safe to call libusb_get_device_descriptor on a device that has left */
|
||||
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 0x02,
|
||||
} libusb_hotplug_event;
|
||||
|
||||
/** \ingroup hotplug
|
||||
* Wildcard matching for hotplug events */
|
||||
#define LIBUSB_HOTPLUG_MATCH_ANY -1
|
||||
|
||||
/** \ingroup hotplug
|
||||
* Hotplug callback function type. When requesting hotplug event notifications,
|
||||
* you pass a pointer to a callback function of this type.
|
||||
*
|
||||
* This callback may be called by an internal event thread and as such it is
|
||||
* recommended the callback do minimal processing before returning.
|
||||
*
|
||||
* libusbx will call this function later, when a matching event had happened on
|
||||
* a matching device. See \ref hotplug for more information.
|
||||
*
|
||||
* It is safe to call either libusb_hotplug_register_callback() or
|
||||
* libusb_hotplug_deregister_callback() from within a callback function.
|
||||
*
|
||||
* Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
|
||||
*
|
||||
* \param libusb_context context of this notification
|
||||
* \param device libusb_device this event occurred on
|
||||
* \param event event that occurred
|
||||
* \param user_data user data provided when this callback was registered
|
||||
* \returns bool whether this callback is finished processing events.
|
||||
* returning 1 will cause this callback to be deregistered
|
||||
*/
|
||||
typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
|
||||
libusb_device *device,
|
||||
libusb_hotplug_event event,
|
||||
void *user_data);
|
||||
|
||||
/** \ingroup hotplug
|
||||
* Register a hotplug callback function
|
||||
*
|
||||
* Register a callback with the libusb_context. The callback will fire
|
||||
* when a matching event occurs on a matching device. The callback is
|
||||
* armed until either it is deregistered with libusb_hotplug_deregister_callback()
|
||||
* or the supplied callback returns 1 to indicate it is finished processing events.
|
||||
*
|
||||
* Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
|
||||
*
|
||||
* \param[in] ctx context to register this callback with
|
||||
* \param[in] events bitwise or of events that will trigger this callback. See \ref
|
||||
* libusb_hotplug_event
|
||||
* \param[in] flags hotplug callback flags. See \ref libusb_hotplug_flag
|
||||
* \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
|
||||
* \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
|
||||
* \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
|
||||
* \param[in] cb_fn the function to be invoked on a matching event/device
|
||||
* \param[in] user_data user data to pass to the callback function
|
||||
* \param[out] handle pointer to store the handle of the allocated callback (can be NULL)
|
||||
* \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure
|
||||
*/
|
||||
int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
|
||||
libusb_hotplug_event events,
|
||||
libusb_hotplug_flag flags,
|
||||
int vendor_id, int product_id,
|
||||
int dev_class,
|
||||
libusb_hotplug_callback_fn cb_fn,
|
||||
void *user_data,
|
||||
libusb_hotplug_callback_handle *handle);
|
||||
|
||||
/** \ingroup hotplug
|
||||
* Deregisters a hotplug callback.
|
||||
*
|
||||
* Deregister a callback from a libusb_context. This function is safe to call from within
|
||||
* a hotplug callback.
|
||||
*
|
||||
* Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
|
||||
*
|
||||
* \param[in] ctx context this callback is registered with
|
||||
* \param[in] handle the handle of the callback to deregister
|
||||
*/
|
||||
void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
|
||||
libusb_hotplug_callback_handle handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* darwin backend for libusbx 1.0
|
||||
* Copyright © 2008-2013 Nathan Hjelm <hjelmn@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(LIBUSB_DARWIN_H)
|
||||
#define LIBUSB_DARWIN_H
|
||||
|
||||
#include "libusbi.h"
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOCFBundle.h>
|
||||
#include <IOKit/usb/IOUSBLib.h>
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
|
||||
/* IOUSBInterfaceInferface */
|
||||
#if defined (kIOUSBInterfaceInterfaceID550)
|
||||
|
||||
#define usb_interface_t IOUSBInterfaceInterface550
|
||||
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID550
|
||||
#define InterfaceVersion 550
|
||||
|
||||
#elif defined (kIOUSBInterfaceInterfaceID500)
|
||||
|
||||
#define usb_interface_t IOUSBInterfaceInterface500
|
||||
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID500
|
||||
#define InterfaceVersion 500
|
||||
|
||||
#elif defined (kIOUSBInterfaceInterfaceID300)
|
||||
|
||||
#define usb_interface_t IOUSBInterfaceInterface300
|
||||
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID300
|
||||
#define InterfaceVersion 300
|
||||
|
||||
#elif defined (kIOUSBInterfaceInterfaceID245)
|
||||
|
||||
#define usb_interface_t IOUSBInterfaceInterface245
|
||||
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID245
|
||||
#define InterfaceVersion 245
|
||||
|
||||
#elif defined (kIOUSBInterfaceInterfaceID220)
|
||||
|
||||
#define usb_interface_t IOUSBInterfaceInterface220
|
||||
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID220
|
||||
#define InterfaceVersion 220
|
||||
|
||||
#else
|
||||
|
||||
#error "IOUSBFamily is too old. Please upgrade your OS"
|
||||
|
||||
#endif
|
||||
|
||||
/* IOUSBDeviceInterface */
|
||||
#if defined (kIOUSBDeviceInterfaceID500)
|
||||
|
||||
#define usb_device_t IOUSBDeviceInterface500
|
||||
#define DeviceInterfaceID kIOUSBDeviceInterfaceID500
|
||||
#define DeviceVersion 500
|
||||
|
||||
#elif defined (kIOUSBDeviceInterfaceID320)
|
||||
|
||||
#define usb_device_t IOUSBDeviceInterface320
|
||||
#define DeviceInterfaceID kIOUSBDeviceInterfaceID320
|
||||
#define DeviceVersion 320
|
||||
|
||||
#elif defined (kIOUSBDeviceInterfaceID300)
|
||||
|
||||
#define usb_device_t IOUSBDeviceInterface300
|
||||
#define DeviceInterfaceID kIOUSBDeviceInterfaceID300
|
||||
#define DeviceVersion 300
|
||||
|
||||
#elif defined (kIOUSBDeviceInterfaceID245)
|
||||
|
||||
#define usb_device_t IOUSBDeviceInterface245
|
||||
#define DeviceInterfaceID kIOUSBDeviceInterfaceID245
|
||||
#define DeviceVersion 245
|
||||
|
||||
#elif defined (kIOUSBDeviceInterfaceID220)
|
||||
#define usb_device_t IOUSBDeviceInterface197
|
||||
#define DeviceInterfaceID kIOUSBDeviceInterfaceID197
|
||||
#define DeviceVersion 197
|
||||
|
||||
#else
|
||||
|
||||
#error "IOUSBFamily is too old. Please upgrade your OS"
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(IO_OBJECT_NULL)
|
||||
#define IO_OBJECT_NULL ((io_object_t) 0)
|
||||
#endif
|
||||
|
||||
typedef IOCFPlugInInterface *io_cf_plugin_ref_t;
|
||||
typedef IONotificationPortRef io_notification_port_t;
|
||||
|
||||
/* private structures */
|
||||
struct darwin_cached_device {
|
||||
struct list_head list;
|
||||
IOUSBDeviceDescriptor dev_descriptor;
|
||||
UInt32 location;
|
||||
UInt64 parent_session;
|
||||
UInt64 session;
|
||||
UInt16 address;
|
||||
char sys_path[21];
|
||||
usb_device_t **device;
|
||||
int open_count;
|
||||
UInt8 first_config, active_config, port;
|
||||
int can_enumerate;
|
||||
int refcount;
|
||||
};
|
||||
|
||||
struct darwin_device_priv {
|
||||
struct darwin_cached_device *dev;
|
||||
};
|
||||
|
||||
struct darwin_device_handle_priv {
|
||||
int is_open;
|
||||
CFRunLoopSourceRef cfSource;
|
||||
int fds[2];
|
||||
|
||||
struct darwin_interface {
|
||||
usb_interface_t **interface;
|
||||
uint8_t num_endpoints;
|
||||
CFRunLoopSourceRef cfSource;
|
||||
uint64_t frames[256];
|
||||
uint8_t endpoint_addrs[USB_MAXENDPOINTS];
|
||||
} interfaces[USB_MAXINTERFACES];
|
||||
};
|
||||
|
||||
struct darwin_transfer_priv {
|
||||
/* Isoc */
|
||||
IOUSBIsocFrame *isoc_framelist;
|
||||
int num_iso_packets;
|
||||
|
||||
/* Control */
|
||||
IOUSBDevRequestTO req;
|
||||
|
||||
/* Bulk */
|
||||
};
|
||||
|
||||
/* structure for signaling io completion */
|
||||
struct darwin_msg_async_io_complete {
|
||||
struct usbi_transfer *itransfer;
|
||||
IOReturn result;
|
||||
UInt32 size;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,254 @@
|
|||
/* -*- Mode: C; c-basic-offset:8 ; indent-tabs-mode:t -*- */
|
||||
/*
|
||||
* Linux usbfs backend for libusb
|
||||
* Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright (c) 2013 Nathan Hjelm <hjelmn@mac.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "libusb.h"
|
||||
#include "libusbi.h"
|
||||
#include "linux_usbfs.h"
|
||||
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/filter.h>
|
||||
|
||||
#define KERNEL 1
|
||||
|
||||
static int linux_netlink_socket = -1;
|
||||
static pthread_t libusb_linux_event_thread;
|
||||
|
||||
static void *linux_netlink_event_thread_main(void *arg);
|
||||
|
||||
struct sockaddr_nl snl = { .nl_family=AF_NETLINK, .nl_groups=KERNEL };
|
||||
|
||||
int linux_netlink_start_event_monitor(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
snl.nl_groups = KERNEL;
|
||||
|
||||
linux_netlink_socket = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT);
|
||||
if (-1 == linux_netlink_socket) {
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
ret = bind(linux_netlink_socket, (struct sockaddr *) &snl, sizeof(snl));
|
||||
if (0 != ret) {
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
/* TODO -- add authentication */
|
||||
/* setsockopt(linux_netlink_socket, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); */
|
||||
|
||||
ret = pthread_create(&libusb_linux_event_thread, NULL, linux_netlink_event_thread_main, NULL);
|
||||
if (0 != ret) {
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
return LIBUSB_SUCCESS;
|
||||
}
|
||||
|
||||
int linux_netlink_stop_event_monitor(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (-1 == linux_netlink_socket) {
|
||||
/* already closed. nothing to do */
|
||||
return LIBUSB_SUCCESS;
|
||||
}
|
||||
|
||||
r = close(linux_netlink_socket);
|
||||
if (0 > r) {
|
||||
usbi_err(NULL, "error closing netlink socket. %s", strerror(errno));
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
pthread_cancel(libusb_linux_event_thread);
|
||||
|
||||
linux_netlink_socket = -1;
|
||||
|
||||
return LIBUSB_SUCCESS;
|
||||
}
|
||||
|
||||
static const char *netlink_message_parse (const char *buffer, size_t len, const char *key)
|
||||
{
|
||||
size_t keylen = strlen(key);
|
||||
size_t offset;
|
||||
|
||||
for (offset = 0 ; offset < len && '\0' != buffer[offset] ; offset += strlen(buffer + offset) + 1) {
|
||||
if (0 == strncmp(buffer + offset, key, keylen) &&
|
||||
'=' == buffer[offset + keylen]) {
|
||||
return buffer + offset + keylen + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* parse parts of netlink message common to both libudev and the kernel */
|
||||
static int linux_netlink_parse(char *buffer, size_t len, int *detached, const char **sys_name,
|
||||
uint8_t *busnum, uint8_t *devaddr) {
|
||||
const char *tmp;
|
||||
int i;
|
||||
|
||||
errno = 0;
|
||||
|
||||
*sys_name = NULL;
|
||||
*detached = 0;
|
||||
*busnum = 0;
|
||||
*devaddr = 0;
|
||||
|
||||
tmp = netlink_message_parse((const char *) buffer, len, "ACTION");
|
||||
if (tmp == NULL)
|
||||
return -1;
|
||||
if (0 == strcmp(tmp, "remove")) {
|
||||
*detached = 1;
|
||||
} else if (0 != strcmp(tmp, "add")) {
|
||||
usbi_dbg("unknown device action %s", tmp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check that this is a usb message */
|
||||
tmp = netlink_message_parse(buffer, len, "SUBSYSTEM");
|
||||
if (NULL == tmp || 0 != strcmp(tmp, "usb")) {
|
||||
/* not usb. ignore */
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = netlink_message_parse(buffer, len, "BUSNUM");
|
||||
if (NULL == tmp) {
|
||||
/* no bus number (likely a usb interface). ignore*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
*busnum = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
|
||||
if (errno) {
|
||||
errno = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = netlink_message_parse(buffer, len, "DEVNUM");
|
||||
if (NULL == tmp) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*devaddr = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
|
||||
if (errno) {
|
||||
errno = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = netlink_message_parse(buffer, len, "DEVPATH");
|
||||
if (NULL == tmp) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = strlen(tmp) - 1 ; i ; --i) {
|
||||
if ('/' ==tmp[i]) {
|
||||
*sys_name = tmp + i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* found a usb device */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int linux_netlink_read_message(void)
|
||||
{
|
||||
unsigned char buffer[1024];
|
||||
struct iovec iov = {.iov_base = buffer, .iov_len = sizeof(buffer)};
|
||||
struct msghdr meh = { .msg_iov=&iov, .msg_iovlen=1,
|
||||
.msg_name=&snl, .msg_namelen=sizeof(snl) };
|
||||
const char *sys_name = NULL;
|
||||
uint8_t busnum, devaddr;
|
||||
int detached, r;
|
||||
size_t len;
|
||||
|
||||
/* read netlink message */
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
len = recvmsg(linux_netlink_socket, &meh, 0);
|
||||
if (len < 32) {
|
||||
if (errno != EAGAIN)
|
||||
usbi_dbg("error recieving message from netlink");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* TODO -- authenticate this message is from the kernel or udevd */
|
||||
|
||||
r = linux_netlink_parse(buffer, len, &detached, &sys_name,
|
||||
&busnum, &devaddr);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
usbi_dbg("netlink hotplug found device busnum: %hhu, devaddr: %hhu, sys_name: %s, removed: %s",
|
||||
busnum, devaddr, sys_name, detached ? "yes" : "no");
|
||||
|
||||
/* signal device is available (or not) to all contexts */
|
||||
if (detached)
|
||||
linux_hotplug_disconnected(busnum, devaddr, sys_name);
|
||||
else
|
||||
linux_hotplug_enumerate(busnum, devaddr, sys_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *linux_netlink_event_thread_main(void *arg)
|
||||
{
|
||||
struct pollfd fds = {.fd = linux_netlink_socket,
|
||||
.events = POLLIN};
|
||||
|
||||
/* silence compiler warning */
|
||||
(void) arg;
|
||||
|
||||
while (1 == poll(&fds, 1, -1)) {
|
||||
if (POLLIN != fds.revents) {
|
||||
break;
|
||||
}
|
||||
|
||||
usbi_mutex_static_lock(&linux_hotplug_lock);
|
||||
linux_netlink_read_message();
|
||||
usbi_mutex_static_unlock(&linux_hotplug_lock);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void linux_netlink_hotplug_poll(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
usbi_mutex_static_lock(&linux_hotplug_lock);
|
||||
do {
|
||||
r = linux_netlink_read_message();
|
||||
} while (r == 0);
|
||||
usbi_mutex_static_unlock(&linux_hotplug_lock);
|
||||
}
|
|
@ -0,0 +1,273 @@
|
|||
/* -*- Mode: C; c-basic-offset:8 ; indent-tabs-mode:t -*- */
|
||||
/*
|
||||
* Linux usbfs backend for libusb
|
||||
* Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright (c) 2012-2013 Nathan Hjelm <hjelmn@mac.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <libudev.h>
|
||||
|
||||
#include "libusb.h"
|
||||
#include "libusbi.h"
|
||||
#include "linux_usbfs.h"
|
||||
|
||||
/* udev context */
|
||||
static struct udev *udev_ctx = NULL;
|
||||
static int udev_monitor_fd = -1;
|
||||
static struct udev_monitor *udev_monitor = NULL;
|
||||
static pthread_t linux_event_thread;
|
||||
|
||||
static void udev_hotplug_event(struct udev_device* udev_dev);
|
||||
static void *linux_udev_event_thread_main(void *arg);
|
||||
|
||||
int linux_udev_start_event_monitor(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
assert(udev_ctx == NULL);
|
||||
udev_ctx = udev_new();
|
||||
if (!udev_ctx) {
|
||||
usbi_err(NULL, "could not create udev context");
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
udev_monitor = udev_monitor_new_from_netlink(udev_ctx, "udev");
|
||||
if (!udev_monitor) {
|
||||
usbi_err(NULL, "could not initialize udev monitor");
|
||||
goto err_free_ctx;
|
||||
}
|
||||
|
||||
r = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", 0);
|
||||
if (r) {
|
||||
usbi_err(NULL, "could not initialize udev monitor filter for \"usb\" subsystem");
|
||||
goto err_free_monitor;
|
||||
}
|
||||
|
||||
if (udev_monitor_enable_receiving(udev_monitor)) {
|
||||
usbi_err(NULL, "failed to enable the udev monitor");
|
||||
goto err_free_monitor;
|
||||
}
|
||||
|
||||
udev_monitor_fd = udev_monitor_get_fd(udev_monitor);
|
||||
|
||||
/* Some older versions of udev are not non-blocking by default,
|
||||
* so make sure this is set */
|
||||
r = fcntl(udev_monitor_fd, F_GETFL);
|
||||
if (r == -1) {
|
||||
usbi_err(NULL, "getting udev monitor fd flags (%d)", errno);
|
||||
goto err_free_monitor;
|
||||
}
|
||||
r = fcntl(udev_monitor_fd, F_SETFL, r | O_NONBLOCK);
|
||||
if (r) {
|
||||
usbi_err(NULL, "setting udev monitor fd flags (%d)", errno);
|
||||
goto err_free_monitor;
|
||||
}
|
||||
|
||||
r = pthread_create(&linux_event_thread, NULL, linux_udev_event_thread_main, NULL);
|
||||
if (r) {
|
||||
usbi_err(NULL, "creating hotplug event thread (%d)", r);
|
||||
goto err_free_monitor;
|
||||
}
|
||||
|
||||
return LIBUSB_SUCCESS;
|
||||
|
||||
err_free_monitor:
|
||||
udev_monitor_unref(udev_monitor);
|
||||
udev_monitor = NULL;
|
||||
udev_monitor_fd = -1;
|
||||
err_free_ctx:
|
||||
udev_unref(udev_ctx);
|
||||
udev_ctx = NULL;
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
int linux_udev_stop_event_monitor(void)
|
||||
{
|
||||
assert(udev_ctx != NULL);
|
||||
assert(udev_monitor != NULL);
|
||||
assert(udev_monitor_fd != -1);
|
||||
|
||||
/* Cancel the event thread. This is the only way to guarantee the
|
||||
thread exits since closing the monitor fd won't necessarily cause
|
||||
poll to return. */
|
||||
pthread_cancel(linux_event_thread);
|
||||
pthread_join(linux_event_thread, NULL);
|
||||
|
||||
/* Release the udev monitor */
|
||||
udev_monitor_unref(udev_monitor);
|
||||
udev_monitor = NULL;
|
||||
udev_monitor_fd = -1;
|
||||
|
||||
/* Clean up the udev context */
|
||||
udev_unref(udev_ctx);
|
||||
udev_ctx = NULL;
|
||||
|
||||
return LIBUSB_SUCCESS;
|
||||
}
|
||||
|
||||
static void *linux_udev_event_thread_main(void *arg)
|
||||
{
|
||||
struct udev_device* udev_dev;
|
||||
struct pollfd fds = {.fd = udev_monitor_fd,
|
||||
.events = POLLIN};
|
||||
|
||||
usbi_dbg("udev event thread entering.");
|
||||
|
||||
while (1 == poll(&fds, 1, -1)) {
|
||||
if (NULL == udev_monitor || POLLIN != fds.revents) {
|
||||
break;
|
||||
}
|
||||
|
||||
usbi_mutex_static_lock(&linux_hotplug_lock);
|
||||
udev_dev = udev_monitor_receive_device(udev_monitor);
|
||||
if (udev_dev)
|
||||
udev_hotplug_event(udev_dev);
|
||||
usbi_mutex_static_unlock(&linux_hotplug_lock);
|
||||
}
|
||||
|
||||
usbi_dbg("udev event thread exiting");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int udev_device_info(struct libusb_context *ctx, int detached,
|
||||
struct udev_device *udev_dev, uint8_t *busnum,
|
||||
uint8_t *devaddr, const char **sys_name) {
|
||||
const char *dev_node;
|
||||
|
||||
dev_node = udev_device_get_devnode(udev_dev);
|
||||
if (!dev_node) {
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
*sys_name = udev_device_get_sysname(udev_dev);
|
||||
if (!*sys_name) {
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
return linux_get_device_address(ctx, detached, busnum, devaddr,
|
||||
dev_node, *sys_name);
|
||||
}
|
||||
|
||||
static void udev_hotplug_event(struct udev_device* udev_dev)
|
||||
{
|
||||
const char* udev_action;
|
||||
const char* sys_name = NULL;
|
||||
uint8_t busnum = 0, devaddr = 0;
|
||||
int detached;
|
||||
int r;
|
||||
|
||||
do {
|
||||
udev_action = udev_device_get_action(udev_dev);
|
||||
if (!udev_action) {
|
||||
break;
|
||||
}
|
||||
|
||||
detached = !strncmp(udev_action, "remove", 6);
|
||||
|
||||
r = udev_device_info(NULL, detached, udev_dev, &busnum, &devaddr, &sys_name);
|
||||
if (LIBUSB_SUCCESS != r) {
|
||||
break;
|
||||
}
|
||||
|
||||
usbi_dbg("udev hotplug event. action: %s.", udev_action);
|
||||
|
||||
if (strncmp(udev_action, "add", 3) == 0) {
|
||||
linux_hotplug_enumerate(busnum, devaddr, sys_name);
|
||||
} else if (detached) {
|
||||
linux_hotplug_disconnected(busnum, devaddr, sys_name);
|
||||
} else {
|
||||
usbi_err(NULL, "ignoring udev action %s", udev_action);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
udev_device_unref(udev_dev);
|
||||
}
|
||||
|
||||
int linux_udev_scan_devices(struct libusb_context *ctx)
|
||||
{
|
||||
struct udev_enumerate *enumerator;
|
||||
struct udev_list_entry *devices, *entry;
|
||||
struct udev_device *udev_dev;
|
||||
const char *sys_name;
|
||||
int r;
|
||||
|
||||
assert(udev_ctx != NULL);
|
||||
|
||||
enumerator = udev_enumerate_new(udev_ctx);
|
||||
if (NULL == enumerator) {
|
||||
usbi_err(ctx, "error creating udev enumerator");
|
||||
return LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
udev_enumerate_add_match_subsystem(enumerator, "usb");
|
||||
udev_enumerate_scan_devices(enumerator);
|
||||
devices = udev_enumerate_get_list_entry(enumerator);
|
||||
|
||||
udev_list_entry_foreach(entry, devices) {
|
||||
const char *path = udev_list_entry_get_name(entry);
|
||||
uint8_t busnum = 0, devaddr = 0;
|
||||
|
||||
udev_dev = udev_device_new_from_syspath(udev_ctx, path);
|
||||
|
||||
r = udev_device_info(ctx, 0, udev_dev, &busnum, &devaddr, &sys_name);
|
||||
if (r) {
|
||||
udev_device_unref(udev_dev);
|
||||
continue;
|
||||
}
|
||||
|
||||
linux_enumerate_device(ctx, busnum, devaddr, sys_name);
|
||||
udev_device_unref(udev_dev);
|
||||
}
|
||||
|
||||
udev_enumerate_unref(enumerator);
|
||||
|
||||
return LIBUSB_SUCCESS;
|
||||
}
|
||||
|
||||
void linux_udev_hotplug_poll(void)
|
||||
{
|
||||
struct udev_device* udev_dev;
|
||||
|
||||
usbi_mutex_static_lock(&linux_hotplug_lock);
|
||||
do {
|
||||
udev_dev = udev_monitor_receive_device(udev_monitor);
|
||||
if (udev_dev) {
|
||||
usbi_dbg("Handling hotplug event from hotplug_poll");
|
||||
udev_hotplug_event(udev_dev);
|
||||
}
|
||||
} while (udev_dev);
|
||||
usbi_mutex_static_unlock(&linux_hotplug_lock);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
* usbfs header structures
|
||||
* Copyright © 2007 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef LIBUSB_USBFS_H
|
||||
#define LIBUSB_USBFS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define SYSFS_DEVICE_PATH "/sys/bus/usb/devices"
|
||||
|
||||
struct usbfs_ctrltransfer {
|
||||
/* keep in sync with usbdevice_fs.h:usbdevfs_ctrltransfer */
|
||||
uint8_t bmRequestType;
|
||||
uint8_t bRequest;
|
||||
uint16_t wValue;
|
||||
uint16_t wIndex;
|
||||
uint16_t wLength;
|
||||
|
||||
uint32_t timeout; /* in milliseconds */
|
||||
|
||||
/* pointer to data */
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct usbfs_bulktransfer {
|
||||
/* keep in sync with usbdevice_fs.h:usbdevfs_bulktransfer */
|
||||
unsigned int ep;
|
||||
unsigned int len;
|
||||
unsigned int timeout; /* in milliseconds */
|
||||
|
||||
/* pointer to data */
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct usbfs_setinterface {
|
||||
/* keep in sync with usbdevice_fs.h:usbdevfs_setinterface */
|
||||
unsigned int interface;
|
||||
unsigned int altsetting;
|
||||
};
|
||||
|
||||
#define USBFS_MAXDRIVERNAME 255
|
||||
|
||||
struct usbfs_getdriver {
|
||||
unsigned int interface;
|
||||
char driver[USBFS_MAXDRIVERNAME + 1];
|
||||
};
|
||||
|
||||
#define USBFS_URB_SHORT_NOT_OK 0x01
|
||||
#define USBFS_URB_ISO_ASAP 0x02
|
||||
#define USBFS_URB_BULK_CONTINUATION 0x04
|
||||
#define USBFS_URB_QUEUE_BULK 0x10
|
||||
#define USBFS_URB_ZERO_PACKET 0x40
|
||||
|
||||
enum usbfs_urb_type {
|
||||
USBFS_URB_TYPE_ISO = 0,
|
||||
USBFS_URB_TYPE_INTERRUPT = 1,
|
||||
USBFS_URB_TYPE_CONTROL = 2,
|
||||
USBFS_URB_TYPE_BULK = 3,
|
||||
};
|
||||
|
||||
struct usbfs_iso_packet_desc {
|
||||
unsigned int length;
|
||||
unsigned int actual_length;
|
||||
unsigned int status;
|
||||
};
|
||||
|
||||
#define MAX_ISO_BUFFER_LENGTH 32768
|
||||
#define MAX_BULK_BUFFER_LENGTH 16384
|
||||
#define MAX_CTRL_BUFFER_LENGTH 4096
|
||||
|
||||
struct usbfs_urb {
|
||||
unsigned char type;
|
||||
unsigned char endpoint;
|
||||
int status;
|
||||
unsigned int flags;
|
||||
void *buffer;
|
||||
int buffer_length;
|
||||
int actual_length;
|
||||
int start_frame;
|
||||
int number_of_packets;
|
||||
int error_count;
|
||||
unsigned int signr;
|
||||
void *usercontext;
|
||||
struct usbfs_iso_packet_desc iso_frame_desc[0];
|
||||
};
|
||||
|
||||
struct usbfs_connectinfo {
|
||||
unsigned int devnum;
|
||||
unsigned char slow;
|
||||
};
|
||||
|
||||
struct usbfs_ioctl {
|
||||
int ifno; /* interface 0..N ; negative numbers reserved */
|
||||
int ioctl_code; /* MUST encode size + direction of data so the
|
||||
* macros in <asm/ioctl.h> give correct values */
|
||||
void *data; /* param buffer (in, or out) */
|
||||
};
|
||||
|
||||
struct usbfs_hub_portinfo {
|
||||
unsigned char numports;
|
||||
unsigned char port[127]; /* port to device num mapping */
|
||||
};
|
||||
|
||||
#define USBFS_CAP_ZERO_PACKET 0x01
|
||||
#define USBFS_CAP_BULK_CONTINUATION 0x02
|
||||
#define USBFS_CAP_NO_PACKET_SIZE_LIM 0x04
|
||||
#define USBFS_CAP_BULK_SCATTER_GATHER 0x08
|
||||
|
||||
#define USBFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
|
||||
#define USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
|
||||
|
||||
struct usbfs_disconnect_claim {
|
||||
unsigned int interface;
|
||||
unsigned int flags;
|
||||
char driver[USBFS_MAXDRIVERNAME + 1];
|
||||
};
|
||||
|
||||
#define IOCTL_USBFS_CONTROL _IOWR('U', 0, struct usbfs_ctrltransfer)
|
||||
#define IOCTL_USBFS_BULK _IOWR('U', 2, struct usbfs_bulktransfer)
|
||||
#define IOCTL_USBFS_RESETEP _IOR('U', 3, unsigned int)
|
||||
#define IOCTL_USBFS_SETINTF _IOR('U', 4, struct usbfs_setinterface)
|
||||
#define IOCTL_USBFS_SETCONFIG _IOR('U', 5, unsigned int)
|
||||
#define IOCTL_USBFS_GETDRIVER _IOW('U', 8, struct usbfs_getdriver)
|
||||
#define IOCTL_USBFS_SUBMITURB _IOR('U', 10, struct usbfs_urb)
|
||||
#define IOCTL_USBFS_DISCARDURB _IO('U', 11)
|
||||
#define IOCTL_USBFS_REAPURB _IOW('U', 12, void *)
|
||||
#define IOCTL_USBFS_REAPURBNDELAY _IOW('U', 13, void *)
|
||||
#define IOCTL_USBFS_CLAIMINTF _IOR('U', 15, unsigned int)
|
||||
#define IOCTL_USBFS_RELEASEINTF _IOR('U', 16, unsigned int)
|
||||
#define IOCTL_USBFS_CONNECTINFO _IOW('U', 17, struct usbfs_connectinfo)
|
||||
#define IOCTL_USBFS_IOCTL _IOWR('U', 18, struct usbfs_ioctl)
|
||||
#define IOCTL_USBFS_HUB_PORTINFO _IOR('U', 19, struct usbfs_hub_portinfo)
|
||||
#define IOCTL_USBFS_RESET _IO('U', 20)
|
||||
#define IOCTL_USBFS_CLEAR_HALT _IOR('U', 21, unsigned int)
|
||||
#define IOCTL_USBFS_DISCONNECT _IO('U', 22)
|
||||
#define IOCTL_USBFS_CONNECT _IO('U', 23)
|
||||
#define IOCTL_USBFS_CLAIM_PORT _IOR('U', 24, unsigned int)
|
||||
#define IOCTL_USBFS_RELEASE_PORT _IOR('U', 25, unsigned int)
|
||||
#define IOCTL_USBFS_GET_CAPABILITIES _IOR('U', 26, __u32)
|
||||
#define IOCTL_USBFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbfs_disconnect_claim)
|
||||
|
||||
extern usbi_mutex_static_t linux_hotplug_lock;
|
||||
|
||||
#if defined(HAVE_LIBUDEV)
|
||||
int linux_udev_start_event_monitor(void);
|
||||
int linux_udev_stop_event_monitor(void);
|
||||
int linux_udev_scan_devices(struct libusb_context *ctx);
|
||||
void linux_udev_hotplug_poll(void);
|
||||
#else
|
||||
int linux_netlink_start_event_monitor(void);
|
||||
int linux_netlink_stop_event_monitor(void);
|
||||
void linux_netlink_hotplug_poll(void);
|
||||
#endif
|
||||
|
||||
void linux_hotplug_enumerate(uint8_t busnum, uint8_t devaddr, const char *sys_name);
|
||||
void linux_hotplug_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys_name);
|
||||
|
||||
int linux_get_device_address (struct libusb_context *ctx, int detached,
|
||||
uint8_t *busnum, uint8_t *devaddr, const char *dev_node,
|
||||
const char *sys_name);
|
||||
int linux_enumerate_device(struct libusb_context *ctx,
|
||||
uint8_t busnum, uint8_t devaddr, const char *sysfs_dir);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,734 @@
|
|||
/*
|
||||
* Copyright © 2011 Martin Pieuchot <mpi@openbsd.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
|
||||
#include "libusb.h"
|
||||
#include "libusbi.h"
|
||||
|
||||
struct device_priv {
|
||||
char devnode[16];
|
||||
int fd;
|
||||
|
||||
unsigned char *cdesc; /* active config descriptor */
|
||||
usb_device_descriptor_t ddesc; /* usb device descriptor */
|
||||
};
|
||||
|
||||
struct handle_priv {
|
||||
int pipe[2]; /* for event notification */
|
||||
int endpoints[USB_MAX_ENDPOINTS];
|
||||
};
|
||||
|
||||
/*
|
||||
* Backend functions
|
||||
*/
|
||||
static int obsd_get_device_list(struct libusb_context *,
|
||||
struct discovered_devs **);
|
||||
static int obsd_open(struct libusb_device_handle *);
|
||||
static void obsd_close(struct libusb_device_handle *);
|
||||
|
||||
static int obsd_get_device_descriptor(struct libusb_device *, unsigned char *,
|
||||
int *);
|
||||
static int obsd_get_active_config_descriptor(struct libusb_device *,
|
||||
unsigned char *, size_t, int *);
|
||||
static int obsd_get_config_descriptor(struct libusb_device *, uint8_t,
|
||||
unsigned char *, size_t, int *);
|
||||
|
||||
static int obsd_get_configuration(struct libusb_device_handle *, int *);
|
||||
static int obsd_set_configuration(struct libusb_device_handle *, int);
|
||||
|
||||
static int obsd_claim_interface(struct libusb_device_handle *, int);
|
||||
static int obsd_release_interface(struct libusb_device_handle *, int);
|
||||
|
||||
static int obsd_set_interface_altsetting(struct libusb_device_handle *, int,
|
||||
int);
|
||||
static int obsd_clear_halt(struct libusb_device_handle *, unsigned char);
|
||||
static int obsd_reset_device(struct libusb_device_handle *);
|
||||
static void obsd_destroy_device(struct libusb_device *);
|
||||
|
||||
static int obsd_submit_transfer(struct usbi_transfer *);
|
||||
static int obsd_cancel_transfer(struct usbi_transfer *);
|
||||
static void obsd_clear_transfer_priv(struct usbi_transfer *);
|
||||
static int obsd_handle_events(struct libusb_context *ctx, struct pollfd *,
|
||||
nfds_t, int);
|
||||
static int obsd_clock_gettime(int, struct timespec *);
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*/
|
||||
static int _errno_to_libusb(int);
|
||||
static int _cache_active_config_descriptor(struct libusb_device *, int);
|
||||
static int _sync_control_transfer(struct usbi_transfer *);
|
||||
static int _sync_gen_transfer(struct usbi_transfer *);
|
||||
static int _access_endpoint(struct libusb_transfer *);
|
||||
|
||||
const struct usbi_os_backend openbsd_backend = {
|
||||
"Synchronous OpenBSD backend",
|
||||
0,
|
||||
NULL, /* init() */
|
||||
NULL, /* exit() */
|
||||
obsd_get_device_list,
|
||||
NULL, /* hotplug_poll */
|
||||
obsd_open,
|
||||
obsd_close,
|
||||
|
||||
obsd_get_device_descriptor,
|
||||
obsd_get_active_config_descriptor,
|
||||
obsd_get_config_descriptor,
|
||||
NULL, /* get_config_descriptor_by_value() */
|
||||
|
||||
obsd_get_configuration,
|
||||
obsd_set_configuration,
|
||||
|
||||
obsd_claim_interface,
|
||||
obsd_release_interface,
|
||||
|
||||
obsd_set_interface_altsetting,
|
||||
obsd_clear_halt,
|
||||
obsd_reset_device,
|
||||
|
||||
NULL, /* kernel_driver_active() */
|
||||
NULL, /* detach_kernel_driver() */
|
||||
NULL, /* attach_kernel_driver() */
|
||||
|
||||
obsd_destroy_device,
|
||||
|
||||
obsd_submit_transfer,
|
||||
obsd_cancel_transfer,
|
||||
obsd_clear_transfer_priv,
|
||||
|
||||
obsd_handle_events,
|
||||
|
||||
obsd_clock_gettime,
|
||||
sizeof(struct device_priv),
|
||||
sizeof(struct handle_priv),
|
||||
0, /* transfer_priv_size */
|
||||
0, /* add_iso_packet_size */
|
||||
};
|
||||
|
||||
int
|
||||
obsd_get_device_list(struct libusb_context * ctx,
|
||||
struct discovered_devs **discdevs)
|
||||
{
|
||||
struct libusb_device *dev;
|
||||
struct device_priv *dpriv;
|
||||
struct usb_device_info di;
|
||||
unsigned long session_id;
|
||||
char devnode[16];
|
||||
int fd, err, i;
|
||||
|
||||
usbi_dbg("");
|
||||
|
||||
/* Only ugen(4) is supported */
|
||||
for (i = 0; i < USB_MAX_DEVICES; i++) {
|
||||
/* Control endpoint is always .00 */
|
||||
snprintf(devnode, sizeof(devnode), "/dev/ugen%d.00", i);
|
||||
|
||||
if ((fd = open(devnode, O_RDONLY)) < 0) {
|
||||
if (errno != ENOENT && errno != ENXIO)
|
||||
usbi_err(ctx, "could not open %s", devnode);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ioctl(fd, USB_GET_DEVICEINFO, &di) < 0)
|
||||
continue;
|
||||
|
||||
session_id = (di.udi_bus << 8 | di.udi_addr);
|
||||
dev = usbi_get_device_by_session_id(ctx, session_id);
|
||||
|
||||
if (dev) {
|
||||
dev = libusb_ref_device(dev);
|
||||
} else {
|
||||
dev = usbi_alloc_device(ctx, session_id);
|
||||
if (dev == NULL)
|
||||
return (LIBUSB_ERROR_NO_MEM);
|
||||
|
||||
dev->bus_number = di.udi_bus;
|
||||
dev->device_address = di.udi_addr;
|
||||
dev->speed = di.udi_speed;
|
||||
|
||||
dpriv = (struct device_priv *)dev->os_priv;
|
||||
strlcpy(dpriv->devnode, devnode, sizeof(devnode));
|
||||
dpriv->fd = -1;
|
||||
|
||||
if (ioctl(fd, USB_GET_DEVICE_DESC, &dpriv->ddesc) < 0) {
|
||||
err = errno;
|
||||
goto error;
|
||||
}
|
||||
|
||||
dpriv->cdesc = NULL;
|
||||
if (_cache_active_config_descriptor(dev, fd)) {
|
||||
err = errno;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((err = usbi_sanitize_device(dev)))
|
||||
goto error;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
if (discovered_devs_append(*discdevs, dev) == NULL)
|
||||
return (LIBUSB_ERROR_NO_MEM);
|
||||
|
||||
libusb_unref_device(dev);
|
||||
}
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
|
||||
error:
|
||||
close(fd);
|
||||
libusb_unref_device(dev);
|
||||
return _errno_to_libusb(err);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_open(struct libusb_device_handle *handle)
|
||||
{
|
||||
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
|
||||
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
|
||||
|
||||
dpriv->fd = open(dpriv->devnode, O_RDWR);
|
||||
if (dpriv->fd < 0) {
|
||||
dpriv->fd = open(dpriv->devnode, O_RDONLY);
|
||||
if (dpriv->fd < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
}
|
||||
|
||||
usbi_dbg("open %s: fd %d", dpriv->devnode, dpriv->fd);
|
||||
|
||||
if (pipe(hpriv->pipe) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
return usbi_add_pollfd(HANDLE_CTX(handle), hpriv->pipe[0], POLLIN);
|
||||
}
|
||||
|
||||
void
|
||||
obsd_close(struct libusb_device_handle *handle)
|
||||
{
|
||||
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
|
||||
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
|
||||
|
||||
usbi_dbg("close: fd %d", dpriv->fd);
|
||||
|
||||
close(dpriv->fd);
|
||||
dpriv->fd = -1;
|
||||
|
||||
usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->pipe[0]);
|
||||
|
||||
close(hpriv->pipe[0]);
|
||||
close(hpriv->pipe[1]);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_get_device_descriptor(struct libusb_device *dev, unsigned char *buf,
|
||||
int *host_endian)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
|
||||
|
||||
usbi_dbg("");
|
||||
|
||||
memcpy(buf, &dpriv->ddesc, DEVICE_DESC_LENGTH);
|
||||
|
||||
*host_endian = 0;
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_get_active_config_descriptor(struct libusb_device *dev,
|
||||
unsigned char *buf, size_t len, int *host_endian)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
|
||||
usb_config_descriptor_t *ucd;
|
||||
|
||||
ucd = (usb_config_descriptor_t *) dpriv->cdesc;
|
||||
len = MIN(len, UGETW(ucd->wTotalLength));
|
||||
|
||||
usbi_dbg("len %d", len);
|
||||
|
||||
memcpy(buf, dpriv->cdesc, len);
|
||||
|
||||
*host_endian = 0;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
obsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
|
||||
unsigned char *buf, size_t len, int *host_endian)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
|
||||
struct usb_full_desc ufd;
|
||||
int fd, err;
|
||||
|
||||
usbi_dbg("index %d, len %d", idx, len);
|
||||
|
||||
/* A config descriptor may be requested before opening the device */
|
||||
if (dpriv->fd >= 0) {
|
||||
fd = dpriv->fd;
|
||||
} else {
|
||||
fd = open(dpriv->devnode, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
}
|
||||
|
||||
ufd.ufd_config_index = idx;
|
||||
ufd.ufd_size = len;
|
||||
ufd.ufd_data = buf;
|
||||
|
||||
if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
|
||||
err = errno;
|
||||
if (dpriv->fd < 0)
|
||||
close(fd);
|
||||
return _errno_to_libusb(err);
|
||||
}
|
||||
|
||||
if (dpriv->fd < 0)
|
||||
close(fd);
|
||||
|
||||
*host_endian = 0;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
obsd_get_configuration(struct libusb_device_handle *handle, int *config)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
|
||||
|
||||
usbi_dbg("");
|
||||
|
||||
if (ioctl(dpriv->fd, USB_GET_CONFIG, config) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
usbi_dbg("configuration %d", *config);
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_set_configuration(struct libusb_device_handle *handle, int config)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
|
||||
|
||||
usbi_dbg("configuration %d", config);
|
||||
|
||||
if (ioctl(dpriv->fd, USB_SET_CONFIG, &config) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
return _cache_active_config_descriptor(handle->dev, dpriv->fd);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_claim_interface(struct libusb_device_handle *handle, int iface)
|
||||
{
|
||||
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < USB_MAX_ENDPOINTS; i++)
|
||||
hpriv->endpoints[i] = -1;
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_release_interface(struct libusb_device_handle *handle, int iface)
|
||||
{
|
||||
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < USB_MAX_ENDPOINTS; i++)
|
||||
if (hpriv->endpoints[i] >= 0)
|
||||
close(hpriv->endpoints[i]);
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_set_interface_altsetting(struct libusb_device_handle *handle, int iface,
|
||||
int altsetting)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
|
||||
struct usb_alt_interface intf;
|
||||
|
||||
usbi_dbg("iface %d, setting %d", iface, altsetting);
|
||||
|
||||
memset(&intf, 0, sizeof(intf));
|
||||
|
||||
intf.uai_interface_index = iface;
|
||||
intf.uai_alt_no = altsetting;
|
||||
|
||||
if (ioctl(dpriv->fd, USB_SET_ALTINTERFACE, &intf) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
|
||||
struct usb_ctl_request req;
|
||||
|
||||
usbi_dbg("");
|
||||
|
||||
req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT;
|
||||
req.ucr_request.bRequest = UR_CLEAR_FEATURE;
|
||||
USETW(req.ucr_request.wValue, UF_ENDPOINT_HALT);
|
||||
USETW(req.ucr_request.wIndex, endpoint);
|
||||
USETW(req.ucr_request.wLength, 0);
|
||||
|
||||
if (ioctl(dpriv->fd, USB_DO_REQUEST, &req) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_reset_device(struct libusb_device_handle *handle)
|
||||
{
|
||||
usbi_dbg("");
|
||||
|
||||
return (LIBUSB_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
void
|
||||
obsd_destroy_device(struct libusb_device *dev)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
|
||||
|
||||
usbi_dbg("");
|
||||
|
||||
free(dpriv->cdesc);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_submit_transfer(struct usbi_transfer *itransfer)
|
||||
{
|
||||
struct libusb_transfer *transfer;
|
||||
struct handle_priv *hpriv;
|
||||
int err = 0;
|
||||
|
||||
usbi_dbg("");
|
||||
|
||||
transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
|
||||
hpriv = (struct handle_priv *)transfer->dev_handle->os_priv;
|
||||
|
||||
switch (transfer->type) {
|
||||
case LIBUSB_TRANSFER_TYPE_CONTROL:
|
||||
err = _sync_control_transfer(itransfer);
|
||||
break;
|
||||
case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
|
||||
if (IS_XFEROUT(transfer)) {
|
||||
/* Isochronous write is not supported */
|
||||
err = LIBUSB_ERROR_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
err = _sync_gen_transfer(itransfer);
|
||||
break;
|
||||
case LIBUSB_TRANSFER_TYPE_BULK:
|
||||
case LIBUSB_TRANSFER_TYPE_INTERRUPT:
|
||||
if (IS_XFEROUT(transfer) &&
|
||||
transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) {
|
||||
err = LIBUSB_ERROR_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
err = _sync_gen_transfer(itransfer);
|
||||
break;
|
||||
}
|
||||
|
||||
if (err)
|
||||
return (err);
|
||||
|
||||
if (write(hpriv->pipe[1], &itransfer, sizeof(itransfer)) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_cancel_transfer(struct usbi_transfer *itransfer)
|
||||
{
|
||||
usbi_dbg("");
|
||||
|
||||
return (LIBUSB_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
void
|
||||
obsd_clear_transfer_priv(struct usbi_transfer *itransfer)
|
||||
{
|
||||
usbi_dbg("");
|
||||
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
int
|
||||
obsd_handle_events(struct libusb_context *ctx, struct pollfd *fds, nfds_t nfds,
|
||||
int num_ready)
|
||||
{
|
||||
struct libusb_device_handle *handle;
|
||||
struct handle_priv *hpriv = NULL;
|
||||
struct usbi_transfer *itransfer;
|
||||
struct pollfd *pollfd;
|
||||
int i, err = 0;
|
||||
|
||||
usbi_dbg("");
|
||||
|
||||
pthread_mutex_lock(&ctx->open_devs_lock);
|
||||
for (i = 0; i < nfds && num_ready > 0; i++) {
|
||||
pollfd = &fds[i];
|
||||
|
||||
if (!pollfd->revents)
|
||||
continue;
|
||||
|
||||
hpriv = NULL;
|
||||
num_ready--;
|
||||
list_for_each_entry(handle, &ctx->open_devs, list,
|
||||
struct libusb_device_handle) {
|
||||
hpriv = (struct handle_priv *)handle->os_priv;
|
||||
|
||||
if (hpriv->pipe[0] == pollfd->fd)
|
||||
break;
|
||||
|
||||
hpriv = NULL;
|
||||
}
|
||||
|
||||
if (NULL == hpriv) {
|
||||
usbi_dbg("fd %d is not an event pipe!", pollfd->fd);
|
||||
err = ENOENT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pollfd->revents & POLLERR) {
|
||||
usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->pipe[0]);
|
||||
usbi_handle_disconnect(handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (read(hpriv->pipe[0], &itransfer, sizeof(itransfer)) < 0) {
|
||||
err = errno;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((err = usbi_handle_transfer_completion(itransfer,
|
||||
LIBUSB_TRANSFER_COMPLETED)))
|
||||
break;
|
||||
}
|
||||
pthread_mutex_unlock(&ctx->open_devs_lock);
|
||||
|
||||
if (err)
|
||||
return _errno_to_libusb(err);
|
||||
|
||||
return (LIBUSB_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
obsd_clock_gettime(int clkid, struct timespec *tp)
|
||||
{
|
||||
usbi_dbg("clock %d", clkid);
|
||||
|
||||
if (clkid == USBI_CLOCK_REALTIME)
|
||||
return clock_gettime(CLOCK_REALTIME, tp);
|
||||
|
||||
if (clkid == USBI_CLOCK_MONOTONIC)
|
||||
return clock_gettime(CLOCK_MONOTONIC, tp);
|
||||
|
||||
return (LIBUSB_ERROR_INVALID_PARAM);
|
||||
}
|
||||
|
||||
int
|
||||
_errno_to_libusb(int err)
|
||||
{
|
||||
switch (err) {
|
||||
case EIO:
|
||||
return (LIBUSB_ERROR_IO);
|
||||
case EACCES:
|
||||
return (LIBUSB_ERROR_ACCESS);
|
||||
case ENOENT:
|
||||
return (LIBUSB_ERROR_NO_DEVICE);
|
||||
case ENOMEM:
|
||||
return (LIBUSB_ERROR_NO_MEM);
|
||||
}
|
||||
|
||||
usbi_dbg("error: %s", strerror(err));
|
||||
|
||||
return (LIBUSB_ERROR_OTHER);
|
||||
}
|
||||
|
||||
int
|
||||
_cache_active_config_descriptor(struct libusb_device *dev, int fd)
|
||||
{
|
||||
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
|
||||
struct usb_config_desc ucd;
|
||||
struct usb_full_desc ufd;
|
||||
unsigned char* buf;
|
||||
int len;
|
||||
|
||||
usbi_dbg("fd %d", fd);
|
||||
|
||||
ucd.ucd_config_index = USB_CURRENT_CONFIG_INDEX;
|
||||
|
||||
if ((ioctl(fd, USB_GET_CONFIG_DESC, &ucd)) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
usbi_dbg("active bLength %d", ucd.ucd_desc.bLength);
|
||||
|
||||
len = UGETW(ucd.ucd_desc.wTotalLength);
|
||||
buf = malloc(len);
|
||||
if (buf == NULL)
|
||||
return (LIBUSB_ERROR_NO_MEM);
|
||||
|
||||
ufd.ufd_config_index = ucd.ucd_config_index;
|
||||
ufd.ufd_size = len;
|
||||
ufd.ufd_data = buf;
|
||||
|
||||
usbi_dbg("index %d, len %d", ufd.ufd_config_index, len);
|
||||
|
||||
if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
|
||||
free(buf);
|
||||
return _errno_to_libusb(errno);
|
||||
}
|
||||
|
||||
if (dpriv->cdesc)
|
||||
free(dpriv->cdesc);
|
||||
dpriv->cdesc = buf;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
_sync_control_transfer(struct usbi_transfer *itransfer)
|
||||
{
|
||||
struct libusb_transfer *transfer;
|
||||
struct libusb_control_setup *setup;
|
||||
struct device_priv *dpriv;
|
||||
struct usb_ctl_request req;
|
||||
|
||||
transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
|
||||
dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
|
||||
setup = (struct libusb_control_setup *)transfer->buffer;
|
||||
|
||||
usbi_dbg("type %d request %d value %d index %d length %d timeout %d",
|
||||
setup->bmRequestType, setup->bRequest,
|
||||
libusb_le16_to_cpu(setup->wValue),
|
||||
libusb_le16_to_cpu(setup->wIndex),
|
||||
libusb_le16_to_cpu(setup->wLength), transfer->timeout);
|
||||
|
||||
req.ucr_request.bmRequestType = setup->bmRequestType;
|
||||
req.ucr_request.bRequest = setup->bRequest;
|
||||
/* Don't use USETW, libusbx already deals with the endianness */
|
||||
(*(uint16_t *)req.ucr_request.wValue) = setup->wValue;
|
||||
(*(uint16_t *)req.ucr_request.wIndex) = setup->wIndex;
|
||||
(*(uint16_t *)req.ucr_request.wLength) = setup->wLength;
|
||||
req.ucr_data = transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
|
||||
|
||||
if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
|
||||
req.ucr_flags = USBD_SHORT_XFER_OK;
|
||||
|
||||
if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
itransfer->transferred = req.ucr_actlen;
|
||||
|
||||
usbi_dbg("transferred %d", itransfer->transferred);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
_access_endpoint(struct libusb_transfer *transfer)
|
||||
{
|
||||
struct handle_priv *hpriv;
|
||||
struct device_priv *dpriv;
|
||||
char *s, devnode[16];
|
||||
int fd, endpt;
|
||||
mode_t mode;
|
||||
|
||||
hpriv = (struct handle_priv *)transfer->dev_handle->os_priv;
|
||||
dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
|
||||
|
||||
endpt = UE_GET_ADDR(transfer->endpoint);
|
||||
mode = IS_XFERIN(transfer) ? O_RDONLY : O_WRONLY;
|
||||
|
||||
usbi_dbg("endpoint %d mode %d", endpt, mode);
|
||||
|
||||
if (hpriv->endpoints[endpt] < 0) {
|
||||
/* Pick the right node given the control one */
|
||||
strlcpy(devnode, dpriv->devnode, sizeof(devnode));
|
||||
s = strchr(devnode, '.');
|
||||
snprintf(s, 4, ".%02d", endpt);
|
||||
|
||||
/* We may need to read/write to the same endpoint later. */
|
||||
if (((fd = open(devnode, O_RDWR)) < 0) && (errno == ENXIO))
|
||||
if ((fd = open(devnode, mode)) < 0)
|
||||
return (-1);
|
||||
|
||||
hpriv->endpoints[endpt] = fd;
|
||||
}
|
||||
|
||||
return (hpriv->endpoints[endpt]);
|
||||
}
|
||||
|
||||
int
|
||||
_sync_gen_transfer(struct usbi_transfer *itransfer)
|
||||
{
|
||||
struct libusb_transfer *transfer;
|
||||
int fd, nr = 1;
|
||||
|
||||
transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
|
||||
|
||||
/*
|
||||
* Bulk, Interrupt or Isochronous transfer depends on the
|
||||
* endpoint and thus the node to open.
|
||||
*/
|
||||
if ((fd = _access_endpoint(transfer)) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
if ((ioctl(fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
if (IS_XFERIN(transfer)) {
|
||||
if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
|
||||
if ((ioctl(fd, USB_SET_SHORT_XFER, &nr)) < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
nr = read(fd, transfer->buffer, transfer->length);
|
||||
} else {
|
||||
nr = write(fd, transfer->buffer, transfer->length);
|
||||
}
|
||||
|
||||
if (nr < 0)
|
||||
return _errno_to_libusb(errno);
|
||||
|
||||
itransfer->transferred = nr;
|
||||
|
||||
return (0);
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* poll_posix: poll compatibility wrapper for POSIX systems
|
||||
* Copyright © 2013 RealVNC Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libusbi.h"
|
||||
|
||||
int usbi_pipe(int pipefd[2])
|
||||
{
|
||||
int ret = pipe(pipefd);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
ret = fcntl(pipefd[1], F_GETFL);
|
||||
if (ret == -1) {
|
||||
usbi_dbg("Failed to get pipe fd flags: %d", errno);
|
||||
goto err_close_pipe;
|
||||
}
|
||||
ret = fcntl(pipefd[1], F_SETFL, ret | O_NONBLOCK);
|
||||
if (ret != 0) {
|
||||
usbi_dbg("Failed to set non-blocking on new pipe: %d", errno);
|
||||
goto err_close_pipe;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_close_pipe:
|
||||
usbi_close(pipefd[0]);
|
||||
usbi_close(pipefd[1]);
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef LIBUSB_POLL_POSIX_H
|
||||
#define LIBUSB_POLL_POSIX_H
|
||||
|
||||
#define usbi_write write
|
||||
#define usbi_read read
|
||||
#define usbi_close close
|
||||
#define usbi_poll poll
|
||||
|
||||
int usbi_pipe(int pipefd[2]);
|
||||
|
||||
#endif /* LIBUSB_POLL_POSIX_H */
|
|
@ -0,0 +1,726 @@
|
|||
/*
|
||||
* poll_windows: poll compatibility wrapper for Windows
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
* Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* poll() and pipe() Windows compatibility layer for libusbx 1.0
|
||||
*
|
||||
* The way this layer works is by using OVERLAPPED with async I/O transfers, as
|
||||
* OVERLAPPED have an associated event which is flagged for I/O completion.
|
||||
*
|
||||
* For USB pollable async I/O, you would typically:
|
||||
* - obtain a Windows HANDLE to a file or device that has been opened in
|
||||
* OVERLAPPED mode
|
||||
* - call usbi_create_fd with this handle to obtain a custom fd.
|
||||
* Note that if you need simultaneous R/W access, you need to call create_fd
|
||||
* twice, once in RW_READ and once in RW_WRITE mode to obtain 2 separate
|
||||
* pollable fds
|
||||
* - leave the core functions call the poll routine and flag POLLIN/POLLOUT
|
||||
*
|
||||
* The pipe pollable synchronous I/O works using the overlapped event associated
|
||||
* with a fake pipe. The read/write functions are only meant to be used in that
|
||||
* context.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libusbi.h"
|
||||
|
||||
// Uncomment to debug the polling layer
|
||||
//#define DEBUG_POLL_WINDOWS
|
||||
#if defined(DEBUG_POLL_WINDOWS)
|
||||
#define poll_dbg usbi_dbg
|
||||
#else
|
||||
// MSVC++ < 2005 cannot use a variadic argument and non MSVC
|
||||
// compilers produce warnings if parenthesis are ommitted.
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
||||
#define poll_dbg
|
||||
#else
|
||||
#define poll_dbg(...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_PREFAST_)
|
||||
#pragma warning(disable:28719)
|
||||
#endif
|
||||
|
||||
#define CHECK_INIT_POLLING do {if(!is_polling_set) init_polling();} while(0)
|
||||
|
||||
// public fd data
|
||||
const struct winfd INVALID_WINFD = {-1, INVALID_HANDLE_VALUE, NULL, NULL, NULL, RW_NONE};
|
||||
struct winfd poll_fd[MAX_FDS];
|
||||
// internal fd data
|
||||
struct {
|
||||
CRITICAL_SECTION mutex; // lock for fds
|
||||
// Additional variables for XP CancelIoEx partial emulation
|
||||
HANDLE original_handle;
|
||||
DWORD thread_id;
|
||||
} _poll_fd[MAX_FDS];
|
||||
|
||||
// globals
|
||||
BOOLEAN is_polling_set = FALSE;
|
||||
LONG pipe_number = 0;
|
||||
static volatile LONG compat_spinlock = 0;
|
||||
|
||||
#if !defined(_WIN32_WCE)
|
||||
// CancelIoEx, available on Vista and later only, provides the ability to cancel
|
||||
// a single transfer (OVERLAPPED) when used. As it may not be part of any of the
|
||||
// platform headers, we hook into the Kernel32 system DLL directly to seek it.
|
||||
static BOOL (__stdcall *pCancelIoEx)(HANDLE, LPOVERLAPPED) = NULL;
|
||||
#define Use_Duplicate_Handles (pCancelIoEx == NULL)
|
||||
|
||||
static inline void setup_cancel_io(void)
|
||||
{
|
||||
HMODULE hKernel32 = GetModuleHandleA("KERNEL32");
|
||||
if (hKernel32 != NULL) {
|
||||
pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED))
|
||||
GetProcAddress(hKernel32, "CancelIoEx");
|
||||
}
|
||||
usbi_dbg("Will use CancelIo%s for I/O cancellation",
|
||||
Use_Duplicate_Handles?"":"Ex");
|
||||
}
|
||||
|
||||
static inline BOOL cancel_io(int _index)
|
||||
{
|
||||
if ((_index < 0) || (_index >= MAX_FDS)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
|
||||
|| (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
|
||||
return TRUE;
|
||||
}
|
||||
if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
|
||||
// Cancel outstanding transfer via the specific callback
|
||||
(*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
|
||||
return TRUE;
|
||||
}
|
||||
if (pCancelIoEx != NULL) {
|
||||
return (*pCancelIoEx)(poll_fd[_index].handle, poll_fd[_index].overlapped);
|
||||
}
|
||||
if (_poll_fd[_index].thread_id == GetCurrentThreadId()) {
|
||||
return CancelIo(poll_fd[_index].handle);
|
||||
}
|
||||
usbi_warn(NULL, "Unable to cancel I/O that was started from another thread");
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
#define Use_Duplicate_Handles FALSE
|
||||
|
||||
static __inline void setup_cancel_io()
|
||||
{
|
||||
// No setup needed on WinCE
|
||||
}
|
||||
|
||||
static __inline BOOL cancel_io(int _index)
|
||||
{
|
||||
if ((_index < 0) || (_index >= MAX_FDS)) {
|
||||
return FALSE;
|
||||
}
|
||||
if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
|
||||
|| (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
|
||||
return TRUE;
|
||||
}
|
||||
if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
|
||||
// Cancel outstanding transfer via the specific callback
|
||||
(*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Init
|
||||
void init_polling(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
|
||||
SleepEx(0, TRUE);
|
||||
}
|
||||
if (!is_polling_set) {
|
||||
setup_cancel_io();
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
poll_fd[i] = INVALID_WINFD;
|
||||
_poll_fd[i].original_handle = INVALID_HANDLE_VALUE;
|
||||
_poll_fd[i].thread_id = 0;
|
||||
InitializeCriticalSection(&_poll_fd[i].mutex);
|
||||
}
|
||||
is_polling_set = TRUE;
|
||||
}
|
||||
InterlockedExchange((LONG *)&compat_spinlock, 0);
|
||||
}
|
||||
|
||||
// Internal function to retrieve the table index (and lock the fd mutex)
|
||||
static int _fd_to_index_and_lock(int fd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
if (poll_fd[i].fd == fd) {
|
||||
EnterCriticalSection(&_poll_fd[i].mutex);
|
||||
// fd might have changed before we got to critical
|
||||
if (poll_fd[i].fd != fd) {
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
continue;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static OVERLAPPED *create_overlapped(void)
|
||||
{
|
||||
OVERLAPPED *overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
|
||||
if (overlapped == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
overlapped->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
if(overlapped->hEvent == NULL) {
|
||||
free (overlapped);
|
||||
return NULL;
|
||||
}
|
||||
return overlapped;
|
||||
}
|
||||
|
||||
static void free_overlapped(OVERLAPPED *overlapped)
|
||||
{
|
||||
if (overlapped == NULL)
|
||||
return;
|
||||
|
||||
if ( (overlapped->hEvent != 0)
|
||||
&& (overlapped->hEvent != INVALID_HANDLE_VALUE) ) {
|
||||
CloseHandle(overlapped->hEvent);
|
||||
}
|
||||
free(overlapped);
|
||||
}
|
||||
|
||||
void exit_polling(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
|
||||
SleepEx(0, TRUE);
|
||||
}
|
||||
if (is_polling_set) {
|
||||
is_polling_set = FALSE;
|
||||
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
// Cancel any async I/O (handle can be invalid)
|
||||
cancel_io(i);
|
||||
// If anything was pending on that I/O, it should be
|
||||
// terminating, and we should be able to access the fd
|
||||
// mutex lock before too long
|
||||
EnterCriticalSection(&_poll_fd[i].mutex);
|
||||
free_overlapped(poll_fd[i].overlapped);
|
||||
if (Use_Duplicate_Handles) {
|
||||
// Close duplicate handle
|
||||
if (_poll_fd[i].original_handle != INVALID_HANDLE_VALUE) {
|
||||
CloseHandle(poll_fd[i].handle);
|
||||
}
|
||||
}
|
||||
poll_fd[i] = INVALID_WINFD;
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
DeleteCriticalSection(&_poll_fd[i].mutex);
|
||||
}
|
||||
}
|
||||
InterlockedExchange((LONG *)&compat_spinlock, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a fake pipe.
|
||||
* As libusbx only uses pipes for signaling, all we need from a pipe is an
|
||||
* event. To that extent, we create a single wfd and overlapped as a means
|
||||
* to access that event.
|
||||
*/
|
||||
int usbi_pipe(int filedes[2])
|
||||
{
|
||||
int i;
|
||||
OVERLAPPED* overlapped;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
overlapped = create_overlapped();
|
||||
|
||||
if (overlapped == NULL) {
|
||||
return -1;
|
||||
}
|
||||
// The overlapped must have status pending for signaling to work in poll
|
||||
overlapped->Internal = STATUS_PENDING;
|
||||
overlapped->InternalHigh = 0;
|
||||
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
if (poll_fd[i].fd < 0) {
|
||||
EnterCriticalSection(&_poll_fd[i].mutex);
|
||||
// fd might have been allocated before we got to critical
|
||||
if (poll_fd[i].fd >= 0) {
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Use index as the unique fd number
|
||||
poll_fd[i].fd = i;
|
||||
// Read end of the "pipe"
|
||||
filedes[0] = poll_fd[i].fd;
|
||||
// We can use the same handle for both ends
|
||||
filedes[1] = filedes[0];
|
||||
|
||||
poll_fd[i].handle = DUMMY_HANDLE;
|
||||
poll_fd[i].overlapped = overlapped;
|
||||
// There's no polling on the write end, so we just use READ for our needs
|
||||
poll_fd[i].rw = RW_READ;
|
||||
_poll_fd[i].original_handle = INVALID_HANDLE_VALUE;
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
free_overlapped(overlapped);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create both an fd and an OVERLAPPED from an open Windows handle, so that
|
||||
* it can be used with our polling function
|
||||
* The handle MUST support overlapped transfers (usually requires CreateFile
|
||||
* with FILE_FLAG_OVERLAPPED)
|
||||
* Return a pollable file descriptor struct, or INVALID_WINFD on error
|
||||
*
|
||||
* Note that the fd returned by this function is a per-transfer fd, rather
|
||||
* than a per-session fd and cannot be used for anything else but our
|
||||
* custom functions (the fd itself points to the NUL: device)
|
||||
* if you plan to do R/W on the same handle, you MUST create 2 fds: one for
|
||||
* read and one for write. Using a single R/W fd is unsupported and will
|
||||
* produce unexpected results
|
||||
*/
|
||||
struct winfd usbi_create_fd(HANDLE handle, int access_mode, struct usbi_transfer *itransfer, cancel_transfer *cancel_fn)
|
||||
{
|
||||
int i;
|
||||
struct winfd wfd = INVALID_WINFD;
|
||||
OVERLAPPED* overlapped = NULL;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
if ((handle == 0) || (handle == INVALID_HANDLE_VALUE)) {
|
||||
return INVALID_WINFD;
|
||||
}
|
||||
|
||||
wfd.itransfer = itransfer;
|
||||
wfd.cancel_fn = cancel_fn;
|
||||
|
||||
if ((access_mode != RW_READ) && (access_mode != RW_WRITE)) {
|
||||
usbi_warn(NULL, "only one of RW_READ or RW_WRITE are supported.\n"
|
||||
"If you want to poll for R/W simultaneously, create multiple fds from the same handle.");
|
||||
return INVALID_WINFD;
|
||||
}
|
||||
if (access_mode == RW_READ) {
|
||||
wfd.rw = RW_READ;
|
||||
} else {
|
||||
wfd.rw = RW_WRITE;
|
||||
}
|
||||
|
||||
overlapped = create_overlapped();
|
||||
if(overlapped == NULL) {
|
||||
return INVALID_WINFD;
|
||||
}
|
||||
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
if (poll_fd[i].fd < 0) {
|
||||
EnterCriticalSection(&_poll_fd[i].mutex);
|
||||
// fd might have been removed before we got to critical
|
||||
if (poll_fd[i].fd >= 0) {
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
continue;
|
||||
}
|
||||
// Use index as the unique fd number
|
||||
wfd.fd = i;
|
||||
// Attempt to emulate some of the CancelIoEx behaviour on platforms
|
||||
// that don't have it
|
||||
if (Use_Duplicate_Handles) {
|
||||
_poll_fd[i].thread_id = GetCurrentThreadId();
|
||||
if (!DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(),
|
||||
&wfd.handle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
|
||||
usbi_dbg("could not duplicate handle for CancelIo - using original one");
|
||||
wfd.handle = handle;
|
||||
// Make sure we won't close the original handle on fd deletion then
|
||||
_poll_fd[i].original_handle = INVALID_HANDLE_VALUE;
|
||||
} else {
|
||||
_poll_fd[i].original_handle = handle;
|
||||
}
|
||||
} else {
|
||||
wfd.handle = handle;
|
||||
}
|
||||
wfd.overlapped = overlapped;
|
||||
memcpy(&poll_fd[i], &wfd, sizeof(struct winfd));
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
return wfd;
|
||||
}
|
||||
}
|
||||
free_overlapped(overlapped);
|
||||
return INVALID_WINFD;
|
||||
}
|
||||
|
||||
static void _free_index(int _index)
|
||||
{
|
||||
// Cancel any async IO (Don't care about the validity of our handles for this)
|
||||
cancel_io(_index);
|
||||
// close the duplicate handle (if we have an actual duplicate)
|
||||
if (Use_Duplicate_Handles) {
|
||||
if (_poll_fd[_index].original_handle != INVALID_HANDLE_VALUE) {
|
||||
CloseHandle(poll_fd[_index].handle);
|
||||
}
|
||||
_poll_fd[_index].original_handle = INVALID_HANDLE_VALUE;
|
||||
_poll_fd[_index].thread_id = 0;
|
||||
}
|
||||
free_overlapped(poll_fd[_index].overlapped);
|
||||
poll_fd[_index] = INVALID_WINFD;
|
||||
}
|
||||
|
||||
/*
|
||||
* Release a pollable file descriptor.
|
||||
*
|
||||
* Note that the associated Windows handle is not closed by this call
|
||||
*/
|
||||
void usbi_free_fd(struct winfd *wfd)
|
||||
{
|
||||
int _index;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
_index = _fd_to_index_and_lock(wfd->fd);
|
||||
if (_index < 0) {
|
||||
return;
|
||||
}
|
||||
_free_index(_index);
|
||||
*wfd = INVALID_WINFD;
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
* The functions below perform various conversions between fd, handle and OVERLAPPED
|
||||
*/
|
||||
struct winfd fd_to_winfd(int fd)
|
||||
{
|
||||
int i;
|
||||
struct winfd wfd;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
if (fd <= 0)
|
||||
return INVALID_WINFD;
|
||||
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
if (poll_fd[i].fd == fd) {
|
||||
EnterCriticalSection(&_poll_fd[i].mutex);
|
||||
// fd might have been deleted before we got to critical
|
||||
if (poll_fd[i].fd != fd) {
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
continue;
|
||||
}
|
||||
memcpy(&wfd, &poll_fd[i], sizeof(struct winfd));
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
return wfd;
|
||||
}
|
||||
}
|
||||
return INVALID_WINFD;
|
||||
}
|
||||
|
||||
struct winfd handle_to_winfd(HANDLE handle)
|
||||
{
|
||||
int i;
|
||||
struct winfd wfd;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
if ((handle == 0) || (handle == INVALID_HANDLE_VALUE))
|
||||
return INVALID_WINFD;
|
||||
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
if (poll_fd[i].handle == handle) {
|
||||
EnterCriticalSection(&_poll_fd[i].mutex);
|
||||
// fd might have been deleted before we got to critical
|
||||
if (poll_fd[i].handle != handle) {
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
continue;
|
||||
}
|
||||
memcpy(&wfd, &poll_fd[i], sizeof(struct winfd));
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
return wfd;
|
||||
}
|
||||
}
|
||||
return INVALID_WINFD;
|
||||
}
|
||||
|
||||
struct winfd overlapped_to_winfd(OVERLAPPED* overlapped)
|
||||
{
|
||||
int i;
|
||||
struct winfd wfd;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
if (overlapped == NULL)
|
||||
return INVALID_WINFD;
|
||||
|
||||
for (i=0; i<MAX_FDS; i++) {
|
||||
if (poll_fd[i].overlapped == overlapped) {
|
||||
EnterCriticalSection(&_poll_fd[i].mutex);
|
||||
// fd might have been deleted before we got to critical
|
||||
if (poll_fd[i].overlapped != overlapped) {
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
continue;
|
||||
}
|
||||
memcpy(&wfd, &poll_fd[i], sizeof(struct winfd));
|
||||
LeaveCriticalSection(&_poll_fd[i].mutex);
|
||||
return wfd;
|
||||
}
|
||||
}
|
||||
return INVALID_WINFD;
|
||||
}
|
||||
|
||||
/*
|
||||
* POSIX poll equivalent, using Windows OVERLAPPED
|
||||
* Currently, this function only accepts one of POLLIN or POLLOUT per fd
|
||||
* (but you can create multiple fds from the same handle for read and write)
|
||||
*/
|
||||
int usbi_poll(struct pollfd *fds, unsigned int nfds, int timeout)
|
||||
{
|
||||
unsigned i;
|
||||
int _index, object_index, triggered;
|
||||
HANDLE *handles_to_wait_on;
|
||||
int *handle_to_index;
|
||||
DWORD nb_handles_to_wait_on = 0;
|
||||
DWORD ret;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
triggered = 0;
|
||||
handles_to_wait_on = (HANDLE*) calloc(nfds+1, sizeof(HANDLE)); // +1 for fd_update
|
||||
handle_to_index = (int*) calloc(nfds, sizeof(int));
|
||||
if ((handles_to_wait_on == NULL) || (handle_to_index == NULL)) {
|
||||
errno = ENOMEM;
|
||||
triggered = -1;
|
||||
goto poll_exit;
|
||||
}
|
||||
|
||||
for (i = 0; i < nfds; ++i) {
|
||||
fds[i].revents = 0;
|
||||
|
||||
// Only one of POLLIN or POLLOUT can be selected with this version of poll (not both)
|
||||
if ((fds[i].events & ~POLLIN) && (!(fds[i].events & POLLOUT))) {
|
||||
fds[i].revents |= POLLERR;
|
||||
errno = EACCES;
|
||||
usbi_warn(NULL, "unsupported set of events");
|
||||
triggered = -1;
|
||||
goto poll_exit;
|
||||
}
|
||||
|
||||
_index = _fd_to_index_and_lock(fds[i].fd);
|
||||
poll_dbg("fd[%d]=%d: (overlapped=%p) got events %04X", i, poll_fd[_index].fd, poll_fd[_index].overlapped, fds[i].events);
|
||||
|
||||
if ( (_index < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
|
||||
|| (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL)) {
|
||||
fds[i].revents |= POLLNVAL | POLLERR;
|
||||
errno = EBADF;
|
||||
if (_index >= 0) {
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
}
|
||||
usbi_warn(NULL, "invalid fd");
|
||||
triggered = -1;
|
||||
goto poll_exit;
|
||||
}
|
||||
|
||||
// IN or OUT must match our fd direction
|
||||
if ((fds[i].events & POLLIN) && (poll_fd[_index].rw != RW_READ)) {
|
||||
fds[i].revents |= POLLNVAL | POLLERR;
|
||||
errno = EBADF;
|
||||
usbi_warn(NULL, "attempted POLLIN on fd without READ access");
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
triggered = -1;
|
||||
goto poll_exit;
|
||||
}
|
||||
|
||||
if ((fds[i].events & POLLOUT) && (poll_fd[_index].rw != RW_WRITE)) {
|
||||
fds[i].revents |= POLLNVAL | POLLERR;
|
||||
errno = EBADF;
|
||||
usbi_warn(NULL, "attempted POLLOUT on fd without WRITE access");
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
triggered = -1;
|
||||
goto poll_exit;
|
||||
}
|
||||
|
||||
// The following macro only works if overlapped I/O was reported pending
|
||||
if ( (HasOverlappedIoCompleted(poll_fd[_index].overlapped))
|
||||
|| (HasOverlappedIoCompletedSync(poll_fd[_index].overlapped)) ) {
|
||||
poll_dbg(" completed");
|
||||
// checks above should ensure this works:
|
||||
fds[i].revents = fds[i].events;
|
||||
triggered++;
|
||||
} else {
|
||||
handles_to_wait_on[nb_handles_to_wait_on] = poll_fd[_index].overlapped->hEvent;
|
||||
handle_to_index[nb_handles_to_wait_on] = i;
|
||||
nb_handles_to_wait_on++;
|
||||
}
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
}
|
||||
|
||||
// If nothing was triggered, wait on all fds that require it
|
||||
if ((timeout != 0) && (triggered == 0) && (nb_handles_to_wait_on != 0)) {
|
||||
if (timeout < 0) {
|
||||
poll_dbg("starting infinite wait for %d handles...", (int)nb_handles_to_wait_on);
|
||||
} else {
|
||||
poll_dbg("starting %d ms wait for %d handles...", timeout, (int)nb_handles_to_wait_on);
|
||||
}
|
||||
ret = WaitForMultipleObjects(nb_handles_to_wait_on, handles_to_wait_on,
|
||||
FALSE, (timeout<0)?INFINITE:(DWORD)timeout);
|
||||
object_index = ret-WAIT_OBJECT_0;
|
||||
if ((object_index >= 0) && ((DWORD)object_index < nb_handles_to_wait_on)) {
|
||||
poll_dbg(" completed after wait");
|
||||
i = handle_to_index[object_index];
|
||||
_index = _fd_to_index_and_lock(fds[i].fd);
|
||||
fds[i].revents = fds[i].events;
|
||||
triggered++;
|
||||
if (_index >= 0) {
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
}
|
||||
} else if (ret == WAIT_TIMEOUT) {
|
||||
poll_dbg(" timed out");
|
||||
triggered = 0; // 0 = timeout
|
||||
} else {
|
||||
errno = EIO;
|
||||
triggered = -1; // error
|
||||
}
|
||||
}
|
||||
|
||||
poll_exit:
|
||||
if (handles_to_wait_on != NULL) {
|
||||
free(handles_to_wait_on);
|
||||
}
|
||||
if (handle_to_index != NULL) {
|
||||
free(handle_to_index);
|
||||
}
|
||||
return triggered;
|
||||
}
|
||||
|
||||
/*
|
||||
* close a fake pipe fd
|
||||
*/
|
||||
int usbi_close(int fd)
|
||||
{
|
||||
int _index;
|
||||
int r = -1;
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
_index = _fd_to_index_and_lock(fd);
|
||||
|
||||
if (_index < 0) {
|
||||
errno = EBADF;
|
||||
} else {
|
||||
free_overlapped(poll_fd[_index].overlapped);
|
||||
poll_fd[_index] = INVALID_WINFD;
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* synchronous write for fake "pipe" signaling
|
||||
*/
|
||||
ssize_t usbi_write(int fd, const void *buf, size_t count)
|
||||
{
|
||||
int _index;
|
||||
UNUSED(buf);
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
if (count != sizeof(unsigned char)) {
|
||||
usbi_err(NULL, "this function should only used for signaling");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_index = _fd_to_index_and_lock(fd);
|
||||
|
||||
if ( (_index < 0) || (poll_fd[_index].overlapped == NULL) ) {
|
||||
errno = EBADF;
|
||||
if (_index >= 0) {
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
poll_dbg("set pipe event (fd = %d, thread = %08X)", _index, GetCurrentThreadId());
|
||||
SetEvent(poll_fd[_index].overlapped->hEvent);
|
||||
poll_fd[_index].overlapped->Internal = STATUS_WAIT_0;
|
||||
// If two threads write on the pipe at the same time, we need to
|
||||
// process two separate reads => use the overlapped as a counter
|
||||
poll_fd[_index].overlapped->InternalHigh++;
|
||||
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
return sizeof(unsigned char);
|
||||
}
|
||||
|
||||
/*
|
||||
* synchronous read for fake "pipe" signaling
|
||||
*/
|
||||
ssize_t usbi_read(int fd, void *buf, size_t count)
|
||||
{
|
||||
int _index;
|
||||
ssize_t r = -1;
|
||||
UNUSED(buf);
|
||||
|
||||
CHECK_INIT_POLLING;
|
||||
|
||||
if (count != sizeof(unsigned char)) {
|
||||
usbi_err(NULL, "this function should only used for signaling");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_index = _fd_to_index_and_lock(fd);
|
||||
|
||||
if (_index < 0) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (WaitForSingleObject(poll_fd[_index].overlapped->hEvent, INFINITE) != WAIT_OBJECT_0) {
|
||||
usbi_warn(NULL, "waiting for event failed: %d", (int)GetLastError());
|
||||
errno = EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
poll_dbg("clr pipe event (fd = %d, thread = %08X)", _index, GetCurrentThreadId());
|
||||
poll_fd[_index].overlapped->InternalHigh--;
|
||||
// Don't reset unless we don't have any more events to process
|
||||
if (poll_fd[_index].overlapped->InternalHigh <= 0) {
|
||||
ResetEvent(poll_fd[_index].overlapped->hEvent);
|
||||
poll_fd[_index].overlapped->Internal = STATUS_PENDING;
|
||||
}
|
||||
|
||||
r = sizeof(unsigned char);
|
||||
|
||||
out:
|
||||
LeaveCriticalSection(&_poll_fd[_index].mutex);
|
||||
return r;
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Windows compat: POSIX compatibility wrapper
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
* Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// disable /W4 MSVC warnings that are benign
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#endif
|
||||
|
||||
// Handle synchronous completion through the overlapped structure
|
||||
#if !defined(STATUS_REPARSE) // reuse the REPARSE status code
|
||||
#define STATUS_REPARSE ((LONG)0x00000104L)
|
||||
#endif
|
||||
#define STATUS_COMPLETED_SYNCHRONOUSLY STATUS_REPARSE
|
||||
#if defined(_WIN32_WCE)
|
||||
// WinCE doesn't have a HasOverlappedIoCompleted() macro, so attempt to emulate it
|
||||
#define HasOverlappedIoCompleted(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) != STATUS_PENDING)
|
||||
#endif
|
||||
#define HasOverlappedIoCompletedSync(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) == STATUS_COMPLETED_SYNCHRONOUSLY)
|
||||
|
||||
#define DUMMY_HANDLE ((HANDLE)(LONG_PTR)-2)
|
||||
|
||||
enum windows_version {
|
||||
WINDOWS_UNSUPPORTED,
|
||||
WINDOWS_CE,
|
||||
WINDOWS_XP,
|
||||
WINDOWS_2003, // also includes XP 64
|
||||
WINDOWS_VISTA_AND_LATER,
|
||||
};
|
||||
extern enum windows_version windows_version;
|
||||
|
||||
#define MAX_FDS 256
|
||||
|
||||
#define POLLIN 0x0001 /* There is data to read */
|
||||
#define POLLPRI 0x0002 /* There is urgent data to read */
|
||||
#define POLLOUT 0x0004 /* Writing now will not block */
|
||||
#define POLLERR 0x0008 /* Error condition */
|
||||
#define POLLHUP 0x0010 /* Hung up */
|
||||
#define POLLNVAL 0x0020 /* Invalid request: fd not open */
|
||||
|
||||
struct pollfd {
|
||||
int fd; /* file descriptor */
|
||||
short events; /* requested events */
|
||||
short revents; /* returned events */
|
||||
};
|
||||
|
||||
// access modes
|
||||
enum rw_type {
|
||||
RW_NONE,
|
||||
RW_READ,
|
||||
RW_WRITE,
|
||||
};
|
||||
|
||||
// fd struct that can be used for polling on Windows
|
||||
typedef int cancel_transfer(struct usbi_transfer *itransfer);
|
||||
|
||||
struct winfd {
|
||||
int fd; // what's exposed to libusb core
|
||||
HANDLE handle; // what we need to attach overlapped to the I/O op, so we can poll it
|
||||
OVERLAPPED* overlapped; // what will report our I/O status
|
||||
struct usbi_transfer *itransfer; // Associated transfer, or NULL if completed
|
||||
cancel_transfer *cancel_fn; // Function pointer to cancel transfer API
|
||||
enum rw_type rw; // I/O transfer direction: read *XOR* write (NOT BOTH)
|
||||
};
|
||||
extern const struct winfd INVALID_WINFD;
|
||||
|
||||
int usbi_pipe(int pipefd[2]);
|
||||
int usbi_poll(struct pollfd *fds, unsigned int nfds, int timeout);
|
||||
ssize_t usbi_write(int fd, const void *buf, size_t count);
|
||||
ssize_t usbi_read(int fd, void *buf, size_t count);
|
||||
int usbi_close(int fd);
|
||||
|
||||
void init_polling(void);
|
||||
void exit_polling(void);
|
||||
struct winfd usbi_create_fd(HANDLE handle, int access_mode,
|
||||
struct usbi_transfer *transfer, cancel_transfer *cancel_fn);
|
||||
void usbi_free_fd(struct winfd* winfd);
|
||||
struct winfd fd_to_winfd(int fd);
|
||||
struct winfd handle_to_winfd(HANDLE handle);
|
||||
struct winfd overlapped_to_winfd(OVERLAPPED* overlapped);
|
||||
|
||||
/*
|
||||
* Timeval operations
|
||||
*/
|
||||
#if defined(DDKBUILD)
|
||||
#include <winsock.h> // defines timeval functions on DDK
|
||||
#endif
|
||||
|
||||
#if !defined(TIMESPEC_TO_TIMEVAL)
|
||||
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
|
||||
(tv)->tv_sec = (long)(ts)->tv_sec; \
|
||||
(tv)->tv_usec = (long)(ts)->tv_nsec / 1000; \
|
||||
}
|
||||
#endif
|
||||
#if !defined(timersub)
|
||||
#define timersub(a, b, result) \
|
||||
do { \
|
||||
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
|
||||
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
|
||||
if ((result)->tv_usec < 0) { \
|
||||
--(result)->tv_sec; \
|
||||
(result)->tv_usec += 1000000; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* libusbx synchronization using POSIX Threads
|
||||
*
|
||||
* Copyright © 2011 Vitali Lovich <vlovich@aliph.com>
|
||||
* Copyright © 2011 Peter Stuge <peter@stuge.se>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if defined(__linux__) || defined(__OpenBSD__)
|
||||
# if defined(__linux__)
|
||||
# define _GNU_SOURCE
|
||||
# else
|
||||
# define _BSD_SOURCE
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
# include <sys/syscall.h>
|
||||
#elif defined(__APPLE__)
|
||||
# include <mach/mach.h>
|
||||
#elif defined(__CYGWIN__)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "threads_posix.h"
|
||||
|
||||
int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
|
||||
{
|
||||
int err;
|
||||
pthread_mutexattr_t stack_attr;
|
||||
if (!attr) {
|
||||
attr = &stack_attr;
|
||||
err = pthread_mutexattr_init(&stack_attr);
|
||||
if (err != 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* mutexattr_settype requires _GNU_SOURCE or _XOPEN_SOURCE >= 500 on Linux */
|
||||
err = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
if (err != 0)
|
||||
goto finish;
|
||||
|
||||
err = pthread_mutex_init(mutex, attr);
|
||||
|
||||
finish:
|
||||
if (attr == &stack_attr)
|
||||
pthread_mutexattr_destroy(&stack_attr);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int usbi_get_tid(void)
|
||||
{
|
||||
int ret = -1;
|
||||
#if defined(__linux__)
|
||||
ret = syscall(SYS_gettid);
|
||||
#elif defined(__OpenBSD__)
|
||||
/* The following only works with OpenBSD > 5.1 as it requires
|
||||
real thread support. For 5.1 and earlier, -1 is returned. */
|
||||
ret = syscall(SYS_getthrid);
|
||||
#elif defined(__APPLE__)
|
||||
ret = mach_thread_self();
|
||||
mach_port_deallocate(mach_task_self(), ret);
|
||||
#elif defined(__CYGWIN__)
|
||||
ret = GetCurrentThreadId();
|
||||
#endif
|
||||
/* TODO: NetBSD thread ID support */
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* libusbx synchronization using POSIX Threads
|
||||
*
|
||||
* Copyright © 2010 Peter Stuge <peter@stuge.se>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef LIBUSB_THREADS_POSIX_H
|
||||
#define LIBUSB_THREADS_POSIX_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define usbi_mutex_static_t pthread_mutex_t
|
||||
#define USBI_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
#define usbi_mutex_static_lock pthread_mutex_lock
|
||||
#define usbi_mutex_static_unlock pthread_mutex_unlock
|
||||
|
||||
#define usbi_mutex_t pthread_mutex_t
|
||||
#define usbi_mutex_init pthread_mutex_init
|
||||
#define usbi_mutex_lock pthread_mutex_lock
|
||||
#define usbi_mutex_unlock pthread_mutex_unlock
|
||||
#define usbi_mutex_trylock pthread_mutex_trylock
|
||||
#define usbi_mutex_destroy pthread_mutex_destroy
|
||||
|
||||
#define usbi_cond_t pthread_cond_t
|
||||
#define usbi_cond_init pthread_cond_init
|
||||
#define usbi_cond_wait pthread_cond_wait
|
||||
#define usbi_cond_timedwait pthread_cond_timedwait
|
||||
#define usbi_cond_broadcast pthread_cond_broadcast
|
||||
#define usbi_cond_destroy pthread_cond_destroy
|
||||
#define usbi_cond_signal pthread_cond_signal
|
||||
|
||||
extern int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
|
||||
|
||||
int usbi_get_tid(void);
|
||||
|
||||
#endif /* LIBUSB_THREADS_POSIX_H */
|
|
@ -0,0 +1,212 @@
|
|||
/*
|
||||
* libusbx synchronization on Microsoft Windows
|
||||
*
|
||||
* Copyright © 2010 Michael Plante <michael.plante@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <objbase.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "libusbi.h"
|
||||
|
||||
extern const uint64_t epoch_time;
|
||||
|
||||
int usbi_mutex_init(usbi_mutex_t *mutex,
|
||||
const usbi_mutexattr_t *attr) {
|
||||
UNUSED(attr);
|
||||
if(! mutex) return ((errno=EINVAL));
|
||||
*mutex = CreateMutex(NULL, FALSE, NULL);
|
||||
if(!*mutex) return ((errno=ENOMEM));
|
||||
return 0;
|
||||
}
|
||||
int usbi_mutex_destroy(usbi_mutex_t *mutex) {
|
||||
// It is not clear if CloseHandle failure is due to failure to unlock.
|
||||
// If so, this should be errno=EBUSY.
|
||||
if(!mutex || !CloseHandle(*mutex)) return ((errno=EINVAL));
|
||||
*mutex = NULL;
|
||||
return 0;
|
||||
}
|
||||
int usbi_mutex_trylock(usbi_mutex_t *mutex) {
|
||||
DWORD result;
|
||||
if(!mutex) return ((errno=EINVAL));
|
||||
result = WaitForSingleObject(*mutex, 0);
|
||||
if(result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
|
||||
return 0; // acquired (ToDo: check that abandoned is ok)
|
||||
if(result == WAIT_TIMEOUT)
|
||||
return ((errno=EBUSY));
|
||||
return ((errno=EINVAL)); // don't know how this would happen
|
||||
// so don't know proper errno
|
||||
}
|
||||
int usbi_mutex_lock(usbi_mutex_t *mutex) {
|
||||
DWORD result;
|
||||
if(!mutex) return ((errno=EINVAL));
|
||||
result = WaitForSingleObject(*mutex, INFINITE);
|
||||
if(result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
|
||||
return 0; // acquired (ToDo: check that abandoned is ok)
|
||||
return ((errno=EINVAL)); // don't know how this would happen
|
||||
// so don't know proper errno
|
||||
}
|
||||
int usbi_mutex_unlock(usbi_mutex_t *mutex) {
|
||||
if(!mutex) return ((errno=EINVAL));
|
||||
if(!ReleaseMutex(*mutex)) return ((errno=EPERM ));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usbi_mutex_static_lock(usbi_mutex_static_t *mutex) {
|
||||
if(!mutex) return ((errno=EINVAL));
|
||||
while (InterlockedExchange((LONG *)mutex, 1) == 1) {
|
||||
SleepEx(0, TRUE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex) {
|
||||
if(!mutex) return ((errno=EINVAL));
|
||||
*mutex = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usbi_cond_init(usbi_cond_t *cond,
|
||||
const usbi_condattr_t *attr) {
|
||||
UNUSED(attr);
|
||||
if(!cond) return ((errno=EINVAL));
|
||||
list_init(&cond->waiters );
|
||||
list_init(&cond->not_waiting);
|
||||
return 0;
|
||||
}
|
||||
int usbi_cond_destroy(usbi_cond_t *cond) {
|
||||
// This assumes no one is using this anymore. The check MAY NOT BE safe.
|
||||
struct usbi_cond_perthread *pos, *next_pos = NULL;
|
||||
if(!cond) return ((errno=EINVAL));
|
||||
if(!list_empty(&cond->waiters)) return ((errno=EBUSY )); // (!see above!)
|
||||
list_for_each_entry_safe(pos, next_pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
|
||||
CloseHandle(pos->event);
|
||||
list_del(&pos->list);
|
||||
free(pos);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usbi_cond_broadcast(usbi_cond_t *cond) {
|
||||
// Assumes mutex is locked; this is not in keeping with POSIX spec, but
|
||||
// libusb does this anyway, so we simplify by not adding more sync
|
||||
// primitives to the CV definition!
|
||||
int fail = 0;
|
||||
struct usbi_cond_perthread *pos;
|
||||
if(!cond) return ((errno=EINVAL));
|
||||
list_for_each_entry(pos, &cond->waiters, list, struct usbi_cond_perthread) {
|
||||
if(!SetEvent(pos->event))
|
||||
fail = 1;
|
||||
}
|
||||
// The wait function will remove its respective item from the list.
|
||||
return fail ? ((errno=EINVAL)) : 0;
|
||||
}
|
||||
int usbi_cond_signal(usbi_cond_t *cond) {
|
||||
// Assumes mutex is locked; this is not in keeping with POSIX spec, but
|
||||
// libusb does this anyway, so we simplify by not adding more sync
|
||||
// primitives to the CV definition!
|
||||
struct usbi_cond_perthread *pos;
|
||||
if(!cond) return ((errno=EINVAL));
|
||||
if(list_empty(&cond->waiters)) return 0; // no one to wakeup.
|
||||
pos = list_entry(&cond->waiters.next, struct usbi_cond_perthread, list);
|
||||
// The wait function will remove its respective item from the list.
|
||||
return SetEvent(pos->event) ? 0 : ((errno=EINVAL));
|
||||
}
|
||||
__inline static int usbi_cond_intwait(usbi_cond_t *cond,
|
||||
usbi_mutex_t *mutex,
|
||||
DWORD timeout_ms) {
|
||||
struct usbi_cond_perthread *pos;
|
||||
int found = 0, r;
|
||||
DWORD r2,tid = GetCurrentThreadId();
|
||||
if(!cond || !mutex) return ((errno=EINVAL));
|
||||
list_for_each_entry(pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
|
||||
if(tid == pos->tid) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
pos = (struct usbi_cond_perthread*) calloc(1, sizeof(struct usbi_cond_perthread));
|
||||
if(!pos) return ((errno=ENOMEM)); // This errno is not POSIX-allowed.
|
||||
pos->tid = tid;
|
||||
pos->event = CreateEvent(NULL, FALSE, FALSE, NULL); // auto-reset.
|
||||
if(!pos->event) {
|
||||
free(pos);
|
||||
return ((errno=ENOMEM));
|
||||
}
|
||||
list_add(&pos->list, &cond->not_waiting);
|
||||
}
|
||||
|
||||
list_del(&pos->list); // remove from not_waiting list.
|
||||
list_add(&pos->list, &cond->waiters);
|
||||
|
||||
r = usbi_mutex_unlock(mutex);
|
||||
if(r) return r;
|
||||
r2 = WaitForSingleObject(pos->event, timeout_ms);
|
||||
r = usbi_mutex_lock(mutex);
|
||||
if(r) return r;
|
||||
|
||||
list_del(&pos->list);
|
||||
list_add(&pos->list, &cond->not_waiting);
|
||||
|
||||
if(r2 == WAIT_TIMEOUT) return ((errno=ETIMEDOUT));
|
||||
|
||||
return 0;
|
||||
}
|
||||
// N.B.: usbi_cond_*wait() can also return ENOMEM, even though pthread_cond_*wait cannot!
|
||||
int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex) {
|
||||
return usbi_cond_intwait(cond, mutex, INFINITE);
|
||||
}
|
||||
int usbi_cond_timedwait(usbi_cond_t *cond,
|
||||
usbi_mutex_t *mutex,
|
||||
const struct timespec *abstime) {
|
||||
FILETIME filetime;
|
||||
ULARGE_INTEGER rtime;
|
||||
struct timeval targ_time, cur_time, delta_time;
|
||||
struct timespec cur_time_ns;
|
||||
DWORD millis;
|
||||
|
||||
// GetSystemTimeAsFileTime() is not available on CE
|
||||
SYSTEMTIME st;
|
||||
GetSystemTime(&st);
|
||||
SystemTimeToFileTime(&st, &filetime);
|
||||
rtime.LowPart = filetime.dwLowDateTime;
|
||||
rtime.HighPart = filetime.dwHighDateTime;
|
||||
rtime.QuadPart -= epoch_time;
|
||||
cur_time_ns.tv_sec = (long)(rtime.QuadPart / 10000000);
|
||||
cur_time_ns.tv_nsec = (long)((rtime.QuadPart % 10000000)*100);
|
||||
TIMESPEC_TO_TIMEVAL(&cur_time, &cur_time_ns);
|
||||
|
||||
TIMESPEC_TO_TIMEVAL(&targ_time, abstime);
|
||||
timersub(&targ_time, &cur_time, &delta_time);
|
||||
if(delta_time.tv_sec < 0) // abstime already passed?
|
||||
millis = 0;
|
||||
else {
|
||||
millis = delta_time.tv_usec/1000;
|
||||
millis += delta_time.tv_sec *1000;
|
||||
if (delta_time.tv_usec % 1000) // round up to next millisecond
|
||||
millis++;
|
||||
}
|
||||
|
||||
return usbi_cond_intwait(cond, mutex, millis);
|
||||
}
|
||||
|
||||
int usbi_get_tid(void) {
|
||||
return GetCurrentThreadId();
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* libusbx synchronization on Microsoft Windows
|
||||
*
|
||||
* Copyright © 2010 Michael Plante <michael.plante@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef LIBUSB_THREADS_WINDOWS_H
|
||||
#define LIBUSB_THREADS_WINDOWS_H
|
||||
|
||||
#define usbi_mutex_static_t volatile LONG
|
||||
#define USBI_MUTEX_INITIALIZER 0
|
||||
|
||||
#define usbi_mutex_t HANDLE
|
||||
|
||||
struct usbi_cond_perthread {
|
||||
struct list_head list;
|
||||
DWORD tid;
|
||||
HANDLE event;
|
||||
};
|
||||
struct usbi_cond_t_ {
|
||||
// Every time a thread touches the CV, it winds up in one of these lists.
|
||||
// It stays there until the CV is destroyed, even if the thread
|
||||
// terminates.
|
||||
struct list_head waiters;
|
||||
struct list_head not_waiting;
|
||||
};
|
||||
typedef struct usbi_cond_t_ usbi_cond_t;
|
||||
|
||||
// We *were* getting timespec from pthread.h:
|
||||
#if (!defined(HAVE_STRUCT_TIMESPEC) && !defined(_TIMESPEC_DEFINED))
|
||||
#define HAVE_STRUCT_TIMESPEC 1
|
||||
#define _TIMESPEC_DEFINED 1
|
||||
struct timespec {
|
||||
long tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif /* HAVE_STRUCT_TIMESPEC | _TIMESPEC_DEFINED */
|
||||
|
||||
// We *were* getting ETIMEDOUT from pthread.h:
|
||||
#ifndef ETIMEDOUT
|
||||
# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
|
||||
#endif
|
||||
|
||||
#define usbi_mutexattr_t void
|
||||
#define usbi_condattr_t void
|
||||
|
||||
// all Windows mutexes are recursive
|
||||
#define usbi_mutex_init_recursive(mutex, attr) usbi_mutex_init((mutex), (attr))
|
||||
|
||||
int usbi_mutex_static_lock(usbi_mutex_static_t *mutex);
|
||||
int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex);
|
||||
|
||||
|
||||
int usbi_mutex_init(usbi_mutex_t *mutex,
|
||||
const usbi_mutexattr_t *attr);
|
||||
int usbi_mutex_lock(usbi_mutex_t *mutex);
|
||||
int usbi_mutex_unlock(usbi_mutex_t *mutex);
|
||||
int usbi_mutex_trylock(usbi_mutex_t *mutex);
|
||||
int usbi_mutex_destroy(usbi_mutex_t *mutex);
|
||||
|
||||
int usbi_cond_init(usbi_cond_t *cond,
|
||||
const usbi_condattr_t *attr);
|
||||
int usbi_cond_destroy(usbi_cond_t *cond);
|
||||
int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex);
|
||||
int usbi_cond_timedwait(usbi_cond_t *cond,
|
||||
usbi_mutex_t *mutex,
|
||||
const struct timespec *abstime);
|
||||
int usbi_cond_broadcast(usbi_cond_t *cond);
|
||||
int usbi_cond_signal(usbi_cond_t *cond);
|
||||
|
||||
int usbi_get_tid(void);
|
||||
|
||||
#endif /* LIBUSB_THREADS_WINDOWS_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Windows CE backend for libusbx 1.0
|
||||
* Copyright © 2011-2013 RealVNC Ltd.
|
||||
* Portions taken from Windows backend, which is
|
||||
* Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
|
||||
* Major code testing contribution by Xiaofan Chen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "windows_common.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include "poll_windows.h"
|
||||
|
||||
#define MAX_DEVICE_COUNT 256
|
||||
|
||||
// This is a modified dump of the types in the ceusbkwrapper.h library header
|
||||
// with functions transformed into extern pointers.
|
||||
//
|
||||
// This backend dynamically loads ceusbkwrapper.dll and doesn't include
|
||||
// ceusbkwrapper.h directly to simplify the build process. The kernel
|
||||
// side wrapper driver is built using the platform image build tools,
|
||||
// which makes it difficult to reference directly from the libusbx build
|
||||
// system.
|
||||
struct UKW_DEVICE_PRIV;
|
||||
typedef struct UKW_DEVICE_PRIV *UKW_DEVICE;
|
||||
typedef UKW_DEVICE *PUKW_DEVICE, *LPUKW_DEVICE;
|
||||
|
||||
typedef struct {
|
||||
UINT8 bLength;
|
||||
UINT8 bDescriptorType;
|
||||
UINT16 bcdUSB;
|
||||
UINT8 bDeviceClass;
|
||||
UINT8 bDeviceSubClass;
|
||||
UINT8 bDeviceProtocol;
|
||||
UINT8 bMaxPacketSize0;
|
||||
UINT16 idVendor;
|
||||
UINT16 idProduct;
|
||||
UINT16 bcdDevice;
|
||||
UINT8 iManufacturer;
|
||||
UINT8 iProduct;
|
||||
UINT8 iSerialNumber;
|
||||
UINT8 bNumConfigurations;
|
||||
} UKW_DEVICE_DESCRIPTOR, *PUKW_DEVICE_DESCRIPTOR, *LPUKW_DEVICE_DESCRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 bmRequestType;
|
||||
UINT8 bRequest;
|
||||
UINT16 wValue;
|
||||
UINT16 wIndex;
|
||||
UINT16 wLength;
|
||||
} UKW_CONTROL_HEADER, *PUKW_CONTROL_HEADER, *LPUKW_CONTROL_HEADER;
|
||||
|
||||
// Collection of flags which can be used when issuing transfer requests
|
||||
/* Indicates that the transfer direction is 'in' */
|
||||
#define UKW_TF_IN_TRANSFER 0x00000001
|
||||
/* Indicates that the transfer direction is 'out' */
|
||||
#define UKW_TF_OUT_TRANSFER 0x00000000
|
||||
/* Specifies that the transfer should complete as soon as possible,
|
||||
* even if no OVERLAPPED structure has been provided. */
|
||||
#define UKW_TF_NO_WAIT 0x00000100
|
||||
/* Indicates that transfers shorter than the buffer are ok */
|
||||
#define UKW_TF_SHORT_TRANSFER_OK 0x00000200
|
||||
#define UKW_TF_SEND_TO_DEVICE 0x00010000
|
||||
#define UKW_TF_SEND_TO_INTERFACE 0x00020000
|
||||
#define UKW_TF_SEND_TO_ENDPOINT 0x00040000
|
||||
/* Don't block when waiting for memory allocations */
|
||||
#define UKW_TF_DONT_BLOCK_FOR_MEM 0x00080000
|
||||
|
||||
/* Value to use when dealing with configuration values, such as UkwGetConfigDescriptor,
|
||||
* to specify the currently active configuration for the device. */
|
||||
#define UKW_ACTIVE_CONFIGURATION -1
|
||||
|
||||
DLL_DECLARE(WINAPI, HANDLE, UkwOpenDriver, ());
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceList, (HANDLE, LPUKW_DEVICE, DWORD, LPDWORD));
|
||||
DLL_DECLARE(WINAPI, void, UkwReleaseDeviceList, (HANDLE, LPUKW_DEVICE, DWORD));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceAddress, (UKW_DEVICE, unsigned char*, unsigned char*, unsigned long*));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceDescriptor, (UKW_DEVICE, LPUKW_DEVICE_DESCRIPTOR));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwGetConfigDescriptor, (UKW_DEVICE, DWORD, LPVOID, DWORD, LPDWORD));
|
||||
DLL_DECLARE(WINAPI, void, UkwCloseDriver, (HANDLE));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwCancelTransfer, (UKW_DEVICE, LPOVERLAPPED, DWORD));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwIssueControlTransfer, (UKW_DEVICE, DWORD, LPUKW_CONTROL_HEADER, LPVOID, DWORD, LPDWORD, LPOVERLAPPED));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwClaimInterface, (UKW_DEVICE, DWORD));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwReleaseInterface, (UKW_DEVICE, DWORD));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwSetInterfaceAlternateSetting, (UKW_DEVICE, DWORD, DWORD));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwClearHaltHost, (UKW_DEVICE, UCHAR));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwClearHaltDevice, (UKW_DEVICE, UCHAR));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwGetConfig, (UKW_DEVICE, PUCHAR));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwSetConfig, (UKW_DEVICE, UCHAR));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwResetDevice, (UKW_DEVICE));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwKernelDriverActive, (UKW_DEVICE, DWORD, PBOOL));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwAttachKernelDriver, (UKW_DEVICE, DWORD));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwDetachKernelDriver, (UKW_DEVICE, DWORD));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwIssueBulkTransfer, (UKW_DEVICE, DWORD, UCHAR, LPVOID, DWORD, LPDWORD, LPOVERLAPPED));
|
||||
DLL_DECLARE(WINAPI, BOOL, UkwIsPipeHalted, (UKW_DEVICE, UCHAR, LPBOOL));
|
||||
|
||||
// Used to determine if an endpoint status really is halted on a failed transfer.
|
||||
#define STATUS_HALT_FLAG 0x1
|
||||
|
||||
struct wince_device_priv {
|
||||
UKW_DEVICE dev;
|
||||
UKW_DEVICE_DESCRIPTOR desc;
|
||||
};
|
||||
|
||||
struct wince_device_handle_priv {
|
||||
// This member isn't used, but only exists to avoid an empty structure
|
||||
// for private data for the device handle.
|
||||
int reserved;
|
||||
};
|
||||
|
||||
struct wince_transfer_priv {
|
||||
struct winfd pollable_fd;
|
||||
uint8_t interface_number;
|
||||
};
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Windows backend common header for libusbx 1.0
|
||||
*
|
||||
* This file brings together header code common between
|
||||
* the desktop Windows and Windows CE backends.
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
* Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
|
||||
* Major code testing contribution by Xiaofan Chen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Windows API default is uppercase - ugh!
|
||||
#if !defined(bool)
|
||||
#define bool BOOL
|
||||
#endif
|
||||
#if !defined(true)
|
||||
#define true TRUE
|
||||
#endif
|
||||
#if !defined(false)
|
||||
#define false FALSE
|
||||
#endif
|
||||
|
||||
#define safe_free(p) do {if (p != NULL) {free((void*)p); p = NULL;}} while(0)
|
||||
#define safe_closehandle(h) do {if (h != INVALID_HANDLE_VALUE) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0)
|
||||
#define safe_min(a, b) min((size_t)(a), (size_t)(b))
|
||||
#define safe_strcp(dst, dst_max, src, count) do {memcpy(dst, src, safe_min(count, dst_max)); \
|
||||
((char*)dst)[safe_min(count, dst_max)-1] = 0;} while(0)
|
||||
#define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1)
|
||||
#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1))
|
||||
#define safe_strcat(dst, dst_max, src) safe_strncat(dst, dst_max, src, safe_strlen(src)+1)
|
||||
#define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
|
||||
#define safe_stricmp(str1, str2) _stricmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
|
||||
#define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count)
|
||||
#define safe_strlen(str) ((str==NULL)?0:strlen(str))
|
||||
#define safe_sprintf(dst, count, ...) do {_snprintf(dst, count, __VA_ARGS__); (dst)[(count)-1] = 0; } while(0)
|
||||
#define safe_stprintf _sntprintf
|
||||
#define safe_tcslen(str) ((str==NULL)?0:_tcslen(str))
|
||||
#define safe_unref_device(dev) do {if (dev != NULL) {libusb_unref_device(dev); dev = NULL;}} while(0)
|
||||
#define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL)
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
#endif
|
||||
|
||||
#define ERR_BUFFER_SIZE 256
|
||||
#define TIMER_REQUEST_RETRY_MS 100
|
||||
#define MAX_TIMER_SEMAPHORES 128
|
||||
|
||||
|
||||
/*
|
||||
* API macros - from libusb-win32 1.x
|
||||
*/
|
||||
#define DLL_DECLARE_PREFIXNAME(api, ret, prefixname, name, args) \
|
||||
typedef ret (api * __dll_##name##_t)args; \
|
||||
static __dll_##name##_t prefixname = NULL
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define DLL_STRINGIFY(dll) #dll
|
||||
#define DLL_GET_MODULE_HANDLE(dll) GetModuleHandleA(DLL_STRINGIFY(dll))
|
||||
#define DLL_LOAD_LIBRARY(dll) LoadLibraryA(DLL_STRINGIFY(dll))
|
||||
#else
|
||||
#define DLL_STRINGIFY(dll) L#dll
|
||||
#define DLL_GET_MODULE_HANDLE(dll) GetModuleHandle(DLL_STRINGIFY(dll))
|
||||
#define DLL_LOAD_LIBRARY(dll) LoadLibrary(DLL_STRINGIFY(dll))
|
||||
#endif
|
||||
|
||||
#define DLL_LOAD_PREFIXNAME(dll, prefixname, name, ret_on_failure) \
|
||||
do { \
|
||||
HMODULE h = DLL_GET_MODULE_HANDLE(dll); \
|
||||
if (!h) \
|
||||
h = DLL_LOAD_LIBRARY(dll); \
|
||||
if (!h) { \
|
||||
if (ret_on_failure) { return LIBUSB_ERROR_NOT_FOUND; } \
|
||||
else { break; } \
|
||||
} \
|
||||
prefixname = (__dll_##name##_t)GetProcAddress(h, \
|
||||
DLL_STRINGIFY(name)); \
|
||||
if (prefixname) break; \
|
||||
prefixname = (__dll_##name##_t)GetProcAddress(h, \
|
||||
DLL_STRINGIFY(name) DLL_STRINGIFY(A)); \
|
||||
if (prefixname) break; \
|
||||
prefixname = (__dll_##name##_t)GetProcAddress(h, \
|
||||
DLL_STRINGIFY(name) DLL_STRINGIFY(W)); \
|
||||
if (prefixname) break; \
|
||||
if(ret_on_failure) \
|
||||
return LIBUSB_ERROR_NOT_FOUND; \
|
||||
} while(0)
|
||||
|
||||
#define DLL_DECLARE(api, ret, name, args) DLL_DECLARE_PREFIXNAME(api, ret, name, name, args)
|
||||
#define DLL_LOAD(dll, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, name, name, ret_on_failure)
|
||||
#define DLL_DECLARE_PREFIXED(api, ret, prefix, name, args) DLL_DECLARE_PREFIXNAME(api, ret, prefix##name, name, args)
|
||||
#define DLL_LOAD_PREFIXED(dll, prefix, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, prefix##name, name, ret_on_failure)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,918 @@
|
|||
/*
|
||||
* Windows backend for libusbx 1.0
|
||||
* Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
|
||||
* Major code testing contribution by Xiaofan Chen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "windows_common.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// disable /W4 MSVC warnings that are benign
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
#pragma warning(disable:4214) // bit field types other than int
|
||||
#pragma warning(disable:4201) // nameless struct/union
|
||||
#endif
|
||||
|
||||
// Missing from MSVC6 setupapi.h
|
||||
#if !defined(SPDRP_ADDRESS)
|
||||
#define SPDRP_ADDRESS 28
|
||||
#endif
|
||||
#if !defined(SPDRP_INSTALL_STATE)
|
||||
#define SPDRP_INSTALL_STATE 34
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__ )
|
||||
#define _stricmp stricmp
|
||||
// cygwin produces a warning unless these prototypes are defined
|
||||
extern int _snprintf(char *buffer, size_t count, const char *format, ...);
|
||||
extern char *_strdup(const char *strSource);
|
||||
// _beginthreadex is MSVCRT => unavailable for cygwin. Fallback to using CreateThread
|
||||
#define _beginthreadex(a, b, c, d, e, f) CreateThread(a, b, (LPTHREAD_START_ROUTINE)c, d, e, f)
|
||||
#endif
|
||||
|
||||
#define MAX_CTRL_BUFFER_LENGTH 4096
|
||||
#define MAX_USB_DEVICES 256
|
||||
#define MAX_USB_STRING_LENGTH 128
|
||||
#define MAX_HID_REPORT_SIZE 1024
|
||||
#define MAX_HID_DESCRIPTOR_SIZE 256
|
||||
#define MAX_GUID_STRING_LENGTH 40
|
||||
#define MAX_PATH_LENGTH 128
|
||||
#define MAX_KEY_LENGTH 256
|
||||
#define LIST_SEPARATOR ';'
|
||||
#define HTAB_SIZE 1021
|
||||
|
||||
// Handle code for HID interface that have been claimed ("dibs")
|
||||
#define INTERFACE_CLAIMED ((HANDLE)(intptr_t)0xD1B5)
|
||||
// Additional return code for HID operations that completed synchronously
|
||||
#define LIBUSB_COMPLETED (LIBUSB_SUCCESS + 1)
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/ff545978.aspx
|
||||
// http://msdn.microsoft.com/en-us/library/ff545972.aspx
|
||||
// http://msdn.microsoft.com/en-us/library/ff545982.aspx
|
||||
#if !defined(GUID_DEVINTERFACE_USB_HOST_CONTROLLER)
|
||||
const GUID GUID_DEVINTERFACE_USB_HOST_CONTROLLER = { 0x3ABF6F2D, 0x71C4, 0x462A, {0x8A, 0x92, 0x1E, 0x68, 0x61, 0xE6, 0xAF, 0x27} };
|
||||
#endif
|
||||
#if !defined(GUID_DEVINTERFACE_USB_DEVICE)
|
||||
const GUID GUID_DEVINTERFACE_USB_DEVICE = { 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED} };
|
||||
#endif
|
||||
#if !defined(GUID_DEVINTERFACE_USB_HUB)
|
||||
const GUID GUID_DEVINTERFACE_USB_HUB = { 0xF18A0E88, 0xC30C, 0x11D0, {0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8} };
|
||||
#endif
|
||||
#if !defined(GUID_DEVINTERFACE_LIBUSB0_FILTER)
|
||||
const GUID GUID_DEVINTERFACE_LIBUSB0_FILTER = { 0xF9F3FF14, 0xAE21, 0x48A0, {0x8A, 0x25, 0x80, 0x11, 0xA7, 0xA9, 0x31, 0xD9} };
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Multiple USB API backend support
|
||||
*/
|
||||
#define USB_API_UNSUPPORTED 0
|
||||
#define USB_API_HUB 1
|
||||
#define USB_API_COMPOSITE 2
|
||||
#define USB_API_WINUSBX 3
|
||||
#define USB_API_HID 4
|
||||
#define USB_API_MAX 5
|
||||
// The following is used to indicate if the HID or composite extra props have already been set.
|
||||
#define USB_API_SET (1<<USB_API_MAX)
|
||||
|
||||
// Sub-APIs for WinUSB-like driver APIs (WinUSB, libusbK, libusb-win32 through the libusbK DLL)
|
||||
// Must have the same values as the KUSB_DRVID enum from libusbk.h
|
||||
#define SUB_API_NOTSET -1
|
||||
#define SUB_API_LIBUSBK 0
|
||||
#define SUB_API_LIBUSB0 1
|
||||
#define SUB_API_WINUSB 2
|
||||
#define SUB_API_MAX 3
|
||||
|
||||
#define WINUSBX_DRV_NAMES { "libusbK", "libusb0", "WinUSB"}
|
||||
|
||||
struct windows_usb_api_backend {
|
||||
const uint8_t id;
|
||||
const char* designation;
|
||||
const char **driver_name_list; // Driver name, without .sys, e.g. "usbccgp"
|
||||
const uint8_t nb_driver_names;
|
||||
int (*init)(int sub_api, struct libusb_context *ctx);
|
||||
int (*exit)(int sub_api);
|
||||
int (*open)(int sub_api, struct libusb_device_handle *dev_handle);
|
||||
void (*close)(int sub_api, struct libusb_device_handle *dev_handle);
|
||||
int (*configure_endpoints)(int sub_api, struct libusb_device_handle *dev_handle, int iface);
|
||||
int (*claim_interface)(int sub_api, struct libusb_device_handle *dev_handle, int iface);
|
||||
int (*set_interface_altsetting)(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting);
|
||||
int (*release_interface)(int sub_api, struct libusb_device_handle *dev_handle, int iface);
|
||||
int (*clear_halt)(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint);
|
||||
int (*reset_device)(int sub_api, struct libusb_device_handle *dev_handle);
|
||||
int (*submit_bulk_transfer)(int sub_api, struct usbi_transfer *itransfer);
|
||||
int (*submit_iso_transfer)(int sub_api, struct usbi_transfer *itransfer);
|
||||
int (*submit_control_transfer)(int sub_api, struct usbi_transfer *itransfer);
|
||||
int (*abort_control)(int sub_api, struct usbi_transfer *itransfer);
|
||||
int (*abort_transfers)(int sub_api, struct usbi_transfer *itransfer);
|
||||
int (*copy_transfer_data)(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size);
|
||||
};
|
||||
|
||||
extern const struct windows_usb_api_backend usb_api_backend[USB_API_MAX];
|
||||
|
||||
#define PRINT_UNSUPPORTED_API(fname) \
|
||||
usbi_dbg("unsupported API call for '" \
|
||||
#fname "' (unrecognized device driver)"); \
|
||||
return LIBUSB_ERROR_NOT_SUPPORTED;
|
||||
|
||||
/*
|
||||
* private structures definition
|
||||
* with inline pseudo constructors/destructors
|
||||
*/
|
||||
|
||||
// TODO (v2+): move hid desc to libusb.h?
|
||||
struct libusb_hid_descriptor {
|
||||
uint8_t bLength;
|
||||
uint8_t bDescriptorType;
|
||||
uint16_t bcdHID;
|
||||
uint8_t bCountryCode;
|
||||
uint8_t bNumDescriptors;
|
||||
uint8_t bClassDescriptorType;
|
||||
uint16_t wClassDescriptorLength;
|
||||
};
|
||||
#define LIBUSB_DT_HID_SIZE 9
|
||||
#define HID_MAX_CONFIG_DESC_SIZE (LIBUSB_DT_CONFIG_SIZE + LIBUSB_DT_INTERFACE_SIZE \
|
||||
+ LIBUSB_DT_HID_SIZE + 2 * LIBUSB_DT_ENDPOINT_SIZE)
|
||||
#define HID_MAX_REPORT_SIZE 1024
|
||||
#define HID_IN_EP 0x81
|
||||
#define HID_OUT_EP 0x02
|
||||
#define LIBUSB_REQ_RECIPIENT(request_type) ((request_type) & 0x1F)
|
||||
#define LIBUSB_REQ_TYPE(request_type) ((request_type) & (0x03 << 5))
|
||||
#define LIBUSB_REQ_IN(request_type) ((request_type) & LIBUSB_ENDPOINT_IN)
|
||||
#define LIBUSB_REQ_OUT(request_type) (!LIBUSB_REQ_IN(request_type))
|
||||
|
||||
// The following are used for HID reports IOCTLs
|
||||
#define HID_CTL_CODE(id) \
|
||||
CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
#define HID_BUFFER_CTL_CODE(id) \
|
||||
CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define HID_IN_CTL_CODE(id) \
|
||||
CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
|
||||
#define HID_OUT_CTL_CODE(id) \
|
||||
CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
|
||||
#define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104)
|
||||
#define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100)
|
||||
#define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101)
|
||||
|
||||
enum libusb_hid_request_type {
|
||||
HID_REQ_GET_REPORT = 0x01,
|
||||
HID_REQ_GET_IDLE = 0x02,
|
||||
HID_REQ_GET_PROTOCOL = 0x03,
|
||||
HID_REQ_SET_REPORT = 0x09,
|
||||
HID_REQ_SET_IDLE = 0x0A,
|
||||
HID_REQ_SET_PROTOCOL = 0x0B
|
||||
};
|
||||
|
||||
enum libusb_hid_report_type {
|
||||
HID_REPORT_TYPE_INPUT = 0x01,
|
||||
HID_REPORT_TYPE_OUTPUT = 0x02,
|
||||
HID_REPORT_TYPE_FEATURE = 0x03
|
||||
};
|
||||
|
||||
struct hid_device_priv {
|
||||
uint16_t vid;
|
||||
uint16_t pid;
|
||||
uint8_t config;
|
||||
uint8_t nb_interfaces;
|
||||
bool uses_report_ids[3]; // input, ouptput, feature
|
||||
uint16_t input_report_size;
|
||||
uint16_t output_report_size;
|
||||
uint16_t feature_report_size;
|
||||
WCHAR string[3][MAX_USB_STRING_LENGTH];
|
||||
uint8_t string_index[3]; // man, prod, ser
|
||||
};
|
||||
|
||||
typedef struct libusb_device_descriptor USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
|
||||
struct windows_device_priv {
|
||||
uint8_t depth; // distance to HCD
|
||||
uint8_t port; // port number on the hub
|
||||
uint8_t active_config;
|
||||
struct libusb_device *parent_dev; // access to parent is required for usermode ops
|
||||
struct windows_usb_api_backend const *apib;
|
||||
char *path; // device interface path
|
||||
int sub_api; // for WinUSB-like APIs
|
||||
struct {
|
||||
char *path; // each interface needs a device interface path,
|
||||
struct windows_usb_api_backend const *apib; // an API backend (multiple drivers support),
|
||||
int sub_api;
|
||||
int8_t nb_endpoints; // and a set of endpoint addresses (USB_MAXENDPOINTS)
|
||||
uint8_t *endpoint;
|
||||
bool restricted_functionality; // indicates if the interface functionality is restricted
|
||||
// by Windows (eg. HID keyboards or mice cannot do R/W)
|
||||
} usb_interface[USB_MAXINTERFACES];
|
||||
struct hid_device_priv *hid;
|
||||
USB_DEVICE_DESCRIPTOR dev_descriptor;
|
||||
unsigned char **config_descriptor; // list of pointers to the cached config descriptors
|
||||
};
|
||||
|
||||
static inline struct windows_device_priv *_device_priv(struct libusb_device *dev) {
|
||||
return (struct windows_device_priv *)dev->os_priv;
|
||||
}
|
||||
|
||||
static inline void windows_device_priv_init(libusb_device* dev) {
|
||||
struct windows_device_priv* p = _device_priv(dev);
|
||||
int i;
|
||||
p->depth = 0;
|
||||
p->port = 0;
|
||||
p->parent_dev = NULL;
|
||||
p->path = NULL;
|
||||
p->apib = &usb_api_backend[USB_API_UNSUPPORTED];
|
||||
p->sub_api = SUB_API_NOTSET;
|
||||
p->hid = NULL;
|
||||
p->active_config = 0;
|
||||
p->config_descriptor = NULL;
|
||||
memset(&(p->dev_descriptor), 0, sizeof(USB_DEVICE_DESCRIPTOR));
|
||||
for (i=0; i<USB_MAXINTERFACES; i++) {
|
||||
p->usb_interface[i].path = NULL;
|
||||
p->usb_interface[i].apib = &usb_api_backend[USB_API_UNSUPPORTED];
|
||||
p->usb_interface[i].sub_api = SUB_API_NOTSET;
|
||||
p->usb_interface[i].nb_endpoints = 0;
|
||||
p->usb_interface[i].endpoint = NULL;
|
||||
p->usb_interface[i].restricted_functionality = false;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void windows_device_priv_release(libusb_device* dev) {
|
||||
struct windows_device_priv* p = _device_priv(dev);
|
||||
int i;
|
||||
safe_free(p->path);
|
||||
if ((dev->num_configurations > 0) && (p->config_descriptor != NULL)) {
|
||||
for (i=0; i < dev->num_configurations; i++)
|
||||
safe_free(p->config_descriptor[i]);
|
||||
}
|
||||
safe_free(p->config_descriptor);
|
||||
safe_free(p->hid);
|
||||
for (i=0; i<USB_MAXINTERFACES; i++) {
|
||||
safe_free(p->usb_interface[i].path);
|
||||
safe_free(p->usb_interface[i].endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
struct interface_handle_t {
|
||||
HANDLE dev_handle; // WinUSB needs an extra handle for the file
|
||||
HANDLE api_handle; // used by the API to communicate with the device
|
||||
};
|
||||
|
||||
struct windows_device_handle_priv {
|
||||
int active_interface;
|
||||
struct interface_handle_t interface_handle[USB_MAXINTERFACES];
|
||||
int autoclaim_count[USB_MAXINTERFACES]; // For auto-release
|
||||
};
|
||||
|
||||
static inline struct windows_device_handle_priv *_device_handle_priv(
|
||||
struct libusb_device_handle *handle)
|
||||
{
|
||||
return (struct windows_device_handle_priv *) handle->os_priv;
|
||||
}
|
||||
|
||||
// used for async polling functions
|
||||
struct windows_transfer_priv {
|
||||
struct winfd pollable_fd;
|
||||
uint8_t interface_number;
|
||||
uint8_t *hid_buffer; // 1 byte extended data buffer, required for HID
|
||||
uint8_t *hid_dest; // transfer buffer destination, required for HID
|
||||
size_t hid_expected_size;
|
||||
};
|
||||
|
||||
// used to match a device driver (including filter drivers) against a supported API
|
||||
struct driver_lookup {
|
||||
char list[MAX_KEY_LENGTH+1];// REG_MULTI_SZ list of services (driver) names
|
||||
const DWORD reg_prop; // SPDRP registry key to use to retreive list
|
||||
const char* designation; // internal designation (for debug output)
|
||||
};
|
||||
|
||||
/* OLE32 dependency */
|
||||
DLL_DECLARE_PREFIXED(WINAPI, HRESULT, p, CLSIDFromString, (LPCOLESTR, LPCLSID));
|
||||
|
||||
/* SetupAPI dependencies */
|
||||
DLL_DECLARE_PREFIXED(WINAPI, HDEVINFO, p, SetupDiGetClassDevsA, (const GUID*, PCSTR, HWND, DWORD));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiEnumDeviceInfo, (HDEVINFO, DWORD, PSP_DEVINFO_DATA));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiEnumDeviceInterfaces, (HDEVINFO, PSP_DEVINFO_DATA,
|
||||
const GUID*, DWORD, PSP_DEVICE_INTERFACE_DATA));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiGetDeviceInterfaceDetailA, (HDEVINFO, PSP_DEVICE_INTERFACE_DATA,
|
||||
PSP_DEVICE_INTERFACE_DETAIL_DATA_A, DWORD, PDWORD, PSP_DEVINFO_DATA));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiDestroyDeviceInfoList, (HDEVINFO));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDevRegKey, (HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiGetDeviceRegistryPropertyA, (HDEVINFO,
|
||||
PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDeviceInterfaceRegKey, (HDEVINFO, PSP_DEVICE_INTERFACE_DATA, DWORD, DWORD));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, LONG, p, RegQueryValueExW, (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD));
|
||||
DLL_DECLARE_PREFIXED(WINAPI, LONG, p, RegCloseKey, (HKEY));
|
||||
|
||||
/*
|
||||
* Windows DDK API definitions. Most of it copied from MinGW's includes
|
||||
*/
|
||||
typedef DWORD DEVNODE, DEVINST;
|
||||
typedef DEVNODE *PDEVNODE, *PDEVINST;
|
||||
typedef DWORD RETURN_TYPE;
|
||||
typedef RETURN_TYPE CONFIGRET;
|
||||
|
||||
#define CR_SUCCESS 0x00000000
|
||||
#define CR_NO_SUCH_DEVNODE 0x0000000D
|
||||
|
||||
#define USB_DEVICE_DESCRIPTOR_TYPE LIBUSB_DT_DEVICE
|
||||
#define USB_CONFIGURATION_DESCRIPTOR_TYPE LIBUSB_DT_CONFIG
|
||||
#define USB_STRING_DESCRIPTOR_TYPE LIBUSB_DT_STRING
|
||||
#define USB_INTERFACE_DESCRIPTOR_TYPE LIBUSB_DT_INTERFACE
|
||||
#define USB_ENDPOINT_DESCRIPTOR_TYPE LIBUSB_DT_ENDPOINT
|
||||
|
||||
#define USB_REQUEST_GET_STATUS LIBUSB_REQUEST_GET_STATUS
|
||||
#define USB_REQUEST_CLEAR_FEATURE LIBUSB_REQUEST_CLEAR_FEATURE
|
||||
#define USB_REQUEST_SET_FEATURE LIBUSB_REQUEST_SET_FEATURE
|
||||
#define USB_REQUEST_SET_ADDRESS LIBUSB_REQUEST_SET_ADDRESS
|
||||
#define USB_REQUEST_GET_DESCRIPTOR LIBUSB_REQUEST_GET_DESCRIPTOR
|
||||
#define USB_REQUEST_SET_DESCRIPTOR LIBUSB_REQUEST_SET_DESCRIPTOR
|
||||
#define USB_REQUEST_GET_CONFIGURATION LIBUSB_REQUEST_GET_CONFIGURATION
|
||||
#define USB_REQUEST_SET_CONFIGURATION LIBUSB_REQUEST_SET_CONFIGURATION
|
||||
#define USB_REQUEST_GET_INTERFACE LIBUSB_REQUEST_GET_INTERFACE
|
||||
#define USB_REQUEST_SET_INTERFACE LIBUSB_REQUEST_SET_INTERFACE
|
||||
#define USB_REQUEST_SYNC_FRAME LIBUSB_REQUEST_SYNCH_FRAME
|
||||
|
||||
#define USB_GET_NODE_INFORMATION 258
|
||||
#define USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION 260
|
||||
#define USB_GET_NODE_CONNECTION_NAME 261
|
||||
#define USB_GET_HUB_CAPABILITIES 271
|
||||
#if !defined(USB_GET_NODE_CONNECTION_INFORMATION_EX)
|
||||
#define USB_GET_NODE_CONNECTION_INFORMATION_EX 274
|
||||
#endif
|
||||
#if !defined(USB_GET_HUB_CAPABILITIES_EX)
|
||||
#define USB_GET_HUB_CAPABILITIES_EX 276
|
||||
#endif
|
||||
|
||||
#ifndef METHOD_BUFFERED
|
||||
#define METHOD_BUFFERED 0
|
||||
#endif
|
||||
#ifndef FILE_ANY_ACCESS
|
||||
#define FILE_ANY_ACCESS 0x00000000
|
||||
#endif
|
||||
#ifndef FILE_DEVICE_UNKNOWN
|
||||
#define FILE_DEVICE_UNKNOWN 0x00000022
|
||||
#endif
|
||||
#ifndef FILE_DEVICE_USB
|
||||
#define FILE_DEVICE_USB FILE_DEVICE_UNKNOWN
|
||||
#endif
|
||||
|
||||
#ifndef CTL_CODE
|
||||
#define CTL_CODE(DeviceType, Function, Method, Access)( \
|
||||
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
|
||||
#endif
|
||||
|
||||
typedef enum USB_CONNECTION_STATUS {
|
||||
NoDeviceConnected,
|
||||
DeviceConnected,
|
||||
DeviceFailedEnumeration,
|
||||
DeviceGeneralFailure,
|
||||
DeviceCausedOvercurrent,
|
||||
DeviceNotEnoughPower,
|
||||
DeviceNotEnoughBandwidth,
|
||||
DeviceHubNestedTooDeeply,
|
||||
DeviceInLegacyHub
|
||||
} USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;
|
||||
|
||||
typedef enum USB_HUB_NODE {
|
||||
UsbHub,
|
||||
UsbMIParent
|
||||
} USB_HUB_NODE;
|
||||
|
||||
/* Cfgmgr32.dll interface */
|
||||
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Parent, (PDEVINST, DEVINST, ULONG));
|
||||
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Child, (PDEVINST, DEVINST, ULONG));
|
||||
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Sibling, (PDEVINST, DEVINST, ULONG));
|
||||
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Device_IDA, (DEVINST, PCHAR, ULONG, ULONG));
|
||||
|
||||
#define IOCTL_USB_GET_HUB_CAPABILITIES_EX \
|
||||
CTL_CODE( FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES_EX, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_USB_GET_HUB_CAPABILITIES \
|
||||
CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION \
|
||||
CTL_CODE(FILE_DEVICE_USB, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_USB_GET_ROOT_HUB_NAME \
|
||||
CTL_CODE(FILE_DEVICE_USB, HCD_GET_ROOT_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_USB_GET_NODE_INFORMATION \
|
||||
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX \
|
||||
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION_EX, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES \
|
||||
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_ATTRIBUTES, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_USB_GET_NODE_CONNECTION_NAME \
|
||||
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
// Most of the structures below need to be packed
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct USB_INTERFACE_DESCRIPTOR {
|
||||
UCHAR bLength;
|
||||
UCHAR bDescriptorType;
|
||||
UCHAR bInterfaceNumber;
|
||||
UCHAR bAlternateSetting;
|
||||
UCHAR bNumEndpoints;
|
||||
UCHAR bInterfaceClass;
|
||||
UCHAR bInterfaceSubClass;
|
||||
UCHAR bInterfaceProtocol;
|
||||
UCHAR iInterface;
|
||||
} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
|
||||
|
||||
typedef struct USB_CONFIGURATION_DESCRIPTOR {
|
||||
UCHAR bLength;
|
||||
UCHAR bDescriptorType;
|
||||
USHORT wTotalLength;
|
||||
UCHAR bNumInterfaces;
|
||||
UCHAR bConfigurationValue;
|
||||
UCHAR iConfiguration;
|
||||
UCHAR bmAttributes;
|
||||
UCHAR MaxPower;
|
||||
} USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
|
||||
|
||||
typedef struct USB_CONFIGURATION_DESCRIPTOR_SHORT {
|
||||
struct {
|
||||
ULONG ConnectionIndex;
|
||||
struct {
|
||||
UCHAR bmRequest;
|
||||
UCHAR bRequest;
|
||||
USHORT wValue;
|
||||
USHORT wIndex;
|
||||
USHORT wLength;
|
||||
} SetupPacket;
|
||||
} req;
|
||||
USB_CONFIGURATION_DESCRIPTOR data;
|
||||
} USB_CONFIGURATION_DESCRIPTOR_SHORT;
|
||||
|
||||
typedef struct USB_ENDPOINT_DESCRIPTOR {
|
||||
UCHAR bLength;
|
||||
UCHAR bDescriptorType;
|
||||
UCHAR bEndpointAddress;
|
||||
UCHAR bmAttributes;
|
||||
USHORT wMaxPacketSize;
|
||||
UCHAR bInterval;
|
||||
} USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
|
||||
|
||||
typedef struct USB_DESCRIPTOR_REQUEST {
|
||||
ULONG ConnectionIndex;
|
||||
struct {
|
||||
UCHAR bmRequest;
|
||||
UCHAR bRequest;
|
||||
USHORT wValue;
|
||||
USHORT wIndex;
|
||||
USHORT wLength;
|
||||
} SetupPacket;
|
||||
// UCHAR Data[0];
|
||||
} USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST;
|
||||
|
||||
typedef struct USB_HUB_DESCRIPTOR {
|
||||
UCHAR bDescriptorLength;
|
||||
UCHAR bDescriptorType;
|
||||
UCHAR bNumberOfPorts;
|
||||
USHORT wHubCharacteristics;
|
||||
UCHAR bPowerOnToPowerGood;
|
||||
UCHAR bHubControlCurrent;
|
||||
UCHAR bRemoveAndPowerMask[64];
|
||||
} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
|
||||
|
||||
typedef struct USB_ROOT_HUB_NAME {
|
||||
ULONG ActualLength;
|
||||
WCHAR RootHubName[1];
|
||||
} USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME;
|
||||
|
||||
typedef struct USB_ROOT_HUB_NAME_FIXED {
|
||||
ULONG ActualLength;
|
||||
WCHAR RootHubName[MAX_PATH_LENGTH];
|
||||
} USB_ROOT_HUB_NAME_FIXED;
|
||||
|
||||
typedef struct USB_NODE_CONNECTION_NAME {
|
||||
ULONG ConnectionIndex;
|
||||
ULONG ActualLength;
|
||||
WCHAR NodeName[1];
|
||||
} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
|
||||
|
||||
typedef struct USB_NODE_CONNECTION_NAME_FIXED {
|
||||
ULONG ConnectionIndex;
|
||||
ULONG ActualLength;
|
||||
WCHAR NodeName[MAX_PATH_LENGTH];
|
||||
} USB_NODE_CONNECTION_NAME_FIXED;
|
||||
|
||||
typedef struct USB_HUB_NAME_FIXED {
|
||||
union {
|
||||
USB_ROOT_HUB_NAME_FIXED root;
|
||||
USB_NODE_CONNECTION_NAME_FIXED node;
|
||||
} u;
|
||||
} USB_HUB_NAME_FIXED;
|
||||
|
||||
typedef struct USB_HUB_INFORMATION {
|
||||
USB_HUB_DESCRIPTOR HubDescriptor;
|
||||
BOOLEAN HubIsBusPowered;
|
||||
} USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION;
|
||||
|
||||
typedef struct USB_MI_PARENT_INFORMATION {
|
||||
ULONG NumberOfInterfaces;
|
||||
} USB_MI_PARENT_INFORMATION, *PUSB_MI_PARENT_INFORMATION;
|
||||
|
||||
typedef struct USB_NODE_INFORMATION {
|
||||
USB_HUB_NODE NodeType;
|
||||
union {
|
||||
USB_HUB_INFORMATION HubInformation;
|
||||
USB_MI_PARENT_INFORMATION MiParentInformation;
|
||||
} u;
|
||||
} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;
|
||||
|
||||
typedef struct USB_PIPE_INFO {
|
||||
USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
|
||||
ULONG ScheduleOffset;
|
||||
} USB_PIPE_INFO, *PUSB_PIPE_INFO;
|
||||
|
||||
typedef struct USB_NODE_CONNECTION_INFORMATION_EX {
|
||||
ULONG ConnectionIndex;
|
||||
USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
||||
UCHAR CurrentConfigurationValue;
|
||||
UCHAR Speed;
|
||||
BOOLEAN DeviceIsHub;
|
||||
USHORT DeviceAddress;
|
||||
ULONG NumberOfOpenPipes;
|
||||
USB_CONNECTION_STATUS ConnectionStatus;
|
||||
// USB_PIPE_INFO PipeList[0];
|
||||
} USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX;
|
||||
|
||||
typedef struct USB_HUB_CAP_FLAGS {
|
||||
ULONG HubIsHighSpeedCapable:1;
|
||||
ULONG HubIsHighSpeed:1;
|
||||
ULONG HubIsMultiTtCapable:1;
|
||||
ULONG HubIsMultiTt:1;
|
||||
ULONG HubIsRoot:1;
|
||||
ULONG HubIsArmedWakeOnConnect:1;
|
||||
ULONG ReservedMBZ:26;
|
||||
} USB_HUB_CAP_FLAGS, *PUSB_HUB_CAP_FLAGS;
|
||||
|
||||
typedef struct USB_HUB_CAPABILITIES {
|
||||
ULONG HubIs2xCapable : 1;
|
||||
} USB_HUB_CAPABILITIES, *PUSB_HUB_CAPABILITIES;
|
||||
|
||||
typedef struct USB_HUB_CAPABILITIES_EX {
|
||||
USB_HUB_CAP_FLAGS CapabilityFlags;
|
||||
} USB_HUB_CAPABILITIES_EX, *PUSB_HUB_CAPABILITIES_EX;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* winusb.dll interface */
|
||||
|
||||
#define SHORT_PACKET_TERMINATE 0x01
|
||||
#define AUTO_CLEAR_STALL 0x02
|
||||
#define PIPE_TRANSFER_TIMEOUT 0x03
|
||||
#define IGNORE_SHORT_PACKETS 0x04
|
||||
#define ALLOW_PARTIAL_READS 0x05
|
||||
#define AUTO_FLUSH 0x06
|
||||
#define RAW_IO 0x07
|
||||
#define MAXIMUM_TRANSFER_SIZE 0x08
|
||||
#define AUTO_SUSPEND 0x81
|
||||
#define SUSPEND_DELAY 0x83
|
||||
#define DEVICE_SPEED 0x01
|
||||
#define LowSpeed 0x01
|
||||
#define FullSpeed 0x02
|
||||
#define HighSpeed 0x03
|
||||
|
||||
typedef enum USBD_PIPE_TYPE {
|
||||
UsbdPipeTypeControl,
|
||||
UsbdPipeTypeIsochronous,
|
||||
UsbdPipeTypeBulk,
|
||||
UsbdPipeTypeInterrupt
|
||||
} USBD_PIPE_TYPE;
|
||||
|
||||
typedef struct {
|
||||
USBD_PIPE_TYPE PipeType;
|
||||
UCHAR PipeId;
|
||||
USHORT MaximumPacketSize;
|
||||
UCHAR Interval;
|
||||
} WINUSB_PIPE_INFORMATION, *PWINUSB_PIPE_INFORMATION;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UCHAR request_type;
|
||||
UCHAR request;
|
||||
USHORT value;
|
||||
USHORT index;
|
||||
USHORT length;
|
||||
} WINUSB_SETUP_PACKET, *PWINUSB_SETUP_PACKET;
|
||||
#pragma pack()
|
||||
|
||||
typedef void *WINUSB_INTERFACE_HANDLE, *PWINUSB_INTERFACE_HANDLE;
|
||||
|
||||
typedef BOOL (WINAPI *WinUsb_AbortPipe_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR PipeID
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_ControlTransfer_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
WINUSB_SETUP_PACKET SetupPacket,
|
||||
PUCHAR Buffer,
|
||||
ULONG BufferLength,
|
||||
PULONG LengthTransferred,
|
||||
LPOVERLAPPED Overlapped
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_FlushPipe_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR PipeID
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_Free_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_GetAssociatedInterface_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR AssociatedInterfaceIndex,
|
||||
PWINUSB_INTERFACE_HANDLE AssociatedInterfaceHandle
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_GetCurrentAlternateSetting_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
PUCHAR AlternateSetting
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_GetDescriptor_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR DescriptorType,
|
||||
UCHAR Index,
|
||||
USHORT LanguageID,
|
||||
PUCHAR Buffer,
|
||||
ULONG BufferLength,
|
||||
PULONG LengthTransferred
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_GetOverlappedResult_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
LPOVERLAPPED lpOverlapped,
|
||||
LPDWORD lpNumberOfBytesTransferred,
|
||||
BOOL bWait
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_GetPipePolicy_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR PipeID,
|
||||
ULONG PolicyType,
|
||||
PULONG ValueLength,
|
||||
PVOID Value
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_GetPowerPolicy_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
ULONG PolicyType,
|
||||
PULONG ValueLength,
|
||||
PVOID Value
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_Initialize_t)(
|
||||
HANDLE DeviceHandle,
|
||||
PWINUSB_INTERFACE_HANDLE InterfaceHandle
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_QueryDeviceInformation_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
ULONG InformationType,
|
||||
PULONG BufferLength,
|
||||
PVOID Buffer
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_QueryInterfaceSettings_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR AlternateSettingNumber,
|
||||
PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_QueryPipe_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR AlternateInterfaceNumber,
|
||||
UCHAR PipeIndex,
|
||||
PWINUSB_PIPE_INFORMATION PipeInformation
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_ReadPipe_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR PipeID,
|
||||
PUCHAR Buffer,
|
||||
ULONG BufferLength,
|
||||
PULONG LengthTransferred,
|
||||
LPOVERLAPPED Overlapped
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_ResetPipe_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR PipeID
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_SetCurrentAlternateSetting_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR AlternateSetting
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_SetPipePolicy_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR PipeID,
|
||||
ULONG PolicyType,
|
||||
ULONG ValueLength,
|
||||
PVOID Value
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_SetPowerPolicy_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
ULONG PolicyType,
|
||||
ULONG ValueLength,
|
||||
PVOID Value
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_WritePipe_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle,
|
||||
UCHAR PipeID,
|
||||
PUCHAR Buffer,
|
||||
ULONG BufferLength,
|
||||
PULONG LengthTransferred,
|
||||
LPOVERLAPPED Overlapped
|
||||
);
|
||||
typedef BOOL (WINAPI *WinUsb_ResetDevice_t)(
|
||||
WINUSB_INTERFACE_HANDLE InterfaceHandle
|
||||
);
|
||||
|
||||
/* /!\ These must match the ones from the official libusbk.h */
|
||||
typedef enum _KUSB_FNID
|
||||
{
|
||||
KUSB_FNID_Init,
|
||||
KUSB_FNID_Free,
|
||||
KUSB_FNID_ClaimInterface,
|
||||
KUSB_FNID_ReleaseInterface,
|
||||
KUSB_FNID_SetAltInterface,
|
||||
KUSB_FNID_GetAltInterface,
|
||||
KUSB_FNID_GetDescriptor,
|
||||
KUSB_FNID_ControlTransfer,
|
||||
KUSB_FNID_SetPowerPolicy,
|
||||
KUSB_FNID_GetPowerPolicy,
|
||||
KUSB_FNID_SetConfiguration,
|
||||
KUSB_FNID_GetConfiguration,
|
||||
KUSB_FNID_ResetDevice,
|
||||
KUSB_FNID_Initialize,
|
||||
KUSB_FNID_SelectInterface,
|
||||
KUSB_FNID_GetAssociatedInterface,
|
||||
KUSB_FNID_Clone,
|
||||
KUSB_FNID_QueryInterfaceSettings,
|
||||
KUSB_FNID_QueryDeviceInformation,
|
||||
KUSB_FNID_SetCurrentAlternateSetting,
|
||||
KUSB_FNID_GetCurrentAlternateSetting,
|
||||
KUSB_FNID_QueryPipe,
|
||||
KUSB_FNID_SetPipePolicy,
|
||||
KUSB_FNID_GetPipePolicy,
|
||||
KUSB_FNID_ReadPipe,
|
||||
KUSB_FNID_WritePipe,
|
||||
KUSB_FNID_ResetPipe,
|
||||
KUSB_FNID_AbortPipe,
|
||||
KUSB_FNID_FlushPipe,
|
||||
KUSB_FNID_IsoReadPipe,
|
||||
KUSB_FNID_IsoWritePipe,
|
||||
KUSB_FNID_GetCurrentFrameNumber,
|
||||
KUSB_FNID_GetOverlappedResult,
|
||||
KUSB_FNID_GetProperty,
|
||||
KUSB_FNID_COUNT,
|
||||
} KUSB_FNID;
|
||||
|
||||
typedef struct _KLIB_VERSION {
|
||||
INT Major;
|
||||
INT Minor;
|
||||
INT Micro;
|
||||
INT Nano;
|
||||
} KLIB_VERSION;
|
||||
typedef KLIB_VERSION* PKLIB_VERSION;
|
||||
|
||||
typedef BOOL (WINAPI *LibK_GetProcAddress_t)(
|
||||
PVOID* ProcAddress,
|
||||
ULONG DriverID,
|
||||
ULONG FunctionID
|
||||
);
|
||||
|
||||
typedef VOID (WINAPI *LibK_GetVersion_t)(
|
||||
PKLIB_VERSION Version
|
||||
);
|
||||
|
||||
struct winusb_interface {
|
||||
bool initialized;
|
||||
WinUsb_AbortPipe_t AbortPipe;
|
||||
WinUsb_ControlTransfer_t ControlTransfer;
|
||||
WinUsb_FlushPipe_t FlushPipe;
|
||||
WinUsb_Free_t Free;
|
||||
WinUsb_GetAssociatedInterface_t GetAssociatedInterface;
|
||||
WinUsb_GetCurrentAlternateSetting_t GetCurrentAlternateSetting;
|
||||
WinUsb_GetDescriptor_t GetDescriptor;
|
||||
WinUsb_GetOverlappedResult_t GetOverlappedResult;
|
||||
WinUsb_GetPipePolicy_t GetPipePolicy;
|
||||
WinUsb_GetPowerPolicy_t GetPowerPolicy;
|
||||
WinUsb_Initialize_t Initialize;
|
||||
WinUsb_QueryDeviceInformation_t QueryDeviceInformation;
|
||||
WinUsb_QueryInterfaceSettings_t QueryInterfaceSettings;
|
||||
WinUsb_QueryPipe_t QueryPipe;
|
||||
WinUsb_ReadPipe_t ReadPipe;
|
||||
WinUsb_ResetPipe_t ResetPipe;
|
||||
WinUsb_SetCurrentAlternateSetting_t SetCurrentAlternateSetting;
|
||||
WinUsb_SetPipePolicy_t SetPipePolicy;
|
||||
WinUsb_SetPowerPolicy_t SetPowerPolicy;
|
||||
WinUsb_WritePipe_t WritePipe;
|
||||
WinUsb_ResetDevice_t ResetDevice;
|
||||
};
|
||||
|
||||
/* hid.dll interface */
|
||||
|
||||
#define HIDP_STATUS_SUCCESS 0x110000
|
||||
typedef void* PHIDP_PREPARSED_DATA;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
ULONG Size;
|
||||
USHORT VendorID;
|
||||
USHORT ProductID;
|
||||
USHORT VersionNumber;
|
||||
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
|
||||
#pragma pack()
|
||||
|
||||
typedef USHORT USAGE;
|
||||
typedef struct {
|
||||
USAGE Usage;
|
||||
USAGE UsagePage;
|
||||
USHORT InputReportByteLength;
|
||||
USHORT OutputReportByteLength;
|
||||
USHORT FeatureReportByteLength;
|
||||
USHORT Reserved[17];
|
||||
USHORT NumberLinkCollectionNodes;
|
||||
USHORT NumberInputButtonCaps;
|
||||
USHORT NumberInputValueCaps;
|
||||
USHORT NumberInputDataIndices;
|
||||
USHORT NumberOutputButtonCaps;
|
||||
USHORT NumberOutputValueCaps;
|
||||
USHORT NumberOutputDataIndices;
|
||||
USHORT NumberFeatureButtonCaps;
|
||||
USHORT NumberFeatureValueCaps;
|
||||
USHORT NumberFeatureDataIndices;
|
||||
} HIDP_CAPS, *PHIDP_CAPS;
|
||||
|
||||
typedef enum _HIDP_REPORT_TYPE {
|
||||
HidP_Input,
|
||||
HidP_Output,
|
||||
HidP_Feature
|
||||
} HIDP_REPORT_TYPE;
|
||||
|
||||
typedef struct _HIDP_VALUE_CAPS {
|
||||
USAGE UsagePage;
|
||||
UCHAR ReportID;
|
||||
BOOLEAN IsAlias;
|
||||
USHORT BitField;
|
||||
USHORT LinkCollection;
|
||||
USAGE LinkUsage;
|
||||
USAGE LinkUsagePage;
|
||||
BOOLEAN IsRange;
|
||||
BOOLEAN IsStringRange;
|
||||
BOOLEAN IsDesignatorRange;
|
||||
BOOLEAN IsAbsolute;
|
||||
BOOLEAN HasNull;
|
||||
UCHAR Reserved;
|
||||
USHORT BitSize;
|
||||
USHORT ReportCount;
|
||||
USHORT Reserved2[5];
|
||||
ULONG UnitsExp;
|
||||
ULONG Units;
|
||||
LONG LogicalMin, LogicalMax;
|
||||
LONG PhysicalMin, PhysicalMax;
|
||||
union {
|
||||
struct {
|
||||
USAGE UsageMin, UsageMax;
|
||||
USHORT StringMin, StringMax;
|
||||
USHORT DesignatorMin, DesignatorMax;
|
||||
USHORT DataIndexMin, DataIndexMax;
|
||||
} Range;
|
||||
struct {
|
||||
USAGE Usage, Reserved1;
|
||||
USHORT StringIndex, Reserved2;
|
||||
USHORT DesignatorIndex, Reserved3;
|
||||
USHORT DataIndex, Reserved4;
|
||||
} NotRange;
|
||||
} u;
|
||||
} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
|
||||
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetAttributes, (HANDLE, PHIDD_ATTRIBUTES));
|
||||
DLL_DECLARE(WINAPI, VOID, HidD_GetHidGuid, (LPGUID));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetPreparsedData, (HANDLE, PHIDP_PREPARSED_DATA *));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_FreePreparsedData, (PHIDP_PREPARSED_DATA));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetManufacturerString, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetProductString, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetSerialNumberString, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, LONG, HidP_GetCaps, (PHIDP_PREPARSED_DATA, PHIDP_CAPS));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_SetNumInputBuffers, (HANDLE, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_SetFeature, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetFeature, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetPhysicalDescriptor, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_GetInputReport, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_SetOutputReport, (HANDLE, PVOID, ULONG));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidD_FlushQueue, (HANDLE));
|
||||
DLL_DECLARE(WINAPI, BOOL, HidP_GetValueCaps, (HIDP_REPORT_TYPE, PHIDP_VALUE_CAPS, PULONG, PHIDP_PREPARSED_DATA));
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* libusb strerror code
|
||||
* Copyright © 2013 Hans de Goede <hdegoede@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libusb.h"
|
||||
#include "libusbi.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
static size_t usbi_locale = 0;
|
||||
|
||||
/** \ingroup misc
|
||||
* How to add a new \ref libusb_strerror() translation:
|
||||
* <ol>
|
||||
* <li> Download the latest \c strerror.c from:<br>
|
||||
* https://raw.github.com/libusbx/libusbx/master/libusb/sterror.c </li>
|
||||
* <li> Open the file in an UTF-8 capable editor </li>
|
||||
* <li> Add the 2 letter <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">ISO 639-1</a>
|
||||
* code for your locale at the end of \c usbi_locale_supported[]<br>
|
||||
* Eg. for Chinese, you would add "zh" so that:
|
||||
* \code... usbi_locale_supported[] = { "en", "nl", "fr" };\endcode
|
||||
* becomes:
|
||||
* \code... usbi_locale_supported[] = { "en", "nl", "fr", "zh" };\endcode </li>
|
||||
* <li> Copy the <tt>{ / * English (en) * / ... }</tt> section and add it at the end of \c usbi_localized_errors<br>
|
||||
* Eg. for Chinese, the last section of \c usbi_localized_errors could look like:
|
||||
* \code
|
||||
* }, { / * Chinese (zh) * /
|
||||
* "Success",
|
||||
* ...
|
||||
* "Other error",
|
||||
* }
|
||||
* };\endcode </li>
|
||||
* <li> Translate each of the English messages from the section you copied into your language </li>
|
||||
* <li> Save the file (in UTF-8 format) and send it to \c libusbx-devel@lists.sourceforge.net </li>
|
||||
* </ol>
|
||||
*/
|
||||
|
||||
static const char* usbi_locale_supported[] = { "en", "nl", "fr" };
|
||||
static const char* usbi_localized_errors[ARRAYSIZE(usbi_locale_supported)][LIBUSB_ERROR_COUNT] = {
|
||||
{ /* English (en) */
|
||||
"Success",
|
||||
"Input/Output Error",
|
||||
"Invalid parameter",
|
||||
"Access denied (insufficient permissions)",
|
||||
"No such device (it may have been disconnected)",
|
||||
"Entity not found",
|
||||
"Resource busy",
|
||||
"Operation timed out",
|
||||
"Overflow",
|
||||
"Pipe error",
|
||||
"System call interrupted (perhaps due to signal)",
|
||||
"Insufficient memory",
|
||||
"Operation not supported or unimplemented on this platform",
|
||||
"Other error",
|
||||
}, { /* Dutch (nl) */
|
||||
"Gelukt",
|
||||
"Invoer-/uitvoerfout",
|
||||
"Ongeldig argument",
|
||||
"Toegang geweigerd (onvoldoende toegangsrechten)",
|
||||
"Apparaat bestaat niet (verbinding met apparaat verbroken?)",
|
||||
"Niet gevonden",
|
||||
"Apparaat of hulpbron is bezig",
|
||||
"Bewerking verlopen",
|
||||
"Waarde is te groot",
|
||||
"Gebroken pijp",
|
||||
"Onderbroken systeemaanroep",
|
||||
"Onvoldoende geheugen beschikbaar",
|
||||
"Bewerking wordt niet ondersteund",
|
||||
"Andere fout",
|
||||
}, { /* French (fr) */
|
||||
"Succès",
|
||||
"Erreur d'entrée/sortie",
|
||||
"Paramètre invalide",
|
||||
"Accès refusé (permissions insuffisantes)",
|
||||
"Périphérique introuvable (peut-être déconnecté)",
|
||||
"Elément introuvable",
|
||||
"Resource déjà occupée",
|
||||
"Operation expirée",
|
||||
"Débordement",
|
||||
"Erreur de pipe",
|
||||
"Appel système abandonné (peut-être à cause d’un signal)",
|
||||
"Mémoire insuffisante",
|
||||
"Opération non supportée or non implémentée sur cette plateforme",
|
||||
"Autre erreur"
|
||||
}
|
||||
};
|
||||
|
||||
/** \ingroup misc
|
||||
* Set the language, and only the language, not the encoding! used for
|
||||
* translatable libusb messages.
|
||||
*
|
||||
* This takes a locale string in the default setlocale format: lang[-region]
|
||||
* or lang[_country_region][.codeset]. Only the lang part of the string is
|
||||
* used, and only 2 letter ISO 639-1 codes are accepted for it, such as "de".
|
||||
* The optional region, country_region or codeset parts are ignored. This
|
||||
* means that functions which return translatable strings will NOT honor the
|
||||
* specified encoding.
|
||||
* All strings returned are encoded as UTF-8 strings.
|
||||
*
|
||||
* If libusb_setlocale() is not called, all messages will be in English.
|
||||
*
|
||||
* The following functions return translatable strings: libusb_strerror().
|
||||
* Note that the libusb log messages controlled through libusb_set_debug()
|
||||
* are not translated, they are always in English.
|
||||
*
|
||||
* For POSIX UTF-8 environments if you want libusb to follow the standard
|
||||
* locale settings, call libusb_setlocale(setlocale(LC_MESSAGES, NULL)),
|
||||
* after your app has done its locale setup.
|
||||
*
|
||||
* \param locale locale-string in the form of lang[_country_region][.codeset]
|
||||
* or lang[-region], where lang is a 2 letter ISO 639-1 code
|
||||
* \returns LIBUSB_SUCCESS on success
|
||||
* \returns LIBUSB_ERROR_INVALID_PARAM if the locale doesn't meet the requirements
|
||||
* \returns LIBUSB_ERROR_NOT_FOUND if the requested language is not supported
|
||||
* \returns a LIBUSB_ERROR code on other errors
|
||||
*/
|
||||
|
||||
int API_EXPORTED libusb_setlocale(const char *locale)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if ( (locale == NULL) || (strlen(locale) < 2)
|
||||
|| ((strlen(locale) > 2) && (locale[2] != '-') && (locale[2] != '_') && (locale[2] != '.')) )
|
||||
return LIBUSB_ERROR_INVALID_PARAM;
|
||||
|
||||
for (i=0; i<ARRAYSIZE(usbi_locale_supported); i++) {
|
||||
if (strncasecmp(usbi_locale_supported[i], locale, 2) == 0)
|
||||
break;
|
||||
}
|
||||
if (i >= ARRAYSIZE(usbi_locale_supported)) {
|
||||
return LIBUSB_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
usbi_locale = i;
|
||||
|
||||
return LIBUSB_SUCCESS;
|
||||
}
|
||||
|
||||
/** \ingroup misc
|
||||
* Returns a constant string with a short description of the given error code,
|
||||
* this description is intended for displaying to the end user and will be in
|
||||
* the language set by libusb_setlocale().
|
||||
*
|
||||
* The returned string is encoded in UTF-8.
|
||||
*
|
||||
* The messages always start with a capital letter and end without any dot.
|
||||
* The caller must not free() the returned string.
|
||||
*
|
||||
* \param errcode the error code whose description is desired
|
||||
* \returns a short description of the error code in UTF-8 encoding
|
||||
*/
|
||||
DEFAULT_VISIBILITY const char* LIBUSB_CALL libusb_strerror(enum libusb_error errcode)
|
||||
{
|
||||
int errcode_index = -errcode;
|
||||
|
||||
if ((errcode_index < 0) || (errcode_index >= LIBUSB_ERROR_COUNT)) {
|
||||
/* "Other Error", which should always be our last message, is returned */
|
||||
errcode_index = LIBUSB_ERROR_COUNT - 1;
|
||||
}
|
||||
|
||||
return usbi_localized_errors[usbi_locale][errcode_index];
|
||||
}
|
|
@ -0,0 +1,307 @@
|
|||
/*
|
||||
* Synchronous I/O functions for libusbx
|
||||
* Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libusbi.h"
|
||||
|
||||
/**
|
||||
* @defgroup syncio Synchronous device I/O
|
||||
*
|
||||
* This page documents libusbx's synchronous (blocking) API for USB device I/O.
|
||||
* This interface is easy to use but has some limitations. More advanced users
|
||||
* may wish to consider using the \ref asyncio "asynchronous I/O API" instead.
|
||||
*/
|
||||
|
||||
static void LIBUSB_CALL sync_transfer_cb(struct libusb_transfer *transfer)
|
||||
{
|
||||
int *completed = transfer->user_data;
|
||||
*completed = 1;
|
||||
usbi_dbg("actual_length=%d", transfer->actual_length);
|
||||
/* caller interprets result and frees transfer */
|
||||
}
|
||||
|
||||
static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
|
||||
{
|
||||
int r, *completed = transfer->user_data;
|
||||
struct libusb_context *ctx = HANDLE_CTX(transfer->dev_handle);
|
||||
|
||||
while (!*completed) {
|
||||
r = libusb_handle_events_completed(ctx, completed);
|
||||
if (r < 0) {
|
||||
if (r == LIBUSB_ERROR_INTERRUPTED)
|
||||
continue;
|
||||
usbi_err(ctx, "libusb_handle_events failed: %s, cancelling transfer and retrying",
|
||||
libusb_error_name(r));
|
||||
libusb_cancel_transfer(transfer);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \ingroup syncio
|
||||
* Perform a USB control transfer.
|
||||
*
|
||||
* The direction of the transfer is inferred from the bmRequestType field of
|
||||
* the setup packet.
|
||||
*
|
||||
* The wValue, wIndex and wLength fields values should be given in host-endian
|
||||
* byte order.
|
||||
*
|
||||
* \param dev_handle a handle for the device to communicate with
|
||||
* \param bmRequestType the request type field for the setup packet
|
||||
* \param bRequest the request field for the setup packet
|
||||
* \param wValue the value field for the setup packet
|
||||
* \param wIndex the index field for the setup packet
|
||||
* \param data a suitably-sized data buffer for either input or output
|
||||
* (depending on direction bits within bmRequestType)
|
||||
* \param wLength the length field for the setup packet. The data buffer should
|
||||
* be at least this size.
|
||||
* \param timeout timeout (in millseconds) that this function should wait
|
||||
* before giving up due to no response being received. For an unlimited
|
||||
* timeout, use value 0.
|
||||
* \returns on success, the number of bytes actually transferred
|
||||
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
|
||||
* \returns LIBUSB_ERROR_PIPE if the control request was not supported by the
|
||||
* device
|
||||
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
|
||||
* \returns another LIBUSB_ERROR code on other failures
|
||||
*/
|
||||
int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
|
||||
uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
|
||||
unsigned char *data, uint16_t wLength, unsigned int timeout)
|
||||
{
|
||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||
unsigned char *buffer;
|
||||
int completed = 0;
|
||||
int r;
|
||||
|
||||
if (!transfer)
|
||||
return LIBUSB_ERROR_NO_MEM;
|
||||
|
||||
buffer = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
|
||||
if (!buffer) {
|
||||
libusb_free_transfer(transfer);
|
||||
return LIBUSB_ERROR_NO_MEM;
|
||||
}
|
||||
|
||||
libusb_fill_control_setup(buffer, bmRequestType, bRequest, wValue, wIndex,
|
||||
wLength);
|
||||
if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_OUT)
|
||||
memcpy(buffer + LIBUSB_CONTROL_SETUP_SIZE, data, wLength);
|
||||
|
||||
libusb_fill_control_transfer(transfer, dev_handle, buffer,
|
||||
sync_transfer_cb, &completed, timeout);
|
||||
transfer->flags = LIBUSB_TRANSFER_FREE_BUFFER;
|
||||
r = libusb_submit_transfer(transfer);
|
||||
if (r < 0) {
|
||||
libusb_free_transfer(transfer);
|
||||
return r;
|
||||
}
|
||||
|
||||
sync_transfer_wait_for_completion(transfer);
|
||||
|
||||
if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
|
||||
memcpy(data, libusb_control_transfer_get_data(transfer),
|
||||
transfer->actual_length);
|
||||
|
||||
switch (transfer->status) {
|
||||
case LIBUSB_TRANSFER_COMPLETED:
|
||||
r = transfer->actual_length;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_TIMED_OUT:
|
||||
r = LIBUSB_ERROR_TIMEOUT;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_STALL:
|
||||
r = LIBUSB_ERROR_PIPE;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_NO_DEVICE:
|
||||
r = LIBUSB_ERROR_NO_DEVICE;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_OVERFLOW:
|
||||
r = LIBUSB_ERROR_OVERFLOW;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_ERROR:
|
||||
case LIBUSB_TRANSFER_CANCELLED:
|
||||
r = LIBUSB_ERROR_IO;
|
||||
break;
|
||||
default:
|
||||
usbi_warn(HANDLE_CTX(dev_handle),
|
||||
"unrecognised status code %d", transfer->status);
|
||||
r = LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
libusb_free_transfer(transfer);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
|
||||
unsigned char endpoint, unsigned char *buffer, int length,
|
||||
int *transferred, unsigned int timeout, unsigned char type)
|
||||
{
|
||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||
int completed = 0;
|
||||
int r;
|
||||
|
||||
if (!transfer)
|
||||
return LIBUSB_ERROR_NO_MEM;
|
||||
|
||||
libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, length,
|
||||
sync_transfer_cb, &completed, timeout);
|
||||
transfer->type = type;
|
||||
|
||||
r = libusb_submit_transfer(transfer);
|
||||
if (r < 0) {
|
||||
libusb_free_transfer(transfer);
|
||||
return r;
|
||||
}
|
||||
|
||||
sync_transfer_wait_for_completion(transfer);
|
||||
|
||||
*transferred = transfer->actual_length;
|
||||
switch (transfer->status) {
|
||||
case LIBUSB_TRANSFER_COMPLETED:
|
||||
r = 0;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_TIMED_OUT:
|
||||
r = LIBUSB_ERROR_TIMEOUT;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_STALL:
|
||||
r = LIBUSB_ERROR_PIPE;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_OVERFLOW:
|
||||
r = LIBUSB_ERROR_OVERFLOW;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_NO_DEVICE:
|
||||
r = LIBUSB_ERROR_NO_DEVICE;
|
||||
break;
|
||||
case LIBUSB_TRANSFER_ERROR:
|
||||
case LIBUSB_TRANSFER_CANCELLED:
|
||||
r = LIBUSB_ERROR_IO;
|
||||
break;
|
||||
default:
|
||||
usbi_warn(HANDLE_CTX(dev_handle),
|
||||
"unrecognised status code %d", transfer->status);
|
||||
r = LIBUSB_ERROR_OTHER;
|
||||
}
|
||||
|
||||
libusb_free_transfer(transfer);
|
||||
return r;
|
||||
}
|
||||
|
||||
/** \ingroup syncio
|
||||
* Perform a USB bulk transfer. The direction of the transfer is inferred from
|
||||
* the direction bits of the endpoint address.
|
||||
*
|
||||
* For bulk reads, the <tt>length</tt> field indicates the maximum length of
|
||||
* data you are expecting to receive. If less data arrives than expected,
|
||||
* this function will return that data, so be sure to check the
|
||||
* <tt>transferred</tt> output parameter.
|
||||
*
|
||||
* You should also check the <tt>transferred</tt> parameter for bulk writes.
|
||||
* Not all of the data may have been written.
|
||||
*
|
||||
* Also check <tt>transferred</tt> when dealing with a timeout error code.
|
||||
* libusbx may have to split your transfer into a number of chunks to satisfy
|
||||
* underlying O/S requirements, meaning that the timeout may expire after
|
||||
* the first few chunks have completed. libusbx is careful not to lose any data
|
||||
* that may have been transferred; do not assume that timeout conditions
|
||||
* indicate a complete lack of I/O.
|
||||
*
|
||||
* \param dev_handle a handle for the device to communicate with
|
||||
* \param endpoint the address of a valid endpoint to communicate with
|
||||
* \param data a suitably-sized data buffer for either input or output
|
||||
* (depending on endpoint)
|
||||
* \param length for bulk writes, the number of bytes from data to be sent. for
|
||||
* bulk reads, the maximum number of bytes to receive into the data buffer.
|
||||
* \param transferred output location for the number of bytes actually
|
||||
* transferred.
|
||||
* \param timeout timeout (in millseconds) that this function should wait
|
||||
* before giving up due to no response being received. For an unlimited
|
||||
* timeout, use value 0.
|
||||
*
|
||||
* \returns 0 on success (and populates <tt>transferred</tt>)
|
||||
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates
|
||||
* <tt>transferred</tt>)
|
||||
* \returns LIBUSB_ERROR_PIPE if the endpoint halted
|
||||
* \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
|
||||
* \ref packetoverflow
|
||||
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
|
||||
* \returns another LIBUSB_ERROR code on other failures
|
||||
*/
|
||||
int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
|
||||
unsigned char endpoint, unsigned char *data, int length, int *transferred,
|
||||
unsigned int timeout)
|
||||
{
|
||||
return do_sync_bulk_transfer(dev_handle, endpoint, data, length,
|
||||
transferred, timeout, LIBUSB_TRANSFER_TYPE_BULK);
|
||||
}
|
||||
|
||||
/** \ingroup syncio
|
||||
* Perform a USB interrupt transfer. The direction of the transfer is inferred
|
||||
* from the direction bits of the endpoint address.
|
||||
*
|
||||
* For interrupt reads, the <tt>length</tt> field indicates the maximum length
|
||||
* of data you are expecting to receive. If less data arrives than expected,
|
||||
* this function will return that data, so be sure to check the
|
||||
* <tt>transferred</tt> output parameter.
|
||||
*
|
||||
* You should also check the <tt>transferred</tt> parameter for interrupt
|
||||
* writes. Not all of the data may have been written.
|
||||
*
|
||||
* Also check <tt>transferred</tt> when dealing with a timeout error code.
|
||||
* libusbx may have to split your transfer into a number of chunks to satisfy
|
||||
* underlying O/S requirements, meaning that the timeout may expire after
|
||||
* the first few chunks have completed. libusbx is careful not to lose any data
|
||||
* that may have been transferred; do not assume that timeout conditions
|
||||
* indicate a complete lack of I/O.
|
||||
*
|
||||
* The default endpoint bInterval value is used as the polling interval.
|
||||
*
|
||||
* \param dev_handle a handle for the device to communicate with
|
||||
* \param endpoint the address of a valid endpoint to communicate with
|
||||
* \param data a suitably-sized data buffer for either input or output
|
||||
* (depending on endpoint)
|
||||
* \param length for bulk writes, the number of bytes from data to be sent. for
|
||||
* bulk reads, the maximum number of bytes to receive into the data buffer.
|
||||
* \param transferred output location for the number of bytes actually
|
||||
* transferred.
|
||||
* \param timeout timeout (in millseconds) that this function should wait
|
||||
* before giving up due to no response being received. For an unlimited
|
||||
* timeout, use value 0.
|
||||
*
|
||||
* \returns 0 on success (and populates <tt>transferred</tt>)
|
||||
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
|
||||
* \returns LIBUSB_ERROR_PIPE if the endpoint halted
|
||||
* \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
|
||||
* \ref packetoverflow
|
||||
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
|
||||
* \returns another LIBUSB_ERROR code on other error
|
||||
*/
|
||||
int API_EXPORTED libusb_interrupt_transfer(
|
||||
struct libusb_device_handle *dev_handle, unsigned char endpoint,
|
||||
unsigned char *data, int length, int *transferred, unsigned int timeout)
|
||||
{
|
||||
return do_sync_bulk_transfer(dev_handle, endpoint, data, length,
|
||||
transferred, timeout, LIBUSB_TRANSFER_TYPE_INTERRUPT);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */
|
||||
#include "version_nano.h"
|
||||
#ifndef LIBUSB_MAJOR
|
||||
#define LIBUSB_MAJOR 1
|
||||
#endif
|
||||
#ifndef LIBUSB_MINOR
|
||||
#define LIBUSB_MINOR 0
|
||||
#endif
|
||||
#ifndef LIBUSB_MICRO
|
||||
#define LIBUSB_MICRO 16
|
||||
#endif
|
||||
#ifndef LIBUSB_NANO
|
||||
#define LIBUSB_NANO 0
|
||||
#endif
|
||||
/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
|
||||
#ifndef LIBUSB_RC
|
||||
#define LIBUSB_RC ""
|
||||
#endif
|
|
@ -0,0 +1 @@
|
|||
#define LIBUSB_NANO 10774
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,384 @@
|
|||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option `$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the `shared' and
|
||||
# `disable-shared' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the `static' and
|
||||
# `disable-static' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the `fast-install'
|
||||
# and `disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[lt_p=${PACKAGE-default}
|
||||
case $withval in
|
||||
yes|no) pic_mode=$withval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for lt_pkg in $withval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=default])
|
||||
|
||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
|
@ -0,0 +1,123 @@
|
|||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59 which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
|
@ -0,0 +1,23 @@
|
|||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# @configure_input@
|
||||
|
||||
# serial 3337 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.2])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3337])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.2'
|
||||
macro_revision='1.3337'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
|
@ -0,0 +1,98 @@
|
|||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
|
@ -0,0 +1,215 @@
|
|||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2012-06-26.16; # UTC
|
||||
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'automa4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,39 @@
|
|||
/* config.h. Manual config for MSVC. */
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#warn "msvc/config.h shouldn't be included for your development environment."
|
||||
#error "Please make sure the msvc/ directory is removed from your build path."
|
||||
#endif
|
||||
|
||||
/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
|
||||
#pragma warning(disable:4200)
|
||||
/* Disable: warning C6258: Using TerminateThread does not allow proper thread clean up */
|
||||
#pragma warning(disable: 6258)
|
||||
#if defined(_PREFAST_)
|
||||
/* Disable "Banned API" errors when using the MS's WDK OACR/Prefast */
|
||||
#pragma warning(disable:28719)
|
||||
/* Disable "The function 'InitializeCriticalSection' must be called from within a try/except block" */
|
||||
#pragma warning(disable:28125)
|
||||
#endif
|
||||
|
||||
/* Default visibility */
|
||||
#define DEFAULT_VISIBILITY /**/
|
||||
|
||||
/* Enable global message logging */
|
||||
#define ENABLE_LOGGING 1
|
||||
|
||||
/* Uncomment to start with debug message logging enabled */
|
||||
// #define ENABLE_DEBUG_LOGGING 1
|
||||
|
||||
/* type of second poll() argument */
|
||||
#define POLL_NFDS_TYPE unsigned int
|
||||
|
||||
/* Windows/WinCE backend */
|
||||
#if defined(_WIN32_WCE)
|
||||
#define OS_WINCE 1
|
||||
#define HAVE_MISSING_H
|
||||
#else
|
||||
#define OS_WINDOWS 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#endif
|
|
@ -0,0 +1,175 @@
|
|||
@echo off
|
||||
::# default builds static library.
|
||||
::# you can pass the following arguments (case insensitive):
|
||||
::# - "DLL" to build a DLL instead of a static library
|
||||
::# - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
|
||||
|
||||
if Test%BUILD_ALT_DIR%==Test goto usage
|
||||
|
||||
::# process commandline parameters
|
||||
set TARGET=LIBRARY
|
||||
set STATIC_LIBC=
|
||||
set version=1.0
|
||||
set PWD=%~dp0
|
||||
set BUILD_CMD=build -bcwgZ -M2
|
||||
|
||||
if "%1" == "" goto no_more_args
|
||||
::# /I for case insensitive
|
||||
if /I Test%1==TestDLL set TARGET=DYNLINK
|
||||
if /I Test%1==Test/MT set STATIC_LIBC=1
|
||||
:no_more_args
|
||||
|
||||
cd ..\libusb\os
|
||||
echo TARGETTYPE=%TARGET% > target
|
||||
copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
|
||||
del target
|
||||
@echo on
|
||||
%BUILD_CMD%
|
||||
@echo off
|
||||
if errorlevel 1 goto builderror
|
||||
cd ..\..
|
||||
|
||||
set cpudir=i386
|
||||
set destType=Win32
|
||||
if %_BUILDARCH%==x86 goto isI386
|
||||
set cpudir=amd64
|
||||
set destType=x64
|
||||
:isI386
|
||||
|
||||
set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir%
|
||||
|
||||
set dstPath=%destType%\Debug
|
||||
if %DDKBUILDENV%==chk goto isDebug
|
||||
set dstPath=%destType%\Release
|
||||
:isDebug
|
||||
|
||||
if exist %destType% goto md2
|
||||
mkdir %destType%
|
||||
:md2
|
||||
if exist %dstPath% goto md3
|
||||
mkdir %dstPath%
|
||||
:md3
|
||||
if exist %dstPath%\dll goto md4
|
||||
mkdir %dstPath%\dll
|
||||
:md4
|
||||
if exist %dstPath%\lib goto md5
|
||||
md %dstPath%\lib
|
||||
:md5
|
||||
if exist %dstPath%\examples goto md6
|
||||
md %dstPath%\examples
|
||||
:md6
|
||||
@echo on
|
||||
|
||||
@if /I NOT Test%1==TestDLL goto copylib
|
||||
copy %srcPath%\libusb-%version%.dll %dstPath%\dll
|
||||
copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
|
||||
:copylib
|
||||
copy %srcPath%\libusb-%version%.lib %dstPath%\lib
|
||||
|
||||
@echo off
|
||||
|
||||
if exist examples\listdevs_ddkbuild goto md7
|
||||
md examples\listdevs_ddkbuild
|
||||
:md7
|
||||
|
||||
cd examples\listdevs_ddkbuild
|
||||
copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
|
||||
@echo on
|
||||
%BUILD_CMD%
|
||||
@echo off
|
||||
if errorlevel 1 goto builderror
|
||||
cd ..\..
|
||||
|
||||
set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
|
||||
@echo on
|
||||
|
||||
copy %srcPath%\listdevs.exe %dstPath%\examples
|
||||
copy %srcPath%\listdevs.pdb %dstPath%\examples
|
||||
|
||||
@echo off
|
||||
|
||||
if exist examples\xusb_ddkbuild goto md8
|
||||
md examples\xusb_ddkbuild
|
||||
:md8
|
||||
|
||||
cd examples\xusb_ddkbuild
|
||||
copy ..\..\msvc\xusb_sources sources >NUL 2>&1
|
||||
@echo on
|
||||
%BUILD_CMD%
|
||||
@echo off
|
||||
if errorlevel 1 goto builderror
|
||||
cd ..\..
|
||||
|
||||
set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
|
||||
@echo on
|
||||
|
||||
copy %srcPath%\xusb.exe %dstPath%\examples
|
||||
copy %srcPath%\xusb.pdb %dstPath%\examples
|
||||
|
||||
@echo off
|
||||
|
||||
if exist examples\getopt\getopt_ddkbuild goto md9
|
||||
md examples\getopt\getopt_ddkbuild
|
||||
:md9
|
||||
|
||||
cd examples\getopt\getopt_ddkbuild
|
||||
copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
|
||||
@echo on
|
||||
%BUILD_CMD%
|
||||
@echo off
|
||||
if errorlevel 1 goto builderror
|
||||
cd ..\..\..
|
||||
|
||||
if exist examples\fxload_ddkbuild goto md10
|
||||
md examples\fxload_ddkbuild
|
||||
:md10
|
||||
|
||||
cd examples\fxload_ddkbuild
|
||||
copy ..\..\msvc\fxload_sources sources >NUL 2>&1
|
||||
@echo on
|
||||
%BUILD_CMD%
|
||||
@echo off
|
||||
if errorlevel 1 goto builderror
|
||||
cd ..\..
|
||||
|
||||
set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
|
||||
@echo on
|
||||
|
||||
copy %srcPath%\fxload.exe %dstPath%\examples
|
||||
copy %srcPath%\fxload.pdb %dstPath%\examples
|
||||
|
||||
@echo off
|
||||
|
||||
if exist examples\hotplugtest_ddkbuild goto md11
|
||||
md examples\hotplugtest_ddkbuild
|
||||
:md11
|
||||
|
||||
cd examples\hotplugtest_ddkbuild
|
||||
copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1
|
||||
@echo on
|
||||
%BUILD_CMD%
|
||||
@echo off
|
||||
if errorlevel 1 goto builderror
|
||||
cd ..\..
|
||||
|
||||
set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
|
||||
@echo on
|
||||
|
||||
copy %srcPath%\hotplugtest.exe %dstPath%\examples
|
||||
copy %srcPath%\hotplugtest.pdb %dstPath%\examples
|
||||
|
||||
@echo off
|
||||
|
||||
cd msvc
|
||||
goto done
|
||||
|
||||
:usage
|
||||
echo ddk_build must be run in a WDK build environment
|
||||
pause
|
||||
goto done
|
||||
|
||||
:builderror
|
||||
echo Build failed
|
||||
|
||||
:done
|
||||
cd %PWD%
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* errno.h
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is a part of the mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER within the package.
|
||||
*
|
||||
* Error numbers and access to error reporting.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ERRNO_H_
|
||||
#define _ERRNO_H_
|
||||
|
||||
#include <crtdefs.h>
|
||||
|
||||
/*
|
||||
* Error numbers.
|
||||
* TODO: Can't be sure of some of these assignments, I guessed from the
|
||||
* names given by strerror and the defines in the Cygnus errno.h. A lot
|
||||
* of the names from the Cygnus errno.h are not represented, and a few
|
||||
* of the descriptions returned by strerror do not obviously match
|
||||
* their error naming.
|
||||
*/
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOFILE 2 /* No such file or directory */
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted function call */
|
||||
#define EIO 5 /* Input/output error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Arg list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file descriptor */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Resource temporarily unavailable */
|
||||
#define ENOMEM 12 /* Not enough space */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
/* 15 - Unknown Error */
|
||||
#define EBUSY 16 /* strerror reports "Resource device" */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Improper link (cross-device link?) */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* Too many open files in system */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Inappropriate I/O control operation */
|
||||
/* 26 - Unknown Error */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Domain error (math functions) */
|
||||
#define ERANGE 34 /* Result too large (possibly too small) */
|
||||
/* 35 - Unknown Error */
|
||||
#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */
|
||||
#define EDEADLK 36
|
||||
#if 0
|
||||
/* 37 - Unknown Error */
|
||||
#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */
|
||||
#define ENOLCK 39 /* No locks available (46 in Cyg?) */
|
||||
#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */
|
||||
#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */
|
||||
#define EILSEQ 42 /* Illegal byte sequence */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
|
||||
* sockets.h header provided with windows32api-0.1.2.
|
||||
* You should go and put an #if 0 ... #endif around the whole block
|
||||
* of errors (look at the comment above them).
|
||||
*/
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
|
||||
* stdlib.h.
|
||||
*/
|
||||
#if defined(_UWIN) || defined(_WIN32_WCE)
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#else
|
||||
_CRTIMP int* __cdecl _errno(void);
|
||||
#define errno (*_errno())
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not RC_INVOKED */
|
||||
|
||||
#endif /* Not _ERRNO_H_ */
|
|
@ -0,0 +1,295 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file was original part of the w64 mingw-runtime package.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com>
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Date: 2010-04-02
|
||||
*/
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#error This header should only be used with Microsoft compilers
|
||||
#endif
|
||||
|
||||
/* 7.8 Format conversion of integer types <inttypes.h> */
|
||||
|
||||
#ifndef _INTTYPES_H_
|
||||
#define _INTTYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
intmax_t quot;
|
||||
intmax_t rem;
|
||||
} imaxdiv_t;
|
||||
|
||||
|
||||
/* 7.8.1 Macros for format specifiers
|
||||
*
|
||||
* MS runtime does not yet understand C9x standard "ll"
|
||||
* length specifier. It appears to treat "ll" as "l".
|
||||
* The non-standard I64 length specifier causes warning in GCC,
|
||||
* but understood by MS runtime functions.
|
||||
*/
|
||||
|
||||
/* fprintf macros for signed types */
|
||||
#define PRId8 "d"
|
||||
#define PRId16 "d"
|
||||
#define PRId32 "d"
|
||||
#define PRId64 "I64d"
|
||||
|
||||
#define PRIdLEAST8 "d"
|
||||
#define PRIdLEAST16 "d"
|
||||
#define PRIdLEAST32 "d"
|
||||
#define PRIdLEAST64 "I64d"
|
||||
|
||||
#define PRIdFAST8 "d"
|
||||
#define PRIdFAST16 "d"
|
||||
#define PRIdFAST32 "d"
|
||||
#define PRIdFAST64 "I64d"
|
||||
|
||||
#define PRIdMAX "I64d"
|
||||
|
||||
#define PRIi8 "i"
|
||||
#define PRIi16 "i"
|
||||
#define PRIi32 "i"
|
||||
#define PRIi64 "I64i"
|
||||
|
||||
#define PRIiLEAST8 "i"
|
||||
#define PRIiLEAST16 "i"
|
||||
#define PRIiLEAST32 "i"
|
||||
#define PRIiLEAST64 "I64i"
|
||||
|
||||
#define PRIiFAST8 "i"
|
||||
#define PRIiFAST16 "i"
|
||||
#define PRIiFAST32 "i"
|
||||
#define PRIiFAST64 "I64i"
|
||||
|
||||
#define PRIiMAX "I64i"
|
||||
|
||||
#define PRIo8 "o"
|
||||
#define PRIo16 "o"
|
||||
#define PRIo32 "o"
|
||||
#define PRIo64 "I64o"
|
||||
|
||||
#define PRIoLEAST8 "o"
|
||||
#define PRIoLEAST16 "o"
|
||||
#define PRIoLEAST32 "o"
|
||||
#define PRIoLEAST64 "I64o"
|
||||
|
||||
#define PRIoFAST8 "o"
|
||||
#define PRIoFAST16 "o"
|
||||
#define PRIoFAST32 "o"
|
||||
#define PRIoFAST64 "I64o"
|
||||
|
||||
#define PRIoMAX "I64o"
|
||||
|
||||
/* fprintf macros for unsigned types */
|
||||
#define PRIu8 "u"
|
||||
#define PRIu16 "u"
|
||||
#define PRIu32 "u"
|
||||
#define PRIu64 "I64u"
|
||||
|
||||
|
||||
#define PRIuLEAST8 "u"
|
||||
#define PRIuLEAST16 "u"
|
||||
#define PRIuLEAST32 "u"
|
||||
#define PRIuLEAST64 "I64u"
|
||||
|
||||
#define PRIuFAST8 "u"
|
||||
#define PRIuFAST16 "u"
|
||||
#define PRIuFAST32 "u"
|
||||
#define PRIuFAST64 "I64u"
|
||||
|
||||
#define PRIuMAX "I64u"
|
||||
|
||||
#define PRIx8 "x"
|
||||
#define PRIx16 "x"
|
||||
#define PRIx32 "x"
|
||||
#define PRIx64 "I64x"
|
||||
|
||||
#define PRIxLEAST8 "x"
|
||||
#define PRIxLEAST16 "x"
|
||||
#define PRIxLEAST32 "x"
|
||||
#define PRIxLEAST64 "I64x"
|
||||
|
||||
#define PRIxFAST8 "x"
|
||||
#define PRIxFAST16 "x"
|
||||
#define PRIxFAST32 "x"
|
||||
#define PRIxFAST64 "I64x"
|
||||
|
||||
#define PRIxMAX "I64x"
|
||||
|
||||
#define PRIX8 "X"
|
||||
#define PRIX16 "X"
|
||||
#define PRIX32 "X"
|
||||
#define PRIX64 "I64X"
|
||||
|
||||
#define PRIXLEAST8 "X"
|
||||
#define PRIXLEAST16 "X"
|
||||
#define PRIXLEAST32 "X"
|
||||
#define PRIXLEAST64 "I64X"
|
||||
|
||||
#define PRIXFAST8 "X"
|
||||
#define PRIXFAST16 "X"
|
||||
#define PRIXFAST32 "X"
|
||||
#define PRIXFAST64 "I64X"
|
||||
|
||||
#define PRIXMAX "I64X"
|
||||
|
||||
/*
|
||||
* fscanf macros for signed int types
|
||||
* NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
|
||||
* (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
|
||||
* no length identifiers
|
||||
*/
|
||||
|
||||
#define SCNd16 "hd"
|
||||
#define SCNd32 "d"
|
||||
#define SCNd64 "I64d"
|
||||
|
||||
#define SCNdLEAST16 "hd"
|
||||
#define SCNdLEAST32 "d"
|
||||
#define SCNdLEAST64 "I64d"
|
||||
|
||||
#define SCNdFAST16 "hd"
|
||||
#define SCNdFAST32 "d"
|
||||
#define SCNdFAST64 "I64d"
|
||||
|
||||
#define SCNdMAX "I64d"
|
||||
|
||||
#define SCNi16 "hi"
|
||||
#define SCNi32 "i"
|
||||
#define SCNi64 "I64i"
|
||||
|
||||
#define SCNiLEAST16 "hi"
|
||||
#define SCNiLEAST32 "i"
|
||||
#define SCNiLEAST64 "I64i"
|
||||
|
||||
#define SCNiFAST16 "hi"
|
||||
#define SCNiFAST32 "i"
|
||||
#define SCNiFAST64 "I64i"
|
||||
|
||||
#define SCNiMAX "I64i"
|
||||
|
||||
#define SCNo16 "ho"
|
||||
#define SCNo32 "o"
|
||||
#define SCNo64 "I64o"
|
||||
|
||||
#define SCNoLEAST16 "ho"
|
||||
#define SCNoLEAST32 "o"
|
||||
#define SCNoLEAST64 "I64o"
|
||||
|
||||
#define SCNoFAST16 "ho"
|
||||
#define SCNoFAST32 "o"
|
||||
#define SCNoFAST64 "I64o"
|
||||
|
||||
#define SCNoMAX "I64o"
|
||||
|
||||
#define SCNx16 "hx"
|
||||
#define SCNx32 "x"
|
||||
#define SCNx64 "I64x"
|
||||
|
||||
#define SCNxLEAST16 "hx"
|
||||
#define SCNxLEAST32 "x"
|
||||
#define SCNxLEAST64 "I64x"
|
||||
|
||||
#define SCNxFAST16 "hx"
|
||||
#define SCNxFAST32 "x"
|
||||
#define SCNxFAST64 "I64x"
|
||||
|
||||
#define SCNxMAX "I64x"
|
||||
|
||||
/* fscanf macros for unsigned int types */
|
||||
|
||||
#define SCNu16 "hu"
|
||||
#define SCNu32 "u"
|
||||
#define SCNu64 "I64u"
|
||||
|
||||
#define SCNuLEAST16 "hu"
|
||||
#define SCNuLEAST32 "u"
|
||||
#define SCNuLEAST64 "I64u"
|
||||
|
||||
#define SCNuFAST16 "hu"
|
||||
#define SCNuFAST32 "u"
|
||||
#define SCNuFAST64 "I64u"
|
||||
|
||||
#define SCNuMAX "I64u"
|
||||
|
||||
#ifdef _WIN64
|
||||
#define PRIdPTR "I64d"
|
||||
#define PRIiPTR "I64i"
|
||||
#define PRIoPTR "I64o"
|
||||
#define PRIuPTR "I64u"
|
||||
#define PRIxPTR "I64x"
|
||||
#define PRIXPTR "I64X"
|
||||
#define SCNdPTR "I64d"
|
||||
#define SCNiPTR "I64i"
|
||||
#define SCNoPTR "I64o"
|
||||
#define SCNxPTR "I64x"
|
||||
#define SCNuPTR "I64u"
|
||||
#else
|
||||
#define PRIdPTR "d"
|
||||
#define PRIiPTR "i"
|
||||
#define PRIoPTR "o"
|
||||
#define PRIuPTR "u"
|
||||
#define PRIxPTR "x"
|
||||
#define PRIXPTR "X"
|
||||
#define SCNdPTR "d"
|
||||
#define SCNiPTR "i"
|
||||
#define SCNoPTR "o"
|
||||
#define SCNxPTR "x"
|
||||
#define SCNuPTR "u"
|
||||
#endif
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
/*
|
||||
* no length modifier for char types prior to C9x
|
||||
* MS runtime scanf appears to treat "hh" as "h"
|
||||
*/
|
||||
|
||||
/* signed char */
|
||||
#define SCNd8 "hhd"
|
||||
#define SCNdLEAST8 "hhd"
|
||||
#define SCNdFAST8 "hhd"
|
||||
|
||||
#define SCNi8 "hhi"
|
||||
#define SCNiLEAST8 "hhi"
|
||||
#define SCNiFAST8 "hhi"
|
||||
|
||||
#define SCNo8 "hho"
|
||||
#define SCNoLEAST8 "hho"
|
||||
#define SCNoFAST8 "hho"
|
||||
|
||||
#define SCNx8 "hhx"
|
||||
#define SCNxLEAST8 "hhx"
|
||||
#define SCNxFAST8 "hhx"
|
||||
|
||||
/* unsigned char */
|
||||
#define SCNu8 "hhu"
|
||||
#define SCNuLEAST8 "hhu"
|
||||
#define SCNuFAST8 "hhu"
|
||||
#endif /* __STDC_VERSION__ >= 199901 */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ndef _INTTYPES_H */
|
|
@ -0,0 +1,38 @@
|
|||
#TARGETTYPE is not defined, to allow selection between static lib or DLL with ddk_build
|
||||
TARGETNAME=libusb-1.0
|
||||
DLLDEF=..\libusb-1.0.def
|
||||
|
||||
!IFNDEF MSC_WARNING_LEVEL
|
||||
MSC_WARNING_LEVEL=/W3
|
||||
!ENDIF
|
||||
|
||||
!IFDEF STATIC_LIBC
|
||||
USE_LIBCMT=1
|
||||
!ELSE
|
||||
USE_MSVCRT=1
|
||||
!ENDIF
|
||||
|
||||
INCLUDES=..;..\..\msvc;$(DDK_INC_PATH)
|
||||
C_DEFINES= $(C_DEFINES) $(LIBUSB_DEFINES) /DDDKBUILD
|
||||
|
||||
# http://jpassing.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/
|
||||
# prevents the following error when using the 64 bit static lib with Visual Studio 2010:
|
||||
# "fatal error C1001: An internal error has occurred in the compiler.
|
||||
# (compiler file 'f:\dd\vctools\compiler\utc\src\p2\p2symtab.c', line 1823)"
|
||||
# and the following with Visual Studio 2010:
|
||||
# "fatal error C1047: The object or library file 'libusb-1.0.lib' was created with
|
||||
# an older compiler than other objects; rebuild old objects and libraries"
|
||||
USER_C_FLAGS=/GL-
|
||||
|
||||
TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib
|
||||
|
||||
SOURCES=..\core.c \
|
||||
..\descriptor.c \
|
||||
..\io.c \
|
||||
..\strerror.c \
|
||||
..\sync.c \
|
||||
..\hotplug.c \
|
||||
threads_windows.c \
|
||||
poll_windows.c \
|
||||
windows_usb.c \
|
||||
..\libusb-1.0.rc
|
|
@ -0,0 +1,174 @@
|
|||
# Microsoft Developer Studio Project File - Name="libusb_static" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=libusb_static - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "libusb_static.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "libusb_static.mak" CFG="libusb_static - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "libusb_static - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libusb_static - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "libusb_static - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../Win32/Release/lib"
|
||||
# PROP Intermediate_Dir "../Win32/Release/lib"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /EHsc /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"../Win32/Release/lib/libusb-1.0.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "libusb_static - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../Win32/Debug/lib"
|
||||
# PROP Intermediate_Dir "../Win32/Debug/lib"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /GZ /EHsc /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo /n
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"../Win32/Debug/lib/libusb-1.0.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "libusb_static - Win32 Release"
|
||||
# Name "libusb_static - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\core.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\darwin_usb.c
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\descriptor.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\io.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\linux_usbfs.c
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\poll_windows.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\sync.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\threads_windows.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\windows_usb.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\darwin_usb.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\libusb.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\libusbi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\linux_usbfs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\poll_posix.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\poll_windows.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\threads_posix.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\threads_windows.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\windows_usb.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libusb\os\windows_common.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -0,0 +1,362 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libusb-1.0 (static)"
|
||||
ProjectGUID="{5AB6B770-1925-48D5-ABC2-930F3259C020}"
|
||||
RootNamespace="libusb"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\libusb"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\libusb-1.0.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\libusb"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\libusb-1.0.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\libusb"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\libusb-1.0.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\libusb"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\libusb-1.0.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\libusb\core.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\descriptor.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\hotplug.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\io.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\strerror.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\sync.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\os\threads_windows.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\os\poll_windows.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\os\windows_usb.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\hotplug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\libusb.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\libusbi.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\os\threads_windows.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\os\poll_windows.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\os\windows_usb.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\libusb\os\windows_common.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -0,0 +1,213 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="DebugFast|Win32">
|
||||
<Configuration>DebugFast</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DebugFast|x64">
|
||||
<Configuration>DebugFast</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>libusb</ProjectName>
|
||||
<ProjectGuid>{349EE8F9-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
|
||||
<RootNamespace>libusb</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\libusb\core.c" />
|
||||
<ClCompile Include="..\libusb\descriptor.c" />
|
||||
<ClCompile Include="..\libusb\hotplug.c" />
|
||||
<ClCompile Include="..\libusb\io.c" />
|
||||
<ClCompile Include="..\libusb\os\poll_windows.c" />
|
||||
<ClCompile Include="..\libusb\strerror.c" />
|
||||
<ClCompile Include="..\libusb\sync.c" />
|
||||
<ClCompile Include="..\libusb\os\threads_windows.c" />
|
||||
<ClCompile Include="..\libusb\os\windows_usb.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include=".\config.h" />
|
||||
<ClInclude Include="..\libusb\hotplug.h" />
|
||||
<ClInclude Include="..\libusb\version.h" />
|
||||
<ClInclude Include="..\libusb\version_nano.h" />
|
||||
<ClInclude Include="..\libusb\libusb.h" />
|
||||
<ClInclude Include="..\libusb\libusbi.h" />
|
||||
<ClInclude Include="..\libusb\os\poll_windows.h" />
|
||||
<ClInclude Include="..\libusb\os\threads_windows.h" />
|
||||
<ClInclude Include="..\libusb\os\windows_usb.h" />
|
||||
<ClInclude Include="..\libusb\os\windows_common.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\libusb\core.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\descriptor.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\io.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\os\poll_windows.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\strerror.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\sync.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\os\threads_windows.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\os\windows_usb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\hotplug.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include=".\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\libusb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\libusbi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\poll_windows.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\threads_windows.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\windows_usb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\windows_common.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\version_nano.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\hotplug.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>libusb-1.0 (static)</ProjectName>
|
||||
<ProjectGuid>{349EE8F9-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
|
||||
<RootNamespace>libusb</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\libusb\core.c" />
|
||||
<ClCompile Include="..\libusb\descriptor.c" />
|
||||
<ClCompile Include="..\libusb\hotplug.c" />
|
||||
<ClCompile Include="..\libusb\io.c" />
|
||||
<ClCompile Include="..\libusb\os\poll_windows.c" />
|
||||
<ClCompile Include="..\libusb\strerror.c" />
|
||||
<ClCompile Include="..\libusb\sync.c" />
|
||||
<ClCompile Include="..\libusb\os\threads_windows.c" />
|
||||
<ClCompile Include="..\libusb\os\windows_usb.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\libusb\hotplug.h" />
|
||||
<ClInclude Include="..\libusb\version.h" />
|
||||
<ClInclude Include="..\libusb\version_nano.h" />
|
||||
<ClInclude Include=".\config.h" />
|
||||
<ClInclude Include="..\libusb\libusb.h" />
|
||||
<ClInclude Include="..\libusb\libusbi.h" />
|
||||
<ClInclude Include="..\libusb\os\poll_windows.h" />
|
||||
<ClInclude Include="..\libusb\os\threads_windows.h" />
|
||||
<ClInclude Include="..\libusb\os\windows_usb.h" />
|
||||
<ClInclude Include="..\libusb\os\windows_common.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\libusb\core.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\descriptor.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\io.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\os\poll_windows.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\strerror.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\sync.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\os\threads_windows.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\os\windows_usb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libusb\hotplug.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include=".\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\libusb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\libusbi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\poll_windows.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\threads_windows.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\windows_usb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\os\windows_common.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\version_nano.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libusb\hotplug.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Source file for missing WinCE functionality
|
||||
* Copyright © 2012 RealVNC Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "missing.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <libusbi.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// The registry path to store environment variables
|
||||
#define ENVIRONMENT_REG_PATH _T("Software\\libusb\\environment")
|
||||
|
||||
/* Workaround getenv not being available on WinCE.
|
||||
* Instead look in HKLM\Software\libusb\environment */
|
||||
char *getenv(const char *name)
|
||||
{
|
||||
static char value[MAX_PATH];
|
||||
TCHAR wValue[MAX_PATH];
|
||||
WCHAR wName[MAX_PATH];
|
||||
DWORD dwType, dwData;
|
||||
HKEY hkey;
|
||||
LONG rc;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, name, -1, wName, MAX_PATH) <= 0) {
|
||||
usbi_dbg("Failed to convert environment variable name to wide string");
|
||||
return NULL;
|
||||
}
|
||||
wName[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
|
||||
|
||||
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ENVIRONMENT_REG_PATH, 0, KEY_QUERY_VALUE, &hkey);
|
||||
if (rc != ERROR_SUCCESS) {
|
||||
usbi_dbg("Failed to open registry key for getenv with error %d", rc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Attempt to read the key
|
||||
dwData = sizeof(wValue);
|
||||
rc = RegQueryValueEx(hkey, wName, NULL, &dwType,
|
||||
(LPBYTE)&wValue, &dwData);
|
||||
RegCloseKey(hkey);
|
||||
if (rc != ERROR_SUCCESS) {
|
||||
usbi_dbg("Failed to read registry key value for getenv with error %d", rc);
|
||||
return NULL;
|
||||
}
|
||||
if (dwType != REG_SZ) {
|
||||
usbi_dbg("Registry value was of type %d instead of REG_SZ", dwType);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Success in reading the key, convert from WCHAR to char
|
||||
if (WideCharToMultiByte(CP_UTF8, 0,
|
||||
wValue, dwData / sizeof(*wValue),
|
||||
value, MAX_PATH,
|
||||
NULL, NULL) <= 0) {
|
||||
usbi_dbg("Failed to convert environment variable value to narrow string");
|
||||
return NULL;
|
||||
}
|
||||
value[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
|
||||
return value;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Header file for missing WinCE functionality
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MISSING_H
|
||||
#define MISSING_H
|
||||
|
||||
/* Windows CE doesn't have SleepEx() - Fallback to Sleep() */
|
||||
#define SleepEx(m, a) Sleep(m)
|
||||
|
||||
/* Windows CE doesn't have any APIs to query environment variables.
|
||||
*
|
||||
* This contains a registry based implementation of getenv.
|
||||
*/
|
||||
char *getenv(const char *name);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,256 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file was originally part of the w64 mingw-runtime package.
|
||||
*/
|
||||
|
||||
/* ISO C9x 7.18 Integer types <stdint.h>
|
||||
* Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
|
||||
* Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com>
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Date: 2010-04-02
|
||||
*/
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#error This header should only be used with Microsoft compilers
|
||||
#endif
|
||||
|
||||
#ifndef _STDINT_H
|
||||
#define _STDINT_H
|
||||
|
||||
#ifndef _INTPTR_T_DEFINED
|
||||
#define _INTPTR_T_DEFINED
|
||||
#ifndef __intptr_t_defined
|
||||
#define __intptr_t_defined
|
||||
#undef intptr_t
|
||||
#ifdef _WIN64
|
||||
typedef __int64 intptr_t;
|
||||
#else
|
||||
typedef int intptr_t;
|
||||
#endif /* _WIN64 */
|
||||
#endif /* __intptr_t_defined */
|
||||
#endif /* _INTPTR_T_DEFINED */
|
||||
|
||||
#ifndef _UINTPTR_T_DEFINED
|
||||
#define _UINTPTR_T_DEFINED
|
||||
#ifndef __uintptr_t_defined
|
||||
#define __uintptr_t_defined
|
||||
#undef uintptr_t
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif /* _WIN64 */
|
||||
#endif /* __uintptr_t_defined */
|
||||
#endif /* _UINTPTR_T_DEFINED */
|
||||
|
||||
#ifndef _PTRDIFF_T_DEFINED
|
||||
#define _PTRDIFF_T_DEFINED
|
||||
#ifndef _PTRDIFF_T_
|
||||
#define _PTRDIFF_T_
|
||||
#undef ptrdiff_t
|
||||
#ifdef _WIN64
|
||||
typedef __int64 ptrdiff_t;
|
||||
#else
|
||||
typedef int ptrdiff_t;
|
||||
#endif /* _WIN64 */
|
||||
#endif /* _PTRDIFF_T_ */
|
||||
#endif /* _PTRDIFF_T_DEFINED */
|
||||
|
||||
#ifndef _WCHAR_T_DEFINED
|
||||
#define _WCHAR_T_DEFINED
|
||||
#ifndef __cplusplus
|
||||
typedef unsigned short wchar_t;
|
||||
#endif /* C++ */
|
||||
#endif /* _WCHAR_T_DEFINED */
|
||||
|
||||
#ifndef _WCTYPE_T_DEFINED
|
||||
#define _WCTYPE_T_DEFINED
|
||||
#ifndef _WINT_T
|
||||
#define _WINT_T
|
||||
typedef unsigned short wint_t;
|
||||
typedef unsigned short wctype_t;
|
||||
#endif /* _WINT_T */
|
||||
#endif /* _WCTYPE_T_DEFINED */
|
||||
|
||||
/* 7.18.1.1 Exact-width integer types */
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
/* 7.18.1.2 Minimum-width integer types */
|
||||
typedef signed char int_least8_t;
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef short int_least16_t;
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef int int_least32_t;
|
||||
typedef unsigned uint_least32_t;
|
||||
typedef __int64 int_least64_t;
|
||||
typedef unsigned __int64 uint_least64_t;
|
||||
|
||||
/* 7.18.1.3 Fastest minimum-width integer types
|
||||
* Not actually guaranteed to be fastest for all purposes
|
||||
* Here we use the exact-width types for 8 and 16-bit ints.
|
||||
*/
|
||||
typedef __int8 int_fast8_t;
|
||||
typedef unsigned __int8 uint_fast8_t;
|
||||
typedef __int16 int_fast16_t;
|
||||
typedef unsigned __int16 uint_fast16_t;
|
||||
typedef __int32 int_fast32_t;
|
||||
typedef unsigned __int32 uint_fast32_t;
|
||||
typedef __int64 int_fast64_t;
|
||||
typedef unsigned __int64 uint_fast64_t;
|
||||
|
||||
/* 7.18.1.5 Greatest-width integer types */
|
||||
typedef __int64 intmax_t;
|
||||
typedef unsigned __int64 uintmax_t;
|
||||
|
||||
/* 7.18.2 Limits of specified-width integer types */
|
||||
|
||||
/* 7.18.2.1 Limits of exact-width integer types */
|
||||
#define INT8_MIN (-128)
|
||||
#define INT16_MIN (-32768)
|
||||
#define INT32_MIN (-2147483647 - 1)
|
||||
#define INT64_MIN (-9223372036854775807LL - 1)
|
||||
|
||||
#define INT8_MAX 127
|
||||
#define INT16_MAX 32767
|
||||
#define INT32_MAX 2147483647
|
||||
#define INT64_MAX 9223372036854775807LL
|
||||
|
||||
#define UINT8_MAX 255
|
||||
#define UINT16_MAX 65535
|
||||
#define UINT32_MAX 0xffffffffU /* 4294967295U */
|
||||
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
|
||||
|
||||
/* 7.18.2.2 Limits of minimum-width integer types */
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
/* 7.18.2.3 Limits of fastest minimum-width integer types */
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
/* 7.18.2.4 Limits of integer types capable of holding
|
||||
object pointers */
|
||||
#ifdef _WIN64
|
||||
#define INTPTR_MIN INT64_MIN
|
||||
#define INTPTR_MAX INT64_MAX
|
||||
#define UINTPTR_MAX UINT64_MAX
|
||||
#else
|
||||
#define INTPTR_MIN INT32_MIN
|
||||
#define INTPTR_MAX INT32_MAX
|
||||
#define UINTPTR_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.2.5 Limits of greatest-width integer types */
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
/* 7.18.3 Limits of other integer types */
|
||||
#ifdef _WIN64
|
||||
#define PTRDIFF_MIN INT64_MIN
|
||||
#define PTRDIFF_MAX INT64_MAX
|
||||
#else
|
||||
#define PTRDIFF_MIN INT32_MIN
|
||||
#define PTRDIFF_MAX INT32_MAX
|
||||
#endif
|
||||
|
||||
#define SIG_ATOMIC_MIN INT32_MIN
|
||||
#define SIG_ATOMIC_MAX INT32_MAX
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
#ifdef _WIN64
|
||||
#define SIZE_MAX UINT64_MAX
|
||||
#else
|
||||
#define SIZE_MAX UINT32_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef WCHAR_MIN /* also in wchar.h */
|
||||
#define WCHAR_MIN 0U
|
||||
#define WCHAR_MAX 0xffffU
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wint_t is unsigned short for compatibility with MS runtime
|
||||
*/
|
||||
#define WINT_MIN 0U
|
||||
#define WINT_MAX 0xffffU
|
||||
|
||||
|
||||
/* 7.18.4 Macros for integer constants */
|
||||
|
||||
/* 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
Accoding to Douglas Gwyn <gwyn@arl.mil>:
|
||||
"This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
|
||||
9899:1999 as initially published, the expansion was required
|
||||
to be an integer constant of precisely matching type, which
|
||||
is impossible to accomplish for the shorter types on most
|
||||
platforms, because C99 provides no standard way to designate
|
||||
an integer constant with width less than that of type int.
|
||||
TC1 changed this to require just an integer constant
|
||||
*expression* with *promoted* type."
|
||||
|
||||
The trick used here is from Clive D W Feather.
|
||||
*/
|
||||
|
||||
#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val))
|
||||
#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val))
|
||||
#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val))
|
||||
/* The 'trick' doesn't work in C89 for long long because, without
|
||||
suffix, (val) will be evaluated as int, not intmax_t */
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) (val)
|
||||
#define UINT16_C(val) (val)
|
||||
#define UINT32_C(val) (val##i32)
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
/* 7.18.4.2 Macros for greatest-width integer constants */
|
||||
#define INTMAX_C(val) val##i64
|
||||
#define UINTMAX_C(val) val##ui64
|
||||
|
||||
#endif
|
|
@ -115,7 +115,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusbx\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -127,7 +127,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusbx\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -139,7 +139,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusbx\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -153,7 +153,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusbx\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -167,7 +167,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusbx\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -181,7 +181,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\miniupnpc\src;..\..\..\Externals\polarssl\include;..\..\..\Externals\libusbx\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
|
@ -9,19 +9,6 @@
|
|||
#include "WII_IPC_HLE_Device_hid.h"
|
||||
#include "errno.h"
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
# include <time.h>
|
||||
#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */
|
||||
#define _TIMEVAL_DEFINED
|
||||
struct timeval {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
};
|
||||
#endif /* _TIMEVAL_DEFINED */
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#define MAX_DEVICE_DEVNUM 256
|
||||
static u64 hidDeviceAliases[MAX_DEVICE_DEVNUM];
|
||||
|
||||
|
@ -535,6 +522,8 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
|||
|
||||
if (cnt < 0)
|
||||
return NULL;
|
||||
|
||||
static bool has_warned_about_drivers = false;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
libusb_device *device = list[i];
|
||||
|
@ -569,7 +558,12 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
|||
#ifdef _WIN32
|
||||
else if (ret == LIBUSB_ERROR_NOT_SUPPORTED)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HID, "Please install the libusb drivers for the device %04X:%04X", desc.idVendor, desc.idProduct);
|
||||
if(!has_warned_about_drivers)
|
||||
{
|
||||
// Max of one warning.
|
||||
has_warned_about_drivers = true;
|
||||
WARN_LOG(WII_IPC_HID, "Please install the libusb drivers for the device %04X:%04X", desc.idVendor, desc.idProduct);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
|
|
|
@ -348,6 +348,9 @@ xcopy "$(SolutionDir)..\Externals\msvcrt\$(PlatformName)\*.dll" "$(TargetDir)" /
|
|||
<ProjectReference Include="..\..\..\Externals\libpng\png\png.vcxproj">
|
||||
<Project>{01573c36-ac6e-49f6-94ba-572517eb9740}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Externals\libusbx\msvc\libusb_static_2010.vcxproj">
|
||||
<Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Externals\LZO\LZO.vcxproj">
|
||||
<Project>{d8890b98-26f7-4cff-bbfb-b95f371b5f20}</Project>
|
||||
</ProjectReference>
|
||||
|
@ -356,6 +359,11 @@ xcopy "$(SolutionDir)..\Externals\msvcrt\$(PlatformName)\*.dll" "$(TargetDir)" /
|
|||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Externals\SFML\build\vc2010\SFML_Network.vcxproj">
|
||||
<Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project>
|
||||
<Private>true</Private>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Externals\wxWidgets3\build\msw\wx_base.vcxproj">
|
||||
<Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project>
|
||||
|
@ -400,4 +408,4 @@ xcopy "$(SolutionDir)..\Externals\msvcrt\$(PlatformName)\*.dll" "$(TargetDir)" /
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -12,6 +12,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\D
|
|||
{C87A4178-44F6-49B2-B7AA-C79AF1B8C534} = {C87A4178-44F6-49B2-B7AA-C79AF1B8C534}
|
||||
{B39AC394-5DB5-4DA9-9D98-09D46CA3701F} = {B39AC394-5DB5-4DA9-9D98-09D46CA3701F}
|
||||
{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} = {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {349EE8F9-7D25-4909-AAF5-FF3FADE72187}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "Core\Common\Common.vcxproj", "{C87A4178-44F6-49B2-B7AA-C79AF1B8C534}"
|
||||
|
@ -51,6 +52,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core\Core.vcxp
|
|||
{C87A4178-44F6-49B2-B7AA-C79AF1B8C534} = {C87A4178-44F6-49B2-B7AA-C79AF1B8C534}
|
||||
{B39AC394-5DB5-4DA9-9D98-09D46CA3701F} = {B39AC394-5DB5-4DA9-9D98-09D46CA3701F}
|
||||
{D8890B98-26F7-4CFF-BBFB-B95F371B5F20} = {D8890B98-26F7-4CFF-BBFB-B95F371B5F20}
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {349EE8F9-7D25-4909-AAF5-FF3FADE72187}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bochs_disasm", "..\Externals\Bochs_disasm\Bochs_disasm.vcxproj", "{CD3D4C3C-1027-4D33-B047-AEC7B56D0BF6}"
|
||||
|
@ -120,6 +122,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\Unit
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniupnpc", "..\Externals\miniupnpc\miniupnpc.vcxproj", "{A680190D-0764-485B-9CF3-A82C5EDD5715}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb", "..\Externals\libusbx\msvc\libusb_static_2010.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -441,6 +445,18 @@ Global
|
|||
{A680190D-0764-485B-9CF3-A82C5EDD5715}.Release|Win32.Build.0 = Release|Win32
|
||||
{A680190D-0764-485B-9CF3-A82C5EDD5715}.Release|x64.ActiveCfg = Release|x64
|
||||
{A680190D-0764-485B-9CF3-A82C5EDD5715}.Release|x64.Build.0 = Release|x64
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DebugFast|Win32.Build.0 = DebugFast|Win32
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DebugFast|x64.ActiveCfg = DebugFast|x64
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DebugFast|x64.Build.0 = DebugFast|x64
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\libusb\$(PlatformName);..\..\..\Externals\polarssl\visualc\VS2010\$(PlatformName)\$(ConfigurationName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;opengl32.lib;glew32s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;libusb-1.0.lib;PolarSSL.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\libusbx\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\polarssl\visualc\VS2010\$(PlatformName)\$(ConfigurationName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;opengl32.lib;glew32s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;PolarSSL.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\libusb\$(PlatformName);..\..\..\Externals\polarssl\visualc\VS2010\$(PlatformName)\$(ConfigurationName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;opengl32.lib;glew64s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;libusb-1.0.lib;PolarSSL.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\polarssl\visualc\VS2010\$(PlatformName)\$(ConfigurationName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;opengl32.lib;glew64s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;PolarSSL.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
|
Loading…
Reference in New Issue