diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:13:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:13:39 +0000 |
commit | 18d2dadb3c9132b52fdc88f509ea9005b9eebd5f (patch) | |
tree | 8e399598f572b2e88c16ddd26fb1fe601dd0e64b | |
parent | Initial commit. (diff) | |
download | usbutils-upstream.tar.xz usbutils-upstream.zip |
Adding upstream version 1:017.upstream/1%017upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
62 files changed, 37759 insertions, 0 deletions
diff --git a/LICENSES/GPL-2.0-only.txt b/LICENSES/GPL-2.0-only.txt new file mode 100644 index 0000000..4408fbf --- /dev/null +++ b/LICENSES/GPL-2.0-only.txt @@ -0,0 +1,357 @@ +Valid-License-Identifier: GPL-2.0 +Valid-License-Identifier: GPL-2.0-only +Valid-License-Identifier: GPL-2.0+ +Valid-License-Identifier: GPL-2.0-or-later +SPDX-URL: https://spdx.org/licenses/GPL-2.0.html +Usage-Guide: + To use this license in source code, put one of the following SPDX + tag/value pairs into a comment according to the placement + guidelines in the licensing rules documentation. + For 'GNU General Public License (GPL) version 2 only' use: + SPDX-License-Identifier: GPL-2.0 + or + SPDX-License-Identifier: GPL-2.0-only + For 'GNU General Public License (GPL) version 2 or any later version' use: + SPDX-License-Identifier: GPL-2.0+ + or + SPDX-License-Identifier: GPL-2.0-or-later +License-Text: + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 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. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, 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 or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +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 give any other recipients of the Program a copy of this License +along with the Program. + +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 Program or any portion +of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +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 Program, 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 Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) 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; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, 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 executable. However, as a +special exception, the source code 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. + +If distribution of executable or 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 counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program 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. + + 5. 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 Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program 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 to +this License. + + 7. 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 Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program 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 Program. + +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. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program 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. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 Program +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 Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, 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 + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), 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 Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 of the License, 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, 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. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/LICENSES/GPL-3.0-only.txt b/LICENSES/GPL-3.0-only.txt new file mode 100644 index 0000000..568c6c0 --- /dev/null +++ b/LICENSES/GPL-3.0-only.txt @@ -0,0 +1,691 @@ +Valid-License-Identifier: GPL-3.0-only +Valid-License-Identifier: GPL-3.0+ +Valid-License-Identifier: GPL-3.0-or-later +SPDX-URL: https://spdx.org/licenses/GPL-3.0.html +Usage-Guide: + To use this license in source code, put one of the following SPDX + tag/value pairs into a comment according to the placement + guidelines in the licensing rules documentation. + For 'GNU General Public License (GPL) version 3 only' use: + SPDX-License-Identifier: GPL-3.0 + or + SPDX-License-Identifier: GPL-3.0-only + For 'GNU General Public License (GPL) version 3 or any later version' use: + SPDX-License-Identifier: GPL-3.0+ + or + SPDX-License-Identifier: GPL-3.0-or-later +License-Text: + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, 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 +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state 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 program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 3 of the License, 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 <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..ae9e383 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,85 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2004 Thomas Sailer <sailer@ife.ee.ethz.ch> +# Copyright (c) 2005-2006 David Brownell <dbrownell@users.sourceforge.net> +# Copyright (c) 2009 Kay Sievers <kay.sievers@vrfy.org> +# Copyright (c) 2009 Greg Kroah-Hartman <gregkh@suse.de> + +SUBDIRS = \ + usbhid-dump + +AM_LDFLAGS = \ + -Wl,--as-needed + +data_DATA = + +bin_PROGRAMS = \ + lsusb + +sbin_SCRIPTS = + +bin_SCRIPTS = \ + usb-devices \ + lsusb.py + +noinst_PROGRAMS = \ + usbreset + +lsusb_SOURCES = \ + lsusb.c lsusb.h \ + lsusb-t.c \ + list.h \ + desc-defs.c desc-defs.h \ + desc-dump.c desc-dump.h \ + names.c names.h \ + sysfs.c sysfs.h \ + usb-spec.h \ + usbmisc.c usbmisc.h + +lsusb_CPPFLAGS = \ + $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) $(UDEV_CFLAGS) + +lsusb_LDADD = \ + $(LIBUSB_LIBS) \ + $(UDEV_LIBS) + +usbreset_SOURCES = \ + usbreset.c + +man_MANS = \ + lsusb.8 \ + usbhid-dump.8 \ + usb-devices.1 + +EXTRA_DIST = \ + lsusb.8.in \ + usbhid-dump.8.in \ + usb-devices.1.in \ + usb-devices \ + lsusb.py.in \ + usbreset.c \ + LICENSES/GPL-2.0-only.txt \ + LICENSES/GPL-3.0-only.txt + +pkgconfig_DATA = usbutils.pc + +lsusb.py: $(srcdir)/lsusb.py.in + sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@ + chmod 755 $@ + +lsusb.8: $(srcdir)/lsusb.8.in + sed 's|VERSION|$(VERSION)|g' $< >$@ + +usbhid-dump.8: $(srcdir)/usbhid-dump.8.in + sed 's|VERSION|$(VERSION)|g' $< >$@ + +usb-devices.1: $(srcdir)/usb-devices.1.in + sed 's|VERSION|$(VERSION)|g' $< >$@ + +DISTCLEANFILES = \ + lsusb.py \ + lsusb.8 \ + usb-devices.1 \ + usbhid-dump.8 + +distclean-local: + rm -rf autom4te.cache diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..e84ea47 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1362 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2004 Thomas Sailer <sailer@ife.ee.ethz.ch> +# Copyright (c) 2005-2006 David Brownell <dbrownell@users.sourceforge.net> +# Copyright (c) 2009 Kay Sievers <kay.sievers@vrfy.org> +# Copyright (c) 2009 Greg Kroah-Hartman <gregkh@suse.de> + + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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 = : +bin_PROGRAMS = lsusb$(EXEEXT) +noinst_PROGRAMS = usbreset$(EXEEXT) +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +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 = usbutils.pc +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" \ + "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(datadir)" \ + "$(DESTDIR)$(pkgconfigdir)" +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_lsusb_OBJECTS = lsusb-lsusb.$(OBJEXT) lsusb-lsusb-t.$(OBJEXT) \ + lsusb-desc-defs.$(OBJEXT) lsusb-desc-dump.$(OBJEXT) \ + lsusb-names.$(OBJEXT) lsusb-sysfs.$(OBJEXT) \ + lsusb-usbmisc.$(OBJEXT) +lsusb_OBJECTS = $(am_lsusb_OBJECTS) +am__DEPENDENCIES_1 = +lsusb_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_usbreset_OBJECTS = usbreset.$(OBJEXT) +usbreset_OBJECTS = $(am_usbreset_OBJECTS) +usbreset_LDADD = $(LDADD) +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; }; \ + } +SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) +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@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/lsusb-desc-defs.Po \ + ./$(DEPDIR)/lsusb-desc-dump.Po ./$(DEPDIR)/lsusb-lsusb-t.Po \ + ./$(DEPDIR)/lsusb-lsusb.Po ./$(DEPDIR)/lsusb-names.Po \ + ./$(DEPDIR)/lsusb-sysfs.Po ./$(DEPDIR)/lsusb-usbmisc.Po \ + ./$(DEPDIR)/usbreset.Po +am__mv = mv -f +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 = +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 = $(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 = $(lsusb_SOURCES) $(usbreset_SOURCES) +DIST_SOURCES = $(lsusb_SOURCES) $(usbreset_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 +man1dir = $(mandir)/man1 +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +DATA = $(data_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 distdir-am 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)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/usbutils.pc.in NEWS README.md compile depcomp \ + install-sh missing +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" +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +DIST_TARGETS = dist-bzip2 dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi +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_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +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@ +pkgconfigdir = @pkgconfigdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = \ + usbhid-dump + +AM_LDFLAGS = \ + -Wl,--as-needed + +data_DATA = +sbin_SCRIPTS = +bin_SCRIPTS = \ + usb-devices \ + lsusb.py + +lsusb_SOURCES = \ + lsusb.c lsusb.h \ + lsusb-t.c \ + list.h \ + desc-defs.c desc-defs.h \ + desc-dump.c desc-dump.h \ + names.c names.h \ + sysfs.c sysfs.h \ + usb-spec.h \ + usbmisc.c usbmisc.h + +lsusb_CPPFLAGS = \ + $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) $(UDEV_CFLAGS) + +lsusb_LDADD = \ + $(LIBUSB_LIBS) \ + $(UDEV_LIBS) + +usbreset_SOURCES = \ + usbreset.c + +man_MANS = \ + lsusb.8 \ + usbhid-dump.8 \ + usb-devices.1 + +EXTRA_DIST = \ + lsusb.8.in \ + usbhid-dump.8.in \ + usb-devices.1.in \ + usb-devices \ + lsusb.py.in \ + usbreset.c \ + LICENSES/GPL-2.0-only.txt \ + LICENSES/GPL-3.0-only.txt + +pkgconfig_DATA = usbutils.pc +DISTCLEANFILES = \ + lsusb.py \ + lsusb.8 \ + usb-devices.1 \ + usbhid-dump.8 + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign 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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +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: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +usbutils.pc: $(top_builddir)/config.status $(srcdir)/usbutils.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +lsusb$(EXEEXT): $(lsusb_OBJECTS) $(lsusb_DEPENDENCIES) $(EXTRA_lsusb_DEPENDENCIES) + @rm -f lsusb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(lsusb_OBJECTS) $(lsusb_LDADD) $(LIBS) + +usbreset$(EXEEXT): $(usbreset_OBJECTS) $(usbreset_DEPENDENCIES) $(EXTRA_usbreset_DEPENDENCIES) + @rm -f usbreset$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(usbreset_OBJECTS) $(usbreset_LDADD) $(LIBS) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) +install-sbinSCRIPTS: $(sbin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsusb-desc-defs.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsusb-desc-dump.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsusb-lsusb-t.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsusb-lsusb.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsusb-names.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsusb-sysfs.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsusb-usbmisc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usbreset.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.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 -o $@ $< + +.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 -o $@ `$(CYGPATH_W) '$<'` + +lsusb-lsusb.o: lsusb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-lsusb.o -MD -MP -MF $(DEPDIR)/lsusb-lsusb.Tpo -c -o lsusb-lsusb.o `test -f 'lsusb.c' || echo '$(srcdir)/'`lsusb.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-lsusb.Tpo $(DEPDIR)/lsusb-lsusb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lsusb.c' object='lsusb-lsusb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-lsusb.o `test -f 'lsusb.c' || echo '$(srcdir)/'`lsusb.c + +lsusb-lsusb.obj: lsusb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-lsusb.obj -MD -MP -MF $(DEPDIR)/lsusb-lsusb.Tpo -c -o lsusb-lsusb.obj `if test -f 'lsusb.c'; then $(CYGPATH_W) 'lsusb.c'; else $(CYGPATH_W) '$(srcdir)/lsusb.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-lsusb.Tpo $(DEPDIR)/lsusb-lsusb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lsusb.c' object='lsusb-lsusb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-lsusb.obj `if test -f 'lsusb.c'; then $(CYGPATH_W) 'lsusb.c'; else $(CYGPATH_W) '$(srcdir)/lsusb.c'; fi` + +lsusb-lsusb-t.o: lsusb-t.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-lsusb-t.o -MD -MP -MF $(DEPDIR)/lsusb-lsusb-t.Tpo -c -o lsusb-lsusb-t.o `test -f 'lsusb-t.c' || echo '$(srcdir)/'`lsusb-t.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-lsusb-t.Tpo $(DEPDIR)/lsusb-lsusb-t.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lsusb-t.c' object='lsusb-lsusb-t.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-lsusb-t.o `test -f 'lsusb-t.c' || echo '$(srcdir)/'`lsusb-t.c + +lsusb-lsusb-t.obj: lsusb-t.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-lsusb-t.obj -MD -MP -MF $(DEPDIR)/lsusb-lsusb-t.Tpo -c -o lsusb-lsusb-t.obj `if test -f 'lsusb-t.c'; then $(CYGPATH_W) 'lsusb-t.c'; else $(CYGPATH_W) '$(srcdir)/lsusb-t.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-lsusb-t.Tpo $(DEPDIR)/lsusb-lsusb-t.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lsusb-t.c' object='lsusb-lsusb-t.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-lsusb-t.obj `if test -f 'lsusb-t.c'; then $(CYGPATH_W) 'lsusb-t.c'; else $(CYGPATH_W) '$(srcdir)/lsusb-t.c'; fi` + +lsusb-desc-defs.o: desc-defs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-desc-defs.o -MD -MP -MF $(DEPDIR)/lsusb-desc-defs.Tpo -c -o lsusb-desc-defs.o `test -f 'desc-defs.c' || echo '$(srcdir)/'`desc-defs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-desc-defs.Tpo $(DEPDIR)/lsusb-desc-defs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='desc-defs.c' object='lsusb-desc-defs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-desc-defs.o `test -f 'desc-defs.c' || echo '$(srcdir)/'`desc-defs.c + +lsusb-desc-defs.obj: desc-defs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-desc-defs.obj -MD -MP -MF $(DEPDIR)/lsusb-desc-defs.Tpo -c -o lsusb-desc-defs.obj `if test -f 'desc-defs.c'; then $(CYGPATH_W) 'desc-defs.c'; else $(CYGPATH_W) '$(srcdir)/desc-defs.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-desc-defs.Tpo $(DEPDIR)/lsusb-desc-defs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='desc-defs.c' object='lsusb-desc-defs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-desc-defs.obj `if test -f 'desc-defs.c'; then $(CYGPATH_W) 'desc-defs.c'; else $(CYGPATH_W) '$(srcdir)/desc-defs.c'; fi` + +lsusb-desc-dump.o: desc-dump.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-desc-dump.o -MD -MP -MF $(DEPDIR)/lsusb-desc-dump.Tpo -c -o lsusb-desc-dump.o `test -f 'desc-dump.c' || echo '$(srcdir)/'`desc-dump.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-desc-dump.Tpo $(DEPDIR)/lsusb-desc-dump.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='desc-dump.c' object='lsusb-desc-dump.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-desc-dump.o `test -f 'desc-dump.c' || echo '$(srcdir)/'`desc-dump.c + +lsusb-desc-dump.obj: desc-dump.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-desc-dump.obj -MD -MP -MF $(DEPDIR)/lsusb-desc-dump.Tpo -c -o lsusb-desc-dump.obj `if test -f 'desc-dump.c'; then $(CYGPATH_W) 'desc-dump.c'; else $(CYGPATH_W) '$(srcdir)/desc-dump.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-desc-dump.Tpo $(DEPDIR)/lsusb-desc-dump.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='desc-dump.c' object='lsusb-desc-dump.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-desc-dump.obj `if test -f 'desc-dump.c'; then $(CYGPATH_W) 'desc-dump.c'; else $(CYGPATH_W) '$(srcdir)/desc-dump.c'; fi` + +lsusb-names.o: names.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-names.o -MD -MP -MF $(DEPDIR)/lsusb-names.Tpo -c -o lsusb-names.o `test -f 'names.c' || echo '$(srcdir)/'`names.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-names.Tpo $(DEPDIR)/lsusb-names.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='names.c' object='lsusb-names.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-names.o `test -f 'names.c' || echo '$(srcdir)/'`names.c + +lsusb-names.obj: names.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-names.obj -MD -MP -MF $(DEPDIR)/lsusb-names.Tpo -c -o lsusb-names.obj `if test -f 'names.c'; then $(CYGPATH_W) 'names.c'; else $(CYGPATH_W) '$(srcdir)/names.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-names.Tpo $(DEPDIR)/lsusb-names.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='names.c' object='lsusb-names.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-names.obj `if test -f 'names.c'; then $(CYGPATH_W) 'names.c'; else $(CYGPATH_W) '$(srcdir)/names.c'; fi` + +lsusb-sysfs.o: sysfs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-sysfs.o -MD -MP -MF $(DEPDIR)/lsusb-sysfs.Tpo -c -o lsusb-sysfs.o `test -f 'sysfs.c' || echo '$(srcdir)/'`sysfs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-sysfs.Tpo $(DEPDIR)/lsusb-sysfs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sysfs.c' object='lsusb-sysfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-sysfs.o `test -f 'sysfs.c' || echo '$(srcdir)/'`sysfs.c + +lsusb-sysfs.obj: sysfs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-sysfs.obj -MD -MP -MF $(DEPDIR)/lsusb-sysfs.Tpo -c -o lsusb-sysfs.obj `if test -f 'sysfs.c'; then $(CYGPATH_W) 'sysfs.c'; else $(CYGPATH_W) '$(srcdir)/sysfs.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-sysfs.Tpo $(DEPDIR)/lsusb-sysfs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sysfs.c' object='lsusb-sysfs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-sysfs.obj `if test -f 'sysfs.c'; then $(CYGPATH_W) 'sysfs.c'; else $(CYGPATH_W) '$(srcdir)/sysfs.c'; fi` + +lsusb-usbmisc.o: usbmisc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-usbmisc.o -MD -MP -MF $(DEPDIR)/lsusb-usbmisc.Tpo -c -o lsusb-usbmisc.o `test -f 'usbmisc.c' || echo '$(srcdir)/'`usbmisc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-usbmisc.Tpo $(DEPDIR)/lsusb-usbmisc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='usbmisc.c' object='lsusb-usbmisc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-usbmisc.o `test -f 'usbmisc.c' || echo '$(srcdir)/'`usbmisc.c + +lsusb-usbmisc.obj: usbmisc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsusb-usbmisc.obj -MD -MP -MF $(DEPDIR)/lsusb-usbmisc.Tpo -c -o lsusb-usbmisc.obj `if test -f 'usbmisc.c'; then $(CYGPATH_W) 'usbmisc.c'; else $(CYGPATH_W) '$(srcdir)/usbmisc.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lsusb-usbmisc.Tpo $(DEPDIR)/lsusb-usbmisc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='usbmisc.c' object='lsusb-usbmisc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lsusb_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsusb-usbmisc.obj `if test -f 'usbmisc.c'; then $(CYGPATH_W) 'usbmisc.c'; else $(CYGPATH_W) '$(srcdir)/usbmisc.c'; fi` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +install-man8: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man8dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.8[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ + done; } + +uninstall-man8: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man8dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.8[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) +install-dataDATA: $(data_DATA) + @$(NORMAL_INSTALL) + @list='$(data_DATA)'; test -n "$(datadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(datadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(datadir)" || 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)$(datadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \ + done + +uninstall-dataDATA: + @$(NORMAL_UNINSTALL) + @list='$(data_DATA)'; test -n "$(datadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir) +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @case `sed 15q $(srcdir)/NEWS` in \ + *"$(VERSION)"*) : ;; \ + *) \ + echo "NEWS not updated; not releasing" 1>&2; \ + exit 1;; \ + esac + $(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) | eval GZIP= gzip $(GZIP_ENV) -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-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -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*) \ + eval GZIP= gzip $(GZIP_ENV) -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*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(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/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(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 $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(datadir)" "$(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-binPROGRAMS clean-generic clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f ./$(DEPDIR)/lsusb-desc-defs.Po + -rm -f ./$(DEPDIR)/lsusb-desc-dump.Po + -rm -f ./$(DEPDIR)/lsusb-lsusb-t.Po + -rm -f ./$(DEPDIR)/lsusb-lsusb.Po + -rm -f ./$(DEPDIR)/lsusb-names.Po + -rm -f ./$(DEPDIR)/lsusb-sysfs.Po + -rm -f ./$(DEPDIR)/lsusb-usbmisc.Po + -rm -f ./$(DEPDIR)/usbreset.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-local distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-dataDATA install-man install-pkgconfigDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-binSCRIPTS \ + install-sbinSCRIPTS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: install-man1 install-man8 + +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 ./$(DEPDIR)/lsusb-desc-defs.Po + -rm -f ./$(DEPDIR)/lsusb-desc-dump.Po + -rm -f ./$(DEPDIR)/lsusb-lsusb-t.Po + -rm -f ./$(DEPDIR)/lsusb-lsusb.Po + -rm -f ./$(DEPDIR)/lsusb-names.Po + -rm -f ./$(DEPDIR)/lsusb-sysfs.Po + -rm -f ./$(DEPDIR)/lsusb-usbmisc.Po + -rm -f ./$(DEPDIR)/usbreset.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ + uninstall-dataDATA uninstall-man uninstall-pkgconfigDATA \ + uninstall-sbinSCRIPTS + +uninstall-man: uninstall-man1 uninstall-man8 + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles am--refresh check check-am clean \ + clean-binPROGRAMS clean-cscope clean-generic \ + clean-noinstPROGRAMS cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ + dist-xz dist-zip dist-zstd distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-local distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-binSCRIPTS \ + install-data install-data-am install-dataDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-man8 install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am \ + install-sbinSCRIPTS install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \ + uninstall-dataDATA uninstall-man uninstall-man1 uninstall-man8 \ + uninstall-pkgconfigDATA uninstall-sbinSCRIPTS + +.PRECIOUS: Makefile + + +lsusb.py: $(srcdir)/lsusb.py.in + sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@ + chmod 755 $@ + +lsusb.8: $(srcdir)/lsusb.8.in + sed 's|VERSION|$(VERSION)|g' $< >$@ + +usbhid-dump.8: $(srcdir)/usbhid-dump.8.in + sed 's|VERSION|$(VERSION)|g' $< >$@ + +usb-devices.1: $(srcdir)/usb-devices.1.in + sed 's|VERSION|$(VERSION)|g' $< >$@ + +distclean-local: + rm -rf autom4te.cache + +# 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,798 @@ +# usbutils old-style "NEWS" file +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (c) 2018-2023 Greg Kroah-Hartman <gregkh@linuxfoundation.org> +# +# This file is here for people who do not have access to the git commit +# history (i.e. packaged versions of the software). +# + +usbutils 017 +============ + +Greg Kroah-Hartman (4): + lsusb: fix up [unknown] vendor and product strings. + lsusb: fix build warning for dump_billboard_alt_mode_capability_desc() + lsusb: add fallback names for 'lsusb -v' output + names: simplify get_vendor_product_with_fallback() a bit + +rezso (1): + Honor system libdir and includedir + +usbutils 016 +============ + +Alan Stern (1): + usbutils: lsusb-t: print entries for devices with no interfaces + +Aurelien Jarno (1): + Fix a typo in usb-spec.h + +Bob Hyman (1): + lsusb.py.in: Display (device) power/wakeup via -w option. + +Dingyan Li (3): + Fix an incorrect length value in hid descriptor. + Fix misalignments in hid device descripptor. + Use bigger buffer to place speed value string + +Greg Kroah-Hartman (19): + lsusb -h returns an error + lsusb -h fixups + lsusb -t: sort in bus order, not reverse order + lsusb -t: print ports and busses and devices with same width + lsusb -t: assign_interface_to_parent() fixups + lsusb.8.in: fix up missing '-' in text + README.md: add source location + lsusb.py: fix up wakeup logic for devices that do not support it + lsusb.py.in: add another default path for usb.ids + names.c: if a string can not be found in the usb.ids file, return [unknown] + lsusb-t: if a driver is not bound to an interface, report "[none]" + +Hannes Weisbach (1): + Generate usbutils.pc pkgconfig file + +Kristoffer Ellersgaard Koch (1): + usbreset: Allow idProduct and idVendor to be 0 + +Lukas Nykryn (1): + usb-devices: make shellcheck happy + +Tan Li Boon (3): + lsusb: Add function that sorts the output by device ID. + lsusb: Additional sorting by bus number. + lsusb: This is a more compact implementation of the device list sort implemented within this pull request. The output remains the same as the one demonstrated in the previous commit. + +usbutils 015 +============ + +Greg Kroah-Hartman (6): + usb-devices: list the root devices in numerical order + usb-devices: use 'local' variable type to handle recursion + lsusb: remove unused wireless check + lsusb: remove wireless descriptor information + usb-devices: fix field width on device speed field + lsusb: fix up Midi Device specification devices + +Han Han (1): + Fix an runtime error reported by undefind sanitizer + +Robert Hancock (1): + lsusb: Improve status display for SuperSpeedPlus hubs + +Tan Li Boon (1): + lsusb-t: Fix recursive sorting on child devices. + + +usbutils 014 +============ + +Adrian Kalazi (1): + Add Tx+Rx lanes to tree mode + +Aurelien Jarno (1): + lsusb(8): mention the udev's hardware database + +Benson Leung (1): + lsusb: Fix typo in string output for iAdditionalInfoURL + +Bui Quang Minh (1): + lsusb-t: Add lower bound checks in read_sysfs_file_string + +Grant Grundler (2): + lsusb: remove unused RETRIES constant + lsusb: don't complain on EAGAIN + +Greg Kroah-Hartman (10): + sysfs: add copyright notice taken from name.* + LICENSES: add symlink to handle "or-later" issue for GPL-2.0 + LICENSES: put spdx headers on the license files + rename "GPL-2.0+" to "GPL-2.0-or-later" + LICENSE: rename GPL-3.0.txt -> GPL-3.0-only.txt + usbhid-dump.8.in: add copyright information + .gitignore: add copyright and SPDX info + usbhid-dump: add copyright and SPDX info + SPDX header cleanups from GPL-2.0 -> GPL-2.0-only + usbutils.spdx: update with output of latest reuse tool + +Jonathan Neuschäfer (2): + lsusb: Fix spelling of bEndpointAddress in UVC + lsusb: Decode endpoint addresses in UVC + +Lukas Zaoral (3): + lsusb.c: fix leak in dump_printer_device + usb-devices: do not use `local` in a POSIX shell script + desc-defs.c: fix possible out-of-bound read + +Matthias Braun (1): + Fix typos in lsusb.8.in + +Ruslan Kabatsayev (5): + Fix locating endpoint when it's a directory rather than a symlink + Fix formatting of interface descriptors to match /sys/kernel/debug/usb/devices + Fix formatting of endpoint direction to match /sys/kernel/debug/usb/devices + Fix formatting of endpoint type to match /sys/kernel/debug/usb/devices + Fix formatting of max endpoint packet size to match /sys/kernel/debug/usb/devices + +Thomas Hebb (1): + lsusb: Fix buffer size copy/paste error + +Tormod Volden (1): + Makefile.am: Remove unused DATADIR + + +usbutils 013 +============ + +Aurelien Jarno (1): + lsusb.8.in: do not mention usb.ids + +Baruch Siach (1): + usb-devices.1: don't mention bash + +Greg Kroah-Hartman (15): + usbhid-dump: move manpage to main directory out of subdir + usbhid-dump.8: add SPDX header + usbhid-dump.8: autogenerate it with the usbutils version number + .gitignore: add usbhid-dump.8 + usbhid-dump: add SPDX identifiers to all files. + usbhid-dump: remove libusb.h libusb_strerror() implementation + usbhid-dump: remove lib directory + usbhid-dump: move .h files into src/ directory + Makefile.am: add usbhid-dump.8 to distclean list + usbhid-dump: some autoconf cleanup + usbhid-dump: remove some dev_list functions that were never used + dump_audiostreaming_interface(): remove unused variable + usbmisc: initialize string buffer before reading from device. + lsusb.py: drop trailing space on non-hub devices + lsusb.py: strip whitespace from device strings + +Jakub Wilk (2): + lsusb(8): fix formatting + lsusb(8): document --tree + +Pino Toscano (1): + lsusb.py: remove private paths for usb.ids + +Rob Gill (1): + Additional device classes for usb-devices script + +Rosen Penev (1): + usbhid-dump: Do not use rindex + +Thomas Hebb (4): + Move read_sysfs_prop() from names.c to its own file + sysfs: Don't return bogus data for devices under a hub + lsusb: Use vendor and product name fallback logic in -D mode too + lsusb: Get manufacturer, product, and serial from sysfs + +Timothy Robert Bednarzyk (1): + bootstrap: change /bin/bash to /bin/sh + +Torleiv Sundre (1): + lsusb: fix two typos in UVC Extension Unit descriptor + +Tormod Volden (1): + usbhid-dump: Put back autoconf check for libusb_set_option() + + +usbutils 012 +============ + +Greg Kroah-Hartman: + Merge usbhid-dump into main usbutils repository + + +usbutils 011 +============ + +Clemens Fruhwirth (1): + Add usbreset.c as noinst_PROGRAMS target. + +Daniel Schaefer (1): + lsusb: Read unkown names from sysfs device desc. + +Darsey Litzenberger (3): + Remove a small hack that no longer has any effect. + Cleanup grammar + lsusb-t: Emit USB IDs and other handy info when verbosity is increased + +Emmanuele Bassi (1): + Require newer version of libusb + +Georg Brandl (1): + lsusb.py: fix up Python 3 conversion + +Greg Kroah-Hartman (10): + SPDX bill-of-material is supposed to be project_name.spdx + usbutils.spdx: rerun report, it is properly sorted. + desc-dump.c: fix compiler warning about unused variable + add usbreset to .gitignore + usbreset: fix some build warnings + usbhid-dump: update to latest version + fix up standard int types + update usbhid-dump git id + usbhid-dump: update to a newer version of usbhid-dump again. + usbutils.spdx: update with latest information + +Kurt Garloff (4): + lsusb.py: Search multiple paths for usb.ids. + lsusb.py: Usb enum for parser state machine. + lsusb.py: Add driver names for usbhid. + lsusb.py: python2 compatibility + +Lukas Nykryn (1): + Makefile.am: add files with licenses to archive + +Mantas Mikulėnas (33): + lsusb.py: sort devices and interfaces numerically + lsusb.py: sort toplevel entries + lsusb.py: improve usage text + lsusb.py: replace fake deepcopy() + lsusb.py: remove -w (warn if usb.ids not sorted) option + lsusb.py: ensure all error messages are written to stderr + lsusb.py: support long options + lsusb.py: use regular print() instead of hand-rolling the same thing + lsusb.py: avoid shadowing Python's built-in 'str' + lsusb.py: replace usb.ids binary search with dict lookup + lsusb.py: remove now-unused bin_search() + lsusb.py: avoid manual calls to __foo__() + lsusb.py: replace __repr__() for USB IDs with __str__() + lsusb.py: insert class FF:FF:FF into usbclasses to avoid special casing + lsusb.py: entirely remove Usb* classes + lsusb.py: cosmetic - replace tuples-as-"immutable lists" with regular lists + lsusb.py: use 'elif' where suitable + lsusb.py: remove dead code + lsusb.py: move unrelated code out of try..except + lsusb.py: allow - as well as _ when matching hci module names + lsusb.py: use a constant for the magic class number 9 + lsusb.py: Usb* classes: call read() automatically from constructor + lsusb.py: UsbEndpoint: indent is a class implementation detail + lsusb.py: a few cosmetic changes + lsusb.py: shorten find_usb_class() + lsusb.py: give all Usb* objects a .path attribute + lsusb.py: add an actual __repr__() to classes + lsusb.py: give all Usb* classes a superclass + lsusb.py: convert readattr() and readlink() to methods of the container + lsusb.py: use color by default + lsusb.py: rework output for more consistent indent of both columns + lsusb.py: fix endpoint interval spacing + lsusb.py: visually group USB-version-related fields + +Michael Drake (4): + lsusb: Split out routine that fetches value for given field. + lsusb: Split out field name rendering. + lsusb: Add support for descriptor extensions. + lsusb: Add support for audio processing unit type-specific fields. + +Philip Langdale (2): + lsusb: Added support for Billboard Alternate Mode Capability descriptor + lsusb.py: Fix formatting of 10Gbps speeds + +Ross Burton (1): + usb-devices: use /bin/sh hashbang + +Solomon Peachy (1): + lsusb: Add support for decoding IPP printer descriptors + +Stefan Tauner (1): + Depend on libusb 1.0.14 + +Valerii Zapodovnikov (1): + man pages: add information on verbosity levels of -t option + +junjie (1): + fix typo + + +usbutils 010 +============ + +Aurelien Jarno (2): + usbreset.c: add missing <stdlib.h> include + Do not create and install usbutils.pc + +Greg Kroah-Hartman (32): + fix dump_videocontrol_interface for unitialized variable usage + Add correct SPDX license identifiers to all files + Add SPDX identifiers on files that did not have a specific license. + wTotalLength should be printed as a hex number + usbmisc: fix up some strncpy() issues + lsusb-t: fix up error with readlink() + lsusb.py.in: add proper SPDX license identifier + usb-devices: reword the copyright identifier + LICENSES: move the GPL 2 license to the LICENSES directory + LICENSES/GPL-3.0.txt: add the file + lsusb.h: add copyright notice + lsusb-t: add copyright info + bom.spdx: Add bill of materials file in SPDX format. + ChangeLog: remove it. + AUTHORS: remove file + do_release: drop file + NEWS: add SPDX header and comment + autogen.sh: add SPDX and copyright header + list.h: add copyright information + travis-autogen.sh: add SPDX and copyright information. + INSTALL: remove the file, it's boiler-plate + configure.ac: add SPDX and copyright + man pages: add SPDX and copyright information + Makefile.am: add SPDX and copyright information + .gitmodules: add SPDX and copyright lines + lsusb.py.in: fix up Copyright strings + usbreset.c: add Alan's copyright + .travis.yml: add correct SPDX and copyright notices + bom.spdx: update with latest copyright and SPDX identifier additions + README.md: move the README file to markdown + README.md: fix fomatting + bom.spdx: upate with README -> README.md change + +Lukas Nykryn (1): + lsusb.py: convert to python3 + +Michael Drake (11): + lsusb: Split subtype mapping out of AudioControl interface handling. + lsusb: Add declarative definitions for UAC1 and UAC2 descriptors. + lsusb: Add code to dump descriptor data using descriptor definition. + lsusb: Switch to descriptor-definition based dump for UAC1 and UAC2. + lsusb: Add descriptor definitions for UAC3. + lsusb: Add initial support for USB Audio Device Class 3. + lsusb: Add descriptor definition for USB3 BOS Configuration Summary. + lsusb: Dump USB3 BOS Configuration Summary Descriptor. + lsusb: Squash Wpointer-compare warning. + lsusb: Remove unused function. + lsusb: Fix array entry count for variable sized entries. + +Robby Workman (1): + Makefile.am: Include usbreset.c in the release tarball + +Torleiv Sundre (1): + lsusb: Dump UVC Stream based payload descriptor. + + +usbutils 009 +============ + +Bjørn Mork (1): + usbreset: coding style + +Emmanuele Bassi (1): + Don't use C99-ism + +Greg Kroah-Hartman (22): + usbhid-dump: update submodule to latest version + add usbreset.c example program + update usbhid-dump to latest + lsusb.py: Don't dump a trace dump if usb.ids is not present + +Grueninger, Tobias (1): + USB: usb-devices: Interface number can be a string + +Heinrich Schuchardt (1): + autogen.sh: checkout usbhid-dump + +Jaejoong Kim (4): + lsusb : add support for the Encoding Unit Desc for uvc 1.5 device + lsusb: fix alignment for Video Streaming interface desc + lsusb: parse additional control fileds in USB video control interfaces for UVC1.5 + lsusb: proper display hexadecimal value for UVC control interface + +Jakub Wilk (1): + Fix typos + +Jo-Philipp Wich (1): + usbreset.c: import usability improvements from OpenWrt + +Justin McBride (2): + Update lsusb.c + Un-indent bVariableSize for Frame-Based Format descriptors + +Kylie McClain (1): + Makefile: install pkgconfig file to arch-dependent location + +Mathias Nyman (2): + lsusb: Allocate the BOS descriptor buffer dynamically + lsusb: Add support for the USB 3.1 SuperSpeedPlus device capability desc + +Muthu M (2): + lsusb: Fix issue with lengthy string descriptors + lsusb: Added support for Billboard Capability descriptor + +Nikolai Kondrashov (2): + Update usbhid-dump repo URL + Update usbhid-dump to v1.4 + +Stephan Linz (7): + travis-ci: add control files borrowed from libusb + configure: remove summary about unused USE_ZLIB + drop unused input file for usb.ids update script + substitute usb.id location in lsusb Python script + travis-ci: cleanup before second run + travis-ci: rework travis-autogen.sh + lsusb: remove unused variable procbususb + +Tobias Klauser (4): + lsusb: Report correct MaxPower for USB 3.0 devices + lsusb: Request proper descriptor type for USB 3.1 + lsusb: Store link state descriptions without preceding space + build: Request at least libusb 1.0.9 + +Torleiv Sundre (2): + Added support for Platform Device Capability descriptor + lsusb: change endianness of first three fields when printing UUID/GUIDs. + +Vianney le Clément de Saint-Marcq (3): + lsusb: Fix UVC STILL_IMAGE_FRAME descriptor + lsusb: Fix UVC VideoStreaming interface header descriptor + lsusb: Fix UVC OUTPUT_TERMINAL descriptor + +Vincent Palatin (1): + lsusb: print WebUSB platform descriptor + + +usbutils 008 +============ + +Alexandra Yates (2): + lsusb: Reports if USB2.0 port is on L1 state + lsusb: Reports devices that support BESL on USB2.0 + +Aurelien Jarno (1): + dump_ccid_device: fix a typo + +Ben Chan (1): + lsusb: decode CDC MBIM extended functional descriptor + +Greg Kroah-Hartman (8): + lsusb: fix incorrect printf() for CAPS + lsusb-t: handle problem if there is no usb bus list + .gitignore: add compile to the list of things we need to ignore + +John Freed (1): + Fix logic error + +Kurt Garloff (1): + Update lsusb.py in usbutils + +Lukas Nykryn (2): + update COPYING file + lsusb-t: don't segfault when usbbuslist is empty + +Peter Wu (1): + Ignore invalid string descriptors + +Raphaël Droz (1): + usb-devices: hexadecimal bInterfaceNumber handling + +Tom Gundersen (2): + lsusb: port to hwdb + drop dependency on usb.ids + +Vadim Rutkovsky (1): + New path for usbhid-dump submodule + + +usbutils 007 +============ + +Aurelien Jarno (1): + usb-devices: correctly quote driver path + +Bjørn Mork (4): + lsusb: decode CDC MBIM descriptor + lsusb: decode CDC NCM functional descriptor + lsusb: decode CDC Command Set descriptor + usb-devices: avoid numbers being seen as octal by printf + +Daniel Mack (1): + lsusb: parse bmFormats inside UAC2 interface headers as hex + +Greg Kroah-Hartman (12): + do_release notes + update of usb.ids file from upstream + remove devtree logic + usb.ids update + usb.ids add BlueZ Host stack device id. + +Jethro Beekman (1): + Fix lsusb -t potentially not listing all devices + +Lukas Nykryn (1): + lsusb-t: make sure that interfaces are added to lists only once + +Sarah Sharp (2): + lsusb: Fix USB 3.0 link state reporting. + lsusb: Fix bug in USB 2.0 extended caps descriptor. + +Torstein Hegge (1): + lsusb: Parse misplaced UAC1 AudioControl Endpoint Descriptor + +Роман Донченко (1): + lsusb: Support non-ASCII string descriptors. + + +usbutils 006 +============ + +Aurelien Jarno (1): + usb-devices(1): fix a typo + +Diego Elio Pettenò (1): + build: add a --disable-usbids option to avoid installing usb.ids + +Greg Kroah-Hartman (7): + update usbhid-dump to 1.3 + lsusb.c: remove unused variables and the unused -x command line option + Make 'lsusb -t' use the correct device class string names + Update usb.ids file with latest version. + +Lukas Nykryn (7): + Possible buffer overflow when using SYSFS_STR + Reading 26 item in array with size 12. + Using uninitialized value as index + Possible resource leak + Wrong shifting of bmMPEGFeatures byte + Buffer overrun + lsusb-t: don't show error when driver link is missing + +Mark Veltzer (1): + --tree, --help, and better build documentation + +Nikolai Kondrashov (1): + Update usbhid-dump to complete 1.3 release + +Roger Tseng (1): + Option -V(version) doesn't require an argument. + +Sarah Sharp (3): + usbutils: Dump BOS descriptor for USB 2.01 devices. + lsusb: Show USB 3.0 U1, U2, and LTM status. + lsusb: Fix LTM capabilities reporting. + +Thierry Vignaud (3): + set arrays to NULL when freeing them. + simplify get_string() + make treedump() work if the database isn't there. + + +usbutils 005 +============ + +Greg Kroah-Hartman (7): + usb.ids: updated version of the file + Remove the FSF address from the source files. + update usbhid-dump to release 1.2 + add another Linux kernel usb id. + updated usb.ids file + lsusb-t.c: fix up some compiler warnings + add lsusb.h to fix some compiler warnings. + +Lukáš Nykrýn (1): + Add more space to lsusb.py output + +Sarah Sharp (2): + lsusb: wSpeedsSupported is 2 bytes, not one. + lsusb: bU2DevExitLat is little endian, not big endian. + + +usbutils 004 +============ + +Carl-Daniel Hailfinger (2): + Fix lsusb out-of-bounds write + Fix lsusb double-free + +Dafydd Crosby (2): + Verbose flag in tree mode shows vendor and product name. When running `lsusb -tv`, devices should have the vendor and product name appended to the row. + Fix compiler warning + +Greg Kroah-Hartman (2): + Merge pull request #2 from nphilipp/master--nphilipp + Merge pull request #3 from dafyddcrosby/lsusb-tv + +Nils Philippsen (1): + don't use invalid config descriptors + + +usbutils 003 +============ + +Diego Elio Pettenò (1): + build-sys: properly enable support for zlib in lsusb + + +usbutils 002 +============ + +Diego Elio Pettenò (2): + Simplify the configure script. + Print device class descriptors like it's done for interface descriptors. + +Greg Kroah-Hartman (2): + Updated version of lsusb.py from Kurt Garloff. + add lsusb.py to the bin files + + +usbutils 001 +============ + +Greg Kroah-Hartman (2): + usb.ids update from linux-usb.org + updated usbhid-dump subproject + +Laurent Pinchart (2): + usbutils: Support UVC frame-based descriptors + usbutils: Support UVC MPEG2-TS format descriptor + +Luben Tuikov (3): + lsusb: Fix getting BOS and DEVQUAL descriptors + lsusb: Dump the Pipe Usage descriptor + lsusb: Fix bMaxBurst reporting + +Mike Frysinger (5): + lsusb: install into /usr/bin + usbmisc: pull in unistd.h for readlink() + lsusb: pull in stdlib.h for exit() + lsusb: constify! + usbutils: convert to libusb-1.0 + +Nikolai Kondrashov (1): + Update usbhid-dump to release 1.2 + +Sarah Sharp (2): + usbutils: Fix compile error on Ubuntu 9.04. + usbutils: Make lsusb -t show USB 3.0 devices. + + +usbutils 0.91 +============= + +Greg Kroah-Hartman (3): + add usbhid-dump to the autogen.sh script + usb.ids: add new device id for qemu audio device + Minor fixes + +Laurent Pinchart (1): + usbutils: Fix the UVC bmInterlaceFlags field decoding + +Mike Frysinger (2): + usbutils.pc: use datarootdir + fix building on non-Linux systems (e.g. BSD) + +Nikolai Kondrashov (1): + Integrate usbhid-dump + +Sarah Sharp (5): + usbutils: Fix Wireless USB descriptor fetching. + usbutils: Support USB 3.0 hub descriptor output. + usbutils: Print MaxStreams and Mult for USB 3.0 devices. + usbutils: Print Binary Object Store descriptor. + usbutils: Fix bug in link state description printing. + + +usbutils 0.90 +============= +Aurelien Jarno (1): + fix bcdDFUVersion endianness + +Chris Clayton (1): + Patch to add additional devices to usb.ids + +Daniel Mack (7): + dump_audiostreaming_interface(): fix ac-3 decoder + parse USB audio class 2 control interface types + parse USB audio class 2 streaming interfaces + parse USB audio class 2 endpoints + dump_audio_bmcontrols(): tell users about faulty bmControl bits + dump_audiostreaming_interface(): drop audio class 2 FORMAT_TYPE length check + lsusb: fix iFeature position calculation for UAC2 feature units + +Greg Kroah-Hartman (8): + reserve a USB Ethernet Gadget driver device id. + fix up wording of NCM Ethernet gadget device id + fix up some signed/unsigned warnings in lsusb.c + move #defines around a bit to make it more orderly. + Merge git://github.com/zonque/usbutils into work + more gadget device ids reserved for the Linux Foundation vendor id + Merge branch 'master' of git://github.com/zonque/usbutils into test + Fix up a lot of memory leaks + +Ludovic Rousseau (1): + Update Gemplus id + +Matthew Wilcox (1): + Decode USB 3 Endpoint Companion Descriptors + +Nix (1): + Include config.h before everything else. + + +usbutils 0.87 +============= +Aurelien Jarno (1): + lsusb.c: correctly dump ccid devices + +Greg Kroah-Hartman (11): + lots of trailing whitespace removed. + add autogen.sh script + coding style cleanups for .h files. + names.c: fix up some compiler warnings + coding style cleanups for usbmisc.c + names.c: fix lots of coding style issues + devtree.c: coding style cleanups + lsusb.c: coding style fixes + lsusb.c: fix some build warnings. + usb.ids: Reserve EEM Gadget id for the Linux Foundation + add lsusb.py from Kurt Garloff <garloff@suse.de> + +Philip A. Prindeville (1): + Fix build issue with libusb location + + +usbutils 0.86 +============= +HID device robust fix + +usbutils 0.85 +============= +usb-devices bugfixes +build fixes + +usbutils 0.84 +============= +Sync up usb.ids file from upstream + +usbutils 0.83 +============= +HID descriptor bugfixes +usb-devices script to emulate the /proc/bus/usb/devices file +new device ids + +usbutils 0.82 +============= +Wireless USB device support +better autoconf support. +automatic handling for usb.ids +bugfixes + +usbutils 0.81 +============= +fixed '-t' option if usbfs is not mounted +added DFU parsing +updated the man page + +usbutils 0.80 +============= +Updated usb.ids. +Updated autotools logic. +Removed obsolete usbmodules. + +usbutils 0.73 (and older) +============= +Thanks to a patch from Aurelien Jarno, usbutils now uses the system's +libusb to access USB devices, not a private (old) copy of that library. + +The "usbmodules" program is now deprecated, and no longer built by default. +If your Linux 2.4 based system needs it to handle the "coldplug" processing +(handling devices that exist before the OS is fully operational), you +can "configure --enable-usbmodules". + diff --git a/README.md b/README.md new file mode 100644 index 0000000..293a1c7 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +<!--- +SPDX-License-Identifier: GPL-2.0-or-later +Copyright (c) 2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--> +# usbutils + +This is a collection of USB tools for use on Linux and BSD systems to +query what type of USB devices are connected to the system. This is to +be run on a USB host (i.e. a machine you plug USB devices into), not on +a USB device (i.e. a device you plug into a USB host.) + +## Building and installing + +Note, usbutils depends on libusb, be sure that library is properly +installed first. + +To work with the "raw" repo, after cloning it just do: + + ./autogen.sh + +Or if you like doing things "by hand" you can try the following: + +Get the usbhid-dump git submodule: + + git submodule init + git submodule update + +Initialize autobuild with: + + autoreconf --install --symlink + +Configure the project with: + + ./configure + +Build everything with: + + make + +Install it, if you really want to, with: + + make install + +## Source location + +The source for usbutils can be found in many places, depending on the git +hosting site you prefer. Here are the primary locations, in order of +preference by the maintainer: + + https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usbutils.git/ + https://git.sr.ht/~gregkh/usbutils + https://github.com/gregkh/usbutils diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..5b12ff7 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1494 @@ +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. + +# 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. + +# 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. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + +dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.1]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.16' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.5])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# 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. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# 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. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: <https://www.gnu.org/software/coreutils/>. + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# +# 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. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + AM_RUN_LOG([cat conftest.dir/file]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 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 <https://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* | MSYS*) + 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/* | msys/*) + 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 | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..1d782b7 --- /dev/null +++ b/config.h.in @@ -0,0 +1,166 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the <byteswap.h> header file. */ +#undef HAVE_BYTESWAP_H + +/* Define to 1 if you have the `iconv' function. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <minix/config.h> header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* Define to 1 if you have the `nl_langinfo' function. */ +#undef HAVE_NL_LANGINFO + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_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 you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_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 1 if you have the <wchar.h> header file. */ +#undef HAVE_WCHAR_H + +/* 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 + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + +/* Version number of package */ +#undef VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES diff --git a/configure b/configure new file mode 100755 index 0000000..3b4d3ac --- /dev/null +++ b/configure @@ -0,0 +1,6747 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for usbutils 017. +# +# Report bugs to <linux-usb@vger.kernel.org>. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi +if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and +$0: linux-usb@vger.kernel.org about your system, including +$0: any error possibly output before this message. Then +$0: install a modern shell, or manually run the script +$0: under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 </dev/null +exec 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='usbutils' +PACKAGE_TARNAME='usbutils' +PACKAGE_VERSION='017' +PACKAGE_STRING='usbutils 017' +PACKAGE_BUGREPORT='linux-usb@vger.kernel.org' +PACKAGE_URL='' + +ac_default_prefix=/usr +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stddef.h> +#ifdef HAVE_STDIO_H +# include <stdio.h> +#endif +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_header_c_list= +enable_option_checking=no +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +subdirs +UDEV_LIBS +UDEV_CFLAGS +LIBUSB_LIBS +LIBUSB_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +pkgconfigdir +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_dependency_tracking +enable_largefile +with_pkgconfigdir +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +LIBUSB_CFLAGS +LIBUSB_LIBS +UDEV_CFLAGS +UDEV_LIBS' +ac_subdirs_all='usbhid-dump' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures usbutils 017 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/usbutils] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of usbutils 017:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-largefile omit support for large files + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pkgconfigdir pkg-config installation directory + ['${libdir}/pkgconfig'] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + LIBUSB_CFLAGS + C compiler flags for LIBUSB, overriding pkg-config + LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config + UDEV_CFLAGS C compiler flags for UDEV, overriding pkg-config + UDEV_LIBS linker flags for UDEV, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to <linux-usb@vger.kernel.org>. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +usbutils configure 017 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include <limits.h> +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by usbutils $as_me 017, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include <stddef.h> +#include <stdarg.h> +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include <stdbool.h> +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" + +# Auxiliary files required by this configure script. +ac_aux_files="compile missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +am__api_version='1.16' + + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='usbutils' + VERSION='017' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: <https://www.gnu.org/software/coreutils/>. + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + + + + + + + + + + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_safe_to_define___extensions__=yes +else $as_nop + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <wchar.h> + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 500 + #include <wchar.h> + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi + +# Check whether --enable-largefile was given. +if test ${enable_largefile+y} +then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO" +then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h +;; +esac +rm -rf conftest* + fi +fi + + +ac_fn_c_check_header_compile "$LINENO" "byteswap.h" "ac_cv_header_byteswap_h" "$ac_includes_default" +if test "x$ac_cv_header_byteswap_h" = xyes +then : + printf "%s\n" "#define HAVE_BYTESWAP_H 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" +if test "x$ac_cv_func_iconv" = xyes +then : + printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h + +fi + + + + + +# Check whether --with-pkgconfigdir was given. +if test ${with_pkgconfigdir+y} +then : + withval=$with_pkgconfigdir; +else $as_nop + with_pkgconfigdir='${libdir}/pkgconfig' +fi + +pkgconfigdir=$with_pkgconfigdir + + + + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5 +printf %s "checking for LIBUSB... " >&6; } + +if test -n "$LIBUSB_CFLAGS"; then + pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.14\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.14") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0 >= 1.0.14" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUSB_LIBS"; then + pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.14\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.14") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb-1.0 >= 1.0.14" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libusb-1.0 >= 1.0.14" 2>&1` + else + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libusb-1.0 >= 1.0.14" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUSB_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libusb-1.0 >= 1.0.14) were not met: + +$LIBUSB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details" "$LINENO" 5; } +else + LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS + LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +fi + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5 +printf %s "checking for UDEV... " >&6; } + +if test -n "$UDEV_CFLAGS"; then + pkg_cv_UDEV_CFLAGS="$UDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev >= 196\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev >= 196") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_UDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev >= 196" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$UDEV_LIBS"; then + pkg_cv_UDEV_LIBS="$UDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev >= 196\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev >= 196") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_UDEV_LIBS=`$PKG_CONFIG --libs "libudev >= 196" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + UDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libudev >= 196" 2>&1` + else + UDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libudev >= 196" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$UDEV_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libudev >= 196) were not met: + +$UDEV_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables UDEV_CFLAGS +and UDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables UDEV_CFLAGS +and UDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details" "$LINENO" 5; } +else + UDEV_CFLAGS=$pkg_cv_UDEV_CFLAGS + UDEV_LIBS=$pkg_cv_UDEV_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +fi + +ac_config_headers="$ac_config_headers config.h" + +ac_config_files="$ac_config_files usbutils.pc Makefile" + + + +subdirs="$subdirs usbhid-dump" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi +if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by usbutils $as_me 017, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <linux-usb@vger.kernel.org>." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +usbutils config.status 017 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "usbutils.pc") CONFIG_FILES="$CONFIG_FILES usbutils.pc" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' <confdefs.h | sed ' +s/'"$ac_delim"'/"\\\ +"/g' >>$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_dir" || continue + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + printf "%s\n" "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + cd "$ac_dir" + + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +printf "%s\n" "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 + fi + + cd "$ac_popdir" + done +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: + usbutils $VERSION + ============= + + prefix: ${prefix} + datarootdir: ${datarootdir} + datadir: ${datadir} + pkgconfigdir: ${pkgconfigdir} + mandir: ${mandir} + + usb.ids: ${datadir}/usb.ids + + compiler: ${CC} + cflags: ${CFLAGS} + ldflags: ${LDFLAGS} +" >&5 +printf "%s\n" " + usbutils $VERSION + ============= + + prefix: ${prefix} + datarootdir: ${datarootdir} + datadir: ${datadir} + pkgconfigdir: ${pkgconfigdir} + mandir: ${mandir} + + usb.ids: ${datadir}/usb.ids + + compiler: ${CC} + cflags: ${CFLAGS} + ldflags: ${LDFLAGS} +" >&6; } + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..6b7fdb7 --- /dev/null +++ b/configure.ac @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (c) 2009 Kay Sievers <kay.sievers@vrfy.org> + +AC_INIT([usbutils], + [017], + [linux-usb@vger.kernel.org]) +AC_PREREQ(2.60) +AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_PREFIX_DEFAULT([/usr]) + +AC_USE_SYSTEM_EXTENSIONS +AC_SYS_LARGEFILE + +AC_CHECK_HEADERS([byteswap.h]) +AC_CHECK_FUNCS([nl_langinfo iconv]) + +PKG_INSTALLDIR + +PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.14) + +PKG_CHECK_MODULES(UDEV, libudev >= 196) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([ + usbutils.pc + Makefile +]) +AC_CONFIG_SUBDIRS([usbhid-dump]) + +AC_OUTPUT +AC_MSG_RESULT([ + usbutils $VERSION + ============= + + prefix: ${prefix} + datarootdir: ${datarootdir} + datadir: ${datadir} + pkgconfigdir: ${pkgconfigdir} + mandir: ${mandir} + + usb.ids: ${datadir}/usb.ids + + compiler: ${CC} + cflags: ${CFLAGS} + ldflags: ${LDFLAGS} +]) @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 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 <https://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" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + 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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/desc-defs.c b/desc-defs.c new file mode 100644 index 0000000..4cad9e7 --- /dev/null +++ b/desc-defs.c @@ -0,0 +1,1131 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * USB descriptor definitions + * + * Copyright (C) 2017-2018 Michael Drake <michael.drake@codethink.co.uk> + */ + +#include "config.h" + +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> + +#include "desc-defs.h" + +/** Macro for computing number of elements in array. */ +#define ARRAY_LEN(a) ((sizeof(a)) / (sizeof(a[0]))) + +/** + * Undefined descriptor + * + * Ensures remaining data is dumped as garbage at end of descriptor. + */ +const struct desc desc_undefined[] = { + { .field = NULL } +}; + +/** USB Audio Device Class 1 Channel Names. (Note: Order matters.) */ +static const char * const uac1_channel_names[] = { + "Left Front (L)", "Right Front (R)", "Center Front (C)", + "Low Frequency Enhancement (LFE)", "Left Surround (LS)", + "Right Surround (RS)", "Left of Center (LC)", "Right of Center (RC)", + "Surround (S)", "Side Left (SL)", "Side Right (SR)", "Top (T)" +}; + +/** USB Audio Device Class 2 Channel Names. (Note: Order matters.) */ +static const char * const uac2_channel_names[] = { + "Front Left (FL)", "Front Right (FR)", "Front Center (FC)", + "Low Frequency Effects (LFE)", "Back Left (BL)", "Back Right (BR)", + "Front Left of Center (FLC)", "Front Right of Center (FRC)", + "Back Center (BC)", "Side Left (SL)", "Side Right (SR)", + "Top Center (TC)", "Top Front Left (TFL)", "Top Front Center (TFC)", + "Top Front Right (TFR)", "Top Back Left (TBL)", "Top Back Center (TBC)", + "Top Back Right (TBR)", "Top Front Left of Center (TFLC)", + "Top Front Right of Center (TFRC)", "Left Low Frequency Effects (LLFE)", + "Right Low Frequency Effects (RLFE)", "Top Side Left (TSL)", + "Top Side Right (TSR)", "Bottom Center (BC)", + "Back Left of Center (BLC)", "Back Right of Center (BRC)" +}; + +/** Audio Control Interface Header bmControls; Human readable bit meanings. */ +static const char * const uac2_interface_header_bmcontrols[] = { + [0] = "Latency control", + [1] = NULL +}; + +/** UAC1: 4.3.2 Class-Specific AC Interface Descriptor; Table 4-2. */ +static const struct desc desc_audio_1_ac_header[] = { + { .field = "bcdADC", .size = 2, .type = DESC_BCD }, + { .field = "wTotalLength", .size = 2, .type = DESC_CONSTANT }, + { .field = "bInCollection", .size = 1, .type = DESC_CONSTANT }, + { .field = "baInterfaceNr", .size = 1, .type = DESC_NUMBER, + .array = { .array = true } }, + { .field = NULL } +}; + +/** UAC2: 4.7.2 Class-Specific AC Interface Descriptor; Table 4-5. */ +static const struct desc desc_audio_2_ac_header[] = { + { .field = "bcdADC", .size = 2, .type = DESC_BCD }, + { .field = "bCategory", .size = 1, .type = DESC_CONSTANT }, + { .field = "wTotalLength", .size = 2, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_interface_header_bmcontrols }, + { .field = NULL } +}; + +/** UAC3: 4.5.2 Class-Specific AC Interface Descriptor; Table 4-15. */ +static const struct desc desc_audio_3_ac_header[] = { + { .field = "bCategory", .size = 1, .type = DESC_CONSTANT }, + { .field = "wTotalLength", .size = 2, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_interface_header_bmcontrols }, + { .field = NULL } +}; + +/** AudioControl Header descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_header[3] = { + desc_audio_1_ac_header, + desc_audio_2_ac_header, + desc_audio_3_ac_header, +}; + +/** UAC2: 4.7.2.10 Effect Unit Descriptor; Table 4-15. */ +static const struct desc desc_audio_2_ac_effect_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wEffectType", .size = 2, .type = DESC_CONSTANT }, + { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bmaControls", .size = 4, .type = DESC_BITMAP, + .array = { .array = true } }, + { .field = "iEffects", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.9 Effect Unit Descriptor; Table 4-33. */ +static const struct desc desc_audio_3_ac_effect_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wEffectType", .size = 2, .type = DESC_CONSTANT }, + { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bmaControls", .size = 4, .type = DESC_BITMAP, + .array = { .array = true } }, + { .field = "wEffectsDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Effect Unit descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_effect_unit[3] = { + NULL, /* UAC1 not supported */ + desc_audio_2_ac_effect_unit, + desc_audio_3_ac_effect_unit, +}; + +/** UAC2 Input Terminal bmControls; Human readable bit meanings. */ +static const char * const uac2_input_term_bmcontrols[] = { + [0] = "Copy Protect", + [1] = "Connector", + [2] = "Overload", + [3] = "Cluster", + [4] = "Underflow", + [5] = "Overflow", + [6] = NULL +}; + +/** UAC3 Input Terminal bmControls; Human readable bit meanings. */ +static const char * const uac3_input_term_bmcontrols[] = { + [0] = "Insertion", + [1] = "Overload", + [2] = "Underflow", + [3] = "Overflow", + [4] = "Underflow", + [5] = NULL +}; + +/** UAC1: 4.3.2.1 Input Terminal Descriptor; Table 4-3. */ +static const struct desc desc_audio_1_ac_input_terminal[] = { + { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER }, + { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR }, + { .field = "bAssocTerminal", .size = 1, .type = DESC_CONSTANT }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.4 Input Terminal Descriptor; Table 4-9. */ +static const struct desc desc_audio_2_ac_input_terminal[] = { + { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER }, + { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR }, + { .field = "bAssocTerminal", .size = 1, .type = DESC_CONSTANT }, + { .field = "bCSourceID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "bmControls", .size = 2, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_input_term_bmcontrols }, + { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.1 Input Terminal Descriptor; Table 4-16. */ +static const struct desc desc_audio_3_ac_input_terminal[] = { + { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER }, + { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR }, + { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER }, + { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_input_term_bmcontrols }, + { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER }, + { .field = "wExTerminalDescrID", .size = 2, .type = DESC_NUMBER }, + { .field = "wConnectorsDescrID", .size = 2, .type = DESC_NUMBER }, + { .field = "wTerminalDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Input Terminal descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_input_terminal[3] = { + desc_audio_1_ac_input_terminal, + desc_audio_2_ac_input_terminal, + desc_audio_3_ac_input_terminal, +}; + +/** UAC2 Output Terminal bmControls; Human readable bit meanings. */ +static const char * const uac2_output_term_bmcontrols[] = { + [0] = "Copy Protect", + [1] = "Connector", + [2] = "Overload", + [3] = "Underflow", + [4] = "Overflow", + [5] = NULL +}; + +/** UAC3 Output Terminal bmControls; Human readable bit meanings. */ +static const char * const uac3_output_term_bmcontrols[] = { + [0] = "Insertion", + [1] = "Overload", + [2] = "Underflow", + [3] = "Overflow", + [4] = NULL +}; + +/** UAC1: 4.3.2.2 Output Terminal Descriptor; Table 4-4. */ +static const struct desc desc_audio_1_ac_output_terminal[] = { + { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER }, + { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR }, + { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER }, + { .field = "bSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.5 Output Terminal Descriptor; Table 4-10. */ +static const struct desc desc_audio_2_ac_output_terminal[] = { + { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER }, + { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR }, + { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER }, + { .field = "bSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 2, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_output_term_bmcontrols }, + { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.2 Output Terminal Descriptor; Table 4-17. */ +static const struct desc desc_audio_3_ac_output_terminal[] = { + { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER }, + { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR }, + { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER }, + { .field = "bSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_output_term_bmcontrols }, + { .field = "wExTerminalDescrID", .size = 2, .type = DESC_NUMBER }, + { .field = "wConnectorsDescrID", .size = 2, .type = DESC_NUMBER }, + { .field = "wTerminalDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Output Terminal descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_output_terminal[3] = { + desc_audio_1_ac_output_terminal, + desc_audio_2_ac_output_terminal, + desc_audio_3_ac_output_terminal, +}; + +/** UAC3: 4.5.2.3.1 Extended Terminal Header Descriptor; Table 4-18. */ +static const struct desc desc_audio_3_ac_extended_terminal_header[] = { + { .field = "wDescriptorID", .size = 2, .type = DESC_NUMBER }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = NULL } +}; + +/** Extended Terminal descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_extended_terminal[3] = { + NULL, /* UAC1 not supported */ + NULL, /* UAC2 not supported */ + desc_audio_3_ac_extended_terminal_header, +}; + +/** UAC3: 4.5.2.15 Power Domain Descriptor; Table 4-46. */ +static const struct desc desc_audio_3_ac_power_domain[] = { + { .field = "bPowerDomainID", .size = 1, .type = DESC_NUMBER }, + { .field = "waRecoveryTime(1)", .size = 2, .type = DESC_NUMBER }, + { .field = "waRecoveryTime(2)", .size = 2, .type = DESC_NUMBER }, + { .field = "bNrEntities", .size = 1, .type = DESC_NUMBER }, + { .field = "baEntityID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrEntities" } }, + { .field = "wPDomainDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Power Domain descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_power_domain[3] = { + NULL, /* UAC1 not supported */ + NULL, /* UAC2 not supported */ + desc_audio_3_ac_power_domain, +}; + +/** UAC2 Mixer Unit bmControls; Human readable bit meanings. */ +static const char * const uac2_mixer_unit_bmcontrols[] = { + [0] = "Cluster", + [1] = "Underflow", + [2] = "Overflow", + [3] = NULL +}; + +/** UAC3 Mixer Unit bmControls; Human readable bit meanings. */ +static const char * const uac3_mixer_unit_bmcontrols[] = { + [0] = "Underflow", + [1] = "Overflow", + [2] = NULL +}; + +/** UAC1: 4.3.2.3 Mixer Unit Descriptor; Table 4-5. */ +static const struct desc desc_audio_1_ac_mixer_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "bmControls", .size = 1, .type = DESC_BITMAP, + .array = { .array = true, .bits = true, + .length_field1 = "bNrInPins", + .length_field2 = "bNrChannels" } }, + { .field = "iMixer", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.6 Mixer Unit Descriptor; Table 4-11. */ +static const struct desc desc_audio_2_ac_mixer_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "bmChannelConfig",.size = 4, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "bmMixerControls",.size = 1, .type = DESC_BITMAP, + .array = { .array = true, .bits = true, + .length_field1 = "bNrInPins", + .length_field2 = "bNrChannels" } }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_mixer_unit_bmcontrols }, + { .field = "iMixer", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.5 Mixer Unit Descriptor; Table 4-29. */ +static const struct desc desc_audio_3_ac_mixer_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "wClusterDescrID",.size = 2, .type = DESC_NUMBER }, + { .field = "bmMixerControls",.size = 1, .type = DESC_BITMAP, + .array = { .array = true } }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_mixer_unit_bmcontrols }, + { .field = "wMixerDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Mixer Unit descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_mixer_unit[3] = { + desc_audio_1_ac_mixer_unit, + desc_audio_2_ac_mixer_unit, + desc_audio_3_ac_mixer_unit, +}; + +/** Selector Unit bmControls; Human readable bit meanings. */ +static const char * const uac2_selector_unit_bmcontrols[] = { + [0] = "Selector", + [1] = NULL +}; + +/** UAC1: 4.3.2.4 Selector Unit Descriptor; Table 4-6. */ +static const struct desc desc_audio_1_ac_selector_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "iSelector", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.7 Selector Unit Descriptor; Table 4-12. */ +static const struct desc desc_audio_2_ac_selector_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_selector_unit_bmcontrols }, + { .field = "iSelector", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.6 Selector Unit Descriptor; Table 4-30. */ +static const struct desc desc_audio_3_ac_selector_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_selector_unit_bmcontrols }, + { .field = "wSelectorDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Selector Unit descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_selector_unit[3] = { + desc_audio_1_ac_selector_unit, + desc_audio_2_ac_selector_unit, + desc_audio_3_ac_selector_unit, +}; + +/** UAC1: Table A-7: Processing Unit Process Types */ +static const char * const uac1_proc_unit_types[] = { + [0] = "Undefined", + [1] = "Up/Down-mix", + [2] = "Dolby Prologic", + [3] = "3D Stereo Extender", + [4] = "Reverberation", + [5] = "Chorus", + [6] = "Dyn Range Comp", + [7] = NULL +}; + +/** UAC1: Up/Down-mix and Dolby Prologic proc unit descriptor extensions Table 4-9, Table 4-10. */ +static const struct desc desc_audio_1_ac_proc_unit_extended[] = { + { .field = "bNrModes", .size = 1, .type = DESC_NUMBER }, + { .field = "waModes", .size = 2, .type = DESC_BITMAP, + .array = { .array = true, .length_field1 = "bNrModes" } }, + { .field = NULL } +}; + +/** UAC1: Table A-7: Processing Unit Process Types */ +static const struct desc_ext desc_audio_1_ac_proc_unit_specific[] = { + { .type = 1, .desc = desc_audio_1_ac_proc_unit_extended }, + { .type = 2, .desc = desc_audio_1_ac_proc_unit_extended }, + { .desc = NULL } +}; + +/** UAC1: 4.3.2.6 Processing Unit Descriptor; Table 4-8. */ +static const struct desc desc_audio_1_ac_processing_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wProcessType", .size = 2, .type = DESC_NUMBER_STRINGS, + .number_strings = uac1_proc_unit_types }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "bControlSize", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 1, .type = DESC_BITMAP, + .array = { .array = true, .length_field1 = "bControlSize" } }, + { .field = "iProcessing", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "Process-specific", .size = 1, .type = DESC_EXTENSION, + .extension = { .type_field = "wProcessType", .d = desc_audio_1_ac_proc_unit_specific } }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.11.1 Up/Down-mix Processing Unit Descriptor; Table 4-21. */ +static const struct desc desc_audio_2_ac_proc_unit_up_down_mix[] = { + { .field = "bNrModes", .size = 1, .type = DESC_NUMBER }, + { .field = "daModes", .size = 4, .type = DESC_BITMAP, + .array = { .array = true, .length_field1 = "bNrModes" } }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.11.2 Dolby prologic Processing Unit Descriptor; Table 4-22. */ +static const struct desc desc_audio_2_ac_proc_unit_dolby_prologic[] = { + { .field = "bNrModes", .size = 1, .type = DESC_NUMBER }, + { .field = "daModes", .size = 4, .type = DESC_BITMAP, + .array = { .array = true, .length_field1 = "bNrModes" } }, + { .field = NULL } +}; + +/** UAC2: Table A-12: Processing Unit Process Types */ +static const struct desc_ext desc_audio_2_ac_proc_unit_specific[] = { + { .type = 1, .desc = desc_audio_2_ac_proc_unit_up_down_mix }, + { .type = 2, .desc = desc_audio_2_ac_proc_unit_dolby_prologic }, + { .desc = NULL } +}; + +/** UAC2: Table A-12: Processing Unit Process Types */ +static const char * const uac2_proc_unit_types[] = { + [0] = "Undefined", + [1] = "Up/Down-mix", + [2] = "Dolby Prologic", + [3] = "Stereo Extender", + [4] = NULL +}; + +/** UAC2: 4.7.2.11 Processing Unit Descriptor; Table 4-20. */ +static const struct desc desc_audio_2_ac_processing_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wProcessType", .size = 2, .type = DESC_NUMBER_STRINGS, + .number_strings = uac2_proc_unit_types }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "bmControls", .size = 2, .type = DESC_BITMAP }, + { .field = "iProcessing", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "Process-specific", .size = 1, .type = DESC_EXTENSION, + .extension = { .type_field = "wProcessType", .d = desc_audio_2_ac_proc_unit_specific } }, + { .field = NULL } +}; + +/** Processor unit Up/Down-mix bmControls; Human readable bit meanings. */ +static const char * const uac3_proc_unit_up_down_mix_bmcontrols[] = { + [0] = "Mode Select", + [1] = "Underflow", + [2] = "Overflow", + [3] = NULL +}; + +/** UAC3: 4.5.2.10.1 Up/Down-mix Processing Unit Descriptor; Table 4-39. */ +static const struct desc desc_audio_3_ac_proc_unit_up_down_mix[] = { + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_proc_unit_up_down_mix_bmcontrols }, + { .field = "bNrModes", .size = 1, .type = DESC_NUMBER }, + { .field = "waClusterDescrID", .size = 2, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrModes" } }, + { .field = NULL } +}; + +/** Processor unit stereo extender bmControls; Human readable bit meanings. */ +static const char * const uac3_proc_unit_stereo_extender_bmcontrols[] = { + [0] = "Width", + [1] = "Underflow", + [2] = "Overflow", + [3] = NULL +}; + +/** UAC3: 4.5.2.10.2 Stereo Extender Processing Unit Descriptor; Table 4-40. */ +static const struct desc desc_audio_3_ac_proc_unit_stereo_extender[] = { + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_proc_unit_stereo_extender_bmcontrols }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.10.3 Multi Func Proc Unit Descriptor; Algorithms; Table 4-41. */ +static const char *uac3_proc_unit_multi_func_algorithms[] = { + [0] = "Algorithm Undefined.", + [1] = "Beam Forming.", + [2] = "Acoustic Echo Cancellation.", + [3] = "Active Noise Cancellation.", + [4] = "Blind Source Separation.", + [5] = "Noise Suppression/Reduction.", + [6] = NULL +}; + +/** Processor unit Multi Func bmControls; Human readable bit meanings. */ +static const char * const uac3_proc_unit_multi_func_bmcontrols[] = { + [0] = "Underflow", + [1] = "Overflow", + [2] = NULL +}; + +/** UAC3: 4.5.2.10.3 Multi Function Processing Unit Descriptor; Table 4-41. */ +static const struct desc desc_audio_3_ac_proc_unit_multi_function[] = { + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_proc_unit_multi_func_bmcontrols }, + { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER, }, + { .field = "bmAlgorithms", .size = 4, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { + .strings = uac3_proc_unit_multi_func_algorithms, + .count = 6 + } }, + { .field = NULL } +}; + +/** UAC3: Table A-20: Processing Unit Process Types */ +static const char * const uac3_proc_unit_types[] = { + [0] = "Undefined", + [1] = "Up/Down-mix", + [2] = "Stereo Extender", + [3] = "Multi-Function", + [4] = NULL +}; + +/** UAC3: Table A-20: Processing Unit Process Types */ +static const struct desc_ext desc_audio_3_ac_proc_unit_specific[] = { + { .type = 1, .desc = desc_audio_3_ac_proc_unit_up_down_mix }, + { .type = 2, .desc = desc_audio_3_ac_proc_unit_stereo_extender }, + { .type = 3, .desc = desc_audio_3_ac_proc_unit_multi_function }, + { .desc = NULL } +}; + +/** UAC3: 4.5.2.10 Processing Unit Descriptor; Table 4-38. */ +static const struct desc desc_audio_3_ac_processing_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wProcessType", .size = 2, .type = DESC_NUMBER_STRINGS, + .number_strings = uac3_proc_unit_types }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "wProcessingDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = "Process-specific", .size = 1, .type = DESC_EXTENSION, + .extension = { .type_field = "wProcessType", .d = desc_audio_3_ac_proc_unit_specific } }, + { .field = NULL } +}; + +/** Processing Unit descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_processing_unit[3] = { + desc_audio_1_ac_processing_unit, + desc_audio_2_ac_processing_unit, + desc_audio_3_ac_processing_unit, +}; + +/** Audio Control Feature Unit bmControls; Human readable bit meanings. */ +static const char * const uac_feature_unit_bmcontrols[] = { + [ 0] = "Mute", + [ 1] = "Volume", + [ 2] = "Bass", + [ 3] = "Mid", + [ 4] = "Treble", + [ 5] = "Graphic Equalizer", + [ 6] = "Automatic Gain", + [ 7] = "Delay", + [ 8] = "Bass Boost", + [ 9] = "Loudness", + [10] = "Input gain", + [11] = "Input gain pad", + [12] = "Phase inverter", + [13] = NULL +}; + +/** UAC1: 4.3.2.5 Feature Unit Descriptor; Table 4-7. */ +static const struct desc desc_audio_1_ac_feature_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bControlSize", .size = 1, .type = DESC_NUMBER }, + { .field = "bmaControls", .size_field = "bControlSize", .type = DESC_BMCONTROL_1, + .bmcontrol = uac_feature_unit_bmcontrols, .array = { .array = true } }, + { .field = "iFeature", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.8 Feature Unit Descriptor; Table 4-13. */ +static const struct desc desc_audio_2_ac_feature_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bmaControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac_feature_unit_bmcontrols, .array = { .array = true } }, + { .field = "iFeature", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.7 Feature Unit Descriptor; Table 4-31. */ +static const struct desc desc_audio_3_ac_feature_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bmaControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac_feature_unit_bmcontrols, .array = { .array = true } }, + { .field = "wFeatureDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Feature Unit descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_feature_unit[3] = { + desc_audio_1_ac_feature_unit, + desc_audio_2_ac_feature_unit, + desc_audio_3_ac_feature_unit, +}; + +/** UAC2 Extension Unit bmControls; Human readable bit meanings. */ +static const char * const uac2_extension_unit_bmcontrols[] = { + [0] = "Enable", + [1] = "Cluster", + [2] = "Underflow", + [3] = "Overflow", + [4] = NULL +}; + +/** UAC3 Extension Unit bmControls; Human readable bit meanings. */ +static const char * const uac3_extension_unit_bmcontrols[] = { + [0] = "Underflow", + [1] = "Overflow", + [2] = NULL +}; + +/** UAC1: 4.3.2.7 Extension Unit Descriptor; Table 4-15. */ +static const struct desc desc_audio_1_ac_extension_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wExtensionCode", .size = 2, .type = DESC_CONSTANT }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "bControlSize", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 1, .type = DESC_BITMAP, + .array = { .array = true, .length_field1 = "bControlSize" } }, + { .field = "iExtension", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC2: 4.7.2.12 Extension Unit Descriptor; Table 4-24. */ +static const struct desc desc_audio_2_ac_extension_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wExtensionCode", .size = 2, .type = DESC_CONSTANT }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_extension_unit_bmcontrols }, + { .field = "iExtension", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.11 Extension Unit Descriptor; Table 4-42. */ +static const struct desc desc_audio_3_ac_extension_unit[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "wExtensionCode", .size = 2, .type = DESC_CONSTANT }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "wExtensionDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_extension_unit_bmcontrols }, + { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER }, + { .field = NULL } +}; + +/** Extension Unit descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_extension_unit[3] = { + desc_audio_1_ac_extension_unit, + desc_audio_2_ac_extension_unit, + desc_audio_3_ac_extension_unit, +}; + +/** UAC2 Clock Source bmControls; Human readable bit meanings. */ +static const char * const uac2_clock_source_bmcontrols[] = { + [0] = "Clock Frequency", + [1] = "Clock Validity", + [2] = NULL +}; + +static const char * const uac2_clk_src_bmattr[] = { + [0] = "External", + [1] = "Internal fixed", + [2] = "Internal variable", + [3] = "Internal programmable" +}; + +static const char * const uac3_clk_src_bmattr[] = { + [0] = "External", + [1] = "Internal", + [2] = "(asynchronous)", + [3] = "(synchronized to SOF)" +}; + +/** Special rendering function for UAC2 clock source bmAttributes */ +static void desc_snowflake_dump_uac2_clk_src_bmattr( + unsigned long long value, + unsigned int indent) +{ + printf(" %s clock %s\n", + uac2_clk_src_bmattr[value & 0x3], + (value & 0x4) ? uac3_clk_src_bmattr[3] : ""); +} + +/** Special rendering function for UAC3 clock source bmAttributes */ +static void desc_snowflake_dump_uac3_clk_src_bmattr( + unsigned long long value, + unsigned int indent) +{ + printf(" %s clock %s\n", + uac3_clk_src_bmattr[(value & 0x1)], + uac3_clk_src_bmattr[0x2 | ((value & 0x2) >> 1)]); +} + +/** UAC2: 4.7.2.1 Clock Source Descriptor; Table 4-6. */ +static const struct desc desc_audio_2_ac_clock_source[] = { + { .field = "bClockID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bmAttributes", .size = 1, .type = DESC_SNOWFLAKE, + .snowflake = desc_snowflake_dump_uac2_clk_src_bmattr }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_clock_source_bmcontrols }, + { .field = "bAssocTerminal", .size = 1, .type = DESC_CONSTANT }, + { .field = "iClockSource", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.12 Clock Source Descriptor; Table 4-43. */ +static const struct desc desc_audio_3_ac_clock_source[] = { + { .field = "bClockID", .size = 1, .type = DESC_NUMBER }, + { .field = "bmAttributes", .size = 1, .type = DESC_SNOWFLAKE, + .snowflake = desc_snowflake_dump_uac3_clk_src_bmattr }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_clock_source_bmcontrols }, + { .field = "bReferenceTerminal", .size = 1, .type = DESC_NUMBER }, + { .field = "wClockSourceStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Clock Source descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_clock_source[3] = { + NULL, /* UAC1 not supported */ + desc_audio_2_ac_clock_source, + desc_audio_3_ac_clock_source, +}; + +/** UAC2 Clock Selector bmControls; Human readable bit meanings. */ +static const char * const uac2_clock_selector_bmcontrols[] = { + [0] = "Clock Selector", + [1] = NULL +}; + +/** UAC2: 4.7.2.2 Clock Selector Descriptor; Table 4-7. */ +static const struct desc desc_audio_2_ac_clock_selector[] = { + { .field = "bClockID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baCSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_clock_selector_bmcontrols }, + { .field = "iClockSelector", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.13 Clock Selector Descriptor; Table 4-44. */ +static const struct desc desc_audio_3_ac_clock_selector[] = { + { .field = "bClockID", .size = 1, .type = DESC_NUMBER }, + { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER }, + { .field = "baCSourceID", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bNrInPins" } }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_clock_selector_bmcontrols }, + { .field = "wCSelectorDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Clock Selector descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_clock_selector[3] = { + NULL, /* UAC1 not supported */ + desc_audio_2_ac_clock_selector, + desc_audio_3_ac_clock_selector, +}; + +/** UAC2 Clock Multiplier bmControls; Human readable bit meanings. */ +static const char * const uac2_clock_multiplier_bmcontrols[] = { + [0] = "Clock Numerator", + [1] = "Clock Denominator", + [2] = NULL +}; + +/** UAC2: 4.7.2.3 Clock Multiplier Descriptor; Table 4-8. */ +static const struct desc desc_audio_2_ac_clock_multiplier[] = { + { .field = "bClockID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_clock_multiplier_bmcontrols }, + { .field = "iClockMultiplier", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.14 Clock Multiplier Descriptor; Table 4-45. */ +static const struct desc desc_audio_3_ac_clock_multiplier[] = { + { .field = "bClockID", .size = 1, .type = DESC_NUMBER }, + { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_clock_multiplier_bmcontrols }, + { .field = "wCMultiplierDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Clock Multiplier descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_clock_multiplier[3] = { + NULL, /* UAC1 not supported */ + desc_audio_2_ac_clock_multiplier, + desc_audio_3_ac_clock_multiplier, +}; + +/** UAC2: 4.7.2.9 Sampling Rate Converter Descriptor; Table 4-14. */ +static const struct desc desc_audio_2_ac_sample_rate_converter[] = { + { .field = "bUnitID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bCSourceInID", .size = 1, .type = DESC_CONSTANT }, + { .field = "bCSourceOutID", .size = 1, .type = DESC_CONSTANT }, + { .field = "iSRC", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.5.2.8 Sampling Rate Converter Descriptor; Table 4-32. */ +static const struct desc desc_audio_3_ac_sample_rate_converter[] = { + { .field = "bUnitID", .size = 1, .type = DESC_NUMBER }, + { .field = "bSourceID", .size = 1, .type = DESC_NUMBER }, + { .field = "bCSourceInID", .size = 1, .type = DESC_NUMBER }, + { .field = "bCSourceOutID", .size = 1, .type = DESC_NUMBER }, + { .field = "wSRCDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID }, + { .field = NULL } +}; + +/** Sample Rate Converter descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_ac_sample_rate_converter[3] = { + NULL, /* UAC1 not supported */ + desc_audio_2_ac_sample_rate_converter, + desc_audio_3_ac_sample_rate_converter, +}; + +/** UAC2 AudioStreaming Interface bmControls; Human readable bit meanings. */ +static const char * const uac2_as_interface_bmcontrols[] = { + [0] = "Active Alternate Setting", + [1] = "Valid Alternate Setting", + [2] = NULL +}; + +/** UAC3 AudioStreaming Interface bmControls; Human readable bit meanings. */ +static const char * const uac3_as_interface_bmcontrols[] = { + [0] = "Active Alternate Setting", + [1] = "Valid Alternate Setting", + [2] = "Audio Data Format Control", + [3] = NULL +}; + +/* wFormatTag hex prefix for format type */ +#define UAC_FORMAT_TYPE_I 0x0 +#define UAC_FORMAT_TYPE_II 0x1 +#define UAC_FORMAT_TYPE_III 0x2 + +/** Format type I codes; Human-readable values. */ +static const char * const audio_data_format_type_i[] = { + [0] = "TYPE_I_UNDEFINED", + [1] = "PCM", + [2] = "PCM8", + [3] = "IEEE_FLOAT", + [4] = "ALAW", + [5] = "MULAW" +}; + +/** Format type II codes; Human-readable values. */ +static const char * const audio_data_format_type_ii[] = { + [0] = "TYPE_II_UNDEFINED", + [1] = "MPEG", + [2] = "AC-3" +}; + +/** Format type III codes; Human-readable values. */ +static const char * const audio_data_format_type_iii[] = { + [0] = "TYPE_III_UNDEFINED", + [1] = "IEC1937_AC-3", + [2] = "IEC1937_MPEG-1_Layer1", + [3] = "IEC1937_MPEG-Layer2/3/NOEXT", + [4] = "IEC1937_MPEG-2_EXT", + [5] = "IEC1937_MPEG-2_Layer1_LS", + [6] = "IEC1937_MPEG-2_Layer2/3_LS" +}; + +/** Special rendering function for UAC1 AS interface wFormatTag */ +static void desc_snowflake_dump_uac1_as_interface_wformattag( + unsigned long long value, + unsigned int indent) +{ + const char *format_string = "undefined"; + + /* Format codes are 0xTNNN, where T=Type prefix, NNN = format code. */ + + if (value < ((UAC_FORMAT_TYPE_I << 12) + + ARRAY_LEN(audio_data_format_type_i))) { + format_string = audio_data_format_type_i[value]; + + } else if ((value >= (UAC_FORMAT_TYPE_II << 12)) && + (value <= ((UAC_FORMAT_TYPE_II << 12) + + ARRAY_LEN(audio_data_format_type_ii)))) { + format_string = audio_data_format_type_ii[value & 0xfff]; + + } else if ((value >= (UAC_FORMAT_TYPE_III << 12)) && + (value <= ((UAC_FORMAT_TYPE_III << 12) + + ARRAY_LEN(audio_data_format_type_iii)))) { + format_string = audio_data_format_type_iii[value & 0xfff]; + } + + printf(" %s\n", format_string); +} + +/** Special rendering function for UAC2 AS interface bmFormats */ +static void desc_snowflake_dump_uac2_as_interface_bmformats( + unsigned long long value, + unsigned int indent) +{ + unsigned int i; + + printf("\n"); + for (i = 0; i < 5; i++) { + if ((value >> i) & 0x1) { + printf("%*s%s\n", indent * 2, "", + audio_data_format_type_i[i + 1]); + } + } + +} + +/** UAC1: 4.5.2 Class-Specific AS Interface Descriptor; Table 4-19. */ +static const struct desc desc_audio_1_as_interface[] = { + { .field = "bTerminalLink", .size = 1, .type = DESC_CONSTANT }, + { .field = "bDelay", .size = 1, .type = DESC_NUMBER_POSTFIX, + .number_postfix = " frames" }, + { .field = "wFormatTag", .size = 2, .type = DESC_SNOWFLAKE, + .snowflake = desc_snowflake_dump_uac1_as_interface_wformattag }, + { .field = NULL } +}; + +/** UAC2: 4.9.2 Class-Specific AS Interface Descriptor; Table 4-27. */ +static const struct desc desc_audio_2_as_interface[] = { + { .field = "bTerminalLink", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_as_interface_bmcontrols }, + { .field = "bFormatType", .size = 1, .type = DESC_CONSTANT }, + { .field = "bmFormats", .size = 4, .type = DESC_SNOWFLAKE, + .snowflake = desc_snowflake_dump_uac2_as_interface_bmformats }, + { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER }, + { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } }, + { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX }, + { .field = NULL } +}; + +/** UAC3: 4.7.2 Class-Specific AS Interface Descriptor; Table 4-49. */ +static const struct desc desc_audio_3_as_interface[] = { + { .field = "bTerminalLink", .size = 1, .type = DESC_NUMBER }, + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac3_as_interface_bmcontrols }, + { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER }, + { .field = "bmFormats", .size = 8, .type = DESC_BITMAP }, + { .field = "bSubslotSize", .size = 1, .type = DESC_NUMBER }, + { .field = "bBitResolution", .size = 1, .type = DESC_NUMBER }, + { .field = "bmAuxProtocols", .size = 2, .type = DESC_BITMAP }, + { .field = "bControlSize", .size = 1, .type = DESC_NUMBER }, + { .field = NULL } +}; + +/** AudioStreaming Interface descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_as_interface[3] = { + desc_audio_1_as_interface, + desc_audio_2_as_interface, + desc_audio_3_as_interface, +}; + +/** UAC1: Data Endpoint bmAttributes; Human readable bit meanings. */ +static const char * const uac1_as_endpoint_bmattributes[] = { + [0] = "Sampling Frequency", + [1] = "Pitch", + [2] = "Audio Data Format Control", + [7] = "MaxPacketsOnly" +}; + +/** UAC2: Data Endpoint bmAttributes; Human readable bit meanings. */ +static const char * const uac2_as_endpoint_bmattributes[] = { + [7] = "MaxPacketsOnly", +}; + +/** UAC2 AudioStreaming Interface bmControls; Human readable bit meanings. */ +static const char * const uac2_as_isochronous_audio_data_endpoint_bmcontrols[] = { + [0] = "Pitch", + [1] = "Data Overrun", + [2] = "Data Underrun", + [3] = NULL +}; + +/** Audio Data Endpoint bLockDelayUnits; Human readable value meanings. */ +static const char * const uac_as_isochronous_audio_data_endpoint_blockdelayunits[] = { + [0] = "Undefined", + [1] = "Milliseconds", + [2] = "Decoded PCM samples", + [3] = NULL +}; + +/** UAC1: 4.6.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor; Table 4-21. */ +static const struct desc desc_audio_1_as_isochronous_audio_data_endpoint[] = { + { .field = "bmAttributes", .size = 1, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac1_as_endpoint_bmattributes, .count = 8 } }, + { .field = "bLockDelayUnits", .size = 1, .type = DESC_NUMBER_STRINGS, + .number_strings = uac_as_isochronous_audio_data_endpoint_blockdelayunits }, + { .field = "wLockDelay", .size = 2, .type = DESC_NUMBER }, + { .field = NULL } +}; + +/** UAC2: 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor; Table 4-34. */ +static const struct desc desc_audio_2_as_isochronous_audio_data_endpoint[] = { + { .field = "bmAttributes", .size = 1, .type = DESC_BITMAP_STRINGS, + .bitmap_strings = { .strings = uac2_as_endpoint_bmattributes, .count = 8 } }, + { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_as_isochronous_audio_data_endpoint_bmcontrols }, + { .field = "bLockDelayUnits", .size = 1, .type = DESC_NUMBER_STRINGS, + .number_strings = uac_as_isochronous_audio_data_endpoint_blockdelayunits }, + { .field = "wLockDelay", .size = 2, .type = DESC_NUMBER }, + { .field = NULL } +}; + +/** UAC3: 4.8.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor; Table 4-52. */ +static const struct desc desc_audio_3_as_isochronous_audio_data_endpoint[] = { + { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2, + .bmcontrol = uac2_as_isochronous_audio_data_endpoint_bmcontrols }, + { .field = "bLockDelayUnits", .size = 1, .type = DESC_NUMBER_STRINGS, + .number_strings = uac_as_isochronous_audio_data_endpoint_blockdelayunits }, + { .field = "wLockDelay", .size = 2, .type = DESC_NUMBER }, + { .field = NULL } +}; + +/** Isochronous Audio Data Endpoint descriptor definitions for the three Audio Device Class protocols */ +const struct desc * const desc_audio_as_isochronous_audio_data_endpoint[3] = { + desc_audio_1_as_isochronous_audio_data_endpoint, + desc_audio_2_as_isochronous_audio_data_endpoint, + desc_audio_3_as_isochronous_audio_data_endpoint, +}; + +/** USB3: 9.6.2.7 Configuration Summary Descriptor; Table 9-21. */ +const struct desc desc_usb3_dc_configuration_summary[] = { + { .field = "bLength", .size = 1, .type = DESC_NUMBER }, + { .field = "bDescriptorType", .size = 1, .type = DESC_CONSTANT }, + { .field = "bDevCapabilityType", .size = 1, .type = DESC_NUMBER }, + { .field = "bcdVersion", .size = 2, .type = DESC_BCD }, + { .field = "bClass", .size = 1, .type = DESC_NUMBER }, + { .field = "bSubClass", .size = 1, .type = DESC_NUMBER }, + { .field = "bProtocol", .size = 1, .type = DESC_NUMBER }, + { .field = "bConfigurationCount", .size = 1, .type = DESC_NUMBER }, + { .field = "bConfigurationIndex", .size = 1, .type = DESC_NUMBER, + .array = { .array = true, .length_field1 = "bConfigurationCount" } }, + { .field = NULL } +}; diff --git a/desc-defs.h b/desc-defs.h new file mode 100644 index 0000000..27891bc --- /dev/null +++ b/desc-defs.h @@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * USB descriptor definitions + * + * Copyright (C) 2017-2018 Michael Drake <michael.drake@codethink.co.uk> + */ + +#ifndef _DESC_DEFS_H +#define _DESC_DEFS_H + +/* ---------------------------------------------------------------------- */ + +/** + * Descriptor field value type. + * + * Note that there are more types here than exist in the descriptor definitions + * in the specifications. This is because the type here is used to do `lsusb` + * specific rendering of certain fields. + * + * Note that the use of certain types mandates the setting of various entries + * in the type-specific anonymous union in `struct desc`. + */ +enum desc_type { + DESC_CONSTANT, /** Plain numerical value; no annotation. */ + DESC_NUMBER, /** Plain numerical value; no annotation. */ + DESC_NUMBER_POSTFIX, /**< Number with a postfix string. */ + DESC_BITMAP, /**< Plain hex rendered value; no annotation. */ + DESC_BCD, /**< Binary coded decimal */ + DESC_BMCONTROL_1, /**< UAC1 style bmControl field */ + DESC_BMCONTROL_2, /**< UAC2/UAC3 style bmControl field */ + DESC_STR_DESC_INDEX, /**< String index. */ + DESC_CS_STR_DESC_ID, /**< UAC3 style class-specific string request. */ + DESC_TERMINAL_STR, /**< Audio terminal string. */ + DESC_BITMAP_STRINGS, /**< Bitfield with string per bit. */ + DESC_NUMBER_STRINGS, /**< Use for enum-style value to string. */ + DESC_EXTENSION, /**< Various possible descriptor extensions. */ + DESC_SNOWFLAKE, /**< Value with custom annotation callback function. */ +}; + +/** + * Callback function for the DESC_SNOWFLAKE descriptor field value type. + * + * This is used when some special rendering of the value is required, which + * is specific to the field in question, so no generic type's rendering is + * suitable. + * + * The core descriptor dumping code will have already dumped the numerical + * value for the field, but not the trailing newline character. It is up + * to the callback function to ensure it always finishes by writing a '\n' + * character to stdout. + * + * \param[in] value The value to dump a human-readable representation of. + * \param[in] indent The current indent level. + */ +typedef void (*desc_snowflake_dump_fn)( + unsigned long long value, + unsigned int indent); + + +/** + * Descriptor field definition. + * + * Whole descriptors can be defined as NULL terminated arrays of these + * structures. + */ +struct desc { + const char *field; /**< Field's name */ + unsigned int size; /**< Byte size of field, if (size_field == NULL) */ + const char *size_field; /**< Name of field specifying field size. */ + enum desc_type type; /**< Field's value type. */ + + /** Anonymous union containing type-specific data. */ + union { + /** + * Corresponds to types DESC_BMCONTROL_1 and DESC_BMCONTROL_2. + * + * Must be a NULL terminated array of '\0' terminated strings. + */ + const char * const *bmcontrol; + /** Corresponds to type DESC_BITMAP_STRINGS */ + struct { + /** Must contain '\0' terminated strings. */ + const char * const *strings; + /** Number of strings in strings array. */ + unsigned int count; + } bitmap_strings; + /** + * Corresponds to type DESC_NUMBER_STRINGS. + * + * Must be a NULL terminated array of '\0' terminated strings. + */ + const char * const *number_strings; + /** + * Corresponds to type DESC_NUMBER_POSTFIX. + * + * Must be a '\0' terminated string. + */ + const char *number_postfix; + /** + * Corresponds to type DESC_EXTENSION. + * + * This allows the value of this field to be processed by + * another descriptor definition. The definition used to + * process the value of this field can be controlled by + * the value of another field. + */ + struct { + /** + * Name of field specifying descriptor type to select. + */ + const char *type_field; + /** + * Array of descriptor definitions and their + * associated types values. Array must be terminated + * by entry with NULL `desc` member. + */ + const struct desc_ext { + /** + * Array of descriptor field definitions. + * Terminated by entry with NULL `field` member. + */ + const struct desc *desc; + /** + * Type value for this descriptor definition. + * If it matches the type read from the + * field `type_field`, then this descriptor + * definition will be used to decode this value. + */ + unsigned int type; + } *d; + } extension; + /** + * Corresponds to type DESC_SNOWFLAKE. + * + * Callback function called to annotate snowflake value type. + */ + desc_snowflake_dump_fn snowflake; + }; + + /** Grouping of array-specific fields. */ + struct { + bool array; /**< True if entry is an array. */ + bool bits; /**< True if array length is specified in bits */ + /** Name of field specifying the array entry count. */ + const char *length_field1; + /** Name of field specifying multiplier for array entry count. */ + const char *length_field2; + } array; +}; + +/* ---------------------------------------------------------------------- */ + +/* Undefined descriptor */ +extern const struct desc desc_undefined[]; + +/* Audio Control (AC) descriptor definitions */ +extern const struct desc * const desc_audio_ac_header[3]; +extern const struct desc * const desc_audio_ac_effect_unit[3]; +extern const struct desc * const desc_audio_ac_input_terminal[3]; +extern const struct desc * const desc_audio_ac_output_terminal[3]; +extern const struct desc * const desc_audio_ac_extended_terminal[3]; +extern const struct desc * const desc_audio_ac_power_domain[3]; +extern const struct desc * const desc_audio_ac_mixer_unit[3]; +extern const struct desc * const desc_audio_ac_selector_unit[3]; +extern const struct desc * const desc_audio_ac_processing_unit[3]; +extern const struct desc * const desc_audio_ac_feature_unit[3]; +extern const struct desc * const desc_audio_ac_extension_unit[3]; +extern const struct desc * const desc_audio_ac_clock_source[3]; +extern const struct desc * const desc_audio_ac_clock_selector[3]; +extern const struct desc * const desc_audio_ac_clock_multiplier[3]; +extern const struct desc * const desc_audio_ac_sample_rate_converter[3]; + +/* Audio Streaming (AS) descriptor definitions */ +extern const struct desc * const desc_audio_as_interface[3]; +extern const struct desc * const desc_audio_as_isochronous_audio_data_endpoint[3]; + +/* Device Capability (DC) descriptor definitions */ +extern const struct desc desc_usb3_dc_configuration_summary[]; + +/* ---------------------------------------------------------------------- */ + +#endif /* _DESC_DEFS_H */ diff --git a/desc-dump.c b/desc-dump.c new file mode 100644 index 0000000..076cb6f --- /dev/null +++ b/desc-dump.c @@ -0,0 +1,599 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * USB descriptor dumping + * + * Copyright (C) 2017-2018 Michael Drake <michael.drake@codethink.co.uk> + */ + +#include "config.h" + +#include <stdbool.h> +#include <assert.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#include <libusb.h> + +#include "desc-defs.h" +#include "desc-dump.h" +#include "usbmisc.h" +#include "names.h" + +/** + * Print a description of a bmControls field value, using a given string array. + * + * Handles the DESC_BMCONTROL_1 and DESC_BMCONTROL_2 field types. The former + * is one bit per string, and the latter is 2 bits per string, with the + * additional bit specifying whether the control is read-only. + * + * \param[in] bmcontrols The value to dump a human-readable representation of. + * \param[in] strings Array of human-readable strings, must be NULL terminated. + * \param[in] type The type of the value in bmcontrols. + * \param[in] indent The current indent level. + */ +static void desc_bmcontrol_dump( + unsigned long long bmcontrols, + const char * const * strings, + enum desc_type type, + unsigned int indent) +{ + static const char * const setting[] = { + "read-only", + "ILLEGAL VALUE (0b10)", + "read/write" + }; + unsigned int count = 0; + unsigned int control; + + assert((type == DESC_BMCONTROL_1) || + (type == DESC_BMCONTROL_2)); + + while (strings[count] != NULL) { + if (strings[count][0] != '\0') { + if (type == DESC_BMCONTROL_1) { + if ((bmcontrols >> count) & 0x1) { + printf("%*s%s Control\n", + indent * 2, "", + strings[count]); + } + } else { + control = (bmcontrols >> (count * 2)) & 0x3; + if (control) { + printf("%*s%s Control (%s)\n", + indent * 2, "", + strings[count], + setting[control-1]); + } + } + } + count++; + } +} + +/** + * Read N bytes from descriptor data buffer into a value. + * + * Only supports values of up to 8 bytes. + * + * \param[in] buf Buffer containing the bytes to read. + * \param[in] offset Offset in buffer to start reading bytes from. + * \param[in] bytes Number of bytes to read. + * \return Value contained within the given bytes. + */ +static unsigned long long get_n_bytes_as_ull( + const unsigned char *buf, + unsigned int offset, + unsigned int bytes) +{ + unsigned long long ret = 0; + + if (bytes > 8) { + fprintf(stderr, "Bad descriptor definition; Field size > 8.\n"); + exit(EXIT_FAILURE); + } + + buf += offset; + + switch (bytes) { + case 8: ret |= ((unsigned long long)buf[7]) << 56; /* fall-through */ + case 7: ret |= ((unsigned long long)buf[6]) << 48; /* fall-through */ + case 6: ret |= ((unsigned long long)buf[5]) << 40; /* fall-through */ + case 5: ret |= ((unsigned long long)buf[4]) << 32; /* fall-through */ + case 4: ret |= ((unsigned long long)buf[3]) << 24; /* fall-through */ + case 3: ret |= ((unsigned long long)buf[2]) << 16; /* fall-through */ + case 2: ret |= ((unsigned long long)buf[1]) << 8; /* fall-through */ + case 1: ret |= ((unsigned long long)buf[0]); + } + + return ret; +} + +/** + * Get the size of a descriptor field in bytes. + * + * Normally the size is provided in the entry's size parameter, but some + * fields have a variable size, with the actual size being stored in as + * the value of another field. + * + * \param[in] buf Descriptor data. + * \param[in] desc First field in the descriptor definition array. + * \param[in] entry The descriptor definition field to get size for. + * \return Size of the field in bytes. + */ +static unsigned int get_entry_size( + const unsigned char *buf, + const struct desc *desc, + const struct desc *entry); + +/** + * Read a value from a field of given name. + * + * \param[in] buf Descriptor data. + * \param[in] desc First field in the descriptor definition array. + * \param[in] field The name of the field to get the value for. + * \return The value from the given field. + */ +static unsigned long long get_value_from_field( + const unsigned char *buf, + const struct desc *desc, + const char *field) +{ + size_t offset = 0; + const struct desc *current; + unsigned long long value = 0; + + /* Search descriptor definition array for the field who's value + * gives the value of the entry we're interested in. */ + for (current = desc; current->field != NULL; current++) { + if (strcmp(current->field, field) == 0) { + value = get_n_bytes_as_ull(buf, offset, + current->size); + break; + } + + /* Keep track of our offset in the descriptor data + * as we look for the field we want. */ + offset += get_entry_size(buf, desc, current); + } + + return value; +} + +/** + * Dump a number as hex to stdout. + * + * \param[in] buf Descriptor buffer to get values to render from. + * \param[in] width Character width to right-align value inside. + * \param[in] offset Offset in buffer to start of value to render. + * \param[in] bytes Byte length of value to render. + */ +static void hex_renderer( + const unsigned char *buf, + unsigned int width, + unsigned int offset, + unsigned int bytes) +{ + unsigned int align = (width >= bytes * 2) ? width - bytes * 2 : 0; + printf(" %*s0x%0*llx", align, "", bytes * 2, + get_n_bytes_as_ull(buf, offset, bytes)); +} + +/** + * Dump a number to stdout. + * + * Single-byte numbers a rendered as decimal, otherwise hexadecimal is used. + * + * \param[in] buf Descriptor buffer to get values to render from. + * \param[in] width Character width to right-align value inside. + * \param[in] offset Offset in buffer to start of value to render. + * \param[in] bytes Byte length of value to render. + */ +static void number_renderer( + const unsigned char *buf, + unsigned int width, + unsigned int offset, + unsigned int bytes) +{ + if (bytes == 1) { + /* Render small numbers as decimal */ + printf(" %*u", width, buf[offset]); + } else { + /* Otherwise render as hexadecimal */ + hex_renderer(buf, width, offset, bytes); + } +} + +/** + * Render a field's value to stdout. + * + * The manner of rendering the value is dependant on the value type. + * + * \param[in] dev LibUSB device handle. + * \param[in] current Descriptor definition field to render. + * \param[in] current_size Size of value to render. + * \param[in] buf Byte array containing the descriptor date to dump. + * \param[in] buf_len Byte length of `buf`. + * \param[in] desc First field in the descriptor definition. + * \param[in] indent Current indent level. + * \param[in] offset Offset to current value in `buf`. + */ +static void value_renderer( + libusb_device_handle *dev, + const struct desc *current, + unsigned int current_size, + const unsigned char *buf, + unsigned int buf_len, + const struct desc *desc, + unsigned int indent, + size_t offset) +{ + /** Maximum amount of characters to right align numerical values by. */ + const unsigned int size_chars = 4; + + switch (current->type) { + case DESC_NUMBER: /* fall-through */ + case DESC_CONSTANT: + number_renderer(buf, size_chars, offset, current_size); + printf("\n"); + break; + case DESC_NUMBER_POSTFIX: + number_renderer(buf, size_chars, offset, current_size); + printf("%s\n", current->number_postfix); + break; + case DESC_NUMBER_STRINGS: { + unsigned int i; + unsigned long long value = get_n_bytes_as_ull(buf, offset, current_size); + number_renderer(buf, size_chars, offset, current_size); + for (i = 0; i <= value; i++) { + if (current->number_strings[i] == NULL) { + break; + } + if (value == i) { + printf(" %s", current->number_strings[i]); + } + } + printf("\n"); + break; + } + case DESC_BCD: { + unsigned int i; + printf(" %2x", buf[offset + current_size - 1]); + for (i = 1; i < current_size; i++) { + printf(".%02x", buf[offset + current_size - 1 - i]); + } + printf("\n"); + break; + } + case DESC_BITMAP: + hex_renderer(buf, size_chars, offset, current_size); + printf("\n"); + break; + case DESC_BMCONTROL_1: /* fall-through */ + case DESC_BMCONTROL_2: + hex_renderer(buf, size_chars, offset, current_size); + printf("\n"); + desc_bmcontrol_dump( + get_n_bytes_as_ull(buf, offset, current_size), + current->bmcontrol, current->type, indent + 1); + break; + case DESC_BITMAP_STRINGS: { + unsigned int i; + unsigned long long value = get_n_bytes_as_ull(buf, offset, current_size); + hex_renderer(buf, size_chars, offset, current_size); + printf("\n"); + for (i = 0; i < current->bitmap_strings.count; i++) { + if (current->bitmap_strings.strings[i] == NULL) { + continue; + } + if (((value >> i) & 0x1) == 0) { + continue; + } + printf("%*s%s\n", (indent + 1) * 2, "", + current->bitmap_strings.strings[i]); + } + break; + } + case DESC_STR_DESC_INDEX: { + char *string; + number_renderer(buf, size_chars, offset, current_size); + string = get_dev_string(dev, buf[offset]); + if (string) { + printf(" %s\n", string); + free(string); + } else { + printf("\n"); + } + break; + } + case DESC_CS_STR_DESC_ID: + number_renderer(buf, size_chars, offset, current_size); + /* TODO: Add support for UAC3 class-specific String descriptor */ + printf("\n"); + break; + case DESC_TERMINAL_STR: + number_renderer(buf, size_chars, offset, current_size); + printf(" %s\n", names_audioterminal( + get_n_bytes_as_ull(buf, offset, current_size))); + break; + case DESC_EXTENSION: { + unsigned int type = get_value_from_field(buf, desc, + current->extension.type_field); + const struct desc *ext_desc; + const struct desc_ext *ext; + + /* Lookup the extention descriptor definitions to use, */ + for (ext = current->extension.d; ext->desc != NULL; ext++) { + if (ext->type == type) { + ext_desc = ext->desc; + break; + } + } + + /* If the type didn't match a known type, use the + * undefined descriptor. */ + if (ext->desc == NULL) { + ext_desc = desc_undefined; + } + + desc_dump(dev, ext_desc, buf + offset, + buf_len - offset, indent); + + break; + } + case DESC_SNOWFLAKE: + number_renderer(buf, size_chars, offset, current_size); + current->snowflake( + get_n_bytes_as_ull(buf, offset, current_size), + indent + 1); + break; + } +} + +/* Documented at forward declaration above. */ +static unsigned int get_entry_size( + const unsigned char *buf, + const struct desc *desc, + const struct desc *entry) +{ + unsigned int size = entry->size; + + if (entry->size_field != NULL) { + /* Variable field length, given by `size_field`'s value. */ + size = get_value_from_field(buf, desc, entry->size_field); + } + + if (size == 0) { + fprintf(stderr, "Bad descriptor definition; " + "'%s' field has zero size.\n", entry->field); + exit(EXIT_FAILURE); + } + + return size; +} + +/** + * Get the number of entries needed by an descriptor definition array field. + * + * The number of entries is either calculated from length_field parameters, + * which indicate which other field(s) contain values representing the + * array length, or the array length is calculated from the buf_len parameter, + * which should ultimately have been derived from the bLength field in the raw + * descriptor data. + * + * \param[in] buf Descriptor data. + * \param[in] buf_len Byte length of `buf`. + * \param[in] desc First field in the descriptor definition. + * \param[in] array_entry Array field to get entry count for. + * \return Number of entries in array. + */ +static unsigned int get_array_entry_count( + const unsigned char *buf, + unsigned int buf_len, + const struct desc *desc, + const struct desc *array_entry) +{ + const struct desc *current; + unsigned int entries = 0; + + if (array_entry->array.length_field1) { + /* We can get the array size from the length_field1. */ + entries = get_value_from_field(buf, desc, + array_entry->array.length_field1); + + if (array_entry->array.length_field2 != NULL) { + /* There's a second field specifying length. The two + * lengths are multiplied. */ + entries *= get_value_from_field(buf, desc, + array_entry->array.length_field2); + } + + /* If the bits flag is set, then the entry count so far + * was a bit count, and we need to get a byte count. */ + if (array_entry->array.bits) { + entries = (entries / 8) + (entries & 0x7) ? 1 : 0; + } + } else { + /* Inferred array length. We haven't been given a field to get + * length from; start with the descriptor's byte-length, and + * subtract the sizes of all the other fields. */ + unsigned int size = buf_len; + + for (current = desc; current->field != NULL; current++) { + if (current == array_entry) + continue; + + if (current->array.array) { + unsigned int count; + /* We can't deal with two inferred-length arrays + * in one descriptor definition, because its + * an unresolvable ambiguity. If this + * happens it's a flaw in the descriptor + * definition. */ + if (current->array.length_field1 == NULL) { + return 0xffffffff; + } + count = get_array_entry_count(buf, buf_len, + desc, current); + if (count == 0xffffffff) { + fprintf(stderr, "Bad descriptor definition; " + "multiple inferred-length arrays.\n"); + exit(EXIT_FAILURE); + } + size -= get_entry_size(buf, desc, current) * + count; + } else { + size -= get_entry_size(buf, desc, current); + } + } + + entries = size / get_entry_size(buf, desc, array_entry); + } + + return entries; +} + +/** + * Get the number of characters needed to dump an array index + * + * \param[in] array_entries Number of entries in array. + * \return number of characters required to render largest possible index. + */ +static unsigned int get_char_count_for_array_index(unsigned int array_entries) +{ + /* Arrays are zero-indexed, so largest index is array_entries - 1. */ + if (array_entries > 100) { + /* [NNN] */ + return 5; + } else if (array_entries > 10) { + /* [NN] */ + return 4; + } + + /* [N] */ + return 3; +} + +/** + * Render a field's name. + * + * \param[in] entry Current entry number (for arrays). + * \param[in] entries Entry count (for arrays). + * \param[in] field_len Character width of field name space for alignment. + * \param[in] current Descriptor definition of field to render. + * \param[in] indent Current indent level. + */ +static void field_render( + unsigned int entry, + unsigned int entries, + unsigned int field_len, + const struct desc *current, + unsigned int indent) +{ + if (current->array.array) { + unsigned int needed_chars = field_len - + get_char_count_for_array_index(entries) - + strlen(current->field); + printf("%*s%s(%u)%*s", indent * 2, "", + current->field, entry, + needed_chars, ""); + } else { + printf("%*s%-*s", indent * 2, "", + field_len, current->field); + } +} + +/* Function documented in desc-dump.h */ +void desc_dump( + libusb_device_handle *dev, + const struct desc *desc, + const unsigned char *buf, + unsigned int buf_len, + unsigned int indent) +{ + unsigned int entry; + unsigned int entries; + unsigned int needed_chars; + unsigned int current_size; + unsigned int field_len = 18; + const struct desc *current; + size_t offset = 0; + + /* Find the buffer length, if we've been instructed to read it from + * the first field. */ + if ((buf_len == DESC_BUF_LEN_FROM_BUF) && (desc != NULL)) { + buf_len = get_n_bytes_as_ull(buf, offset, desc->size); + } + + /* Increase `field_len` to be sufficient for character length of + * longest field name for this descriptor. */ + for (current = desc; current->field != NULL; current++) { + needed_chars = 0; + if (current->array.array) { + entries = get_array_entry_count(buf, buf_len, + desc, current); + needed_chars = get_char_count_for_array_index(entries); + } + if (strlen(current->field) + needed_chars > field_len) { + field_len = strlen(current->field) + needed_chars; + } + } + + /* Step through each field, and dump it. */ + for (current = desc; current->field != NULL; current++) { + entries = 1; + if (current->array.array) { + /* Array type fields may have more than one entry. */ + entries = get_array_entry_count(buf, buf_len, + desc, current); + } + + current_size = get_entry_size(buf, desc, current); + + for (entry = 0; entry < entries; entry++) { + /* Check there's enough data in buf for this entry. */ + if (offset + current_size > buf_len) { + unsigned int i; + printf("%*sWarning: Length insufficient for " + "descriptor type.\n", + (indent - 1) * 2, ""); + for (i = offset; i < buf_len; i++) { + printf("%02x ", buf[i]); + } + printf("\n"); + return; + } + + /* Dump the field name */ + if (current->type != DESC_EXTENSION) { + field_render(entry, entries, field_len, + current, indent); + } + + /* Dump the value */ + value_renderer(dev, current, current_size, buf, buf_len, + desc, indent, offset); + + if (current->type == DESC_EXTENSION) { + /* A desc extension consumes all remaining + * value buffer. */ + offset = buf_len; + } else { + /* Advance offset in buffer */ + offset += current_size; + } + } + } + + /* Check for junk at end of descriptor. */ + if (offset < buf_len) { + unsigned int i; + printf("%*sWarning: Junk at end of descriptor (%zu bytes):\n", + (indent - 1) * 2, "", buf_len - offset); + printf("%*s", indent * 2, ""); + for (i = offset; i < buf_len; i++) { + printf("%02x ", buf[i]); + } + printf("\n"); + } +} diff --git a/desc-dump.h b/desc-dump.h new file mode 100644 index 0000000..a6191a1 --- /dev/null +++ b/desc-dump.h @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * USB descriptor dumping + * + * Copyright (C) 2017 Michael Drake <michael.drake@codethink.co.uk> + */ + +#ifndef _DESC_DUMP_H +#define _DESC_DUMP_H + +/* ---------------------------------------------------------------------- */ + +/** + * Buffer length value indicating that the buffer length should be + * read from the value of the first field in the buffer, as defined + * by the first field descriptor definition. + */ +#define DESC_BUF_LEN_FROM_BUF 0xffffffff + +/** + * Dump descriptor using a descriptor definition array. + * + * This function dumps the USB descriptor data given in the byte array, + * `buf`, according to the descriptor definition array given in `desc`. + * + * The first byte(s) of `buf` must correspond to the first field definition + * in the `desc` descriptor definition array. + * + * \param[in] dev LibUSB device handle. + * \param[in] desc Array of descriptor field definitions to use to interpret + * `buf`. This array constitutes the descriptor definition. + * The final entry in the array must have a NULL field name, + * which is interpreted as the end of the array. + * \param[in] buf Byte array containing the descriptor data to dump. + * \param[in] buf_len Byte length of `buf` or `DESC_BUF_LEN_FROM_BUF` to get + * the length from the value of the first field in the + * descriptor data. + * \param[in] indent Indent level to use for descriptor dump. + */ +extern void desc_dump( + libusb_device_handle *dev, + const struct desc *desc, + const unsigned char *buf, + unsigned int buf_len, + unsigned int indent); + + +/* ---------------------------------------------------------------------- */ + +#endif /* _DESC_DUMP_H */ diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..ec298b5 --- /dev/null +++ b/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # 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. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# 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_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +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 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. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -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 + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +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 + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +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 + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +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=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + 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. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # 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 + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # 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 + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + 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=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_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 && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $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` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # 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 "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + * + * Copyright (c) 2004 Thomas Sailer <sailer@ife.ee.ethz.ch> + * + * Based on list.h from the Linux kernel source tree. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/* + * Insert a new entry after the specified head.. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/* + * Insert a new entry before the specified head.. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head *prev, struct list_head *next) +{ + next->prev = prev; + prev->next = next; +} + +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +static inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/* + * Splice in "list" into "head" + */ +static inline void list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +#endif diff --git a/lsusb-t.c b/lsusb-t.c new file mode 100644 index 0000000..81cf28a --- /dev/null +++ b/lsusb-t.c @@ -0,0 +1,738 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (c) 2009 Greg Kroah-Hartman <gregkh@suse.de> */ +#include <stdint.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <dirent.h> +#include <string.h> +#include <ctype.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <stddef.h> + +#include <libusb.h> +#include "list.h" +#include "lsusb.h" +#include "names.h" + +#define MY_SYSFS_FILENAME_LEN 255 +#define MY_PATH_MAX 4096 +#define MY_PARAM_MAX 64 + +struct usbinterface { + struct list_head list; + struct usbinterface *next; + struct usbdevice *parent; + unsigned int configuration; + unsigned int ifnum; + + unsigned int bAlternateSetting; + unsigned int bInterfaceClass; + unsigned int bInterfaceNumber; + unsigned int bInterfaceProtocol; + unsigned int bInterfaceSubClass; + unsigned int bNumEndpoints; + + char name[MY_SYSFS_FILENAME_LEN]; + char driver[MY_SYSFS_FILENAME_LEN]; +}; + +struct usbdevice { + struct list_head list; /* connect devices independent of the bus */ + struct usbdevice *next; /* next port on this hub */ + struct usbinterface *first_interface; /* list of interfaces */ + struct usbdevice *first_child; /* connect devices on this port */ + struct usbdevice *parent; /* hub this device is connected to */ + unsigned int busnum; + unsigned int parent_portnum; + unsigned int portnum; + + unsigned int bConfigurationValue; + unsigned int bDeviceClass; + unsigned int bDeviceProtocol; + unsigned int bDeviceSubClass; + unsigned int bMaxPacketSize0; + char bMaxPower[MY_PARAM_MAX]; + unsigned int bNumConfigurations; + unsigned int bNumInterfaces; + unsigned int bcdDevice; + unsigned int bmAttributes; + unsigned int configuration; + unsigned int devnum; + unsigned int idProduct; + unsigned int idVendor; + unsigned int maxchild; + char manufacturer[MY_PARAM_MAX]; + char product[MY_PARAM_MAX]; + char serial[MY_PARAM_MAX]; + char version[MY_PARAM_MAX]; + char speed[MY_PARAM_MAX]; /* '1.5','12','480','5000','10000','20000' + '\n' */ + unsigned int rx_lanes; + unsigned int tx_lanes; + + char name[MY_SYSFS_FILENAME_LEN]; + char driver[MY_SYSFS_FILENAME_LEN]; +}; + +struct usbbusnode { + struct usbbusnode *next; + struct usbinterface *first_interface; /* list of interfaces */ + struct usbdevice *first_child; /* connect children belonging to this bus */ + unsigned int busnum; + + unsigned int bDeviceClass; + unsigned int devnum; + unsigned int idProduct; + unsigned int idVendor; + unsigned int maxchild; + char speed[MY_PARAM_MAX]; /* '1.5','12','480','5000','10000','20000' + '\n' */ + unsigned int rx_lanes; + unsigned int tx_lanes; + + char name[MY_SYSFS_FILENAME_LEN]; + char driver[MY_SYSFS_FILENAME_LEN]; +}; + +#define SYSFS_INTu(de,tgt, name) do { tgt->name = read_sysfs_file_int(de,#name,10); } while(0) +#define SYSFS_INTx(de,tgt, name) do { tgt->name = read_sysfs_file_int(de,#name,16); } while(0) +#define SYSFS_STR(de,tgt, name) do { read_sysfs_file_string(de, #name, tgt->name, MY_PARAM_MAX); } while(0) + +LIST_HEAD(interfacelist); +LIST_HEAD(usbdevlist); +static struct usbbusnode *usbbuslist; + +static const char sys_bus_usb_devices[] = "/sys/bus/usb/devices"; +static int indent; + +#if 0 +static void dump_usbbusnode(struct usbbusnode *b) +{ + printf(" B %p:'%u': n %p fi %p fc %p driver '%s'\n", b, b->busnum, b->next, b->first_interface, b->first_child, b->driver); +} + +static void dump_usbdevice(struct usbdevice *d) +{ + printf + (" D %p:'%s': n %p fi %p fc %p bn %u ppn %u pn %u p %p bCV %u bDC %02x bDP %02x bDSC %02x bMPS %02x bMP '%s' bNC %u bNI %u bcdD %02x bmA %02x c %u dn %u idP %04x idV %04x mc %u m '%s' p '%s' s '%s' v '%s' sp '%s' driver '%s'\n", + d, d->name, d->next, d->first_interface, d->first_child, d->busnum, d->parent_portnum, d->portnum, d->parent, d->bConfigurationValue, d->bDeviceClass, + d->bDeviceProtocol, d->bDeviceSubClass, d->bMaxPacketSize0, d->bMaxPower, d->bNumConfigurations, d->bNumInterfaces, d->bcdDevice, d->bmAttributes, + d->configuration, d->devnum, d->idProduct, d->idVendor, d->maxchild, d->manufacturer, d->product, d->serial, d->version, d->speed, d->driver); +} + +static void dump_usbinterface(struct usbinterface *i) +{ + printf(" I %p:'%s': n %p c %u if %u bAS %u bIC %02x bIN %02x bIP %02x bISC %02x bNE %u d '%s'\n", i, i->name, i->next, i->configuration, i->ifnum, + i->bAlternateSetting, i->bInterfaceClass, i->bInterfaceNumber, i->bInterfaceProtocol, i->bInterfaceSubClass, i->bNumEndpoints, i->driver); +} +#endif + +static char tmp_str[128]; +static const char *bDeviceClass_to_str(unsigned int dc) +{ + const char *s; + switch (dc) { + case 9: + s = "root_hub"; + break; + default: + snprintf(tmp_str, 128, "'bDeviceClass 0x%02x not yet handled'", dc);; + s = tmp_str; + } + return s; +} + +static void lanes_to_str(char *lanes, unsigned int tx, unsigned int rx) { + if (tx == rx) { + if (tx < 2) { + *lanes = '\0'; + return; + } + sprintf(lanes, "/x%u", tx); + } else { + sprintf(lanes, "/Tx%u+Rx%u", tx, rx); + } +} + +static void print_usbbusnode(struct usbbusnode *b) +{ + char vendor[128], product[128]; + char lanes[32]; + + lanes_to_str(lanes, b->tx_lanes, b->rx_lanes); + + printf("/: Bus %03u.Port %03u: Dev %03u, Class=%s, Driver=%s/%up, %sM%s\n", b->busnum, 1, + b->devnum, bDeviceClass_to_str(b->bDeviceClass), b->driver, b->maxchild, b->speed, lanes); + if (verblevel >= 1) { + get_vendor_string(vendor, sizeof(vendor), b->idVendor); + get_product_string(product, sizeof(product), b->idVendor, b->idProduct); + printf(" ID %04x:%04x %s %s\n", b->idVendor, b->idProduct, vendor, product); + } + if (verblevel >= 2) { + printf(" %s/%s /dev/bus/usb/%03d/%03d\n", sys_bus_usb_devices, b->name, b->busnum, b->devnum); + } +} + +static void print_usbdevice(struct usbdevice *d, struct usbinterface *i) +{ + char subcls[128]; + char vendor[128], product[128]; + char lanes[32]; + + lanes_to_str(lanes, d->tx_lanes, d->rx_lanes); + if (i) + get_class_string(subcls, sizeof(subcls), i->bInterfaceClass); + + if (!i) + printf("Port %03u: Dev %03u, %sM%s\n", d->portnum, d->devnum, d->speed, lanes); + else if (i->bInterfaceClass == 9) + printf("Port %03u: Dev %03u, If %u, Class=%s, Driver=%s/%up, %sM%s\n", d->portnum, d->devnum, i->ifnum, subcls, + i->driver, d->maxchild, d->speed, lanes); + else + printf("Port %03u: Dev %03u, If %u, Class=%s, Driver=%s, %sM%s\n", d->portnum, d->devnum, i->ifnum, subcls, i->driver, + d->speed, lanes); + if (verblevel >= 1) { + printf(" %*s", indent, " "); + get_vendor_string(vendor, sizeof(vendor), d->idVendor); + get_product_string(product, sizeof(product), d->idVendor, d->idProduct); + printf("ID %04x:%04x %s %s\n", d->idVendor, d->idProduct, vendor, product); + } + if (verblevel >= 2) { + printf(" %*s", indent, " "); + printf("%s/%s /dev/bus/usb/%03d/%03d\n", sys_bus_usb_devices, d->name, d->busnum, d->devnum); + } +} + +static unsigned int read_sysfs_file_int(const char *d_name, const char *file, int base) +{ + char buf[12], path[MY_PATH_MAX]; + int fd; + ssize_t r; + unsigned long ret; + snprintf(path, MY_PATH_MAX, "%s/%s/%s", sys_bus_usb_devices, d_name, file); + path[MY_PATH_MAX - 1] = '\0'; + fd = open(path, O_RDONLY); + if (fd < 0) + goto error; + memset(buf, 0, sizeof(buf)); + r = read(fd, buf, sizeof(buf) - 1); + close(fd); + if (r < 0) + goto error; + buf[sizeof(buf) - 1] = '\0'; + ret = strtoul(buf, NULL, base); + return (unsigned int)ret; + + error: + perror(path); + return 0; +} + +static void read_sysfs_file_string(const char *d_name, const char *file, char *buf, int len) +{ + char path[MY_PATH_MAX]; + int fd; + ssize_t r; + fd = snprintf(path, MY_PATH_MAX, "%s/%s/%s", sys_bus_usb_devices, d_name, file); + if (fd < 0 || fd >= MY_PATH_MAX) + goto error; + path[fd] = '\0'; + fd = open(path, O_RDONLY); + if (fd < 0) + goto error; + r = read(fd, buf, len); + close(fd); + if (r > 0 && r < len) { + buf[r] = '\0'; + r--; + while (r >= 0 && buf[r] == '\n') { + buf[r] = '\0'; + r--; + } + while (r >= 0) { + if (buf[r] == '\n') + buf[r] = ' '; + r--; + } + return; + } + error: + buf[0] = '\0'; +} + +static void append_dev_interface(struct usbinterface *i, struct usbinterface *new) +{ + while (i->next) { + if (i == new) + return; + i = i->next; + } + if (i == new) + return; + i->next = new; +} + +static void append_dev_sibling(struct usbdevice *d, struct usbdevice *new) +{ + while (d->next) + d = d->next; + d->next = new; +} + +static void append_businterface(unsigned int busnum, struct usbinterface *new) +{ + struct usbbusnode *b = usbbuslist; + struct usbinterface *i; + while (b) { + if (b->busnum == busnum) { + i = b->first_interface; + if (i) { + while (i->next) { + if (i == new) + return; + i = i->next; + } + if (i == new) + return; + i->next = new; + } else + b->first_interface = new; + break; + } + b = b->next; + } +} + +static void append_busnode(struct usbbusnode *new) +{ + struct usbbusnode *b = usbbuslist; + if (b) { + while (b->next) + b = b->next; + b->next = new; + } else + usbbuslist = new; +} + +static void add_usb_interface(const char *d_name) +{ + struct usbinterface *e; + const char *p; + char *pn, driver[MY_PATH_MAX], link[MY_PATH_MAX]; + unsigned long i; + int l; + p = strchr(d_name, ':'); + p++; + i = strtoul(p, &pn, 10); + if (!pn || p == pn) + return; + e = malloc(sizeof(struct usbinterface)); + if (!e) + return; + memset(e, 0, sizeof(struct usbinterface)); + e->configuration = i; + p = pn + 1; + i = strtoul(p, &pn, 10); + if (!pn || p == pn) + { + free(e); + return; + } + e->ifnum = i; + if (snprintf(e->name, MY_SYSFS_FILENAME_LEN, "%s", d_name) >= MY_SYSFS_FILENAME_LEN) + printf("warning: '%s' truncated to '%s'\n", d_name, e->name); + SYSFS_INTu(d_name, e, bAlternateSetting); + SYSFS_INTx(d_name, e, bInterfaceClass); + SYSFS_INTx(d_name, e, bInterfaceNumber); + SYSFS_INTx(d_name, e, bInterfaceProtocol); + SYSFS_INTx(d_name, e, bInterfaceSubClass); + SYSFS_INTx(d_name, e, bNumEndpoints); + l = snprintf(link, MY_PATH_MAX, "%s/%s/driver", sys_bus_usb_devices, d_name); + if (l > 0 && l < MY_PATH_MAX) { + l = readlink(link, driver, MY_PATH_MAX); + if (l >= 0) { + if (l < MY_PATH_MAX - 1) + driver[l] = '\0'; + else + driver[0] = '\0'; + p = strrchr(driver, '/'); + if (p) + snprintf(e->driver, sizeof(e->driver), "%s", p + 1); + } else { + snprintf(e->driver, sizeof(e->driver), "[none]"); + } + } else + printf("Can not read driver link for '%s': %d\n", d_name, l); + list_add_tail(&e->list, &interfacelist); +} + +static void add_usb_device(const char *d_name) +{ + struct usbdevice *d; + const char *p; + char *pn, driver[MY_PATH_MAX], link[MY_PATH_MAX]; + unsigned long i; + int l; + p = d_name; + i = strtoul(p, &pn, 10); + if (!pn || p == pn) + return; + d = malloc(sizeof(struct usbdevice)); + if (!d) + return; + memset(d, 0, sizeof(struct usbdevice)); + d->busnum = i; + while (*pn) { + p = pn + 1; + i = strtoul(p, &pn, 10); + if (p == pn) + break; + d->parent_portnum = d->portnum; + d->portnum = i; + } + if (snprintf(d->name, MY_SYSFS_FILENAME_LEN, "%s", d_name) >= MY_SYSFS_FILENAME_LEN) + printf("warning: '%s' truncated to '%s'\n", d_name, d->name); + SYSFS_INTu(d_name, d, bConfigurationValue); + SYSFS_INTx(d_name, d, bDeviceClass); + SYSFS_INTx(d_name, d, bDeviceProtocol); + SYSFS_INTx(d_name, d, bDeviceSubClass); + SYSFS_INTx(d_name, d, bMaxPacketSize0); + SYSFS_STR(d_name, d, bMaxPower); + SYSFS_INTu(d_name, d, bNumConfigurations); + SYSFS_INTx(d_name, d, bNumInterfaces); + SYSFS_INTx(d_name, d, bcdDevice); + SYSFS_INTx(d_name, d, bmAttributes); + SYSFS_INTu(d_name, d, configuration); + SYSFS_INTu(d_name, d, devnum); + SYSFS_INTx(d_name, d, idProduct); + SYSFS_INTx(d_name, d, idVendor); + SYSFS_INTu(d_name, d, maxchild); + SYSFS_STR(d_name, d, manufacturer); + SYSFS_STR(d_name, d, product); + SYSFS_STR(d_name, d, serial); + SYSFS_STR(d_name, d, version); + SYSFS_STR(d_name, d, speed); + SYSFS_INTu(d_name, d, rx_lanes); + SYSFS_INTu(d_name, d, tx_lanes); + l = snprintf(link, MY_PATH_MAX, "%s/%s/driver", sys_bus_usb_devices, d_name); + if (l > 0 && l < MY_PATH_MAX) { + l = readlink(link, driver, MY_PATH_MAX); + if (l >= 0) { + if (l < MY_PATH_MAX - 1) + driver[l] = '\0'; + else + driver[0] = '\0'; + p = strrchr(driver, '/'); + if (p) + snprintf(d->driver, sizeof(d->driver), "%s", p + 1); + } + } else + printf("Can not read driver link for '%s': %d\n", d_name, l); + list_add_tail(&d->list, &usbdevlist); +} + +static void get_roothub_driver(struct usbbusnode *b, const char *d_name) +{ + char *p, path[MY_PATH_MAX], link[MY_PATH_MAX]; + int l; + l = snprintf(link, MY_PATH_MAX, "%s/%s/../driver", sys_bus_usb_devices, d_name); + if (l > 0 && l < MY_PATH_MAX) { + l = readlink(link, path, MY_PATH_MAX); + if (l >= 0) { + if (l < MY_PATH_MAX - 1) + path[l] = '\0'; + else + path[0] = '\0'; + p = strrchr(path, '/'); + if (p) + snprintf(b->driver, sizeof(b->driver), "%s", p + 1); + } + } else + printf("Can not read driver link for '%s': %d\n", d_name, l); +} + +static void add_usb_bus(const char *d_name) +{ + struct usbbusnode *bus; + bus = malloc(sizeof(struct usbbusnode)); + if (bus) { + memset(bus, 0, sizeof(struct usbbusnode)); + bus->busnum = strtoul(d_name + 3, NULL, 10); + if (snprintf(bus->name, MY_SYSFS_FILENAME_LEN, "%s", d_name) >= MY_SYSFS_FILENAME_LEN) + printf("warning: '%s' truncated to '%s'\n", d_name, bus->name); + SYSFS_INTu(d_name, bus, devnum); + SYSFS_INTx(d_name, bus, bDeviceClass); + SYSFS_INTx(d_name, bus, idProduct); + SYSFS_INTx(d_name, bus, idVendor); + SYSFS_INTu(d_name, bus, maxchild); + SYSFS_STR(d_name, bus, speed); + SYSFS_INTu(d_name, bus, rx_lanes); + SYSFS_INTu(d_name, bus, tx_lanes); + append_busnode(bus); + get_roothub_driver(bus, d_name); + } +} + +static void inspect_bus_entry(const char *d_name) +{ + if (d_name[0] == '.' && (!d_name[1] || (d_name[1] == '.' && !d_name[2]))) + return; + if (d_name[0] == 'u' && d_name[1] == 's' && d_name[2] == 'b' && isdigit(d_name[3])) { + add_usb_bus(d_name); + } else if (isdigit(d_name[0])) { + if (strchr(d_name, ':')) + add_usb_interface(d_name); + else + add_usb_device(d_name); + } else + fprintf(stderr, "ignoring '%s'\n", d_name); +} + +static void walk_usb_devices(DIR * sbud) +{ + struct dirent *de; + while ((de = readdir(sbud))) + inspect_bus_entry(de->d_name); +} + +static void assign_dev_to_bus(struct usbdevice *d) +{ + struct usbbusnode *b = usbbuslist; + while (b) { + if (b->busnum == d->busnum) { + if (b->first_child) + append_dev_sibling(b->first_child, d); + else + b->first_child = d; + } + b = b->next; + } +} + +static void assign_dev_to_parent(struct usbdevice *d) +{ + struct list_head *l; + struct usbdevice *pd; + char n[MY_SYSFS_FILENAME_LEN], *p; + for (l = usbdevlist.next; l != &usbdevlist; l = l->next) { + pd = list_entry(l, struct usbdevice, list); + if (pd == d) + continue; + if (pd->busnum == d->busnum && pd->portnum == d->parent_portnum) { + strcpy(n, d->name); + p = strrchr(n, '.'); + if (p) { + *p = '\0'; + if (strcmp(n, pd->name)) { + continue; + } + d->parent = pd; + if (pd->first_child) + append_dev_sibling(pd->first_child, d); + else + pd->first_child = d; + break; + } + } + } +} + +static void assign_interface_to_parent(struct usbdevice *d, struct usbinterface *i) +{ + const char *p; + char *pn, name[MY_SYSFS_FILENAME_LEN]; + ptrdiff_t l; + unsigned int busnum; + + p = strchr(i->name, ':'); + if (p) { + l = p - i->name; + if (l < MY_SYSFS_FILENAME_LEN) { + memcpy(name, i->name, l); + name[l] = '\0'; + } else + name[0] = '\0'; + if (strcmp(d->name, name) == 0) { + i->parent = d; + if (d->first_interface) + append_dev_interface(d->first_interface, i); + else + d->first_interface = i; + } else { + busnum = strtoul(name, &pn, 10); + if (pn && pn != name) { + if (pn[1] == '0') + append_businterface(busnum, i); + } + } + } +} + +static void connect_devices(void) +{ + struct list_head *ld, *li; + struct usbdevice *d; + struct usbinterface *e; + for (ld = usbdevlist.next; ld != &usbdevlist; ld = ld->next) { + d = list_entry(ld, struct usbdevice, list); + if (d->parent_portnum) + assign_dev_to_parent(d); + else + assign_dev_to_bus(d); + for (li = interfacelist.next; li != &interfacelist; li = li->next) { + e = list_entry(li, struct usbinterface, list); + if (!e->parent) + assign_interface_to_parent(d, e); + } + } + for (li = interfacelist.next; li != &interfacelist; li = li->next) { + e = list_entry(li, struct usbinterface, list); + } +} + +static void sort_dev_interfaces(struct usbinterface **i) +{ + struct usbinterface *t, *p, **pp; + int swapped; + p = *i; + pp = i; + do { + p = *i; + pp = i; + swapped = 0; + while (p->next) { + if (p->configuration > p->next->configuration) { + t = p->next; + p->next = t->next; + t->next = p; + *pp = t; + swapped = 1; + p = t; + } + if (p->ifnum > p->next->ifnum) { + t = p->next; + p->next = t->next; + t->next = p; + *pp = t; + swapped = 1; + p = t; + } + pp = &p->next; + p = p->next; + } + } while (swapped); +} + +static void sort_dev_siblings(struct usbdevice **d) +{ + struct usbdevice *t, *p, **pp; + int swapped; + p = *d; + pp = d; + if (p->first_child) + sort_dev_siblings(&p->first_child); + if (p->first_interface) + sort_dev_interfaces(&p->first_interface); + do { + p = *d; + pp = d; + swapped = 0; + while (p->next) { + sort_dev_siblings(&p->next); + if (p->portnum > p->next->portnum) { + t = p->next; + p->next = t->next; + t->next = p; + *pp = t; + swapped = 1; + p = t; + } + pp = &p->next; + p = p->next; + } + } while (swapped); +} + +static void sort_devices(void) +{ + struct usbbusnode *b = usbbuslist; + while (b) { + if (b->first_child) + sort_dev_siblings(&b->first_child); + b = b->next; + } +} + +static void sort_busses(void) +{ + /* sort in numerical order to match 'lsusb' output */ + struct usbbusnode *t, *p, **pp; + int swapped; + do { + p = usbbuslist; + if (p == NULL) + return; + pp = &usbbuslist; + swapped = 0; + while (p && p->next) { + if (p->busnum > p->next->busnum) { + t = p->next; + p->next = t->next; + t->next = p; + *pp = t; + swapped = 1; + p = t; + } + pp = &p->next; + p = p->next; + } + } while (swapped); +} + +static void print_tree_dev_interface(struct usbdevice *d, struct usbinterface *i) +{ + indent += 3; + do { + printf(" %*s", indent, "|__ "); + print_usbdevice(d, i); + if (i) + i = i->next; + } while (i); + indent -= 3; +} +static void print_tree_dev_children(struct usbdevice *d) +{ + indent += 4; + while (d) { + print_tree_dev_interface(d, d->first_interface); + print_tree_dev_children(d->first_child); + d = d->next; + } + indent -= 4; +} + +static void print_tree(void) +{ + struct usbbusnode *b = usbbuslist; + while (b) { + print_usbbusnode(b); + if (b->first_child) + print_tree_dev_children(b->first_child); + b = b->next; + } +} + +int lsusb_t(void) +{ + DIR *sbud = opendir(sys_bus_usb_devices); + if (sbud) { + walk_usb_devices(sbud); + closedir(sbud); + connect_devices(); + sort_devices(); + sort_busses(); + print_tree(); + } else + perror(sys_bus_usb_devices); + return sbud == NULL; +} diff --git a/lsusb.8.in b/lsusb.8.in new file mode 100644 index 0000000..5b116f1 --- /dev/null +++ b/lsusb.8.in @@ -0,0 +1,66 @@ +.\"SPDX-License-Identifier: GPL-2.0-only +.\"Copyright (c) 1999 Thomas Sailer <sailer@ife.ee.ethz.ch> +.TH lsusb 8 "11 February 2019" "usbutils-VERSION" "Linux USB Utilities" +.IX lsusb +.SH NAME +lsusb \- list USB devices +.SH SYNOPSIS +.B lsusb +[ +.I options +] +.SH DESCRIPTION +.B lsusb +is a utility for displaying information about USB buses in the system and +the devices connected to them. It uses udev's hardware database to +associate a full human-readable name to the vendor ID and the product ID. + +.SH OPTIONS +.TP +.BR \-v ", " \-\-verbose +Tells +.I lsusb +to be verbose and display detailed information about the devices shown. +This includes configuration descriptors for the device's current speed. +Class descriptors will be shown, when available, for USB device classes +including hub, audio, HID, communications, and chipcard. Can be used with the +\fB-t\fP option. +.TP +\fB\-s\fP [[\fIbus\fP]\fB:\fP][\fIdevnum\fP] +Show only devices in specified +.I bus +and/or +.IR devnum . +Both IDs are given in decimal and may be omitted. +.TP +\fB\-d\fP [\fIvendor\fP]\fB:\fP[\fIproduct\fP] +Show only devices with the specified vendor and product ID. +Both IDs are given in hexadecimal. +.TP +.B \-D \fIdevice\fP +Do not scan the /dev/bus/usb directory, +instead display only information +about the device whose device file is given. +The device file should be something like /dev/bus/usb/001/001. +This option displays detailed information like the \fB-v\fP option; +you must be root to do this. +.TP +.BR \-t ", " \-\-tree +Tells +.I lsusb +to dump the physical USB device hierarchy as a tree. Verbosity can be increased twice with the +\fB-v\fP option. +.TP +.BR \-V ", " \-\-version +Print version information on standard output, +then exit successfully. + +.SH RETURN VALUE +If the specified device is not found, a non-zero exit code is returned. + +.SH SEE ALSO +.BR lspci (8), +.BR usbview (8). + +.SH AUTHOR +Thomas Sailer, <sailer@ife.ee.ethz.ch>. @@ -0,0 +1,3827 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * lspci like utility for the USB bus + * + * Copyright (C) 1999-2001, 2003 Thomas Sailer (t.sailer@alumni.ethz.ch) + * Copyright (C) 2003-2005 David Brownell + */ + +#include "config.h" +#include <stdint.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <locale.h> +#include <string.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <stdbool.h> + +#ifdef HAVE_BYTESWAP_H +#include <byteswap.h> +#endif + +#include <libusb.h> +#include <unistd.h> + +#include "lsusb.h" +#include "names.h" +#include "sysfs.h" +#include "usbmisc.h" +#include "desc-defs.h" +#include "desc-dump.h" + +#include <getopt.h> + +#define le16_to_cpu(x) libusb_cpu_to_le16(libusb_cpu_to_le16(x)) + +/* from USB 2.0 spec and updates */ +#define USB_DT_DEVICE_QUALIFIER 0x06 +#define USB_DT_OTHER_SPEED_CONFIG 0x07 +#define USB_DT_OTG 0x09 +#define USB_DT_DEBUG 0x0a +#define USB_DT_INTERFACE_ASSOCIATION 0x0b +#define USB_DT_SECURITY 0x0c +#define USB_DT_KEY 0x0d +#define USB_DT_ENCRYPTION_TYPE 0x0e +#define USB_DT_BOS 0x0f +#define USB_DT_DEVICE_CAPABILITY 0x10 +#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 +#define USB_DT_WIRE_ADAPTER 0x21 +#define USB_DT_RPIPE 0x22 +#define USB_DT_RC_INTERFACE 0x23 +#define USB_DT_SS_ENDPOINT_COMP 0x30 + +/* Device Capability Type Codes (Wireless USB spec and USB 3.0 bus spec) */ +#define USB_DC_WIRELESS_USB 0x01 +#define USB_DC_20_EXTENSION 0x02 +#define USB_DC_SUPERSPEED 0x03 +#define USB_DC_CONTAINER_ID 0x04 +#define USB_DC_PLATFORM 0x05 +#define USB_DC_SUPERSPEEDPLUS 0x0a +#define USB_DC_BILLBOARD 0x0d +#define USB_DC_BILLBOARD_ALT_MODE 0x0f +#define USB_DC_CONFIGURATION_SUMMARY 0x10 + +/* Conventional codes for class-specific descriptors. The convention is + * defined in the USB "Common Class" Spec (3.11). Individual class specs + * are authoritative for their usage, not the "common class" writeup. + */ +#define USB_DT_CS_DEVICE (LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_DT_DEVICE) +#define USB_DT_CS_CONFIG (LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_DT_CONFIG) +#define USB_DT_CS_STRING (LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_DT_STRING) +#define USB_DT_CS_INTERFACE (LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_DT_INTERFACE) +#define USB_DT_CS_ENDPOINT (LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_DT_ENDPOINT) + +#ifndef USB_CLASS_CCID +#define USB_CLASS_CCID 0x0b +#endif + +#ifndef USB_CLASS_VIDEO +#define USB_CLASS_VIDEO 0x0e +#endif + +#ifndef USB_CLASS_APPLICATION +#define USB_CLASS_APPLICATION 0xfe +#endif + +#ifndef USB_AUDIO_CLASS_1 +#define USB_AUDIO_CLASS_1 0x00 +#endif + +#ifndef USB_AUDIO_CLASS_2 +#define USB_AUDIO_CLASS_2 0x20 +#endif + +/* USB DCD for Audio Devices Release 3.0: Section A.6, pp139 */ +#ifndef USB_AUDIO_CLASS_3 +#define USB_AUDIO_CLASS_3 0x30 +#endif + +#ifndef USB_VIDEO_PROTOCOL_15 +#define USB_VIDEO_PROTOCOL_15 0x01 +#endif + +#define VERBLEVEL_DEFAULT 0 /* 0 gives lspci behaviour; 1, lsusb-0.9 */ + +#define CTRL_TIMEOUT (5*1000) /* milliseconds */ + +#define HUB_STATUS_BYTELEN 3 /* max 3 bytes status = hub + 23 ports */ + +#define BILLBOARD_MAX_NUM_ALT_MODE (0x34) + +/* from WebUSB specification : https://wicg.github.io/webusb/ */ +#define WEBUSB_GUID "{3408b638-09a9-47a0-8bfd-a0768815b665}" +#define WEBUSB_GET_URL 0x02 +#define USB_DT_WEBUSB_URL 0x03 + +unsigned int verblevel = VERBLEVEL_DEFAULT; +static int do_report_desc = 1; +static const char * const encryption_type[] = { + "UNSECURE", + "WIRED", + "CCM_1", + "RSA_1", + "RESERVED" +}; + +static const char * const vconn_power[] = { + "1W", + "1.5W", + "2W", + "3W", + "4W", + "5W", + "6W", + "reserved" +}; + +static const char * const alt_mode_state[] = { + "Unspecified Error", + "Alternate Mode configuration not attempted", + "Alternate Mode configuration attempted but unsuccessful", + "Alternate Mode configuration successful" +}; + +static void dump_interface(libusb_device_handle *dev, const struct libusb_interface *interface); +static void dump_endpoint(libusb_device_handle *dev, const struct libusb_interface_descriptor *interface, const struct libusb_endpoint_descriptor *endpoint); +static void dump_audiocontrol_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol); +static void dump_audiostreaming_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol); +static void dump_midistreaming_interface(libusb_device_handle *dev, const unsigned char *buf); +static void dump_videocontrol_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol); +static void dump_videostreaming_interface(const unsigned char *buf); +static void dump_dfu_interface(const unsigned char *buf); +static char *dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, char *indent); +static void dump_hid_device(libusb_device_handle *dev, const struct libusb_interface_descriptor *interface, const unsigned char *buf); +static void dump_printer_device(libusb_device_handle *dev, const struct libusb_interface_descriptor *interface, const unsigned char *buf); +static void dump_audiostreaming_endpoint(libusb_device_handle *dev, const unsigned char *buf, int protocol); +static void dump_midistreaming_endpoint(const unsigned char *buf); +static void dump_hub(const char *prefix, const unsigned char *p, int tt_type); +static void dump_ccid_device(const unsigned char *buf); +static void dump_billboard_device_capability_desc(libusb_device_handle *dev, unsigned char *buf); + +/* ---------------------------------------------------------------------- */ + +static unsigned int convert_le_u32 (const unsigned char *buf) +{ + return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); +} + +static unsigned int convert_le_u16 (const unsigned char *buf) +{ + return buf[0] | (buf[1] << 8); +} + +/* ---------------------------------------------------------------------- */ + +/* workaround libusb API goofs: "byte" should never be sign extended; + * using "char" is trouble. + */ + +static inline int typesafe_control_msg(libusb_device_handle *dev, + unsigned char requesttype, unsigned char request, + int value, int idx, + unsigned char *bytes, unsigned size, int timeout) +{ + int ret = libusb_control_transfer(dev, requesttype, request, value, + idx, bytes, size, timeout); + + return ret; +} + +#define usb_control_msg typesafe_control_msg + +static int get_protocol_string(char *buf, size_t size, uint8_t cls, uint8_t subcls, uint8_t proto) +{ + const char *cp; + + if (size < 1) + return 0; + *buf = 0; + if (!(cp = names_protocol(cls, subcls, proto))) + return 0; + return snprintf(buf, size, "%s", cp); +} + +static int get_videoterminal_string(char *buf, size_t size, uint16_t termt) +{ + const char *cp; + + if (size < 1) + return 0; + *buf = 0; + if (!(cp = names_videoterminal(termt))) + return 0; + return snprintf(buf, size, "%s", cp); +} + +static const char *get_guid(const unsigned char *buf) +{ + static char guid[39]; + + /* NOTE: see RFC 4122 for more information about GUID/UUID + * structure. The first fields fields are historically big + * endian numbers, dating from Apollo mc68000 workstations. + */ + sprintf(guid, "{%02x%02x%02x%02x" + "-%02x%02x" + "-%02x%02x" + "-%02x%02x" + "-%02x%02x%02x%02x%02x%02x}", + buf[3], buf[2], buf[1], buf[0], + buf[5], buf[4], + buf[7], buf[6], + buf[8], buf[9], + buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); + return guid; +} + +/* ---------------------------------------------------------------------- */ + +static void dump_bytes(const unsigned char *buf, unsigned int len) +{ + unsigned int i; + + for (i = 0; i < len; i++) + printf(" %02x", buf[i]); + printf("\n"); +} + +static void dump_junk(const unsigned char *buf, const char *indent, unsigned int len) +{ + unsigned int i; + + if (buf[0] <= len) + return; + printf("%sjunk at descriptor end:", indent); + for (i = len; i < buf[0]; i++) + printf(" %02x", buf[i]); + printf("\n"); +} + +/* + * General config descriptor dump + */ + +static void dump_device( + libusb_device *dev, + struct libusb_device_descriptor *descriptor +) +{ + char vendor[128], product[128]; + char cls[128], subcls[128], proto[128]; + char mfg[128] = {0}, prod[128] = {0}, serial[128] = {0}; + char sysfs_name[PATH_MAX]; + + get_vendor_product_with_fallback(vendor, sizeof(vendor), + product, sizeof(product), dev); + get_class_string(cls, sizeof(cls), descriptor->bDeviceClass); + get_subclass_string(subcls, sizeof(subcls), + descriptor->bDeviceClass, descriptor->bDeviceSubClass); + get_protocol_string(proto, sizeof(proto), descriptor->bDeviceClass, + descriptor->bDeviceSubClass, descriptor->bDeviceProtocol); + + if (get_sysfs_name(sysfs_name, sizeof(sysfs_name), dev) >= 0) { + read_sysfs_prop(mfg, sizeof(mfg), sysfs_name, "manufacturer"); + read_sysfs_prop(prod, sizeof(prod), sysfs_name, "product"); + read_sysfs_prop(serial, sizeof(serial), sysfs_name, "serial"); + } + + printf("Device Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bcdUSB %2x.%02x\n" + " bDeviceClass %5u %s\n" + " bDeviceSubClass %5u %s\n" + " bDeviceProtocol %5u %s\n" + " bMaxPacketSize0 %5u\n" + " idVendor 0x%04x %s\n" + " idProduct 0x%04x %s\n" + " bcdDevice %2x.%02x\n" + " iManufacturer %5u %s\n" + " iProduct %5u %s\n" + " iSerial %5u %s\n" + " bNumConfigurations %5u\n", + descriptor->bLength, descriptor->bDescriptorType, + descriptor->bcdUSB >> 8, descriptor->bcdUSB & 0xff, + descriptor->bDeviceClass, cls, + descriptor->bDeviceSubClass, subcls, + descriptor->bDeviceProtocol, proto, + descriptor->bMaxPacketSize0, + descriptor->idVendor, vendor, descriptor->idProduct, product, + descriptor->bcdDevice >> 8, descriptor->bcdDevice & 0xff, + descriptor->iManufacturer, mfg, + descriptor->iProduct, prod, + descriptor->iSerialNumber, serial, + descriptor->bNumConfigurations); +} + +static void dump_wire_adapter(const unsigned char *buf) +{ + + printf(" Wire Adapter Class Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bcdWAVersion %2x.%02x\n" + " bNumPorts %5u\n" + " bmAttributes %5u\n" + " wNumRPRipes %5u\n" + " wRPipeMaxBlock %5u\n" + " bRPipeBlockSize %5u\n" + " bPwrOn2PwrGood %5u\n" + " bNumMMCIEs %5u\n" + " DeviceRemovable %5u\n", + buf[0], buf[1], buf[3], buf[2], buf[4], buf[5], + (buf[6] | buf[7] << 8), + (buf[8] | buf[9] << 8), + buf[10], buf[11], buf[12], buf[13]); +} + +static void dump_rc_interface(const unsigned char *buf) +{ + printf(" Radio Control Interface Class Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bcdRCIVersion %2x.%02x\n", + buf[0], buf[1], buf[3], buf[2]); + +} + +static void dump_security(const unsigned char *buf) +{ + printf(" Security Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " wTotalLength 0x%04x\n" + " bNumEncryptionTypes %5u\n", + buf[0], buf[1], (buf[3] << 8 | buf[2]), buf[4]); +} + +static void dump_encryption_type(const unsigned char *buf) +{ + int b_encryption_type = buf[2] & 0x4; + + printf(" Encryption Type Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bEncryptionType %5u %s\n" + " bEncryptionValue %5u\n" + " bAuthKeyIndex %5u\n", + buf[0], buf[1], buf[2], + encryption_type[b_encryption_type], buf[3], buf[4]); +} + +static void dump_association(libusb_device_handle *dev, const unsigned char *buf) +{ + char cls[128], subcls[128], proto[128]; + char *func; + + get_class_string(cls, sizeof(cls), buf[4]); + get_subclass_string(subcls, sizeof(subcls), buf[4], buf[5]); + get_protocol_string(proto, sizeof(proto), buf[4], buf[5], buf[6]); + func = get_dev_string(dev, buf[7]); + + printf(" Interface Association:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bFirstInterface %5u\n" + " bInterfaceCount %5u\n" + " bFunctionClass %5u %s\n" + " bFunctionSubClass %5u %s\n" + " bFunctionProtocol %5u %s\n" + " iFunction %5u %s\n", + buf[0], buf[1], + buf[2], buf[3], + buf[4], cls, + buf[5], subcls, + buf[6], proto, + buf[7], func); + + free(func); +} + +static void dump_config(libusb_device_handle *dev, struct libusb_config_descriptor *config, unsigned speed) +{ + char *cfg; + int i; + + cfg = get_dev_string(dev, config->iConfiguration); + + printf(" Configuration Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " wTotalLength 0x%04x\n" + " bNumInterfaces %5u\n" + " bConfigurationValue %5u\n" + " iConfiguration %5u %s\n" + " bmAttributes 0x%02x\n", + config->bLength, config->bDescriptorType, + le16_to_cpu(config->wTotalLength), + config->bNumInterfaces, config->bConfigurationValue, + config->iConfiguration, + cfg, config->bmAttributes); + + free(cfg); + + if (!(config->bmAttributes & 0x80)) + printf(" (Missing must-be-set bit!)\n"); + if (config->bmAttributes & 0x40) + printf(" Self Powered\n"); + else + printf(" (Bus Powered)\n"); + if (config->bmAttributes & 0x20) + printf(" Remote Wakeup\n"); + if (config->bmAttributes & 0x10) + printf(" Battery Powered\n"); + printf(" MaxPower %5umA\n", config->MaxPower * (speed >= 0x0300 ? 8 : 2)); + + /* avoid re-ordering or hiding descriptors for display */ + if (config->extra_length) { + int size = config->extra_length; + const unsigned char *buf = config->extra; + + while (size >= 2) { + if (buf[0] < 2) { + dump_junk(buf, " ", size); + break; + } + switch (buf[1]) { + case USB_DT_OTG: + /* handled separately */ + break; + case USB_DT_INTERFACE_ASSOCIATION: + dump_association(dev, buf); + break; + case USB_DT_SECURITY: + dump_security(buf); + break; + case USB_DT_ENCRYPTION_TYPE: + dump_encryption_type(buf); + break; + default: + /* often a misplaced class descriptor */ + printf(" ** UNRECOGNIZED: "); + dump_bytes(buf, buf[0]); + break; + } + size -= buf[0]; + buf += buf[0]; + } + } + for (i = 0 ; i < config->bNumInterfaces ; i++) + dump_interface(dev, &config->interface[i]); +} + +static void dump_altsetting(libusb_device_handle *dev, const struct libusb_interface_descriptor *interface) +{ + char cls[128], subcls[128], proto[128]; + char *ifstr; + + const unsigned char *buf; + unsigned size, i; + + get_class_string(cls, sizeof(cls), interface->bInterfaceClass); + get_subclass_string(subcls, sizeof(subcls), interface->bInterfaceClass, interface->bInterfaceSubClass); + get_protocol_string(proto, sizeof(proto), interface->bInterfaceClass, interface->bInterfaceSubClass, interface->bInterfaceProtocol); + ifstr = get_dev_string(dev, interface->iInterface); + + printf(" Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bInterfaceNumber %5u\n" + " bAlternateSetting %5u\n" + " bNumEndpoints %5u\n" + " bInterfaceClass %5u %s\n" + " bInterfaceSubClass %5u %s\n" + " bInterfaceProtocol %5u %s\n" + " iInterface %5u %s\n", + interface->bLength, interface->bDescriptorType, interface->bInterfaceNumber, + interface->bAlternateSetting, interface->bNumEndpoints, interface->bInterfaceClass, cls, + interface->bInterfaceSubClass, subcls, interface->bInterfaceProtocol, proto, + interface->iInterface, ifstr); + + free(ifstr); + + /* avoid re-ordering or hiding descriptors for display */ + if (interface->extra_length) { + size = interface->extra_length; + buf = interface->extra; + while (size >= 2 * sizeof(uint8_t)) { + if (buf[0] < 2) { + dump_junk(buf, " ", size); + break; + } + + switch (buf[1]) { + + /* This is the polite way to provide class specific + * descriptors: explicitly tagged, using common class + * spec conventions. + */ + case USB_DT_CS_DEVICE: + case USB_DT_CS_INTERFACE: + switch (interface->bInterfaceClass) { + case LIBUSB_CLASS_AUDIO: + switch (interface->bInterfaceSubClass) { + case 1: + dump_audiocontrol_interface(dev, buf, interface->bInterfaceProtocol); + break; + case 2: + dump_audiostreaming_interface(dev, buf, interface->bInterfaceProtocol); + break; + case 3: + dump_midistreaming_interface(dev, buf); + break; + default: + goto dump; + } + break; + case LIBUSB_CLASS_COMM: + dump_comm_descriptor(dev, buf, + " "); + break; + case USB_CLASS_VIDEO: + switch (interface->bInterfaceSubClass) { + case 1: + dump_videocontrol_interface(dev, buf, interface->bInterfaceProtocol); + break; + case 2: + dump_videostreaming_interface(buf); + break; + default: + goto dump; + } + break; + case USB_CLASS_APPLICATION: + switch (interface->bInterfaceSubClass) { + case 1: + dump_dfu_interface(buf); + break; + default: + goto dump; + } + break; + case LIBUSB_CLASS_HID: + dump_hid_device(dev, interface, buf); + break; + case LIBUSB_CLASS_PRINTER: + dump_printer_device(dev, interface, buf); + break; + case USB_CLASS_CCID: + dump_ccid_device(buf); + break; + default: + goto dump; + } + break; + + /* This is the ugly way: implicitly tagged, + * each class could redefine the type IDs. + */ + default: + switch (interface->bInterfaceClass) { + case LIBUSB_CLASS_HID: + dump_hid_device(dev, interface, buf); + break; + case USB_CLASS_CCID: + dump_ccid_device(buf); + break; + case 0xe0: /* wireless */ + switch (interface->bInterfaceSubClass) { + case 1: + switch (interface->bInterfaceProtocol) { + case 2: + dump_rc_interface(buf); + break; + default: + goto dump; + } + break; + case 2: + dump_wire_adapter(buf); + break; + default: + goto dump; + } + break; + case LIBUSB_CLASS_AUDIO: + switch (buf[1]) { + /* MISPLACED DESCRIPTOR */ + case USB_DT_CS_ENDPOINT: + switch (interface->bInterfaceSubClass) { + case 2: + dump_audiostreaming_endpoint(dev, buf, interface->bInterfaceProtocol); + break; + default: + goto dump; + } + break; + default: + goto dump; + } + break; + default: + /* ... not everything is class-specific */ + switch (buf[1]) { + case USB_DT_OTG: + /* handled separately */ + break; + case USB_DT_INTERFACE_ASSOCIATION: + dump_association(dev, buf); + break; + default: +dump: + /* often a misplaced class descriptor */ + printf(" ** UNRECOGNIZED: "); + dump_bytes(buf, buf[0]); + break; + } + } + } + size -= buf[0]; + buf += buf[0]; + } + } + + for (i = 0 ; i < interface->bNumEndpoints ; i++) + dump_endpoint(dev, interface, &interface->endpoint[i]); +} + +static void dump_interface(libusb_device_handle *dev, const struct libusb_interface *interface) +{ + int i; + + for (i = 0; i < interface->num_altsetting; i++) + dump_altsetting(dev, &interface->altsetting[i]); +} + +static void dump_pipe_desc(const unsigned char *buf) +{ + static const char *pipe_name[] = { + "Reserved", + "Command pipe", + "Status pipe", + "Data-in pipe", + "Data-out pipe", + [5 ... 0xDF] = "Reserved", + [0xE0 ... 0xEF] = "Vendor specific", + [0xF0 ... 0xFF] = "Reserved", + }; + + if (buf[0] == 4 && buf[1] == 0x24) { + printf(" %s (0x%02x)\n", pipe_name[buf[2]], buf[2]); + } else { + printf(" INTERFACE CLASS: "); + dump_bytes(buf, buf[0]); + } +} + +static void dump_endpoint(libusb_device_handle *dev, const struct libusb_interface_descriptor *interface, const struct libusb_endpoint_descriptor *endpoint) +{ + static const char * const typeattr[] = { + "Control", + "Isochronous", + "Bulk", + "Interrupt" + }; + static const char * const syncattr[] = { + "None", + "Asynchronous", + "Adaptive", + "Synchronous" + }; + static const char * const usage[] = { + "Data", + "Feedback", + "Implicit feedback Data", + "(reserved)" + }; + static const char * const hb[] = { "1x", "2x", "3x", "(?\?)" }; + const unsigned char *buf; + unsigned size; + unsigned wmax = le16_to_cpu(endpoint->wMaxPacketSize); + + printf(" Endpoint Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bEndpointAddress 0x%02x EP %u %s\n" + " bmAttributes %5u\n" + " Transfer Type %s\n" + " Synch Type %s\n" + " Usage Type %s\n" + " wMaxPacketSize 0x%04x %s %d bytes\n" + " bInterval %5u\n", + endpoint->bLength, + endpoint->bDescriptorType, + endpoint->bEndpointAddress, + endpoint->bEndpointAddress & 0x0f, + (endpoint->bEndpointAddress & 0x80) ? "IN" : "OUT", + endpoint->bmAttributes, + typeattr[endpoint->bmAttributes & 3], + syncattr[(endpoint->bmAttributes >> 2) & 3], + usage[(endpoint->bmAttributes >> 4) & 3], + wmax, hb[(wmax >> 11) & 3], wmax & 0x7ff, + endpoint->bInterval); + /* only for audio endpoints */ + if (endpoint->bLength == 9) + printf(" bRefresh %5u\n" + " bSynchAddress %5u\n", + endpoint->bRefresh, endpoint->bSynchAddress); + + /* avoid re-ordering or hiding descriptors for display */ + if (endpoint->extra_length) { + size = endpoint->extra_length; + buf = endpoint->extra; + while (size >= 2 * sizeof(uint8_t)) { + if (buf[0] < 2) { + dump_junk(buf, " ", size); + break; + } + switch (buf[1]) { + case USB_DT_CS_ENDPOINT: + if (interface->bInterfaceClass == 1 && interface->bInterfaceSubClass == 2) + dump_audiostreaming_endpoint(dev, buf, interface->bInterfaceProtocol); + else if (interface->bInterfaceClass == 1 && interface->bInterfaceSubClass == 3) + dump_midistreaming_endpoint(buf); + break; + case USB_DT_CS_INTERFACE: + /* MISPLACED DESCRIPTOR ... less indent */ + switch (interface->bInterfaceClass) { + case LIBUSB_CLASS_COMM: + case LIBUSB_CLASS_DATA: /* comm data */ + dump_comm_descriptor(dev, buf, + " "); + break; + case LIBUSB_CLASS_MASS_STORAGE: + dump_pipe_desc(buf); + break; + default: + printf(" INTERFACE CLASS: "); + dump_bytes(buf, buf[0]); + } + break; + case USB_DT_CS_DEVICE: + /* MISPLACED DESCRIPTOR ... less indent */ + switch (interface->bInterfaceClass) { + case USB_CLASS_CCID: + dump_ccid_device(buf); + break; + default: + printf(" DEVICE CLASS: "); + dump_bytes(buf, buf[0]); + } + break; + case USB_DT_OTG: + /* handled separately */ + break; + case USB_DT_INTERFACE_ASSOCIATION: + dump_association(dev, buf); + break; + case USB_DT_SS_ENDPOINT_COMP: + printf(" bMaxBurst %15u\n", buf[2]); + /* Print bulk streams info or isoc "Mult" */ + if ((endpoint->bmAttributes & 3) == 2 && + (buf[3] & 0x1f)) + printf(" MaxStreams %14u\n", + (unsigned) 1 << buf[3]); + if ((endpoint->bmAttributes & 3) == 1 && + (buf[3] & 0x3)) + printf(" Mult %20u\n", + buf[3] & 0x3); + break; + default: + /* often a misplaced class descriptor */ + printf(" ** UNRECOGNIZED: "); + dump_bytes(buf, buf[0]); + break; + } + size -= buf[0]; + buf += buf[0]; + } + } +} + +static void dump_unit(unsigned int data, unsigned int len) +{ + char *systems[5] = { "None", "SI Linear", "SI Rotation", + "English Linear", "English Rotation" }; + + char *units[5][8] = { + { "None", "None", "None", "None", "None", + "None", "None", "None" }, + { "None", "Centimeter", "Gram", "Seconds", "Kelvin", + "Ampere", "Candela", "None" }, + { "None", "Radians", "Gram", "Seconds", "Kelvin", + "Ampere", "Candela", "None" }, + { "None", "Inch", "Slug", "Seconds", "Fahrenheit", + "Ampere", "Candela", "None" }, + { "None", "Degrees", "Slug", "Seconds", "Fahrenheit", + "Ampere", "Candela", "None" }, + }; + + unsigned int i; + unsigned int sys; + int earlier_unit = 0; + + /* First nibble tells us which system we're in. */ + sys = data & 0xf; + data >>= 4; + + if (sys > 4) { + if (sys == 0xf) + printf("System: Vendor defined, Unit: (unknown)\n"); + else + printf("System: Reserved, Unit: (unknown)\n"); + return; + } else { + printf("System: %s, Unit: ", systems[sys]); + } + for (i = 1 ; i < len * 2 ; i++) { + char nibble = data & 0xf; + data >>= 4; + if (nibble != 0) { + if (earlier_unit++ > 0) + printf("*"); + printf("%s", units[sys][i]); + if (nibble != 1) { + /* This is a _signed_ nibble(!) */ + + int val = nibble & 0x7; + if (nibble & 0x08) + val = -((0x7 & ~val) + 1); + printf("^%d", val); + } + } + } + if (earlier_unit == 0) + printf("(None)"); + printf("\n"); +} + +/* ---------------------------------------------------------------------- */ + +/* + * Audio Class descriptor dump + */ + +static void dump_audio_subtype(libusb_device_handle *dev, + const char *name, + const struct desc * const desc[3], + const unsigned char *buf, + int protocol, + unsigned int indent) +{ + static const char * const strings[] = { "UAC1", "UAC2", "UAC3" }; + unsigned int idx = 0; + + switch (protocol) { + case USB_AUDIO_CLASS_2: idx = 1; break; + case USB_AUDIO_CLASS_3: idx = 2; break; + } + + printf("(%s)\n", name); + + if (desc[idx] == NULL) { + printf("%*sWarning: %s descriptors are illegal for %s\n", + indent * 2, "", name, strings[idx]); + return; + } + + /* Skip the first three bytes; those common fields have already + * been dumped. */ + desc_dump(dev, desc[idx], buf + 3, buf[0] - 3, indent); +} + +/* USB Audio Class subtypes */ +enum uac_interface_subtype { + UAC_INTERFACE_SUBTYPE_AC_DESCRIPTOR_UNDEFINED = 0x00, + UAC_INTERFACE_SUBTYPE_HEADER = 0x01, + UAC_INTERFACE_SUBTYPE_INPUT_TERMINAL = 0x02, + UAC_INTERFACE_SUBTYPE_OUTPUT_TERMINAL = 0x03, + UAC_INTERFACE_SUBTYPE_EXTENDED_TERMINAL = 0x04, + UAC_INTERFACE_SUBTYPE_MIXER_UNIT = 0x05, + UAC_INTERFACE_SUBTYPE_SELECTOR_UNIT = 0x06, + UAC_INTERFACE_SUBTYPE_FEATURE_UNIT = 0x07, + UAC_INTERFACE_SUBTYPE_EFFECT_UNIT = 0x08, + UAC_INTERFACE_SUBTYPE_PROCESSING_UNIT = 0x09, + UAC_INTERFACE_SUBTYPE_EXTENSION_UNIT = 0x0a, + UAC_INTERFACE_SUBTYPE_CLOCK_SOURCE = 0x0b, + UAC_INTERFACE_SUBTYPE_CLOCK_SELECTOR = 0x0c, + UAC_INTERFACE_SUBTYPE_CLOCK_MULTIPLIER = 0x0d, + UAC_INTERFACE_SUBTYPE_SAMPLE_RATE_CONVERTER = 0x0e, + UAC_INTERFACE_SUBTYPE_CONNECTORS = 0x0f, + UAC_INTERFACE_SUBTYPE_POWER_DOMAIN = 0x10, +}; + +/* + * UAC1, UAC2, and UAC3 define bDescriptorSubtype differently for the + * AudioControl interface, so we need to do some ugly remapping: + * + * val | UAC1 | UAC2 | UAC3 + * -----|-----------------|-----------------------|--------------------- + * 0x00 | AC UNDEFINED | AC UNDEFINED | AC UNDEFINED + * 0x01 | HEADER | HEADER | HEADER + * 0x02 | INPUT_TERMINAL | INPUT_TERMINAL | INPUT_TERMINAL + * 0x03 | OUTPUT_TERMINAL | OUTPUT_TERMINAL | OUTPUT_TERMINAL + * 0x04 | MIXER_UNIT | MIXER_UNIT | EXTENDED_TERMINAL + * 0x05 | SELECTOR_UNIT | SELECTOR_UNIT | MIXER_UNIT + * 0x06 | FEATURE_UNIT | FEATURE_UNIT | SELECTOR_UNIT + * 0x07 | PROCESSING_UNIT | EFFECT_UNIT | FEATURE_UNIT + * 0x08 | EXTENSION_UNIT | PROCESSING_UNIT | EFFECT_UNIT + * 0x09 | - | EXTENSION_UNIT | PROCESSING_UNIT + * 0x0a | - | CLOCK_SOURCE | EXTENSION_UNIT + * 0x0b | - | CLOCK_SELECTOR | CLOCK_SOURCE + * 0x0c | - | CLOCK_MULTIPLIER | CLOCK_SELECTOR + * 0x0d | - | SAMPLE_RATE_CONVERTER | CLOCK_MULTIPLIER + * 0x0e | - | - | SAMPLE_RATE_CONVERTER + * 0x0f | - | - | CONNECTORS + * 0x10 | - | - | POWER_DOMAIN + */ +static enum uac_interface_subtype get_uac_interface_subtype(unsigned char c, int protocol) +{ + switch (protocol) { + case USB_AUDIO_CLASS_1: + switch(c) { + case 0x04: return UAC_INTERFACE_SUBTYPE_MIXER_UNIT; + case 0x05: return UAC_INTERFACE_SUBTYPE_SELECTOR_UNIT; + case 0x06: return UAC_INTERFACE_SUBTYPE_FEATURE_UNIT; + case 0x07: return UAC_INTERFACE_SUBTYPE_PROCESSING_UNIT; + case 0x08: return UAC_INTERFACE_SUBTYPE_EXTENSION_UNIT; + } + break; + case USB_AUDIO_CLASS_2: + switch(c) { + case 0x04: return UAC_INTERFACE_SUBTYPE_MIXER_UNIT; + case 0x05: return UAC_INTERFACE_SUBTYPE_SELECTOR_UNIT; + case 0x06: return UAC_INTERFACE_SUBTYPE_FEATURE_UNIT; + case 0x07: return UAC_INTERFACE_SUBTYPE_EFFECT_UNIT; + case 0x08: return UAC_INTERFACE_SUBTYPE_PROCESSING_UNIT; + case 0x09: return UAC_INTERFACE_SUBTYPE_EXTENSION_UNIT; + case 0x0a: return UAC_INTERFACE_SUBTYPE_CLOCK_SOURCE; + case 0x0b: return UAC_INTERFACE_SUBTYPE_CLOCK_SELECTOR; + case 0x0c: return UAC_INTERFACE_SUBTYPE_CLOCK_MULTIPLIER; + case 0x0d: return UAC_INTERFACE_SUBTYPE_SAMPLE_RATE_CONVERTER; + } + break; + case USB_AUDIO_CLASS_3: + /* No mapping required. */ + break; + default: + /* Unknown protocol */ + break; + } + + /* If the protocol was unknown, or the value was not known to require + * mapping, just return it unchanged. */ + return c; +} + +static void dump_audiocontrol_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol) +{ + enum uac_interface_subtype subtype; + + if (buf[1] != USB_DT_CS_INTERFACE) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 3) + printf(" Warning: Descriptor too short\n"); + printf(" AudioControl Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDescriptorSubtype %5u ", + buf[0], buf[1], buf[2]); + + subtype = get_uac_interface_subtype(buf[2], protocol); + + switch (subtype) { + case UAC_INTERFACE_SUBTYPE_HEADER: + dump_audio_subtype(dev, "HEADER", desc_audio_ac_header, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_INPUT_TERMINAL: + dump_audio_subtype(dev, "INPUT_TERMINAL", desc_audio_ac_input_terminal, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_OUTPUT_TERMINAL: + dump_audio_subtype(dev, "OUTPUT_TERMINAL", desc_audio_ac_output_terminal, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_MIXER_UNIT: + dump_audio_subtype(dev, "MIXER_UNIT", desc_audio_ac_mixer_unit, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_SELECTOR_UNIT: + dump_audio_subtype(dev, "SELECTOR_UNIT", desc_audio_ac_selector_unit, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_FEATURE_UNIT: + dump_audio_subtype(dev, "FEATURE_UNIT", desc_audio_ac_feature_unit, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_PROCESSING_UNIT: + dump_audio_subtype(dev, "PROCESSING_UNIT", desc_audio_ac_processing_unit, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_EXTENSION_UNIT: + dump_audio_subtype(dev, "EXTENSION_UNIT", desc_audio_ac_extension_unit, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_CLOCK_SOURCE: + dump_audio_subtype(dev, "CLOCK_SOURCE", desc_audio_ac_clock_source, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_CLOCK_SELECTOR: + dump_audio_subtype(dev, "CLOCK_SELECTOR", desc_audio_ac_clock_selector, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_CLOCK_MULTIPLIER: + dump_audio_subtype(dev, "CLOCK_MULTIPLIER", desc_audio_ac_clock_multiplier, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_SAMPLE_RATE_CONVERTER: + dump_audio_subtype(dev, "SAMPLING_RATE_CONVERTER", desc_audio_ac_clock_multiplier, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_EFFECT_UNIT: + dump_audio_subtype(dev, "EFFECT_UNIT", desc_audio_ac_effect_unit, buf, protocol, 4); + break; + + case UAC_INTERFACE_SUBTYPE_POWER_DOMAIN: + dump_audio_subtype(dev, "POWER_DOMAIN", desc_audio_ac_power_domain, buf, protocol, 4); + break; + + default: + printf("(unknown)\n" + " Invalid desc subtype:"); + dump_bytes(buf+3, buf[0]-3); + break; + } +} + + +static void dump_audiostreaming_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol) +{ + static const char * const fmtItag[] = { + "TYPE_I_UNDEFINED", "PCM", "PCM8", "IEEE_FLOAT", "ALAW", "MULAW" }; + static const char * const fmtIItag[] = { "TYPE_II_UNDEFINED", "MPEG", "AC-3" }; + static const char * const fmtIIItag[] = { + "TYPE_III_UNDEFINED", "IEC1937_AC-3", "IEC1937_MPEG-1_Layer1", + "IEC1937_MPEG-Layer2/3/NOEXT", "IEC1937_MPEG-2_EXT", + "IEC1937_MPEG-2_Layer1_LS", "IEC1937_MPEG-2_Layer2/3_LS" }; + unsigned int i, j, fmttag; + const char *fmtptr = "undefined"; + + if (buf[1] != USB_DT_CS_INTERFACE) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 3) + printf(" Warning: Descriptor too short\n"); + printf(" AudioStreaming Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDescriptorSubtype %5u ", + buf[0], buf[1], buf[2]); + switch (buf[2]) { + case 0x01: /* AS_GENERAL */ + dump_audio_subtype(dev, "AS_GENERAL", desc_audio_as_interface, buf, protocol, 4); + break; + + case 0x02: /* FORMAT_TYPE */ + printf("(FORMAT_TYPE)\n"); + switch (protocol) { + case USB_AUDIO_CLASS_1: + if (buf[0] < 8) + printf(" Warning: Descriptor too short\n"); + printf(" bFormatType %5u ", buf[3]); + switch (buf[3]) { + case 0x01: /* FORMAT_TYPE_I */ + printf("(FORMAT_TYPE_I)\n"); + j = buf[7] ? (buf[7]*3+8) : 14; + if (buf[0] < j) + printf(" Warning: Descriptor too short\n"); + printf(" bNrChannels %5u\n" + " bSubframeSize %5u\n" + " bBitResolution %5u\n" + " bSamFreqType %5u %s\n", + buf[4], buf[5], buf[6], buf[7], buf[7] ? "Discrete" : "Continuous"); + if (!buf[7]) + printf(" tLowerSamFreq %7u\n" + " tUpperSamFreq %7u\n", + buf[8] | (buf[9] << 8) | (buf[10] << 16), buf[11] | (buf[12] << 8) | (buf[13] << 16)); + else + for (i = 0; i < buf[7]; i++) + printf(" tSamFreq[%2u] %7u\n", i, + buf[8+3*i] | (buf[9+3*i] << 8) | (buf[10+3*i] << 16)); + dump_junk(buf, " ", j); + break; + + case 0x02: /* FORMAT_TYPE_II */ + printf("(FORMAT_TYPE_II)\n"); + j = buf[8] ? (buf[7]*3+9) : 15; + if (buf[0] < j) + printf(" Warning: Descriptor too short\n"); + printf(" wMaxBitRate %5u\n" + " wSamplesPerFrame %5u\n" + " bSamFreqType %5u %s\n", + buf[4] | (buf[5] << 8), buf[6] | (buf[7] << 8), buf[8], buf[8] ? "Discrete" : "Continuous"); + if (!buf[8]) + printf(" tLowerSamFreq %7u\n" + " tUpperSamFreq %7u\n", + buf[9] | (buf[10] << 8) | (buf[11] << 16), buf[12] | (buf[13] << 8) | (buf[14] << 16)); + else + for (i = 0; i < buf[8]; i++) + printf(" tSamFreq[%2u] %7u\n", i, + buf[9+3*i] | (buf[10+3*i] << 8) | (buf[11+3*i] << 16)); + dump_junk(buf, " ", j); + break; + + case 0x03: /* FORMAT_TYPE_III */ + printf("(FORMAT_TYPE_III)\n"); + j = buf[7] ? (buf[7]*3+8) : 14; + if (buf[0] < j) + printf(" Warning: Descriptor too short\n"); + printf(" bNrChannels %5u\n" + " bSubframeSize %5u\n" + " bBitResolution %5u\n" + " bSamFreqType %5u %s\n", + buf[4], buf[5], buf[6], buf[7], buf[7] ? "Discrete" : "Continuous"); + if (!buf[7]) + printf(" tLowerSamFreq %7u\n" + " tUpperSamFreq %7u\n", + buf[8] | (buf[9] << 8) | (buf[10] << 16), buf[11] | (buf[12] << 8) | (buf[13] << 16)); + else + for (i = 0; i < buf[7]; i++) + printf(" tSamFreq[%2u] %7u\n", i, + buf[8+3*i] | (buf[9+3*i] << 8) | (buf[10+3*i] << 16)); + dump_junk(buf, " ", j); + break; + + default: + printf("(unknown)\n" + " Invalid desc format type:"); + dump_bytes(buf+4, buf[0]-4); + } + + break; + + case USB_AUDIO_CLASS_2: + printf(" bFormatType %5u ", buf[3]); + switch (buf[3]) { + case 0x01: /* FORMAT_TYPE_I */ + printf("(FORMAT_TYPE_I)\n"); + if (buf[0] < 6) + printf(" Warning: Descriptor too short\n"); + printf(" bSubslotSize %5u\n" + " bBitResolution %5u\n", + buf[4], buf[5]); + dump_junk(buf, " ", 6); + break; + + case 0x02: /* FORMAT_TYPE_II */ + printf("(FORMAT_TYPE_II)\n"); + if (buf[0] < 8) + printf(" Warning: Descriptor too short\n"); + printf(" wMaxBitRate %5u\n" + " wSlotsPerFrame %5u\n", + buf[4] | (buf[5] << 8), + buf[6] | (buf[7] << 8)); + dump_junk(buf, " ", 8); + break; + + case 0x03: /* FORMAT_TYPE_III */ + printf("(FORMAT_TYPE_III)\n"); + if (buf[0] < 6) + printf(" Warning: Descriptor too short\n"); + printf(" bSubslotSize %5u\n" + " bBitResolution %5u\n", + buf[4], buf[5]); + dump_junk(buf, " ", 6); + break; + + case 0x04: /* FORMAT_TYPE_IV */ + printf("(FORMAT_TYPE_IV)\n"); + if (buf[0] < 4) + printf(" Warning: Descriptor too short\n"); + printf(" bFormatType %5u\n", buf[3]); + dump_junk(buf, " ", 4); + break; + + default: + printf("(unknown)\n" + " Invalid desc format type:"); + dump_bytes(buf+4, buf[0]-4); + } + + break; + } /* switch (protocol) */ + + break; + + case 0x03: /* FORMAT_SPECIFIC */ + printf("(FORMAT_SPECIFIC)\n"); + if (buf[0] < 5) + printf(" Warning: Descriptor too short\n"); + fmttag = buf[3] | (buf[4] << 8); + if (fmttag <= 5) + fmtptr = fmtItag[fmttag]; + else if (fmttag >= 0x1000 && fmttag <= 0x1002) + fmtptr = fmtIItag[fmttag & 0xfff]; + else if (fmttag >= 0x2000 && fmttag <= 0x2006) + fmtptr = fmtIIItag[fmttag & 0xfff]; + printf(" wFormatTag %5u %s\n", fmttag, fmtptr); + switch (fmttag) { + case 0x1001: /* MPEG */ + if (buf[0] < 8) + printf(" Warning: Descriptor too short\n"); + printf(" bmMPEGCapabilities 0x%04x\n", + buf[5] | (buf[6] << 8)); + if (buf[5] & 0x01) + printf(" Layer I\n"); + if (buf[5] & 0x02) + printf(" Layer II\n"); + if (buf[5] & 0x04) + printf(" Layer III\n"); + if (buf[5] & 0x08) + printf(" MPEG-1 only\n"); + if (buf[5] & 0x10) + printf(" MPEG-1 dual-channel\n"); + if (buf[5] & 0x20) + printf(" MPEG-2 second stereo\n"); + if (buf[5] & 0x40) + printf(" MPEG-2 7.1 channel augmentation\n"); + if (buf[5] & 0x80) + printf(" Adaptive multi-channel prediction\n"); + printf(" MPEG-2 multilingual support: "); + switch (buf[6] & 3) { + case 0: + printf("Not supported\n"); + break; + + case 1: + printf("Supported at Fs\n"); + break; + + case 2: + printf("Reserved\n"); + break; + + default: + printf("Supported at Fs and 1/2Fs\n"); + break; + } + printf(" bmMPEGFeatures 0x%02x\n", buf[7]); + printf(" Internal Dynamic Range Control: "); + switch ((buf[7] >> 4) & 3) { + case 0: + printf("not supported\n"); + break; + + case 1: + printf("supported but not scalable\n"); + break; + + case 2: + printf("scalable, common boost and cut scaling value\n"); + break; + + default: + printf("scalable, separate boost and cut scaling value\n"); + break; + } + dump_junk(buf, " ", 8); + break; + + case 0x1002: /* AC-3 */ + if (buf[0] < 10) + printf(" Warning: Descriptor too short\n"); + printf(" bmBSID 0x%08x\n" + " bmAC3Features 0x%02x\n", + buf[5] | (buf[6] << 8) | (buf[7] << 16) | (buf[8] << 24), buf[9]); + if (buf[9] & 0x01) + printf(" RF mode\n"); + if (buf[9] & 0x02) + printf(" Line mode\n"); + if (buf[9] & 0x04) + printf(" Custom0 mode\n"); + if (buf[9] & 0x08) + printf(" Custom1 mode\n"); + printf(" Internal Dynamic Range Control: "); + switch ((buf[9] >> 4) & 3) { + case 0: + printf("not supported\n"); + break; + + case 1: + printf("supported but not scalable\n"); + break; + + case 2: + printf("scalable, common boost and cut scaling value\n"); + break; + + default: + printf("scalable, separate boost and cut scaling value\n"); + break; + } + dump_junk(buf, " ", 8); + break; + + default: + printf("(unknown)\n" + " Invalid desc format type:"); + dump_bytes(buf+4, buf[0]-4); + } + break; + + default: + printf(" Invalid desc subtype:"); + dump_bytes(buf+3, buf[0]-3); + break; + } +} + +static void dump_audiostreaming_endpoint(libusb_device_handle *dev, const unsigned char *buf, int protocol) +{ + static const char * const subtype[] = { "invalid", "EP_GENERAL" }; + + if (buf[1] != USB_DT_CS_ENDPOINT) + printf(" Warning: Invalid descriptor\n"); + + printf(" AudioStreaming Endpoint Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDescriptorSubtype %5u ", + buf[0], buf[1], buf[2]); + + dump_audio_subtype(dev, subtype[buf[2] == 1], + desc_audio_as_isochronous_audio_data_endpoint, buf, protocol, 5); +} + +static void dump_midistreaming_interface(libusb_device_handle *dev, const unsigned char *buf) +{ + static const char * const jacktypes[] = {"Undefined", "Embedded", "External"}; + char *jackstr = NULL; + unsigned int j, tlength, capssize; + unsigned long caps; + + if (buf[1] != USB_DT_CS_INTERFACE) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 3) + printf(" Warning: Descriptor too short\n"); + printf(" MIDIStreaming Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDescriptorSubtype %5u ", + buf[0], buf[1], buf[2]); + switch (buf[2]) { + case 0x01: + printf("(HEADER)\n"); + if (buf[0] < 7) + printf(" Warning: Descriptor too short\n"); + tlength = buf[5] | (buf[6] << 8); + printf(" bcdADC %2x.%02x\n" + " wTotalLength 0x%04x\n", + buf[4], buf[3], tlength); + dump_junk(buf, " ", 7); + break; + + case 0x02: + printf("(MIDI_IN_JACK)\n"); + if (buf[0] < 6) + printf(" Warning: Descriptor too short\n"); + jackstr = get_dev_string(dev, buf[5]); + printf(" bJackType %5u %s\n" + " bJackID %5u\n" + " iJack %5u %s\n", + buf[3], buf[3] < 3 ? jacktypes[buf[3]] : "Invalid", + buf[4], buf[5], jackstr); + dump_junk(buf, " ", 6); + break; + + case 0x03: + printf("(MIDI_OUT_JACK)\n"); + if (buf[0] < 9) + printf(" Warning: Descriptor too short\n"); + printf(" bJackType %5u %s\n" + " bJackID %5u\n" + " bNrInputPins %5u\n", + buf[3], buf[3] < 3 ? jacktypes[buf[3]] : "Invalid", + buf[4], buf[5]); + for (j = 0; j < buf[5]; j++) { + printf(" baSourceID(%2u) %5u\n" + " BaSourcePin(%2u) %5u\n", + j, buf[2*j+6], j, buf[2*j+7]); + } + j = 6+buf[5]*2; /* midi10.pdf says, incorrectly: 5+2*p */ + jackstr = get_dev_string(dev, buf[j]); + printf(" iJack %5u %s\n", + buf[j], jackstr); + dump_junk(buf, " ", j+1); + break; + + case 0x04: + printf("(ELEMENT)\n"); + if (buf[0] < 12) + printf(" Warning: Descriptor too short\n"); + printf(" bElementID %5u\n" + " bNrInputPins %5u\n", + buf[3], buf[4]); + for (j = 0; j < buf[4]; j++) { + printf(" baSourceID(%2u) %5u\n" + " BaSourcePin(%2u) %5u\n", + j, buf[2*j+5], j, buf[2*j+6]); + } + j = 5+buf[4]*2; + printf(" bNrOutputPins %5u\n" + " bInTerminalLink %5u\n" + " bOutTerminalLink %5u\n" + " bElCapsSize %5u\n", + buf[j], buf[j+1], buf[j+2], buf[j+3]); + capssize = buf[j+3]; + caps = 0; + for (j = 0; j < capssize; j++) + caps |= (buf[j+9+buf[4]*2] << (8*j)); + printf(" bmElementCaps 0x%08lx\n", caps); + if (caps & 0x01) + printf(" Undefined\n"); + if (caps & 0x02) + printf(" MIDI Clock\n"); + if (caps & 0x04) + printf(" MTC (MIDI Time Code)\n"); + if (caps & 0x08) + printf(" MMC (MIDI Machine Control)\n"); + if (caps & 0x10) + printf(" GM1 (General MIDI v.1)\n"); + if (caps & 0x20) + printf(" GM2 (General MIDI v.2)\n"); + if (caps & 0x40) + printf(" GS MIDI Extension\n"); + if (caps & 0x80) + printf(" XG MIDI Extension\n"); + if (caps & 0x100) + printf(" EFX\n"); + if (caps & 0x200) + printf(" MIDI Patch Bay\n"); + if (caps & 0x400) + printf(" DLS1 (Downloadable Sounds Level 1)\n"); + if (caps & 0x800) + printf(" DLS2 (Downloadable Sounds Level 2)\n"); + j = 9+2*buf[4]+capssize; + jackstr = get_dev_string(dev, buf[j]); + printf(" iElement %5u %s\n", buf[j], jackstr); + dump_junk(buf, " ", j+1); + break; + + default: + printf("\n Invalid desc subtype: "); + dump_bytes(buf+3, buf[0]-3); + break; + } + + free(jackstr); +} + +static void dump_midistreaming_endpoint(const unsigned char *buf) +{ + unsigned int j; + + if (buf[1] != USB_DT_CS_ENDPOINT) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 5) + printf(" Warning: Descriptor too short\n"); + printf(" MIDIStreaming Endpoint Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDescriptorSubtype %5u (%s)\n" + " bNumEmbMIDIJack %5u\n", + buf[0], buf[1], buf[2], buf[2] == 2 ? "GENERAL" : "Invalid", buf[3]); + for (j = 0; j < buf[3]; j++) + printf(" baAssocJackID(%2u) %5u\n", j, buf[4+j]); + dump_junk(buf, " ", 4+buf[3]); +} + +/* + * Video Class descriptor dump + */ + +static void dump_videocontrol_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol) +{ + static const char * const ctrlnames[] = { + "Brightness", "Contrast", "Hue", "Saturation", "Sharpness", "Gamma", + "White Balance Temperature", "White Balance Component", "Backlight Compensation", + "Gain", "Power Line Frequency", "Hue, Auto", "White Balance Temperature, Auto", + "White Balance Component, Auto", "Digital Multiplier", "Digital Multiplier Limit", + "Analog Video Standard", "Analog Video Lock Status", "Contrast, Auto" + }; + static const char * const camctrlnames[] = { + "Scanning Mode", "Auto-Exposure Mode", "Auto-Exposure Priority", + "Exposure Time (Absolute)", "Exposure Time (Relative)", "Focus (Absolute)", + "Focus (Relative)", "Iris (Absolute)", "Iris (Relative)", "Zoom (Absolute)", + "Zoom (Relative)", "PanTilt (Absolute)", "PanTilt (Relative)", + "Roll (Absolute)", "Roll (Relative)", "Reserved", "Reserved", "Focus, Auto", + "Privacy", "Focus, Simple", "Window", "Region of Interest" + }; + static const char * const enctrlnames[] = { + "Select Layer", "Profile and Toolset", "Video Resolution", "Minimum Frame Interval", + "Slice Mode", "Rate Control Mode", "Average Bit Rate", "CPB Size", "Peak Bit Rate", + "Quantization Parameter", "Synchronization and Long-Term Reference Frame", + "Long-Term Buffer", "Picture Long-Term Reference", "LTR Validation", + "Level IDC", "SEI Message", "QP Range", "Priority ID", "Start or Stop Layer/View", + "Error Resiliency" + }; + static const char * const stdnames[] = { + "None", "NTSC - 525/60", "PAL - 625/50", "SECAM - 625/50", + "NTSC - 625/50", "PAL - 525/60" }; + unsigned int i, ctrls, stds, n, p, termt, freq; + char *term = NULL, termts[128]; + + if (buf[1] != USB_DT_CS_INTERFACE) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 3) + printf(" Warning: Descriptor too short\n"); + printf(" VideoControl Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDescriptorSubtype %5u ", + buf[0], buf[1], buf[2]); + switch (buf[2]) { + case 0x01: /* HEADER */ + printf("(HEADER)\n"); + n = buf[11]; + if (buf[0] < 12+n) + printf(" Warning: Descriptor too short\n"); + freq = buf[7] | (buf[8] << 8) | (buf[9] << 16) | (buf[10] << 24); + printf(" bcdUVC %2x.%02x\n" + " wTotalLength 0x%04x\n" + " dwClockFrequency %5u.%06uMHz\n" + " bInCollection %5u\n", + buf[4], buf[3], buf[5] | (buf[6] << 8), freq / 1000000, + freq % 1000000, n); + for (i = 0; i < n; i++) + printf(" baInterfaceNr(%2u) %5u\n", i, buf[12+i]); + dump_junk(buf, " ", 12+n); + break; + + case 0x02: /* INPUT_TERMINAL */ + printf("(INPUT_TERMINAL)\n"); + term = get_dev_string(dev, buf[7]); + termt = buf[4] | (buf[5] << 8); + n = termt == 0x0201 ? 7 : 0; + get_videoterminal_string(termts, sizeof(termts), termt); + if (buf[0] < 8 + n) + printf(" Warning: Descriptor too short\n"); + printf(" bTerminalID %5u\n" + " wTerminalType 0x%04x %s\n" + " bAssocTerminal %5u\n", + buf[3], termt, termts, buf[6]); + printf(" iTerminal %5u %s\n", + buf[7], term); + if (termt == 0x0201) { + n += buf[14]; + printf(" wObjectiveFocalLengthMin %5u\n" + " wObjectiveFocalLengthMax %5u\n" + " wOcularFocalLength %5u\n" + " bControlSize %5u\n", + buf[8] | (buf[9] << 8), buf[10] | (buf[11] << 8), + buf[12] | (buf[13] << 8), buf[14]); + ctrls = 0; + for (i = 0; i < 3 && i < buf[14]; i++) + ctrls = (ctrls << 8) | buf[8+n-i-1]; + printf(" bmControls 0x%08x\n", ctrls); + if (protocol == USB_VIDEO_PROTOCOL_15) { + for (i = 0; i < 22; i++) + if ((ctrls >> i) & 1) + printf(" %s\n", camctrlnames[i]); + } + else { + for (i = 0; i < 19; i++) + if ((ctrls >> i) & 1) + printf(" %s\n", camctrlnames[i]); + } + } + dump_junk(buf, " ", 8+n); + break; + + case 0x03: /* OUTPUT_TERMINAL */ + printf("(OUTPUT_TERMINAL)\n"); + term = get_dev_string(dev, buf[8]); + termt = buf[4] | (buf[5] << 8); + get_videoterminal_string(termts, sizeof(termts), termt); + if (buf[0] < 9) + printf(" Warning: Descriptor too short\n"); + printf(" bTerminalID %5u\n" + " wTerminalType 0x%04x %s\n" + " bAssocTerminal %5u\n" + " bSourceID %5u\n" + " iTerminal %5u %s\n", + buf[3], termt, termts, buf[6], buf[7], buf[8], term); + dump_junk(buf, " ", 9); + break; + + case 0x04: /* SELECTOR_UNIT */ + printf("(SELECTOR_UNIT)\n"); + p = buf[4]; + if (buf[0] < 6+p) + printf(" Warning: Descriptor too short\n"); + term = get_dev_string(dev, buf[5+p]); + + printf(" bUnitID %5u\n" + " bNrInPins %5u\n", + buf[3], p); + for (i = 0; i < p; i++) + printf(" baSource(%2u) %5u\n", i, buf[5+i]); + printf(" iSelector %5u %s\n", + buf[5+p], term); + dump_junk(buf, " ", 6+p); + break; + + case 0x05: /* PROCESSING_UNIT */ + printf("(PROCESSING_UNIT)\n"); + n = buf[7]; + term = get_dev_string(dev, buf[8+n]); + if (buf[0] < 10+n) + printf(" Warning: Descriptor too short\n"); + printf(" bUnitID %5u\n" + " bSourceID %5u\n" + " wMaxMultiplier %5u\n" + " bControlSize %5u\n", + buf[3], buf[4], buf[5] | (buf[6] << 8), n); + ctrls = 0; + for (i = 0; i < 3 && i < n; i++) + ctrls = (ctrls << 8) | buf[8+n-i-1]; + printf(" bmControls 0x%08x\n", ctrls); + if (protocol == USB_VIDEO_PROTOCOL_15) { + for (i = 0; i < 19; i++) + if ((ctrls >> i) & 1) + printf(" %s\n", ctrlnames[i]); + } + else { + for (i = 0; i < 18; i++) + if ((ctrls >> i) & 1) + printf(" %s\n", ctrlnames[i]); + } + stds = buf[9+n]; + printf(" iProcessing %5u %s\n" + " bmVideoStandards 0x%02x\n", buf[8+n], term, stds); + for (i = 0; i < 6; i++) + if ((stds >> i) & 1) + printf(" %s\n", stdnames[i]); + break; + + case 0x06: /* EXTENSION_UNIT */ + printf("(EXTENSION_UNIT)\n"); + p = buf[21]; + n = buf[22+p]; + term = get_dev_string(dev, buf[23+p+n]); + if (buf[0] < 24+p+n) + printf(" Warning: Descriptor too short\n"); + printf(" bUnitID %5u\n" + " guidExtensionCode %s\n" + " bNumControls %5u\n" + " bNrInPins %5u\n", + buf[3], get_guid(&buf[4]), buf[20], buf[21]); + for (i = 0; i < p; i++) + printf(" baSourceID(%2u) %5u\n", i, buf[22+i]); + printf(" bControlSize %5u\n", buf[22+p]); + for (i = 0; i < n; i++) + printf(" bmControls(%2u) 0x%02x\n", i, buf[23+p+i]); + printf(" iExtension %5u %s\n", + buf[23+p+n], term); + dump_junk(buf, " ", 24+p+n); + break; + + case 0x07: /* ENCODING UNIT */ + printf("(ENCODING UNIT)\n"); + term = get_dev_string(dev, buf[5]); + if (buf[0] < 13) + printf(" Warning: Descriptor too short\n"); + printf(" bUnitID %5u\n" + " bSourceID %5u\n" + " iEncoding %5u %s\n" + " bControlSize %5u\n", + buf[3], buf[4], buf[5], term, buf[6]); + ctrls = 0; + for (i = 0; i < 3; i++) + ctrls = (ctrls << 8) | buf[9-i]; + printf(" bmControls 0x%08x\n", ctrls); + for (i = 0; i < 20; i++) + if ((ctrls >> i) & 1) + printf(" %s\n", enctrlnames[i]); + for (i = 0; i< 3; i++) + ctrls = (ctrls << 8) | buf[12-i]; + printf(" bmControlsRuntime 0x%08x\n", ctrls); + for (i = 0; i < 20; i++) + if ((ctrls >> i) & 1) + printf(" %s\n", enctrlnames[i]); + break; + + default: + printf("(unknown)\n" + " Invalid desc subtype:"); + dump_bytes(buf+3, buf[0]-3); + break; + } + + free(term); +} + +static void dump_videostreaming_interface(const unsigned char *buf) +{ + static const char * const colorPrims[] = { "Unspecified", "BT.709,sRGB", + "BT.470-2 (M)", "BT.470-2 (B,G)", "SMPTE 170M", "SMPTE 240M" }; + static const char * const transferChars[] = { "Unspecified", "BT.709", + "BT.470-2 (M)", "BT.470-2 (B,G)", "SMPTE 170M", "SMPTE 240M", + "Linear", "sRGB"}; + static const char * const matrixCoeffs[] = { "Unspecified", "BT.709", + "FCC", "BT.470-2 (B,G)", "SMPTE 170M (BT.601)", "SMPTE 240M" }; + unsigned int i, m, n, p, flags, len; + + if (buf[1] != USB_DT_CS_INTERFACE) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 3) + printf(" Warning: Descriptor too short\n"); + printf(" VideoStreaming Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDescriptorSubtype %5u ", + buf[0], buf[1], buf[2]); + switch (buf[2]) { + case 0x01: /* INPUT_HEADER */ + printf("(INPUT_HEADER)\n"); + p = buf[3]; + n = buf[12]; + if (buf[0] < 13+p*n) + printf(" Warning: Descriptor too short\n"); + printf(" bNumFormats %5u\n" + " wTotalLength 0x%04x\n" + " bEndpointAddress 0x%02x EP %u %s\n" + " bmInfo %5u\n" + " bTerminalLink %5u\n" + " bStillCaptureMethod %5u\n" + " bTriggerSupport %5u\n" + " bTriggerUsage %5u\n" + " bControlSize %5u\n", + p, buf[4] | (buf[5] << 8), + buf[6], buf[6] & 0x0f, (buf[6] & 0x80) ? "IN" : "OUT", + buf[7], buf[8], buf[9], buf[10], buf[11], n); + for (i = 0; i < p; i++) + printf( + " bmaControls(%2u) %5u\n", + i, buf[13+i*n]); + dump_junk(buf, " ", 13+p*n); + break; + + case 0x02: /* OUTPUT_HEADER */ + printf("(OUTPUT_HEADER)\n"); + p = buf[3]; + n = buf[8]; + if (buf[0] < 9+p*n) + printf(" Warning: Descriptor too short\n"); + printf(" bNumFormats %5u\n" + " wTotalLength 0x%04x\n" + " bEndpointAddress 0x%02x EP %u %s\n" + " bTerminalLink %5u\n" + " bControlSize %5u\n", + p, buf[4] | (buf[5] << 8), + buf[6], buf[6] & 0x0f, (buf[6] & 0x80) ? "IN" : "OUT", + buf[7], n); + for (i = 0; i < p; i++) + printf( + " bmaControls(%2u) %5u\n", + i, buf[9+i*n]); + dump_junk(buf, " ", 9+p*n); + break; + + case 0x03: /* STILL_IMAGE_FRAME */ + printf("(STILL_IMAGE_FRAME)\n"); + n = buf[4]; + m = buf[5+4*n]; + if (buf[0] < 6+4*n+m) + printf(" Warning: Descriptor too short\n"); + printf(" bEndpointAddress 0x%02x EP %u %s\n" + " bNumImageSizePatterns %3u\n", + buf[3], buf[3] & 0x0f, (buf[3] & 0x80) ? "IN" : "OUT", n); + for (i = 0; i < n; i++) + printf(" wWidth(%2u) %5u\n" + " wHeight(%2u) %5u\n", + i, buf[5+4*i] | (buf[6+4*i] << 8), + i, buf[7+4*i] | (buf[8+4*i] << 8)); + printf(" bNumCompressionPatterns %3u\n", m); + for (i = 0; i < m; i++) + printf(" bCompression(%2u) %5u\n", + i, buf[6+4*n+i]); + dump_junk(buf, " ", 6+4*n+m); + break; + + case 0x04: /* FORMAT_UNCOMPRESSED */ + case 0x10: /* FORMAT_FRAME_BASED */ + if (buf[2] == 0x04) { + printf("(FORMAT_UNCOMPRESSED)\n"); + len = 27; + } else { + printf("(FORMAT_FRAME_BASED)\n"); + len = 28; + } + if (buf[0] < len) + printf(" Warning: Descriptor too short\n"); + flags = buf[25]; + printf(" bFormatIndex %5u\n" + " bNumFrameDescriptors %5u\n" + " guidFormat %s\n" + " bBitsPerPixel %5u\n" + " bDefaultFrameIndex %5u\n" + " bAspectRatioX %5u\n" + " bAspectRatioY %5u\n" + " bmInterlaceFlags 0x%02x\n", + buf[3], buf[4], get_guid(&buf[5]), buf[21], buf[22], + buf[23], buf[24], flags); + printf(" Interlaced stream or variable: %s\n", + (flags & (1 << 0)) ? "Yes" : "No"); + printf(" Fields per frame: %u fields\n", + (flags & (1 << 1)) ? 1 : 2); + printf(" Field 1 first: %s\n", + (flags & (1 << 2)) ? "Yes" : "No"); + printf(" Field pattern: "); + switch ((flags >> 4) & 0x03) { + case 0: + printf("Field 1 only\n"); + break; + case 1: + printf("Field 2 only\n"); + break; + case 2: + printf("Regular pattern of fields 1 and 2\n"); + break; + case 3: + printf("Random pattern of fields 1 and 2\n"); + break; + } + printf(" bCopyProtect %5u\n", buf[26]); + if (buf[2] == 0x10) + printf(" bVariableSize %5u\n", buf[27]); + dump_junk(buf, " ", len); + break; + + case 0x05: /* FRAME UNCOMPRESSED */ + case 0x07: /* FRAME_MJPEG */ + case 0x11: /* FRAME_FRAME_BASED */ + if (buf[2] == 0x05) { + printf("(FRAME_UNCOMPRESSED)\n"); + n = 25; + } else if (buf[2] == 0x07) { + printf("(FRAME_MJPEG)\n"); + n = 25; + } else { + printf("(FRAME_FRAME_BASED)\n"); + n = 21; + } + len = (buf[n] != 0) ? (26+buf[n]*4) : 38; + if (buf[0] < len) + printf(" Warning: Descriptor too short\n"); + flags = buf[4]; + printf(" bFrameIndex %5u\n" + " bmCapabilities 0x%02x\n", + buf[3], flags); + printf(" Still image %ssupported\n", + (flags & (1 << 0)) ? "" : "un"); + if (flags & (1 << 1)) + printf(" Fixed frame-rate\n"); + printf(" wWidth %5u\n" + " wHeight %5u\n" + " dwMinBitRate %9u\n" + " dwMaxBitRate %9u\n", + buf[5] | (buf[6] << 8), buf[7] | (buf[8] << 8), + buf[9] | (buf[10] << 8) | (buf[11] << 16) | (buf[12] << 24), + buf[13] | (buf[14] << 8) | (buf[15] << 16) | (buf[16] << 24)); + if (buf[2] == 0x11) + printf(" dwDefaultFrameInterval %9u\n" + " bFrameIntervalType %5u\n" + " dwBytesPerLine %9u\n", + buf[17] | (buf[18] << 8) | (buf[19] << 16) | (buf[20] << 24), + buf[21], + buf[22] | (buf[23] << 8) | (buf[24] << 16) | (buf[25] << 24)); + else + printf(" dwMaxVideoFrameBufferSize %9u\n" + " dwDefaultFrameInterval %9u\n" + " bFrameIntervalType %5u\n", + buf[17] | (buf[18] << 8) | (buf[19] << 16) | (buf[20] << 24), + buf[21] | (buf[22] << 8) | (buf[23] << 16) | (buf[24] << 24), + buf[25]); + if (buf[n] == 0) + printf(" dwMinFrameInterval %9u\n" + " dwMaxFrameInterval %9u\n" + " dwFrameIntervalStep %9u\n", + buf[26] | (buf[27] << 8) | (buf[28] << 16) | (buf[29] << 24), + buf[30] | (buf[31] << 8) | (buf[32] << 16) | (buf[33] << 24), + buf[34] | (buf[35] << 8) | (buf[36] << 16) | (buf[37] << 24)); + else + for (i = 0; i < buf[n]; i++) + printf(" dwFrameInterval(%2u) %9u\n", + i, buf[26+4*i] | (buf[27+4*i] << 8) | + (buf[28+4*i] << 16) | (buf[29+4*i] << 24)); + dump_junk(buf, " ", len); + break; + + case 0x06: /* FORMAT_MJPEG */ + printf("(FORMAT_MJPEG)\n"); + if (buf[0] < 11) + printf(" Warning: Descriptor too short\n"); + flags = buf[5]; + printf(" bFormatIndex %5u\n" + " bNumFrameDescriptors %5u\n" + " bFlags %5u\n", + buf[3], buf[4], flags); + printf(" Fixed-size samples: %s\n", + (flags & (1 << 0)) ? "Yes" : "No"); + flags = buf[9]; + printf(" bDefaultFrameIndex %5u\n" + " bAspectRatioX %5u\n" + " bAspectRatioY %5u\n" + " bmInterlaceFlags 0x%02x\n", + buf[6], buf[7], buf[8], flags); + printf(" Interlaced stream or variable: %s\n", + (flags & (1 << 0)) ? "Yes" : "No"); + printf(" Fields per frame: %u fields\n", + (flags & (1 << 1)) ? 2 : 1); + printf(" Field 1 first: %s\n", + (flags & (1 << 2)) ? "Yes" : "No"); + printf(" Field pattern: "); + switch ((flags >> 4) & 0x03) { + case 0: + printf("Field 1 only\n"); + break; + case 1: + printf("Field 2 only\n"); + break; + case 2: + printf("Regular pattern of fields 1 and 2\n"); + break; + case 3: + printf("Random pattern of fields 1 and 2\n"); + break; + } + printf(" bCopyProtect %5u\n", buf[10]); + dump_junk(buf, " ", 11); + break; + + case 0x0a: /* FORMAT_MPEG2TS */ + printf("(FORMAT_MPEG2TS)\n"); + len = buf[0] < 23 ? 7 : 23; + if (buf[0] < len) + printf(" Warning: Descriptor too short\n"); + printf(" bFormatIndex %5u\n" + " bDataOffset %5u\n" + " bPacketLength %5u\n" + " bStrideLength %5u\n", + buf[3], buf[4], buf[5], buf[6]); + if (len > 7) + printf(" guidStrideFormat %s\n", + get_guid(&buf[7])); + dump_junk(buf, " ", len); + break; + + case 0x0d: /* COLORFORMAT */ + printf("(COLORFORMAT)\n"); + if (buf[0] < 6) + printf(" Warning: Descriptor too short\n"); + printf(" bColorPrimaries %5u (%s)\n", + buf[3], (buf[3] <= 5) ? colorPrims[buf[3]] : "Unknown"); + printf(" bTransferCharacteristics %5u (%s)\n", + buf[4], (buf[4] <= 7) ? transferChars[buf[4]] : "Unknown"); + printf(" bMatrixCoefficients %5u (%s)\n", + buf[5], (buf[5] <= 5) ? matrixCoeffs[buf[5]] : "Unknown"); + dump_junk(buf, " ", 6); + break; + + case 0x12: /* FORMAT_STREAM_BASED */ + printf("(FORMAT_STREAM_BASED)\n"); + if (buf[0] != 24) + printf(" Warning: Incorrect descriptor length\n"); + + printf(" bFormatIndex %5u\n" + " guidFormat %s\n" + " dwPacketLength %7u\n", + buf[3], get_guid(&buf[4]), buf[20]); + dump_junk(buf, " ", 24); + break; + + default: + printf(" Invalid desc subtype:"); + dump_bytes(buf+3, buf[0]-3); + break; + } +} + +static void dump_dfu_interface(const unsigned char *buf) +{ + if (buf[1] != USB_DT_CS_DEVICE) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 7) + printf(" Warning: Descriptor too short\n"); + printf(" Device Firmware Upgrade Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bmAttributes %5u\n", + buf[0], buf[1], buf[2]); + if (buf[2] & 0xf0) + printf(" (unknown attributes!)\n"); + printf(" Will %sDetach\n", (buf[2] & 0x08) ? "" : "Not "); + printf(" Manifestation %s\n", (buf[2] & 0x04) ? "Tolerant" : "Intolerant"); + printf(" Upload %s\n", (buf[2] & 0x02) ? "Supported" : "Unsupported"); + printf(" Download %s\n", (buf[2] & 0x01) ? "Supported" : "Unsupported"); + printf(" wDetachTimeout %5u milliseconds\n" + " wTransferSize %5u bytes\n", + buf[3] | (buf[4] << 8), buf[5] | (buf[6] << 8)); + + /* DFU 1.0 defines no version code, DFU 1.1 does */ + if (buf[0] < 9) + return; + printf(" bcdDFUVersion %x.%02x\n", + buf[8], buf[7]); +} + +static void dump_hub(const char *prefix, const unsigned char *p, int tt_type) +{ + unsigned int l, i, j; + unsigned int offset; + unsigned int wHubChar = (p[4] << 8) | p[3]; + + printf("%sHub Descriptor:\n", prefix); + printf("%s bLength %3u\n", prefix, p[0]); + printf("%s bDescriptorType %3u\n", prefix, p[1]); + printf("%s nNbrPorts %3u\n", prefix, p[2]); + printf("%s wHubCharacteristic 0x%04x\n", prefix, wHubChar); + switch (wHubChar & 0x03) { + case 0: + printf("%s Ganged power switching\n", prefix); + break; + case 1: + printf("%s Per-port power switching\n", prefix); + break; + default: + printf("%s No power switching (usb 1.0)\n", prefix); + break; + } + if (wHubChar & 0x04) + printf("%s Compound device\n", prefix); + switch ((wHubChar >> 3) & 0x03) { + case 0: + printf("%s Ganged overcurrent protection\n", prefix); + break; + case 1: + printf("%s Per-port overcurrent protection\n", prefix); + break; + default: + printf("%s No overcurrent protection\n", prefix); + break; + } + /* USB 3.0 hubs don't have TTs. */ + if (tt_type >= 1 && tt_type < 3) { + l = (wHubChar >> 5) & 0x03; + printf("%s TT think time %d FS bits\n", prefix, (l + 1) * 8); + } + /* USB 3.0 hubs don't have port indicators. Sad face. */ + if (tt_type != 3 && wHubChar & (1<<7)) + printf("%s Port indicators\n", prefix); + printf("%s bPwrOn2PwrGood %3u * 2 milli seconds\n", prefix, p[5]); + + /* USB 3.0 hubs report current in units of aCurrentUnit, or 4 mA */ + if (tt_type == 3) + printf("%s bHubContrCurrent %4u milli Ampere\n", + prefix, p[6]*4); + else + printf("%s bHubContrCurrent %3u milli Ampere\n", + prefix, p[6]); + + if (tt_type == 3) { + printf("%s bHubDecLat 0.%1u micro seconds\n", + prefix, p[7]); + printf("%s wHubDelay %4u nano seconds\n", + prefix, (p[8] << 4) +(p[7])); + offset = 10; + } else { + offset = 7; + } + + l = (p[2] >> 3) + 1; /* this determines the variable number of bytes following */ + if (l > HUB_STATUS_BYTELEN) + l = HUB_STATUS_BYTELEN; + printf("%s DeviceRemovable ", prefix); + for (i = 0; i < l; i++) + printf(" 0x%02x", p[offset+i]); + + if (tt_type != 3) { + printf("\n%s PortPwrCtrlMask ", prefix); + for (j = 0; j < l; j++) + printf(" 0x%02x", p[offset+i+j]); + } + printf("\n"); +} + +static void dump_ccid_device(const unsigned char *buf) +{ + unsigned int us; + + if (buf[0] < 54) { + printf(" Warning: Descriptor too short\n"); + return; + } + printf(" ChipCard Interface Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bcdCCID %2x.%02x", + buf[0], buf[1], buf[3], buf[2]); + if (buf[3] != 1 || buf[2] != 0) + fputs(" (Warning: Only accurate for version 1.0)", stdout); + putchar('\n'); + + printf(" nMaxSlotIndex %5u\n" + " bVoltageSupport %5u %s%s%s\n", + buf[4], + buf[5], + (buf[5] & 1) ? "5.0V " : "", + (buf[5] & 2) ? "3.0V " : "", + (buf[5] & 4) ? "1.8V " : ""); + + us = convert_le_u32 (buf+6); + printf(" dwProtocols %5u ", us); + if ((us & 1)) + fputs(" T=0", stdout); + if ((us & 2)) + fputs(" T=1", stdout); + if ((us & ~3)) + fputs(" (Invalid values detected)", stdout); + putchar('\n'); + + us = convert_le_u32(buf+10); + printf(" dwDefaultClock %5u\n", us); + us = convert_le_u32(buf+14); + printf(" dwMaxiumumClock %5u\n", us); + printf(" bNumClockSupported %5u\n", buf[18]); + us = convert_le_u32(buf+19); + printf(" dwDataRate %7u bps\n", us); + us = convert_le_u32(buf+23); + printf(" dwMaxDataRate %7u bps\n", us); + printf(" bNumDataRatesSupp. %5u\n", buf[27]); + + us = convert_le_u32(buf+28); + printf(" dwMaxIFSD %5u\n", us); + + us = convert_le_u32(buf+32); + printf(" dwSyncProtocols %08X ", us); + if ((us&1)) + fputs(" 2-wire", stdout); + if ((us&2)) + fputs(" 3-wire", stdout); + if ((us&4)) + fputs(" I2C", stdout); + putchar('\n'); + + us = convert_le_u32(buf+36); + printf(" dwMechanical %08X ", us); + if ((us & 1)) + fputs(" accept", stdout); + if ((us & 2)) + fputs(" eject", stdout); + if ((us & 4)) + fputs(" capture", stdout); + if ((us & 8)) + fputs(" lock", stdout); + putchar('\n'); + + us = convert_le_u32(buf+40); + printf(" dwFeatures %08X\n", us); + if ((us & 0x0002)) + fputs(" Auto configuration based on ATR\n", stdout); + if ((us & 0x0004)) + fputs(" Auto activation on insert\n", stdout); + if ((us & 0x0008)) + fputs(" Auto voltage selection\n", stdout); + if ((us & 0x0010)) + fputs(" Auto clock change\n", stdout); + if ((us & 0x0020)) + fputs(" Auto baud rate change\n", stdout); + if ((us & 0x0040)) + fputs(" Auto parameter negotiation made by CCID\n", stdout); + else if ((us & 0x0080)) + fputs(" Auto PPS made by CCID\n", stdout); + else if ((us & (0x0040 | 0x0080))) + fputs(" WARNING: conflicting negotiation features\n", stdout); + + if ((us & 0x0100)) + fputs(" CCID can set ICC in clock stop mode\n", stdout); + if ((us & 0x0200)) + fputs(" NAD value other than 0x00 accepted\n", stdout); + if ((us & 0x0400)) + fputs(" Auto IFSD exchange\n", stdout); + + if ((us & 0x00010000)) + fputs(" TPDU level exchange\n", stdout); + else if ((us & 0x00020000)) + fputs(" Short APDU level exchange\n", stdout); + else if ((us & 0x00040000)) + fputs(" Short and extended APDU level exchange\n", stdout); + else if ((us & 0x00070000)) + fputs(" WARNING: conflicting exchange levels\n", stdout); + + us = convert_le_u32(buf+44); + printf(" dwMaxCCIDMsgLen %5u\n", us); + + printf(" bClassGetResponse "); + if (buf[48] == 0xff) + fputs("echo\n", stdout); + else + printf(" %02X\n", buf[48]); + + printf(" bClassEnvelope "); + if (buf[49] == 0xff) + fputs("echo\n", stdout); + else + printf(" %02X\n", buf[48]); + + printf(" wlcdLayout "); + if (!buf[50] && !buf[51]) + fputs("none\n", stdout); + else + printf("%u cols %u lines\n", buf[50], buf[51]); + + printf(" bPINSupport %5u ", buf[52]); + if ((buf[52] & 1)) + fputs(" verification", stdout); + if ((buf[52] & 2)) + fputs(" modification", stdout); + putchar('\n'); + + printf(" bMaxCCIDBusySlots %5u\n", buf[53]); + + if (buf[0] > 54) { + fputs(" junk ", stdout); + dump_bytes(buf+54, buf[0]-54); + } +} + +/* ---------------------------------------------------------------------- */ + +/* + * HID descriptor + */ + +static void dump_report_desc(unsigned char *b, int l) +{ + unsigned int j, bsize, btag, btype, data = 0xffff, hut = 0xffff; + int i; + char *types[4] = { "Main", "Global", "Local", "reserved" }; + char indent[] = " "; + + printf(" Report Descriptor: (length is %d)\n", l); + for (i = 0; i < l; ) { + bsize = b[i] & 0x03; + if (bsize == 3) + bsize = 4; + btype = b[i] & (0x03 << 2); + btag = b[i] & ~0x03; /* 2 LSB bits encode length */ + printf(" Item(%-6s): %s, data=", types[btype>>2], + names_reporttag(btag)); + if (bsize > 0) { + printf(" [ "); + data = 0; + for (j = 0; j < bsize; j++) { + printf("0x%02x ", b[i+1+j]); + data += (b[i+1+j] << (8*j)); + } + printf("] %d", data); + } else + printf("none"); + printf("\n"); + switch (btag) { + case 0x04: /* Usage Page */ + printf("%s%s\n", indent, names_huts(data)); + hut = data; + break; + + case 0x08: /* Usage */ + case 0x18: /* Usage Minimum */ + case 0x28: /* Usage Maximum */ + printf("%s%s\n", indent, + names_hutus((hut << 16) + data)); + break; + + case 0x54: /* Unit Exponent */ + printf("%sUnit Exponent: %i\n", indent, + (signed char)data); + break; + + case 0x64: /* Unit */ + printf("%s", indent); + dump_unit(data, bsize); + break; + + case 0xa0: /* Collection */ + printf("%s", indent); + switch (data) { + case 0x00: + printf("Physical\n"); + break; + + case 0x01: + printf("Application\n"); + break; + + case 0x02: + printf("Logical\n"); + break; + + case 0x03: + printf("Report\n"); + break; + + case 0x04: + printf("Named Array\n"); + break; + + case 0x05: + printf("Usage Switch\n"); + break; + + case 0x06: + printf("Usage Modifier\n"); + break; + + default: + if (data & 0x80) + printf("Vendor defined\n"); + else + printf("Reserved for future use.\n"); + } + break; + case 0x80: /* Input */ + case 0x90: /* Output */ + case 0xb0: /* Feature */ + printf("%s%s %s %s %s %s\n%s%s %s %s %s\n", + indent, + data & 0x01 ? "Constant" : "Data", + data & 0x02 ? "Variable" : "Array", + data & 0x04 ? "Relative" : "Absolute", + data & 0x08 ? "Wrap" : "No_Wrap", + data & 0x10 ? "Non_Linear" : "Linear", + indent, + data & 0x20 ? "No_Preferred_State" : "Preferred_State", + data & 0x40 ? "Null_State" : "No_Null_Position", + data & 0x80 ? "Volatile" : "Non_Volatile", + data & 0x100 ? "Buffered Bytes" : "Bitfield"); + break; + } + i += 1 + bsize; + } +} + +static void dump_printer_device(libusb_device_handle *dev, + const struct libusb_interface_descriptor *interface, + const unsigned char *buf) +{ + unsigned int i; + unsigned int n; + + if (interface->bInterfaceProtocol != 0x04) /* IPP-over-USB */ + return; + + printf(" IPP Printer Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bcdReleaseNumber %5u\n" + " bcdNumDescriptors %5u\n", + buf[0], buf[1], buf[2], buf[3]); + + n = 4; + for (i = 0 ; i < buf[3] ; i++) { + switch (buf[n]) { + case 0x00: { /* Basic capabilities */ + uint16_t caps = le16_to_cpu(*((uint16_t*)&buf[n+2])); + char *uuid = get_dev_string(dev, buf[n+5]); + + printf(" iIPPVersionsSupported %5u\n", buf[n+4]); + printf(" iIPPPrinterUUID %5u %s\n", buf[n+5], uuid); + printf(" wBasicCapabilities 0x%04x ", caps); + if (caps & 0x01) + printf(" Print"); + if (caps & 0x02) + printf(" Scan"); + if (caps & 0x04) + printf(" Fax"); + if (caps & 0x08) + printf(" Other"); + if (caps & 0x10) + printf(" HTTP-over-USB"); + if ((caps & 0x60) == 0x00) + printf(" No-Auth"); + else if ((caps & 0x60) == 0x20) + printf(" Username-Auth"); + else if ((caps & 0x60) == 0x40) + printf(" Reserved-Auth"); + else if ((caps & 0x60) == 0x60) + printf(" Negotiable-Auth"); + printf("\n"); + free(uuid); + break; + } + default: + /* Vendor Specific, Ignore for now. */ + printf(" UnknownCapabilities %5u %5u\n", buf[n], buf[n+1]); + break; + } + n += 2 + buf[n+1]; + } +} + +static void dump_hid_device(libusb_device_handle *dev, + const struct libusb_interface_descriptor *interface, + const unsigned char *buf) +{ + int i, len; + unsigned char dbuf[8192]; + + if (buf[1] != LIBUSB_DT_HID) + printf(" Warning: Invalid descriptor\n"); + else if (buf[0] < 6+3*buf[5]) + printf(" Warning: Descriptor too short\n"); + printf(" HID Device Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bcdHID %2x.%02x\n" + " bCountryCode %5u %s\n" + " bNumDescriptors %5u\n", + buf[0], buf[1], buf[3], buf[2], buf[4], + names_countrycode(buf[4]) ? : "Unknown", buf[5]); + for (i = 0; i < buf[5]; i++) + printf(" bDescriptorType %5u %s\n" + " wDescriptorLength %5u\n", + buf[6+3*i], names_hid(buf[6+3*i]), + buf[7+3*i] | (buf[8+3*i] << 8)); + dump_junk(buf, " ", 6+3*buf[5]); + if (!do_report_desc) + return; + + if (!dev) { + printf(" Report Descriptors: \n" + " ** UNAVAILABLE **\n"); + return; + } + + for (i = 0; i < buf[5]; i++) { + /* we are just interested in report descriptors*/ + if (buf[6+3*i] != LIBUSB_DT_REPORT) + continue; + len = buf[7+3*i] | (buf[8+3*i] << 8); + if (len > (int)sizeof(dbuf)) { + printf("report descriptor too long\n"); + continue; + } + if (libusb_claim_interface(dev, interface->bInterfaceNumber) == 0) { + int retries = 4; + int n = 0; + while (n < len && retries--) + n = usb_control_msg(dev, + LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD + | LIBUSB_RECIPIENT_INTERFACE, + LIBUSB_REQUEST_GET_DESCRIPTOR, + (LIBUSB_DT_REPORT << 8), + interface->bInterfaceNumber, + dbuf, len, + CTRL_TIMEOUT); + + if (n > 0) { + if (n < len) + printf(" Warning: incomplete report descriptor\n"); + dump_report_desc(dbuf, n); + } else { + printf(" Warning: can't get report descriptor, %s\n", + libusb_error_name(n)); + } + libusb_release_interface(dev, interface->bInterfaceNumber); + } else { + /* recent Linuxes require claim() for RECIP_INTERFACE, + * so "rmmod hid" will often make these available. + */ + printf(" Report Descriptors: \n" + " ** UNAVAILABLE **\n"); + } + } +} + +static char * +dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, char *indent) +{ + int tmp; + char *str = NULL; + char *type; + + switch (buf[2]) { + case 0: + type = "Header"; + if (buf[0] != 5) + goto bad; + printf("%sCDC Header:\n" + "%s bcdCDC %x.%02x\n", + indent, + indent, buf[4], buf[3]); + break; + case 0x01: /* call management functional desc */ + type = "Call Management"; + if (buf[0] != 5) + goto bad; + printf("%sCDC Call Management:\n" + "%s bmCapabilities 0x%02x\n", + indent, + indent, buf[3]); + if (buf[3] & 0x01) + printf("%s call management\n", indent); + if (buf[3] & 0x02) + printf("%s use DataInterface\n", indent); + printf("%s bDataInterface %d\n", indent, buf[4]); + break; + case 0x02: /* acm functional desc */ + type = "ACM"; + if (buf[0] != 4) + goto bad; + printf("%sCDC ACM:\n" + "%s bmCapabilities 0x%02x\n", + indent, + indent, buf[3]); + if (buf[3] & 0x08) + printf("%s connection notifications\n", indent); + if (buf[3] & 0x04) + printf("%s sends break\n", indent); + if (buf[3] & 0x02) + printf("%s line coding and serial state\n", indent); + if (buf[3] & 0x01) + printf("%s get/set/clear comm features\n", indent); + break; +#if 0 + case 0x03: /* direct line management */ + case 0x04: /* telephone ringer */ + case 0x05: /* telephone call and line state reporting */ +#endif + case 0x06: /* union desc */ + type = "Union"; + if (buf[0] < 5) + goto bad; + printf("%sCDC Union:\n" + "%s bMasterInterface %d\n" + "%s bSlaveInterface ", + indent, + indent, buf[3], + indent); + for (tmp = 4; tmp < buf[0]; tmp++) + printf("%d ", buf[tmp]); + printf("\n"); + break; + case 0x07: /* country selection functional desc */ + type = "Country Selection"; + if (buf[0] < 6 || (buf[0] & 1) != 0) + goto bad; + str = get_dev_string(dev, buf[3]); + printf("%sCountry Selection:\n" + "%s iCountryCodeRelDate %4d %s\n", + indent, + indent, buf[3], (buf[3] && *str) ? str : "(?\?)"); + for (tmp = 4; tmp < buf[0]; tmp += 2) { + printf("%s wCountryCode 0x%02x%02x\n", + indent, buf[tmp], buf[tmp + 1]); + } + break; + case 0x08: /* telephone operational modes */ + type = "Telephone Operations"; + if (buf[0] != 4) + goto bad; + printf("%sCDC Telephone operations:\n" + "%s bmCapabilities 0x%02x\n", + indent, + indent, buf[3]); + if (buf[3] & 0x04) + printf("%s computer centric mode\n", indent); + if (buf[3] & 0x02) + printf("%s standalone mode\n", indent); + if (buf[3] & 0x01) + printf("%s simple mode\n", indent); + break; +#if 0 + case 0x09: /* USB terminal */ +#endif + case 0x0a: /* network channel terminal */ + type = "Network Channel Terminal"; + if (buf[0] != 7) + goto bad; + str = get_dev_string(dev, buf[4]); + printf("%sNetwork Channel Terminal:\n" + "%s bEntityId %3d\n" + "%s iName %3d %s\n" + "%s bChannelIndex %3d\n" + "%s bPhysicalInterface %3d\n", + indent, + indent, buf[3], + indent, buf[4], str, + indent, buf[5], + indent, buf[6]); + break; +#if 0 + case 0x0b: /* protocol unit */ + case 0x0c: /* extension unit */ + case 0x0d: /* multi-channel management */ + case 0x0e: /* CAPI control management*/ +#endif + case 0x0f: /* ethernet functional desc */ + type = "Ethernet"; + if (buf[0] != 13) + goto bad; + str = get_dev_string(dev, buf[3]); + tmp = buf[7] << 8; + tmp |= buf[6]; tmp <<= 8; + tmp |= buf[5]; tmp <<= 8; + tmp |= buf[4]; + printf("%sCDC Ethernet:\n" + "%s iMacAddress %10d %s\n" + "%s bmEthernetStatistics 0x%08x\n", + indent, + indent, buf[3], (buf[3] && *str) ? str : "(?\?)", + indent, tmp); + /* FIXME dissect ALL 28 bits */ + printf("%s wMaxSegmentSize %10d\n" + "%s wNumberMCFilters 0x%04x\n" + "%s bNumberPowerFilters %10d\n", + indent, (buf[9]<<8)|buf[8], + indent, (buf[11]<<8)|buf[10], + indent, buf[12]); + break; +#if 0 + case 0x10: /* ATM networking */ +#endif + case 0x11: /* WHCM functional desc */ + type = "WHCM version"; + if (buf[0] != 5) + goto bad; + printf("%sCDC WHCM:\n" + "%s bcdVersion %x.%02x\n", + indent, + indent, buf[4], buf[3]); + break; + case 0x12: /* MDLM functional desc */ + type = "MDLM"; + if (buf[0] != 21) + goto bad; + printf("%sCDC MDLM:\n" + "%s bcdCDC %x.%02x\n" + "%s bGUID %s\n", + indent, + indent, buf[4], buf[3], + indent, get_guid(buf + 5)); + break; + case 0x13: /* MDLM detail desc */ + type = "MDLM detail"; + if (buf[0] < 5) + goto bad; + printf("%sCDC MDLM detail:\n" + "%s bGuidDescriptorType %02x\n" + "%s bDetailData ", + indent, + indent, buf[3], + indent); + dump_bytes(buf + 4, buf[0] - 4); + break; + case 0x14: /* device management functional desc */ + type = "Device Management"; + if (buf[0] != 7) + goto bad; + printf("%sCDC Device Management:\n" + "%s bcdVersion %x.%02x\n" + "%s wMaxCommand %d\n", + indent, + indent, buf[4], buf[3], + indent, (buf[6] << 8) | buf[5]); + break; + case 0x15: /* OBEX functional desc */ + type = "OBEX"; + if (buf[0] != 5) + goto bad; + printf("%sCDC OBEX:\n" + "%s bcdVersion %x.%02x\n", + indent, + indent, buf[4], buf[3]); + break; + case 0x16: /* command set functional desc */ + type = "Command Set"; + if (buf[0] != 22) + goto bad; + str = get_dev_string(dev, buf[5]); + printf("%sCDC Command Set:\n" + "%s bcdVersion %x.%02x\n" + "%s iCommandSet %4d %s\n" + "%s bGUID %s\n", + indent, + indent, buf[4], buf[3], + indent, buf[5], (buf[5] && *str) ? str : "(?\?)", + indent, get_guid(buf + 6)); + break; +#if 0 + case 0x17: /* command set detail desc */ + case 0x18: /* telephone control model functional desc */ +#endif + case 0x1a: /* NCM functional desc */ + type = "NCM"; + if (buf[0] != 6) + goto bad; + printf("%sCDC NCM:\n" + "%s bcdNcmVersion %x.%02x\n" + "%s bmNetworkCapabilities 0x%02x\n", + indent, + indent, buf[4], buf[3], + indent, buf[5]); + if (buf[5] & 1<<5) + printf("%s 8-byte ntb input size\n", indent); + if (buf[5] & 1<<4) + printf("%s crc mode\n", indent); + if (buf[5] & 1<<3) + printf("%s max datagram size\n", indent); + if (buf[5] & 1<<2) + printf("%s encapsulated commands\n", indent); + if (buf[5] & 1<<1) + printf("%s net address\n", indent); + if (buf[5] & 1<<0) + printf("%s packet filter\n", indent); + break; + case 0x1b: /* MBIM functional desc */ + type = "MBIM"; + if (buf[0] != 12) + goto bad; + printf("%sCDC MBIM:\n" + "%s bcdMBIMVersion %x.%02x\n" + "%s wMaxControlMessage %d\n" + "%s bNumberFilters %d\n" + "%s bMaxFilterSize %d\n" + "%s wMaxSegmentSize %d\n" + "%s bmNetworkCapabilities 0x%02x\n", + indent, + indent, buf[4], buf[3], + indent, (buf[6] << 8) | buf[5], + indent, buf[7], + indent, buf[8], + indent, (buf[10] << 8) | buf[9], + indent, buf[11]); + if (buf[11] & 0x20) + printf("%s 8-byte ntb input size\n", indent); + if (buf[11] & 0x08) + printf("%s max datagram size\n", indent); + break; + case 0x1c: /* MBIM extended functional desc */ + type = "MBIM Extended"; + if (buf[0] != 8) + goto bad; + printf("%sCDC MBIM Extended:\n" + "%s bcdMBIMExtendedVersion %2x.%02x\n" + "%s bMaxOutstandingCommandMessages %3d\n" + "%s wMTU %5d\n", + indent, + indent, buf[4], buf[3], + indent, buf[5], + indent, buf[6] | (buf[7] << 8)); + break; + default: + /* FIXME there are about a dozen more descriptor types */ + printf("%sUNRECOGNIZED CDC: ", indent); + dump_bytes(buf, buf[0]); + return "unrecognized comm descriptor"; + } + + free(str); + + return 0; + +bad: + printf("%sINVALID CDC (%s): ", indent, type); + dump_bytes(buf, buf[0]); + return "corrupt comm descriptor"; +} + +/* ---------------------------------------------------------------------- */ + +static void do_hub(libusb_device_handle *fd, unsigned tt_type, unsigned speed, + bool has_ssp) +{ + unsigned char buf[7 /* base descriptor */ + + 2 /* bitmasks */ * HUB_STATUS_BYTELEN]; + int i, ret, value; + unsigned int link_state; + const char * const link_state_descriptions[] = { + "U0", + "U1", + "U2", + "suspend", + "SS.disabled", + "Rx.Detect", + "SS.Inactive", + "Polling", + "Recovery", + "Hot Reset", + "Compliance", + "Loopback", + }; + bool is_ext_status = tt_type == 3 && speed >= 0x0310 && has_ssp; + + /* USB 3.x hubs have a slightly different descriptor */ + if (speed >= 0x0300) + value = 0x2A; + else + value = 0x29; + + ret = usb_control_msg(fd, + LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_DEVICE, + LIBUSB_REQUEST_GET_DESCRIPTOR, + value << 8, 0, + buf, sizeof buf, CTRL_TIMEOUT); + if (ret < 0) { + /* Linux returns EHOSTUNREACH for suspended devices */ + if (errno != EHOSTUNREACH) + fprintf(stderr, "can't get hub descriptor, %s (%s)\n", + libusb_error_name(ret), strerror(errno)); + return; + } + if (ret < 9 /* at least one port's bitmasks */) { + fprintf(stderr, + "incomplete hub descriptor, %d bytes\n", + ret); + return; + } + dump_hub("", buf, tt_type); + + printf(" Hub Port Status:\n"); + for (i = 0; i < buf[2]; i++) { + unsigned char status[8]; + + /* Request EXT_PORT_STATUS for USB 3.1 SuperSpeedPlus hubs, + PORT_STATUS otherwise */ + ret = usb_control_msg(fd, + LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS + | LIBUSB_RECIPIENT_OTHER, + LIBUSB_REQUEST_GET_STATUS, + is_ext_status ? 2 : 0, i + 1, + status, is_ext_status ? 8 : 4, + CTRL_TIMEOUT); + if (ret < 0) { + fprintf(stderr, + "cannot read port %d status, %s (%d)\n", + i + 1, strerror(errno), errno); + break; + } + + printf(" Port %d: %02x%02x.%02x%02x", i + 1, + status[3], status[2], + status[1], status[0]); + /* CAPS are used to highlight "transient" states */ + if (speed < 0x0300) { + printf("%s%s%s%s%s", + (status[2] & 0x10) ? " C_RESET" : "", + (status[2] & 0x08) ? " C_OC" : "", + (status[2] & 0x04) ? " C_SUSPEND" : "", + (status[2] & 0x02) ? " C_ENABLE" : "", + (status[2] & 0x01) ? " C_CONNECT" : ""); + printf("%s%s%s%s%s%s%s%s%s%s%s\n", + (status[1] & 0x10) ? " indicator" : "", + (status[1] & 0x08) ? " test" : "", + (status[1] & 0x04) ? " highspeed" : "", + (status[1] & 0x02) ? " lowspeed" : "", + (status[1] & 0x01) ? " power" : "", + (status[0] & 0x20) ? " L1" : "", + (status[0] & 0x10) ? " RESET" : "", + (status[0] & 0x08) ? " oc" : "", + (status[0] & 0x04) ? " suspend" : "", + (status[0] & 0x02) ? " enable" : "", + (status[0] & 0x01) ? " connect" : ""); + } else { + link_state = ((status[0] & 0xe0) >> 5) + + ((status[1] & 0x1) << 3); + printf("%s%s%s%s%s%s", + (status[2] & 0x80) ? " C_CONFIG_ERROR" : "", + (status[2] & 0x40) ? " C_LINK_STATE" : "", + (status[2] & 0x20) ? " C_BH_RESET" : "", + (status[2] & 0x10) ? " C_RESET" : "", + (status[2] & 0x08) ? " C_OC" : "", + (status[2] & 0x01) ? " C_CONNECT" : ""); + printf("%s%s", + ((status[1] & 0x1C) == 0) ? " 5Gbps" : " Unknown Speed", + (status[1] & 0x02) ? " power" : ""); + /* Link state is bits 8:5 */ + if (link_state < (sizeof(link_state_descriptions) / + sizeof(*link_state_descriptions))) + printf(" %s", link_state_descriptions[link_state]); + printf("%s%s%s%s\n", + (status[0] & 0x10) ? " RESET" : "", + (status[0] & 0x08) ? " oc" : "", + (status[0] & 0x02) ? " enable" : "", + (status[0] & 0x01) ? " connect" : ""); + } + + if (is_ext_status && (status[0] & 0x01)) { + printf(" Ext Status: %02x%02x.%02x%02x\n", + status[7], status[6], + status[5], status[4]); + printf(" RX Speed Attribute ID: %d Lanes: %d\n", + status[4] & 0x0f, (status[5] & 0x0f)+1); + printf(" TX Speed Attribute ID: %d Lanes: %d\n", + (status[4] >> 4) & 0x0f, ((status[5] >> 4) & 0x0f)+1); + } + } +} + +static void do_dualspeed(libusb_device_handle *fd) +{ + unsigned char buf[10]; + char cls[128], subcls[128], proto[128]; + int ret; + + ret = usb_control_msg(fd, + LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, + LIBUSB_REQUEST_GET_DESCRIPTOR, + USB_DT_DEVICE_QUALIFIER << 8, 0, + buf, sizeof buf, CTRL_TIMEOUT); + + /* We don't need to complain to the user if the device is claimed + * and we aren't allowed to access the device qualifier. + */ + if (ret < 0 && errno != EPIPE) { + if (verblevel > 1 || errno != EAGAIN) + perror("can't get device qualifier"); + } + + /* all dual-speed devices have a qualifier */ + if (ret != sizeof buf + || buf[0] != ret + || buf[1] != USB_DT_DEVICE_QUALIFIER) + return; + + get_class_string(cls, sizeof(cls), + buf[4]); + get_subclass_string(subcls, sizeof(subcls), + buf[4], buf[5]); + get_protocol_string(proto, sizeof(proto), + buf[4], buf[5], buf[6]); + printf("Device Qualifier (for other device speed):\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bcdUSB %2x.%02x\n" + " bDeviceClass %5u %s\n" + " bDeviceSubClass %5u %s\n" + " bDeviceProtocol %5u %s\n" + " bMaxPacketSize0 %5u\n" + " bNumConfigurations %5u\n", + buf[0], buf[1], + buf[3], buf[2], + buf[4], cls, + buf[5], subcls, + buf[6], proto, + buf[7], buf[8]); + + /* FIXME also show the OTHER_SPEED_CONFIG descriptors */ +} + +static void do_debug(libusb_device_handle *fd) +{ + unsigned char buf[4]; + int ret; + + ret = usb_control_msg(fd, + LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, + LIBUSB_REQUEST_GET_DESCRIPTOR, + USB_DT_DEBUG << 8, 0, + buf, sizeof buf, CTRL_TIMEOUT); + + /* We don't need to complain to the user if the device is claimed + * and we aren't allowed to access the debug descriptor. + */ + if (ret < 0 && errno != EPIPE) { + if (verblevel > 1 || errno != EAGAIN) + perror("can't get debug descriptor"); + } + + /* some high speed devices are also "USB2 debug devices", meaning + * you can use them with some EHCI implementations as another kind + * of system debug channel: like JTAG, RS232, or a console. + */ + if (ret != sizeof buf + || buf[0] != ret + || buf[1] != USB_DT_DEBUG) + return; + + printf("Debug descriptor:\n" + " bLength %4u\n" + " bDescriptorType %4u\n" + " bDebugInEndpoint 0x%02x\n" + " bDebugOutEndpoint 0x%02x\n", + buf[0], buf[1], + buf[2], buf[3]); +} + +static const unsigned char *find_otg(const unsigned char *buf, int buflen) +{ + if (!buf) + return 0; + while (buflen >= 3) { + if (buf[0] == 3 && buf[1] == USB_DT_OTG) + return buf; + if (buf[0] > buflen) + return 0; + buflen -= buf[0]; + buf += buf[0]; + } + return 0; +} + +static int do_otg(struct libusb_config_descriptor *config) +{ + unsigned i, k; + int j; + const unsigned char *desc; + + /* each config of an otg device has an OTG descriptor */ + desc = find_otg(config->extra, config->extra_length); + for (i = 0; !desc && i < config->bNumInterfaces; i++) { + const struct libusb_interface *intf; + + intf = &config->interface[i]; + for (j = 0; !desc && j < intf->num_altsetting; j++) { + const struct libusb_interface_descriptor *alt; + + alt = &intf->altsetting[j]; + desc = find_otg(alt->extra, alt->extra_length); + for (k = 0; !desc && k < alt->bNumEndpoints; k++) { + const struct libusb_endpoint_descriptor *ep; + + ep = &alt->endpoint[k]; + desc = find_otg(ep->extra, ep->extra_length); + } + } + } + if (!desc) + return 0; + + printf("OTG Descriptor:\n" + " bLength %3u\n" + " bDescriptorType %3u\n" + " bmAttributes 0x%02x\n" + "%s%s", + desc[0], desc[1], desc[2], + (desc[2] & 0x01) + ? " SRP (Session Request Protocol)\n" : "", + (desc[2] & 0x02) + ? " HNP (Host Negotiation Protocol)\n" : ""); + return 1; +} + +static void +dump_device_status(libusb_device_handle *fd, int otg, int super_speed) +{ + unsigned char status[8]; + int ret; + + ret = usb_control_msg(fd, LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD + | LIBUSB_RECIPIENT_DEVICE, + LIBUSB_REQUEST_GET_STATUS, + 0, 0, + status, 2, + CTRL_TIMEOUT); + if (ret < 0) { + fprintf(stderr, + "cannot read device status, %s (%d)\n", + strerror(errno), errno); + return; + } + + printf("Device Status: 0x%02x%02x\n", + status[1], status[0]); + if (status[0] & (1 << 0)) + printf(" Self Powered\n"); + else + printf(" (Bus Powered)\n"); + if (status[0] & (1 << 1)) + printf(" Remote Wakeup Enabled\n"); + if (super_speed) { + if (status[0] & (1 << 2)) + printf(" U1 Enabled\n"); + if (status[0] & (1 << 3)) + printf(" U2 Enabled\n"); + if (status[0] & (1 << 4)) + printf(" Latency Tolerance Messaging (LTM) Enabled\n"); + } + /* if both HOST and DEVICE support OTG */ + if (otg) { + if (status[0] & (1 << 3)) + printf(" HNP Enabled\n"); + if (status[0] & (1 << 4)) + printf(" HNP Capable\n"); + if (status[0] & (1 << 5)) + printf(" ALT port is HNP Capable\n"); + } + /* for high speed devices with debug descriptors */ + if (status[0] & (1 << 6)) + printf(" Debug Mode\n"); +} + +static void dump_usb2_device_capability_desc(unsigned char *buf) +{ + unsigned int wide; + + wide = buf[3] + (buf[4] << 8) + + (buf[5] << 16) + (buf[6] << 24); + printf(" USB 2.0 Extension Device Capability:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDevCapabilityType %5u\n" + " bmAttributes 0x%08x\n", + buf[0], buf[1], buf[2], wide); + if (!(wide & 0x02)) + printf(" (Missing must-be-set LPM bit!)\n"); + else if (!(wide & 0x04)) + printf(" HIRD Link Power Management (LPM)" + " Supported\n"); + else { + printf(" BESL Link Power Management (LPM)" + " Supported\n"); + if (wide & 0x08) + printf(" BESL value %5u us \n", wide & 0xf00); + if (wide & 0x10) + printf(" Deep BESL value %5u us \n", + wide & 0xf000); + } +} + +static void dump_ss_device_capability_desc(unsigned char *buf) +{ + if (buf[0] < 10) { + fprintf(stderr, " Bad SuperSpeed USB Device Capability descriptor.\n"); + return; + } + printf(" SuperSpeed USB Device Capability:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDevCapabilityType %5u\n" + " bmAttributes 0x%02x\n", + buf[0], buf[1], buf[2], buf[3]); + if (buf[3] & 0x02) + printf(" Latency Tolerance Messages (LTM)" + " Supported\n"); + printf(" wSpeedsSupported 0x%02x%02x\n", buf[5], buf[4]); + if (buf[4] & (1 << 0)) + printf(" Device can operate at Low Speed (1Mbps)\n"); + if (buf[4] & (1 << 1)) + printf(" Device can operate at Full Speed (12Mbps)\n"); + if (buf[4] & (1 << 2)) + printf(" Device can operate at High Speed (480Mbps)\n"); + if (buf[4] & (1 << 3)) + printf(" Device can operate at SuperSpeed (5Gbps)\n"); + + printf(" bFunctionalitySupport %3u\n", buf[6]); + switch(buf[6]) { + case 0: + printf(" Lowest fully-functional device speed is " + "Low Speed (1Mbps)\n"); + break; + case 1: + printf(" Lowest fully-functional device speed is " + "Full Speed (12Mbps)\n"); + break; + case 2: + printf(" Lowest fully-functional device speed is " + "High Speed (480Mbps)\n"); + break; + case 3: + printf(" Lowest fully-functional device speed is " + "SuperSpeed (5Gbps)\n"); + break; + default: + printf(" Lowest fully-functional device speed is " + "at an unknown speed!\n"); + break; + } + printf(" bU1DevExitLat %4u micro seconds\n", buf[7]); + printf(" bU2DevExitLat %8u micro seconds\n", buf[8] + (buf[9] << 8)); +} + +static void dump_ssp_device_capability_desc(unsigned char *buf) +{ + int i; + unsigned int bm_attr, ss_attr; + char bitrate_prefix[] = " KMG"; + + if (buf[0] < 12) { + fprintf(stderr, " Bad SuperSpeedPlus USB Device Capability descriptor.\n"); + return; + } + + bm_attr = convert_le_u32(buf + 4); + printf(" SuperSpeedPlus USB Device Capability:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDevCapabilityType %5u\n" + " bmAttributes 0x%08x\n", + buf[0], buf[1], buf[2], bm_attr); + + printf(" Sublink Speed Attribute count %u\n", (buf[4] & 0x1f)+1); + printf(" Sublink Speed ID count %u\n", ((bm_attr >> 5) & 0xf)+1); + printf(" wFunctionalitySupport 0x%02x%02x\n", buf[9], buf[8]); + printf(" Min functional Speed Attribute ID: %u\n", buf[8] & 0x0f); + printf(" Min functional RX lanes: %u\n", buf[9] & 0x0f); + printf(" Min functional TX lanes: %u\n", (buf[9] >> 4) & 0x0f); + + for (i = 0; i <= (buf[4] & 0x1f); i++) { + ss_attr = convert_le_u32(buf + 12 + (i * 4)); + printf(" bmSublinkSpeedAttr[%u] 0x%08x\n", i, ss_attr); + printf(" Speed Attribute ID: %u %u%cb/s %s %s SuperSpeed%s\n", + ss_attr & 0x0f, + ss_attr >> 16, + (bitrate_prefix[((ss_attr >> 4) & 0x3)]), + (ss_attr & 0x40)? "Asymmetric" : "Symmetric", + (ss_attr & 0x80)? "TX" : "RX", + (ss_attr & 0x4000)? "Plus": "" ); + } +} + +static void dump_container_id_device_capability_desc(unsigned char *buf) +{ + if (buf[0] < 20) { + fprintf(stderr, " Bad Container ID Device Capability descriptor.\n"); + return; + } + printf(" Container ID Device Capability:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDevCapabilityType %5u\n" + " bReserved %5u\n", + buf[0], buf[1], buf[2], buf[3]); + printf(" ContainerID %s\n", + get_guid(&buf[4])); +} + +static char *get_webusb_url(libusb_device_handle *fd, uint8_t vendor_req, uint8_t id) +{ + unsigned char url_buf[255]; + char *scheme; + char *url, *chr; + unsigned char i; + int ret; + + ret = usb_control_msg(fd, + LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE | LIBUSB_REQUEST_TYPE_VENDOR, + vendor_req, id, WEBUSB_GET_URL, + url_buf, sizeof(url_buf), CTRL_TIMEOUT); + if (ret <= 0) + return strdup(""); + else if (url_buf[0] <= 3 || url_buf[1] != USB_DT_WEBUSB_URL || ret != url_buf[0]) + return strdup(""); + + switch (url_buf[2]) { + case 0: + scheme = "http://"; + break; + case 1: + scheme = "https://"; + break; + case 255: + scheme = ""; + break; + default: + fprintf(stderr, "Bad URL scheme.\n"); + return strdup(""); + } + url = malloc(strlen(scheme) + (url_buf[0] - 3) + 1); + if (!url) + return strdup(""); + strcpy(url, scheme); + chr = url + strlen(scheme); + for (i = 3; i < url_buf[0]; i++) + /* crude UTF-8 to ASCII conversion */ + if (url_buf[i] < 0x80) + *chr++ = url_buf[i]; + *chr = '\0'; + + return url; +} + +static void dump_platform_device_capability_desc(libusb_device_handle *fd, unsigned char *buf) +{ + unsigned char desc_len = buf[0]; + unsigned char cap_data_len = desc_len - 20; + unsigned char i; + const char *guid; + if (desc_len < 20) { + fprintf(stderr, " Bad Platform Device Capability descriptor.\n"); + return; + } + printf(" Platform Device Capability:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDevCapabilityType %5u\n" + " bReserved %5u\n", + buf[0], buf[1], buf[2], buf[3]); + guid = get_guid(&buf[4]); + printf(" PlatformCapabilityUUID %s\n", guid); + + if (!strcmp(WEBUSB_GUID , guid) && desc_len == 24) { + /* WebUSB platform descriptor */ + char *url = get_webusb_url(fd, buf[22], buf[23]); + printf(" WebUSB:\n" + " bcdVersion %2x.%02x\n" + " bVendorCode %5u\n" + " iLandingPage %5u %s\n", + buf[21], buf[20], buf[22], buf[23], url); + free(url); + return; + } + + for (i = 0; i < cap_data_len; i++) { + printf(" CapabilityData[%u] 0x%02x\n", i, buf[20 + i]); + } +} + +static void dump_billboard_device_capability_desc(libusb_device_handle *dev, unsigned char *buf) +{ + char *url, *alt_mode_str; + int w_vconn_power, alt_mode, i, svid, state; + const char *vconn; + unsigned char *bmConfigured; + + if (buf[0] < 48) { + fprintf(stderr, " Bad Billboard Capability descriptor.\n"); + return; + } + + if (buf[4] > BILLBOARD_MAX_NUM_ALT_MODE) { + fprintf(stderr, " Invalid value for bNumberOfAlternateModes.\n"); + return; + } + + if (buf[0] < (44 + buf[4] * 4)) { + fprintf(stderr, " bLength does not match with bNumberOfAlternateModes.\n"); + return; + } + + url = get_dev_string(dev, buf[3]); + w_vconn_power = convert_le_u16(buf+6); + if (w_vconn_power & (1 << 15)) { + vconn = "VCONN power not required"; + } else if (w_vconn_power < 7) { + vconn = vconn_power[w_vconn_power & 0x7]; + } else { + vconn = "reserved"; + } + printf(" Billboard Capability:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDevCapabilityType %5u\n" + " iAdditionalInfoURL %5u %s\n" + " bNumberOfAlternateModes %5u\n" + " bPreferredAlternateMode %5u\n" + " VCONN Power %5u %s\n", + buf[0], buf[1], buf[2], + buf[3], url, + buf[4], buf[5], + w_vconn_power, vconn); + + bmConfigured = &buf[8]; + + printf(" bmConfigured "); + dump_bytes(bmConfigured, 32); + + printf( + " bcdVersion %2x.%02x\n" + " bAdditionalFailureInfo %5u\n" + " bReserved %5u\n", + (buf[41] == 0) ? 1 : buf[41], buf[40], + buf[42], buf[43]); + + printf(" Alternate Modes supported by Device Container:\n"); + i = 44; /* Alternate mode 0 starts at index 44 */ + for (alt_mode = 0; alt_mode < buf[4]; alt_mode++) { + svid = convert_le_u16(buf+i); + alt_mode_str = get_dev_string(dev, buf[i+3]); + state = ((bmConfigured[alt_mode >> 2]) >> ((alt_mode & 0x3) << 1)) & 0x3; + printf( + " Alternate Mode %d : %s\n" + " wSVID[%d] 0x%04X\n" + " bAlternateMode[%d] %5u\n" + " iAlternateModeString[%d] %5u %s\n", + alt_mode, alt_mode_state[state], + alt_mode, svid, + alt_mode, buf[i+2], + alt_mode, buf[i+3], alt_mode_str); + free(alt_mode_str); + i += 4; + } + + free (url); +} + +static void dump_billboard_alt_mode_capability_desc(unsigned char *buf) +{ + if (buf[0] != 8) { + fprintf(stderr, " Bad Billboard Alternate Mode Capability descriptor.\n"); + return; + } + + printf(" Billboard Alternate Mode Capability:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " bDevCapabilityType %5u\n" + " bIndex %5u\n" + " dwAlternateModeVdo 0x%02X%02X%02X%02X\n", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], buf[6], buf[7]); +} + +static void dump_bos_descriptor(libusb_device_handle *fd, bool* has_ssp) +{ + /* Total length of BOS descriptors varies. + * Read first static 5 bytes which include the total length before + * allocating and reading the full BOS + */ + + unsigned char bos_desc_static[5]; + unsigned char *bos_desc; + unsigned int bos_desc_size; + int size, ret; + unsigned char *buf; + + /* Get the first 5 bytes to get the wTotalLength field */ + ret = usb_control_msg(fd, + LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE, + LIBUSB_REQUEST_GET_DESCRIPTOR, + USB_DT_BOS << 8, 0, + bos_desc_static, 5, CTRL_TIMEOUT); + if (ret <= 0) + return; + else if (bos_desc_static[0] != 5 || bos_desc_static[1] != USB_DT_BOS) + return; + + bos_desc_size = bos_desc_static[2] + (bos_desc_static[3] << 8); + printf("Binary Object Store Descriptor:\n" + " bLength %5u\n" + " bDescriptorType %5u\n" + " wTotalLength 0x%04x\n" + " bNumDeviceCaps %5u\n", + bos_desc_static[0], bos_desc_static[1], + bos_desc_size, bos_desc_static[4]); + + if (bos_desc_size <= 5) { + if (bos_desc_static[4] > 0) + fprintf(stderr, "Couldn't get " + "device capability descriptors\n"); + return; + } + bos_desc = malloc(bos_desc_size); + if (!bos_desc) + return; + memset(bos_desc, 0, bos_desc_size); + + ret = usb_control_msg(fd, + LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE, + LIBUSB_REQUEST_GET_DESCRIPTOR, + USB_DT_BOS << 8, 0, + bos_desc, bos_desc_size, CTRL_TIMEOUT); + if (ret < 0) { + fprintf(stderr, "Couldn't get device capability descriptors\n"); + goto out; + } + + size = bos_desc_size - 5; + buf = &bos_desc[5]; + + while (size >= 3) { + if (buf[0] < 3) { + printf("buf[0] = %u\n", buf[0]); + goto out; + } + switch (buf[2]) { + case USB_DC_WIRELESS_USB: + /* FIXME */ + break; + case USB_DC_20_EXTENSION: + dump_usb2_device_capability_desc(buf); + break; + case USB_DC_SUPERSPEED: + dump_ss_device_capability_desc(buf); + break; + case USB_DC_SUPERSPEEDPLUS: + dump_ssp_device_capability_desc(buf); + *has_ssp = true; + break; + case USB_DC_CONTAINER_ID: + dump_container_id_device_capability_desc(buf); + break; + case USB_DC_PLATFORM: + dump_platform_device_capability_desc(fd, buf); + break; + case USB_DC_BILLBOARD: + dump_billboard_device_capability_desc(fd, buf); + break; + case USB_DC_BILLBOARD_ALT_MODE: + dump_billboard_alt_mode_capability_desc(buf); + break; + case USB_DC_CONFIGURATION_SUMMARY: + printf(" Configuration Summary Device Capability:\n"); + desc_dump(fd, desc_usb3_dc_configuration_summary, + buf, DESC_BUF_LEN_FROM_BUF, 2); + break; + default: + printf(" ** UNRECOGNIZED: "); + dump_bytes(buf, buf[0]); + break; + } + size -= buf[0]; + buf += buf[0]; + } +out: + free(bos_desc); +} + +static void dumpdev(libusb_device *dev) +{ + libusb_device_handle *udev; + struct libusb_device_descriptor desc; + int i, ret; + int otg; + bool has_ssp = false; + + otg = 0; + ret = libusb_open(dev, &udev); + if (ret) { + fprintf(stderr, "Couldn't open device, some information " + "will be missing\n"); + udev = NULL; + } + + libusb_get_device_descriptor(dev, &desc); + dump_device(dev, &desc); + if (desc.bNumConfigurations) { + struct libusb_config_descriptor *config; + + ret = libusb_get_config_descriptor(dev, 0, &config); + if (ret) { + fprintf(stderr, "Couldn't get configuration descriptor 0, " + "some information will be missing\n"); + } else { + otg = do_otg(config) || otg; + libusb_free_config_descriptor(config); + } + + for (i = 0; i < desc.bNumConfigurations; ++i) { + ret = libusb_get_config_descriptor(dev, i, &config); + if (ret) { + fprintf(stderr, "Couldn't get configuration " + "descriptor %d, some information will " + "be missing\n", i); + } else { + dump_config(udev, config, desc.bcdUSB); + libusb_free_config_descriptor(config); + } + } + } + if (!udev) + return; + + if (desc.bcdUSB >= 0x0201) + dump_bos_descriptor(udev, &has_ssp); + if (desc.bDeviceClass == LIBUSB_CLASS_HUB) + do_hub(udev, desc.bDeviceProtocol, desc.bcdUSB, has_ssp); + if (desc.bcdUSB == 0x0200) { + do_dualspeed(udev); + } + do_debug(udev); + dump_device_status(udev, otg, desc.bcdUSB >= 0x0300); + libusb_close(udev); +} + +/* ---------------------------------------------------------------------- */ + +static int dump_one_device(libusb_context *ctx, const char *path) +{ + libusb_device *dev; + struct libusb_device_descriptor desc; + char vendor[128], product[128]; + + dev = get_usb_device(ctx, path); + if (!dev) { + fprintf(stderr, "Cannot open %s\n", path); + return 1; + } + libusb_get_device_descriptor(dev, &desc); + get_vendor_product_with_fallback(vendor, sizeof(vendor), + product, sizeof(product), dev); + printf("Device: ID %04x:%04x %s %s\n", desc.idVendor, + desc.idProduct, + vendor, + product); + dumpdev(dev); + return 0; +} + +static void sort_device_list(libusb_device **list, ssize_t num_devs) +{ + struct libusb_device *dev, *dev_next; + int bnum, bnum_next, dnum, dnum_next; + ssize_t i; + int sorted; + sorted = 0; + do { + sorted = 1; + for (i = 0; i < num_devs - 1; ++i) { + dev = list[i]; + dev_next = list[i + 1]; + bnum = libusb_get_bus_number(dev); + dnum = libusb_get_device_address(dev); + bnum_next = libusb_get_bus_number(dev_next); + dnum_next = libusb_get_device_address(dev_next); + if ((bnum == bnum_next && dnum > dnum_next) || bnum > bnum_next) { + list[i] = dev_next; + list[i + 1] = dev; + sorted = 0; + } + } + } while(!sorted); +} + +static int list_devices(libusb_context *ctx, int busnum, int devnum, int vendorid, int productid) +{ + libusb_device **list; + struct libusb_device_descriptor desc; + char vendor[128], product[128]; + int status; + ssize_t num_devs, i; + + status = 1; /* 1 device not found, 0 device found */ + + num_devs = libusb_get_device_list(ctx, &list); + if (num_devs < 0) + goto error; + + sort_device_list(list, num_devs); + for (i = 0; i < num_devs; ++i) { + libusb_device *dev = list[i]; + uint8_t bnum = libusb_get_bus_number(dev); + uint8_t dnum = libusb_get_device_address(dev); + + if ((busnum != -1 && busnum != bnum) || + (devnum != -1 && devnum != dnum)) + continue; + libusb_get_device_descriptor(dev, &desc); + if ((vendorid != -1 && vendorid != desc.idVendor) || + (productid != -1 && productid != desc.idProduct)) + continue; + status = 0; + + get_vendor_product_with_fallback(vendor, sizeof(vendor), + product, sizeof(product), dev); + + if (verblevel > 0) + printf("\n"); + printf("Bus %03u Device %03u: ID %04x:%04x %s %s\n", + bnum, dnum, + desc.idVendor, + desc.idProduct, + vendor, product); + if (verblevel > 0) + dumpdev(dev); + } + + libusb_free_device_list(list, 0); +error: + return status; +} + + +/* ---------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + static const struct option long_options[] = { + { "version", 0, 0, 'V' }, + { "verbose", 0, 0, 'v' }, + { "help", 0, 0, 'h' }, + { "tree", 0, 0, 't' }, + { 0, 0, 0, 0 } + }; + libusb_context *ctx; + int c, err = 0; + unsigned int treemode = 0; + int bus = -1, devnum = -1, vendor = -1, product = -1; + const char *devdump = NULL; + int help = 0; + char *cp; + int status; + + setlocale(LC_CTYPE, ""); + + while ((c = getopt_long(argc, argv, "D:vtP:p:s:d:Vh", + long_options, NULL)) != EOF) { + switch (c) { + case 'V': + printf("lsusb (" PACKAGE ") " VERSION "\n"); + return EXIT_SUCCESS; + case 'v': + verblevel++; + break; + + case 'h': + help=1; + break; + + case 't': + treemode = 1; + break; + + case 's': + cp = strchr(optarg, ':'); + if (cp) { + *cp++ = 0; + if (*optarg) + bus = strtoul(optarg, NULL, 10); + if (*cp) + devnum = strtoul(cp, NULL, 10); + } else { + if (*optarg) + devnum = strtoul(optarg, NULL, 10); + } + break; + + case 'd': + cp = strchr(optarg, ':'); + if (!cp) { + err++; + break; + } + *cp++ = 0; + if (*optarg) + vendor = strtoul(optarg, NULL, 16); + if (*cp) + product = strtoul(cp, NULL, 16); + break; + + case 'D': + devdump = optarg; + break; + + case '?': + default: + err++; + break; + } + } + if (err || argc > optind || help) { + fprintf(stderr, "Usage: lsusb [options]...\n" + "List USB devices\n" + " -v, --verbose\n" + " Increase verbosity (show descriptors)\n" + " -s [[bus]:][devnum]\n" + " Show only devices with specified device and/or\n" + " bus numbers (in decimal)\n" + " -d vendor:[product]\n" + " Show only devices with the specified vendor and\n" + " product ID numbers (in hexadecimal)\n" + " -D device\n" + " Selects which device lsusb will examine\n" + " -t, --tree\n" + " Dump the physical USB device hierarchy as a tree\n" + " -V, --version\n" + " Show version of program\n" + " -h, --help\n" + " Show usage and help\n" + ); + if (help && !err) + return 0; + else + return EXIT_FAILURE; + } + + + /* by default, print names as well as numbers */ + if (names_init() < 0) + fprintf(stderr, "unable to initialize usb spec"); + + status = 0; + + if (treemode) { + status = lsusb_t(); + names_exit(); + return status; + } + + err = libusb_init(&ctx); + if (err) { + fprintf(stderr, "unable to initialize libusb: %i\n", err); + return EXIT_FAILURE; + } + + if (devdump) + status = dump_one_device(ctx, devdump); + else + status = list_devices(ctx, bus, devnum, vendor, product); + + names_exit(); + libusb_exit(ctx); + return status; +} @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Copyright 2011 (c) Greg Kroah-Hartman <gregkh@suse.de> */ +#ifndef _LSUSB_H +#define _LSUSB_H + +extern int lsusb_t(void); +extern unsigned int verblevel; + +#endif diff --git a/lsusb.py.in b/lsusb.py.in new file mode 100755 index 0000000..592e5cf --- /dev/null +++ b/lsusb.py.in @@ -0,0 +1,560 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only +# +# lsusb-VERSION.py +# +# Displays your USB devices in reasonable form. +# +# Copyright (c) 2009 Kurt Garloff <garloff@suse.de> +# Copyright (c) 2013,2018 Kurt Garloff <kurt@garloff.de> +# +# Usage: See usage() + +# Py2 compat +from __future__ import print_function +import getopt +import os +import re +import sys + +HUB_ICLASS = 0x09 + +# Global options +showint = False +showhubint = False +noemptyhub = False +nohub = False +showeps = False +showwakeup = False + +prefix = "/sys/bus/usb/devices/" +usbids = [ + "@usbids@", + "/usr/share/hwdata/usb.ids", + "/usr/share/usb.ids", +] +cols = ("", "", "", "", "", "") + +norm = "\033[0;0m" +bold = "\033[0;1m" +red = "\033[0;31m" +green = "\033[0;32m" +amber = "\033[0;33m" +blue = "\033[0;34m" + +usbvendors = {} +usbproducts = {} +usbclasses = {} + +def colorize(num, text): + return cols[num] + str(text) + cols[0] + +def ishexdigit(str): + "return True if all digits are valid hex digits" + for dg in str: + if not dg.isdigit() and not dg in 'abcdef': + return False + return True + +def open_read_ign(fn): + try: + return open(fn, 'r', errors='ignore') + except: + return open(fn, 'r') + +def myenum(*args): + enums = dict(zip(args, range(len(args)))) + return type('MyEnum', (), enums) + +def parse_usb_ids(): + "Parse /usr/share/usb.ids and fill usbvendors, usbproducts, usbclasses" + vid = 0 + did = 0 + modes = myenum('Vendor', 'Class', 'Misc') + mode = modes.Vendor + strg = "" + cstrg = "" + for unm in usbids: + if os.path.exists(unm): + break + for ln in open_read_ign(unm).readlines(): + if ln[0] == '#': + continue + ln = ln.rstrip('\n') + if len(ln) == 0: + continue + if ishexdigit(ln[0:4]): + mode = modes.Vendor + vid = int(ln[:4], 16) + usbvendors[vid] = ln[6:] + continue + if ln[0] == '\t' and ishexdigit(ln[1:3]): + # usb.ids has a device id of 01xy, sigh + if ln[3:5] == "xy": + did = int(ln[1:3], 16)*256 + else: + did = int(ln[1:5], 16) + # USB devices + if mode == modes.Vendor: + usbproducts[vid, did] = ln[7:] + continue + elif mode == modes.Class: + nm = ln[5:] + if nm != "Unused": + strg = cstrg + ":" + nm + else: + strg = cstrg + ":" + usbclasses[vid, did, -1] = strg + continue + if ln[0] == 'C': + mode = modes.Class + cid = int(ln[2:4], 16) + cstrg = ln[6:] + usbclasses[cid, -1, -1] = cstrg + continue + if mode == modes.Class and ln[0] == '\t' and ln[1] == '\t' and ishexdigit(ln[2:4]): + prid = int(ln[2:4], 16) + usbclasses[cid, did, prid] = ln[6:] + continue + mode = modes.Misc + usbclasses[0xFF, 0xFF, 0xFF] = "Vendor Specific" + +def find_usb_prod(vid, pid): + "Return device name from USB Vendor:Product list" + strg = "" + vendor = usbvendors.get(vid) + if vendor: + strg = str(vendor) + else: + return "" + product = usbproducts.get((vid, pid)) + if product: + return strg + " " + str(product) + return strg + +def find_usb_class(cid, sid, pid): + "Return USB protocol from usbclasses list" + lnlst = len(usbclasses) + cls = usbclasses.get((cid, sid, pid)) \ + or usbclasses.get((cid, sid, -1)) \ + or usbclasses.get((cid, -1, -1)) + if cls: + return str(cls) + return "" + + +devlst = [ + 'host', # usb-storage + 'video4linux/video', # uvcvideo et al. + 'sound/card', # snd-usb-audio + 'net/', # cdc_ether, ... + 'input/input', # usbhid + 'usb:hiddev', # usb hid + 'bluetooth/hci', # btusb + 'ttyUSB', # btusb + 'tty/', # cdc_acm + 'usb:lp', # usblp + #'usb/lp', # usblp + 'usb/', # hiddev, usblp + #'usbhid', # hidraw +] + +def find_storage(hostno): + "Return SCSI block dev names for host" + res = "" + for ent in os.listdir("/sys/class/scsi_device/"): + (host, bus, tgt, lun) = ent.split(":") + if host == hostno: + try: + for ent2 in os.listdir("/sys/class/scsi_device/%s/device/block" % ent): + res += ent2 + " " + except: + pass + return res + +def add_drv(path, drvnm): + res = "" + try: + for e2 in os.listdir(path+"/"+drvnm): + if e2[0:len(drvnm)] == drvnm: + res += e2 + " " + try: + if res: + res += "(" + os.path.basename(os.readlink(path+"/driver")) + ") " + except: + pass + except: + pass + return res + +def find_dev(driver, usbname): + "Return pseudo devname that's driven by driver" + res = "" + for nm in devlst: + dirnm = prefix + usbname + prep = "" + idx = nm.find('/') + if idx != -1: + prep = nm[:idx+1] + dirnm += "/" + nm[:idx] + nm = nm[idx+1:] + ln = len(nm) + try: + for ent in os.listdir(dirnm): + if ent[:ln] == nm: + res += prep+ent+" " + if nm == "host": + res += "(" + find_storage(ent[ln:])[:-1] + ")" + except: + pass + if driver == "usbhid": + rg = re.compile(r'[0-9A-F]{4}:[0-9A-F]{4}:[0-9A-F]{4}\.[0-9A-F]{4}') + for ent in os.listdir(prefix + usbname): + m = rg.match(ent) + if m: + res += add_drv(prefix+usbname+"/"+ent, "hidraw") + add = add_drv(prefix+usbname+"/"+ent, "input") + if add: + res += add + else: + for ent2 in os.listdir(prefix+usbname+"/"+ent): + m = rg.match(ent2) + if m: + res += add_drv(prefix+usbname+"/"+ent+"/"+ent2, "input") + return res + + +class UsbObject: + def read_attr(self, name): + path = prefix + self.path + "/" + name + return open(path).readline().strip() + + def read_link(self, name): + path = prefix + self.path + "/" + name + return os.path.basename(os.readlink(path)) + +class UsbEndpoint(UsbObject): + "Container for USB endpoint info" + def __init__(self, parent, fname, level): + self.parent = parent + self.level = level + self.fname = fname + self.path = "" + self.epaddr = 0 + self.len = 0 + self.ival = "" + self.type = "" + self.attr = 0 + self.max = 0 + if self.fname: + self.read(self.fname) + + def read(self, fname): + self.fname = fname + self.path = self.parent.path + "/" + fname + self.epaddr = int(self.read_attr("bEndpointAddress"), 16) + ival = int(self.read_attr("bInterval"), 16) + if ival: + self.ival = " (%s)" % self.read_attr("interval") + self.len = int(self.read_attr("bLength"), 16) + self.type = self.read_attr("type") + self.attr = int(self.read_attr("bmAttributes"), 16) + self.max = int(self.read_attr("wMaxPacketSize"), 16) + + def __repr__(self): + return "<UsbEndpoint[%r]>" % self.fname + + def __str__(self): + indent = " " * self.level + #name = "%s/ep_%02X" % (self.parent.fname, self.epaddr) + name = "" + body = "(EP) %02x: %s%s attr %02x len %02x max %03x" % \ + (self.epaddr, self.type, self.ival, self.attr, self.len, self.max) + body = colorize(5, body) + return "%-17s %s\n" % (indent + name, indent + body) + + +class UsbInterface(UsbObject): + "Container for USB interface info" + def __init__(self, parent, fname, level=1): + self.parent = parent + self.level = level + self.fname = fname + self.path = "" + self.iclass = 0 + self.isclass = 0 + self.iproto = 0 + self.noep = 0 + self.driver = "" + self.devname = "" + self.protoname = "" + self.eps = [] + if self.fname: + self.read(self.fname) + + def read(self, fname): + self.fname = fname + self.path = self.parent.path + "/" + fname + self.iclass = int(self.read_attr("bInterfaceClass"),16) + self.isclass = int(self.read_attr("bInterfaceSubClass"),16) + self.iproto = int(self.read_attr("bInterfaceProtocol"),16) + self.noep = int(self.read_attr("bNumEndpoints")) + try: + self.driver = self.read_link("driver") + self.devname = find_dev(self.driver, self.path) + except: + pass + self.protoname = find_usb_class(self.iclass, self.isclass, self.iproto) + if showeps: + for dirent in os.listdir(prefix + self.path): + if dirent.startswith("ep_"): + ep = UsbEndpoint(self, dirent, self.level+1) + self.eps.append(ep) + + def __repr__(self): + return "<UsbInterface[%r]>" % self.fname + + def __str__(self): + indent = " " * self.level + name = self.fname + plural = (" " if self.noep == 1 else "s") + body = "(IF) %02x:%02x:%02x %iEP%s (%s) %s %s" % \ + (self.iclass, self.isclass, self.iproto, self.noep, plural, + self.protoname, colorize(3, self.driver), colorize(4, self.devname)) + strg = "%-17s %s\n" % (indent + name, indent + body) + if showeps and self.eps: + for ep in self.eps: + strg += str(ep) + return strg + +class UsbDevice(UsbObject): + "Container for USB device info" + def __init__(self, parent, fname, level=0): + self.parent = parent + self.level = level + self.fname = fname + self.path = "" + self.iclass = 0 + self.isclass = 0 + self.iproto = 0 + self.vid = 0 + self.pid = 0 + self.name = "" + self.usbver = "" + self.speed = "" + self.maxpower = "" + self.wakeup = "" + self.noports = 0 + self.nointerfaces = 0 + self.driver = "" + self.devname = "" + self.interfaces = [] + self.children = [] + if self.fname: + self.read(self.fname) + self.readchildren() + + def read(self, fname): + self.fname = fname + self.path = fname + self.iclass = int(self.read_attr("bDeviceClass"), 16) + self.isclass = int(self.read_attr("bDeviceSubClass"), 16) + self.iproto = int(self.read_attr("bDeviceProtocol"), 16) + self.vid = int(self.read_attr("idVendor"), 16) + self.pid = int(self.read_attr("idProduct"), 16) + try: + self.name = self.read_attr("manufacturer") + " " \ + + self.read_attr("product") + except: + pass + if self.name: + mch = re.match(r"Linux [^ ]* (.hci[_-]hcd) .HCI Host Controller", self.name) + if mch: + self.name = mch.group(1) + if not self.name: + self.name = find_usb_prod(self.vid, self.pid) + # Some USB Card readers have a better name then Generic ... + if self.name.startswith("Generic"): + oldnm = self.name + self.name = find_usb_prod(self.vid, self.pid) + if not self.name: + self.name = oldnm + try: + ser = self.read_attr("serial") + # Some USB devs report "serial" as serial no. suppress + if (ser and ser != "serial"): + self.name += " " + ser + except: + pass + self.usbver = self.read_attr("version") + self.speed = self.read_attr("speed") + self.maxpower = self.read_attr("bMaxPower") + self.noports = int(self.read_attr("maxchild")) + try: + self.nointerfaces = int(self.read_attr("bNumInterfaces")) + except: + self.nointerfaces = 0 + try: + self.driver = self.read_link("driver") + self.devname = find_dev(self.driver, self.path) + except: + pass + if showwakeup: + try: + self.wakeup = self.read_attr('power/wakeup') + except: + self.wakeup = "unsupported" + + def readchildren(self): + if self.fname[0:3] == "usb": + fname = self.fname[3:] + else: + fname = self.fname + for dirent in os.listdir(prefix + self.fname): + if not dirent[0:1].isdigit(): + continue + if os.access(prefix + dirent + "/bInterfaceClass", os.R_OK): + iface = UsbInterface(self, dirent, self.level+1) + self.interfaces.append(iface) + else: + usbdev = UsbDevice(self, dirent, self.level+1) + self.children.append(usbdev) + usbsortkey = lambda obj: [int(x) for x in re.split(r"[-:.]", obj.fname)] + self.interfaces.sort(key=usbsortkey) + self.children.sort(key=usbsortkey) + + def __repr__(self): + return "<UsbDevice[%r]>" % self.fname + + def __str__(self): + is_hub = (self.iclass == HUB_ICLASS) + if is_hub: + if noemptyhub and len(self.children) == 0: + return "" + strg = "" + if not (nohub and is_hub): + indent = " " * self.level + name = self.fname + plural = (" " if self.nointerfaces == 1 else "s") + body = "%s %02x %iIF%s [USB %s, %5s Mbps, %5s%s] (%s)%s" % \ + (colorize(1, "%04x:%04x" % (self.vid, self.pid)), + self.iclass, self.nointerfaces, plural, + self.usbver.strip(), self.speed, self.maxpower, + ("" if self.wakeup == "" else (", power wakeup: %s" % self.wakeup)), + colorize(2 if is_hub else 1, self.name), + colorize(2, " hub") if is_hub else "") + strg = "%-17s %s\n" % (indent + name, indent + body) + if not (is_hub and not showhubint): + if showeps: + ep = UsbEndpoint(self, "ep_00", self.level+1) + strg += str(ep) + if showint: + for iface in self.interfaces: + strg += str(iface) + for child in self.children: + strg += str(child) + return strg + + +def usage(): + "Displays usage information" + print("Usage: lsusb.py [options]") + print() + print("Options:") + print(" -h, --help display this help") + print(" -i, --interfaces display interface information") + print(" -I, --hub-interfaces display interface information, even for hubs") + print(" -u, --hide-empty-hubs suppress empty hubs") + print(" -U, --hide-hubs suppress all hubs") + print(" -c, --color use colors") + print(" -C, --no-color disable colors") + print(" -e, --endpoints display endpoint info") + print(" -f FILE, --usbids-path FILE") + print(" override filename for /usr/share/usb.ids") + print(" -w, --wakeup display power wakeup setting") + print() + print("Use lsusb.py -ciu to get a nice overview of your USB devices.") + +def read_usb(): + "Read toplevel USB entries and print" + root_hubs = [] + for dirent in os.listdir(prefix): + if not dirent[0:3] == "usb": + continue + usbdev = UsbDevice(None, dirent, 0) + root_hubs.append(usbdev) + root_hubs.sort(key=lambda x: int(x.fname[3:])) + for usbdev in root_hubs: + print(usbdev, end="") + +def main(argv): + "main entry point" + global showint, showhubint, noemptyhub, nohub + global cols, usbids, showeps, showwakeup + usecols = None + + long_options = [ + "help", + "interfaces", + "hub-interfaces", + "hide-empty-hubs", + "hide-hubs", + "color", + "no-color", + "usbids-path=", + "endpoints", + "wakeup", + ] + + try: + (optlist, args) = getopt.gnu_getopt(argv[1:], "hiIuUwcCef:", long_options) + except getopt.GetoptError as exc: + print("Error:", exc, file=sys.stderr) + sys.exit(2) + for opt in optlist: + if opt[0] in {"-h", "--help"}: + usage() + sys.exit(0) + elif opt[0] in {"-i", "--interfaces"}: + showint = True + elif opt[0] in {"-I", "--hub-interfaces"}: + showint = True + showhubint = True + elif opt[0] in {"-u", "--hide-empty-hubs"}: + noemptyhub = True + elif opt[0] in {"-U", "--hide-hubs"}: + noemptyhub = True + nohub = True + elif opt[0] in {"-c", "--color"}: + usecols = True + elif opt[0] in {"-C", "--no-color"}: + usecols = False + elif opt[0] in {"-f", "--usbids-path"}: + usbids = [opt[1]] + elif opt[0] in {"-e", "--endpoints"}: + showeps = True + elif opt[0] in {"-w", "--wakeup"}: + showwakeup = True + if len(args) > 0: + print("Error: excess args %s ..." % args[0], file=sys.stderr) + sys.exit(2) + + if usecols is None: + usecols = sys.stdout.isatty() and os.environ.get("TERM", "dumb") != "dumb" + + if usecols: + cols = (norm, bold, red, green, amber, blue) + + if usbids[0]: + try: + parse_usb_ids() + except: + print(" WARNING: Failure to read usb.ids", file=sys.stderr) + #print(sys.exc_info(), file=sys.stderr) + read_usb() + +# Entry point +if __name__ == "__main__": + main(sys.argv) + + @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1996-2021 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 <https://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=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://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 'autom4te' 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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: @@ -0,0 +1,465 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * USB name database manipulation routines + * + * Copyright (C) 1999, 2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * Copyright (C) 2013 Tom Gundersen (teg@jklm.no) + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdint.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <dirent.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> +#include <ctype.h> +#include <stdbool.h> + +#include <libusb.h> +#include <libudev.h> + +#include "usb-spec.h" +#include "names.h" +#include "sysfs.h" + + +#define HASH1 0x10 +#define HASH2 0x02 +#define HASHSZ 512 + +static unsigned int hashnum(unsigned int num) +{ + unsigned int mask1 = (unsigned int)HASH1 << 27, mask2 = (unsigned int)HASH2 << 27; + + for (; mask1 >= HASH1; mask1 >>= 1, mask2 >>= 1) + if (num & mask1) + num ^= mask2; + return num & (HASHSZ-1); +} + +/* ---------------------------------------------------------------------- */ + +static struct udev *udev = NULL; +static struct udev_hwdb *hwdb = NULL; +static struct audioterminal *audioterminals_hash[HASHSZ] = { NULL, }; +static struct videoterminal *videoterminals_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *hiddescriptors_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *reports_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *huts_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *biass_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *physdess_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *hutus_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *langids_hash[HASHSZ] = { NULL, }; +static struct genericstrtable *countrycodes_hash[HASHSZ] = { NULL, }; + +/* ---------------------------------------------------------------------- */ + +static const char *names_genericstrtable(struct genericstrtable *t[HASHSZ], + unsigned int idx) +{ + struct genericstrtable *h; + + for (h = t[hashnum(idx)]; h; h = h->next) + if (h->num == idx) + return h->name; + return NULL; +} + +const char *names_hid(uint8_t hidd) +{ + return names_genericstrtable(hiddescriptors_hash, hidd); +} + +const char *names_reporttag(uint8_t rt) +{ + return names_genericstrtable(reports_hash, rt); +} + +const char *names_huts(unsigned int data) +{ + return names_genericstrtable(huts_hash, data); +} + +const char *names_hutus(unsigned int data) +{ + return names_genericstrtable(hutus_hash, data); +} + +const char *names_langid(uint16_t langid) +{ + return names_genericstrtable(langids_hash, langid); +} + +const char *names_physdes(uint8_t ph) +{ + return names_genericstrtable(physdess_hash, ph); +} + +const char *names_bias(uint8_t b) +{ + return names_genericstrtable(biass_hash, b); +} + +const char *names_countrycode(unsigned int countrycode) +{ + return names_genericstrtable(countrycodes_hash, countrycode); +} + +static const char *hwdb_get(const char *modalias, const char *key) +{ + struct udev_list_entry *entry; + + udev_list_entry_foreach(entry, udev_hwdb_get_properties_list_entry(hwdb, modalias, 0)) + if (strcmp(udev_list_entry_get_name(entry), key) == 0) + return udev_list_entry_get_value(entry); + + return NULL; +} + +const char *names_vendor(uint16_t vendorid) +{ + char modalias[64]; + + sprintf(modalias, "usb:v%04X*", vendorid); + return hwdb_get(modalias, "ID_VENDOR_FROM_DATABASE"); +} + +const char *names_product(uint16_t vendorid, uint16_t productid) +{ + char modalias[64]; + + sprintf(modalias, "usb:v%04Xp%04X*", vendorid, productid); + return hwdb_get(modalias, "ID_MODEL_FROM_DATABASE"); +} + +const char *names_class(uint8_t classid) +{ + char modalias[64]; + + sprintf(modalias, "usb:v*p*d*dc%02X*", classid); + return hwdb_get(modalias, "ID_USB_CLASS_FROM_DATABASE"); +} + +const char *names_subclass(uint8_t classid, uint8_t subclassid) +{ + char modalias[64]; + + sprintf(modalias, "usb:v*p*d*dc%02Xdsc%02X*", classid, subclassid); + return hwdb_get(modalias, "ID_USB_SUBCLASS_FROM_DATABASE"); +} + +const char *names_protocol(uint8_t classid, uint8_t subclassid, uint8_t protocolid) +{ + char modalias[64]; + + sprintf(modalias, "usb:v*p*d*dc%02Xdsc%02Xdp%02X*", classid, subclassid, protocolid); + return hwdb_get(modalias, "ID_USB_PROTOCOL_FROM_DATABASE"); +} + +const char *names_audioterminal(uint16_t termt) +{ + struct audioterminal *at; + + at = audioterminals_hash[hashnum(termt)]; + for (; at; at = at->next) + if (at->termt == termt) + return at->name; + return NULL; +} + +const char *names_videoterminal(uint16_t termt) +{ + struct videoterminal *vt; + + vt = videoterminals_hash[hashnum(termt)]; + for (; vt; vt = vt->next) + if (vt->termt == termt) + return vt->name; + return NULL; +} + +/* ---------------------------------------------------------------------- */ + +int get_vendor_string(char *buf, size_t size, uint16_t vid) +{ + const char *cp; + + if (size < 1) + return 0; + *buf = 0; + if (!(cp = names_vendor(vid))) + return 0; + return snprintf(buf, size, "%s", cp); +} + +int get_product_string(char *buf, size_t size, uint16_t vid, uint16_t pid) +{ + const char *cp; + + if (size < 1) + return 0; + *buf = 0; + if (!(cp = names_product(vid, pid))) + return 0; + return snprintf(buf, size, "%s", cp); +} + +int get_class_string(char *buf, size_t size, uint8_t cls) +{ + const char *cp; + + if (size < 1) + return 0; + *buf = 0; + if (!(cp = names_class(cls))) + return snprintf(buf, size, "[unknown]"); + return snprintf(buf, size, "%s", cp); +} + +int get_subclass_string(char *buf, size_t size, uint8_t cls, uint8_t subcls) +{ + const char *cp; + + if (size < 1) + return 0; + *buf = 0; + if (!(cp = names_subclass(cls, subcls))) + return snprintf(buf, size, "[unknown]"); + return snprintf(buf, size, "%s", cp); +} + +/* + * Attempt to get friendly vendor and product names from the udev hwdb. If + * either or both are not present, instead populate those from the device's + * own string descriptors. + */ +void get_vendor_product_with_fallback(char *vendor, int vendor_len, + char *product, int product_len, + libusb_device *dev) +{ + struct libusb_device_descriptor desc; + char sysfs_name[PATH_MAX]; + bool have_vendor, have_product; + + libusb_get_device_descriptor(dev, &desc); + + /* set to "[unknown]" by default unless something below finds a string */ + strncpy(vendor, "[unknown]", vendor_len); + strncpy(product, "[unknown]", product_len); + + have_vendor = !!get_vendor_string(vendor, vendor_len, desc.idVendor); + have_product = !!get_product_string(product, product_len, + desc.idVendor, desc.idProduct); + + if (have_vendor && have_product) + return; + + if (get_sysfs_name(sysfs_name, sizeof(sysfs_name), dev) >= 0) { + if (!have_vendor) + read_sysfs_prop(vendor, vendor_len, sysfs_name, "manufacturer"); + if (!have_product) + read_sysfs_prop(product, product_len, sysfs_name, "product"); + } +} + +/* ---------------------------------------------------------------------- */ + +static int hash_audioterminal(struct audioterminal *at) +{ + struct audioterminal *at_old; + unsigned int h = hashnum(at->termt); + + for (at_old = audioterminals_hash[h]; at_old; at_old = at_old->next) + if (at_old->termt == at->termt) + return -1; + at->next = audioterminals_hash[h]; + audioterminals_hash[h] = at; + return 0; +} + +static int hash_audioterminals(void) +{ + int r = 0, i, k; + + for (i = 0; audioterminals[i].name; i++) + { + k = hash_audioterminal(&audioterminals[i]); + if (k < 0) + r = k; + } + + return r; +} + +static int hash_videoterminal(struct videoterminal *vt) +{ + struct videoterminal *vt_old; + unsigned int h = hashnum(vt->termt); + + for (vt_old = videoterminals_hash[h]; vt_old; vt_old = vt_old->next) + if (vt_old->termt == vt->termt) + return -1; + vt->next = videoterminals_hash[h]; + videoterminals_hash[h] = vt; + return 0; +} + +static int hash_videoterminals(void) +{ + int r = 0, i, k; + + for (i = 0; videoterminals[i].name; i++) + { + k = hash_videoterminal(&videoterminals[i]); + if (k < 0) + r = k; + } + + return r; +} + +static int hash_genericstrtable(struct genericstrtable *t[HASHSZ], + struct genericstrtable *g) +{ + struct genericstrtable *g_old; + unsigned int h = hashnum(g->num); + + for (g_old = t[h]; g_old; g_old = g_old->next) + if (g_old->num == g->num) + return -1; + g->next = t[h]; + t[h] = g; + return 0; +} + +#define HASH_EACH(array, hash) \ + for (i = 0; array[i].name; i++) { \ + k = hash_genericstrtable(hash, &array[i]); \ + if (k < 0) { \ + r = k; \ + }\ + } + +static int hash_tables(void) +{ + int r = 0, k, i; + + k = hash_audioterminals(); + if (k < 0) + r = k; + + k = hash_videoterminals(); + if (k < 0) + r = k; + + HASH_EACH(hiddescriptors, hiddescriptors_hash); + + HASH_EACH(reports, reports_hash); + + HASH_EACH(huts, huts_hash); + + HASH_EACH(hutus, hutus_hash); + + HASH_EACH(langids, langids_hash); + + HASH_EACH(physdess, physdess_hash); + + HASH_EACH(biass, biass_hash); + + HASH_EACH(countrycodes, countrycodes_hash); + + return r; +} + +/* ---------------------------------------------------------------------- */ + +/* +static void print_tables(void) +{ + int i; + struct audioterminal *at; + struct videoterminal *vt; + struct genericstrtable *li; + struct genericstrtable *hu; + + + printf("--------------------------------------------\n"); + printf("\t\t Audio Terminals\n"); + printf("--------------------------------------------\n"); + + for (i = 0; i < HASHSZ; i++) { + printf("hash: %d\n", i); + at = audioterminals_hash[i]; + for (; at; at = at->next) + printf("\tentry: %s\n", at->name); + } + + printf("--------------------------------------------\n"); + printf("\t\t Video Terminals\n"); + printf("--------------------------------------------\n"); + + for (i = 0; i < HASHSZ; i++) { + printf("hash: %d\n", i); + vt = videoterminals_hash[i]; + for (; vt; vt = vt->next) + printf("\tentry: %s\n", vt->name); + } + + printf("--------------------------------------------\n"); + printf("\t\t Languages\n"); + printf("--------------------------------------------\n"); + + for (i = 0; i < HASHSZ; i++) { + li = langids_hash[i]; + if (li) + printf("hash: %d\n", i); + for (; li; li = li->next) + printf("\tid: %x, entry: %s\n", li->num, li->name); + } + + printf("--------------------------------------------\n"); + printf("\t\t Conutry Codes\n"); + printf("--------------------------------------------\n"); + + for (i = 0; i < HASHSZ; i++) { + hu = countrycodes_hash[i]; + if (hu) + printf("hash: %d\n", i); + for (; hu; hu = hu->next) + printf("\tid: %x, entry: %s\n", hu->num, hu->name); + } + + printf("--------------------------------------------\n"); +} +*/ + +int names_init(void) +{ + int r; + + udev = udev_new(); + if (!udev) + r = -1; + else { + hwdb = udev_hwdb_new(udev); + if (!hwdb) + r = -1; + } + + r = hash_tables(); + + return r; +} + +void names_exit(void) +{ + hwdb = udev_hwdb_unref(hwdb); + udev = udev_unref(udev); +} @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * USB name database manipulation routines + * + * Copyright (C) 1999, 2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + */ + +#ifndef _NAMES_H +#define _NAMES_H + +/* ---------------------------------------------------------------------- */ + +extern const char *names_vendor(uint16_t vendorid); +extern const char *names_product(uint16_t vendorid, uint16_t productid); +extern const char *names_class(uint8_t classid); +extern const char *names_subclass(uint8_t classid, uint8_t subclassid); +extern const char *names_protocol(uint8_t classid, uint8_t subclassid, + uint8_t protocolid); +extern const char *names_audioterminal(uint16_t termt); +extern const char *names_videoterminal(uint16_t termt); +extern const char *names_hid(uint8_t hidd); +extern const char *names_reporttag(uint8_t rt); +extern const char *names_huts(unsigned int data); +extern const char *names_hutus(unsigned int data); +extern const char *names_langid(uint16_t langid); +extern const char *names_physdes(uint8_t ph); +extern const char *names_bias(uint8_t b); +extern const char *names_countrycode(unsigned int countrycode); + +extern int get_vendor_string(char *buf, size_t size, uint16_t vid); +extern int get_product_string(char *buf, size_t size, uint16_t vid, uint16_t pid); +extern int get_class_string(char *buf, size_t size, uint8_t cls); +extern int get_subclass_string(char *buf, size_t size, uint8_t cls, uint8_t subcls); +extern void get_vendor_product_with_fallback(char *vendor, int vendor_len, + char *product, int product_len, + libusb_device *dev); + +extern int names_init(void); +extern void names_exit(void); + +/* ---------------------------------------------------------------------- */ +#endif /* _NAMES_H */ @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Helpers for querying USB properties from sysfs + * + * Copied from name.c which is: + * Copyright (C) 1999, 2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * Copyright (C) 2013 Tom Gundersen (teg@jklm.no) + */ + +#include <stdint.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdio.h> +#include <linux/limits.h> + +#include <libusb.h> + +#include "sysfs.h" + +/* + * The documentation of libusb_get_port_numbers() says "As per the USB 3.0 + * specs, the current maximum limit for the depth is 7." + */ +#define USB_MAX_DEPTH 7 + +#define SYSFS_DEV_ATTR_PATH "/sys/bus/usb/devices/%s/%s" + +int get_sysfs_name(char *buf, size_t size, libusb_device *dev) +{ + int len = 0; + uint8_t bnum = libusb_get_bus_number(dev); + uint8_t pnums[USB_MAX_DEPTH]; + int num_pnums; + + buf[0] = '\0'; + + num_pnums = libusb_get_port_numbers(dev, pnums, sizeof(pnums)); + if (num_pnums == LIBUSB_ERROR_OVERFLOW) { + return -1; + } else if (num_pnums == 0) { + /* Special-case root devices */ + return snprintf(buf, size, "usb%d", bnum); + } + + len += snprintf(buf, size, "%d-", bnum); + for (int i = 0; i < num_pnums; i++) + len += snprintf(buf + len, size - len, i ? ".%d" : "%d", pnums[i]); + + return len; +} + +int read_sysfs_prop(char *buf, size_t size, char *sysfs_name, char *propname) +{ + int n, fd; + char path[PATH_MAX]; + + buf[0] = '\0'; + snprintf(path, sizeof(path), SYSFS_DEV_ATTR_PATH, sysfs_name, propname); + fd = open(path, O_RDONLY); + + if (fd == -1) + return 0; + + n = read(fd, buf, size); + + if (n > 0) + buf[n-1] = '\0'; // Turn newline into null terminator + + close(fd); + return n; +} @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Helpers for querying USB properties from sysfs + * + * Copyright (C) 1999, 2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + */ + +#ifndef _SYSFS_H +#define _SYSFS_H +/* ---------------------------------------------------------------------- */ + +int get_sysfs_name(char *buf, size_t size, libusb_device *dev); +extern int read_sysfs_prop(char *buf, size_t size, char *sysfs_name, char *propname); + +/* ---------------------------------------------------------------------- */ +#endif /* _SYSFS_H */ diff --git a/usb-devices b/usb-devices new file mode 100755 index 0000000..f5763da --- /dev/null +++ b/usb-devices @@ -0,0 +1,198 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (c) 2009 Greg Kroah-Hartman <greg@kroah.com> +# Copyright (c) 2009 Randy Dunlap <rdunlap@xenotime.net> +# Copyright (c) 2009 Frans Pop <elendil@planet.nl> +# +# When checking with shellcheck ignore +# "In POSIX sh, local is undefined." +# every modern shell supports it. +# shellcheck disable=SC3043 + +print_string() { + file=$1 + name=$2 + if [ -f "$file" ]; then + echo "S: $name=$(cat "$file")" + fi +} + +class_decode() { + class=$1 # v4: in hex + + case $class in + "00") echo ">ifc " ;; + "01") echo "audio" ;; + "02") echo "commc" ;; + "03") echo "HID " ;; + "05") echo "PID " ;; + "06") echo "still" ;; + "07") echo "print" ;; + "08") echo "stor." ;; + "09") echo "hub " ;; + "0a") echo "data " ;; + "0b") echo "scard" ;; + "0d") echo "c-sec" ;; + "0e") echo "video" ;; + "0f") echo "perhc" ;; + "10") echo "av " ;; + "11") echo "blbrd" ;; + "12") echo "bridg" ;; + "dc") echo "diagd" ;; + "e0") echo "wlcon" ;; + "ef") echo "misc " ;; + "fe") echo "app. " ;; + "ff") echo "vend." ;; + "*") echo "unk. " ;; + esac +} + +print_endpoint() { + eppath=$1 + + read -r addr < "$eppath/bEndpointAddress" + read -r attr < "$eppath/bmAttributes" + read -r dir < "$eppath/direction" + + if [ "$dir" = "in" ]; then + dir="I" + elif [ "$dir" = "out" ]; then + dir="O" + elif [ "$dir" = "both" ]; then + dir="B" + fi + + read -r eptype < "$eppath/type" + if [ "$eptype" = Control ]; then + eptype="Ctrl" + elif [ "$eptype" = Interrupt ]; then + eptype="Int." + fi + + read -r maxps_hex < "$eppath/wMaxPacketSize" + maxps_hex="0x$maxps_hex" + # Extract MaxPS size (bits 0-10) and multiplicity values (bits 11-12) + + maxps=$(($(printf "%4i*%s\n" $((maxps_hex & 0x7ff)) \ + $((1 + ((maxps_hex >> 11) & 0x3)))))) + + read -r interval < "$eppath/interval" + + printf "E: Ad=%s(%s) Atr=%s(%s) MxPS=%4s Ivl=%s\n" \ + "$addr" "$dir" "$attr" "$eptype" "$maxps" "$interval" +} + +print_interface() { + ifpath=$1 + + read -r ifnum < "$ifpath/bInterfaceNumber" + read -r altset < "$ifpath/bAlternateSetting" + read -r numeps < "$ifpath/bNumEndpoints" + read -r class < "$ifpath/bInterfaceClass" + read -r subclass < "$ifpath/bInterfaceSubClass" + read -r protocol < "$ifpath/bInterfaceProtocol" + + if [ -L "$ifpath/driver" ]; then # v4: allow for no driver + driver=$(readlink "$ifpath/driver") + driver=${driver##*/} + else + driver="(none)" + fi + classname=$(class_decode "$class") + printf "I: If#=%2i Alt=%2i #EPs=%2i Cls=%s(%s) Sub=%s Prot=%s Driver=%s\n" \ + "0x${ifnum#0}" "${altset#0}" "0x${numeps#0}" "$class" "$classname" "$subclass" \ + "$protocol" "$driver" + + for endpoint in "$ifpath"/ep_?? + do + if [ -L "$endpoint" ] || [ -d "$endpoint" ]; then # v4: verify endpoint exists + print_endpoint "$endpoint" + fi + done +} + +print_device() { + local devpath=$1 + local parent=$2 + local level=$3 + local count=$4 + + [ -d "$devpath" ] || return + cd "$devpath" || return + + read -r busnum < "busnum" + read -r devnum < "devnum" + + if [ "$level" -gt 0 ]; then + port=$((${devpath##*[-.]} - 1)) + else + port=0 + fi + + read -r speed < "speed" + read -r maxchild < "maxchild" + printf "\nT: Bus=%02i Lev=%02i Prnt=%02i Port=%02i Cnt=%02i Dev#=%3i Spd=%-4s MxCh=%2i\n" \ + "$busnum" "$level" "$parent" "$port" "$count" "$devnum" "$speed" "$maxchild" + + read -r ver < "version" + read -r devclass < "bDeviceClass" + read -r devsubclass < "bDeviceSubClass" + read -r devprotocol < "bDeviceProtocol" + read -r maxps0 < "bMaxPacketSize0" + read -r numconfigs < "bNumConfigurations" + classname="$(class_decode "$devclass")" + printf "D: Ver=%5s Cls=%s(%s) Sub=%s Prot=%s MxPS=%2i #Cfgs=%3i\n" \ + "$ver" "$devclass" "$classname" "$devsubclass" "$devprotocol" \ + "$maxps0" "$numconfigs" + + read -r vendid < "idVendor" + read -r prodid < "idProduct" + read -r bcddevice < "bcdDevice" + revmajor="${bcddevice%%??}" + revminor="${bcddevice##??}" + printf "P: Vendor=%s ProdID=%s Rev=%s.%s\n" \ + "$vendid" "$prodid" "$revmajor" "$revminor" + + print_string manufacturer "Manufacturer" + print_string product Product + print_string serial SerialNumber + + read -r numifs < "bNumInterfaces" + read -r cfgnum < "bConfigurationValue" + read -r attr < "bmAttributes" + read -r maxpower < "bMaxPower" + printf "C: #Ifs=%2i Cfg#=%2i Atr=%s MxPwr=%s\n" \ + "$numifs" "$cfgnum" "$attr" "$maxpower" + + # There's not really any useful info in endpoint 00 + #print_endpoint $devpath/ep_00 + + for interface in "$busnum"-*:?.* + do + print_interface "$devpath/$interface" + done + + devcount=0 + for subdev in "$busnum"-* + do + echo "$subdev" | grep -Eq "^$busnum-[0-9]+(\.[0-9]+)*$" \ + || continue + + devcount=$((devcount + 1)) + if [ -d "$devpath/$subdev" ]; then + print_device "$devpath/$subdev" \ + "$devnum" "$((level +1))" "$devcount" + fi + done +} + +if [ ! -d /sys/bus ]; then + echo "Error: directory /sys/bus does not exist; is sysfs mounted?" >&2 + exit 1 +fi + +for device in $(find /sys/bus/usb/devices -name 'usb*' -printf '%f\n' | sort -V) +do + print_device "/sys/bus/usb/devices/$device" 0 0 0 +done diff --git a/usb-devices.1.in b/usb-devices.1.in new file mode 100644 index 0000000..3667dd9 --- /dev/null +++ b/usb-devices.1.in @@ -0,0 +1,55 @@ +.\" SPDX-License-Identifier: GPL-2.0-only +.\" Copyright (c) 2004 Greg Kroah-Hartman <greg@kroah.com> +.\" Copyright (c) 2004 Randy Dunlap <rdunlap@xenotime.net> +.\" Copyright (c) 2004 Frans Pop <elendil@planet.nl> +.TH usb-devices 1 "23 June 2009" "usbutils-VERSION" "Linux USB Utilities" +.IX usb-devices +.SH NAME +usb-devices \- print USB device details +.SH SYNOPSIS +.B usb-devices + +.SH DESCRIPTION +.B usb-devices +is a shell script that can be used to display details of USB +buses in the system and the devices connected to them. + +The output of the script is similar to the \fIusb/devices\fP file +available either under \fI/proc/bus\fP (if usbfs is mounted), or under +\fI/sys/kernel/debug\fP (if debugfs is mounted there). The script is +primarily intended to be used if the file is not available. + +In contrast to the \fIusb/devices\fP file, this script only lists +\fIactive\fP interfaces (those marked with a "*" in the \fIusb/devices\fP +file) and their endpoints. + +Be advised that there can be differences in the way information is sorted, +as well as in the format of the output. + +.SH RETURN VALUE +If sysfs is not mounted, a non-zero exit code is returned. + +.SH FILES +.TP +.B /sys/bus/usb/devices/usb* +The part of the sysfs tree the script walks through to assemble the +printed information. +.TP +.B /proc/bus/usb/devices +Location where the \fIusb/devices\fP file can normally be found for +Linux kernels before 2.6.31, if usbfs is mounted. +.TP +.B /sys/kernel/debug/usb/devices +Location where the \fIusb/devices\fP file can normally be found for +Linux kernel 2.6.31 and later, if debugfs is mounted. + +.SH SEE ALSO +.BR lsusb (8), +.BR usbview (8). + +.SH AUTHORS +Greg Kroah-Hartman <greg@kroah.com> +.P +Randy Dunlap <rdunlap@xenotime.net> +.P +Frans Pop <elendil@planet.nl> diff --git a/usb-spec.h b/usb-spec.h new file mode 100644 index 0000000..1fab4a7 --- /dev/null +++ b/usb-spec.h @@ -0,0 +1,1600 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * USB specification data + * + * Copyright (C) 2013 Tom Gundersen <teg@jklm.no> + */ + +#ifndef _USB_SPEC_H +#define _USB_SPEC_H + +/* ---------------------------------------------------------------------- */ + +struct audioterminal { + struct audioterminal *next; + const uint16_t termt; + const char *name; +}; + +struct videoterminal { + struct videoterminal *next; + const uint16_t termt; + const char *name; +}; + +struct genericstrtable { + struct genericstrtable *next; + const unsigned int num; + const char *name; +}; + +/* ---------------------------------------------------------------------- */ + +static struct audioterminal audioterminals[] = +{ + { NULL, 0x0100, "USB Undefined" }, + { NULL, 0x0101, "USB Streaming" }, + { NULL, 0x01ff, "USB Vendor Specific" }, + { NULL, 0x0200, "Input Undefined" }, + { NULL, 0x0201, "Microphone" }, + { NULL, 0x0202, "Desktop Microphone" }, + { NULL, 0x0203, "Personal Microphone" }, + { NULL, 0x0204, "Omni-directional Microphone" }, + { NULL, 0x0205, "Microphone Array" }, + { NULL, 0x0206, "Processing Microphone Array" }, + { NULL, 0x0300, "Output Undefined" }, + { NULL, 0x0301, "Speaker" }, + { NULL, 0x0302, "Headphones" }, + { NULL, 0x0303, "Head Mounted Display Audio" }, + { NULL, 0x0304, "Desktop Speaker" }, + { NULL, 0x0305, "Room Speaker" }, + { NULL, 0x0306, "Communication Speaker" }, + { NULL, 0x0307, "Low Frequency Effects Speaker" }, + { NULL, 0x0400, "Bidirectional Undefined" }, + { NULL, 0x0401, "Handset" }, + { NULL, 0x0402, "Headset" }, + { NULL, 0x0403, "Speakerphone, no echo reduction" }, + { NULL, 0x0404, "Echo-suppressing speakerphone" }, + { NULL, 0x0405, "Echo-canceling speakerphone" }, + { NULL, 0x0500, "Telephony Undefined" }, + { NULL, 0x0501, "Phone line" }, + { NULL, 0x0502, "Telephone" }, + { NULL, 0x0503, "Down Line Phone" }, + { NULL, 0x0600, "External Undefined" }, + { NULL, 0x0601, "Analog Connector" }, + { NULL, 0x0602, "Digital Audio Interface" }, + { NULL, 0x0603, "Line Connector" }, + { NULL, 0x0604, "Legacy Audio Connector" }, + { NULL, 0x0605, "SPDIF interface" }, + { NULL, 0x0606, "1394 DA stream" }, + { NULL, 0x0607, "1394 DV stream soundtrack" }, + { NULL, 0x0700, "Embedded Undefined" }, + { NULL, 0x0701, "Level Calibration Noise Source" }, + { NULL, 0x0702, "Equalization Noise" }, + { NULL, 0x0703, "CD Player" }, + { NULL, 0x0704, "DAT" }, + { NULL, 0x0705, "DCC" }, + { NULL, 0x0706, "MiniDisc" }, + { NULL, 0x0707, "Analog Tape" }, + { NULL, 0x0708, "Phonograph" }, + { NULL, 0x0709, "VCR Audio" }, + { NULL, 0x070a, "Video Disc Audio" }, + { NULL, 0x070b, "DVD Audio" }, + { NULL, 0x070c, "TV Tuner Audio" }, + { NULL, 0x070d, "Satellite Receiver Audio" }, + { NULL, 0x070e, "Cable Tuner Audio" }, + { NULL, 0x070f, "DSS Audio" }, + { NULL, 0x0710, "Radio Receiver" }, + { NULL, 0x0711, "Radio Transmitter" }, + { NULL, 0x0712, "Multitrack Recorder" }, + { NULL, 0x0713, "Synthesizer" }, + { NULL }, +}; + +static struct videoterminal videoterminals[] = +{ + { NULL, 0x0100, "USB Vendor Specific" }, + { NULL, 0x0101, "USB Streaming" }, + { NULL, 0x0200, "Input Vendor Specific" }, + { NULL, 0x0201, "Camera Sensor" }, + { NULL, 0x0202, "Sequential Media" }, + { NULL, 0x0300, "Output Vendor Specific" }, + { NULL, 0x0301, "Generic Display" }, + { NULL, 0x0302, "Sequential Media" }, + { NULL, 0x0400, "External Vendor Specific" }, + { NULL, 0x0401, "Composite Video" }, + { NULL, 0x0402, "S-Video" }, + { NULL, 0x0403, "Component Video" }, + { NULL }, +}; + +static struct genericstrtable hiddescriptors[] = +{ + { NULL, 0x21, "HID" }, + { NULL, 0x22, "Report" }, + { NULL, 0x23, "Physical" }, + { NULL }, +}; + +static struct genericstrtable reports[] = +{ + { NULL, 0x04, "Usage Page" }, + { NULL, 0x08, "Usage" }, + { NULL, 0x14, "Logical Minimum" }, + { NULL, 0x18, "Usage Minimum" }, + { NULL, 0x24, "Logical Maximum" }, + { NULL, 0x28, "Usage Maximum" }, + { NULL, 0x34, "Physical Minimum" }, + { NULL, 0x38, "Designator Index" }, + { NULL, 0x44, "Physical Maximum" }, + { NULL, 0x48, "Designator Minimum" }, + { NULL, 0x54, "Unit Exponent" }, + { NULL, 0x58, "Designator Maximum" }, + { NULL, 0x64, "Unit" }, + { NULL, 0x74, "Report Size" }, + { NULL, 0x78, "String Index" }, + { NULL, 0x80, "Input" }, + { NULL, 0x84, "Report ID" }, + { NULL, 0x88, "String Minimum" }, + { NULL, 0x90, "Output" }, + { NULL, 0x94, "Report Count" }, + { NULL, 0x98, "String Maximum" }, + { NULL, 0xa0, "Collection" }, + { NULL, 0xa4, "Push" }, + { NULL, 0xa8, "Delimiter" }, + { NULL, 0xb0, "Feature" }, + { NULL, 0xb4, "Pop" }, + { NULL, 0xc0, "End Collection" }, + { NULL }, +}; + +static struct genericstrtable huts[] = +{ + { NULL, 0x00, "Undefined" }, + { NULL, 0x01, "Generic Desktop Controls" }, + { NULL, 0x02, "Simulation Controls" }, + { NULL, 0x03, "VR Controls" }, + { NULL, 0x04, "Sport Controls" }, + { NULL, 0x05, "Game Controls" }, + { NULL, 0x07, "Keyboard" }, + { NULL, 0x08, "LEDs" }, + { NULL, 0x09, "Buttons" }, + { NULL, 0x0a, "Ordinal" }, + { NULL, 0x0b, "Telephony" }, + { NULL, 0x0c, "Consumer" }, + { NULL, 0x0d, "Digitizer" }, + { NULL, 0x0f, "PID Page" }, + { NULL, 0x10, "Unicode" }, + { NULL, 0x14, "Alphanumeric Display" }, + { NULL, 0x80, "USB Monitor" }, + { NULL, 0x81, "USB Monitor Enumerated Values" }, + { NULL, 0x82, "Monitor VESA Virtual Controls" }, + { NULL, 0x84, "Power Device Page" }, + { NULL, 0x85, "Battery System Page" }, + { NULL, 0x86, "Power Pages" }, + { NULL, 0x87, "Power Pages" }, + { NULL, 0x8c, "Bar Code Scanner Page (POS)" }, + { NULL, 0x8d, "Scale Page (POS)" }, + { NULL, 0x90, "Camera Control Page" }, + { NULL, 0x91, "Arcade Control Page" }, + { NULL, 0xf0, "Cash Device" }, + { NULL, 0xff, "Vendor Specific" }, + { NULL }, +}; + +static struct genericstrtable biass[] = +{ + { NULL, 0x0, "Not Applicable" }, + { NULL, 0x1, "Right Hand" }, + { NULL, 0x2, "Left Hand" }, + { NULL, 0x3, "Both Hands" }, + { NULL, 0x4, "Either Hand" }, + { NULL }, +}; + +static struct genericstrtable physdess[] = +{ + { NULL, 0x00, "None" }, + { NULL, 0x01, "Hand" }, + { NULL, 0x02, "Eyeball" }, + { NULL, 0x03, "Eyebrow" }, + { NULL, 0x04, "Eyelid" }, + { NULL, 0x05, "Ear" }, + { NULL, 0x06, "Nose" }, + { NULL, 0x07, "Mouth" }, + { NULL, 0x08, "Upper Lip" }, + { NULL, 0x09, "Lower Lip" }, + { NULL, 0x0a, "Jaw" }, + { NULL, 0x0b, "Neck" }, + { NULL, 0x0c, "Upper Arm" }, + { NULL, 0x0d, "Elbow" }, + { NULL, 0x0e, "Forearm" }, + { NULL, 0x0f, "Wrist" }, + { NULL, 0x10, "Palm" }, + { NULL, 0x11, "Thumb" }, + { NULL, 0x12, "Index Finger" }, + { NULL, 0x13, "Middle Finger" }, + { NULL, 0x14, "Ring Finger" }, + { NULL, 0x15, "Little Finger" }, + { NULL, 0x16, "Head" }, + { NULL, 0x17, "Shoulder" }, + { NULL, 0x18, "Hip" }, + { NULL, 0x19, "Waist" }, + { NULL, 0x1a, "Thigh" }, + { NULL, 0x1b, "Knee" }, + { NULL, 0x1c, "calf" }, + { NULL, 0x1d, "Ankle" }, + { NULL, 0x1e, "Foot" }, + { NULL, 0x1f, "Heel" }, + { NULL, 0x20, "Ball of Foot" }, + { NULL, 0x21, "Big Toe" }, + { NULL, 0x22, "Second Toe" }, + { NULL, 0x23, "Third Toe" }, + { NULL, 0x24, "Fourth Toe" }, + { NULL, 0x25, "Fifth Toe" }, + { NULL, 0x26, "Brow" }, + { NULL, 0x27, "Cheek" }, + { NULL }, +}; + +/* HUT usage specs are represented as: + * (huttype << 16) + hutus + */ +static struct genericstrtable hutus[] = +{ + { NULL, (0x01 << 16) + 0x000, "Undefined" }, + { NULL, (0x01 << 16) + 0x001, "Pointer" }, + { NULL, (0x01 << 16) + 0x002, "Mouse" }, + { NULL, (0x01 << 16) + 0x004, "Joystick" }, + { NULL, (0x01 << 16) + 0x005, "Gamepad" }, + { NULL, (0x01 << 16) + 0x006, "Keyboard" }, + { NULL, (0x01 << 16) + 0x007, "Keypad" }, + { NULL, (0x01 << 16) + 0x008, "Multi-Axis Controller" }, + { NULL, (0x01 << 16) + 0x030, "Direction-X" }, + { NULL, (0x01 << 16) + 0x031, "Direction-Y" }, + { NULL, (0x01 << 16) + 0x032, "Direction-Z" }, + { NULL, (0x01 << 16) + 0x033, "Rotate-X" }, + { NULL, (0x01 << 16) + 0x034, "Rotate-Y" }, + { NULL, (0x01 << 16) + 0x035, "Rotate-Z" }, + { NULL, (0x01 << 16) + 0x036, "Slider" }, + { NULL, (0x01 << 16) + 0x037, "Dial" }, + { NULL, (0x01 << 16) + 0x038, "Wheel" }, + { NULL, (0x01 << 16) + 0x039, "Hat Switch" }, + { NULL, (0x01 << 16) + 0x03a, "Counted Buffer" }, + { NULL, (0x01 << 16) + 0x03b, "Byte Count" }, + { NULL, (0x01 << 16) + 0x03c, "Motion Wakeup" }, + { NULL, (0x01 << 16) + 0x03d, "Start" }, + { NULL, (0x01 << 16) + 0x03e, "Select" }, + { NULL, (0x01 << 16) + 0x040, "Vector-X" }, + { NULL, (0x01 << 16) + 0x041, "Vector-Y" }, + { NULL, (0x01 << 16) + 0x042, "Vector-Z" }, + { NULL, (0x01 << 16) + 0x043, "Vector-X relative Body" }, + { NULL, (0x01 << 16) + 0x044, "Vector-Y relative Body" }, + { NULL, (0x01 << 16) + 0x045, "Vector-Z relative Body" }, + { NULL, (0x01 << 16) + 0x046, "Vector" }, + { NULL, (0x01 << 16) + 0x080, "System Control" }, + { NULL, (0x01 << 16) + 0x081, "System Power Down" }, + { NULL, (0x01 << 16) + 0x082, "System Sleep" }, + { NULL, (0x01 << 16) + 0x083, "System Wake Up" }, + { NULL, (0x01 << 16) + 0x084, "System Context Menu" }, + { NULL, (0x01 << 16) + 0x085, "System Main Menu" }, + { NULL, (0x01 << 16) + 0x086, "System App Menu" }, + { NULL, (0x01 << 16) + 0x087, "System Menu Help" }, + { NULL, (0x01 << 16) + 0x088, "System Menu Exit" }, + { NULL, (0x01 << 16) + 0x089, "System Menu Select" }, + { NULL, (0x01 << 16) + 0x08a, "System Menu Right" }, + { NULL, (0x01 << 16) + 0x08b, "System Menu Left" }, + { NULL, (0x01 << 16) + 0x08c, "System Menu Up" }, + { NULL, (0x01 << 16) + 0x08d, "System Menu Down" }, + { NULL, (0x01 << 16) + 0x090, "Direction Pad Up" }, + { NULL, (0x01 << 16) + 0x091, "Direction Pad Down" }, + { NULL, (0x01 << 16) + 0x092, "Direction Pad Right" }, + { NULL, (0x01 << 16) + 0x093, "Direction Pad Left" }, + { NULL, (0x02 << 16) + 0x000, "Undefined" }, + { NULL, (0x02 << 16) + 0x001, "Flight Simulation Device" }, + { NULL, (0x02 << 16) + 0x002, "Automobile Simulation Device" }, + { NULL, (0x02 << 16) + 0x003, "Tank Simulation Device" }, + { NULL, (0x02 << 16) + 0x004, "Spaceship Simulation Device" }, + { NULL, (0x02 << 16) + 0x005, "Submarine Simulation Device" }, + { NULL, (0x02 << 16) + 0x006, "Sailing Simulation Device" }, + { NULL, (0x02 << 16) + 0x007, "Motorcycle Simulation Device" }, + { NULL, (0x02 << 16) + 0x008, "Sports Simulation Device" }, + { NULL, (0x02 << 16) + 0x009, "Airplane Simualtion Device" }, + { NULL, (0x02 << 16) + 0x00a, "Helicopter Simulation Device" }, + { NULL, (0x02 << 16) + 0x00b, "Magic Carpet Simulation Device" }, + { NULL, (0x02 << 16) + 0x00c, "Bicycle Simulation Device" }, + { NULL, (0x02 << 16) + 0x020, "Flight Control Stick" }, + { NULL, (0x02 << 16) + 0x021, "Flight Stick" }, + { NULL, (0x02 << 16) + 0x022, "Cyclic Control" }, + { NULL, (0x02 << 16) + 0x023, "Cyclic Trim" }, + { NULL, (0x02 << 16) + 0x024, "Flight Yoke" }, + { NULL, (0x02 << 16) + 0x025, "Track Control" }, + { NULL, (0x02 << 16) + 0x0b0, "Aileron" }, + { NULL, (0x02 << 16) + 0x0b1, "Aileron Trim" }, + { NULL, (0x02 << 16) + 0x0b2, "Anti-Torque Control" }, + { NULL, (0x02 << 16) + 0x0b3, "Autopilot Enable" }, + { NULL, (0x02 << 16) + 0x0b4, "Chaff Release" }, + { NULL, (0x02 << 16) + 0x0b5, "Collective Control" }, + { NULL, (0x02 << 16) + 0x0b6, "Dive Break" }, + { NULL, (0x02 << 16) + 0x0b7, "Electronic Countermeasures" }, + { NULL, (0x02 << 16) + 0x0b8, "Elevator" }, + { NULL, (0x02 << 16) + 0x0b9, "Elevator Trim" }, + { NULL, (0x02 << 16) + 0x0ba, "Rudder" }, + { NULL, (0x02 << 16) + 0x0bb, "Throttle" }, + { NULL, (0x02 << 16) + 0x0bc, "Flight COmmunications" }, + { NULL, (0x02 << 16) + 0x0bd, "Flare Release" }, + { NULL, (0x02 << 16) + 0x0be, "Landing Gear" }, + { NULL, (0x02 << 16) + 0x0bf, "Toe Break" }, + { NULL, (0x02 << 16) + 0x0c0, "Trigger" }, + { NULL, (0x02 << 16) + 0x0c1, "Weapon Arm" }, + { NULL, (0x02 << 16) + 0x0c2, "Weapons Select" }, + { NULL, (0x02 << 16) + 0x0c3, "Wing Flaps" }, + { NULL, (0x02 << 16) + 0x0c4, "Accelerator" }, + { NULL, (0x02 << 16) + 0x0c5, "Brake" }, + { NULL, (0x02 << 16) + 0x0c6, "Clutch" }, + { NULL, (0x02 << 16) + 0x0c7, "Shifter" }, + { NULL, (0x02 << 16) + 0x0c8, "Steering" }, + { NULL, (0x02 << 16) + 0x0c9, "Turret Direction" }, + { NULL, (0x02 << 16) + 0x0ca, "Barrel Elevation" }, + { NULL, (0x02 << 16) + 0x0cb, "Drive Plane" }, + { NULL, (0x02 << 16) + 0x0cc, "Ballast" }, + { NULL, (0x02 << 16) + 0x0cd, "Bicylce Crank" }, + { NULL, (0x02 << 16) + 0x0ce, "Handle Bars" }, + { NULL, (0x02 << 16) + 0x0cf, "Front Brake" }, + { NULL, (0x02 << 16) + 0x0d0, "Rear Brake" }, + { NULL, (0x03 << 16) + 0x000, "Unidentified" }, + { NULL, (0x03 << 16) + 0x001, "Belt" }, + { NULL, (0x03 << 16) + 0x002, "Body Suit" }, + { NULL, (0x03 << 16) + 0x003, "Flexor" }, + { NULL, (0x03 << 16) + 0x004, "Glove" }, + { NULL, (0x03 << 16) + 0x005, "Head Tracker" }, + { NULL, (0x03 << 16) + 0x006, "Head Mounted Display" }, + { NULL, (0x03 << 16) + 0x007, "Hand Tracker" }, + { NULL, (0x03 << 16) + 0x008, "Oculometer" }, + { NULL, (0x03 << 16) + 0x009, "Vest" }, + { NULL, (0x03 << 16) + 0x00a, "Animatronic Device" }, + { NULL, (0x03 << 16) + 0x020, "Stereo Enable" }, + { NULL, (0x03 << 16) + 0x021, "Display Enable" }, + { NULL, (0x04 << 16) + 0x000, "Unidentified" }, + { NULL, (0x04 << 16) + 0x001, "Baseball Bat" }, + { NULL, (0x04 << 16) + 0x002, "Golf Club" }, + { NULL, (0x04 << 16) + 0x003, "Rowing Machine" }, + { NULL, (0x04 << 16) + 0x004, "Treadmill" }, + { NULL, (0x04 << 16) + 0x030, "Oar" }, + { NULL, (0x04 << 16) + 0x031, "Slope" }, + { NULL, (0x04 << 16) + 0x032, "Rate" }, + { NULL, (0x04 << 16) + 0x033, "Stick Speed" }, + { NULL, (0x04 << 16) + 0x034, "Stick Face Angle" }, + { NULL, (0x04 << 16) + 0x035, "Stick Heel/Toe" }, + { NULL, (0x04 << 16) + 0x036, "Stick Follow Through" }, + { NULL, (0x04 << 16) + 0x038, "Stick Type" }, + { NULL, (0x04 << 16) + 0x039, "Stick Height" }, + { NULL, (0x04 << 16) + 0x047, "Stick Temp" }, + { NULL, (0x04 << 16) + 0x050, "Putter" }, + { NULL, (0x04 << 16) + 0x051, "1 Iron" }, + { NULL, (0x04 << 16) + 0x052, "2 Iron" }, + { NULL, (0x04 << 16) + 0x053, "3 Iron" }, + { NULL, (0x04 << 16) + 0x054, "4 Iron" }, + { NULL, (0x04 << 16) + 0x055, "5 Iron" }, + { NULL, (0x04 << 16) + 0x056, "6 Iron" }, + { NULL, (0x04 << 16) + 0x057, "7 Iron" }, + { NULL, (0x04 << 16) + 0x058, "8 Iron" }, + { NULL, (0x04 << 16) + 0x059, "9 Iron" }, + { NULL, (0x04 << 16) + 0x05a, "10 Iron" }, + { NULL, (0x04 << 16) + 0x05b, "11 Iron" }, + { NULL, (0x04 << 16) + 0x05c, "Sand Wedge" }, + { NULL, (0x04 << 16) + 0x05d, "Loft Wedge" }, + { NULL, (0x04 << 16) + 0x05e, "Power Wedge" }, + { NULL, (0x04 << 16) + 0x05f, "1 Wood" }, + { NULL, (0x04 << 16) + 0x060, "3 Wood" }, + { NULL, (0x04 << 16) + 0x061, "5 Wood" }, + { NULL, (0x04 << 16) + 0x062, "7 Wood" }, + { NULL, (0x04 << 16) + 0x063, "9 Wood" }, + { NULL, (0x05 << 16) + 0x000, "Undefined" }, + { NULL, (0x05 << 16) + 0x001, "3D Game Controller" }, + { NULL, (0x05 << 16) + 0x002, "Pinball Device" }, + { NULL, (0x05 << 16) + 0x003, "Gun Device" }, + { NULL, (0x05 << 16) + 0x020, "Point Of View" }, + { NULL, (0x05 << 16) + 0x021, "Turn Right/Left" }, + { NULL, (0x05 << 16) + 0x022, "Pitch Right/Left" }, + { NULL, (0x05 << 16) + 0x023, "Roll Forward/Backward" }, + { NULL, (0x05 << 16) + 0x024, "Move Right/Left" }, + { NULL, (0x05 << 16) + 0x025, "Move Forward/Backward" }, + { NULL, (0x05 << 16) + 0x026, "Move Up/Down" }, + { NULL, (0x05 << 16) + 0x027, "Lean Right/Left" }, + { NULL, (0x05 << 16) + 0x028, "Lean Forward/Backward" }, + { NULL, (0x05 << 16) + 0x029, "Height of POV" }, + { NULL, (0x05 << 16) + 0x02a, "Flipper" }, + { NULL, (0x05 << 16) + 0x02b, "Secondary Flipper" }, + { NULL, (0x05 << 16) + 0x02c, "Bump" }, + { NULL, (0x05 << 16) + 0x02d, "New Game" }, + { NULL, (0x05 << 16) + 0x02e, "Shoot Ball" }, + { NULL, (0x05 << 16) + 0x02f, "Player" }, + { NULL, (0x05 << 16) + 0x030, "Gun Bolt" }, + { NULL, (0x05 << 16) + 0x031, "Gun Clip" }, + { NULL, (0x05 << 16) + 0x032, "Gun Selector" }, + { NULL, (0x05 << 16) + 0x033, "Gun Single Shot" }, + { NULL, (0x05 << 16) + 0x034, "Gun Burst" }, + { NULL, (0x05 << 16) + 0x035, "Gun Automatic" }, + { NULL, (0x05 << 16) + 0x036, "Gun Safety" }, + { NULL, (0x05 << 16) + 0x037, "Gamepad Fire/Jump" }, + { NULL, (0x05 << 16) + 0x038, "Gamepad Fun" }, + { NULL, (0x05 << 16) + 0x039, "Gamepad Trigger" }, + { NULL, (0x07 << 16) + 0x000, "No Event" }, + { NULL, (0x07 << 16) + 0x001, "Keyboard ErrorRollOver" }, + { NULL, (0x07 << 16) + 0x002, "Keyboard POSTfail" }, + { NULL, (0x07 << 16) + 0x003, "Keyboard Error Undefined" }, + { NULL, (0x07 << 16) + 0x004, "A" }, + { NULL, (0x07 << 16) + 0x005, "B" }, + { NULL, (0x07 << 16) + 0x006, "C" }, + { NULL, (0x07 << 16) + 0x007, "D" }, + { NULL, (0x07 << 16) + 0x008, "E" }, + { NULL, (0x07 << 16) + 0x009, "F" }, + { NULL, (0x07 << 16) + 0x00a, "G" }, + { NULL, (0x07 << 16) + 0x00b, "H" }, + { NULL, (0x07 << 16) + 0x00c, "I" }, + { NULL, (0x07 << 16) + 0x00d, "J" }, + { NULL, (0x07 << 16) + 0x00e, "K" }, + { NULL, (0x07 << 16) + 0x00f, "L" }, + { NULL, (0x07 << 16) + 0x010, "M" }, + { NULL, (0x07 << 16) + 0x011, "N" }, + { NULL, (0x07 << 16) + 0x012, "O" }, + { NULL, (0x07 << 16) + 0x013, "P" }, + { NULL, (0x07 << 16) + 0x014, "Q" }, + { NULL, (0x07 << 16) + 0x015, "R" }, + { NULL, (0x07 << 16) + 0x016, "S" }, + { NULL, (0x07 << 16) + 0x017, "T" }, + { NULL, (0x07 << 16) + 0x018, "U" }, + { NULL, (0x07 << 16) + 0x019, "V" }, + { NULL, (0x07 << 16) + 0x01a, "W" }, + { NULL, (0x07 << 16) + 0x01b, "X" }, + { NULL, (0x07 << 16) + 0x01c, "Y" }, + { NULL, (0x07 << 16) + 0x01d, "Z" }, + { NULL, (0x07 << 16) + 0x01e, "1 and ! (One and Exclamation)" }, + { NULL, (0x07 << 16) + 0x01f, "2 and @ (2 and at)" }, + { NULL, (0x07 << 16) + 0x020, "3 and # (3 and Hash)" }, + { NULL, (0x07 << 16) + 0x021, "4 and $ (4 and Dollar Sign)" }, + { NULL, (0x07 << 16) + 0x022, "5 and % (5 and Percent Sign)" }, + { NULL, (0x07 << 16) + 0x023, "6 and ^ (6 and circumflex)" }, + { NULL, (0x07 << 16) + 0x024, "7 and & (Seven and Ampersand)" }, + { NULL, (0x07 << 16) + 0x025, "8 and * (Eight and asterisk)" }, + { NULL, (0x07 << 16) + 0x026, "9 and ( (Nine and Parenthesis Left)" }, + { NULL, (0x07 << 16) + 0x027, "0 and ) (Zero and Parenthesis Right)" }, + { NULL, (0x07 << 16) + 0x028, "Return (Enter)" }, + { NULL, (0x07 << 16) + 0x029, "Escape" }, + { NULL, (0x07 << 16) + 0x02a, "Delete (Backspace)" }, + { NULL, (0x07 << 16) + 0x02b, "Tab" }, + { NULL, (0x07 << 16) + 0x02c, "Space Bar" }, + { NULL, (0x07 << 16) + 0x02d, "- and _ (Minus and underscore)" }, + { NULL, (0x07 << 16) + 0x02e, "= and + (Equal and Plus)" }, + { NULL, (0x07 << 16) + 0x02f, "[ and { (Bracket and Braces Left)" }, + { NULL, (0x07 << 16) + 0x030, "] and } (Bracket and Braces Right)" }, + { NULL, (0x07 << 16) + 0x031, "\\ and | (Backslash and Bar)" }, + { NULL, (0x07 << 16) + 0x032, "# and ~ (Hash and Tilde, Non-US Keyboard near right shift)" }, + { NULL, (0x07 << 16) + 0x033, "; and : (Semicolon and Colon)" }, + { NULL, (0x07 << 16) + 0x034, "´ and \" (Accent Acute and Double Quotes)" }, + { NULL, (0x07 << 16) + 0x035, "` and ~ (Accent Grace and Tilde)" }, + { NULL, (0x07 << 16) + 0x036, ", and < (Comma and Less)" }, + { NULL, (0x07 << 16) + 0x037, ". and > (Period and Greater)" }, + { NULL, (0x07 << 16) + 0x038, "/ and ? (Slash and Question Mark)" }, + { NULL, (0x07 << 16) + 0x039, "Caps Lock" }, + { NULL, (0x07 << 16) + 0x03a, "F1" }, + { NULL, (0x07 << 16) + 0x03b, "F2" }, + { NULL, (0x07 << 16) + 0x03c, "F3" }, + { NULL, (0x07 << 16) + 0x03d, "F4" }, + { NULL, (0x07 << 16) + 0x03e, "F5" }, + { NULL, (0x07 << 16) + 0x03f, "F6" }, + { NULL, (0x07 << 16) + 0x040, "F7" }, + { NULL, (0x07 << 16) + 0x041, "F8" }, + { NULL, (0x07 << 16) + 0x042, "F9" }, + { NULL, (0x07 << 16) + 0x043, "F10" }, + { NULL, (0x07 << 16) + 0x044, "F11" }, + { NULL, (0x07 << 16) + 0x045, "F12" }, + { NULL, (0x07 << 16) + 0x046, "Print Screen" }, + { NULL, (0x07 << 16) + 0x047, "Scroll Lock" }, + { NULL, (0x07 << 16) + 0x048, "Pause" }, + { NULL, (0x07 << 16) + 0x049, "Insert" }, + { NULL, (0x07 << 16) + 0x04a, "Home" }, + { NULL, (0x07 << 16) + 0x04b, "Page Up" }, + { NULL, (0x07 << 16) + 0x04c, "Delete Forward (without Changing Position)" }, + { NULL, (0x07 << 16) + 0x04d, "End" }, + { NULL, (0x07 << 16) + 0x04e, "Page Down" }, + { NULL, (0x07 << 16) + 0x04f, "Right Arrow" }, + { NULL, (0x07 << 16) + 0x050, "Left Arrow" }, + { NULL, (0x07 << 16) + 0x051, "Down Arrow" }, + { NULL, (0x07 << 16) + 0x052, "Up Arrow" }, + { NULL, (0x07 << 16) + 0x053, "Num Lock and Clear" }, + { NULL, (0x07 << 16) + 0x054, "Keypad / (Division Sign)" }, + { NULL, (0x07 << 16) + 0x055, "Keypad * (Multiplication Sign)" }, + { NULL, (0x07 << 16) + 0x056, "Keypad - (Subtraction Sign)" }, + { NULL, (0x07 << 16) + 0x057, "Keypad + (Addition Sign)" }, + { NULL, (0x07 << 16) + 0x058, "Keypad Enter" }, + { NULL, (0x07 << 16) + 0x059, "Keypad 1 and END" }, + { NULL, (0x07 << 16) + 0x05a, "Keypad 2 and Down Arrow" }, + { NULL, (0x07 << 16) + 0x05b, "Keypad 3 and Page Down" }, + { NULL, (0x07 << 16) + 0x05c, "Keypad 4 and Left Arrow" }, + { NULL, (0x07 << 16) + 0x05d, "Keypad 5 (Tactilei Raised)" }, + { NULL, (0x07 << 16) + 0x05f, "Keypad 6 and Right Arrow" }, + { NULL, (0x07 << 16) + 0x060, "Keypad 7 and Home" }, + { NULL, (0x07 << 16) + 0x061, "Keypad 8 and Up Arrow" }, + { NULL, (0x07 << 16) + 0x062, "Keypad 8 and Page Up" }, + { NULL, (0x07 << 16) + 0x063, "Keypad . (decimal delimiter) and Delete" }, + { NULL, (0x07 << 16) + 0x064, "\\ and | (Backslash and Bar, UK and Non-US Keyboard near left shift)" }, + { NULL, (0x07 << 16) + 0x065, "Keyboard Application (Windows Key for Win95 or Compose)" }, + { NULL, (0x07 << 16) + 0x066, "Power (not a key)" }, + { NULL, (0x07 << 16) + 0x067, "Keypad = (Equal Sign)" }, + { NULL, (0x07 << 16) + 0x068, "F13" }, + { NULL, (0x07 << 16) + 0x069, "F14" }, + { NULL, (0x07 << 16) + 0x06a, "F15" }, + { NULL, (0x07 << 16) + 0x06b, "F16" }, + { NULL, (0x07 << 16) + 0x06c, "F17" }, + { NULL, (0x07 << 16) + 0x06d, "F18" }, + { NULL, (0x07 << 16) + 0x06e, "F19" }, + { NULL, (0x07 << 16) + 0x06f, "F20" }, + { NULL, (0x07 << 16) + 0x070, "F21" }, + { NULL, (0x07 << 16) + 0x071, "F22" }, + { NULL, (0x07 << 16) + 0x072, "F23" }, + { NULL, (0x07 << 16) + 0x073, "F24" }, + { NULL, (0x07 << 16) + 0x074, "Execute" }, + { NULL, (0x07 << 16) + 0x075, "Help" }, + { NULL, (0x07 << 16) + 0x076, "Menu" }, + { NULL, (0x07 << 16) + 0x077, "Select" }, + { NULL, (0x07 << 16) + 0x078, "Stop" }, + { NULL, (0x07 << 16) + 0x079, "Again" }, + { NULL, (0x07 << 16) + 0x07a, "Undo" }, + { NULL, (0x07 << 16) + 0x07b, "Cut" }, + { NULL, (0x07 << 16) + 0x07c, "Copy" }, + { NULL, (0x07 << 16) + 0x07d, "Paste" }, + { NULL, (0x07 << 16) + 0x07e, "Find" }, + { NULL, (0x07 << 16) + 0x07f, "Mute" }, + { NULL, (0x07 << 16) + 0x080, "Volume Up" }, + { NULL, (0x07 << 16) + 0x081, "Volume Down" }, + { NULL, (0x07 << 16) + 0x082, "Locking Caps Lock" }, + { NULL, (0x07 << 16) + 0x083, "Locking Num Lock" }, + { NULL, (0x07 << 16) + 0x084, "Locking Scroll Lock" }, + { NULL, (0x07 << 16) + 0x085, "Keypad Comma" }, + { NULL, (0x07 << 16) + 0x086, "Keypad Equal Sign (AS/400)" }, + { NULL, (0x07 << 16) + 0x087, "International 1 (PC98)" }, + { NULL, (0x07 << 16) + 0x088, "International 2 (PC98)" }, + { NULL, (0x07 << 16) + 0x089, "International 3 (PC98)" }, + { NULL, (0x07 << 16) + 0x08a, "International 4 (PC98)" }, + { NULL, (0x07 << 16) + 0x08b, "International 5 (PC98)" }, + { NULL, (0x07 << 16) + 0x08c, "International 6 (PC98)" }, + { NULL, (0x07 << 16) + 0x08d, "International 7 (Toggle Single/Double Byte Mode)" }, + { NULL, (0x07 << 16) + 0x08e, "International 8" }, + { NULL, (0x07 << 16) + 0x08f, "International 9" }, + { NULL, (0x07 << 16) + 0x090, "LANG 1 (Hangul/English Toggle, Korea)" }, + { NULL, (0x07 << 16) + 0x091, "LANG 2 (Hanja Conversion, Korea)" }, + { NULL, (0x07 << 16) + 0x092, "LANG 3 (Katakana, Japan)" }, + { NULL, (0x07 << 16) + 0x093, "LANG 4 (Hiragana, Japan)" }, + { NULL, (0x07 << 16) + 0x094, "LANG 5 (Zenkaku/Hankaku, Japan)" }, + { NULL, (0x07 << 16) + 0x095, "LANG 6" }, + { NULL, (0x07 << 16) + 0x096, "LANG 7" }, + { NULL, (0x07 << 16) + 0x097, "LANG 8" }, + { NULL, (0x07 << 16) + 0x098, "LANG 9" }, + { NULL, (0x07 << 16) + 0x099, "Alternate Erase" }, + { NULL, (0x07 << 16) + 0x09a, "SysReq/Attention" }, + { NULL, (0x07 << 16) + 0x09b, "Cancel" }, + { NULL, (0x07 << 16) + 0x09c, "Clear" }, + { NULL, (0x07 << 16) + 0x09d, "Prior" }, + { NULL, (0x07 << 16) + 0x09e, "Return" }, + { NULL, (0x07 << 16) + 0x09f, "Separator" }, + { NULL, (0x07 << 16) + 0x0a0, "Out" }, + { NULL, (0x07 << 16) + 0x0a1, "Open" }, + { NULL, (0x07 << 16) + 0x0a2, "Clear/Again" }, + { NULL, (0x07 << 16) + 0x0a3, "CrSel/Props" }, + { NULL, (0x07 << 16) + 0x0a4, "ExSel" }, + { NULL, (0x07 << 16) + 0x0e0, "Control Left" }, + { NULL, (0x07 << 16) + 0x0e1, "Shift Left" }, + { NULL, (0x07 << 16) + 0x0e2, "Alt Left" }, + { NULL, (0x07 << 16) + 0x0e3, "GUI Left" }, + { NULL, (0x07 << 16) + 0x0e4, "Control Right" }, + { NULL, (0x07 << 16) + 0x0e5, "Shift Right" }, + { NULL, (0x07 << 16) + 0x0e6, "Alt Right" }, + { NULL, (0x07 << 16) + 0x0e7, "GUI Right" }, + { NULL, (0x08 << 16) + 0x000, "Undefined" }, + { NULL, (0x08 << 16) + 0x001, "NumLock" }, + { NULL, (0x08 << 16) + 0x002, "CapsLock" }, + { NULL, (0x08 << 16) + 0x003, "Scroll Lock" }, + { NULL, (0x08 << 16) + 0x004, "Compose" }, + { NULL, (0x08 << 16) + 0x005, "Kana" }, + { NULL, (0x08 << 16) + 0x006, "Power" }, + { NULL, (0x08 << 16) + 0x007, "Shift" }, + { NULL, (0x08 << 16) + 0x008, "Do not disturb" }, + { NULL, (0x08 << 16) + 0x009, "Mute" }, + { NULL, (0x08 << 16) + 0x00a, "Tone Enabke" }, + { NULL, (0x08 << 16) + 0x00b, "High Cut Filter" }, + { NULL, (0x08 << 16) + 0x00c, "Low Cut Filter" }, + { NULL, (0x08 << 16) + 0x00d, "Equalizer Enable" }, + { NULL, (0x08 << 16) + 0x00e, "Sound Field ON" }, + { NULL, (0x08 << 16) + 0x00f, "Surround On" }, + { NULL, (0x08 << 16) + 0x010, "Repeat" }, + { NULL, (0x08 << 16) + 0x011, "Stereo" }, + { NULL, (0x08 << 16) + 0x012, "Sampling Rate Detect" }, + { NULL, (0x08 << 16) + 0x013, "Spinning" }, + { NULL, (0x08 << 16) + 0x014, "CAV" }, + { NULL, (0x08 << 16) + 0x015, "CLV" }, + { NULL, (0x08 << 16) + 0x016, "Recording Format Detect" }, + { NULL, (0x08 << 16) + 0x017, "Off-Hook" }, + { NULL, (0x08 << 16) + 0x018, "Ring" }, + { NULL, (0x08 << 16) + 0x019, "Message Waiting" }, + { NULL, (0x08 << 16) + 0x01a, "Data Mode" }, + { NULL, (0x08 << 16) + 0x01b, "Battery Operation" }, + { NULL, (0x08 << 16) + 0x01c, "Battery OK" }, + { NULL, (0x08 << 16) + 0x01d, "Battery Low" }, + { NULL, (0x08 << 16) + 0x01e, "Speaker" }, + { NULL, (0x08 << 16) + 0x01f, "Head Set" }, + { NULL, (0x08 << 16) + 0x020, "Hold" }, + { NULL, (0x08 << 16) + 0x021, "Microphone" }, + { NULL, (0x08 << 16) + 0x022, "Coverage" }, + { NULL, (0x08 << 16) + 0x023, "Night Mode" }, + { NULL, (0x08 << 16) + 0x024, "Send Calls" }, + { NULL, (0x08 << 16) + 0x025, "Call Pickup" }, + { NULL, (0x08 << 16) + 0x026, "Conference" }, + { NULL, (0x08 << 16) + 0x027, "Stand-by" }, + { NULL, (0x08 << 16) + 0x028, "Camera On" }, + { NULL, (0x08 << 16) + 0x029, "Camera Off" }, + { NULL, (0x08 << 16) + 0x02a, "On-Line" }, + { NULL, (0x08 << 16) + 0x02b, "Off-Line" }, + { NULL, (0x08 << 16) + 0x02c, "Busy" }, + { NULL, (0x08 << 16) + 0x02d, "Ready" }, + { NULL, (0x08 << 16) + 0x02e, "Paper-Out" }, + { NULL, (0x08 << 16) + 0x02f, "Paper-Jam" }, + { NULL, (0x08 << 16) + 0x030, "Remote" }, + { NULL, (0x08 << 16) + 0x031, "Forward" }, + { NULL, (0x08 << 16) + 0x032, "Reverse" }, + { NULL, (0x08 << 16) + 0x033, "Stop" }, + { NULL, (0x08 << 16) + 0x034, "Rewind" }, + { NULL, (0x08 << 16) + 0x035, "Fast Forward" }, + { NULL, (0x08 << 16) + 0x036, "Play" }, + { NULL, (0x08 << 16) + 0x037, "Pause" }, + { NULL, (0x08 << 16) + 0x038, "Record" }, + { NULL, (0x08 << 16) + 0x039, "Error" }, + { NULL, (0x08 << 16) + 0x03a, "Usage Selected Indicator" }, + { NULL, (0x08 << 16) + 0x03b, "Usage In Use Indicator" }, + { NULL, (0x08 << 16) + 0x03c, "Usage Multi Indicator" }, + { NULL, (0x08 << 16) + 0x03d, "Indicator On" }, + { NULL, (0x08 << 16) + 0x03e, "Indicator Flash" }, + { NULL, (0x08 << 16) + 0x03f, "Indicator Slow Blink" }, + { NULL, (0x08 << 16) + 0x040, "Indicator Fast Blink" }, + { NULL, (0x08 << 16) + 0x041, "Indicator Off" }, + { NULL, (0x08 << 16) + 0x042, "Flash On Time" }, + { NULL, (0x08 << 16) + 0x043, "Slow Blink On Time" }, + { NULL, (0x08 << 16) + 0x044, "Slow Blink Off Time" }, + { NULL, (0x08 << 16) + 0x045, "Fast Blink On Time" }, + { NULL, (0x08 << 16) + 0x046, "Fast Blink Off Time" }, + { NULL, (0x08 << 16) + 0x047, "Usage Color Indicator" }, + { NULL, (0x08 << 16) + 0x048, "Indicator Red" }, + { NULL, (0x08 << 16) + 0x049, "Indicator Green" }, + { NULL, (0x08 << 16) + 0x04a, "Indicator Amber" }, + { NULL, (0x08 << 16) + 0x04b, "Generic Indicator" }, + { NULL, (0x08 << 16) + 0x04c, "System Suspend" }, + { NULL, (0x08 << 16) + 0x04d, "External Power Connected" }, + { NULL, (0x09 << 16) + 0x000, "No Button Pressed" }, + { NULL, (0x09 << 16) + 0x001, "Button 1 (Primary)" }, + { NULL, (0x09 << 16) + 0x002, "Button 2 (Secondary)" }, + { NULL, (0x09 << 16) + 0x003, "Button 3 (Tertiary)" }, + { NULL, (0x09 << 16) + 0x004, "Button 4" }, + { NULL, (0x09 << 16) + 0x005, "Button 5" }, + { NULL, (0x0a << 16) + 0x001, "Instance 1" }, + { NULL, (0x0a << 16) + 0x002, "Instance 2" }, + { NULL, (0x0a << 16) + 0x003, "Instance 3" }, + { NULL, (0x0b << 16) + 0x000, "Unassigned" }, + { NULL, (0x0b << 16) + 0x001, "Phone" }, + { NULL, (0x0b << 16) + 0x002, "Answering Machine" }, + { NULL, (0x0b << 16) + 0x003, "Message Controls" }, + { NULL, (0x0b << 16) + 0x004, "Handset" }, + { NULL, (0x0b << 16) + 0x005, "Headset" }, + { NULL, (0x0b << 16) + 0x006, "Telephony Key Pad" }, + { NULL, (0x0b << 16) + 0x007, "Programmable Button" }, + { NULL, (0x0b << 16) + 0x020, "Hook Switch" }, + { NULL, (0x0b << 16) + 0x021, "Flash" }, + { NULL, (0x0b << 16) + 0x022, "Feature" }, + { NULL, (0x0b << 16) + 0x023, "Hold" }, + { NULL, (0x0b << 16) + 0x024, "Redial" }, + { NULL, (0x0b << 16) + 0x025, "Transfer" }, + { NULL, (0x0b << 16) + 0x026, "Drop" }, + { NULL, (0x0b << 16) + 0x027, "Park" }, + { NULL, (0x0b << 16) + 0x028, "Forward Calls" }, + { NULL, (0x0b << 16) + 0x029, "Alternate Function" }, + { NULL, (0x0b << 16) + 0x02a, "Line" }, + { NULL, (0x0b << 16) + 0x02b, "Speaker Phone" }, + { NULL, (0x0b << 16) + 0x02c, "Conference" }, + { NULL, (0x0b << 16) + 0x02d, "Ring Enable" }, + { NULL, (0x0b << 16) + 0x02e, "Ring Select" }, + { NULL, (0x0b << 16) + 0x02f, "Phone Mute" }, + { NULL, (0x0b << 16) + 0x030, "Caller ID" }, + { NULL, (0x0b << 16) + 0x050, "Speed Dial" }, + { NULL, (0x0b << 16) + 0x051, "Store Number" }, + { NULL, (0x0b << 16) + 0x052, "Recall Number" }, + { NULL, (0x0b << 16) + 0x053, "Phone Directory" }, + { NULL, (0x0b << 16) + 0x070, "Voice Mail" }, + { NULL, (0x0b << 16) + 0x071, "Screen Calls" }, + { NULL, (0x0b << 16) + 0x072, "Do Not Disturb" }, + { NULL, (0x0b << 16) + 0x073, "Message" }, + { NULL, (0x0b << 16) + 0x074, "Answer On/Offf" }, + { NULL, (0x0b << 16) + 0x090, "Inside Dial Tone" }, + { NULL, (0x0b << 16) + 0x091, "Outside Dial Tone" }, + { NULL, (0x0b << 16) + 0x092, "Inside Ring Tone" }, + { NULL, (0x0b << 16) + 0x093, "Outside Ring Tone" }, + { NULL, (0x0b << 16) + 0x094, "Priority Ring Tone" }, + { NULL, (0x0b << 16) + 0x095, "Inside Ringback" }, + { NULL, (0x0b << 16) + 0x096, "Priority Ringback" }, + { NULL, (0x0b << 16) + 0x097, "Line Busy Tone" }, + { NULL, (0x0b << 16) + 0x098, "Recorder Tone" }, + { NULL, (0x0b << 16) + 0x099, "Call Waiting Tone" }, + { NULL, (0x0b << 16) + 0x09a, "Confirmation Tone 1" }, + { NULL, (0x0b << 16) + 0x09b, "Confirmation Tone 2" }, + { NULL, (0x0b << 16) + 0x09c, "Tones Off" }, + { NULL, (0x0b << 16) + 0x09d, "Outside Ringback" }, + { NULL, (0x0b << 16) + 0x0b0, "Key 1" }, + { NULL, (0x0b << 16) + 0x0b1, "Key 2" }, + { NULL, (0x0b << 16) + 0x0b3, "Key 3" }, + { NULL, (0x0b << 16) + 0x0b4, "Key 4" }, + { NULL, (0x0b << 16) + 0x0b5, "Key 5" }, + { NULL, (0x0b << 16) + 0x0b6, "Key 6" }, + { NULL, (0x0b << 16) + 0x0b7, "Key 7" }, + { NULL, (0x0b << 16) + 0x0b8, "Key 8" }, + { NULL, (0x0b << 16) + 0x0b9, "Key 9" }, + { NULL, (0x0b << 16) + 0x0ba, "Key Star" }, + { NULL, (0x0b << 16) + 0x0bb, "Key Pound" }, + { NULL, (0x0b << 16) + 0x0bc, "Key A" }, + { NULL, (0x0b << 16) + 0x0bd, "Key B" }, + { NULL, (0x0b << 16) + 0x0be, "Key C" }, + { NULL, (0x0b << 16) + 0x0bf, "Key D" }, + { NULL, (0x0c << 16) + 0x000, "Unassigned" }, + { NULL, (0x0c << 16) + 0x001, "Consumer Control" }, + { NULL, (0x0c << 16) + 0x002, "Numeric Key Pad" }, + { NULL, (0x0c << 16) + 0x003, "Programmable Buttons" }, + { NULL, (0x0c << 16) + 0x020, "+10" }, + { NULL, (0x0c << 16) + 0x021, "+100" }, + { NULL, (0x0c << 16) + 0x022, "AM/PM" }, + { NULL, (0x0c << 16) + 0x030, "Power" }, + { NULL, (0x0c << 16) + 0x031, "Reset" }, + { NULL, (0x0c << 16) + 0x032, "Sleep" }, + { NULL, (0x0c << 16) + 0x033, "Sleep After" }, + { NULL, (0x0c << 16) + 0x034, "Sleep Mode" }, + { NULL, (0x0c << 16) + 0x035, "Illumination" }, + { NULL, (0x0c << 16) + 0x036, "Function Buttons" }, + { NULL, (0x0c << 16) + 0x040, "Menu" }, + { NULL, (0x0c << 16) + 0x041, "Menu Pick" }, + { NULL, (0x0c << 16) + 0x042, "Menu Up" }, + { NULL, (0x0c << 16) + 0x043, "Menu Down" }, + { NULL, (0x0c << 16) + 0x044, "Menu Left" }, + { NULL, (0x0c << 16) + 0x045, "Menu Right" }, + { NULL, (0x0c << 16) + 0x046, "Menu Escape" }, + { NULL, (0x0c << 16) + 0x047, "Menu Value Increase" }, + { NULL, (0x0c << 16) + 0x048, "Menu Value Decrease" }, + { NULL, (0x0c << 16) + 0x060, "Data on Screen" }, + { NULL, (0x0c << 16) + 0x061, "Closed Caption" }, + { NULL, (0x0c << 16) + 0x062, "Closed Caption Select" }, + { NULL, (0x0c << 16) + 0x063, "VCR/TV" }, + { NULL, (0x0c << 16) + 0x064, "Broadcast Mode" }, + { NULL, (0x0c << 16) + 0x065, "Snapshot" }, + { NULL, (0x0c << 16) + 0x066, "Still" }, + { NULL, (0x0c << 16) + 0x080, "Selection" }, + { NULL, (0x0c << 16) + 0x081, "Assign Selection" }, + { NULL, (0x0c << 16) + 0x082, "Mode Step" }, + { NULL, (0x0c << 16) + 0x083, "Recall Last" }, + { NULL, (0x0c << 16) + 0x084, "Enter Channel" }, + { NULL, (0x0c << 16) + 0x085, "Order Movie" }, + { NULL, (0x0c << 16) + 0x086, "Channel" }, + { NULL, (0x0c << 16) + 0x087, "Media Selection" }, + { NULL, (0x0c << 16) + 0x088, "Media Select Computer" }, + { NULL, (0x0c << 16) + 0x089, "Media Select TV" }, + { NULL, (0x0c << 16) + 0x08a, "Media Select WWW" }, + { NULL, (0x0c << 16) + 0x08b, "Media Select DVD" }, + { NULL, (0x0c << 16) + 0x08c, "Media Select Telephone" }, + { NULL, (0x0c << 16) + 0x08d, "Media Select Program Guide" }, + { NULL, (0x0c << 16) + 0x08e, "Media Select Video Phone" }, + { NULL, (0x0c << 16) + 0x08f, "Media Select Games" }, + { NULL, (0x0c << 16) + 0x090, "Media Select Messages" }, + { NULL, (0x0c << 16) + 0x091, "Media Select CD" }, + { NULL, (0x0c << 16) + 0x092, "Media Select VCR" }, + { NULL, (0x0c << 16) + 0x093, "Media Select Tuner" }, + { NULL, (0x0c << 16) + 0x094, "Quit" }, + { NULL, (0x0c << 16) + 0x095, "Help" }, + { NULL, (0x0c << 16) + 0x096, "Media Select Tape" }, + { NULL, (0x0c << 16) + 0x097, "Media Select Cable" }, + { NULL, (0x0c << 16) + 0x098, "Media Select Satellite" }, + { NULL, (0x0c << 16) + 0x099, "Media Select Security" }, + { NULL, (0x0c << 16) + 0x09a, "Media Select Home" }, + { NULL, (0x0c << 16) + 0x09b, "Media Select Call" }, + { NULL, (0x0c << 16) + 0x09c, "Channel Increment" }, + { NULL, (0x0c << 16) + 0x09d, "Channel Decrement" }, + { NULL, (0x0c << 16) + 0x09e, "Media Select SAP" }, + { NULL, (0x0c << 16) + 0x0a0, "VCR Plus" }, + { NULL, (0x0c << 16) + 0x0a1, "Once" }, + { NULL, (0x0c << 16) + 0x0a2, "Daily" }, + { NULL, (0x0c << 16) + 0x0a3, "Weekly" }, + { NULL, (0x0c << 16) + 0x0a4, "Monthly" }, + { NULL, (0x0c << 16) + 0x0b0, "Play" }, + { NULL, (0x0c << 16) + 0x0b1, "Pause" }, + { NULL, (0x0c << 16) + 0x0b2, "Record" }, + { NULL, (0x0c << 16) + 0x0b3, "Fast Forward" }, + { NULL, (0x0c << 16) + 0x0b4, "Rewind" }, + { NULL, (0x0c << 16) + 0x0b5, "Scan Next Track" }, + { NULL, (0x0c << 16) + 0x0b6, "Scan Previous Track" }, + { NULL, (0x0c << 16) + 0x0b7, "Stop" }, + { NULL, (0x0c << 16) + 0x0b8, "Eject" }, + { NULL, (0x0c << 16) + 0x0b9, "Random Play" }, + { NULL, (0x0c << 16) + 0x0ba, "Select Disc" }, + { NULL, (0x0c << 16) + 0x0bb, "Enter Disc" }, + { NULL, (0x0c << 16) + 0x0bc, "Repeat" }, + { NULL, (0x0c << 16) + 0x0bd, "Tracking" }, + { NULL, (0x0c << 16) + 0x0be, "Track Normal" }, + { NULL, (0x0c << 16) + 0x0bf, "Slow Tracking" }, + { NULL, (0x0c << 16) + 0x0c0, "Frame Forward" }, + { NULL, (0x0c << 16) + 0x0c1, "Frame Back" }, + { NULL, (0x0c << 16) + 0x0c2, "Mark" }, + { NULL, (0x0c << 16) + 0x0c3, "Clear Mark" }, + { NULL, (0x0c << 16) + 0x0c4, "Repeat from Mark" }, + { NULL, (0x0c << 16) + 0x0c5, "Return to Mark" }, + { NULL, (0x0c << 16) + 0x0c6, "Search Mark Forward" }, + { NULL, (0x0c << 16) + 0x0c7, "Search Mark Backward" }, + { NULL, (0x0c << 16) + 0x0c8, "Counter Reset" }, + { NULL, (0x0c << 16) + 0x0c9, "Show Counter" }, + { NULL, (0x0c << 16) + 0x0ca, "Tracking Increment" }, + { NULL, (0x0c << 16) + 0x0cb, "Tracking Decrement" }, + { NULL, (0x0c << 16) + 0x0cc, "Stop/Eject" }, + { NULL, (0x0c << 16) + 0x0cd, "Play/Pause" }, + { NULL, (0x0c << 16) + 0x0ce, "Play/Skip" }, + { NULL, (0x0c << 16) + 0x0e0, "Volume" }, + { NULL, (0x0c << 16) + 0x0e1, "Balance" }, + { NULL, (0x0c << 16) + 0x0e2, "Mute" }, + { NULL, (0x0c << 16) + 0x0e3, "Bass" }, + { NULL, (0x0c << 16) + 0x0e4, "Treble" }, + { NULL, (0x0c << 16) + 0x0e5, "Bass Boost" }, + { NULL, (0x0c << 16) + 0x0e6, "Surround Mode" }, + { NULL, (0x0c << 16) + 0x0e7, "Loudness" }, + { NULL, (0x0c << 16) + 0x0e8, "MPX" }, + { NULL, (0x0c << 16) + 0x0e9, "Volume Increment" }, + { NULL, (0x0c << 16) + 0x0ea, "Volume Decrement" }, + { NULL, (0x0c << 16) + 0x0f0, "Speed Select" }, + { NULL, (0x0c << 16) + 0x0f1, "Playback Speed" }, + { NULL, (0x0c << 16) + 0x0f2, "Standard Play" }, + { NULL, (0x0c << 16) + 0x0f3, "Long Play" }, + { NULL, (0x0c << 16) + 0x0f4, "Extended Play" }, + { NULL, (0x0c << 16) + 0x0f5, "Slow" }, + { NULL, (0x0c << 16) + 0x100, "Fan Enable" }, + { NULL, (0x0c << 16) + 0x101, "Fan Speed" }, + { NULL, (0x0c << 16) + 0x102, "Light Enable" }, + { NULL, (0x0c << 16) + 0x103, "Light Illumination Level" }, + { NULL, (0x0c << 16) + 0x104, "Climate Control Enable" }, + { NULL, (0x0c << 16) + 0x105, "Room Temperature" }, + { NULL, (0x0c << 16) + 0x106, "Security Enable" }, + { NULL, (0x0c << 16) + 0x107, "Fire Alarm" }, + { NULL, (0x0c << 16) + 0x108, "Police Alarm" }, + { NULL, (0x0c << 16) + 0x150, "Balance Right" }, + { NULL, (0x0c << 16) + 0x151, "Balance Left" }, + { NULL, (0x0c << 16) + 0x152, "Bass Increment" }, + { NULL, (0x0c << 16) + 0x153, "Bass Decrement" }, + { NULL, (0x0c << 16) + 0x154, "Treble Increment" }, + { NULL, (0x0c << 16) + 0x155, "Treble Decrement" }, + { NULL, (0x0c << 16) + 0x160, "Speaker System" }, + { NULL, (0x0c << 16) + 0x161, "Channel Left" }, + { NULL, (0x0c << 16) + 0x162, "Channel Right" }, + { NULL, (0x0c << 16) + 0x163, "Channel Center" }, + { NULL, (0x0c << 16) + 0x164, "Channel Front" }, + { NULL, (0x0c << 16) + 0x165, "Channel Center Front" }, + { NULL, (0x0c << 16) + 0x166, "Channel Side" }, + { NULL, (0x0c << 16) + 0x167, "Channel Surround" }, + { NULL, (0x0c << 16) + 0x168, "Channel Low Frequency Enhancement" }, + { NULL, (0x0c << 16) + 0x169, "Channel Top" }, + { NULL, (0x0c << 16) + 0x16a, "Channel Unknown" }, + { NULL, (0x0c << 16) + 0x170, "Sub-Channel" }, + { NULL, (0x0c << 16) + 0x171, "Sub-Channel Increment" }, + { NULL, (0x0c << 16) + 0x172, "Sub-Channel Decrement" }, + { NULL, (0x0c << 16) + 0x173, "Alternative Audio Increment" }, + { NULL, (0x0c << 16) + 0x174, "Alternative Audio Decrement" }, + { NULL, (0x0c << 16) + 0x180, "Application Launch Buttons" }, + { NULL, (0x0c << 16) + 0x181, "AL Launch Button Configuration Tool" }, + { NULL, (0x0c << 16) + 0x182, "AL Launch Button Configuration" }, + { NULL, (0x0c << 16) + 0x183, "AL Consumer Control Configuration" }, + { NULL, (0x0c << 16) + 0x184, "AL Word Processor" }, + { NULL, (0x0c << 16) + 0x185, "AL Text Editor" }, + { NULL, (0x0c << 16) + 0x186, "AL Spreadsheet" }, + { NULL, (0x0c << 16) + 0x187, "AL Graphics Editor" }, + { NULL, (0x0c << 16) + 0x188, "AL Presentation App" }, + { NULL, (0x0c << 16) + 0x189, "AL Database App" }, + { NULL, (0x0c << 16) + 0x18a, "AL Email Reader" }, + { NULL, (0x0c << 16) + 0x18b, "AL Newsreader" }, + { NULL, (0x0c << 16) + 0x18c, "AL Voicemail" }, + { NULL, (0x0c << 16) + 0x18d, "AL Contacts/Address Book" }, + { NULL, (0x0c << 16) + 0x18e, "AL Calendar/Schedule" }, + { NULL, (0x0c << 16) + 0x18f, "AL Task/Project Manager" }, + { NULL, (0x0c << 16) + 0x190, "AL Log/Jounal/Timecard" }, + { NULL, (0x0c << 16) + 0x191, "AL Checkbook/Finance" }, + { NULL, (0x0c << 16) + 0x192, "AL Calculator" }, + { NULL, (0x0c << 16) + 0x193, "AL A/V Capture/Playback" }, + { NULL, (0x0c << 16) + 0x194, "AL Local Machine Browser" }, + { NULL, (0x0c << 16) + 0x195, "AL LAN/Wan Browser" }, + { NULL, (0x0c << 16) + 0x196, "AL Internet Browser" }, + { NULL, (0x0c << 16) + 0x197, "AL Remote Networking/ISP Connect" }, + { NULL, (0x0c << 16) + 0x198, "AL Network Conference" }, + { NULL, (0x0c << 16) + 0x199, "AL Network Chat" }, + { NULL, (0x0c << 16) + 0x19a, "AL Telephony/Dialer" }, + { NULL, (0x0c << 16) + 0x19b, "AL Logon" }, + { NULL, (0x0c << 16) + 0x19c, "AL Logoff" }, + { NULL, (0x0c << 16) + 0x19d, "AL Logon/Logoff" }, + { NULL, (0x0c << 16) + 0x19e, "AL Terminal Local/Screensaver" }, + { NULL, (0x0c << 16) + 0x19f, "AL Control Panel" }, + { NULL, (0x0c << 16) + 0x1a0, "AL Command Line Processor/Run" }, + { NULL, (0x0c << 16) + 0x1a1, "AL Process/Task Manager" }, + { NULL, (0x0c << 16) + 0x1a2, "AL Select Task/Application" }, + { NULL, (0x0c << 16) + 0x1a3, "AL Next Task/Application" }, + { NULL, (0x0c << 16) + 0x1a4, "AL Previous Task/Application" }, + { NULL, (0x0c << 16) + 0x1a5, "AL Preemptive Halt Task/Application" }, + { NULL, (0x0c << 16) + 0x200, "Generic GUI Application Controls" }, + { NULL, (0x0c << 16) + 0x201, "AC New" }, + { NULL, (0x0c << 16) + 0x202, "AC Open" }, + { NULL, (0x0c << 16) + 0x203, "AC CLose" }, + { NULL, (0x0c << 16) + 0x204, "AC Exit" }, + { NULL, (0x0c << 16) + 0x205, "AC Maximize" }, + { NULL, (0x0c << 16) + 0x206, "AC Minimize" }, + { NULL, (0x0c << 16) + 0x207, "AC Save" }, + { NULL, (0x0c << 16) + 0x208, "AC Print" }, + { NULL, (0x0c << 16) + 0x209, "AC Properties" }, + { NULL, (0x0c << 16) + 0x21a, "AC Undo" }, + { NULL, (0x0c << 16) + 0x21b, "AC Copy" }, + { NULL, (0x0c << 16) + 0x21c, "AC Cut" }, + { NULL, (0x0c << 16) + 0x21d, "AC Paste" }, + { NULL, (0x0c << 16) + 0x21e, "AC Select All" }, + { NULL, (0x0c << 16) + 0x21f, "AC Find" }, + { NULL, (0x0c << 16) + 0x220, "AC Find and Replace" }, + { NULL, (0x0c << 16) + 0x221, "AC Search" }, + { NULL, (0x0c << 16) + 0x222, "AC Go To" }, + { NULL, (0x0c << 16) + 0x223, "AC Home" }, + { NULL, (0x0c << 16) + 0x224, "AC Back" }, + { NULL, (0x0c << 16) + 0x225, "AC Forward" }, + { NULL, (0x0c << 16) + 0x226, "AC Stop" }, + { NULL, (0x0c << 16) + 0x227, "AC Refresh" }, + { NULL, (0x0c << 16) + 0x228, "AC Previous Link" }, + { NULL, (0x0c << 16) + 0x229, "AC Next Link" }, + { NULL, (0x0c << 16) + 0x22b, "AC History" }, + { NULL, (0x0c << 16) + 0x22c, "AC Subscriptions" }, + { NULL, (0x0c << 16) + 0x22d, "AC Zoom In" }, + { NULL, (0x0c << 16) + 0x22e, "AC Zoom Out" }, + { NULL, (0x0c << 16) + 0x22f, "AC Zoom" }, + { NULL, (0x0c << 16) + 0x230, "AC Full Screen View" }, + { NULL, (0x0c << 16) + 0x231, "AC Normal View" }, + { NULL, (0x0c << 16) + 0x232, "AC View Toggle" }, + { NULL, (0x0c << 16) + 0x233, "AC Scroll Up" }, + { NULL, (0x0c << 16) + 0x234, "AC Scroll Down" }, + { NULL, (0x0c << 16) + 0x235, "AC Scroll" }, + { NULL, (0x0c << 16) + 0x236, "AC Pan Left" }, + { NULL, (0x0c << 16) + 0x237, "AC Pan Right" }, + { NULL, (0x0c << 16) + 0x238, "AC Pan" }, + { NULL, (0x0c << 16) + 0x239, "AC New Window" }, + { NULL, (0x0c << 16) + 0x23a, "AC Tile Horizontally" }, + { NULL, (0x0c << 16) + 0x23b, "AC Tile Vertically" }, + { NULL, (0x0c << 16) + 0x23c, "AC Format" }, + { NULL, (0x0d << 16) + 0x000, "Undefined" }, + { NULL, (0x0d << 16) + 0x001, "Digitizer" }, + { NULL, (0x0d << 16) + 0x002, "Pen" }, + { NULL, (0x0d << 16) + 0x003, "Light Pen" }, + { NULL, (0x0d << 16) + 0x004, "Touch Screen" }, + { NULL, (0x0d << 16) + 0x005, "Touch Pad" }, + { NULL, (0x0d << 16) + 0x006, "White Board" }, + { NULL, (0x0d << 16) + 0x007, "Coordinate Measuring Machine" }, + { NULL, (0x0d << 16) + 0x008, "3D Digitizer" }, + { NULL, (0x0d << 16) + 0x009, "Stereo Plotter" }, + { NULL, (0x0d << 16) + 0x00a, "Articulated Arm" }, + { NULL, (0x0d << 16) + 0x00b, "Armature" }, + { NULL, (0x0d << 16) + 0x00c, "Multiple Point Digitizer" }, + { NULL, (0x0d << 16) + 0x00d, "Free Space Wand" }, + { NULL, (0x0d << 16) + 0x020, "Stylus" }, + { NULL, (0x0d << 16) + 0x021, "Puck" }, + { NULL, (0x0d << 16) + 0x022, "Finger" }, + { NULL, (0x0d << 16) + 0x030, "Tip Pressure" }, + { NULL, (0x0d << 16) + 0x031, "Barrel Pressure" }, + { NULL, (0x0d << 16) + 0x032, "In Range" }, + { NULL, (0x0d << 16) + 0x033, "Touch" }, + { NULL, (0x0d << 16) + 0x034, "Untouch" }, + { NULL, (0x0d << 16) + 0x035, "Tap" }, + { NULL, (0x0d << 16) + 0x036, "Quality" }, + { NULL, (0x0d << 16) + 0x037, "Data Valid" }, + { NULL, (0x0d << 16) + 0x038, "Transducer Index" }, + { NULL, (0x0d << 16) + 0x039, "Tablet Function Keys" }, + { NULL, (0x0d << 16) + 0x03a, "Program Change Keys" }, + { NULL, (0x0d << 16) + 0x03b, "Battery Strength" }, + { NULL, (0x0d << 16) + 0x03c, "Invert" }, + { NULL, (0x0d << 16) + 0x03d, "X Tilt" }, + { NULL, (0x0d << 16) + 0x03e, "Y Tilt" }, + { NULL, (0x0d << 16) + 0x03f, "Azimuth" }, + { NULL, (0x0d << 16) + 0x040, "Altitude" }, + { NULL, (0x0d << 16) + 0x041, "Twist" }, + { NULL, (0x0d << 16) + 0x042, "Tip Switch" }, + { NULL, (0x0d << 16) + 0x043, "Secondary Tip Switch" }, + { NULL, (0x0d << 16) + 0x044, "Barrel Switch" }, + { NULL, (0x0d << 16) + 0x045, "Eraser" }, + { NULL, (0x0d << 16) + 0x046, "Tablet Pick" }, + { NULL, (0x0d << 16) + 0x047, "Confidence" }, + { NULL, (0x0d << 16) + 0x048, "Width" }, + { NULL, (0x0d << 16) + 0x049, "Height" }, + { NULL, (0x0d << 16) + 0x051, "Contact ID" }, + { NULL, (0x0d << 16) + 0x052, "Input Mode" }, + { NULL, (0x0d << 16) + 0x053, "Device Index" }, + { NULL, (0x0d << 16) + 0x054, "Contact Count" }, + { NULL, (0x0d << 16) + 0x055, "Maximum Contact Number" }, + { NULL, (0x0f << 16) + 0x000, "Undefined" }, + { NULL, (0x0f << 16) + 0x001, "Physical Interface Device" }, + { NULL, (0x0f << 16) + 0x020, "Normal" }, + { NULL, (0x0f << 16) + 0x021, "Set Effect Report" }, + { NULL, (0x0f << 16) + 0x022, "Effect Block Index" }, + { NULL, (0x0f << 16) + 0x023, "Parameter Block Offset" }, + { NULL, (0x0f << 16) + 0x024, "ROM Flag" }, + { NULL, (0x0f << 16) + 0x025, "Effect Type" }, + { NULL, (0x0f << 16) + 0x026, "ET Constant Force" }, + { NULL, (0x0f << 16) + 0x027, "ET Ramp" }, + { NULL, (0x0f << 16) + 0x028, "ET Custom Force Data" }, + { NULL, (0x0f << 16) + 0x030, "ET Square" }, + { NULL, (0x0f << 16) + 0x031, "ET Sine" }, + { NULL, (0x0f << 16) + 0x032, "ET Triangle" }, + { NULL, (0x0f << 16) + 0x033, "ET Sawtooth Up" }, + { NULL, (0x0f << 16) + 0x034, "ET Sawtooth Down" }, + { NULL, (0x0f << 16) + 0x040, "ET Spring" }, + { NULL, (0x0f << 16) + 0x041, "ET Damper" }, + { NULL, (0x0f << 16) + 0x042, "ET Inertia" }, + { NULL, (0x0f << 16) + 0x043, "ET Friction" }, + { NULL, (0x0f << 16) + 0x050, "Duration" }, + { NULL, (0x0f << 16) + 0x051, "Sample Period" }, + { NULL, (0x0f << 16) + 0x052, "Gain" }, + { NULL, (0x0f << 16) + 0x053, "Trigger Button" }, + { NULL, (0x0f << 16) + 0x054, "Trigger Repeat Interval" }, + { NULL, (0x0f << 16) + 0x055, "Axes Enable" }, + { NULL, (0x0f << 16) + 0x056, "Direction Enable" }, + { NULL, (0x0f << 16) + 0x057, "Direction" }, + { NULL, (0x0f << 16) + 0x058, "Type Specific Block Offset" }, + { NULL, (0x0f << 16) + 0x059, "Block Type" }, + { NULL, (0x0f << 16) + 0x05A, "Set Envelope Report" }, + { NULL, (0x0f << 16) + 0x05B, "Attack Level" }, + { NULL, (0x0f << 16) + 0x05C, "Attack Time" }, + { NULL, (0x0f << 16) + 0x05D, "Fade Level" }, + { NULL, (0x0f << 16) + 0x05E, "Fade Time" }, + { NULL, (0x0f << 16) + 0x05F, "Set Condition Report" }, + { NULL, (0x0f << 16) + 0x060, "CP Offset" }, + { NULL, (0x0f << 16) + 0x061, "Positive Coefficient" }, + { NULL, (0x0f << 16) + 0x062, "Negative Coefficient" }, + { NULL, (0x0f << 16) + 0x063, "Positive Saturation" }, + { NULL, (0x0f << 16) + 0x064, "Negative Saturation" }, + { NULL, (0x0f << 16) + 0x065, "Dead Band" }, + { NULL, (0x0f << 16) + 0x066, "Download Force Sample" }, + { NULL, (0x0f << 16) + 0x067, "Isoch Custom Force Enable" }, + { NULL, (0x0f << 16) + 0x068, "Custom Force Data Report" }, + { NULL, (0x0f << 16) + 0x069, "Custom Force Data" }, + { NULL, (0x0f << 16) + 0x06A, "Custom Force Vendor Defined Data" }, + { NULL, (0x0f << 16) + 0x06B, "Set Custom Force Report" }, + { NULL, (0x0f << 16) + 0x06C, "Custom Force Data Offset" }, + { NULL, (0x0f << 16) + 0x06D, "Sample Count" }, + { NULL, (0x0f << 16) + 0x06E, "Set Periodic Report" }, + { NULL, (0x0f << 16) + 0x06F, "Offset" }, + { NULL, (0x0f << 16) + 0x070, "Magnitude" }, + { NULL, (0x0f << 16) + 0x071, "Phase" }, + { NULL, (0x0f << 16) + 0x072, "Period" }, + { NULL, (0x0f << 16) + 0x073, "Set Constant Force Report" }, + { NULL, (0x0f << 16) + 0x074, "Set Ramp Force Report" }, + { NULL, (0x0f << 16) + 0x075, "Ramp Start" }, + { NULL, (0x0f << 16) + 0x076, "Ramp End" }, + { NULL, (0x0f << 16) + 0x077, "Effect Operation Report" }, + { NULL, (0x0f << 16) + 0x078, "Effect Operation" }, + { NULL, (0x0f << 16) + 0x079, "Op Effect Start" }, + { NULL, (0x0f << 16) + 0x07A, "Op Effect Start Solo" }, + { NULL, (0x0f << 16) + 0x07B, "Op Effect Stop" }, + { NULL, (0x0f << 16) + 0x07C, "Loop Count" }, + { NULL, (0x0f << 16) + 0x07D, "Device Gain Report" }, + { NULL, (0x0f << 16) + 0x07E, "Device Gain" }, + { NULL, (0x0f << 16) + 0x07F, "PID Pool Report" }, + { NULL, (0x0f << 16) + 0x080, "RAM Pool Size" }, + { NULL, (0x0f << 16) + 0x081, "ROM Pool Size" }, + { NULL, (0x0f << 16) + 0x082, "ROM Effect Block Count" }, + { NULL, (0x0f << 16) + 0x083, "Simultaneous Effects Max" }, + { NULL, (0x0f << 16) + 0x084, "Pool Alignment" }, + { NULL, (0x0f << 16) + 0x085, "PID Pool Move Report" }, + { NULL, (0x0f << 16) + 0x086, "Move Source" }, + { NULL, (0x0f << 16) + 0x087, "Move Destination" }, + { NULL, (0x0f << 16) + 0x088, "Move Length" }, + { NULL, (0x0f << 16) + 0x089, "PID Block Load Report" }, + { NULL, (0x0f << 16) + 0x08B, "Block Load Status" }, + { NULL, (0x0f << 16) + 0x08C, "Block Load Success" }, + { NULL, (0x0f << 16) + 0x08D, "Block Load Full" }, + { NULL, (0x0f << 16) + 0x08E, "Block Load Error" }, + { NULL, (0x0f << 16) + 0x08F, "Block Handle" }, + { NULL, (0x0f << 16) + 0x090, "PID Block Free Report" }, + { NULL, (0x0f << 16) + 0x091, "Type Specific Block Handle" }, + { NULL, (0x0f << 16) + 0x092, "PID State Report" }, + { NULL, (0x0f << 16) + 0x094, "Effect Playing" }, + { NULL, (0x0f << 16) + 0x095, "PID Device Control Report" }, + { NULL, (0x0f << 16) + 0x096, "PID Device Control" }, + { NULL, (0x0f << 16) + 0x097, "DC Enable Actuators" }, + { NULL, (0x0f << 16) + 0x098, "DC Disable Actuators" }, + { NULL, (0x0f << 16) + 0x099, "DC Stop All Effects" }, + { NULL, (0x0f << 16) + 0x09A, "DC Device Reset" }, + { NULL, (0x0f << 16) + 0x09B, "DC Device Pause" }, + { NULL, (0x0f << 16) + 0x09C, "DC Device Continue" }, + { NULL, (0x0f << 16) + 0x09F, "Device Paused" }, + { NULL, (0x0f << 16) + 0x0A0, "Actuators Enabled" }, + { NULL, (0x0f << 16) + 0x0A4, "Safety Switch" }, + { NULL, (0x0f << 16) + 0x0A5, "Actuator Override Switch" }, + { NULL, (0x0f << 16) + 0x0A6, "Actuator Power" }, + { NULL, (0x0f << 16) + 0x0A7, "Start Delay" }, + { NULL, (0x0f << 16) + 0x0A8, "Parameter Block Size" }, + { NULL, (0x0f << 16) + 0x0A9, "Device Managed Pool" }, + { NULL, (0x0f << 16) + 0x0AA, "Shared Parameter Blocks" }, + { NULL, (0x0f << 16) + 0x0AB, "Create New Effect Report" }, + { NULL, (0x0f << 16) + 0x0AC, "RAM Pool Available" }, + { NULL, (0x14 << 16) + 0x000, "Undefined" }, + { NULL, (0x14 << 16) + 0x001, "Alphanumeric Display" }, + { NULL, (0x14 << 16) + 0x020, "Display Attributes Report" }, + { NULL, (0x14 << 16) + 0x021, "ASCII Character Set" }, + { NULL, (0x14 << 16) + 0x022, "Data Read Back" }, + { NULL, (0x14 << 16) + 0x023, "Font Read Back" }, + { NULL, (0x14 << 16) + 0x024, "Display Control Report" }, + { NULL, (0x14 << 16) + 0x025, "Clear Display" }, + { NULL, (0x14 << 16) + 0x026, "Display Enable" }, + { NULL, (0x14 << 16) + 0x027, "Screen Saver Delay" }, + { NULL, (0x14 << 16) + 0x028, "Screen Saver Enable" }, + { NULL, (0x14 << 16) + 0x029, "Vertical Scroll" }, + { NULL, (0x14 << 16) + 0x02a, "Horizontal Scroll" }, + { NULL, (0x14 << 16) + 0x02b, "Character Report" }, + { NULL, (0x14 << 16) + 0x02c, "Display Data" }, + { NULL, (0x14 << 16) + 0x02d, "Display Status" }, + { NULL, (0x14 << 16) + 0x02e, "Stat Not Ready" }, + { NULL, (0x14 << 16) + 0x02f, "Stat Ready" }, + { NULL, (0x14 << 16) + 0x030, "Err Not a loadable Character" }, + { NULL, (0x14 << 16) + 0x031, "Err Font Data Cannot Be Read" }, + { NULL, (0x14 << 16) + 0x032, "Cursur Position Report" }, + { NULL, (0x14 << 16) + 0x033, "Row" }, + { NULL, (0x14 << 16) + 0x034, "Column" }, + { NULL, (0x14 << 16) + 0x035, "Rows" }, + { NULL, (0x14 << 16) + 0x036, "Columns" }, + { NULL, (0x14 << 16) + 0x037, "Cursor Pixel Positioning" }, + { NULL, (0x14 << 16) + 0x038, "Cursor Mode" }, + { NULL, (0x14 << 16) + 0x039, "Cursor Enable" }, + { NULL, (0x14 << 16) + 0x03a, "Cursor Blink" }, + { NULL, (0x14 << 16) + 0x03b, "Font Report" }, + { NULL, (0x14 << 16) + 0x03c, "Font Data" }, + { NULL, (0x14 << 16) + 0x03d, "Character Width" }, + { NULL, (0x14 << 16) + 0x03e, "Character Height" }, + { NULL, (0x14 << 16) + 0x03f, "Character Spacing Horizontal" }, + { NULL, (0x14 << 16) + 0x040, "Character Spacing Vertical" }, + { NULL, (0x14 << 16) + 0x041, "Unicode Character Set" }, + { NULL, (0x80 << 16) + 0x001, "Monitor Control" }, + { NULL, (0x80 << 16) + 0x002, "EDID Information" }, + { NULL, (0x80 << 16) + 0x003, "VDIF Information" }, + { NULL, (0x80 << 16) + 0x004, "VESA Version" }, + { NULL, (0x82 << 16) + 0x001, "Degauss" }, + { NULL, (0x82 << 16) + 0x010, "Brightness" }, + { NULL, (0x82 << 16) + 0x012, "Contrast" }, + { NULL, (0x82 << 16) + 0x016, "Red Video Gain" }, + { NULL, (0x82 << 16) + 0x018, "Green Video Gain" }, + { NULL, (0x82 << 16) + 0x01a, "Blue Video Gain" }, + { NULL, (0x82 << 16) + 0x01c, "Focus" }, + { NULL, (0x82 << 16) + 0x020, "Horizontal Position" }, + { NULL, (0x82 << 16) + 0x022, "Horizontal Size" }, + { NULL, (0x82 << 16) + 0x024, "Horizontal Pincushion" }, + { NULL, (0x82 << 16) + 0x026, "Horizontal Pincushion Balance" }, + { NULL, (0x82 << 16) + 0x028, "Horizontal Misconvergence" }, + { NULL, (0x82 << 16) + 0x02a, "Horizontal Linearity" }, + { NULL, (0x82 << 16) + 0x02c, "Horizontal Linearity Balance" }, + { NULL, (0x82 << 16) + 0x030, "Vertical Position" }, + { NULL, (0x82 << 16) + 0x032, "Vertical Size" }, + { NULL, (0x82 << 16) + 0x034, "Vertical Pincushion" }, + { NULL, (0x82 << 16) + 0x036, "Vertical Pincushion Balance" }, + { NULL, (0x82 << 16) + 0x038, "Vertical Misconvergence" }, + { NULL, (0x82 << 16) + 0x03a, "Vertical Linearity" }, + { NULL, (0x82 << 16) + 0x03c, "Vertical Linearity Balance" }, + { NULL, (0x82 << 16) + 0x040, "Parallelogram Balance (Key Distortion)" }, + { NULL, (0x82 << 16) + 0x042, "Trapezoidal Distortion (Key)" }, + { NULL, (0x82 << 16) + 0x044, "Tilt (Rotation)" }, + { NULL, (0x82 << 16) + 0x046, "Top Corner Distortion Control" }, + { NULL, (0x82 << 16) + 0x048, "Top Corner Distortion Balance" }, + { NULL, (0x82 << 16) + 0x04a, "Bottom Corner Distortion Control" }, + { NULL, (0x82 << 16) + 0x04c, "Bottom Corner Distortion Balance" }, + { NULL, (0x82 << 16) + 0x056, "Horizontal Moire" }, + { NULL, (0x82 << 16) + 0x058, "Vertical Moire" }, + { NULL, (0x82 << 16) + 0x05e, "Input Level Select" }, + { NULL, (0x82 << 16) + 0x060, "Input Source Select" }, + { NULL, (0x82 << 16) + 0x06c, "Red Video Black Level" }, + { NULL, (0x82 << 16) + 0x06e, "Green Video Black Level" }, + { NULL, (0x82 << 16) + 0x070, "Blue Video Black Level" }, + { NULL, (0x82 << 16) + 0x0a2, "Auto Size Center" }, + { NULL, (0x82 << 16) + 0x0a4, "Polarity Horizontal Sychronization" }, + { NULL, (0x82 << 16) + 0x0a6, "Polarity Vertical Synchronization" }, + { NULL, (0x82 << 16) + 0x0aa, "Screen Orientation" }, + { NULL, (0x82 << 16) + 0x0ac, "Horizontal Frequency in Hz" }, + { NULL, (0x82 << 16) + 0x0ae, "Vertical Frequency in 0.1 Hz" }, + { NULL, (0x82 << 16) + 0x0b0, "Settings" }, + { NULL, (0x82 << 16) + 0x0ca, "On Screen Display (OSD)" }, + { NULL, (0x82 << 16) + 0x0d4, "Stereo Mode" }, + { NULL, (0x84 << 16) + 0x000, "Undefined" }, + { NULL, (0x84 << 16) + 0x001, "iName" }, + { NULL, (0x84 << 16) + 0x002, "Present Status" }, + { NULL, (0x84 << 16) + 0x003, "Changed Status" }, + { NULL, (0x84 << 16) + 0x004, "UPS" }, + { NULL, (0x84 << 16) + 0x005, "Power Supply" }, + { NULL, (0x84 << 16) + 0x010, "Battery System" }, + { NULL, (0x84 << 16) + 0x011, "Battery System ID" }, + { NULL, (0x84 << 16) + 0x012, "Battery" }, + { NULL, (0x84 << 16) + 0x013, "Battery ID" }, + { NULL, (0x84 << 16) + 0x014, "Charger" }, + { NULL, (0x84 << 16) + 0x015, "Charger ID" }, + { NULL, (0x84 << 16) + 0x016, "Power Converter" }, + { NULL, (0x84 << 16) + 0x017, "Power Converter ID" }, + { NULL, (0x84 << 16) + 0x018, "Outlet System" }, + { NULL, (0x84 << 16) + 0x019, "Outlet System ID" }, + { NULL, (0x84 << 16) + 0x01a, "Input" }, + { NULL, (0x84 << 16) + 0x01b, "Input ID" }, + { NULL, (0x84 << 16) + 0x01c, "Output" }, + { NULL, (0x84 << 16) + 0x01d, "Output ID" }, + { NULL, (0x84 << 16) + 0x01e, "Flow" }, + { NULL, (0x84 << 16) + 0x01f, "Flow ID" }, + { NULL, (0x84 << 16) + 0x020, "Outlet" }, + { NULL, (0x84 << 16) + 0x021, "Outlet ID" }, + { NULL, (0x84 << 16) + 0x022, "Gang" }, + { NULL, (0x84 << 16) + 0x023, "Gang ID" }, + { NULL, (0x84 << 16) + 0x024, "Power Summary" }, + { NULL, (0x84 << 16) + 0x025, "Power Summary ID" }, + { NULL, (0x84 << 16) + 0x030, "Voltage" }, + { NULL, (0x84 << 16) + 0x031, "Current" }, + { NULL, (0x84 << 16) + 0x032, "Frequency" }, + { NULL, (0x84 << 16) + 0x033, "Apparent Power" }, + { NULL, (0x84 << 16) + 0x034, "Active Power" }, + { NULL, (0x84 << 16) + 0x035, "Percent Load" }, + { NULL, (0x84 << 16) + 0x036, "Temperature" }, + { NULL, (0x84 << 16) + 0x037, "Humidity" }, + { NULL, (0x84 << 16) + 0x038, "Bad Count" }, + { NULL, (0x84 << 16) + 0x040, "Config Voltage" }, + { NULL, (0x84 << 16) + 0x041, "Config Current" }, + { NULL, (0x84 << 16) + 0x042, "Config Frequency" }, + { NULL, (0x84 << 16) + 0x043, "Config Apparent Power" }, + { NULL, (0x84 << 16) + 0x044, "Config Active Power" }, + { NULL, (0x84 << 16) + 0x045, "Config Percent Load" }, + { NULL, (0x84 << 16) + 0x046, "Config Temperature" }, + { NULL, (0x84 << 16) + 0x047, "Config Humidity" }, + { NULL, (0x84 << 16) + 0x050, "Switch On Control" }, + { NULL, (0x84 << 16) + 0x051, "Switch Off Control" }, + { NULL, (0x84 << 16) + 0x052, "Toggle Control" }, + { NULL, (0x84 << 16) + 0x053, "Low Voltage Transfer" }, + { NULL, (0x84 << 16) + 0x054, "High Voltage Transfer" }, + { NULL, (0x84 << 16) + 0x055, "Delay Before Reboot" }, + { NULL, (0x84 << 16) + 0x056, "Delay Before Startup" }, + { NULL, (0x84 << 16) + 0x057, "Delay Before Shutdown" }, + { NULL, (0x84 << 16) + 0x058, "Test" }, + { NULL, (0x84 << 16) + 0x059, "Module Reset" }, + { NULL, (0x84 << 16) + 0x05a, "Audible Alarm Control" }, + { NULL, (0x84 << 16) + 0x060, "Present" }, + { NULL, (0x84 << 16) + 0x061, "Good" }, + { NULL, (0x84 << 16) + 0x062, "Internal Failure" }, + { NULL, (0x84 << 16) + 0x063, "Voltage out of range" }, + { NULL, (0x84 << 16) + 0x064, "Frequency out of range" }, + { NULL, (0x84 << 16) + 0x065, "Overload" }, + { NULL, (0x84 << 16) + 0x066, "Over Charged" }, + { NULL, (0x84 << 16) + 0x067, "Over Temperature" }, + { NULL, (0x84 << 16) + 0x068, "Shutdown Requested" }, + { NULL, (0x84 << 16) + 0x069, "Shutdown Imminent" }, + { NULL, (0x84 << 16) + 0x06a, "Reserved" }, + { NULL, (0x84 << 16) + 0x06b, "Switch On/Off" }, + { NULL, (0x84 << 16) + 0x06c, "Switchable" }, + { NULL, (0x84 << 16) + 0x06d, "Used" }, + { NULL, (0x84 << 16) + 0x06e, "Boost" }, + { NULL, (0x84 << 16) + 0x06f, "Buck" }, + { NULL, (0x84 << 16) + 0x070, "Initialized" }, + { NULL, (0x84 << 16) + 0x071, "Tested" }, + { NULL, (0x84 << 16) + 0x072, "Awaiting Power" }, + { NULL, (0x84 << 16) + 0x073, "Communication Lost" }, + { NULL, (0x84 << 16) + 0x0fd, "iManufacturer" }, + { NULL, (0x84 << 16) + 0x0fe, "iProduct" }, + { NULL, (0x84 << 16) + 0x0ff, "iSerialNumber" }, + { NULL, (0x85 << 16) + 0x000, "Undefined" }, + { NULL, (0x85 << 16) + 0x001, "SMB Battery Mode" }, + { NULL, (0x85 << 16) + 0x002, "SMB Battery Status" }, + { NULL, (0x85 << 16) + 0x003, "SMB Alarm Warning" }, + { NULL, (0x85 << 16) + 0x004, "SMB Charger Mode" }, + { NULL, (0x85 << 16) + 0x005, "SMB Charger Status" }, + { NULL, (0x85 << 16) + 0x006, "SMB Charger Spec Info" }, + { NULL, (0x85 << 16) + 0x007, "SMB Selector State" }, + { NULL, (0x85 << 16) + 0x008, "SMB Selector Presets" }, + { NULL, (0x85 << 16) + 0x009, "SMB Selector Info" }, + { NULL, (0x85 << 16) + 0x010, "Optional Mfg. Function 1" }, + { NULL, (0x85 << 16) + 0x011, "Optional Mfg. Function 2" }, + { NULL, (0x85 << 16) + 0x012, "Optional Mfg. Function 3" }, + { NULL, (0x85 << 16) + 0x013, "Optional Mfg. Function 4" }, + { NULL, (0x85 << 16) + 0x014, "Optional Mfg. Function 5" }, + { NULL, (0x85 << 16) + 0x015, "Connection to SMBus" }, + { NULL, (0x85 << 16) + 0x016, "Output Connection" }, + { NULL, (0x85 << 16) + 0x017, "Charger Connection" }, + { NULL, (0x85 << 16) + 0x018, "Battery Insertion" }, + { NULL, (0x85 << 16) + 0x019, "Use Next" }, + { NULL, (0x85 << 16) + 0x01a, "OK to use" }, + { NULL, (0x85 << 16) + 0x01b, "Battery Supported" }, + { NULL, (0x85 << 16) + 0x01c, "SelectorRevision" }, + { NULL, (0x85 << 16) + 0x01d, "Charging Indicator" }, + { NULL, (0x85 << 16) + 0x028, "Manufacturer Access" }, + { NULL, (0x85 << 16) + 0x029, "Remaining Capacity Limit" }, + { NULL, (0x85 << 16) + 0x02a, "Remaining Time Limit" }, + { NULL, (0x85 << 16) + 0x02b, "At Rate" }, + { NULL, (0x85 << 16) + 0x02c, "Capacity Mode" }, + { NULL, (0x85 << 16) + 0x02d, "Broadcast To Charger" }, + { NULL, (0x85 << 16) + 0x02e, "Primary Battery" }, + { NULL, (0x85 << 16) + 0x02f, "Charge Controller" }, + { NULL, (0x85 << 16) + 0x040, "Terminate Charge" }, + { NULL, (0x85 << 16) + 0x041, "Terminate Discharge" }, + { NULL, (0x85 << 16) + 0x042, "Below Remaining Capacity Limit" }, + { NULL, (0x85 << 16) + 0x043, "Remaining Time Limit Expired" }, + { NULL, (0x85 << 16) + 0x044, "Charging" }, + { NULL, (0x85 << 16) + 0x045, "Discharging" }, + { NULL, (0x85 << 16) + 0x046, "Fully Charged" }, + { NULL, (0x85 << 16) + 0x047, "Fully Discharged" }, + { NULL, (0x85 << 16) + 0x048, "Conditioning Flag" }, + { NULL, (0x85 << 16) + 0x049, "At Rate OK" }, + { NULL, (0x85 << 16) + 0x04a, "SMB Error Code" }, + { NULL, (0x85 << 16) + 0x04b, "Need Replacement" }, + { NULL, (0x85 << 16) + 0x060, "At Rate Time To Full" }, + { NULL, (0x85 << 16) + 0x061, "At Rate Time To Empty" }, + { NULL, (0x85 << 16) + 0x062, "Average Current" }, + { NULL, (0x85 << 16) + 0x063, "Max Error" }, + { NULL, (0x85 << 16) + 0x064, "Relative State Of Charge" }, + { NULL, (0x85 << 16) + 0x065, "Absolute State Of Charge" }, + { NULL, (0x85 << 16) + 0x066, "Remaining Capacity" }, + { NULL, (0x85 << 16) + 0x067, "Full Charge Capacity" }, + { NULL, (0x85 << 16) + 0x068, "Run Time To Empty" }, + { NULL, (0x85 << 16) + 0x069, "Average Time To Empty" }, + { NULL, (0x85 << 16) + 0x06a, "Average Time To Full" }, + { NULL, (0x85 << 16) + 0x06b, "Cycle Count" }, + { NULL, (0x85 << 16) + 0x080, "Batt. Pack Model Level" }, + { NULL, (0x85 << 16) + 0x081, "Internal Charge Controller" }, + { NULL, (0x85 << 16) + 0x082, "Primary Battery Support" }, + { NULL, (0x85 << 16) + 0x083, "Design Capacity" }, + { NULL, (0x85 << 16) + 0x084, "Specification Info" }, + { NULL, (0x85 << 16) + 0x085, "Manufacturer Date" }, + { NULL, (0x85 << 16) + 0x086, "Serial Number" }, + { NULL, (0x85 << 16) + 0x087, "iManufacturerName" }, + { NULL, (0x85 << 16) + 0x088, "iDeviceName" }, + { NULL, (0x85 << 16) + 0x089, "iDeviceChemistry" }, + { NULL, (0x85 << 16) + 0x08a, "Manufacturer Data" }, + { NULL, (0x85 << 16) + 0x08b, "Rechargeable" }, + { NULL, (0x85 << 16) + 0x08c, "Warning Capacity Limit" }, + { NULL, (0x85 << 16) + 0x08d, "Capacity Granularity 1" }, + { NULL, (0x85 << 16) + 0x08e, "Capacity Granularity 2" }, + { NULL, (0x85 << 16) + 0x08f, "iOEMInformation" }, + { NULL, (0x85 << 16) + 0x0c0, "Inhibit Charge" }, + { NULL, (0x85 << 16) + 0x0c1, "Enable Polling" }, + { NULL, (0x85 << 16) + 0x0c2, "Reset To Zero" }, + { NULL, (0x85 << 16) + 0x0d0, "AC Present" }, + { NULL, (0x85 << 16) + 0x0d1, "Battery Present" }, + { NULL, (0x85 << 16) + 0x0d2, "Power Fail" }, + { NULL, (0x85 << 16) + 0x0d3, "Alarm Inhibited" }, + { NULL, (0x85 << 16) + 0x0d4, "Thermistor Under Range" }, + { NULL, (0x85 << 16) + 0x0d5, "Thermistor Hot" }, + { NULL, (0x85 << 16) + 0x0d6, "Thermistor Cold" }, + { NULL, (0x85 << 16) + 0x0d7, "Thermistor Over Range" }, + { NULL, (0x85 << 16) + 0x0d8, "Voltage Out Of Range" }, + { NULL, (0x85 << 16) + 0x0d9, "Current Out Of Range" }, + { NULL, (0x85 << 16) + 0x0da, "Current Not Regulated" }, + { NULL, (0x85 << 16) + 0x0db, "Voltage Not Regulated" }, + { NULL, (0x85 << 16) + 0x0dc, "Master Mode" }, + { NULL, (0x85 << 16) + 0x0f0, "Charger Selector Support" }, + { NULL, (0x85 << 16) + 0x0f1, "Charger Spec" }, + { NULL, (0x85 << 16) + 0x0f2, "Level 2" }, + { NULL, (0x85 << 16) + 0x0f3, "Level 3" }, + { NULL, (0xf0 << 16) + 0x0f1, "Cash Drawer" }, + { NULL, (0xf0 << 16) + 0x0f2, "Cash Drawer Number" }, + { NULL, (0xf0 << 16) + 0x0f3, "Cash Drawer Set" }, + { NULL, (0xf0 << 16) + 0x0f4, "Cash Drawer Status" }, + { NULL }, +}; + +/* dialects are represented as: + * langid + (dialectid << 10) + */ +static struct genericstrtable langids[] = +{ + { NULL, 0x0001 + (0x01 << 10), "Saudi Arabia" }, + { NULL, 0x0001 + (0x02 << 10), "Iraq" }, + { NULL, 0x0001 + (0x03 << 10), "Egypt" }, + { NULL, 0x0001 + (0x04 << 10), "Libya" }, + { NULL, 0x0001 + (0x05 << 10), "Algeria" }, + { NULL, 0x0001 + (0x06 << 10), "Morocco" }, + { NULL, 0x0001 + (0x07 << 10), "Tunesia" }, + { NULL, 0x0001 + (0x08 << 10), "Oman" }, + { NULL, 0x0001 + (0x09 << 10), "Yemen" }, + { NULL, 0x0001 + (0x0a << 10), "Syria" }, + { NULL, 0x0001 + (0x0b << 10), "Jordan" }, + { NULL, 0x0001 + (0x0c << 10), "Lebanon" }, + { NULL, 0x0001 + (0x0d << 10), "Kuwait" }, + { NULL, 0x0001 + (0x0e << 10), "U.A.E" }, + { NULL, 0x0001 + (0x0f << 10), "Bahrain" }, + { NULL, 0x0001 + (0x10 << 10), "Qatar" }, + { NULL, 0x0001, "Arabic" }, + { NULL, 0x0002, "Bulgarian" }, + { NULL, 0x0003, "Catalan" }, + { NULL, 0x0004 + (0x01 << 10), "Traditional" }, + { NULL, 0x0004 + (0x02 << 10), "Simplified" }, + { NULL, 0x0004 + (0x03 << 10), "Hongkong SAR, PRC" }, + { NULL, 0x0004 + (0x04 << 10), "Singapore" }, + { NULL, 0x0004 + (0x05 << 10), "Macau SAR" }, + { NULL, 0x0004, "Chinese" }, + { NULL, 0x0005, "Czech" }, + { NULL, 0x0006, "Danish" }, + { NULL, 0x0007 + (0x01 << 10), "German" }, + { NULL, 0x0007 + (0x02 << 10), "Swiss" }, + { NULL, 0x0007 + (0x03 << 10), "Austrian" }, + { NULL, 0x0007 + (0x04 << 10), "Luxembourg" }, + { NULL, 0x0007 + (0x05 << 10), "Liechtenstein" }, + { NULL, 0x0007, "German" }, + { NULL, 0x0008, "Greek" }, + { NULL, 0x0009 + (0x01 << 10), "US" }, + { NULL, 0x0009 + (0x02 << 10), "UK" }, + { NULL, 0x0009 + (0x03 << 10), "Australian" }, + { NULL, 0x0009 + (0x04 << 10), "Canadian" }, + { NULL, 0x0009 + (0x05 << 10), "New Zealand" }, + { NULL, 0x0009 + (0x06 << 10), "Ireland" }, + { NULL, 0x0009 + (0x07 << 10), "South Africa" }, + { NULL, 0x0009 + (0x08 << 10), "Jamaica" }, + { NULL, 0x0009 + (0x09 << 10), "Carribean" }, + { NULL, 0x0009 + (0x0a << 10), "Belize" }, + { NULL, 0x0009 + (0x0b << 10), "Trinidad" }, + { NULL, 0x0009 + (0x0c << 10), "Zimbabwe" }, + { NULL, 0x0009 + (0x0d << 10), "Philippines" }, + { NULL, 0x0009, "English" }, + { NULL, 0x000a + (0x01 << 10), "Castilian" }, + { NULL, 0x000a + (0x02 << 10), "Mexican" }, + { NULL, 0x000a + (0x03 << 10), "Modern" }, + { NULL, 0x000a + (0x04 << 10), "Guatemala" }, + { NULL, 0x000a + (0x05 << 10), "Costa Rica" }, + { NULL, 0x000a + (0x06 << 10), "Panama" }, + { NULL, 0x000a + (0x07 << 10), "Dominican Republic" }, + { NULL, 0x000a + (0x08 << 10), "Venzuela" }, + { NULL, 0x000a + (0x09 << 10), "Colombia" }, + { NULL, 0x000a + (0x0a << 10), "Peru" }, + { NULL, 0x000a + (0x0b << 10), "Argentina" }, + { NULL, 0x000a + (0x0c << 10), "Ecuador" }, + { NULL, 0x000a + (0x0d << 10), "Chile" }, + { NULL, 0x000a + (0x0e << 10), "Uruguay" }, + { NULL, 0x000a + (0x0f << 10), "Paraguay" }, + { NULL, 0x000a + (0x10 << 10), "Bolivia" }, + { NULL, 0x000a + (0x11 << 10), "El Salvador" }, + { NULL, 0x000a + (0x12 << 10), "Honduras" }, + { NULL, 0x000a + (0x13 << 10), "Nicaragua" }, + { NULL, 0x000a + (0x14 << 10), "Puerto Rico" }, + { NULL, 0x000a, "Spanish" }, + { NULL, 0x000b, "Finnish" }, + { NULL, 0x000c + (0x01 << 10), "French" }, + { NULL, 0x000c + (0x02 << 10), "Belgian" }, + { NULL, 0x000c + (0x03 << 10), "Canadian" }, + { NULL, 0x000c + (0x04 << 10), "Swiss" }, + { NULL, 0x000c + (0x05 << 10), "Luxembourg" }, + { NULL, 0x000c + (0x06 << 10), "Monaco" }, + { NULL, 0x000c, "French" }, + { NULL, 0x000d, "Hebrew" }, + { NULL, 0x000e, "Hungarian" }, + { NULL, 0x000f, "Idelandic" }, + { NULL, 0x0010 + (0x01 << 10), "Italian" }, + { NULL, 0x0010 + (0x02 << 10), "Swiss" }, + { NULL, 0x0010, "Italian" }, + { NULL, 0x0011, "Japanese" }, + { NULL, 0x0012 + (0x01 << 10), "Korean" }, + { NULL, 0x0012, "Korean" }, + { NULL, 0x0013 + (0x01 << 10), "Dutch" }, + { NULL, 0x0013 + (0x02 << 10), "Belgian" }, + { NULL, 0x0013, "Dutch" }, + { NULL, 0x0014 + (0x01 << 10), "Bokmal" }, + { NULL, 0x0014 + (0x02 << 10), "Nynorsk" }, + { NULL, 0x0014, "Norwegian" }, + { NULL, 0x0015, "Polish" }, + { NULL, 0x0016 + (0x01 << 10), "Portuguese" }, + { NULL, 0x0016 + (0x02 << 10), "Brazilian" }, + { NULL, 0x0016, "Portuguese" }, + { NULL, 0x0017, "forgotten" }, + { NULL, 0x0018, "Romanian" }, + { NULL, 0x0019, "Russian" }, + { NULL, 0x001a + (0x01 << 10), "Croatian" }, + { NULL, 0x001a + (0x02 << 10), "Latin" }, + { NULL, 0x001a + (0x03 << 10), "Cyrillic" }, + { NULL, 0x001a, "Serbian" }, + { NULL, 0x001b, "Slovak" }, + { NULL, 0x001c, "Albanian" }, + { NULL, 0x001d + (0x01 << 10), "Swedish" }, + { NULL, 0x001d + (0x02 << 10), "Finland" }, + { NULL, 0x001d, "Swedish" }, + { NULL, 0x001e, "Thai" }, + { NULL, 0x001f, "Turkish" }, + { NULL, 0x0020 + (0x01 << 10), "Pakistan" }, + { NULL, 0x0020 + (0x02 << 10), "India" }, + { NULL, 0x0020, "Urdu" }, + { NULL, 0x0021, "Indonesian" }, + { NULL, 0x0022, "Ukrainian" }, + { NULL, 0x0023, "Belarusian" }, + { NULL, 0x0024, "Slovenian" }, + { NULL, 0x0025, "Estonian" }, + { NULL, 0x0026, "Latvian" }, + { NULL, 0x0027 + (0x01 << 10), "Lithuanian" }, + { NULL, 0x0027, "Lithuanian" }, + { NULL, 0x0028, "forgotten" }, + { NULL, 0x0029, "Farsi" }, + { NULL, 0x002a, "Vietnamese" }, + { NULL, 0x002b, "Armenian" }, + { NULL, 0x002c + (0x01 << 10), "Cyrillic" }, + { NULL, 0x002c + (0x02 << 10), "Latin" }, + { NULL, 0x002c, "Azeri" }, + { NULL, 0x002d, "Basque" }, + { NULL, 0x002e, "forgotten" }, + { NULL, 0x002f, "Macedonian" }, + { NULL, 0x0036, "Afrikaans" }, + { NULL, 0x0037, "Georgian" }, + { NULL, 0x0038, "Faeroese" }, + { NULL, 0x0039, "Hindi" }, + { NULL, 0x003e + (0x01 << 10), "Malaysia" }, + { NULL, 0x003e + (0x02 << 10), "Brunei Darassalam" }, + { NULL, 0x003e, "Malay" }, + { NULL, 0x003f, "Kazak" }, + { NULL, 0x0041, "Awahili" }, + { NULL, 0x0043 + (0x01 << 10), "Latin" }, + { NULL, 0x0043 + (0x02 << 10), "Cyrillic" }, + { NULL, 0x0043, "Uzbek" }, + { NULL, 0x0044, "Tatar" }, + { NULL, 0x0045, "Bengali" }, + { NULL, 0x0046, "Punjabi" }, + { NULL, 0x0047, "Gujarati" }, + { NULL, 0x0048, "Oriya" }, + { NULL, 0x0049, "Tamil" }, + { NULL, 0x004a, "Telugu" }, + { NULL, 0x004b, "Kannada" }, + { NULL, 0x004c, "Malayalam" }, + { NULL, 0x004d, "Assamese" }, + { NULL, 0x004e, "Marathi" }, + { NULL, 0x004f, "Sanskrit" }, + { NULL, 0x0057, "Konkani" }, + { NULL, 0x0058, "Manipuri" }, + { NULL, 0x0059, "Sindhi" }, + { NULL, 0x0060 + (0x02 << 10), "India" }, + { NULL, 0x0060, "Kashmiri" }, + { NULL, 0x0061 + (0x02 << 10), "India" }, + { NULL, 0x0061, "Nepali" }, + { NULL }, +}; + +static struct genericstrtable countrycodes[] = +{ + { NULL, 0, "Not supported" }, + { NULL, 1, "Arabic" }, + { NULL, 2, "Belgian" }, + { NULL, 3, "Canadian-Bilingual" }, + { NULL, 4, "Canadian-French" }, + { NULL, 5, "Czech Republic" }, + { NULL, 6, "Danish" }, + { NULL, 7, "Finnish" }, + { NULL, 8, "French" }, + { NULL, 9, "German" }, + { NULL, 10, "Greek" }, + { NULL, 11, "Hebrew" }, + { NULL, 12, "Hungary" }, + { NULL, 13, "International (ISO)" }, + { NULL, 14, "Italian" }, + { NULL, 15, "Japan (Katakana)" }, + { NULL, 16, "Korean" }, + { NULL, 17, "Latin American" }, + { NULL, 18, "Netherlands/Dutch" }, + { NULL, 19, "Norwegian" }, + { NULL, 20, "Persian (Farsi)" }, + { NULL, 21, "Poland" }, + { NULL, 22, "Portuguese" }, + { NULL, 23, "Russia" }, + { NULL, 24, "Slovakia" }, + { NULL, 25, "Spanish" }, + { NULL, 26, "Swedish" }, + { NULL, 27, "Swiss/French" }, + { NULL, 28, "Swiss/German" }, + { NULL, 29, "Switzerland" }, + { NULL, 30, "Taiwan" }, + { NULL, 31, "Turkish-Q" }, + { NULL, 32, "UK" }, + { NULL, 33, "US" }, + { NULL, 34, "Yugoslavia" }, + { NULL, 35, "Turkish-F" }, + { NULL }, +}; + +/* ---------------------------------------------------------------------- */ +#endif /* _USB_SPEC_H */ diff --git a/usbhid-dump.8.in b/usbhid-dump.8.in new file mode 100644 index 0000000..b4c90d0 --- /dev/null +++ b/usbhid-dump.8.in @@ -0,0 +1,102 @@ +.\"SPDX-License-Identifier: GPL-2.0-or-later +.\" Copyright Nikolai Kondrashov <spbnick@gmail.com> +.TH usbhid-dump "8" "February 2012" "usbutils-VERSION" "Linux USB Utilities" +.IX usbhid-dump +.SH NAME +usbhid-dump \- dump USB HID device report descriptors and streams +.SH SYNOPSIS +.B usbhid-dump +[OPTION]... +.SH DESCRIPTION +.B usbhid-dump +uses +.B libusb +to dump report descriptors and streams from HID (human interface device) +interfaces of USB devices. By default, it dumps HID interfaces of all +connected USB devices, but could be limited to a subset of them, or to a single +interface, using options. + +NOTE: usbhid-dump detaches kernel drivers from the interfaces it dumps and uses +them exclusively, so no other program receives the input in the meantime. The +report descriptor dumping is instantaneous, but the stream dumping continues +until terminated with SIGINT (^C from the terminal) or a timeout expires. + +If you accidentally start dumping a stream from the USB keyboard you use to +control the terminal, the system will stop receiving the input and you won't +be able to terminate usbhid-dump. Just stop your input and wait until the +timeout expires. The stream dumping will stop, the keyboard will be +reattached to the kernel driver and you will regain control. + +The default stream dumping timeout is 60 seconds and could be changed with the +-t option. +.SH OPTIONS +.TP +.B -h, --help +Output a help message and exit. +.TP +.B -v, --version +Output version information and exit. +.TP +.B -s, -a, --address=bus[:dev] +Limit interfaces by bus number and device address. Both 1-255, decimal. +Zeroes match any bus or device. +.TP +.B -d, -m, --model=vid[:pid] +Limit interfaces by device vendor and product IDs. Both 1-FFFF, hexadecimal. +Zeroes match any vendor or product. +.TP +.B -i, --interface=NUMBER +Limit interfaces by number (0-254), decimal. 255 matches any interface. +.TP +.B -e, --entity=STRING +The entity to dump: either "descriptor", "stream" or "all". The value can be +abbreviated down to one letter. The default is "descriptor". +.TP +.B -t, --stream-timeout=NUMBER +Stream interrupt transfer timeout, ms. Zero means infinity. The default is +60000 (60 seconds). +.TP +.B -p, --stream-paused +Start with the stream dump output paused. +.TP +.B -f, --stream-feedback +Enable stream dumping feedback: print a dot to stderr for every transfer +dumped. +.SH SIGNALS +.TP +.B USR1/USR2 +Pause/resume stream dump output. +.SH OUTPUT FORMAT +.B usbhid-dump +outputs dumps in chunks. Each chunk is separated by an empty line and starts +with the following header line: + +BUS:DEVICE:INTERFACE:ENTITY TIMESTAMP + +Here, BUS, DEVICE and INTERFACE are bus, device and interface numbers +respectively. ENTITY is either "DESCRIPTOR" or "STREAM". TIMESTAMP is +timestamp in seconds since epoch. + +After the header the actual dump data follows as hex bytes. A descriptor +chunk includes the whole report descriptor. Every stream chunk includes a +whole report, usually, but if a report is bigger than endpoint's +wMaxPacketSize, it will span several chunks. +.SH EXAMPLES +.TP +Dump report descriptor for a device with address 3 on bus number 2: +.B usbhid-dump -a 2:3 + +.TP +Dump report stream for a device with vendor ID 0x5543 and product ID 0x0005: +.B usbhid-dump -m 5543:0005 -es + +.TP +Dump report descriptor from interface 1 of a device with vendor ID 0x5543: +.B usbhid-dump -m 5543 -i 1 -ed + +.TP +Dump report streams from all HID interfaces of all USB devices (caution: you will lose control over the terminal if you use USB keyboard): +.B usbhid-dump -es + +.SH AUTHOR +Nikolai Kondrashov <spbnick@gmail.com> diff --git a/usbhid-dump/ChangeLog b/usbhid-dump/ChangeLog new file mode 100644 index 0000000..79d4914 --- /dev/null +++ b/usbhid-dump/ChangeLog @@ -0,0 +1 @@ +# Dummy ChangeLog, replaced with git log when distribution is created. diff --git a/usbhid-dump/Makefile.am b/usbhid-dump/Makefile.am new file mode 100644 index 0000000..3ba22f0 --- /dev/null +++ b/usbhid-dump/Makefile.am @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2009-2010 Nikolai Kondrashov +# +# This file is part of usbhid-dump. + +SUBDIRS = src + +dist_noinst_SCRIPTS = bootstrap + +dist-hook: + @set -e; \ + if test -d "$(srcdir)/.git"; then \ + echo Generating ChangeLog; \ + ( cd "$(srcdir)" && auxdir/missing --run git log ) > \ + ChangeLog.tmp; \ + mv -f ChangeLog.tmp "$(distdir)/ChangeLog"; \ + else \ + echo Skipping ChangeLog generation: no .git directory >&2; \ + fi + diff --git a/usbhid-dump/Makefile.in b/usbhid-dump/Makefile.in new file mode 100644 index 0000000..9e77503 --- /dev/null +++ b/usbhid-dump/Makefile.in @@ -0,0 +1,802 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2009-2010 Nikolai Kondrashov +# +# This file is part of usbhid-dump. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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 = : +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(dist_noinst_SCRIPTS) \ + $(am__DIST_COMMON) +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 = +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(dist_noinst_SCRIPTS) +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 +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 distdir-am 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)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + ChangeLog NEWS README.md compile depcomp install-sh missing +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" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi +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_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +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@ +runstatedir = @runstatedir@ +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@ +SUBDIRS = src +dist_noinst_SCRIPTS = bootstrap +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) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign 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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + 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 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +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 + +# 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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(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 + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -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) | eval GZIP= gzip $(GZIP_ENV) -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-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -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*) \ + eval GZIP= gzip $(GZIP_ENV) -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*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(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/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(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 $(SCRIPTS) config.h +installdirs: installdirs-recursive +installdirs-am: +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) + +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 mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +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 + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.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 \ + cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ + dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ + dist-zip dist-zstd distcheck distclean distclean-generic \ + distclean-hdr 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-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +dist-hook: + @set -e; \ + if test -d "$(srcdir)/.git"; then \ + echo Generating ChangeLog; \ + ( cd "$(srcdir)" && auxdir/missing --run git log ) > \ + ChangeLog.tmp; \ + mv -f ChangeLog.tmp "$(distdir)/ChangeLog"; \ + else \ + echo Skipping ChangeLog generation: no .git directory >&2; \ + fi + +# 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: diff --git a/usbhid-dump/NEWS b/usbhid-dump/NEWS new file mode 100644 index 0000000..4c7e40d --- /dev/null +++ b/usbhid-dump/NEWS @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2010 Nikolai Kondrashov + +2014-11-11: 1.4 + * Request report descriptor with size specified in the interface descriptor + to fix retrieval with some devices (e.g. Waltop Vega Tablet) which + would produce ERROR_PIPE otherwise. + * Add missing stdint.h includes to fix Gentoo/FreeBSD build issues. + * Add README.md + +2011-02-05: 1.3 + * Add manual page. + * Fix several build issues. + * Fix infinite loop in command-line option parsing on unsigned char + platforms. + +2010-11-20: 1.2 + * Command line parameters are removed, now all HID interfaces + of all USB devices are dumped by default. This may include the + keyboard controlling the terminal, for example, please be careful. + * Added device selection limiting options: -s, -a, --address=bus[:dev] + to limit by bus number and/or device address and -d, -m, + --model=vid[:pid] to limit by vendor and/or product. + * Added interface number limiting option -i, --interface=NUMBER. + * Added stream interrupt transfer timeout option -t, + --stream-timeout=NUMBER, which is set to 1 minute by default to + allow recovery of accidentially captured terminal input device. + This timeout is printed on the start of stream dumping. + +2010-08-24: 1.1 + * Renamed to usbhid-dump + * Fix handling of responses to unsupported HID requests + * Renamed dump entity "both" to "all" + +2010-07-25: 1.0 + * Report descriptor dumping support + * Report stream dumping support + * Report stream dumping feedback and output pausing support diff --git a/usbhid-dump/README.md b/usbhid-dump/README.md new file mode 100644 index 0000000..001b858 --- /dev/null +++ b/usbhid-dump/README.md @@ -0,0 +1,126 @@ +<!--- +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2010 Nikolai Kondrashov +--> + +Usbhid-dump +=========== + +Usbhid-dump is a USB HID dumping utility based on libusb 1.0. It dumps USB HID device report descriptors and reports themselves as they are being sent, for all or specific device interfaces. + +Installation +------------ + +Run `./configure && make` to build and `make install` to install. If building from a Git tree, run `./bootstrap` first. Usbhid-dump can also be run directly from the source directory as `src/usbhid-dump`, without installation. + +Usage +----- + +Here is the output of `usbhid-dump --help`: + + $ usbhid-dump --help + Usage: usbhid-dump [OPTION]... + Dump USB device HID report descriptor(s) and/or stream(s). + + Options: + -h, --help output this help message and exit + -v, --version output version information and exit + + -s, -a, --address=bus[:dev] limit interfaces by bus number + (1-255) and device address (1-255), + decimal; zeroes match any + -d, -m, --model=vid[:pid] limit interfaces by vendor and + product IDs (0001-ffff), hexadecimal; + zeroes match any + -i, --interface=NUMBER limit interfaces by number (0-254), + decimal; 255 matches any + + -e, --entity=STRING what to dump: either "descriptor", + "stream" or "all"; value can be + abbreviated + + -t, --stream-timeout=NUMBER stream interrupt transfer timeout, ms; + zero means infinity + -p, --stream-paused start with the stream dump output + paused + -f, --stream-feedback enable stream dumping feedback: for + every transfer dumped a dot is + printed to stderr + + Default options: --stream-timeout=60000 --entity=descriptor + + Signals: + USR1/USR2 pause/resume the stream dump output + + +**Warning:** please be careful running usbhid-dump as a superuser without limiting your device selection with options. Usbhid-dump will try to dump every device possible and If you're using a USB keyboard to control your terminal, it will be detached and you will be unable to terminate usbhid-dump and regain control. + +If that happens just don't touch your keyboard for the duration of the interrupt transfer timeout (1 minute by default) and the dumping will be aborted. + +Here is an example of a report descriptor and stream dump from a mouse: + + $ sudo usbhid-dump --entity=all --address=2:3 + 002:003:000:DESCRIPTOR         1290272184.081322 +  05 01 09 02 A1 01 09 01 A1 00 05 09 19 01 29 03 +  15 00 25 01 75 01 95 03 81 02 75 05 95 01 81 01 +  05 01 09 30 09 31 09 38 15 81 25 7F 75 08 95 03 +  81 06 C0 C0 + + Starting dumping interrupt transfer stream + with 1 minute timeout. + + 002:003:000:STREAM             1290272185.210022 +  00 FF 00 00 + + 002:003:000:STREAM             1290272185.217988 +  00 FE 00 00 + + 002:003:000:STREAM             1290272185.225985 +  00 FC 01 00 + + 002:003:000:STREAM             1290272185.233995 +  00 FE 01 00 + + 002:003:000:STREAM             1290272185.241992 +  00 FF 01 00 + + 002:003:000:STREAM             1290272185.249995 +  00 FE 02 00 + + 002:003:000:STREAM             1290272185.257993 +  00 FF 01 00 + + ^C + +In the output above "002" is the bus number, "003" is the device address and "000" is the interface number. "DESCRIPTOR" indicates descriptor chunk and "STREAM" - stream chunk. The number to the right is the timestamp in seconds since epoch. The hexadecimal numbers below is the chunk dump itself. Usually every stream chunk includes a whole report, but if the report is bigger than endpoint's wMaxPacketSize, it will span several chunks. + +You can use usbhid-dump along with [hidrd-convert](https://github.com/DIGImend/hidrd) to dump report descriptors in human-readable format. Like this: + + $ sudo usbhid-dump -a2:3 -i0 | grep -v : | xxd -r -p | hidrd-convert -o spec + Usage Page (Desktop),               ; Generic desktop controls (01h) + Usage (Mouse),                      ; Mouse (02h, application collection) + Collection (Application), +     Usage (Pointer),                ; Pointer (01h, physical collection) +     Collection (Physical), +         Usage Page (Button),        ; Button (09h) +         Usage Minimum (01h), +         Usage Maximum (03h), +         Logical Minimum (0), +         Logical Maximum (1), +         Report Size (1), +         Report Count (3), +         Input (Variable), +         Report Size (5), +         Report Count (1), +         Input (Constant), +         Usage Page (Desktop),       ; Generic desktop controls (01h) +         Usage (X),                  ; X (30h, dynamic value) +         Usage (Y),                  ; Y (31h, dynamic value) +         Usage (Wheel),              ; Wheel (38h, dynamic value) +         Logical Minimum (-127), +         Logical Maximum (127), +         Report Size (8), +         Report Count (3), +         Input (Variable, Relative), +     End Collection, + End Collection diff --git a/usbhid-dump/aclocal.m4 b/usbhid-dump/aclocal.m4 new file mode 100644 index 0000000..464ead6 --- /dev/null +++ b/usbhid-dump/aclocal.m4 @@ -0,0 +1,1530 @@ +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. + +# 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. + +# 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. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + +dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.1]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.16' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.5])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# 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. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# 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. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: <https://www.gnu.org/software/coreutils/>. + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# +# 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. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# 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. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2021 Free Software Foundation, Inc. +# +# 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. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + AM_RUN_LOG([cat conftest.dir/file]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/usbhid-dump/bootstrap b/usbhid-dump/bootstrap new file mode 100755 index 0000000..7574b3d --- /dev/null +++ b/usbhid-dump/bootstrap @@ -0,0 +1,28 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2010 Nikolai Kondrashov +# +# This file is part of usbhid-dump. +# +# Usbhid-dump 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 of the License, or +# (at your option) any later version. +# +# Usbhid-dump 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 usbhid-dump; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# Fail on any error +set -e + +cat > ChangeLog <<CUT +# Dummy ChangeLog, replaced with git log when distribution is created. +CUT + +autoreconf -i -f diff --git a/usbhid-dump/compile b/usbhid-dump/compile new file mode 100755 index 0000000..df363c8 --- /dev/null +++ b/usbhid-dump/compile @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 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 <https://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* | MSYS*) + 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/* | msys/*) + 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 | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/usbhid-dump/config.h.in b/usbhid-dump/config.h.in new file mode 100644 index 0000000..fae6da8 --- /dev/null +++ b/usbhid-dump/config.h.in @@ -0,0 +1,154 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `libusb_set_option' function. */ +#undef HAVE_LIBUSB_SET_OPTION + +/* Define to 1 if you have the <minix/config.h> header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_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 you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_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 1 if you have the <wchar.h> header file. */ +#undef HAVE_WCHAR_H + +/* 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 + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + +/* Version number of package */ +#undef VERSION diff --git a/usbhid-dump/configure b/usbhid-dump/configure new file mode 100755 index 0000000..ba02b61 --- /dev/null +++ b/usbhid-dump/configure @@ -0,0 +1,6319 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for usbhid-dump 1.4. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi +if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 </dev/null +exec 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='usbhid-dump' +PACKAGE_TARNAME='usbhid-dump' +PACKAGE_VERSION='1.4' +PACKAGE_STRING='usbhid-dump 1.4' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stddef.h> +#ifdef HAVE_STDIO_H +# include <stdio.h> +#endif +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_header_c_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +LIBUSB_LIBS +LIBUSB_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_maintainer_mode +enable_dependency_tracking +enable_debug +enable_tests_install +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +LIBUSB_CFLAGS +LIBUSB_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures usbhid-dump 1.4 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/usbhid-dump] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of usbhid-dump 1.4:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-debug enable debugging features + --enable-tests-install enable installation of tests + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + LIBUSB_CFLAGS + C compiler flags for LIBUSB, overriding pkg-config + LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +usbhid-dump configure 1.4 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include <limits.h> +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by usbhid-dump $as_me 1.4, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include <stddef.h> +#include <stdarg.h> +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include <stdbool.h> +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" + +# Auxiliary files required by this configure script. +ac_aux_files="compile missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +am__api_version='1.16' + + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='usbhid-dump' + VERSION='1.4' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: <https://www.gnu.org/software/coreutils/>. + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test ${enable_maintainer_mode+y} +then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else $as_nop + USE_MAINTAINER_MODE=no +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + + + + + + + + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_safe_to_define___extensions__=yes +else $as_nop + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <wchar.h> + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 500 + #include <wchar.h> + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi + + +ac_config_headers="$ac_config_headers config.h" + + +# To have empty CFLAGS instead of undefined and '-g -O2' by default +CFLAGS=$CFLAGS +CFLAGS="-Os -Wall $CFLAGS" +ABS_SRCDIR=`cd ${srcdir} ; pwd` +ABS_BUILDDIR=`pwd` +CPPFLAGS="-I${ABS_BUILDDIR} -DNDEBUG $CPPFLAGS" + + +# +# Checks for programs. +# + +# +# Checks for libraries. +# + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5 +printf %s "checking for LIBUSB... " >&6; } + +if test -n "$LIBUSB_CFLAGS"; then + pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0 >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUSB_LIBS"; then + pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb-1.0 >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libusb-1.0 >= 1.0.0" 2>&1` + else + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libusb-1.0 >= 1.0.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUSB_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libusb-1.0 >= 1.0.0) were not met: + +$LIBUSB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details" "$LINENO" 5; } +else + LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS + LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +fi +CFLAGS="$CFLAGS $LIBUSB_CFLAGS" +LIBS="$LIBS $LIBUSB_LIBS" + +# +# Checks for features +# +# Check whether --enable-debug was given. +if test ${enable_debug+y} +then : + enableval=$enable_debug; +else $as_nop + enable_debug="no" +fi + + +# Check whether --enable-tests-install was given. +if test ${enable_tests_install+y} +then : + enableval=$enable_tests_install; +else $as_nop + enable_tests_install="no" +fi + + +# Output features to preprocessor and compiler +if test "$enable_debug" = "yes"; then + CPPFLAGS="$CPPFLAGS -UNDEBUG" + CFLAGS="$CFLAGS -Wextra -Werror -g -O0" +fi + +# +# Checks for header files. +# + +# +# Checks for typedefs, structures, and compiler characteristics. +# + +# +# Checks for declarations +# + +# +# Checks for library functions. +# +ac_fn_c_check_func "$LINENO" "libusb_set_option" "ac_cv_func_libusb_set_option" +if test "x$ac_cv_func_libusb_set_option" = xyes +then : + printf "%s\n" "#define HAVE_LIBUSB_SET_OPTION 1" >>confdefs.h + +fi + + +# +# Output +# +ac_config_files="$ac_config_files Makefile src/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi +if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by usbhid-dump $as_me 1.4, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +usbhid-dump config.status 1.4 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' <confdefs.h | sed ' +s/'"$ac_delim"'/"\\\ +"/g' >>$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + diff --git a/usbhid-dump/configure.ac b/usbhid-dump/configure.ac new file mode 100644 index 0000000..f07e47a --- /dev/null +++ b/usbhid-dump/configure.ac @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2010-2011 Nikolai Kondrashov +# +# This file is part of usbhid-dump. + +AC_PREREQ(2.61) +AC_INIT([usbhid-dump], [1.4]) +AM_INIT_AUTOMAKE([1.9 -Wall foreign]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AM_MAINTAINER_MODE + +AC_USE_SYSTEM_EXTENSIONS + +AC_CONFIG_HEADERS([config.h]) + +# To have empty CFLAGS instead of undefined and '-g -O2' by default +CFLAGS=$CFLAGS +CFLAGS="-Os -Wall $CFLAGS" +ABS_SRCDIR=`cd ${srcdir} ; pwd` +ABS_BUILDDIR=`pwd` +CPPFLAGS="-I${ABS_BUILDDIR} -DNDEBUG $CPPFLAGS" + + +# +# Checks for programs. +# + +# +# Checks for libraries. +# +PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.0) +CFLAGS="$CFLAGS $LIBUSB_CFLAGS" +LIBS="$LIBS $LIBUSB_LIBS" + +# +# Checks for features +# +AC_ARG_ENABLE( + debug, + AS_HELP_STRING([--enable-debug], [enable debugging features]), + [], [enable_debug="no"]) + +AC_ARG_ENABLE( + tests-install, + AS_HELP_STRING([--enable-tests-install], [enable installation of tests]), + [], [enable_tests_install="no"]) + +# Output features to preprocessor and compiler +if test "$enable_debug" = "yes"; then + CPPFLAGS="$CPPFLAGS -UNDEBUG" + CFLAGS="$CFLAGS -Wextra -Werror -g -O0" +fi + +# +# Checks for header files. +# + +# +# Checks for typedefs, structures, and compiler characteristics. +# + +# +# Checks for declarations +# + +# +# Checks for library functions. +# +AC_CHECK_FUNCS(libusb_set_option) + +# +# Output +# +AC_CONFIG_FILES([Makefile + src/Makefile]) +AC_OUTPUT diff --git a/usbhid-dump/depcomp b/usbhid-dump/depcomp new file mode 100755 index 0000000..715e343 --- /dev/null +++ b/usbhid-dump/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 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 <https://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" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + 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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/usbhid-dump/install-sh b/usbhid-dump/install-sh new file mode 100755 index 0000000..ec298b5 --- /dev/null +++ b/usbhid-dump/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # 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. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# 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_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +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 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. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -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 + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +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 + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +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 + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +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=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + 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. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # 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 + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # 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 + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + 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=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_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 && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $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` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # 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 "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/usbhid-dump/missing b/usbhid-dump/missing new file mode 100755 index 0000000..1fe1611 --- /dev/null +++ b/usbhid-dump/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1996-2021 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 <https://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=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://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 'autom4te' 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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/usbhid-dump/src/Makefile.am b/usbhid-dump/src/Makefile.am new file mode 100644 index 0000000..262bb74 --- /dev/null +++ b/usbhid-dump/src/Makefile.am @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2010 Nikolai Kondrashov + +noinst_HEADERS = \ + dev.h \ + dev_list.h \ + iface.h \ + iface_list.h \ + misc.h + +bin_PROGRAMS = usbhid-dump + +usbhid_dump_SOURCES = \ + dev.c \ + dev_list.c \ + iface.c \ + iface_list.c \ + usbhid-dump.c diff --git a/usbhid-dump/src/Makefile.in b/usbhid-dump/src/Makefile.in new file mode 100644 index 0000000..5fadc80 --- /dev/null +++ b/usbhid-dump/src/Makefile.in @@ -0,0 +1,609 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2010 Nikolai Kondrashov + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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 = : +bin_PROGRAMS = usbhid-dump$(EXEEXT) +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_usbhid_dump_OBJECTS = dev.$(OBJEXT) dev_list.$(OBJEXT) \ + iface.$(OBJEXT) iface_list.$(OBJEXT) usbhid-dump.$(OBJEXT) +usbhid_dump_OBJECTS = $(am_usbhid_dump_OBJECTS) +usbhid_dump_LDADD = $(LDADD) +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__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/dev.Po ./$(DEPDIR)/dev_list.Po \ + ./$(DEPDIR)/iface.Po ./$(DEPDIR)/iface_list.Po \ + ./$(DEPDIR)/usbhid-dump.Po +am__mv = mv -f +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 = $(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 = $(usbhid_dump_SOURCES) +DIST_SOURCES = $(usbhid_dump_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_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)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +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@ +runstatedir = @runstatedir@ +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@ +noinst_HEADERS = \ + dev.h \ + dev_list.h \ + iface.h \ + iface_list.h \ + misc.h + +usbhid_dump_SOURCES = \ + dev.c \ + dev_list.c \ + iface.c \ + iface_list.c \ + usbhid-dump.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(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) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + 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-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +usbhid-dump$(EXEEXT): $(usbhid_dump_OBJECTS) $(usbhid_dump_DEPENDENCIES) $(EXTRA_usbhid_dump_DEPENDENCIES) + @rm -f usbhid-dump$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(usbhid_dump_OBJECTS) $(usbhid_dump_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dev.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dev_list.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iface.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iface_list.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usbhid-dump.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.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 -o $@ $< + +.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 -o $@ `$(CYGPATH_W) '$<'` + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(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 $(PROGRAMS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; 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-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/dev.Po + -rm -f ./$(DEPDIR)/dev_list.Po + -rm -f ./$(DEPDIR)/iface.Po + -rm -f ./$(DEPDIR)/iface_list.Po + -rm -f ./$(DEPDIR)/usbhid-dump.Po + -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-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +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 -f ./$(DEPDIR)/dev.Po + -rm -f ./$(DEPDIR)/dev_list.Po + -rm -f ./$(DEPDIR)/iface.Po + -rm -f ./$(DEPDIR)/iface_list.Po + -rm -f ./$(DEPDIR)/usbhid-dump.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS 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-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS + +.PRECIOUS: Makefile + + +# 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: diff --git a/usbhid-dump/src/dev.c b/usbhid-dump/src/dev.c new file mode 100644 index 0000000..1978496 --- /dev/null +++ b/usbhid-dump/src/dev.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - device + * + * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#include "config.h" + +#include "dev.h" +#include <assert.h> +#include <stdlib.h> + +bool +uhd_dev_valid(const uhd_dev *dev) +{ + return dev != NULL && + dev->handle != NULL; +} + + +enum libusb_error +uhd_dev_open(libusb_device *lusb_dev, + uhd_dev **pdev) +{ + enum libusb_error err; + uhd_dev *dev; + + assert(lusb_dev != NULL); + + dev = malloc(sizeof(*dev)); + if (dev == NULL) + return LIBUSB_ERROR_NO_MEM; + + dev->next = NULL; + + err = libusb_open(lusb_dev, &dev->handle); + if (err != LIBUSB_SUCCESS) + { + free(dev); + return err; + } + + assert(uhd_dev_valid(dev)); + + if (pdev != NULL) + *pdev = dev; + else + { + libusb_close(dev->handle); + free(dev); + } + + return LIBUSB_SUCCESS; +} + + +void +uhd_dev_close(uhd_dev *dev) +{ + if (dev == NULL) + return; + + assert(uhd_dev_valid(dev)); + + libusb_close(dev->handle); + dev->handle = NULL; + + free(dev); +} + + diff --git a/usbhid-dump/src/dev.h b/usbhid-dump/src/dev.h new file mode 100644 index 0000000..3f647a5 --- /dev/null +++ b/usbhid-dump/src/dev.h @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - device + * + * Copyright (C) 2010-2011 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#ifndef __UHD_DEV_H__ +#define __UHD_DEV_H__ + +#include <stdbool.h> +#include <libusb.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** usbhid-dump device */ +typedef struct uhd_dev uhd_dev; + +struct uhd_dev { + uhd_dev *next; /**< Next device in the list */ + libusb_device_handle *handle; /**< Handle */ +}; + +/** + * Check if a device is valid. + * + * @param dev Device to check. + * + * @return True if the device is valid, false otherwise. + */ +extern bool uhd_dev_valid(const uhd_dev *dev); + +/** + * Open a device. + * + * @param lusb_dev Libusb device. + * @param pdev Location for the opened device pointer. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_dev_open(libusb_device *lusb_dev, + uhd_dev **pdev); + +/** + * Close a device. + * + * @param dev The device to close. + */ +extern void uhd_dev_close(uhd_dev *dev); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __UHD_DEV_H__ */ diff --git a/usbhid-dump/src/dev_list.c b/usbhid-dump/src/dev_list.c new file mode 100644 index 0000000..9848902 --- /dev/null +++ b/usbhid-dump/src/dev_list.c @@ -0,0 +1,125 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - device list + * + * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#include "config.h" + +#include "misc.h" +#include "dev_list.h" +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> + +bool +uhd_dev_list_valid(const uhd_dev *list) +{ + UHD_DEV_LIST_FOR_EACH(list, list) + if (!uhd_dev_valid(list)) + return false; + + return true; +} + + +void +uhd_dev_list_close(uhd_dev *list) +{ + uhd_dev *next; + + for (; list != NULL; list = next) + { + next = list->next; + uhd_dev_close(list); + } +} + + +enum libusb_error +uhd_dev_list_open(libusb_context *ctx, + uint8_t bus_num, uint8_t dev_addr, + uint16_t vid, uint16_t pid, + uhd_dev **plist) +{ + enum libusb_error err = LIBUSB_ERROR_OTHER; + libusb_device **lusb_list = NULL; + ssize_t num; + ssize_t idx; + libusb_device *lusb_dev; + struct libusb_device_descriptor desc; + uhd_dev *list = NULL; + uhd_dev *dev; + + assert(ctx != NULL); + + /* Retrieve libusb device list */ + num = libusb_get_device_list(ctx, &lusb_list); + if (num == LIBUSB_ERROR_NO_MEM) + { + err = num; + goto cleanup; + } + + /* Find and open the devices */ + for (idx = 0; idx < num; idx++) + { + lusb_dev = lusb_list[idx]; + + /* Skip devices not matching bus_num/dev_addr mask */ + if ((bus_num != UHD_BUS_NUM_ANY && + libusb_get_bus_number(lusb_dev) != bus_num) || + (dev_addr != UHD_DEV_ADDR_ANY && + libusb_get_device_address(lusb_dev) != dev_addr)) + continue; + + /* Skip devices not matching vendor/product mask */ + if (vid != UHD_VID_ANY || pid != UHD_PID_ANY) + { + err = libusb_get_device_descriptor(lusb_dev, &desc); + if (err != LIBUSB_SUCCESS) + goto cleanup; + + if ((vid != UHD_VID_ANY && vid != desc.idVendor) || + (pid != UHD_PID_ANY && pid != desc.idProduct)) + continue; + } + + /* Open and append the device to the list */ + err = uhd_dev_open(lusb_dev, &dev); + if (err != LIBUSB_SUCCESS) + goto cleanup; + + dev->next = list; + list = dev; + } + + /* Free the libusb device list freeing unused devices */ + libusb_free_device_list(lusb_list, true); + lusb_list = NULL; + + /* Output device list, if requested */ + assert(uhd_dev_list_valid(list)); + if (plist != NULL) + { + *plist = list; + list = NULL; + } + + /* Done! */ + err = LIBUSB_SUCCESS; + +cleanup: + + /* Close the device list if not output */ + uhd_dev_list_close(list); + + /* Free the libusb device list along with devices */ + if (lusb_list != NULL) + libusb_free_device_list(lusb_list, true); + + return err; +} + + diff --git a/usbhid-dump/src/dev_list.h b/usbhid-dump/src/dev_list.h new file mode 100644 index 0000000..5c70ad1 --- /dev/null +++ b/usbhid-dump/src/dev_list.h @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - device list + * + * Copyright (C) 2010-2011 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#ifndef __UHD_DEV_LIST_H__ +#define __UHD_DEV_LIST_H__ + +#include <stddef.h> +#include <stdint.h> +#include "dev.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Check if a device list is valid. + * + * @param list Device list to check. + * + * @return True if the device list is valid, false otherwise. + */ +extern bool uhd_dev_list_valid(const uhd_dev *list); + +/** + * Close every device in a device list. + * + * @param list The device list to close. + */ +extern void uhd_dev_list_close(uhd_dev *list); + +/** + * Iterate over a device list. + * + * @param _dev Loop device variable. + * @param _list Device list to iterate over. + */ +#define UHD_DEV_LIST_FOR_EACH(_dev, _list) \ + for (_dev = _list; _dev != NULL; _dev = _dev->next) + +/** + * Open a list of devices optionally matching bus number/device address and + * vendor/product IDs. + * + * @param ctx Libusb context. + * @param bus_num Bus number, or 0 for any bus. + * @param dev_addr Device address, or 0 for any address. + * @param vid Vendor ID, or 0 for any vendor. + * @param pid Product ID, or 0 for any product. + * @param plist Location for the resulting device list head; could be + * NULL. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_dev_list_open(libusb_context *ctx, + uint8_t bus_num, + uint8_t dev_addr, + uint16_t vid, + uint16_t pid, + uhd_dev **plist); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __UHD_DEV_LIST_H__ */ diff --git a/usbhid-dump/src/iface.c b/usbhid-dump/src/iface.c new file mode 100644 index 0000000..7bcf28b --- /dev/null +++ b/usbhid-dump/src/iface.c @@ -0,0 +1,227 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - interface + * + * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#include "config.h" + +#include "iface.h" +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +bool +uhd_iface_valid(const uhd_iface *iface) +{ + return iface != NULL && + uhd_dev_valid(iface->dev) && + iface->number < UINT8_MAX && + strlen(iface->addr_str) == (sizeof(iface->addr_str) - 1); +} + +uhd_iface * +uhd_iface_new(const uhd_dev *dev, + uint8_t number, + uint8_t int_in_ep_addr, + uint16_t int_in_ep_maxp, + uint16_t rd_len) +{ + uhd_iface *iface; + libusb_device *lusb_dev; + int rc; + + iface = malloc(sizeof(*iface)); + if (iface == NULL) + return NULL; + + iface->next = NULL; + iface->dev = dev; + iface->number = number; + iface->int_in_ep_addr = int_in_ep_addr; + iface->int_in_ep_maxp = int_in_ep_maxp; + iface->rd_len = rd_len; + iface->detached = false; + iface->claimed = false; + iface->submitted = false; + + /* Format address string */ + lusb_dev = libusb_get_device(dev->handle); + rc = snprintf(iface->addr_str, sizeof(iface->addr_str), + "%.3hhu:%.3hhu:%.3hhu", + libusb_get_bus_number(lusb_dev), + libusb_get_device_address(lusb_dev), + number); + (void)rc; + assert(rc == (sizeof(iface->addr_str) - 1)); + + assert(uhd_iface_valid(iface)); + + return iface; +} + + +void +uhd_iface_free(uhd_iface *iface) +{ + if (iface == NULL) + return; + + assert(uhd_iface_valid(iface)); + + free(iface); +} + + +enum libusb_error +uhd_iface_detach(uhd_iface *iface) +{ + enum libusb_error err; + + assert(uhd_iface_valid(iface)); + + err = libusb_detach_kernel_driver(iface->dev->handle, iface->number); + if (err == LIBUSB_SUCCESS) + iface->detached = true; + else if (err != LIBUSB_ERROR_NOT_FOUND) + return err; + + return LIBUSB_SUCCESS; +} + + +enum libusb_error +uhd_iface_attach(uhd_iface *iface) +{ + enum libusb_error err; + + assert(uhd_iface_valid(iface)); + + if (iface->detached) + { + err = libusb_attach_kernel_driver(iface->dev->handle, + iface->number); + if (err != LIBUSB_SUCCESS) + return err; + iface->detached = false; + } + + return LIBUSB_SUCCESS; +} + + +enum libusb_error +uhd_iface_claim(uhd_iface *iface) +{ + enum libusb_error err; + + assert(uhd_iface_valid(iface)); + + err = libusb_claim_interface(iface->dev->handle, iface->number); + if (err != LIBUSB_SUCCESS) + return err; + + iface->claimed = true; + + return LIBUSB_SUCCESS; +} + + +enum libusb_error +uhd_iface_release(uhd_iface *iface) +{ + enum libusb_error err; + + assert(uhd_iface_valid(iface)); + + err = libusb_release_interface(iface->dev->handle, iface->number); + if (err != LIBUSB_SUCCESS) + return err; + + iface->claimed = false; + + return LIBUSB_SUCCESS; +} + + +enum libusb_error +uhd_iface_clear_halt(uhd_iface *iface) +{ + enum libusb_error err; + + assert(uhd_iface_valid(iface)); + + err = libusb_clear_halt(iface->dev->handle, iface->int_in_ep_addr); + if (err != LIBUSB_SUCCESS) + return err; + + return LIBUSB_SUCCESS; +} + + +enum libusb_error +uhd_iface_set_idle(const uhd_iface *iface, + uint8_t duration, + unsigned int timeout) +{ + int rc; + + assert(uhd_iface_valid(iface)); + + rc = libusb_control_transfer(iface->dev->handle, + /* host->device, class, interface */ + 0x21, + /* Set_Idle */ + 0x0A, + /* duration for all report IDs */ + duration << 8, + /* interface */ + iface->number, + NULL, 0, + timeout); + /* + * Ignoring EPIPE, which means a STALL handshake, which is OK on + * control pipes and indicates request is not supported. + * See USB 2.0 spec, 8.4.5 Handshake Packets + */ + if (rc < 0 && rc != LIBUSB_ERROR_PIPE) + return rc; + + return LIBUSB_SUCCESS; +} + + +enum libusb_error +uhd_iface_set_protocol(const uhd_iface *iface, + bool report, + unsigned int timeout) +{ + int rc; + + assert(uhd_iface_valid(iface)); + + rc = libusb_control_transfer(iface->dev->handle, + /* host->device, class, interface */ + 0x21, + /* Set_Protocol */ + 0x0B, + /* 0 - boot, 1 - report */ + report ? 1 : 0, + /* interface */ + iface->number, + NULL, 0, + timeout); + /* + * Ignoring EPIPE, which means a STALL handshake, which is OK on + * control pipes and indicates request is not supported. + * See USB 2.0 spec, 8.4.5 Handshake Packets + */ + if (rc < 0 && rc != LIBUSB_ERROR_PIPE) + return rc; + + return LIBUSB_SUCCESS; +} + + diff --git a/usbhid-dump/src/iface.h b/usbhid-dump/src/iface.h new file mode 100644 index 0000000..0e1da6b --- /dev/null +++ b/usbhid-dump/src/iface.h @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - interface + * + * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#ifndef __UHD_IFACE_H__ +#define __UHD_IFACE_H__ + +#include <stdint.h> +#include "dev.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** usbhid-dump interface */ +typedef struct uhd_iface uhd_iface; + +struct uhd_iface { + uhd_iface *next; + const uhd_dev *dev; /**< Device */ + uint8_t number; /**< Interface number */ + char addr_str[12]; /**< Address string */ + uint8_t int_in_ep_addr; /**< Interrupt IN EP address */ + uint16_t int_in_ep_maxp; /**< Interrupt IN EP maximum + packet size */ + uint16_t rd_len; /**< Report descriptor length */ + bool detached; /**< True if the interface was + detached from the kernel + driver, false otherwise */ + bool claimed; /**< True if the interface was + claimed */ + /* + * This is somewhat hackish and doesn't belong here, since theoretically + * there could be more than one transfer submitted for an interface. + * However, we don't do it yet. This flag is used to track transfer + * cancellation during stream dumping. + */ + bool submitted; /**< True if an asynchronous + transfer has been submitted + for the interface */ +}; + +/** + * Check if an interface is valid. + * + * @param iface Interface. + * + * @return True if the interface is valid, false otherwise. + */ +extern bool uhd_iface_valid(const uhd_iface *iface); + +/** + * Create a new interface. + * + * @param handle Device handle. + * @param number Interface number. + * @param int_in_ep_addr Interrupt in endpoint address. + * @param int_in_ep_maxp Interrupt in endpoint maximum packet size. + * @param rd_len Report descriptor length. + * + * @return New interface or NULL, if failed to allocate. + */ +extern uhd_iface *uhd_iface_new(const uhd_dev *dev, + uint8_t number, + uint8_t int_in_ep_addr, + uint16_t int_in_ep_maxp, + uint16_t rd_len); + +/** + * Free an interface. + * + * @param iface The interface to free, could be NULL. + */ +extern void uhd_iface_free(uhd_iface *iface); + +/** + * Detach an interface from its kernel driver (if any). + * + * @param iface The interface to detach. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_detach(uhd_iface *iface); + +/** + * Attach an interface to its kernel driver (if detached before). + * + * @param iface The interface to attach. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_attach(uhd_iface *iface); + +/** + * Claim an interface. + * + * @param iface The interface to claim. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_claim(uhd_iface *iface); + +/** + * Set idle duration on an interface; ignore errors indicating missing + * support. + * + * @param iface The interface to set idle duration on. + * @param duration The duration in 4 ms steps starting from 4 ms. + * @param timeout The request timeout, ms. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_set_idle( + const uhd_iface *iface, + uint8_t duration, + unsigned int timeout); + +/** + * Set HID protocol on an interface; ignore errors indicating missing + * support. + * + * @param iface The interface to set idle duration on. + * @param report True for "report" protocol, false for "boot" protocol. + * @param timeout The request timeout, ms. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_set_protocol( + const uhd_iface *iface, + bool report, + unsigned int timeout); + +/** + * Clear halt condition on the input interrupt endpoint of an interface. + * + * @param iface The interface to clear halt condition on. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_clear_halt(uhd_iface *iface); + +/** + * Release an interface (if claimed before). + * + * @param iface The interface to release. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_release(uhd_iface *iface); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __UHD_IFACE_H__ */ diff --git a/usbhid-dump/src/iface_list.c b/usbhid-dump/src/iface_list.c new file mode 100644 index 0000000..3c82504 --- /dev/null +++ b/usbhid-dump/src/iface_list.c @@ -0,0 +1,220 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - interface list + * + * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#include "config.h" + +#include "iface_list.h" +#include "misc.h" +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> + +bool +uhd_iface_list_valid(const uhd_iface *list) +{ + UHD_IFACE_LIST_FOR_EACH(list, list) + if (!uhd_iface_valid(list)) + return false; + + return true; +} + + +size_t +uhd_iface_list_len(const uhd_iface *list) +{ + size_t len = 0; + + UHD_IFACE_LIST_FOR_EACH(list, list) + len++; + + return len; +} + + +void +uhd_iface_list_free(uhd_iface *list) +{ + uhd_iface *next; + + for (; list != NULL; list = next) + { + next = list->next; + uhd_iface_free(list); + } +} + + +enum libusb_error +uhd_iface_list_new(uhd_dev *dev_list, + uhd_iface **plist) +{ + enum libusb_error err = LIBUSB_ERROR_OTHER; + + uhd_dev *dev; + struct libusb_config_descriptor *config = NULL; + const struct libusb_interface *lusb_iface; + const struct libusb_interface_descriptor *iface_desc; + const uhd_hid_descriptor *hid_desc; + const uhd_hid_descriptor_extra *hid_desc_extra; + uint16_t rd_len; + const struct libusb_endpoint_descriptor *ep_list; + uint8_t ep_num; + const struct libusb_endpoint_descriptor *ep; + uhd_iface *list = NULL; + uhd_iface *iface; + + assert(uhd_dev_list_valid(dev_list)); + + UHD_DEV_LIST_FOR_EACH(dev, dev_list) + { + /* Retrieve active configuration descriptor */ + err = libusb_get_active_config_descriptor(libusb_get_device(dev->handle), + &config); + if (err != LIBUSB_SUCCESS) + goto cleanup; + + /* + * Build the matching interface list + */ + + /* For each interface */ + for (lusb_iface = config->interface; + lusb_iface - config->interface < config->bNumInterfaces; + lusb_iface++) + { + /* Skip interfaces with altsettings */ + if (lusb_iface->num_altsetting != 1) + continue; + + iface_desc = lusb_iface->altsetting; + + /* Skip non-HID interfaces */ + if (iface_desc->bInterfaceClass != LIBUSB_CLASS_HID) + continue; + + /* + * Try to retrieve report descriptor length + */ + rd_len = UHD_MAX_DESCRIPTOR_SIZE; + /* If interface descriptor has space for a HID descriptor */ + if (iface_desc->extra_length >= (int)sizeof(uhd_hid_descriptor)) + { + hid_desc = (const uhd_hid_descriptor *)iface_desc->extra; + /* If this is truly a HID class descriptor */ + if (hid_desc->bDescriptorType == LIBUSB_DT_HID) + { + /* For each extra HID descriptor entry */ + for (hid_desc_extra = hid_desc->extra; + hid_desc_extra < + hid_desc->extra + hid_desc->bNumDescriptors && + (uint8_t *)hid_desc_extra < + (uint8_t *)hid_desc + hid_desc->bLength && + (unsigned char *)hid_desc_extra < + iface_desc->extra + + iface_desc->extra_length; + hid_desc_extra++) { + /* If this is a report descriptor entry */ + if (hid_desc_extra->bDescriptorType == + LIBUSB_DT_REPORT) + { + rd_len = hid_desc_extra->wDescriptorLength; + break; + } + } + } + } + + /* Retrieve endpoint list */ + ep_list = iface_desc->endpoint; + ep_num = iface_desc->bNumEndpoints; + + /* For each endpoint */ + for (ep = ep_list; (ep - ep_list) < ep_num; ep++) + { + /* Skip non-interrupt and non-in endpoints */ + if ((ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) != + LIBUSB_TRANSFER_TYPE_INTERRUPT || + (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) != + LIBUSB_ENDPOINT_IN) + continue; + + /* Create the interface */ + iface = uhd_iface_new( + dev, + iface_desc->bInterfaceNumber, + ep->bEndpointAddress, ep->wMaxPacketSize, + rd_len); + if (iface == NULL) + { + err = LIBUSB_ERROR_NO_MEM; + goto cleanup; + } + + /* Add the interface */ + iface->next = list; + list = iface; + + break; + } + } + + /* Free the config descriptor */ + libusb_free_config_descriptor(config); + config = NULL; + } + + /* Output the resulting list, if requested */ + assert(uhd_iface_list_valid(list)); + if (plist != NULL) + { + *plist = list; + list = NULL; + } + + /* Done! */ + err = LIBUSB_SUCCESS; + +cleanup: + + libusb_free_config_descriptor(config); + uhd_iface_list_free(list); + + return err; +} + + +uhd_iface * +uhd_iface_list_fltr_by_num(uhd_iface *list, + uint8_t number) +{ + uhd_iface *prev; + uhd_iface *iface; + uhd_iface *next; + + assert(uhd_iface_list_valid(list)); + assert(number < UINT8_MAX); + + for (prev = NULL, iface = list; iface != NULL; iface = next) + { + next = iface->next; + if (iface->number == number) + prev = iface; + else + { + if (prev == NULL) + list = next; + else + prev->next = next; + uhd_iface_free(iface); + } + } + + return list; +} + + diff --git a/usbhid-dump/src/iface_list.h b/usbhid-dump/src/iface_list.h new file mode 100644 index 0000000..d99f761 --- /dev/null +++ b/usbhid-dump/src/iface_list.h @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - interface list + * + * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#ifndef __UHD_IFACE_LIST_H__ +#define __UHD_IFACE_LIST_H__ + +#include <stdint.h> +#include "dev_list.h" +#include "iface.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Check if an interface list is valid. + * + * @param list Interface list to check. + * + * @return True if the interface list is valid, false otherwise. + */ +extern bool uhd_iface_list_valid(const uhd_iface *list); + +/** + * Check if an interface list is empty. + * + * @param list Interface list to check. + * + * @return True if the interface list is empty, false otherwise. + */ +static inline bool +uhd_iface_list_empty(const uhd_iface *list) +{ + return list == NULL; +} + +/** + * Calculate length of an interface list. + * + * @param list The list to calculate length of. + * + * @return The list length. + */ +extern size_t uhd_iface_list_len(const uhd_iface *list); + +/** + * Free an interface list. + * + * @param list The interface list to free. + */ +extern void uhd_iface_list_free(uhd_iface *list); + +/** + * Iterate over an interface list. + * + * @param _iface Loop interface variable. + * @param _list Interface list to iterate over. + */ +#define UHD_IFACE_LIST_FOR_EACH(_iface, _list) \ + for (_iface = _list; _iface != NULL; _iface = _iface->next) + +/** + * Fetch a list of HID interfaces from a device list. + * + * @param dev_list The device list to fetch interface list from. + * @param plist Location for the resulting list head; could be NULL. + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_list_new(uhd_dev *dev_list, + uhd_iface **plist); + +/** + * Filter an interface list by an interface number. + * + * @param plist The original list head. + * @param number The interface number to match against. + * + * @return The resulting list head. + */ +extern uhd_iface *uhd_iface_list_fltr_by_num(uhd_iface *list, + uint8_t number); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __UHD_IFACE_LIST_H__ */ diff --git a/usbhid-dump/src/misc.h b/usbhid-dump/src/misc.h new file mode 100644 index 0000000..17b7e6a --- /dev/null +++ b/usbhid-dump/src/misc.h @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - miscellaneous declarations + * + * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#ifndef __UHD_MISC_H__ +#define __UHD_MISC_H__ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(1) + +/** HID extra descriptor record */ +typedef struct uhd_hid_descriptor_extra uhd_hid_descriptor_extra; + +struct uhd_hid_descriptor_extra { + uint8_t bDescriptorType; + uint16_t wDescriptorLength; +}; + +/** HID class-specific descriptor */ +typedef struct uhd_hid_descriptor uhd_hid_descriptor; + +struct uhd_hid_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; + uhd_hid_descriptor_extra extra[1]; +}; + +#pragma pack() + +/** + * Maximum descriptor size. + * + * @note 4096 here is maximum control buffer length. + */ +#define UHD_MAX_DESCRIPTOR_SIZE 4096 + +/** Generic USB I/O timeout, ms */ +#define UHD_IO_TIMEOUT 1000 + +/** Wildcard bus number */ +#define UHD_BUS_NUM_ANY 0 + +/** Wildcard device address */ +#define UHD_DEV_ADDR_ANY 0 + +/** Wildcard vendor ID */ +#define UHD_VID_ANY 0 + +/** Wildcard product ID */ +#define UHD_PID_ANY 0 + +/** Wildcard interface number */ +#define UHD_IFACE_NUM_ANY UINT8_MAX + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __UHD_MISC_H__ */ diff --git a/usbhid-dump/src/usbhid-dump.c b/usbhid-dump/src/usbhid-dump.c new file mode 100644 index 0000000..bd669e2 --- /dev/null +++ b/usbhid-dump/src/usbhid-dump.c @@ -0,0 +1,1067 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * usbhid-dump - entry point * + * + * Copyright (C) 2010-2011 Nikolai Kondrashov <spbnick@gmail.com> + */ + +#include "config.h" + +#include "iface_list.h" +#include "misc.h" +#include <libusb.h> + +#include <assert.h> +#include <stdbool.h> +#include <ctype.h> +#include <limits.h> +#include <string.h> +#include <errno.h> +#include <signal.h> +#include <stdlib.h> +#include <unistd.h> +#include <getopt.h> +#include <stdio.h> +#include <stdint.h> + +/* Define LIBUSB_CALL for libusb <= 1.0.8 */ +#ifndef LIBUSB_CALL +#define LIBUSB_CALL +#endif + +#define GENERIC_ERROR(_fmt, _args...) \ + fprintf(stderr, _fmt "\n", ##_args) + +#define IFACE_ERROR(_iface, _fmt, _args...) \ + GENERIC_ERROR("%s:" _fmt, _iface->addr_str, ##_args) + +#define GENERIC_FAILURE(_fmt, _args...) \ + GENERIC_ERROR("Failed to " _fmt, ##_args) + +#define IFACE_FAILURE(_iface, _fmt, _args...) \ + IFACE_ERROR(_iface, "Failed to " _fmt, ##_args) + +#define LIBUSB_FAILURE(_fmt, _args...) \ + GENERIC_FAILURE(_fmt ": %s", ##_args, libusb_strerror(err)) + +#define LIBUSB_IFACE_FAILURE(_iface, _fmt, _args...) \ + IFACE_FAILURE(_iface, _fmt ": %s", ##_args, libusb_strerror(err)) + +#define ERROR_CLEANUP(_fmt, _args...) \ + do { \ + GENERIC_ERROR(_fmt, ##_args); \ + goto cleanup; \ + } while (0) + +#define FAILURE_CLEANUP(_fmt, _args...) \ + do { \ + GENERIC_FAILURE(_fmt, ##_args); \ + goto cleanup; \ + } while (0) + +#define LIBUSB_FAILURE_CLEANUP(_fmt, _args...) \ + do { \ + LIBUSB_FAILURE(_fmt, ##_args); \ + goto cleanup; \ + } while (0) + +#define LIBUSB_IFACE_FAILURE_CLEANUP(_iface, _fmt, _args...) \ + do { \ + LIBUSB_IFACE_FAILURE(_iface, _fmt, ##_args); \ + goto cleanup; \ + } while (0) + +#define LIBUSB_GUARD(_expr, _fmt, _args...) \ + do { \ + err = _expr; \ + if (err != LIBUSB_SUCCESS) \ + LIBUSB_FAILURE_CLEANUP(_fmt, ##_args); \ + } while (0) + +#define LIBUSB_IFACE_GUARD(_expr, _iface, _fmt, _args...) \ + do { \ + err = _expr; \ + if (err != LIBUSB_SUCCESS) \ + LIBUSB_IFACE_FAILURE_CLEANUP(_iface, _fmt, ##_args); \ + } while (0) + +/**< Number of the signal causing the exit */ +static volatile sig_atomic_t exit_signum = 0; + +static void +exit_sighandler(int signum) +{ + if (exit_signum == 0) + exit_signum = signum; +} + +/**< "Stream paused" flag - non-zero if paused */ +static volatile sig_atomic_t stream_paused = 0; + +static void +stream_pause_sighandler(int signum) +{ + (void)signum; + stream_paused = 1; +} + +static void +stream_resume_sighandler(int signum) +{ + (void)signum; + stream_paused = 0; +} + +/**< "Stream feedback" flag - non-zero if feedback is enabled */ +static volatile sig_atomic_t stream_feedback = 0; + +static void +dump(const uhd_iface *iface, + const char *entity, + const uint8_t *ptr, + size_t len) +{ + static const char xd[] = "0123456789ABCDEF"; + static char buf[] = " XX\n"; + size_t pos; + uint8_t b; + struct timeval tv; + + gettimeofday(&tv, NULL); + + fprintf(stdout, "%s:%-16s %12llu.%.6u\n", + iface->addr_str, entity, + (unsigned long long int)tv.tv_sec, + (unsigned int)tv.tv_usec); + + for (pos = 1; len > 0; len--, ptr++, pos++) + { + b = *ptr; + buf[1] = xd[b >> 4]; + buf[2] = xd[b & 0xF]; + + (void)fwrite(buf, ((pos % 16 == 0) ? 4 : 3), 1, stdout); + } + + if (pos % 16 != 1) + fputc('\n', stdout); + fputc('\n', stdout); + + fflush(stdout); +} + + +static bool +dump_iface_list_descriptor(const uhd_iface *list) +{ + const uhd_iface *iface; + uint8_t buf[UHD_MAX_DESCRIPTOR_SIZE]; + int rc; + enum libusb_error err; + + UHD_IFACE_LIST_FOR_EACH(iface, list) + { + if (iface->rd_len > sizeof(buf)) + { + err = LIBUSB_ERROR_NO_MEM; + LIBUSB_IFACE_FAILURE(iface, "report descriptor too long: %hu", + iface->rd_len); + return false; + } + + rc = libusb_control_transfer(iface->dev->handle, + /* See HID spec, 7.1.1 */ + 0x81, + LIBUSB_REQUEST_GET_DESCRIPTOR, + (LIBUSB_DT_REPORT << 8), iface->number, + buf, iface->rd_len, UHD_IO_TIMEOUT); + if (rc < 0) + { + err = rc; + LIBUSB_IFACE_FAILURE(iface, "retrieve report descriptor"); + return false; + } + dump(iface, "DESCRIPTOR", buf, rc); + } + + return true; +} + + +static void LIBUSB_CALL +dump_iface_list_stream_cb(struct libusb_transfer *transfer) +{ + enum libusb_error err; + uhd_iface *iface; + + assert(transfer != NULL); + + iface = (uhd_iface *)transfer->user_data; + assert(uhd_iface_valid(iface)); + + /* Clear interface "has transfer submitted" flag */ + iface->submitted = false; + + switch (transfer->status) + { + case LIBUSB_TRANSFER_COMPLETED: + /* Dump the result */ + if (!stream_paused) + { + dump(iface, "STREAM", + transfer->buffer, transfer->actual_length); + if (stream_feedback) + fputc('.', stderr); + } + /* Resubmit the transfer */ + err = libusb_submit_transfer(transfer); + if (err != LIBUSB_SUCCESS) + LIBUSB_IFACE_FAILURE(iface, "resubmit a transfer"); + else + { + /* Set interface "has transfer submitted" flag */ + iface->submitted = true; + } + break; + +#define MAP(_name, _desc) \ + case LIBUSB_TRANSFER_##_name: \ + IFACE_ERROR(iface, _desc); \ + break + + MAP(ERROR, "Interrupt transfer failed"); + MAP(TIMED_OUT, "Interrupt transfer timed out"); + MAP(STALL, "Interrupt transfer halted (endpoint stalled)"); + MAP(NO_DEVICE, "Device was disconnected"); + MAP(OVERFLOW, "Interrupt transfer overflowed " + "(device sent more data than requested)"); +#undef MAP + + case LIBUSB_TRANSFER_CANCELLED: + break; + } +} + + +static const char * +format_time_interval(unsigned int i) +{ + static char buf[128]; + char *p = buf; + unsigned int h = i / (60 * 60 * 1000); + unsigned int m = (i % (60 * 60 * 1000)) / (60 * 1000); + unsigned int s = (i % (60 * 1000)) / 1000; + unsigned int ms = i % 1000; + +#define FRACTION(_prev_sum, _name, _val) \ + do { \ + if ((_val) > 0) \ + p += snprintf(p, sizeof(buf) - (p - buf), \ + "%s%u " _name "%s", \ + ((_prev_sum) > 0 ? " " : ""), \ + _val, \ + (((_val) == 1) ? "" : "s")); \ + if (p >= (buf + sizeof(buf))) \ + return buf; \ + } while (0) + + FRACTION(0, "hour", h); + FRACTION(h, "minute", m); + FRACTION(h + m, "second", s); + FRACTION(h + m + s, "millisecond", ms); + +#undef FRACTION + + return buf; +} + + +static const char * +format_timeout(unsigned int i) +{ + return (i == 0) ? "infinite" : format_time_interval(i); +} + + +static bool +dump_iface_list_stream(libusb_context *ctx, + uhd_iface *list, + unsigned int timeout) +{ + bool result = false; + enum libusb_error err; + size_t transfer_num = 0; + struct libusb_transfer **transfer_list = NULL; + struct libusb_transfer **ptransfer; + uhd_iface *iface; + bool submitted = false; + + fprintf(stderr, + "Starting dumping interrupt transfer stream\n" + "with %s timeout.\n\n", + format_timeout(timeout)); + + UHD_IFACE_LIST_FOR_EACH(iface, list) + { + /* Set report protocol */ + LIBUSB_IFACE_GUARD(uhd_iface_set_protocol(iface, true, + UHD_IO_TIMEOUT), + iface, "set report protocol"); + /* Set infinite idle duration */ + LIBUSB_IFACE_GUARD(uhd_iface_set_idle(iface, 0, UHD_IO_TIMEOUT), + iface, "set infinite idle duration"); + } + + /* Calculate number of interfaces and thus transfers */ + transfer_num = uhd_iface_list_len(list); + + /* Allocate transfer list */ + transfer_list = malloc(sizeof(*transfer_list) * transfer_num); + if (transfer_list == NULL) + FAILURE_CLEANUP("allocate transfer list"); + + /* Zero transfer list */ + for (ptransfer = transfer_list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++) + *ptransfer = NULL; + + /* Allocate transfers */ + for (ptransfer = transfer_list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++) + { + *ptransfer = libusb_alloc_transfer(0); + if (*ptransfer == NULL) + FAILURE_CLEANUP("allocate a transfer"); + /* + * Set user_data to NULL explicitly, since libusb_alloc_transfer + * does memset to zero only and zero is not NULL, strictly speaking. + */ + (*ptransfer)->user_data = NULL; + } + + /* Initialize the transfers as interrupt transfers */ + for (ptransfer = transfer_list, iface = list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++, iface = iface->next) + { + void *buf; + const size_t len = iface->int_in_ep_maxp; + + /* Allocate the transfer buffer */ + buf = malloc(len); + if (len > 0 && buf == NULL) + FAILURE_CLEANUP("allocate a transfer buffer"); + + /* Initialize the transfer */ + libusb_fill_interrupt_transfer(*ptransfer, + iface->dev->handle, iface->int_in_ep_addr, + buf, len, + dump_iface_list_stream_cb, + (void *)iface, + timeout); + + /* Ask to free the buffer when the transfer is freed */ + (*ptransfer)->flags |= LIBUSB_TRANSFER_FREE_BUFFER; + } + + /* Submit first transfer requests */ + for (ptransfer = transfer_list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++) + { + LIBUSB_GUARD(libusb_submit_transfer(*ptransfer), + "submit a transfer"); + /* Set interface "has transfer submitted" flag */ + ((uhd_iface *)(*ptransfer)->user_data)->submitted = true; + /* Set "have any submitted transfers" flag */ + submitted = true; + } + + /* Run the event machine */ + while (submitted && exit_signum == 0) + { + /* Handle the transfer events */ + err = libusb_handle_events(ctx); + if (err != LIBUSB_SUCCESS && err != LIBUSB_ERROR_INTERRUPTED) + LIBUSB_FAILURE_CLEANUP("handle transfer events"); + + /* Check if there are any submitted transfers left */ + submitted = false; + for (ptransfer = transfer_list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++) + { + iface = (uhd_iface *)(*ptransfer)->user_data; + + if (iface != NULL && iface->submitted) + submitted = true; + } + } + + /* If all the transfers were terminated unexpectedly */ + if (transfer_num > 0 && !submitted) + ERROR_CLEANUP("No more interfaces to dump"); + + result = true; + +cleanup: + + /* Cancel the transfers */ + if (submitted) + { + submitted = false; + for (ptransfer = transfer_list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++) + { + iface = (uhd_iface *)(*ptransfer)->user_data; + + if (iface != NULL && iface->submitted) + { + err = libusb_cancel_transfer(*ptransfer); + if (err == LIBUSB_SUCCESS) + submitted = true; + else + { + LIBUSB_FAILURE("cancel a transfer, ignoring"); + /* + * XXX are we really sure + * the transfer won't be finished? + */ + iface->submitted = false; + } + } + } + } + + /* Wait for transfer cancellation */ + while (submitted) + { + /* Handle cancellation events */ + err = libusb_handle_events(ctx); + if (err != LIBUSB_SUCCESS && err != LIBUSB_ERROR_INTERRUPTED) + { + LIBUSB_FAILURE("handle transfer cancellation events, " + "aborting transfer cancellation"); + break; + } + + /* Check if there are any submitted transfers left */ + submitted = false; + for (ptransfer = transfer_list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++) + { + iface = (uhd_iface *)(*ptransfer)->user_data; + + if (iface != NULL && iface->submitted) + submitted = true; + } + } + + /* + * Free transfer list along with non-submitted transfers and their + * buffers. + */ + if (transfer_list != NULL) + { + for (ptransfer = transfer_list; + (size_t)(ptransfer - transfer_list) < transfer_num; + ptransfer++) + { + iface = (uhd_iface *)(*ptransfer)->user_data; + + /* + * Only free a transfer if it is not submitted. Better leak some + * memory than have some important memory overwritten. + */ + if (iface == NULL || !iface->submitted) + libusb_free_transfer(*ptransfer); + } + + free(transfer_list); + } + + return result; +} + + +static int +run(bool dump_descriptor, + bool dump_stream, + unsigned int stream_timeout, + uint8_t bus_num, + uint8_t dev_addr, + uint16_t vid, + uint16_t pid, + int iface_num) +{ + int result = 1; + enum libusb_error err; + libusb_context *ctx = NULL; + uhd_dev *dev_list = NULL; + uhd_iface *iface_list = NULL; + uhd_iface *iface; + + /* Create libusb context */ + LIBUSB_GUARD(libusb_init(&ctx), "create libusb context"); + + /* Set libusb debug level to informational only */ +#if HAVE_LIBUSB_SET_OPTION + libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO); +#else + libusb_set_debug(ctx, LIBUSB_LOG_LEVEL_INFO); +#endif + + /* Open device list */ + LIBUSB_GUARD(uhd_dev_list_open(ctx, bus_num, dev_addr, + vid, pid, &dev_list), + "find and open the devices"); + + /* Retrieve the list of HID interfaces from the device list */ + LIBUSB_GUARD(uhd_iface_list_new(dev_list, &iface_list), + "find HID interfaces"); + + /* Filter the interface list by specified interface number */ + if (iface_num != UHD_IFACE_NUM_ANY) + iface_list = uhd_iface_list_fltr_by_num(iface_list, iface_num); + + /* Check if there are any interfaces left */ + if (uhd_iface_list_empty(iface_list)) + ERROR_CLEANUP("No matching HID interfaces"); + + /* Detach and claim the interfaces */ + UHD_IFACE_LIST_FOR_EACH(iface, iface_list) + { + LIBUSB_IFACE_GUARD(uhd_iface_detach(iface), + iface, "detach from the kernel driver"); + LIBUSB_IFACE_GUARD(uhd_iface_claim(iface), + iface, "claim"); + } + + /* Run with the prepared interface list */ + result = (!dump_descriptor || dump_iface_list_descriptor(iface_list)) && + (!dump_stream || dump_iface_list_stream(ctx, iface_list, + stream_timeout)) + ? 0 + : 1; + +cleanup: + + /* Release and attach the interfaces back */ + UHD_IFACE_LIST_FOR_EACH(iface, iface_list) + { + err = uhd_iface_release(iface); + if (err != LIBUSB_SUCCESS) + LIBUSB_IFACE_FAILURE(iface, "release"); + + err = uhd_iface_attach(iface); + if (err != LIBUSB_SUCCESS) + LIBUSB_IFACE_FAILURE(iface, "attach to the kernel driver"); + } + + /* Free the interface list */ + uhd_iface_list_free(iface_list); + + /* Close the device list */ + uhd_dev_list_close(dev_list); + + /* Destroy the libusb context */ + if (ctx != NULL) + libusb_exit(ctx); + + return result; +} + + +static bool +parse_number_pair(const char *str, + int base, + long *pn1, + long *pn2) +{ + const char *p; + char *end; + long n1; + long n2; + + assert(str != NULL); + + p = str; + + /* Skip space (prevent strtol doing so) */ + while (isspace((int)*p)) + p++; + + /* Extract the first number */ + errno = 0; + n1 = strtol(p, &end, base); + if (errno != 0) + return false; + + /* If nothing was read */ + if (end == p) + return false; + + /* Move on */ + p = end; + + /* Skip space */ + while (isspace((int)*p)) + p++; + + /* If it is the end of string */ + if (*p == '\0') + n2 = 0; + else + { + /* If it is not the number separator */ + if (*p != ':') + return false; + + /* Skip the number separator */ + p++; + + /* Skip space (prevent strtol doing so) */ + while (isspace((int)*p)) + p++; + + /* Extract the second number */ + errno = 0; + n2 = strtol(p, &end, base); + if (errno != 0) + return false; + /* If nothing was read */ + if (end == p) + return false; + + /* Move on */ + p = end; + + /* Skip space */ + while (isspace((int)*p)) + p++; + + /* If it is not the end of string */ + if (*p != '\0') + return false; + } + + /* Output the numbers */ + if (pn1 != NULL) + *pn1 = n1; + if (pn2 != NULL) + *pn2 = n2; + + return true; +} + + +static bool +parse_address(const char *str, + uint8_t *pbus_num, + uint8_t *pdev_addr) +{ + long bus_num; + long dev_addr; + + assert(str != NULL); + + if (!parse_number_pair(str, 10, &bus_num, &dev_addr)) + return false; + + if (bus_num < 0 || bus_num > UINT8_MAX || + dev_addr < 0 || dev_addr > UINT8_MAX) + return false; + + if (pbus_num != NULL) + *pbus_num = bus_num; + if (pdev_addr != NULL) + *pdev_addr = dev_addr; + + return true; +} + + +static bool +parse_model(const char *str, + uint16_t *pvid, + uint16_t *ppid) +{ + long vid; + long pid; + + assert(str != NULL); + + if (!parse_number_pair(str, 16, &vid, &pid)) + return false; + + if (vid < 0 || vid > UINT16_MAX || + pid < 0 || pid > UINT16_MAX) + return false; + + if (pvid != NULL) + *pvid = vid; + if (ppid != NULL) + *ppid = pid; + + return true; +} + + +static bool +parse_iface_num(const char *str, + uint8_t *piface_num) +{ + long iface_num; + const char *p; + char *end; + + assert(str != NULL); + + p = str; + + /* Skip space (prevent strtol doing so) */ + while (isspace((int)*p)) + p++; + + /* Extract interface number */ + errno = 0; + iface_num = strtol(p, &end, 10); + if (errno != 0 || end == p || iface_num < 0 || iface_num > UINT8_MAX) + return false; + + /* Output interface number */ + if (piface_num != NULL) + *piface_num = iface_num; + + return true; +} + + +static bool +parse_timeout(const char *str, + unsigned int *ptimeout) +{ + long long timeout; + const char *p; + char *end; + + assert(str != NULL); + + p = str; + + /* Skip space (prevent strtoll doing so) */ + while (isspace((int)*p)) + p++; + + /* Extract timeout */ + errno = 0; + timeout = strtoll(p, &end, 10); + if (errno != 0 || end == p || timeout < 0 || timeout > UINT_MAX) + return false; + + /* Output timeout */ + if (ptimeout != NULL) + *ptimeout = timeout; + + return true; +} + + +static bool +version(FILE *stream) +{ + return + fprintf( + stream, +PACKAGE_STRING "\n" +"Copyright (C) 2010 Nikolai Kondrashov\n" +"License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.\n" +"\n" +"This is free software: you are free to change and redistribute it.\n" +"There is NO WARRANTY, to the extent permitted by law.\n") >= 0; +} + + +static bool +usage(FILE *stream, const char *name) +{ + return + fprintf( + stream, +"Usage: %s [OPTION]...\n" +"Dump USB device HID report descriptor(s) and/or stream(s).\n" +"\n" +"Options:\n" +" -h, --help output this help message and exit\n" +" -v, --version output version information and exit\n" +"\n" +" -s, -a, --address=bus[:dev] limit interfaces by bus number\n" +" (1-255) and device address (1-255),\n" +" decimal; zeroes match any\n" +" -d, -m, --model=vid[:pid] limit interfaces by vendor and\n" +" product IDs (0001-ffff), hexadecimal;\n" +" zeroes match any\n" +" -i, --interface=NUMBER limit interfaces by number (0-254),\n" +" decimal; 255 matches any\n" +"\n" +" -e, --entity=STRING what to dump: either \"descriptor\",\n" +" \"stream\" or \"all\"; value can be\n" +" abbreviated\n" +"\n" +" -t, --stream-timeout=NUMBER stream interrupt transfer timeout, ms;\n" +" zero means infinity\n" +" -p, --stream-paused start with the stream dump output\n" +" paused\n" +" -f, --stream-feedback enable stream dumping feedback: for\n" +" every transfer dumped a dot is\n" +" printed to stderr\n" +"\n" +"Default options: --stream-timeout=60000 --entity=descriptor\n" +"\n" +"Signals:\n" +" USR1/USR2 pause/resume the stream dump output\n" +"\n", + name) >= 0; +} + + +typedef enum opt_val { + OPT_VAL_HELP = 'h', + OPT_VAL_VERSION = 'v', + OPT_VAL_ADDRESS = 'a', + OPT_VAL_ADDRESS_COMP = 's', + OPT_VAL_MODEL = 'm', + OPT_VAL_MODEL_COMP = 'd', + OPT_VAL_INTERFACE = 'i', + OPT_VAL_ENTITY = 'e', + OPT_VAL_STREAM_TIMEOUT = 't', + OPT_VAL_STREAM_PAUSED = 'p', + OPT_VAL_STREAM_FEEDBACK = 'f', +} opt_val; + + +static const struct option long_opt_list[] = { + {.val = OPT_VAL_HELP, + .name = "help", + .has_arg = no_argument, + .flag = NULL}, + {.val = OPT_VAL_VERSION, + .name = "version", + .has_arg = no_argument, + .flag = NULL}, + {.val = OPT_VAL_ADDRESS, + .name = "address", + .has_arg = required_argument, + .flag = NULL}, + {.val = OPT_VAL_MODEL, + .name = "model", + .has_arg = required_argument, + .flag = NULL}, + {.val = OPT_VAL_INTERFACE, + .name = "interface", + .has_arg = required_argument, + .flag = NULL}, + {.val = OPT_VAL_ENTITY, + .name = "entity", + .has_arg = required_argument, + .flag = NULL}, + {.val = OPT_VAL_STREAM_TIMEOUT, + .name = "stream-timeout", + .has_arg = required_argument, + .flag = NULL}, + {.val = OPT_VAL_STREAM_PAUSED, + .name = "stream-paused", + .has_arg = no_argument, + .flag = NULL}, + {.val = OPT_VAL_STREAM_FEEDBACK, + .name = "stream-feedback", + .has_arg = no_argument, + .flag = NULL}, + {.val = 0, + .name = NULL, + .has_arg = 0, + .flag = NULL} +}; + + +static const char *short_opt_list = "hvs:a:d:m:i:e:t:pf"; + + +int +main(int argc, char **argv) +{ + int result; + + const char *name; + + int c; + + uint8_t bus_num = UHD_BUS_NUM_ANY; + uint8_t dev_addr = UHD_DEV_ADDR_ANY; + + uint16_t vid = UHD_VID_ANY; + uint16_t pid = UHD_PID_ANY; + + uint8_t iface_num = UHD_IFACE_NUM_ANY; + + bool dump_descriptor = true; + bool dump_stream = false; + unsigned int stream_timeout = 60000; + + struct sigaction sa; + + /* + * Extract program invocation name + */ + name = strrchr(argv[0], '/'); + if (name == NULL) + name = argv[0]; + else + name++; + +#define USAGE_ERROR(_fmt, _args...) \ + do { \ + fprintf(stderr, _fmt "\n", ##_args); \ + usage(stderr, name); \ + return 1; \ + } while (0) + + /* + * Parse command line arguments + */ + while ((c = getopt_long(argc, argv, + short_opt_list, long_opt_list, NULL)) >= 0) + { + switch (c) + { + case OPT_VAL_HELP: + usage(stdout, name); + return 0; + break; + case OPT_VAL_VERSION: + version(stdout); + return 0; + break; + case OPT_VAL_ADDRESS: + case OPT_VAL_ADDRESS_COMP: + if (!parse_address(optarg, &bus_num, &dev_addr)) + USAGE_ERROR("Invalid device address \"%s\"", optarg); + break; + case OPT_VAL_MODEL: + case OPT_VAL_MODEL_COMP: + if (!parse_model(optarg, &vid, &pid)) + USAGE_ERROR("Invalid model \"%s\"", optarg); + break; + case OPT_VAL_INTERFACE: + if (!parse_iface_num(optarg, &iface_num)) + USAGE_ERROR("Invalid interface number \"%s\"", optarg); + break; + case OPT_VAL_ENTITY: + if (strncmp(optarg, "descriptor", strlen(optarg)) == 0) + { + dump_descriptor = true; + dump_stream = false; + } + else if (strncmp(optarg, "stream", strlen(optarg)) == 0) + { + dump_descriptor = false; + dump_stream = true; + } + else if (strncmp(optarg, "all", strlen(optarg)) == 0) + { + dump_descriptor = true; + dump_stream = true; + } + else + USAGE_ERROR("Unknown entity \"%s\"", optarg); + + break; + case OPT_VAL_STREAM_TIMEOUT: + if (!parse_timeout(optarg, &stream_timeout)) + USAGE_ERROR("Invalid stream timeout \"%s\"", optarg); + break; + case OPT_VAL_STREAM_PAUSED: + stream_paused = 1; + break; + case OPT_VAL_STREAM_FEEDBACK: + stream_feedback = 1; + break; + case '?': + usage(stderr, name); + return 1; + break; + } + } + + /* + * Verify positional arguments + */ + if (optind < argc) + USAGE_ERROR("Positional arguments are not accepted"); + + /* + * Setup signal handlers + */ + /* Setup SIGINT to terminate gracefully */ + sigaction(SIGINT, NULL, &sa); + if (sa.sa_handler != SIG_IGN) + { + sa.sa_handler = exit_sighandler; + sigemptyset(&sa.sa_mask); + sigaddset(&sa.sa_mask, SIGTERM); + sa.sa_flags = 0; /* NOTE: no SA_RESTART on purpose */ + sigaction(SIGINT, &sa, NULL); + } + + /* Setup SIGTERM to terminate gracefully */ + sigaction(SIGTERM, NULL, &sa); + if (sa.sa_handler != SIG_IGN) + { + sa.sa_handler = exit_sighandler; + sigemptyset(&sa.sa_mask); + sigaddset(&sa.sa_mask, SIGINT); + sa.sa_flags = 0; /* NOTE: no SA_RESTART on purpose */ + sigaction(SIGTERM, &sa, NULL); + } + + /* Setup SIGUSR1/SIGUSR2 to pause/resume the stream output */ + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sa.sa_handler = stream_pause_sighandler; + sigaction(SIGUSR1, &sa, NULL); + sa.sa_handler = stream_resume_sighandler; + sigaction(SIGUSR2, &sa, NULL); + + /* Make stdout buffered - we will flush it explicitly */ + setbuf(stdout, NULL); + + /* Run! */ + result = run(dump_descriptor, dump_stream, stream_timeout, + bus_num, dev_addr, vid, pid, iface_num); + + /* + * Restore signal handlers + */ + sigaction(SIGINT, NULL, &sa); + if (sa.sa_handler != SIG_IGN) + signal(SIGINT, SIG_DFL); + + sigaction(SIGTERM, NULL, &sa); + if (sa.sa_handler != SIG_IGN) + signal(SIGTERM, SIG_DFL); + + /* + * Reproduce the signal used to stop the program to get proper exit + * status. + */ + if (exit_signum != 0) + raise(exit_signum); + + return result; +} + + diff --git a/usbmisc.c b/usbmisc.c new file mode 100644 index 0000000..b12928f --- /dev/null +++ b/usbmisc.c @@ -0,0 +1,236 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Misc USB routines + * + * Copyright (C) 2003 Aurelien Jarno (aurelien@aurel32.net) + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <limits.h> + +#ifdef HAVE_ICONV +#include <iconv.h> +#endif + +#ifdef HAVE_NL_LANGINFO +#include <langinfo.h> +#endif + +#include "usbmisc.h" + +/* ---------------------------------------------------------------------- */ + +static const char *devbususb = "/dev/bus/usb"; + +/* ---------------------------------------------------------------------- */ + +static int readlink_recursive(const char *path, char *buf, size_t bufsize) +{ + char temp[PATH_MAX + 1]; + char *ptemp; + int ret; + + ret = readlink(path, buf, bufsize-1); + + if (ret > 0) { + buf[ret] = 0; + if (*buf != '/') { + strncpy(temp, path, sizeof(temp) - 1); + ptemp = temp + strlen(temp); + while (*ptemp != '/' && ptemp != temp) + ptemp--; + ptemp++; + strncpy(ptemp, buf, bufsize + temp - ptemp - 1); + } else + strncpy(temp, buf, sizeof(temp) - 1); + return readlink_recursive(temp, buf, bufsize); + } else { + strncpy(buf, path, bufsize); + return strlen(buf); + } +} + +static char *get_absolute_path(const char *path, char *result, + size_t result_size) +{ + const char *ppath; /* pointer on the input string */ + char *presult; /* pointer on the output string */ + + ppath = path; + presult = result; + result[0] = 0; + + if (path == NULL) + return result; + + if (*ppath != '/') { + result = getcwd(result, result_size); + presult += strlen(result); + result_size -= strlen(result); + + *presult++ = '/'; + result_size--; + } + + while (*ppath != 0 && result_size > 1) { + if (*ppath == '/') { + do + ppath++; + while (*ppath == '/'); + *presult++ = '/'; + result_size--; + } else if (*ppath == '.' && *(ppath + 1) == '.' && + *(ppath + 2) == '/' && *(presult - 1) == '/') { + if ((presult - 1) != result) { + /* go one directory upper */ + do { + presult--; + result_size++; + } while (*(presult - 1) != '/'); + } + ppath += 3; + } else if (*ppath == '.' && + *(ppath + 1) == '/' && + *(presult - 1) == '/') { + ppath += 2; + } else { + *presult++ = *ppath++; + result_size--; + } + } + /* Don't forget to mark the end of the string! */ + *presult = 0; + + return result; +} + +libusb_device *get_usb_device(libusb_context *ctx, const char *path) +{ + libusb_device **list; + libusb_device *dev; + ssize_t num_devs, i; + char device_path[PATH_MAX + 1]; + char absolute_path[PATH_MAX + 1]; + + readlink_recursive(path, device_path, sizeof(device_path)); + get_absolute_path(device_path, absolute_path, sizeof(absolute_path)); + + dev = NULL; + num_devs = libusb_get_device_list(ctx, &list); + + for (i = 0; i < num_devs; ++i) { + uint8_t bnum = libusb_get_bus_number(list[i]); + uint8_t dnum = libusb_get_device_address(list[i]); + + snprintf(device_path, sizeof(device_path), "%s/%03u/%03u", + devbususb, bnum, dnum); + if (!strcmp(device_path, absolute_path)) { + dev = list[i]; + break; + } + } + + libusb_free_device_list(list, 0); + return dev; +} + +static char *get_dev_string_ascii(libusb_device_handle *dev, size_t size, + uint8_t id) +{ + char *buf = malloc(size); + int ret = libusb_get_string_descriptor_ascii(dev, id, + (unsigned char *) buf, + size); + + if (ret < 0) { + free(buf); + return strdup("(error)"); + } + + return buf; +} + +#if defined(HAVE_NL_LANGINFO) && defined(HAVE_ICONV) +static uint16_t get_any_langid(libusb_device_handle *dev) +{ + unsigned char buf[4]; + int ret = libusb_get_string_descriptor(dev, 0, 0, buf, sizeof buf); + if (ret != sizeof buf) return 0; + return buf[2] | (buf[3] << 8); +} + +static char *usb_string_to_native(char * str, size_t len) +{ + size_t num_converted; + iconv_t conv; + char *result, *result_end; + size_t in_bytes_left, out_bytes_left; + + conv = iconv_open(nl_langinfo(CODESET), "UTF-16LE"); + + if (conv == (iconv_t) -1) + return NULL; + + in_bytes_left = len * 2; + out_bytes_left = len * MB_CUR_MAX; + result = result_end = malloc(out_bytes_left + 1); + + num_converted = iconv(conv, &str, &in_bytes_left, + &result_end, &out_bytes_left); + + iconv_close(conv); + if (num_converted == (size_t) -1) { + free(result); + return NULL; + } + + *result_end = 0; + return result; +} +#endif + +char *get_dev_string(libusb_device_handle *dev, uint8_t id) +{ +#if defined(HAVE_NL_LANGINFO) && defined(HAVE_ICONV) + int ret; + char *buf, unicode_buf[254]; + uint16_t langid; +#endif + + if (!dev || !id) return strdup(""); + +#if defined(HAVE_NL_LANGINFO) && defined(HAVE_ICONV) + langid = get_any_langid(dev); + if (!langid) return strdup("(error)"); + + /* + * Some devices lie about their string size, so initialize + * the buffer with all 0 to account for that. + */ + memset(unicode_buf, 0x00, sizeof(unicode_buf)); + + ret = libusb_get_string_descriptor(dev, id, langid, + (unsigned char *) unicode_buf, + sizeof unicode_buf); + if (ret < 2) return strdup("(error)"); + + if ((unsigned char)unicode_buf[0] < 2 || unicode_buf[1] != LIBUSB_DT_STRING) + return strdup("(error)"); + + buf = usb_string_to_native(unicode_buf + 2, + ((unsigned char) unicode_buf[0] - 2) / 2); + + if (!buf) return get_dev_string_ascii(dev, 127, id); + + return buf; +#else + return get_dev_string_ascii(dev, 127, id); +#endif +} diff --git a/usbmisc.h b/usbmisc.h new file mode 100644 index 0000000..24b27ee --- /dev/null +++ b/usbmisc.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Misc USB routines + * + * Copyright (C) 2003 Aurelien Jarno (aurelien@aurel32.net) + */ + +#ifndef _USBMISC_H +#define _USBMISC_H + +#include <libusb.h> + +/* ---------------------------------------------------------------------- */ + +extern libusb_device *get_usb_device(libusb_context *ctx, const char *path); + +extern char *get_dev_string(libusb_device_handle *dev, uint8_t id); + +/* ---------------------------------------------------------------------- */ +#endif /* _USBMISC_H */ diff --git a/usbreset.c b/usbreset.c new file mode 100644 index 0000000..68f87cb --- /dev/null +++ b/usbreset.c @@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* usbreset -- send a USB port reset to a USB device */ +/* Copyright (c) 2009-2016 Alan Stern */ +/* To build: gcc -o usbreset usbreset.c */ + +#include <stdint.h> +#include <stdio.h> +#include <stdbool.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <ctype.h> +#include <limits.h> +#include <dirent.h> +#include <sys/ioctl.h> + +#include <linux/usbdevice_fs.h> + + +/* static char *usbfs = NULL; */ + +struct usbentry { + int bus_num; + int dev_num; + int vendor_id; + int product_id; + char vendor_name[128]; + char product_name[128]; +}; + +static char *sysfs_attr(const char *dev, const char *attr) +{ + int fd, len = 0; + char path[PATH_MAX]; + static char buf[129]; + + memset(buf, 0, sizeof(buf)); + snprintf(path, sizeof(path) - 1, "/sys/bus/usb/devices/%s/%s", dev, attr); + + fd = open(path, O_RDONLY); + if (fd >= 0) { + len = read(fd, buf, sizeof(buf) - 1); + close(fd); + } + + while (--len > 0 && isspace(buf[len])) + buf[len] = 0; + + return (len >= 0) ? buf : NULL; +} + +static struct usbentry *parse_devlist(DIR *d) +{ + char *attr; + struct dirent *e; + static struct usbentry dev; + + do { + e = readdir(d); + + if (!e) + return NULL; + } while (!isdigit(e->d_name[0]) || strchr(e->d_name, ':')); + + memset(&dev, 0, sizeof(dev)); + dev.vendor_id = -1; + dev.product_id = -1; + + attr = sysfs_attr(e->d_name, "busnum"); + if (attr) + dev.bus_num = strtoul(attr, NULL, 10); + + attr = sysfs_attr(e->d_name, "devnum"); + if (attr) + dev.dev_num = strtoul(attr, NULL, 10); + + attr = sysfs_attr(e->d_name, "idVendor"); + if (attr) + dev.vendor_id = strtoul(attr, NULL, 16); + + attr = sysfs_attr(e->d_name, "idProduct"); + if (attr) + dev.product_id = strtoul(attr, NULL, 16); + + attr = sysfs_attr(e->d_name, "manufacturer"); + if (attr) + strcpy(dev.vendor_name, attr); + + attr = sysfs_attr(e->d_name, "product"); + if (attr) + strcpy(dev.product_name, attr); + + if (dev.bus_num && dev.dev_num && dev.vendor_id >= 0 && dev.product_id >= 0) + return &dev; + + return NULL; +} + +static void list_devices(void) +{ + DIR *devs = opendir("/sys/bus/usb/devices"); + struct usbentry *dev; + + if (!devs) + return; + + while ((dev = parse_devlist(devs)) != NULL) + printf(" Number %03d/%03d ID %04x:%04x %s\n", + dev->bus_num, dev->dev_num, + dev->vendor_id, dev->product_id, + dev->product_name); + + closedir(devs); +} + +static struct usbentry *find_device(int *bus, int *dev, int *vid, int *pid, + const char *product) +{ + DIR *devs = opendir("/sys/bus/usb/devices"); + + struct usbentry *e, *match = NULL; + + if (!devs) + return NULL; + + while ((e = parse_devlist(devs)) != NULL) + if ((bus && (e->bus_num == *bus) && (e->dev_num == *dev)) || + (vid && (e->vendor_id == *vid) && (e->product_id == *pid)) || + (product && !strcasecmp(e->product_name, product))) { + match = e; + break; + } + + closedir(devs); + + return match; +} + +static void reset_device(struct usbentry *dev) +{ + int fd; + char path[PATH_MAX]; + + snprintf(path, sizeof(path) - 1, "/dev/bus/usb/%03d/%03d", + dev->bus_num, dev->dev_num); + + printf("Resetting %s ... ", dev->product_name); + + fd = open(path, O_WRONLY); + if (fd > -1) { + if (ioctl(fd, USBDEVFS_RESET, 0) < 0) + printf("failed [%s]\n", strerror(errno)); + else + printf("ok\n"); + + close(fd); + } else { + printf("can't open [%s]\n", strerror(errno)); + } +} + + +int main(int argc, char **argv) +{ + int id1, id2; + struct usbentry *dev; + + if ((argc == 2) && (sscanf(argv[1], "%3d/%3d", &id1, &id2) == 2)) + dev = find_device(&id1, &id2, NULL, NULL, NULL); + else if ((argc == 2) && (sscanf(argv[1], "%4x:%4x", &id1, &id2) == 2)) + dev = find_device(NULL, NULL, &id1, &id2, NULL); + else if ((argc == 2) && strlen(argv[1]) < 128) + dev = find_device(NULL, NULL, NULL, NULL, argv[1]); + else { + printf("Usage:\n" + " usbreset PPPP:VVVV - reset by product and vendor id\n" + " usbreset BBB/DDD - reset by bus and device number\n" + " usbreset \"Product\" - reset by product name\n\n" + "Devices:\n"); + list_devices(); + return 1; + } + + if (!dev) { + fprintf(stderr, "No such device found\n"); + return 1; + } + + reset_device(dev); + return 0; +} diff --git a/usbutils.pc.in b/usbutils.pc.in new file mode 100644 index 0000000..e69778c --- /dev/null +++ b/usbutils.pc.in @@ -0,0 +1,18 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ +usbids=@datadir@/usb.ids + +Name: @PACKAGE_NAME@ +Description: usbutils This is a collection of USB tools for use on Linux and BSD systems\ + to query what type of USB devices are connected to the system. This is to be run on a USB host\ + (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.) + +Version: @VERSION@ +URL: https://github.com/gregkh/usbutils +Requires: libusb-1.0 >= 1.0.14 libudev >= 196 +Conflicts: +Libs: -L${libdir} +Libs.private: @LIBUSB_LIBS@ @UDEV_LIBS@ +Cflags: @CFLAGS@ @LIBUSB_CFLAGS@ @UDEV_CFLAGS@ |