Launching soon!

This commit is contained in:
[ Kristjan Komloši HomePC ]
2017-03-28 13:33:10 +02:00
parent db1ecbddbe
commit 2cdf7fb91c
276 changed files with 19 additions and 113542 deletions

View File

@@ -1,36 +0,0 @@
========================================================================================
Cypress Semiconductor Corporation
CyUSB Serial library.
=========================================================================================
Pre-requisite:
1. libusb-1.0.9 is required for compilation and functioning of the APIs in the library.
2. GNU Make and the GCC tool-chain are used for the build process.
Installation steps:
1.cd to the main directory where the library source files are extracted and goto ./linux/library
2.Type 'sudo make'.
2.This will generate shared library libcyusbserial.so.1 and its soft link libcyusbserial.so.
Both of them will be copied/installed to /usr/local/lib.
3.Go to ./linux/testUtility (I2C/SPI test utility program) and type 'sudo make'.
This will generate CyUSBSerialTestUtility binary (Refer to README in testUtility folder).
4.User can launch the application and test the communication with Cypress USB-Serial DVk in vendor mode.
Changing USB device node permission:
By default the USB device node created in linux do not have read/write permission
for normal user. In order to make the USB device node accessable, copy 90-cyusb.rules
which is inside the library folder of release package to /etc/udev/rules.d folder (Default VID mentioned is Cypress VID
which is 0x4B4, if VID is changed then update it in ATTR{idVendor} section of rules file).
*** IMPORTANT:
Some distribution of linux have libusb (older version) as part of their package. Uninstall
the older version and update it with libusb-1.0.9.
**Note:
Refer to ./common/doc/CyUSBSerial API documentation.pdf for description of all
the vendor mode APIs. The header file of the library is in ./common/header/CyUSBSerial.h.

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +0,0 @@
Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
Copyright (C) 2008-2012 Nathan Hjelm <hjelmn@users.sourceforge.net>
Copyright (C) 2009-2012 Pete Batard <pete@akeo.ie>
Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
Copyright (C) 2010-2012 Peter Stuge <peter@stuge.se>
Copyright (C) 2011-2012 Hans de Goede <hdegoede@redhat.com>
Copyright (C) 2012 Martin Pieuchot <mpi@openbsd.org>
Other contributors:
Alan Ott
Alan Stern
Alex Vatchenko
Artem Egorkine
Aurelien Jarno
Bastien Nocera
Brian Shirley
David Engraf
David Moore
Felipe Balbi
Graeme Gill
Hans de Goede
Hans Ulrich Niedermann
Hector Martin
Hoi-Ho Chan
James Hanko
Konrad Rzepecki
Ludovic Rousseau
Martin Koegler
Martin Pieuchot
Mike Frysinger
Mikhail Gusarov
Orin Eman
Pekka Nikander
Peter Stuge
Rob Walker
Sean McBride
Sebastian Pipping
Stephan Meyer
Thomas Röfer
Toby Peterson
Trygve Laugstøl
Vasily Khoruzhick
Vitali Lovich
Xiaofan Chen

View File

@@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -1,234 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@@ -1,807 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
pkgdatadir = $(datadir)/libusb
pkgincludedir = $(includedir)/libusb
pkglibdir = $(libdir)/libusb
pkglibexecdir = $(libexecdir)/libusb
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
#am__append_1 = examples
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libusb-1.0.pc.in $(top_srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL NEWS THANKS TODO compile \
config.guess config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libusb-1.0.pc
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive
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__installdirs = "$(DESTDIR)$(pkgconfigdir)"
DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = libusb doc examples
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
GZIP_ENV = --best
DIST_ARCHIVES = $(distdir).tar.bz2
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run aclocal-1.11
AMTAR = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run tar
AM_CFLAGS = -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow
AM_DEFAULT_VERBOSITY = 0
AR = ar
AUTOCONF = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoconf
AUTOHEADER = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoheader
AUTOMAKE = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run automake-1.11
AWK = mawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
LIBOBJS =
LIBS = -lrt -pthread
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLDFLAGS = -version-info 1:0:1 -no-undefined
LTLIBOBJS =
MAINT = #
MAKEINFO = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OS_DARWIN =
OS_LINUX =
OS_OPENBSD =
OS_WINDOWS =
OTOOL =
OTOOL64 =
PACKAGE = libusb
PACKAGE_BUGREPORT = libusb-devel@lists.sourceforge.net
PACKAGE_NAME = libusb
PACKAGE_STRING = libusb 1.0.9
PACKAGE_TARNAME = libusb
PACKAGE_URL = http://www.libusb.org/
PACKAGE_VERSION = 1.0.9
PATH_SEPARATOR = :
PC_LIBS_PRIVATE = -lrt -pthread
RANLIB = ranlib
RC =
SED = /bin/sed
SET_MAKE =
SHELL = /bin/bash
STRIP = strip
THREAD_CFLAGS = -pthread
VERSION = 1.0.9
VISIBILITY_CFLAGS = -fvisibility=hidden
abs_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
abs_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
abs_top_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
abs_top_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix =
top_builddir = .
top_srcdir = .
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
ACLOCAL_AMFLAGS = -I m4
DISTCLEANFILES = libusb-1.0.pc
MAINTAINERCLEANFILES = ChangeLog
EXTRA_DIST = TODO PORTING msvc
SUBDIRS = libusb doc $(am__append_1)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libusb-1.0.pc
reldir = .release/$(distdir)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: # $(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
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: # $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
libusb-1.0.pc: $(top_builddir)/config.status $(srcdir)/libusb-1.0.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
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|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
# 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.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; 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"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
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; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
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) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__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:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
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."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-pkgconfigDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
ctags-recursive install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgconfigDATA install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-pkgconfigDATA
.PHONY: ChangeLog dist-up
ChangeLog:
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
dist-hook: ChangeLog
dist-up: dist
rm -rf $(reldir)
mkdir -p $(reldir)
cp $(distdir).tar.bz2 $(reldir)
rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
rm -rf $(reldir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -1,28 +0,0 @@
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
ACLOCAL_AMFLAGS = -I m4
DISTCLEANFILES = libusb-1.0.pc
MAINTAINERCLEANFILES = ChangeLog
EXTRA_DIST = TODO PORTING msvc
SUBDIRS = libusb doc
if BUILD_EXAMPLES
SUBDIRS += examples
endif
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA=libusb-1.0.pc
.PHONY: ChangeLog dist-up
ChangeLog:
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
dist-hook: ChangeLog
reldir = .release/$(distdir)
dist-up: dist
rm -rf $(reldir)
mkdir -p $(reldir)
cp $(distdir).tar.bz2 $(reldir)
rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
rm -rf $(reldir)

View File

@@ -1,807 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@BUILD_EXAMPLES_TRUE@am__append_1 = examples
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libusb-1.0.pc.in $(top_srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL NEWS THANKS TODO compile \
config.guess config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libusb-1.0.pc
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive
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__installdirs = "$(DESTDIR)$(pkgconfigdir)"
DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = libusb doc examples
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
GZIP_ENV = --best
DIST_ARCHIVES = $(distdir).tar.bz2
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLDFLAGS = @LTLDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OS_DARWIN = @OS_DARWIN@
OS_LINUX = @OS_LINUX@
OS_OPENBSD = @OS_OPENBSD@
OS_WINDOWS = @OS_WINDOWS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
THREAD_CFLAGS = @THREAD_CFLAGS@
VERSION = @VERSION@
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
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@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
ACLOCAL_AMFLAGS = -I m4
DISTCLEANFILES = libusb-1.0.pc
MAINTAINERCLEANFILES = ChangeLog
EXTRA_DIST = TODO PORTING msvc
SUBDIRS = libusb doc $(am__append_1)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libusb-1.0.pc
reldir = .release/$(distdir)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
libusb-1.0.pc: $(top_builddir)/config.status $(srcdir)/libusb-1.0.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
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|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
# 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.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; 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"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
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; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
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) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__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:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
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."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-pkgconfigDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
ctags-recursive install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgconfigDATA install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-pkgconfigDATA
.PHONY: ChangeLog dist-up
ChangeLog:
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
dist-hook: ChangeLog
dist-up: dist
rm -rf $(reldir)
mkdir -p $(reldir)
cp $(distdir).tar.bz2 $(reldir)
rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
rm -rf $(reldir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -1,65 +0,0 @@
This file lists notable changes in each release. For the full history of all
changes, see ChangeLog.
2012-04-20: 1.0.9
* Numerous bug fixes and improvements
* Backend for Windows, for devices using the WinUSB.sys driver
* Backend for OpenBSD and NetBSD, for devices using the ugen driver
* Add libusb_get_device_speed()
* Add libusb_has_capability()
* Add libusb_error_name()
* Add libusb_get_version()
2010-05-07: v1.0.8
* Bug fixes
2010-04-19: v1.0.7
* Bug fixes and documentation tweaks
* Add more interface class definitions
2009-11-22: v1.0.6
* Bug fixes
* Increase libusb_handle_events() timeout to 60s for powersaving
2009-11-15: v1.0.5
* Use timerfd when available for timer management
* Small fixes/updates
2009-11-06: v1.0.4 release
* Bug fixes including transfer locking to fix some potential threading races
* More flexibility with clock types on Linux
* Use new bulk continuation tracking in Linux 2.6.32 for improved handling
of short/failed transfers
2009-08-27: v1.0.3 release
* Bug fixes
* Add libusb_get_max_iso_packet_size()
2009-06-13: v1.0.2 release
* Bug fixes
2009-05-12: v1.0.1 release
* Bug fixes
* Darwin backend
2008-12-13: v1.0.0 release
* Bug fixes
2008-11-21: v0.9.4 release
* Bug fixes
* Add libusb_attach_kernel_driver()
2008-08-23: v0.9.3 release
* Bug fixes
2008-07-19: v0.9.2 release
* Bug fixes
2008-06-28: v0.9.1 release
* Bug fixes
* Introduce contexts to the API
* Compatibility with new Linux kernel features
2008-05-25: v0.9.0 release
* First libusb-1.0 beta release

View File

@@ -1,95 +0,0 @@
PORTING LIBUSB TO OTHER PLATFORMS
Introduction
============
This document is aimed at developers wishing to port libusb to unsupported
platforms. I believe the libusb API is OS-independent, so by supporting
multiple operating systems we pave the way for cross-platform USB device
drivers.
Implementation-wise, the basic idea is that you provide an interface to
libusb's internal "backend" API, which performs the appropriate operations on
your target platform.
In terms of USB I/O, your backend provides functionality to submit
asynchronous transfers (synchronous transfers are implemented in the higher
layers, based on the async interface). Your backend must also provide
functionality to cancel those transfers.
Your backend must also provide an event handling function to "reap" ongoing
transfers and process their results.
The backend must also provide standard functions for other USB operations,
e.g. setting configuration, obtaining descriptors, etc.
File descriptors for I/O polling
================================
For libusb to work, your event handling function obviously needs to be called
at various points in time. Your backend must provide a set of file descriptors
which libusb and its users can pass to poll() or select() to determine when
it is time to call the event handling function.
On Linux, this is easy: the usbfs kernel interface exposes a file descriptor
which can be passed to poll(). If something similar is not true for your
platform, you can emulate this using an internal library thread to reap I/O as
necessary, and a pipe() with the main library to raise events. The file
descriptor of the pipe can then be provided to libusb as an event source.
Interface semantics and documentation
=====================================
Documentation of the backend interface can be found in libusbi.h inside the
usbi_os_backend structure definition.
Your implementations of these functions will need to call various internal
libusb functions, prefixed with "usbi_". Documentation for these functions
can be found in the .c files where they are implemented.
You probably want to skim over *all* the documentation before starting your
implementation. For example, you probably need to allocate and store private
OS-specific data for device handles, but the documentation for the mechanism
for doing so is probably not the first thing you will see.
The Linux backend acts as a good example - view it as a reference
implementation which you should try to match the behaviour of.
Getting started
===============
1. Modify configure.ac to detect your platform appropriately (see the OS_LINUX
stuff for an example).
2. Implement your backend in the libusb/os/ directory, modifying
libusb/os/Makefile.am appropriately.
3. Add preprocessor logic to the top of libusb/core.c to statically assign the
right usbi_backend for your platform.
4. Produce and test your implementation.
5. Send your implementation to libusb-devel mailing list.
Implementation difficulties? Questions?
=======================================
If you encounter difficulties porting libusb to your platform, please raise
these issues on the libusb-devel mailing list. Where possible and sensible, I
am interested in solving problems preventing libusb from operating on other
platforms.
The libusb-devel mailing list is also a good place to ask questions and
make suggestions about the internal API. Hopefully we can produce some
better documentation based on your questions and other input.
You are encouraged to get involved in the process; if the library needs
some infrastructure additions/modifications to better support your platform,
you are encouraged to make such changes (in cleanly distinct patch
submissions). Even if you do not make such changes yourself, please do raise
the issues on the mailing list at the very minimum.

View File

@@ -1,22 +0,0 @@
libusb
======
libusb is a library for USB device access from Linux, Mac OS X,
OpenBSD, NetBSD, and Windows userspace.
It is written in C and licensed under the LGPL-2.1 (see COPYING).
libusb is abstracted internally in such a way that it can hopefully
be ported to other operating systems. See the PORTING file for some
information, if you fancy a challenge. :)
libusb homepage:
http://libusb.org/
Developers will wish to consult the API documentation:
http://libusb.sourceforge.net/api-1.0/
Use the mailing list for questions, comments, etc:
http://libusb.org/wiki/MailingList
- Peter Stuge <peter@stuge.se>
(use the mailing list rather than mailing developers directly)

View File

@@ -1,8 +0,0 @@
Development contributors are listed in the AUTHORS file. Other community
members who have made significant contributions in other areas are listed
in this file:
Alan Stern
Ludovic Rousseau
Tim Roberts
Xiaofan Chen

View File

@@ -1,9 +0,0 @@
for 1.1 or future
==================
optional timerfd support (runtime detection)
notifications of hotplugged/unplugged devices
offer API to create/destroy handle_events thread
isochronous sync I/O?
exposing of parent-child device relationships
"usb primer" introduction docs
more examples

File diff suppressed because it is too large Load Diff

View File

@@ -1,143 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2009-10-06.20; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
# Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
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 $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@@ -1,116 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Default visibility */
#undef DEFAULT_VISIBILITY
/* Debug message logging */
#undef ENABLE_DEBUG_LOGGING
/* Message logging */
#undef ENABLE_LOGGING
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if the system has the type `struct timespec'. */
#undef HAVE_STRUCT_TIMESPEC
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Darwin backend */
#undef OS_DARWIN
/* Linux backend */
#undef OS_LINUX
/* OpenBSD backend */
#undef OS_OPENBSD
/* Windows backend */
#undef OS_WINDOWS
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* type of second poll() argument */
#undef POLL_NFDS_TYPE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Use POSIX Threads */
#undef THREADS_POSIX
/* timerfd headers available */
#undef USBI_TIMERFD_AVAILABLE
/* Version number of package */
#undef VERSION
/* Use GNU extensions */
#undef _GNU_SOURCE
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif

View File

@@ -1,760 +0,0 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libusb configure 1.0.9, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = kaligula
uname -m = x86_64
uname -r = 4.6.0-kali1-amd64
uname -s = Linux
uname -v = #1 SMP Debian 4.6.4-1kali1 (2016-07-21)
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2370: checking for a BSD-compatible install
configure:2438: result: /usr/bin/install -c
configure:2449: checking whether build environment is sane
configure:2499: result: yes
configure:2640: checking for a thread-safe mkdir -p
configure:2679: result: /bin/mkdir -p
configure:2692: checking for gawk
configure:2722: result: no
configure:2692: checking for mawk
configure:2708: found /usr/bin/mawk
configure:2719: result: mawk
configure:2730: checking whether make sets $(MAKE)
configure:2752: result: yes
configure:2833: checking whether to enable maintainer-specific portions of Makefiles
configure:2842: result: no
configure:2922: checking for gcc
configure:2938: found /usr/bin/gcc
configure:2949: result: gcc
configure:3178: checking for C compiler version
configure:3187: gcc --version >&5
gcc (Debian 6.1.1-11) 6.1.1 20160802
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3198: $? = 0
configure:3187: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.1.1-11' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.1.1 20160802 (Debian 6.1.1-11)
configure:3198: $? = 0
configure:3187: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3198: $? = 1
configure:3187: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:3198: $? = 1
configure:3218: checking whether the C compiler works
configure:3240: gcc conftest.c >&5
configure:3244: $? = 0
configure:3292: result: yes
configure:3295: checking for C compiler default output file name
configure:3297: result: a.out
configure:3303: checking for suffix of executables
configure:3310: gcc -o conftest conftest.c >&5
configure:3314: $? = 0
configure:3336: result:
configure:3358: checking whether we are cross compiling
configure:3366: gcc -o conftest conftest.c >&5
configure:3370: $? = 0
configure:3377: ./conftest
configure:3381: $? = 0
configure:3396: result: no
configure:3401: checking for suffix of object files
configure:3423: gcc -c conftest.c >&5
configure:3427: $? = 0
configure:3448: result: o
configure:3452: checking whether we are using the GNU C compiler
configure:3471: gcc -c conftest.c >&5
configure:3471: $? = 0
configure:3480: result: yes
configure:3489: checking whether gcc accepts -g
configure:3509: gcc -c -g conftest.c >&5
configure:3509: $? = 0
configure:3550: result: yes
configure:3567: checking for gcc option to accept ISO C89
configure:3631: gcc -c -g -O2 conftest.c >&5
configure:3631: $? = 0
configure:3644: result: none needed
configure:3675: checking for style of include used by make
configure:3703: result: GNU
configure:3728: checking dependency style of gcc
configure:3838: result: gcc3
configure:3882: checking build system type
configure:3896: result: x86_64-unknown-linux-gnu
configure:3916: checking host system type
configure:3929: result: x86_64-unknown-linux-gnu
configure:3970: checking how to print strings
configure:3997: result: printf
configure:4018: checking for a sed that does not truncate output
configure:4082: result: /bin/sed
configure:4100: checking for grep that handles long lines and -e
configure:4158: result: /bin/grep
configure:4163: checking for egrep
configure:4225: result: /bin/grep -E
configure:4230: checking for fgrep
configure:4292: result: /bin/grep -F
configure:4327: checking for ld used by gcc
configure:4394: result: /usr/bin/ld
configure:4401: checking if the linker (/usr/bin/ld) is GNU ld
configure:4416: result: yes
configure:4428: checking for BSD- or MS-compatible name lister (nm)
configure:4477: result: /usr/bin/nm -B
configure:4607: checking the name lister (/usr/bin/nm -B) interface
configure:4614: gcc -c -g -O2 conftest.c >&5
configure:4617: /usr/bin/nm -B "conftest.o"
configure:4620: output
0000000000000000 B some_variable
configure:4627: result: BSD nm
configure:4630: checking whether ln -s works
configure:4634: result: yes
configure:4642: checking the maximum length of command line arguments
configure:4767: result: 1572864
configure:4784: checking whether the shell understands some XSI constructs
configure:4794: result: yes
configure:4798: checking whether the shell understands "+="
configure:4804: result: yes
configure:4839: checking for /usr/bin/ld option to reload object files
configure:4846: result: -r
configure:4915: checking for objdump
configure:4931: found /usr/bin/objdump
configure:4942: result: objdump
configure:4974: checking how to recognize dependent libraries
configure:5176: result: pass_all
configure:5236: checking for ar
configure:5252: found /usr/bin/ar
configure:5263: result: ar
configure:5341: checking for strip
configure:5357: found /usr/bin/strip
configure:5368: result: strip
configure:5440: checking for ranlib
configure:5456: found /usr/bin/ranlib
configure:5467: result: ranlib
configure:5569: checking command to parse /usr/bin/nm -B output from gcc object
configure:5687: gcc -c -g -O2 conftest.c >&5
configure:5690: $? = 0
configure:5694: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' \> conftest.nm
configure:5697: $? = 0
configure:5751: gcc -o conftest -g -O2 conftest.c conftstm.o >&5
configure:5754: $? = 0
configure:5792: result: ok
configure:5888: gcc -c -g -O2 conftest.c >&5
configure:5891: $? = 0
configure:6633: checking how to run the C preprocessor
configure:6664: gcc -E conftest.c
configure:6664: $? = 0
configure:6678: gcc -E conftest.c
conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^
compilation terminated.
configure:6678: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libusb"
| #define PACKAGE_TARNAME "libusb"
| #define PACKAGE_VERSION "1.0.9"
| #define PACKAGE_STRING "libusb 1.0.9"
| #define PACKAGE_BUGREPORT "libusb-devel@lists.sourceforge.net"
| #define PACKAGE_URL "http://www.libusb.org/"
| #define PACKAGE "libusb"
| #define VERSION "1.0.9"
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:6703: result: gcc -E
configure:6723: gcc -E conftest.c
configure:6723: $? = 0
configure:6737: gcc -E conftest.c
conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^
compilation terminated.
configure:6737: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libusb"
| #define PACKAGE_TARNAME "libusb"
| #define PACKAGE_VERSION "1.0.9"
| #define PACKAGE_STRING "libusb 1.0.9"
| #define PACKAGE_BUGREPORT "libusb-devel@lists.sourceforge.net"
| #define PACKAGE_URL "http://www.libusb.org/"
| #define PACKAGE "libusb"
| #define VERSION "1.0.9"
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:6766: checking for ANSI C header files
configure:6786: gcc -c -g -O2 conftest.c >&5
configure:6786: $? = 0
configure:6859: gcc -o conftest -g -O2 conftest.c >&5
configure:6859: $? = 0
configure:6859: ./conftest
configure:6859: $? = 0
configure:6870: result: yes
configure:6883: checking for sys/types.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for sys/stat.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for stdlib.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for string.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for memory.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for strings.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for inttypes.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for stdint.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6883: checking for unistd.h
configure:6883: gcc -c -g -O2 conftest.c >&5
configure:6883: $? = 0
configure:6883: result: yes
configure:6897: checking for dlfcn.h
configure:6897: gcc -c -g -O2 conftest.c >&5
configure:6897: $? = 0
configure:6897: result: yes
configure:7084: checking for objdir
configure:7099: result: .libs
configure:7366: checking if gcc supports -fno-rtti -fno-exceptions
configure:7384: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
configure:7388: $? = 0
configure:7401: result: no
configure:7421: checking for gcc option to produce PIC
configure:7706: result: -fPIC -DPIC
configure:7718: checking if gcc PIC flag -fPIC -DPIC works
configure:7736: gcc -c -g -O2 -fPIC -DPIC -DPIC conftest.c >&5
configure:7740: $? = 0
configure:7753: result: yes
configure:7777: checking if gcc static flag -static works
configure:7805: result: yes
configure:7820: checking if gcc supports -c -o file.o
configure:7841: gcc -c -g -O2 -o out/conftest2.o conftest.c >&5
configure:7845: $? = 0
configure:7867: result: yes
configure:7875: checking if gcc supports -c -o file.o
configure:7922: result: yes
configure:7955: checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries
configure:9030: result: yes
configure:9067: checking whether -lc should be explicitly linked in
configure:9075: gcc -c -g -O2 conftest.c >&5
configure:9078: $? = 0
configure:9093: gcc -shared conftest.o -v -Wl,-soname -Wl,conftest -o conftest 2\>\&1 \| /bin/grep -lc \>/dev/null 2\>\&1
configure:9096: $? = 0
configure:9110: result: no
configure:9275: checking dynamic linker characteristics
configure:9743: gcc -o conftest -g -O2 -Wl,-rpath -Wl,/foo conftest.c >&5
configure:9743: $? = 0
configure:9965: result: GNU/Linux ld.so
configure:10072: checking how to hardcode library paths into programs
configure:10097: result: immediate
configure:10637: checking whether stripping libraries is possible
configure:10642: result: yes
configure:10677: checking if libtool supports shared libraries
configure:10679: result: yes
configure:10682: checking whether to build shared libraries
configure:10703: result: yes
configure:10706: checking whether to build static libraries
configure:10710: result: yes
configure:10788: checking for windres
configure:10818: result: no
configure:10919: checking for inline
configure:10935: gcc -c -g -O2 conftest.c >&5
configure:10935: $? = 0
configure:10943: result: inline
configure:10962: checking whether gcc and cc understand -c and -o together
configure:10993: gcc -c conftest.c -o conftest2.o >&5
configure:10997: $? = 0
configure:11003: gcc -c conftest.c -o conftest2.o >&5
configure:11007: $? = 0
configure:11018: cc -c conftest.c >&5
configure:11022: $? = 0
configure:11030: cc -c conftest.c -o conftest2.o >&5
configure:11034: $? = 0
configure:11040: cc -c conftest.c -o conftest2.o >&5
configure:11044: $? = 0
configure:11062: result: yes
configure:11093: checking operating system
configure:11097: result: Linux
configure:11136: checking for clock_gettime in -lrt
configure:11161: gcc -o conftest -g -O2 conftest.c -lrt >&5
configure:11161: $? = 0
configure:11170: result: yes
configure:11181: checking poll.h usability
configure:11181: gcc -c -g -O2 conftest.c >&5
configure:11181: $? = 0
configure:11181: result: yes
configure:11181: checking poll.h presence
configure:11181: gcc -E conftest.c
configure:11181: $? = 0
configure:11181: result: yes
configure:11181: checking for poll.h
configure:11181: result: yes
configure:11315: checking sys/timerfd.h usability
configure:11315: gcc -c -g -O2 conftest.c >&5
configure:11315: $? = 0
configure:11315: result: yes
configure:11315: checking sys/timerfd.h presence
configure:11315: gcc -E conftest.c
configure:11315: $? = 0
configure:11315: result: yes
configure:11315: checking for sys/timerfd.h
configure:11315: result: yes
configure:11335: checking whether TFD_NONBLOCK is declared
configure:11335: gcc -c -g -O2 conftest.c >&5
configure:11335: $? = 0
configure:11335: result: yes
configure:11347: checking whether to use timerfd for timing
configure:11354: result: yes
configure:11365: checking for struct timespec
configure:11365: gcc -c -g -O2 conftest.c >&5
configure:11365: $? = 0
configure:11365: gcc -c -g -O2 conftest.c >&5
conftest.c: In function 'main':
conftest.c:65:30: error: expected expression before ')' token
if (sizeof ((struct timespec)))
^
configure:11365: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libusb"
| #define PACKAGE_TARNAME "libusb"
| #define PACKAGE_VERSION "1.0.9"
| #define PACKAGE_STRING "libusb 1.0.9"
| #define PACKAGE_BUGREPORT "libusb-devel@lists.sourceforge.net"
| #define PACKAGE_URL "http://www.libusb.org/"
| #define PACKAGE "libusb"
| #define VERSION "1.0.9"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define _GNU_SOURCE 1
| #define OS_LINUX 1
| #define HAVE_POLL_H 1
| #define POLL_NFDS_TYPE nfds_t
| #define THREADS_POSIX 1
| #define USBI_TIMERFD_AVAILABLE 1
| /* end confdefs.h. */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| # include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| int
| main ()
| {
| if (sizeof ((struct timespec)))
| return 0;
| ;
| return 0;
| }
configure:11365: result: yes
configure:11435: gcc -c -g -O2 -Werror -fvisibility=hidden conftest.c >&5
configure:11435: $? = 0
configure:11463: gcc -c -g -O2 -Wno-pointer-sign conftest.c >&5
configure:11463: $? = 0
configure:11472: checking for sigaction
configure:11472: gcc -o conftest -g -O2 conftest.c -lrt -pthread >&5
configure:11472: $? = 0
configure:11472: result: yes
configure:11491: checking sys/time.h usability
configure:11491: gcc -c -g -O2 conftest.c >&5
configure:11491: $? = 0
configure:11491: result: yes
configure:11491: checking sys/time.h presence
configure:11491: gcc -E conftest.c
configure:11491: $? = 0
configure:11491: result: yes
configure:11491: checking for sys/time.h
configure:11491: result: yes
configure:11503: checking for gettimeofday
configure:11503: gcc -o conftest -g -O2 conftest.c -lrt -pthread >&5
configure:11503: $? = 0
configure:11503: result: yes
configure:11693: creating ./config.status
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by libusb config.status 1.0.9, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status
on kaligula
config.status:1165: creating libusb-1.0.pc
config.status:1165: creating Makefile
config.status:1165: creating libusb/Makefile
config.status:1165: creating examples/Makefile
config.status:1165: creating doc/Makefile
config.status:1165: creating doc/doxygen.cfg
config.status:1165: creating config.h
config.status:1394: executing depfiles commands
config.status:1394: executing libtool commands
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_c_inline=inline
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_func_gettimeofday=yes
ac_cv_func_sigaction=yes
ac_cv_have_decl_TFD_NONBLOCK=yes
ac_cv_header_dlfcn_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_poll_h=yes
ac_cv_header_stdc=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_time_h=yes
ac_cv_header_sys_timerfd_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_unistd_h=yes
ac_cv_host=x86_64-unknown-linux-gnu
ac_cv_lib_rt_clock_gettime=yes
ac_cv_objext=o
ac_cv_path_EGREP='/bin/grep -E'
ac_cv_path_FGREP='/bin/grep -F'
ac_cv_path_GREP=/bin/grep
ac_cv_path_SED=/bin/sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=mawk
ac_cv_prog_CPP='gcc -E'
ac_cv_prog_ac_ct_AR=ar
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_ac_ct_OBJDUMP=objdump
ac_cv_prog_ac_ct_RANLIB=ranlib
ac_cv_prog_ac_ct_STRIP=strip
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_gcc_c_o=yes
ac_cv_prog_make_make_set=yes
ac_cv_type_struct_timespec=yes
am_cv_CC_dependencies_compiler_type=gcc3
lt_cv_archive_cmds_need_lc=no
lt_cv_deplibs_check_method=pass_all
lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
lt_cv_ld_reload_flag=-r
lt_cv_nm_interface='BSD nm'
lt_cv_objdir=.libs
lt_cv_path_LD=/usr/bin/ld
lt_cv_path_NM='/usr/bin/nm -B'
lt_cv_prog_compiler_c_o=yes
lt_cv_prog_compiler_c_o_RC=yes
lt_cv_prog_compiler_pic_works=yes
lt_cv_prog_compiler_rtti_exceptions=no
lt_cv_prog_compiler_static_works=yes
lt_cv_prog_gnu_ld=yes
lt_cv_shlibpath_overrides_runpath=no
lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'''
lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/ {"\2", (void *) \&\2},/p'\'''
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \(lib[^ ]*\)$/ {"\2", (void *) \&\2},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/ {"lib\2", (void *) \&\2},/p'\'''
lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\'''
lt_cv_sys_max_cmd_len=1572864
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run aclocal-1.11'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run tar'
AM_BACKSLASH='\'
AM_CFLAGS='-std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow'
AM_DEFAULT_VERBOSITY='0'
AR='ar'
AUTOCONF='${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoconf'
AUTOHEADER='${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoheader'
AUTOMAKE='${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run automake-1.11'
AWK='mawk'
BUILD_EXAMPLES_FALSE=''
BUILD_EXAMPLES_TRUE='#'
CC='gcc'
CCDEPMODE='depmode=gcc3'
CFLAGS='-g -O2'
CPP='gcc -E'
CPPFLAGS=''
CYGPATH_W='echo'
DEFS='-DHAVE_CONFIG_H'
DEPDIR='.deps'
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='/bin/grep -E'
EXEEXT=''
FGREP='/bin/grep -F'
GREP='/bin/grep'
HAVE_SIGACTION_FALSE='#'
HAVE_SIGACTION_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD='/usr/bin/ld -m elf_x86_64'
LDFLAGS=''
LIBOBJS=''
LIBS=' -lrt -pthread'
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
LIPO=''
LN_S='ln -s'
LTLDFLAGS='-version-info 1:0:1 -no-undefined'
LTLIBOBJS=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEINFO='${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run makeinfo'
MKDIR_P='/bin/mkdir -p'
NM='/usr/bin/nm -B'
NMEDIT=''
OBJDUMP='objdump'
OBJEXT='o'
OS_DARWIN=''
OS_DARWIN_FALSE=''
OS_DARWIN_TRUE='#'
OS_LINUX=''
OS_LINUX_FALSE='#'
OS_LINUX_TRUE=''
OS_OPENBSD=''
OS_OPENBSD_FALSE=''
OS_OPENBSD_TRUE='#'
OS_WINDOWS=''
OS_WINDOWS_FALSE=''
OS_WINDOWS_TRUE='#'
OTOOL64=''
OTOOL=''
PACKAGE='libusb'
PACKAGE_BUGREPORT='libusb-devel@lists.sourceforge.net'
PACKAGE_NAME='libusb'
PACKAGE_STRING='libusb 1.0.9'
PACKAGE_TARNAME='libusb'
PACKAGE_URL='http://www.libusb.org/'
PACKAGE_VERSION='1.0.9'
PATH_SEPARATOR=':'
PC_LIBS_PRIVATE='-lrt -pthread'
RANLIB='ranlib'
RC=''
SED='/bin/sed'
SET_MAKE=''
SHELL='/bin/bash'
STRIP='strip'
THREADS_POSIX_FALSE='#'
THREADS_POSIX_TRUE=''
THREAD_CFLAGS='-pthread'
VERSION='1.0.9'
VISIBILITY_CFLAGS='-fvisibility=hidden'
ac_ct_CC='gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE='#'
am__fastdepCC_FALSE='#'
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='${prefix}'
host='x86_64-unknown-linux-gnu'
host_alias=''
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='/bin/mkdir -p'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "libusb"
#define PACKAGE_TARNAME "libusb"
#define PACKAGE_VERSION "1.0.9"
#define PACKAGE_STRING "libusb 1.0.9"
#define PACKAGE_BUGREPORT "libusb-devel@lists.sourceforge.net"
#define PACKAGE_URL "http://www.libusb.org/"
#define PACKAGE "libusb"
#define VERSION "1.0.9"
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define _GNU_SOURCE 1
#define OS_LINUX 1
#define HAVE_POLL_H 1
#define POLL_NFDS_TYPE nfds_t
#define THREADS_POSIX 1
#define USBI_TIMERFD_AVAILABLE 1
#define HAVE_STRUCT_TIMESPEC 1
#define ENABLE_LOGGING 1
#define DEFAULT_VISIBILITY __attribute__((visibility("default")))
#define HAVE_SYS_TIME_H 1
#define HAVE_GETTIMEOFDAY 1
configure: exit 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,222 +0,0 @@
dnl These m4 macros are whitespace sensitive and break if moved around much.
m4_define([LU_VERSION_H], m4_include([libusb/version.h]))
m4_define([LU_DEFINE_VERSION_ATOM],
[m4_define([$1], m4_bregexp(LU_VERSION_H,
[^#define\s*$1\s*\([0-9]*\).*], [\1]))])
m4_define([LU_DEFINE_VERSION_RC_ATOM],
[m4_define([$1], m4_bregexp(LU_VERSION_H,
[^#define\s*$1\s*"\(-rc[0-9]*\)".*], [\1]))])
dnl The m4_bregexp() returns (only) the numbers following the #define named
dnl in the first macro parameter. m4_define() then defines the name for use
dnl in AC_INIT().
LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR])
LU_DEFINE_VERSION_ATOM([LIBUSB_MINOR])
LU_DEFINE_VERSION_ATOM([LIBUSB_MICRO])
LU_DEFINE_VERSION_RC_ATOM([LIBUSB_RC])
AC_INIT([libusb], LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/])
# Library versioning
# These numbers should be tweaked on every release. Read carefully:
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
# http://sourceware.org/autobook/autobook/autobook_91.html
lt_current="1"
lt_revision="0"
lt_age="1"
LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([libusb/core.c])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER([config.h])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PREREQ([2.50])
AC_PROG_CC
AC_PROG_LIBTOOL
LT_LANG([Windows Resource])
AC_C_INLINE
AM_PROG_CC_C_O
AC_DEFINE([_GNU_SOURCE], 1, [Use GNU extensions])
LTLDFLAGS="${LTLDFLAGS} -no-undefined"
AC_MSG_CHECKING([operating system])
case $host in
*-linux*)
AC_MSG_RESULT([Linux])
backend="linux"
;;
*-darwin*)
AC_MSG_RESULT([Darwin/Mac OS X])
backend="darwin"
;;
*-openbsd*)
AC_MSG_RESULT([OpenBSD])
backend="openbsd"
;;
*-netbsd*)
AC_MSG_RESULT([NetBSD (using OpenBSD backend)])
backend="openbsd"
;;
*-mingw*)
AC_MSG_RESULT([Windows])
backend="windows"
;;
*-cygwin*)
AC_MSG_RESULT([Cygwin (using Windows backend)])
backend="windows"
threads="posix"
;;
*)
AC_MSG_ERROR([unsupported operating system])
esac
case $backend in
linux)
AC_DEFINE(OS_LINUX, 1, [Linux backend])
AC_SUBST(OS_LINUX)
AC_CHECK_LIB(rt, clock_gettime, PC_LIBS_PRIVATE="-lrt")
threads="posix"
THREAD_CFLAGS="-pthread"
PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
AC_CHECK_HEADERS([poll.h])
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
darwin)
AC_DEFINE(OS_DARWIN, 1, [Darwin backend])
AC_SUBST(OS_DARWIN)
threads="posix"
PC_LIBS_PRIVATE="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
AC_CHECK_HEADERS([poll.h])
AC_CHECK_TYPE([nfds_t],
[AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])],
[AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])],
[#include <poll.h>])
;;
openbsd)
AC_DEFINE(OS_OPENBSD, 1, [OpenBSD backend])
AC_SUBST(OS_OPENBSD)
threads="posix"
THREAD_CFLAGS="-pthread"
PC_LIBS_PRIVATE="-pthread"
AC_CHECK_HEADERS([poll.h])
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
windows)
AC_DEFINE(OS_WINDOWS, 1, [Windows backend])
AC_SUBST(OS_WINDOWS)
PC_LIBS_PRIVATE=""
LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
;;
esac
AC_SUBST(THREAD_CFLAGS)
AC_SUBST(PC_LIBS_PRIVATE)
LIBS="${LIBS} ${PC_LIBS_PRIVATE}"
AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xopenbsd)
AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
if test "$threads" = posix; then
AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
fi
# timerfd
AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=1], [timerfd_h=0])
AC_ARG_ENABLE([timerfd],
[AS_HELP_STRING([--enable-timerfd],
[use timerfd for timing (default auto)])],
[use_timerfd=$enableval], [use_timerfd='auto'])
if test "x$use_timerfd" = "xyes" -a "x$timerfd_h" = "x0"; then
AC_MSG_ERROR([timerfd header not available; glibc 2.9+ required])
fi
AC_CHECK_DECL([TFD_NONBLOCK], [tfd_hdr_ok=yes], [tfd_hdr_ok=no], [#include <sys/timerfd.h>])
if test "x$use_timerfd" = "xyes" -a "x$tfd_hdr_ok" = "xno"; then
AC_MSG_ERROR([timerfd header not usable; glibc 2.9+ required])
fi
AC_MSG_CHECKING([whether to use timerfd for timing])
if test "x$use_timerfd" = "xno"; then
AC_MSG_RESULT([no (disabled by user)])
else
if test "x$timerfd_h" = "x1" -a "x$tfd_hdr_ok" = "xyes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(USBI_TIMERFD_AVAILABLE, 1, [timerfd headers available])
else
AC_MSG_RESULT([no (header not available)])
fi
fi
AC_CHECK_TYPES(struct timespec)
# Message logging
AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
[log_enabled=$enableval],
[log_enabled='yes'])
if test "x$log_enabled" != "xno"; then
AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
fi
AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
[enable debug logging (default n)])],
[debug_log_enabled=$enableval],
[debug_log_enabled='no'])
if test "x$debug_log_enabled" != "xno"; then
AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
fi
# Examples build
AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
[build example applications (default n)])],
[build_examples=$enableval],
[build_examples='no'])
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
# check for -fvisibility=hidden compiler support (GCC >= 3.4)
saved_cflags="$CFLAGS"
# -Werror required for cygwin
CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[VISIBILITY_CFLAGS="-fvisibility=hidden"
AC_DEFINE([DEFAULT_VISIBILITY], [__attribute__((visibility("default")))], [Default visibility]) ],
[ VISIBILITY_CFLAGS=""
AC_DEFINE([DEFAULT_VISIBILITY], [], [Default visibility]) ],
])
CFLAGS="$saved_cflags"
# check for -Wno-pointer-sign compiler support (GCC >= 4)
saved_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
CFLAGS="$saved_cflags"
# sigaction not available on MinGW
AC_CHECK_FUNC([sigaction], [have_sigaction=yes], [have_sigaction=no])
AM_CONDITIONAL([HAVE_SIGACTION], [test "x$have_sigaction" = "xyes"])
# headers not available on all platforms but required on others
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_FUNCS(gettimeofday)
AM_CFLAGS="-std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
AC_SUBST(VISIBILITY_CFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(LTLDFLAGS)
AC_CONFIG_FILES([libusb-1.0.pc])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([libusb/Makefile])
AC_CONFIG_FILES([examples/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([doc/doxygen.cfg])
AC_OUTPUT

View File

@@ -1,630 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
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"
# 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
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 -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## 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).
## - 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 -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## 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.
tr ' ' '
' < "$tmpdepfile" |
## 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.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -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 -eq 0; then :
else
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 ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
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.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
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 -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
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.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
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 -eq 0; then :
else
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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#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.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# 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.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
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"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
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:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,377 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# doc/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
pkgdatadir = $(datadir)/libusb
pkgincludedir = $(includedir)/libusb
pkglibdir = $(libdir)/libusb
pkglibexecdir = $(libexecdir)/libusb
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/doxygen.cfg.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = doxygen.cfg
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run aclocal-1.11
AMTAR = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run tar
AM_CFLAGS = -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow
AM_DEFAULT_VERBOSITY = 0
AR = ar
AUTOCONF = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoconf
AUTOHEADER = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoheader
AUTOMAKE = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run automake-1.11
AWK = mawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
LIBOBJS =
LIBS = -lrt -pthread
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLDFLAGS = -version-info 1:0:1 -no-undefined
LTLIBOBJS =
MAINT = #
MAKEINFO = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OS_DARWIN =
OS_LINUX =
OS_OPENBSD =
OS_WINDOWS =
OTOOL =
OTOOL64 =
PACKAGE = libusb
PACKAGE_BUGREPORT = libusb-devel@lists.sourceforge.net
PACKAGE_NAME = libusb
PACKAGE_STRING = libusb 1.0.9
PACKAGE_TARNAME = libusb
PACKAGE_URL = http://www.libusb.org/
PACKAGE_VERSION = 1.0.9
PATH_SEPARATOR = :
PC_LIBS_PRIVATE = -lrt -pthread
RANLIB = ranlib
RC =
SED = /bin/sed
SET_MAKE =
SHELL = /bin/bash
STRIP = strip
THREAD_CFLAGS = -pthread
VERSION = 1.0.9
VISIBILITY_CFLAGS = -fvisibility=hidden
abs_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/doc
abs_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/doc
abs_top_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
abs_top_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
EXTRA_DIST = doxygen.cfg.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: # $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
doxygen.cfg: $(top_builddir)/config.status $(srcdir)/doxygen.cfg.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
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:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
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-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 Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-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-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
docs: doxygen.cfg
doxygen $^
docs-upload: docs
ln -s html api-1.0
rsync -av api-1.0/ web.sourceforge.net:htdocs/api-1.0/
rm -f api-1.0
# 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:

View File

@@ -1,10 +0,0 @@
EXTRA_DIST = doxygen.cfg.in
docs: doxygen.cfg
doxygen $^
docs-upload: docs
ln -s html api-1.0
rsync -av api-1.0/ web.sourceforge.net:htdocs/api-1.0/
rm -f api-1.0

View File

@@ -1,377 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/doxygen.cfg.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = doxygen.cfg
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLDFLAGS = @LTLDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OS_DARWIN = @OS_DARWIN@
OS_LINUX = @OS_LINUX@
OS_OPENBSD = @OS_OPENBSD@
OS_WINDOWS = @OS_WINDOWS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
THREAD_CFLAGS = @THREAD_CFLAGS@
VERSION = @VERSION@
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
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@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = doxygen.cfg.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
doxygen.cfg: $(top_builddir)/config.status $(srcdir)/doxygen.cfg.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
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:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
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-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 Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-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-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
docs: doxygen.cfg
doxygen $^
docs-upload: docs
ln -s html api-1.0
rsync -av api-1.0/ web.sourceforge.net:htdocs/api-1.0/
rm -f api-1.0
# 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:

View File

@@ -1,542 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# examples/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
pkgdatadir = $(datadir)/libusb
pkgincludedir = $(includedir)/libusb
pkglibdir = $(libdir)/libusb
pkglibexecdir = $(libexecdir)/libusb
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
noinst_PROGRAMS = listdevs$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
am__append_1 = dpfp
am__append_2 = dpfp_threaded
subdir = examples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = dpfp$(EXEEXT)
am__EXEEXT_2 = dpfp_threaded$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
am__dpfp_SOURCES_DIST = dpfp.c
am_dpfp_OBJECTS = dpfp.$(OBJEXT)
dpfp_OBJECTS = $(am_dpfp_OBJECTS)
dpfp_DEPENDENCIES = ../libusb/libusb-1.0.la
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
am__dpfp_threaded_SOURCES_DIST = dpfp_threaded.c
am_dpfp_threaded_OBJECTS = dpfp_threaded-dpfp_threaded.$(OBJEXT)
dpfp_threaded_OBJECTS = $(am_dpfp_threaded_OBJECTS)
dpfp_threaded_DEPENDENCIES = ../libusb/libusb-1.0.la
dpfp_threaded_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(dpfp_threaded_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_listdevs_OBJECTS = listdevs.$(OBJEXT)
listdevs_OBJECTS = $(am_listdevs_OBJECTS)
listdevs_DEPENDENCIES = ../libusb/libusb-1.0.la
DEFAULT_INCLUDES = -I. -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo " CC " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo " CCLD " $@;
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(dpfp_SOURCES) $(dpfp_threaded_SOURCES) $(listdevs_SOURCES)
DIST_SOURCES = $(am__dpfp_SOURCES_DIST) \
$(am__dpfp_threaded_SOURCES_DIST) $(listdevs_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run aclocal-1.11
AMTAR = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run tar
AM_CFLAGS = -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow
AM_DEFAULT_VERBOSITY = 0
AR = ar
AUTOCONF = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoconf
AUTOHEADER = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoheader
AUTOMAKE = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run automake-1.11
AWK = mawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
LIBOBJS =
LIBS = -lrt -pthread
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLDFLAGS = -version-info 1:0:1 -no-undefined
LTLIBOBJS =
MAINT = #
MAKEINFO = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OS_DARWIN =
OS_LINUX =
OS_OPENBSD =
OS_WINDOWS =
OTOOL =
OTOOL64 =
PACKAGE = libusb
PACKAGE_BUGREPORT = libusb-devel@lists.sourceforge.net
PACKAGE_NAME = libusb
PACKAGE_STRING = libusb 1.0.9
PACKAGE_TARNAME = libusb
PACKAGE_URL = http://www.libusb.org/
PACKAGE_VERSION = 1.0.9
PATH_SEPARATOR = :
PC_LIBS_PRIVATE = -lrt -pthread
RANLIB = ranlib
RC =
SED = /bin/sed
SET_MAKE =
SHELL = /bin/bash
STRIP = strip
THREAD_CFLAGS = -pthread
VERSION = 1.0.9
VISIBILITY_CFLAGS = -fvisibility=hidden
abs_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/examples
abs_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/examples
abs_top_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
abs_top_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
INCLUDES = -I$(top_srcdir)/libusb
listdevs_SOURCES = listdevs.c
listdevs_LDADD = ../libusb/libusb-1.0.la
dpfp_SOURCES = dpfp.c
dpfp_LDADD = ../libusb/libusb-1.0.la
dpfp_threaded_SOURCES = dpfp_threaded.c
dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
dpfp_threaded_LDADD = ../libusb/libusb-1.0.la
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu examples/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: # $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
dpfp$(EXEEXT): $(dpfp_OBJECTS) $(dpfp_DEPENDENCIES)
@rm -f dpfp$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(dpfp_OBJECTS) $(dpfp_LDADD) $(LIBS)
dpfp_threaded$(EXEEXT): $(dpfp_threaded_OBJECTS) $(dpfp_threaded_DEPENDENCIES)
@rm -f dpfp_threaded$(EXEEXT)
$(AM_V_CCLD)$(dpfp_threaded_LINK) $(dpfp_threaded_OBJECTS) $(dpfp_threaded_LDADD) $(LIBS)
listdevs$(EXEEXT): $(listdevs_OBJECTS) $(listdevs_DEPENDENCIES)
@rm -f listdevs$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(listdevs_OBJECTS) $(listdevs_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
include ./$(DEPDIR)/dpfp.Po
include ./$(DEPDIR)/dpfp_threaded-dpfp_threaded.Po
include ./$(DEPDIR)/listdevs.Po
.c.o:
$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
# $(AM_V_CC) \
# source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(COMPILE) -c $<
.c.obj:
$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
# $(AM_V_CC) \
# source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
# $(AM_V_CC) \
# source='$<' object='$@' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LTCOMPILE) -c -o $@ $<
dpfp_threaded-dpfp_threaded.o: dpfp_threaded.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -MT dpfp_threaded-dpfp_threaded.o -MD -MP -MF $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo -c -o dpfp_threaded-dpfp_threaded.o `test -f 'dpfp_threaded.c' || echo '$(srcdir)/'`dpfp_threaded.c
$(AM_V_at)$(am__mv) $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo $(DEPDIR)/dpfp_threaded-dpfp_threaded.Po
# $(AM_V_CC) \
# source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.o' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.o `test -f 'dpfp_threaded.c' || echo '$(srcdir)/'`dpfp_threaded.c
dpfp_threaded-dpfp_threaded.obj: dpfp_threaded.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -MT dpfp_threaded-dpfp_threaded.obj -MD -MP -MF $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo -c -o dpfp_threaded-dpfp_threaded.obj `if test -f 'dpfp_threaded.c'; then $(CYGPATH_W) 'dpfp_threaded.c'; else $(CYGPATH_W) '$(srcdir)/dpfp_threaded.c'; fi`
$(AM_V_at)$(am__mv) $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo $(DEPDIR)/dpfp_threaded-dpfp_threaded.Po
# $(AM_V_CC) \
# source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.obj' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.obj `if test -f 'dpfp_threaded.c'; then $(CYGPATH_W) 'dpfp_threaded.c'; else $(CYGPATH_W) '$(srcdir)/dpfp_threaded.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
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:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-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 mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am
# 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:

View File

@@ -1,21 +0,0 @@
INCLUDES = -I$(top_srcdir)/libusb
noinst_PROGRAMS = listdevs
listdevs_SOURCES = listdevs.c
listdevs_LDADD = ../libusb/libusb-1.0.la
if HAVE_SIGACTION
dpfp_SOURCES = dpfp.c
dpfp_LDADD = ../libusb/libusb-1.0.la
noinst_PROGRAMS += dpfp
endif
if THREADS_POSIX
if HAVE_SIGACTION
dpfp_threaded_SOURCES = dpfp_threaded.c
dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
dpfp_threaded_LDADD = ../libusb/libusb-1.0.la
noinst_PROGRAMS += dpfp_threaded
endif
endif

View File

@@ -1,542 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = listdevs$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
@HAVE_SIGACTION_TRUE@am__append_1 = dpfp
@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@am__append_2 = dpfp_threaded
subdir = examples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
@HAVE_SIGACTION_TRUE@am__EXEEXT_1 = dpfp$(EXEEXT)
@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@am__EXEEXT_2 = dpfp_threaded$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
am__dpfp_SOURCES_DIST = dpfp.c
@HAVE_SIGACTION_TRUE@am_dpfp_OBJECTS = dpfp.$(OBJEXT)
dpfp_OBJECTS = $(am_dpfp_OBJECTS)
@HAVE_SIGACTION_TRUE@dpfp_DEPENDENCIES = ../libusb/libusb-1.0.la
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
am__dpfp_threaded_SOURCES_DIST = dpfp_threaded.c
@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@am_dpfp_threaded_OBJECTS = dpfp_threaded-dpfp_threaded.$(OBJEXT)
dpfp_threaded_OBJECTS = $(am_dpfp_threaded_OBJECTS)
@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@dpfp_threaded_DEPENDENCIES = ../libusb/libusb-1.0.la
dpfp_threaded_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(dpfp_threaded_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_listdevs_OBJECTS = listdevs.$(OBJEXT)
listdevs_OBJECTS = $(am_listdevs_OBJECTS)
listdevs_DEPENDENCIES = ../libusb/libusb-1.0.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo " CC " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo " CCLD " $@;
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(dpfp_SOURCES) $(dpfp_threaded_SOURCES) $(listdevs_SOURCES)
DIST_SOURCES = $(am__dpfp_SOURCES_DIST) \
$(am__dpfp_threaded_SOURCES_DIST) $(listdevs_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLDFLAGS = @LTLDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OS_DARWIN = @OS_DARWIN@
OS_LINUX = @OS_LINUX@
OS_OPENBSD = @OS_OPENBSD@
OS_WINDOWS = @OS_WINDOWS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
THREAD_CFLAGS = @THREAD_CFLAGS@
VERSION = @VERSION@
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
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@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir)/libusb
listdevs_SOURCES = listdevs.c
listdevs_LDADD = ../libusb/libusb-1.0.la
@HAVE_SIGACTION_TRUE@dpfp_SOURCES = dpfp.c
@HAVE_SIGACTION_TRUE@dpfp_LDADD = ../libusb/libusb-1.0.la
@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@dpfp_threaded_SOURCES = dpfp_threaded.c
@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
@HAVE_SIGACTION_TRUE@@THREADS_POSIX_TRUE@dpfp_threaded_LDADD = ../libusb/libusb-1.0.la
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .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) --gnu examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu examples/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
dpfp$(EXEEXT): $(dpfp_OBJECTS) $(dpfp_DEPENDENCIES)
@rm -f dpfp$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(dpfp_OBJECTS) $(dpfp_LDADD) $(LIBS)
dpfp_threaded$(EXEEXT): $(dpfp_threaded_OBJECTS) $(dpfp_threaded_DEPENDENCIES)
@rm -f dpfp_threaded$(EXEEXT)
$(AM_V_CCLD)$(dpfp_threaded_LINK) $(dpfp_threaded_OBJECTS) $(dpfp_threaded_LDADD) $(LIBS)
listdevs$(EXEEXT): $(listdevs_OBJECTS) $(listdevs_DEPENDENCIES)
@rm -f listdevs$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(listdevs_OBJECTS) $(listdevs_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpfp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpfp_threaded-dpfp_threaded.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listdevs.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
dpfp_threaded-dpfp_threaded.o: dpfp_threaded.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -MT dpfp_threaded-dpfp_threaded.o -MD -MP -MF $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo -c -o dpfp_threaded-dpfp_threaded.o `test -f 'dpfp_threaded.c' || echo '$(srcdir)/'`dpfp_threaded.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo $(DEPDIR)/dpfp_threaded-dpfp_threaded.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.o `test -f 'dpfp_threaded.c' || echo '$(srcdir)/'`dpfp_threaded.c
dpfp_threaded-dpfp_threaded.obj: dpfp_threaded.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -MT dpfp_threaded-dpfp_threaded.obj -MD -MP -MF $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo -c -o dpfp_threaded-dpfp_threaded.obj `if test -f 'dpfp_threaded.c'; then $(CYGPATH_W) 'dpfp_threaded.c'; else $(CYGPATH_W) '$(srcdir)/dpfp_threaded.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpfp_threaded-dpfp_threaded.Tpo $(DEPDIR)/dpfp_threaded-dpfp_threaded.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dpfp_threaded.c' object='dpfp_threaded-dpfp_threaded.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dpfp_threaded_CFLAGS) $(CFLAGS) -c -o dpfp_threaded-dpfp_threaded.obj `if test -f 'dpfp_threaded.c'; then $(CYGPATH_W) 'dpfp_threaded.c'; else $(CYGPATH_W) '$(srcdir)/dpfp_threaded.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
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:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-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 mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am
# 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:

View File

@@ -1,507 +0,0 @@
/*
* libusb example program to manipulate U.are.U 4000B fingerprint scanner.
* Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
*
* Basic image capture program only, does not consider the powerup quirks or
* the fact that image encryption may be enabled. Not expected to work
* flawlessly all of the time.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <libusb.h>
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
#define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN)
#define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT)
#define USB_RQ 0x04
#define INTR_LENGTH 64
enum {
MODE_INIT = 0x00,
MODE_AWAIT_FINGER_ON = 0x10,
MODE_AWAIT_FINGER_OFF = 0x12,
MODE_CAPTURE = 0x20,
MODE_SHUT_UP = 0x30,
MODE_READY = 0x80,
};
static int next_state(void);
enum {
STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON = 1,
STATE_AWAIT_IRQ_FINGER_DETECTED,
STATE_AWAIT_MODE_CHANGE_CAPTURE,
STATE_AWAIT_IMAGE,
STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF,
STATE_AWAIT_IRQ_FINGER_REMOVED,
};
static int state = 0;
static struct libusb_device_handle *devh = NULL;
static unsigned char imgbuf[0x1b340];
static unsigned char irqbuf[INTR_LENGTH];
static struct libusb_transfer *img_transfer = NULL;
static struct libusb_transfer *irq_transfer = NULL;
static int img_idx = 0;
static int do_exit = 0;
static int find_dpfp_device(void)
{
devh = libusb_open_device_with_vid_pid(NULL, 0x05ba, 0x000a);
return devh ? 0 : -EIO;
}
static int print_f0_data(void)
{
unsigned char data[0x10];
int r;
unsigned int i;
r = libusb_control_transfer(devh, CTRL_IN, USB_RQ, 0xf0, 0, data,
sizeof(data), 0);
if (r < 0) {
fprintf(stderr, "F0 error %d\n", r);
return r;
}
if ((unsigned int) r < sizeof(data)) {
fprintf(stderr, "short read (%d)\n", r);
return -1;
}
printf("F0 data:");
for (i = 0; i < sizeof(data); i++)
printf("%02x ", data[i]);
printf("\n");
return 0;
}
static int get_hwstat(unsigned char *status)
{
int r;
r = libusb_control_transfer(devh, CTRL_IN, USB_RQ, 0x07, 0, status, 1, 0);
if (r < 0) {
fprintf(stderr, "read hwstat error %d\n", r);
return r;
}
if ((unsigned int) r < 1) {
fprintf(stderr, "short read (%d)\n", r);
return -1;
}
printf("hwstat reads %02x\n", *status);
return 0;
}
static int set_hwstat(unsigned char data)
{
int r;
printf("set hwstat to %02x\n", data);
r = libusb_control_transfer(devh, CTRL_OUT, USB_RQ, 0x07, 0, &data, 1, 0);
if (r < 0) {
fprintf(stderr, "set hwstat error %d\n", r);
return r;
}
if ((unsigned int) r < 1) {
fprintf(stderr, "short write (%d)", r);
return -1;
}
return 0;
}
static int set_mode(unsigned char data)
{
int r;
printf("set mode %02x\n", data);
r = libusb_control_transfer(devh, CTRL_OUT, USB_RQ, 0x4e, 0, &data, 1, 0);
if (r < 0) {
fprintf(stderr, "set mode error %d\n", r);
return r;
}
if ((unsigned int) r < 1) {
fprintf(stderr, "short write (%d)", r);
return -1;
}
return 0;
}
static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "mode change transfer not completed!\n");
do_exit = 2;
}
printf("async cb_mode_changed length=%d actual_length=%d\n",
transfer->length, transfer->actual_length);
if (next_state() < 0)
do_exit = 2;
}
static int set_mode_async(unsigned char data)
{
unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
struct libusb_transfer *transfer;
if (!buf)
return -ENOMEM;
transfer = libusb_alloc_transfer(0);
if (!transfer) {
free(buf);
return -ENOMEM;
}
printf("async set mode %02x\n", data);
libusb_fill_control_setup(buf, CTRL_OUT, USB_RQ, 0x4e, 0, 1);
buf[LIBUSB_CONTROL_SETUP_SIZE] = data;
libusb_fill_control_transfer(transfer, devh, buf, cb_mode_changed, NULL,
1000);
transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK
| LIBUSB_TRANSFER_FREE_BUFFER | LIBUSB_TRANSFER_FREE_TRANSFER;
return libusb_submit_transfer(transfer);
}
static int do_sync_intr(unsigned char *data)
{
int r;
int transferred;
r = libusb_interrupt_transfer(devh, EP_INTR, data, INTR_LENGTH,
&transferred, 1000);
if (r < 0) {
fprintf(stderr, "intr error %d\n", r);
return r;
}
if (transferred < INTR_LENGTH) {
fprintf(stderr, "short read (%d)\n", r);
return -1;
}
printf("recv interrupt %04x\n", *((uint16_t *) data));
return 0;
}
static int sync_intr(unsigned char type)
{
int r;
unsigned char data[INTR_LENGTH];
while (1) {
r = do_sync_intr(data);
if (r < 0)
return r;
if (data[0] == type)
return 0;
}
}
static int save_to_file(unsigned char *data)
{
FILE *fd;
char filename[64];
snprintf(filename, sizeof(filename), "finger%d.pgm", img_idx++);
fd = fopen(filename, "w");
if (!fd)
return -1;
fputs("P5 384 289 255 ", fd);
(void) fwrite(data + 64, 1, 384*289, fd);
fclose(fd);
printf("saved image to %s\n", filename);
return 0;
}
static int next_state(void)
{
int r = 0;
printf("old state: %d\n", state);
switch (state) {
case STATE_AWAIT_IRQ_FINGER_REMOVED:
state = STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON;
r = set_mode_async(MODE_AWAIT_FINGER_ON);
break;
case STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON:
state = STATE_AWAIT_IRQ_FINGER_DETECTED;
break;
case STATE_AWAIT_IRQ_FINGER_DETECTED:
state = STATE_AWAIT_MODE_CHANGE_CAPTURE;
r = set_mode_async(MODE_CAPTURE);
break;
case STATE_AWAIT_MODE_CHANGE_CAPTURE:
state = STATE_AWAIT_IMAGE;
break;
case STATE_AWAIT_IMAGE:
state = STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF;
r = set_mode_async(MODE_AWAIT_FINGER_OFF);
break;
case STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF:
state = STATE_AWAIT_IRQ_FINGER_REMOVED;
break;
default:
printf("unrecognised state %d\n", state);
}
if (r < 0) {
fprintf(stderr, "error detected changing state\n");
return r;
}
printf("new state: %d\n", state);
return 0;
}
static void LIBUSB_CALL cb_irq(struct libusb_transfer *transfer)
{
unsigned char irqtype = transfer->buffer[0];
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "irq transfer status %d?\n", transfer->status);
do_exit = 2;
libusb_free_transfer(transfer);
irq_transfer = NULL;
return;
}
printf("IRQ callback %02x\n", irqtype);
switch (state) {
case STATE_AWAIT_IRQ_FINGER_DETECTED:
if (irqtype == 0x01) {
if (next_state() < 0) {
do_exit = 2;
return;
}
} else {
printf("finger-on-sensor detected in wrong state!\n");
}
break;
case STATE_AWAIT_IRQ_FINGER_REMOVED:
if (irqtype == 0x02) {
if (next_state() < 0) {
do_exit = 2;
return;
}
} else {
printf("finger-on-sensor detected in wrong state!\n");
}
break;
}
if (libusb_submit_transfer(irq_transfer) < 0)
do_exit = 2;
}
static void LIBUSB_CALL cb_img(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "img transfer status %d?\n", transfer->status);
do_exit = 2;
libusb_free_transfer(transfer);
img_transfer = NULL;
return;
}
printf("Image callback\n");
save_to_file(imgbuf);
if (next_state() < 0) {
do_exit = 2;
return;
}
if (libusb_submit_transfer(img_transfer) < 0)
do_exit = 2;
}
static int init_capture(void)
{
int r;
r = libusb_submit_transfer(irq_transfer);
if (r < 0)
return r;
r = libusb_submit_transfer(img_transfer);
if (r < 0) {
libusb_cancel_transfer(irq_transfer);
while (irq_transfer)
if (libusb_handle_events(NULL) < 0)
break;
return r;
}
/* start state machine */
state = STATE_AWAIT_IRQ_FINGER_REMOVED;
return next_state();
}
static int do_init(void)
{
unsigned char status;
int r;
r = get_hwstat(&status);
if (r < 0)
return r;
if (!(status & 0x80)) {
r = set_hwstat(status | 0x80);
if (r < 0)
return r;
r = get_hwstat(&status);
if (r < 0)
return r;
}
status &= ~0x80;
r = set_hwstat(status);
if (r < 0)
return r;
r = get_hwstat(&status);
if (r < 0)
return r;
r = sync_intr(0x56);
if (r < 0)
return r;
return 0;
}
static int alloc_transfers(void)
{
img_transfer = libusb_alloc_transfer(0);
if (!img_transfer)
return -ENOMEM;
irq_transfer = libusb_alloc_transfer(0);
if (!irq_transfer)
return -ENOMEM;
libusb_fill_bulk_transfer(img_transfer, devh, EP_DATA, imgbuf,
sizeof(imgbuf), cb_img, NULL, 0);
libusb_fill_interrupt_transfer(irq_transfer, devh, EP_INTR, irqbuf,
sizeof(irqbuf), cb_irq, NULL, 0);
return 0;
}
static void sighandler(int signum)
{
do_exit = 1;
}
int main(void)
{
struct sigaction sigact;
int r = 1;
r = libusb_init(NULL);
if (r < 0) {
fprintf(stderr, "failed to initialise libusb\n");
exit(1);
}
r = find_dpfp_device();
if (r < 0) {
fprintf(stderr, "Could not find/open device\n");
goto out;
}
r = libusb_claim_interface(devh, 0);
if (r < 0) {
fprintf(stderr, "usb_claim_interface error %d\n", r);
goto out;
}
printf("claimed interface\n");
r = print_f0_data();
if (r < 0)
goto out_release;
r = do_init();
if (r < 0)
goto out_deinit;
/* async from here onwards */
r = alloc_transfers();
if (r < 0)
goto out_deinit;
r = init_capture();
if (r < 0)
goto out_deinit;
sigact.sa_handler = sighandler;
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
sigaction(SIGINT, &sigact, NULL);
sigaction(SIGTERM, &sigact, NULL);
sigaction(SIGQUIT, &sigact, NULL);
while (!do_exit) {
r = libusb_handle_events(NULL);
if (r < 0)
goto out_deinit;
}
printf("shutting down...\n");
if (irq_transfer) {
r = libusb_cancel_transfer(irq_transfer);
if (r < 0)
goto out_deinit;
}
if (img_transfer) {
r = libusb_cancel_transfer(img_transfer);
if (r < 0)
goto out_deinit;
}
while (irq_transfer || img_transfer)
if (libusb_handle_events(NULL) < 0)
break;
if (do_exit == 1)
r = 0;
else
r = 1;
out_deinit:
libusb_free_transfer(img_transfer);
libusb_free_transfer(irq_transfer);
set_mode(0);
set_hwstat(0x80);
out_release:
libusb_release_interface(devh, 0);
out:
libusb_close(devh);
libusb_exit(NULL);
return r >= 0 ? r : -r;
}

View File

@@ -1,545 +0,0 @@
/*
* libusb example program to manipulate U.are.U 4000B fingerprint scanner.
* Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
*
* Basic image capture program only, does not consider the powerup quirks or
* the fact that image encryption may be enabled. Not expected to work
* flawlessly all of the time.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <libusb.h>
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
#define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN)
#define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT)
#define USB_RQ 0x04
#define INTR_LENGTH 64
enum {
MODE_INIT = 0x00,
MODE_AWAIT_FINGER_ON = 0x10,
MODE_AWAIT_FINGER_OFF = 0x12,
MODE_CAPTURE = 0x20,
MODE_SHUT_UP = 0x30,
MODE_READY = 0x80,
};
static int next_state(void);
enum {
STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON = 1,
STATE_AWAIT_IRQ_FINGER_DETECTED,
STATE_AWAIT_MODE_CHANGE_CAPTURE,
STATE_AWAIT_IMAGE,
STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF,
STATE_AWAIT_IRQ_FINGER_REMOVED,
};
static int state = 0;
static struct libusb_device_handle *devh = NULL;
static unsigned char imgbuf[0x1b340];
static unsigned char irqbuf[INTR_LENGTH];
static struct libusb_transfer *img_transfer = NULL;
static struct libusb_transfer *irq_transfer = NULL;
static int img_idx = 0;
static int do_exit = 0;
static pthread_t poll_thread;
static pthread_cond_t exit_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t exit_cond_lock = PTHREAD_MUTEX_INITIALIZER;
static void request_exit(int code)
{
do_exit = code;
pthread_cond_signal(&exit_cond);
}
static void *poll_thread_main(void *arg)
{
int r = 0;
printf("poll thread running\n");
while (!do_exit) {
struct timeval tv = { 1, 0 };
r = libusb_handle_events_timeout(NULL, &tv);
if (r < 0) {
request_exit(2);
break;
}
}
printf("poll thread shutting down\n");
return NULL;
}
static int find_dpfp_device(void)
{
devh = libusb_open_device_with_vid_pid(NULL, 0x05ba, 0x000a);
return devh ? 0 : -EIO;
}
static int print_f0_data(void)
{
unsigned char data[0x10];
int r;
unsigned int i;
r = libusb_control_transfer(devh, CTRL_IN, USB_RQ, 0xf0, 0, data,
sizeof(data), 0);
if (r < 0) {
fprintf(stderr, "F0 error %d\n", r);
return r;
}
if ((unsigned int) r < sizeof(data)) {
fprintf(stderr, "short read (%d)\n", r);
return -1;
}
printf("F0 data:");
for (i = 0; i < sizeof(data); i++)
printf("%02x ", data[i]);
printf("\n");
return 0;
}
static int get_hwstat(unsigned char *status)
{
int r;
r = libusb_control_transfer(devh, CTRL_IN, USB_RQ, 0x07, 0, status, 1, 0);
if (r < 0) {
fprintf(stderr, "read hwstat error %d\n", r);
return r;
}
if ((unsigned int) r < 1) {
fprintf(stderr, "short read (%d)\n", r);
return -1;
}
printf("hwstat reads %02x\n", *status);
return 0;
}
static int set_hwstat(unsigned char data)
{
int r;
printf("set hwstat to %02x\n", data);
r = libusb_control_transfer(devh, CTRL_OUT, USB_RQ, 0x07, 0, &data, 1, 0);
if (r < 0) {
fprintf(stderr, "set hwstat error %d\n", r);
return r;
}
if ((unsigned int) r < 1) {
fprintf(stderr, "short write (%d)", r);
return -1;
}
return 0;
}
static int set_mode(unsigned char data)
{
int r;
printf("set mode %02x\n", data);
r = libusb_control_transfer(devh, CTRL_OUT, USB_RQ, 0x4e, 0, &data, 1, 0);
if (r < 0) {
fprintf(stderr, "set mode error %d\n", r);
return r;
}
if ((unsigned int) r < 1) {
fprintf(stderr, "short write (%d)", r);
return -1;
}
return 0;
}
static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "mode change transfer not completed!\n");
request_exit(2);
}
printf("async cb_mode_changed length=%d actual_length=%d\n",
transfer->length, transfer->actual_length);
if (next_state() < 0)
request_exit(2);
}
static int set_mode_async(unsigned char data)
{
unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
struct libusb_transfer *transfer;
if (!buf)
return -ENOMEM;
transfer = libusb_alloc_transfer(0);
if (!transfer) {
free(buf);
return -ENOMEM;
}
printf("async set mode %02x\n", data);
libusb_fill_control_setup(buf, CTRL_OUT, USB_RQ, 0x4e, 0, 1);
buf[LIBUSB_CONTROL_SETUP_SIZE] = data;
libusb_fill_control_transfer(transfer, devh, buf, cb_mode_changed, NULL,
1000);
transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK
| LIBUSB_TRANSFER_FREE_BUFFER | LIBUSB_TRANSFER_FREE_TRANSFER;
return libusb_submit_transfer(transfer);
}
static int do_sync_intr(unsigned char *data)
{
int r;
int transferred;
r = libusb_interrupt_transfer(devh, EP_INTR, data, INTR_LENGTH,
&transferred, 1000);
if (r < 0) {
fprintf(stderr, "intr error %d\n", r);
return r;
}
if (transferred < INTR_LENGTH) {
fprintf(stderr, "short read (%d)\n", r);
return -1;
}
printf("recv interrupt %04x\n", *((uint16_t *) data));
return 0;
}
static int sync_intr(unsigned char type)
{
int r;
unsigned char data[INTR_LENGTH];
while (1) {
r = do_sync_intr(data);
if (r < 0)
return r;
if (data[0] == type)
return 0;
}
}
static int save_to_file(unsigned char *data)
{
FILE *fd;
char filename[64];
snprintf(filename, sizeof(filename), "finger%d.pgm", img_idx++);
fd = fopen(filename, "w");
if (!fd)
return -1;
fputs("P5 384 289 255 ", fd);
(void) fwrite(data + 64, 1, 384*289, fd);
fclose(fd);
printf("saved image to %s\n", filename);
return 0;
}
static int next_state(void)
{
int r = 0;
printf("old state: %d\n", state);
switch (state) {
case STATE_AWAIT_IRQ_FINGER_REMOVED:
state = STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON;
r = set_mode_async(MODE_AWAIT_FINGER_ON);
break;
case STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON:
state = STATE_AWAIT_IRQ_FINGER_DETECTED;
break;
case STATE_AWAIT_IRQ_FINGER_DETECTED:
state = STATE_AWAIT_MODE_CHANGE_CAPTURE;
r = set_mode_async(MODE_CAPTURE);
break;
case STATE_AWAIT_MODE_CHANGE_CAPTURE:
state = STATE_AWAIT_IMAGE;
break;
case STATE_AWAIT_IMAGE:
state = STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF;
r = set_mode_async(MODE_AWAIT_FINGER_OFF);
break;
case STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF:
state = STATE_AWAIT_IRQ_FINGER_REMOVED;
break;
default:
printf("unrecognised state %d\n", state);
}
if (r < 0) {
fprintf(stderr, "error detected changing state\n");
return r;
}
printf("new state: %d\n", state);
return 0;
}
static void LIBUSB_CALL cb_irq(struct libusb_transfer *transfer)
{
unsigned char irqtype = transfer->buffer[0];
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "irq transfer status %d?\n", transfer->status);
irq_transfer = NULL;
request_exit(2);
return;
}
printf("IRQ callback %02x\n", irqtype);
switch (state) {
case STATE_AWAIT_IRQ_FINGER_DETECTED:
if (irqtype == 0x01) {
if (next_state() < 0) {
request_exit(2);
return;
}
} else {
printf("finger-on-sensor detected in wrong state!\n");
}
break;
case STATE_AWAIT_IRQ_FINGER_REMOVED:
if (irqtype == 0x02) {
if (next_state() < 0) {
request_exit(2);
return;
}
} else {
printf("finger-on-sensor detected in wrong state!\n");
}
break;
}
if (libusb_submit_transfer(irq_transfer) < 0)
request_exit(2);
}
static void LIBUSB_CALL cb_img(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "img transfer status %d?\n", transfer->status);
img_transfer = NULL;
request_exit(2);
return;
}
printf("Image callback\n");
save_to_file(imgbuf);
if (next_state() < 0) {
request_exit(2);
return;
}
if (libusb_submit_transfer(img_transfer) < 0)
request_exit(2);
}
static int init_capture(void)
{
int r;
r = libusb_submit_transfer(irq_transfer);
if (r < 0)
return r;
r = libusb_submit_transfer(img_transfer);
if (r < 0) {
libusb_cancel_transfer(irq_transfer);
while (irq_transfer)
if (libusb_handle_events(NULL) < 0)
break;
return r;
}
/* start state machine */
state = STATE_AWAIT_IRQ_FINGER_REMOVED;
return next_state();
}
static int do_init(void)
{
unsigned char status;
int r;
r = get_hwstat(&status);
if (r < 0)
return r;
if (!(status & 0x80)) {
r = set_hwstat(status | 0x80);
if (r < 0)
return r;
r = get_hwstat(&status);
if (r < 0)
return r;
}
status &= ~0x80;
r = set_hwstat(status);
if (r < 0)
return r;
r = get_hwstat(&status);
if (r < 0)
return r;
r = sync_intr(0x56);
if (r < 0)
return r;
return 0;
}
static int alloc_transfers(void)
{
img_transfer = libusb_alloc_transfer(0);
if (!img_transfer)
return -ENOMEM;
irq_transfer = libusb_alloc_transfer(0);
if (!irq_transfer)
return -ENOMEM;
libusb_fill_bulk_transfer(img_transfer, devh, EP_DATA, imgbuf,
sizeof(imgbuf), cb_img, NULL, 0);
libusb_fill_interrupt_transfer(irq_transfer, devh, EP_INTR, irqbuf,
sizeof(irqbuf), cb_irq, NULL, 0);
return 0;
}
static void sighandler(int signum)
{
request_exit(1);
}
int main(void)
{
struct sigaction sigact;
int r = 1;
r = libusb_init(NULL);
if (r < 0) {
fprintf(stderr, "failed to initialise libusb\n");
exit(1);
}
r = find_dpfp_device();
if (r < 0) {
fprintf(stderr, "Could not find/open device\n");
goto out;
}
r = libusb_claim_interface(devh, 0);
if (r < 0) {
fprintf(stderr, "usb_claim_interface error %d %s\n", r, strerror(-r));
goto out;
}
printf("claimed interface\n");
r = print_f0_data();
if (r < 0)
goto out_release;
r = do_init();
if (r < 0)
goto out_deinit;
/* async from here onwards */
sigact.sa_handler = sighandler;
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
sigaction(SIGINT, &sigact, NULL);
sigaction(SIGTERM, &sigact, NULL);
sigaction(SIGQUIT, &sigact, NULL);
r = pthread_create(&poll_thread, NULL, poll_thread_main, NULL);
if (r)
goto out_deinit;
r = alloc_transfers();
if (r < 0) {
request_exit(1);
pthread_join(poll_thread, NULL);
goto out_deinit;
}
r = init_capture();
if (r < 0) {
request_exit(1);
pthread_join(poll_thread, NULL);
goto out_deinit;
}
while (!do_exit) {
pthread_mutex_lock(&exit_cond_lock);
pthread_cond_wait(&exit_cond, &exit_cond_lock);
pthread_mutex_unlock(&exit_cond_lock);
}
printf("shutting down...\n");
pthread_join(poll_thread, NULL);
r = libusb_cancel_transfer(irq_transfer);
if (r < 0) {
request_exit(1);
goto out_deinit;
}
r = libusb_cancel_transfer(img_transfer);
if (r < 0) {
request_exit(1);
goto out_deinit;
}
while (img_transfer || irq_transfer)
if (libusb_handle_events(NULL) < 0)
break;
if (do_exit == 1)
r = 0;
else
r = 1;
out_deinit:
libusb_free_transfer(img_transfer);
libusb_free_transfer(irq_transfer);
set_mode(0);
set_hwstat(0x80);
out_release:
libusb_release_interface(devh, 0);
out:
libusb_close(devh);
libusb_exit(NULL);
return r >= 0 ? r : -r;
}

View File

@@ -1,64 +0,0 @@
/*
* libusb example program to list devices on the bus
* Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <sys/types.h>
#include <libusb.h>
static void print_devs(libusb_device **devs)
{
libusb_device *dev;
int i = 0;
while ((dev = devs[i++]) != NULL) {
struct libusb_device_descriptor desc;
int r = libusb_get_device_descriptor(dev, &desc);
if (r < 0) {
fprintf(stderr, "failed to get device descriptor");
return;
}
printf("%04x:%04x (bus %d, device %d)\n",
desc.idVendor, desc.idProduct,
libusb_get_bus_number(dev), libusb_get_device_address(dev));
}
}
int main(void)
{
libusb_device **devs;
int r;
ssize_t cnt;
r = libusb_init(NULL);
if (r < 0)
return r;
cnt = libusb_get_device_list(NULL, &devs);
if (cnt < 0)
return (int) cnt;
print_devs(devs);
libusb_free_device_list(devs, 1);
libusb_exit(NULL);
return 0;
}

View File

@@ -1,520 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
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
trap '(exit $?); exit' 1 2 13 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 starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +0,0 @@
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libusb-1.0
Description: C API for USB device access from Linux, Mac OS X, OpenBSD, NetBSD and Windows userspace
Version: 1.0.9
Libs: -L${libdir} -lusb-1.0
Libs.private: -lrt -pthread
Cflags: -I${includedir}/libusb-1.0

View File

@@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libusb-1.0
Description: C API for USB device access from Linux, Mac OS X, OpenBSD, NetBSD and Windows userspace
Version: @VERSION@
Libs: -L${libdir} -lusb-1.0
Libs.private: @PC_LIBS_PRIVATE@
Cflags: -I${includedir}/libusb-1.0

View File

@@ -1,205 +0,0 @@
libusb_1_0_la-core.lo: core.c /usr/include/stdc-predef.h ../config.h \
/usr/include/errno.h /usr/include/features.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h /usr/include/stdio.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/wchar.h \
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
/usr/include/x86_64-linux-gnu/bits/stdio.h /usr/include/stdlib.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/xlocale.h \
/usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/sigset.h \
/usr/include/x86_64-linux-gnu/bits/time.h \
/usr/include/x86_64-linux-gnu/sys/sysmacros.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/string.h \
/usr/include/x86_64-linux-gnu/bits/string.h \
/usr/include/x86_64-linux-gnu/bits/string2.h \
/usr/include/x86_64-linux-gnu/sys/time.h libusbi.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h /usr/include/stdint.h \
/usr/include/x86_64-linux-gnu/bits/wchar.h \
/usr/include/x86_64-linux-gnu/bits/timex.h /usr/include/poll.h \
/usr/include/x86_64-linux-gnu/sys/poll.h \
/usr/include/x86_64-linux-gnu/bits/poll.h libusb.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h \
/usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
/usr/include/x86_64-linux-gnu/bits/local_lim.h \
/usr/include/linux/limits.h \
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h version.h \
os/threads_posix.h /usr/include/pthread.h /usr/include/sched.h \
/usr/include/x86_64-linux-gnu/bits/sched.h \
/usr/include/x86_64-linux-gnu/bits/setjmp.h /usr/include/unistd.h \
/usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \
os/poll_posix.h
/usr/include/stdc-predef.h:
../config.h:
/usr/include/errno.h:
/usr/include/features.h:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:
/usr/include/x86_64-linux-gnu/bits/wordsize.h:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
/usr/include/x86_64-linux-gnu/bits/errno.h:
/usr/include/linux/errno.h:
/usr/include/x86_64-linux-gnu/asm/errno.h:
/usr/include/asm-generic/errno.h:
/usr/include/asm-generic/errno-base.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h:
/usr/include/stdio.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h:
/usr/include/x86_64-linux-gnu/bits/types.h:
/usr/include/x86_64-linux-gnu/bits/typesizes.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
/usr/include/x86_64-linux-gnu/bits/stdio.h:
/usr/include/stdlib.h:
/usr/include/x86_64-linux-gnu/bits/waitflags.h:
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/x86_64-linux-gnu/bits/endian.h:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
/usr/include/xlocale.h:
/usr/include/x86_64-linux-gnu/sys/types.h:
/usr/include/time.h:
/usr/include/x86_64-linux-gnu/sys/select.h:
/usr/include/x86_64-linux-gnu/bits/select.h:
/usr/include/x86_64-linux-gnu/bits/sigset.h:
/usr/include/x86_64-linux-gnu/bits/time.h:
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
/usr/include/alloca.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
/usr/include/string.h:
/usr/include/x86_64-linux-gnu/bits/string.h:
/usr/include/x86_64-linux-gnu/bits/string2.h:
/usr/include/x86_64-linux-gnu/sys/time.h:
libusbi.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:
/usr/include/stdint.h:
/usr/include/x86_64-linux-gnu/bits/wchar.h:
/usr/include/x86_64-linux-gnu/bits/timex.h:
/usr/include/poll.h:
/usr/include/x86_64-linux-gnu/sys/poll.h:
/usr/include/x86_64-linux-gnu/bits/poll.h:
libusb.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h:
/usr/include/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
/usr/include/x86_64-linux-gnu/bits/local_lim.h:
/usr/include/linux/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h:
version.h:
os/threads_posix.h:
/usr/include/pthread.h:
/usr/include/sched.h:
/usr/include/x86_64-linux-gnu/bits/sched.h:
/usr/include/x86_64-linux-gnu/bits/setjmp.h:
/usr/include/unistd.h:
/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
/usr/include/x86_64-linux-gnu/bits/environments.h:
/usr/include/x86_64-linux-gnu/bits/confname.h:
/usr/include/getopt.h:
os/poll_posix.h:

View File

@@ -1,181 +0,0 @@
libusb_1_0_la-descriptor.lo: descriptor.c /usr/include/stdc-predef.h \
/usr/include/errno.h /usr/include/features.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h /usr/include/stdint.h \
/usr/include/x86_64-linux-gnu/bits/wchar.h /usr/include/stdlib.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h \
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
/usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/sigset.h \
/usr/include/x86_64-linux-gnu/bits/time.h \
/usr/include/x86_64-linux-gnu/sys/sysmacros.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/string.h \
/usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
/usr/include/x86_64-linux-gnu/bits/string2.h libusbi.h ../config.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h /usr/include/poll.h \
/usr/include/x86_64-linux-gnu/sys/poll.h \
/usr/include/x86_64-linux-gnu/bits/poll.h libusb.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h \
/usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
/usr/include/x86_64-linux-gnu/bits/local_lim.h \
/usr/include/linux/limits.h \
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
/usr/include/x86_64-linux-gnu/sys/time.h version.h os/threads_posix.h \
/usr/include/pthread.h /usr/include/sched.h \
/usr/include/x86_64-linux-gnu/bits/sched.h \
/usr/include/x86_64-linux-gnu/bits/setjmp.h /usr/include/unistd.h \
/usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \
os/poll_posix.h
/usr/include/stdc-predef.h:
/usr/include/errno.h:
/usr/include/features.h:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:
/usr/include/x86_64-linux-gnu/bits/wordsize.h:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
/usr/include/x86_64-linux-gnu/bits/errno.h:
/usr/include/linux/errno.h:
/usr/include/x86_64-linux-gnu/asm/errno.h:
/usr/include/asm-generic/errno.h:
/usr/include/asm-generic/errno-base.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:
/usr/include/stdint.h:
/usr/include/x86_64-linux-gnu/bits/wchar.h:
/usr/include/stdlib.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h:
/usr/include/x86_64-linux-gnu/bits/waitflags.h:
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/x86_64-linux-gnu/bits/endian.h:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:
/usr/include/x86_64-linux-gnu/bits/types.h:
/usr/include/x86_64-linux-gnu/bits/typesizes.h:
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
/usr/include/x86_64-linux-gnu/sys/types.h:
/usr/include/time.h:
/usr/include/x86_64-linux-gnu/sys/select.h:
/usr/include/x86_64-linux-gnu/bits/select.h:
/usr/include/x86_64-linux-gnu/bits/sigset.h:
/usr/include/x86_64-linux-gnu/bits/time.h:
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
/usr/include/alloca.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
/usr/include/string.h:
/usr/include/xlocale.h:
/usr/include/x86_64-linux-gnu/bits/string.h:
/usr/include/x86_64-linux-gnu/bits/string2.h:
libusbi.h:
../config.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h:
/usr/include/poll.h:
/usr/include/x86_64-linux-gnu/sys/poll.h:
/usr/include/x86_64-linux-gnu/bits/poll.h:
libusb.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h:
/usr/include/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
/usr/include/x86_64-linux-gnu/bits/local_lim.h:
/usr/include/linux/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
/usr/include/x86_64-linux-gnu/sys/time.h:
version.h:
os/threads_posix.h:
/usr/include/pthread.h:
/usr/include/sched.h:
/usr/include/x86_64-linux-gnu/bits/sched.h:
/usr/include/x86_64-linux-gnu/bits/setjmp.h:
/usr/include/unistd.h:
/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
/usr/include/x86_64-linux-gnu/bits/environments.h:
/usr/include/x86_64-linux-gnu/bits/confname.h:
/usr/include/getopt.h:
os/poll_posix.h:

View File

@@ -1,219 +0,0 @@
libusb_1_0_la-io.lo: io.c /usr/include/stdc-predef.h ../config.h \
/usr/include/errno.h /usr/include/features.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
/usr/include/signal.h /usr/include/x86_64-linux-gnu/bits/sigset.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h \
/usr/include/x86_64-linux-gnu/bits/signum.h /usr/include/time.h \
/usr/include/x86_64-linux-gnu/bits/siginfo.h \
/usr/include/x86_64-linux-gnu/bits/sigaction.h \
/usr/include/x86_64-linux-gnu/bits/sigcontext.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h \
/usr/include/x86_64-linux-gnu/bits/sigstack.h \
/usr/include/x86_64-linux-gnu/sys/ucontext.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
/usr/include/x86_64-linux-gnu/bits/sigthread.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h /usr/include/stdint.h \
/usr/include/x86_64-linux-gnu/bits/wchar.h /usr/include/stdlib.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/xlocale.h \
/usr/include/x86_64-linux-gnu/sys/types.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/time.h \
/usr/include/x86_64-linux-gnu/sys/sysmacros.h /usr/include/alloca.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/string.h \
/usr/include/x86_64-linux-gnu/bits/string.h \
/usr/include/x86_64-linux-gnu/bits/string2.h \
/usr/include/x86_64-linux-gnu/bits/timex.h \
/usr/include/x86_64-linux-gnu/sys/time.h \
/usr/include/x86_64-linux-gnu/sys/timerfd.h \
/usr/include/x86_64-linux-gnu/bits/timerfd.h libusbi.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h /usr/include/poll.h \
/usr/include/x86_64-linux-gnu/sys/poll.h \
/usr/include/x86_64-linux-gnu/bits/poll.h libusb.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h \
/usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
/usr/include/x86_64-linux-gnu/bits/local_lim.h \
/usr/include/linux/limits.h \
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h \
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h version.h \
os/threads_posix.h /usr/include/pthread.h /usr/include/sched.h \
/usr/include/x86_64-linux-gnu/bits/sched.h \
/usr/include/x86_64-linux-gnu/bits/setjmp.h /usr/include/unistd.h \
/usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \
os/poll_posix.h
/usr/include/stdc-predef.h:
../config.h:
/usr/include/errno.h:
/usr/include/features.h:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:
/usr/include/x86_64-linux-gnu/bits/wordsize.h:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
/usr/include/x86_64-linux-gnu/bits/errno.h:
/usr/include/linux/errno.h:
/usr/include/x86_64-linux-gnu/asm/errno.h:
/usr/include/asm-generic/errno.h:
/usr/include/asm-generic/errno-base.h:
/usr/include/signal.h:
/usr/include/x86_64-linux-gnu/bits/sigset.h:
/usr/include/x86_64-linux-gnu/bits/types.h:
/usr/include/x86_64-linux-gnu/bits/typesizes.h:
/usr/include/x86_64-linux-gnu/bits/signum.h:
/usr/include/time.h:
/usr/include/x86_64-linux-gnu/bits/siginfo.h:
/usr/include/x86_64-linux-gnu/bits/sigaction.h:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h:
/usr/include/x86_64-linux-gnu/bits/sigstack.h:
/usr/include/x86_64-linux-gnu/sys/ucontext.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
/usr/include/x86_64-linux-gnu/bits/sigthread.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:
/usr/include/stdint.h:
/usr/include/x86_64-linux-gnu/bits/wchar.h:
/usr/include/stdlib.h:
/usr/include/x86_64-linux-gnu/bits/waitflags.h:
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/x86_64-linux-gnu/bits/endian.h:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
/usr/include/xlocale.h:
/usr/include/x86_64-linux-gnu/sys/types.h:
/usr/include/x86_64-linux-gnu/sys/select.h:
/usr/include/x86_64-linux-gnu/bits/select.h:
/usr/include/x86_64-linux-gnu/bits/time.h:
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
/usr/include/alloca.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
/usr/include/string.h:
/usr/include/x86_64-linux-gnu/bits/string.h:
/usr/include/x86_64-linux-gnu/bits/string2.h:
/usr/include/x86_64-linux-gnu/bits/timex.h:
/usr/include/x86_64-linux-gnu/sys/time.h:
/usr/include/x86_64-linux-gnu/sys/timerfd.h:
/usr/include/x86_64-linux-gnu/bits/timerfd.h:
libusbi.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h:
/usr/include/poll.h:
/usr/include/x86_64-linux-gnu/sys/poll.h:
/usr/include/x86_64-linux-gnu/bits/poll.h:
libusb.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h:
/usr/include/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
/usr/include/x86_64-linux-gnu/bits/local_lim.h:
/usr/include/linux/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h:
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
version.h:
os/threads_posix.h:
/usr/include/pthread.h:
/usr/include/sched.h:
/usr/include/x86_64-linux-gnu/bits/sched.h:
/usr/include/x86_64-linux-gnu/bits/setjmp.h:
/usr/include/unistd.h:
/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
/usr/include/x86_64-linux-gnu/bits/environments.h:
/usr/include/x86_64-linux-gnu/bits/confname.h:
/usr/include/getopt.h:
os/poll_posix.h:

View File

@@ -1,263 +0,0 @@
libusb_1_0_la-linux_usbfs.lo: os/linux_usbfs.c /usr/include/stdc-predef.h \
../config.h /usr/include/ctype.h /usr/include/features.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/xlocale.h \
/usr/include/dirent.h /usr/include/x86_64-linux-gnu/bits/dirent.h \
/usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
/usr/include/x86_64-linux-gnu/bits/local_lim.h \
/usr/include/linux/limits.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h /usr/include/errno.h \
/usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
/usr/include/fcntl.h /usr/include/x86_64-linux-gnu/bits/fcntl.h \
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
/usr/include/x86_64-linux-gnu/bits/uio.h \
/usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/sigset.h \
/usr/include/x86_64-linux-gnu/bits/time.h \
/usr/include/x86_64-linux-gnu/sys/sysmacros.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
/usr/include/x86_64-linux-gnu/bits/stat.h /usr/include/poll.h \
/usr/include/x86_64-linux-gnu/sys/poll.h \
/usr/include/x86_64-linux-gnu/bits/poll.h /usr/include/stdio.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h \
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
/usr/include/x86_64-linux-gnu/bits/stdio.h /usr/include/stdlib.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/alloca.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/string.h \
/usr/include/x86_64-linux-gnu/bits/string.h \
/usr/include/x86_64-linux-gnu/bits/string2.h \
/usr/include/x86_64-linux-gnu/sys/ioctl.h \
/usr/include/x86_64-linux-gnu/bits/ioctls.h \
/usr/include/x86_64-linux-gnu/asm/ioctls.h \
/usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h \
/usr/include/x86_64-linux-gnu/asm/ioctl.h \
/usr/include/asm-generic/ioctl.h \
/usr/include/x86_64-linux-gnu/bits/ioctl-types.h \
/usr/include/x86_64-linux-gnu/sys/ttydefaults.h \
/usr/include/x86_64-linux-gnu/sys/stat.h \
/usr/include/x86_64-linux-gnu/sys/utsname.h \
/usr/include/x86_64-linux-gnu/bits/utsname.h /usr/include/unistd.h \
/usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \
libusb.h /usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h \
/usr/include/stdint.h /usr/include/x86_64-linux-gnu/bits/wchar.h \
/usr/include/x86_64-linux-gnu/bits/timex.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h \
/usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h \
/usr/include/x86_64-linux-gnu/sys/time.h libusbi.h version.h \
os/threads_posix.h /usr/include/pthread.h /usr/include/sched.h \
/usr/include/x86_64-linux-gnu/bits/sched.h \
/usr/include/x86_64-linux-gnu/bits/setjmp.h os/poll_posix.h \
os/linux_usbfs.h
/usr/include/stdc-predef.h:
../config.h:
/usr/include/ctype.h:
/usr/include/features.h:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:
/usr/include/x86_64-linux-gnu/bits/wordsize.h:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
/usr/include/x86_64-linux-gnu/bits/types.h:
/usr/include/x86_64-linux-gnu/bits/typesizes.h:
/usr/include/endian.h:
/usr/include/x86_64-linux-gnu/bits/endian.h:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
/usr/include/xlocale.h:
/usr/include/dirent.h:
/usr/include/x86_64-linux-gnu/bits/dirent.h:
/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
/usr/include/x86_64-linux-gnu/bits/local_lim.h:
/usr/include/linux/limits.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h:
/usr/include/errno.h:
/usr/include/x86_64-linux-gnu/bits/errno.h:
/usr/include/linux/errno.h:
/usr/include/x86_64-linux-gnu/asm/errno.h:
/usr/include/asm-generic/errno.h:
/usr/include/asm-generic/errno-base.h:
/usr/include/fcntl.h:
/usr/include/x86_64-linux-gnu/bits/fcntl.h:
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:
/usr/include/x86_64-linux-gnu/bits/uio.h:
/usr/include/x86_64-linux-gnu/sys/types.h:
/usr/include/time.h:
/usr/include/x86_64-linux-gnu/sys/select.h:
/usr/include/x86_64-linux-gnu/bits/select.h:
/usr/include/x86_64-linux-gnu/bits/sigset.h:
/usr/include/x86_64-linux-gnu/bits/time.h:
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
/usr/include/x86_64-linux-gnu/bits/stat.h:
/usr/include/poll.h:
/usr/include/x86_64-linux-gnu/sys/poll.h:
/usr/include/x86_64-linux-gnu/bits/poll.h:
/usr/include/stdio.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h:
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
/usr/include/x86_64-linux-gnu/bits/stdio.h:
/usr/include/stdlib.h:
/usr/include/x86_64-linux-gnu/bits/waitflags.h:
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
/usr/include/alloca.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
/usr/include/string.h:
/usr/include/x86_64-linux-gnu/bits/string.h:
/usr/include/x86_64-linux-gnu/bits/string2.h:
/usr/include/x86_64-linux-gnu/sys/ioctl.h:
/usr/include/x86_64-linux-gnu/bits/ioctls.h:
/usr/include/x86_64-linux-gnu/asm/ioctls.h:
/usr/include/asm-generic/ioctls.h:
/usr/include/linux/ioctl.h:
/usr/include/x86_64-linux-gnu/asm/ioctl.h:
/usr/include/asm-generic/ioctl.h:
/usr/include/x86_64-linux-gnu/bits/ioctl-types.h:
/usr/include/x86_64-linux-gnu/sys/ttydefaults.h:
/usr/include/x86_64-linux-gnu/sys/stat.h:
/usr/include/x86_64-linux-gnu/sys/utsname.h:
/usr/include/x86_64-linux-gnu/bits/utsname.h:
/usr/include/unistd.h:
/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
/usr/include/x86_64-linux-gnu/bits/environments.h:
/usr/include/x86_64-linux-gnu/bits/confname.h:
/usr/include/getopt.h:
libusb.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:
/usr/include/stdint.h:
/usr/include/x86_64-linux-gnu/bits/wchar.h:
/usr/include/x86_64-linux-gnu/bits/timex.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h:
/usr/include/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h:
/usr/include/x86_64-linux-gnu/sys/time.h:
libusbi.h:
version.h:
os/threads_posix.h:
/usr/include/pthread.h:
/usr/include/sched.h:
/usr/include/x86_64-linux-gnu/bits/sched.h:
/usr/include/x86_64-linux-gnu/bits/setjmp.h:
os/poll_posix.h:
os/linux_usbfs.h:

View File

@@ -1,190 +0,0 @@
libusb_1_0_la-sync.lo: sync.c /usr/include/stdc-predef.h ../config.h \
/usr/include/errno.h /usr/include/features.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h /usr/include/stdint.h \
/usr/include/x86_64-linux-gnu/bits/wchar.h /usr/include/stdlib.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h \
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/xlocale.h \
/usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/sigset.h \
/usr/include/x86_64-linux-gnu/bits/time.h \
/usr/include/x86_64-linux-gnu/sys/sysmacros.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/string.h \
/usr/include/x86_64-linux-gnu/bits/string.h \
/usr/include/x86_64-linux-gnu/bits/string2.h libusbi.h \
/usr/include/x86_64-linux-gnu/bits/timex.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h /usr/include/poll.h \
/usr/include/x86_64-linux-gnu/sys/poll.h \
/usr/include/x86_64-linux-gnu/bits/poll.h libusb.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h \
/usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
/usr/include/x86_64-linux-gnu/bits/local_lim.h \
/usr/include/linux/limits.h \
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h \
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
/usr/include/x86_64-linux-gnu/sys/time.h version.h os/threads_posix.h \
/usr/include/pthread.h /usr/include/sched.h \
/usr/include/x86_64-linux-gnu/bits/sched.h \
/usr/include/x86_64-linux-gnu/bits/setjmp.h /usr/include/unistd.h \
/usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \
os/poll_posix.h
/usr/include/stdc-predef.h:
../config.h:
/usr/include/errno.h:
/usr/include/features.h:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:
/usr/include/x86_64-linux-gnu/bits/wordsize.h:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
/usr/include/x86_64-linux-gnu/bits/errno.h:
/usr/include/linux/errno.h:
/usr/include/x86_64-linux-gnu/asm/errno.h:
/usr/include/asm-generic/errno.h:
/usr/include/asm-generic/errno-base.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:
/usr/include/stdint.h:
/usr/include/x86_64-linux-gnu/bits/wchar.h:
/usr/include/stdlib.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h:
/usr/include/x86_64-linux-gnu/bits/waitflags.h:
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/x86_64-linux-gnu/bits/endian.h:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:
/usr/include/x86_64-linux-gnu/bits/types.h:
/usr/include/x86_64-linux-gnu/bits/typesizes.h:
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
/usr/include/xlocale.h:
/usr/include/x86_64-linux-gnu/sys/types.h:
/usr/include/time.h:
/usr/include/x86_64-linux-gnu/sys/select.h:
/usr/include/x86_64-linux-gnu/bits/select.h:
/usr/include/x86_64-linux-gnu/bits/sigset.h:
/usr/include/x86_64-linux-gnu/bits/time.h:
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
/usr/include/alloca.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
/usr/include/string.h:
/usr/include/x86_64-linux-gnu/bits/string.h:
/usr/include/x86_64-linux-gnu/bits/string2.h:
libusbi.h:
/usr/include/x86_64-linux-gnu/bits/timex.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h:
/usr/include/poll.h:
/usr/include/x86_64-linux-gnu/sys/poll.h:
/usr/include/x86_64-linux-gnu/bits/poll.h:
libusb.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/limits.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed/syslimits.h:
/usr/include/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
/usr/include/x86_64-linux-gnu/bits/local_lim.h:
/usr/include/linux/limits.h:
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h:
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
/usr/include/x86_64-linux-gnu/sys/time.h:
version.h:
os/threads_posix.h:
/usr/include/pthread.h:
/usr/include/sched.h:
/usr/include/x86_64-linux-gnu/bits/sched.h:
/usr/include/x86_64-linux-gnu/bits/setjmp.h:
/usr/include/unistd.h:
/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
/usr/include/x86_64-linux-gnu/bits/environments.h:
/usr/include/x86_64-linux-gnu/bits/confname.h:
/usr/include/getopt.h:
os/poll_posix.h:

View File

@@ -1,52 +0,0 @@
libusb_1_0_la-threads_posix.lo: os/threads_posix.c \
/usr/include/stdc-predef.h os/threads_posix.h /usr/include/pthread.h \
/usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h /usr/include/sched.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h \
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h /usr/include/time.h \
/usr/include/x86_64-linux-gnu/bits/time.h \
/usr/include/x86_64-linux-gnu/bits/sched.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
/usr/include/x86_64-linux-gnu/bits/setjmp.h
/usr/include/stdc-predef.h:
os/threads_posix.h:
/usr/include/pthread.h:
/usr/include/features.h:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:
/usr/include/x86_64-linux-gnu/bits/wordsize.h:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
/usr/include/endian.h:
/usr/include/x86_64-linux-gnu/bits/endian.h:
/usr/include/sched.h:
/usr/include/x86_64-linux-gnu/bits/types.h:
/usr/include/x86_64-linux-gnu/bits/typesizes.h:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h:
/usr/include/time.h:
/usr/include/x86_64-linux-gnu/bits/time.h:
/usr/include/x86_64-linux-gnu/bits/sched.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
/usr/include/x86_64-linux-gnu/bits/setjmp.h:

View File

@@ -1,41 +0,0 @@
# libusb-1.0.la - a libtool library file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libusb-1.0.so.0'
# Names of this library.
library_names='libusb-1.0.so.0.1.0 libusb-1.0.so.0 libusb-1.0.so'
# The name of the static archive.
old_library='libusb-1.0.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' -lrt'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libusb-1.0.
current=1
age=1
revision=0
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'

View File

@@ -1,718 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# libusb/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
pkgdatadir = $(datadir)/libusb
pkgincludedir = $(includedir)/libusb
pkglibdir = $(libdir)/libusb
pkglibexecdir = $(libexecdir)/libusb
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
subdir = libusb
DIST_COMMON = $(hdr_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libusb_1_0_la_LIBADD =
am__libusb_1_0_la_SOURCES_DIST = libusbi.h core.c descriptor.c io.c \
sync.c os/darwin_usb.c os/linux_usbfs.c os/openbsd_usb.c \
os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
libusb-1.0.def os/linux_usbfs.h os/darwin_usb.h \
os/windows_usb.h os/threads_windows.h os/threads_windows.c \
os/threads_posix.h os/threads_posix.c os/poll_posix.h \
os/poll_windows.h
am__objects_1 = libusb_1_0_la-darwin_usb.lo
am__objects_2 = libusb_1_0_la-linux_usbfs.lo
am__objects_3 = libusb_1_0_la-openbsd_usb.lo
am__objects_4 = libusb_1_0_la-poll_windows.lo \
libusb_1_0_la-windows_usb.lo libusb-1.0.lo
##am__objects_5 = $(am__objects_4)
##am__objects_5 = $(am__objects_3)
am__objects_5 = $(am__objects_2)
#am__objects_5 = $(am__objects_1)
#am__objects_6 = libusb_1_0_la-threads_windows.lo
am__objects_6 = libusb_1_0_la-threads_posix.lo
am_libusb_1_0_la_OBJECTS = libusb_1_0_la-core.lo \
libusb_1_0_la-descriptor.lo libusb_1_0_la-io.lo \
libusb_1_0_la-sync.lo $(am__objects_5) $(am__objects_6)
libusb_1_0_la_OBJECTS = $(am_libusb_1_0_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
libusb_1_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libusb_1_0_la_CFLAGS) \
$(CFLAGS) $(libusb_1_0_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo " CC " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo " CCLD " $@;
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libusb_1_0_la_SOURCES)
DIST_SOURCES = $(am__libusb_1_0_la_SOURCES_DIST)
HEADERS = $(hdr_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run aclocal-1.11
AMTAR = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run tar
AM_CFLAGS = -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow
AM_DEFAULT_VERBOSITY = 0
AR = ar
AUTOCONF = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoconf
AUTOHEADER = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run autoheader
AUTOMAKE = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run automake-1.11
AWK = mawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
LIBOBJS =
LIBS = -lrt -pthread
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLDFLAGS = -version-info 1:0:1 -no-undefined
LTLIBOBJS =
MAINT = #
MAKEINFO = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OS_DARWIN =
OS_LINUX =
OS_OPENBSD =
OS_WINDOWS =
OTOOL =
OTOOL64 =
PACKAGE = libusb
PACKAGE_BUGREPORT = libusb-devel@lists.sourceforge.net
PACKAGE_NAME = libusb
PACKAGE_STRING = libusb 1.0.9
PACKAGE_TARNAME = libusb
PACKAGE_URL = http://www.libusb.org/
PACKAGE_VERSION = 1.0.9
PATH_SEPARATOR = :
PC_LIBS_PRIVATE = -lrt -pthread
RANLIB = ranlib
RC =
SED = /bin/sed
SET_MAKE =
SHELL = /bin/bash
STRIP = strip
THREAD_CFLAGS = -pthread
VERSION = 1.0.9
VISIBILITY_CFLAGS = -fvisibility=hidden
abs_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/libusb
abs_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/libusb
abs_top_builddir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
abs_top_srcdir = /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /root/projekti/CyUSB/CyUSBSerial_SDK_Linux/libusb/libusb-1.0.9/libusb-1.0.9/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
lib_LTLIBRARIES = libusb-1.0.la
LINUX_USBFS_SRC = os/linux_usbfs.c
DARWIN_USB_SRC = os/darwin_usb.c
OPENBSD_USB_SRC = os/openbsd_usb.c
WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
libusb-1.0.def
EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
$(WINDOWS_USB_SRC) os/threads_posix.c os/threads_windows.c
#OS_SRC = $(DARWIN_USB_SRC)
OS_SRC = $(LINUX_USBFS_SRC)
#OS_SRC = $(OPENBSD_USB_SRC)
#OS_SRC = $(WINDOWS_USB_SRC)
#AM_CFLAGS_EXT = -no-cpp-precomp
#THREADS_SRC = os/threads_windows.h os/threads_windows.c
THREADS_SRC = os/threads_posix.h os/threads_posix.c
libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) $(THREAD_CFLAGS) \
-DLIBUSB_DESCRIBE=\"`git --git-dir "$(top_srcdir)/.git" describe --tags 2>/dev/null`\"
libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \
os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \
$(THREADS_SRC) \
os/poll_posix.h os/poll_windows.h
hdrdir = $(includedir)/libusb-1.0
hdr_HEADERS = libusb.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj .rc
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libusb/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu libusb/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: # $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libusb-1.0.la: $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_DEPENDENCIES)
$(AM_V_CCLD)$(libusb_1_0_la_LINK) -rpath $(libdir) $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
include ./$(DEPDIR)/libusb_1_0_la-core.Plo
include ./$(DEPDIR)/libusb_1_0_la-darwin_usb.Plo
include ./$(DEPDIR)/libusb_1_0_la-descriptor.Plo
include ./$(DEPDIR)/libusb_1_0_la-io.Plo
include ./$(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo
include ./$(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo
include ./$(DEPDIR)/libusb_1_0_la-poll_windows.Plo
include ./$(DEPDIR)/libusb_1_0_la-sync.Plo
include ./$(DEPDIR)/libusb_1_0_la-threads_posix.Plo
include ./$(DEPDIR)/libusb_1_0_la-threads_windows.Plo
include ./$(DEPDIR)/libusb_1_0_la-windows_usb.Plo
.c.o:
$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
# $(AM_V_CC) \
# source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(COMPILE) -c $<
.c.obj:
$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
# $(AM_V_CC) \
# source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
# $(AM_V_CC) \
# source='$<' object='$@' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LTCOMPILE) -c -o $@ $<
libusb_1_0_la-core.lo: core.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-core.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-core.Tpo -c -o libusb_1_0_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-core.Tpo $(DEPDIR)/libusb_1_0_la-core.Plo
# $(AM_V_CC) \
# source='core.c' object='libusb_1_0_la-core.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c
libusb_1_0_la-descriptor.lo: descriptor.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-descriptor.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-descriptor.Tpo -c -o libusb_1_0_la-descriptor.lo `test -f 'descriptor.c' || echo '$(srcdir)/'`descriptor.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-descriptor.Tpo $(DEPDIR)/libusb_1_0_la-descriptor.Plo
# $(AM_V_CC) \
# source='descriptor.c' object='libusb_1_0_la-descriptor.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-descriptor.lo `test -f 'descriptor.c' || echo '$(srcdir)/'`descriptor.c
libusb_1_0_la-io.lo: io.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-io.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-io.Tpo -c -o libusb_1_0_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-io.Tpo $(DEPDIR)/libusb_1_0_la-io.Plo
# $(AM_V_CC) \
# source='io.c' object='libusb_1_0_la-io.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c
libusb_1_0_la-sync.lo: sync.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-sync.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-sync.Tpo -c -o libusb_1_0_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-sync.Tpo $(DEPDIR)/libusb_1_0_la-sync.Plo
# $(AM_V_CC) \
# source='sync.c' object='libusb_1_0_la-sync.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c
libusb_1_0_la-darwin_usb.lo: os/darwin_usb.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-darwin_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo -c -o libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo $(DEPDIR)/libusb_1_0_la-darwin_usb.Plo
# $(AM_V_CC) \
# source='os/darwin_usb.c' object='libusb_1_0_la-darwin_usb.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
libusb_1_0_la-linux_usbfs.lo: os/linux_usbfs.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-linux_usbfs.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo -c -o libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo $(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo
# $(AM_V_CC) \
# source='os/linux_usbfs.c' object='libusb_1_0_la-linux_usbfs.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
libusb_1_0_la-openbsd_usb.lo: os/openbsd_usb.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-openbsd_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo -c -o libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo $(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo
# $(AM_V_CC) \
# source='os/openbsd_usb.c' object='libusb_1_0_la-openbsd_usb.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
libusb_1_0_la-poll_windows.lo: os/poll_windows.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-poll_windows.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-poll_windows.Tpo -c -o libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-poll_windows.Tpo $(DEPDIR)/libusb_1_0_la-poll_windows.Plo
# $(AM_V_CC) \
# source='os/poll_windows.c' object='libusb_1_0_la-poll_windows.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
libusb_1_0_la-windows_usb.lo: os/windows_usb.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-windows_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-windows_usb.Tpo -c -o libusb_1_0_la-windows_usb.lo `test -f 'os/windows_usb.c' || echo '$(srcdir)/'`os/windows_usb.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-windows_usb.Tpo $(DEPDIR)/libusb_1_0_la-windows_usb.Plo
# $(AM_V_CC) \
# source='os/windows_usb.c' object='libusb_1_0_la-windows_usb.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-windows_usb.lo `test -f 'os/windows_usb.c' || echo '$(srcdir)/'`os/windows_usb.c
libusb_1_0_la-threads_windows.lo: os/threads_windows.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-threads_windows.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-threads_windows.Tpo -c -o libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_windows.Tpo $(DEPDIR)/libusb_1_0_la-threads_windows.Plo
# $(AM_V_CC) \
# source='os/threads_windows.c' object='libusb_1_0_la-threads_windows.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
libusb_1_0_la-threads_posix.lo: os/threads_posix.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-threads_posix.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-threads_posix.Tpo -c -o libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_posix.Tpo $(DEPDIR)/libusb_1_0_la-threads_posix.Plo
# $(AM_V_CC) \
# source='os/threads_posix.c' object='libusb_1_0_la-threads_posix.lo' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-hdrHEADERS: $(hdr_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(hdrdir)" || $(MKDIR_P) "$(DESTDIR)$(hdrdir)"
@list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(hdrdir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(hdrdir)" || exit $$?; \
done
uninstall-hdrHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(hdrdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(hdrdir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-hdrHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-hdrHEADERS uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-hdrHEADERS \
install-html install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-hdrHEADERS \
uninstall-libLTLIBRARIES
#.rc.lo:
# $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
#libusb-1.0.rc: version.h
# 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:

View File

@@ -1,49 +0,0 @@
lib_LTLIBRARIES = libusb-1.0.la
LINUX_USBFS_SRC = os/linux_usbfs.c
DARWIN_USB_SRC = os/darwin_usb.c
OPENBSD_USB_SRC = os/openbsd_usb.c
WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
libusb-1.0.def
EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
$(WINDOWS_USB_SRC) os/threads_posix.c os/threads_windows.c
if OS_LINUX
OS_SRC = $(LINUX_USBFS_SRC)
endif
if OS_DARWIN
OS_SRC = $(DARWIN_USB_SRC)
AM_CFLAGS_EXT = -no-cpp-precomp
endif
if OS_OPENBSD
OS_SRC = $(OPENBSD_USB_SRC)
endif
if OS_WINDOWS
OS_SRC = $(WINDOWS_USB_SRC)
.rc.lo:
$(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
libusb-1.0.rc: version.h
endif
if THREADS_POSIX
THREADS_SRC = os/threads_posix.h os/threads_posix.c
else
THREADS_SRC = os/threads_windows.h os/threads_windows.c
endif
libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) $(THREAD_CFLAGS) \
-DLIBUSB_DESCRIBE=\"`git --git-dir "$(top_srcdir)/.git" describe --tags 2>/dev/null`\"
libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \
os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \
$(THREADS_SRC) \
os/poll_posix.h os/poll_windows.h
hdrdir = $(includedir)/libusb-1.0
hdr_HEADERS = libusb.h

View File

@@ -1,718 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libusb
DIST_COMMON = $(hdr_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libusb_1_0_la_LIBADD =
am__libusb_1_0_la_SOURCES_DIST = libusbi.h core.c descriptor.c io.c \
sync.c os/darwin_usb.c os/linux_usbfs.c os/openbsd_usb.c \
os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
libusb-1.0.def os/linux_usbfs.h os/darwin_usb.h \
os/windows_usb.h os/threads_windows.h os/threads_windows.c \
os/threads_posix.h os/threads_posix.c os/poll_posix.h \
os/poll_windows.h
am__objects_1 = libusb_1_0_la-darwin_usb.lo
am__objects_2 = libusb_1_0_la-linux_usbfs.lo
am__objects_3 = libusb_1_0_la-openbsd_usb.lo
am__objects_4 = libusb_1_0_la-poll_windows.lo \
libusb_1_0_la-windows_usb.lo libusb-1.0.lo
@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_FALSE@@OS_WINDOWS_TRUE@am__objects_5 = $(am__objects_4)
@OS_DARWIN_FALSE@@OS_LINUX_FALSE@@OS_OPENBSD_TRUE@am__objects_5 = $(am__objects_3)
@OS_DARWIN_FALSE@@OS_LINUX_TRUE@am__objects_5 = $(am__objects_2)
@OS_DARWIN_TRUE@am__objects_5 = $(am__objects_1)
@THREADS_POSIX_FALSE@am__objects_6 = libusb_1_0_la-threads_windows.lo
@THREADS_POSIX_TRUE@am__objects_6 = libusb_1_0_la-threads_posix.lo
am_libusb_1_0_la_OBJECTS = libusb_1_0_la-core.lo \
libusb_1_0_la-descriptor.lo libusb_1_0_la-io.lo \
libusb_1_0_la-sync.lo $(am__objects_5) $(am__objects_6)
libusb_1_0_la_OBJECTS = $(am_libusb_1_0_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
libusb_1_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libusb_1_0_la_CFLAGS) \
$(CFLAGS) $(libusb_1_0_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo " CC " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo " CCLD " $@;
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libusb_1_0_la_SOURCES)
DIST_SOURCES = $(am__libusb_1_0_la_SOURCES_DIST)
HEADERS = $(hdr_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLDFLAGS = @LTLDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OS_DARWIN = @OS_DARWIN@
OS_LINUX = @OS_LINUX@
OS_OPENBSD = @OS_OPENBSD@
OS_WINDOWS = @OS_WINDOWS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PC_LIBS_PRIVATE = @PC_LIBS_PRIVATE@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
THREAD_CFLAGS = @THREAD_CFLAGS@
VERSION = @VERSION@
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
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@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libusb-1.0.la
LINUX_USBFS_SRC = os/linux_usbfs.c
DARWIN_USB_SRC = os/darwin_usb.c
OPENBSD_USB_SRC = os/openbsd_usb.c
WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
libusb-1.0.def
EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
$(WINDOWS_USB_SRC) os/threads_posix.c os/threads_windows.c
@OS_DARWIN_TRUE@OS_SRC = $(DARWIN_USB_SRC)
@OS_LINUX_TRUE@OS_SRC = $(LINUX_USBFS_SRC)
@OS_OPENBSD_TRUE@OS_SRC = $(OPENBSD_USB_SRC)
@OS_WINDOWS_TRUE@OS_SRC = $(WINDOWS_USB_SRC)
@OS_DARWIN_TRUE@AM_CFLAGS_EXT = -no-cpp-precomp
@THREADS_POSIX_FALSE@THREADS_SRC = os/threads_windows.h os/threads_windows.c
@THREADS_POSIX_TRUE@THREADS_SRC = os/threads_posix.h os/threads_posix.c
libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) $(THREAD_CFLAGS) \
-DLIBUSB_DESCRIBE=\"`git --git-dir "$(top_srcdir)/.git" describe --tags 2>/dev/null`\"
libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \
os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \
$(THREADS_SRC) \
os/poll_posix.h os/poll_windows.h
hdrdir = $(includedir)/libusb-1.0
hdr_HEADERS = libusb.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj .rc
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libusb/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu libusb/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libusb-1.0.la: $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_DEPENDENCIES)
$(AM_V_CCLD)$(libusb_1_0_la_LINK) -rpath $(libdir) $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-core.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-darwin_usb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-descriptor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-io.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-poll_windows.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-sync.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-threads_posix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-threads_windows.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_1_0_la-windows_usb.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
libusb_1_0_la-core.lo: core.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-core.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-core.Tpo -c -o libusb_1_0_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-core.Tpo $(DEPDIR)/libusb_1_0_la-core.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='core.c' object='libusb_1_0_la-core.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c
libusb_1_0_la-descriptor.lo: descriptor.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-descriptor.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-descriptor.Tpo -c -o libusb_1_0_la-descriptor.lo `test -f 'descriptor.c' || echo '$(srcdir)/'`descriptor.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-descriptor.Tpo $(DEPDIR)/libusb_1_0_la-descriptor.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='descriptor.c' object='libusb_1_0_la-descriptor.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-descriptor.lo `test -f 'descriptor.c' || echo '$(srcdir)/'`descriptor.c
libusb_1_0_la-io.lo: io.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-io.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-io.Tpo -c -o libusb_1_0_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-io.Tpo $(DEPDIR)/libusb_1_0_la-io.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='io.c' object='libusb_1_0_la-io.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c
libusb_1_0_la-sync.lo: sync.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-sync.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-sync.Tpo -c -o libusb_1_0_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-sync.Tpo $(DEPDIR)/libusb_1_0_la-sync.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sync.c' object='libusb_1_0_la-sync.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c
libusb_1_0_la-darwin_usb.lo: os/darwin_usb.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-darwin_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo -c -o libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-darwin_usb.Tpo $(DEPDIR)/libusb_1_0_la-darwin_usb.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os/darwin_usb.c' object='libusb_1_0_la-darwin_usb.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-darwin_usb.lo `test -f 'os/darwin_usb.c' || echo '$(srcdir)/'`os/darwin_usb.c
libusb_1_0_la-linux_usbfs.lo: os/linux_usbfs.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-linux_usbfs.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo -c -o libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-linux_usbfs.Tpo $(DEPDIR)/libusb_1_0_la-linux_usbfs.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os/linux_usbfs.c' object='libusb_1_0_la-linux_usbfs.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-linux_usbfs.lo `test -f 'os/linux_usbfs.c' || echo '$(srcdir)/'`os/linux_usbfs.c
libusb_1_0_la-openbsd_usb.lo: os/openbsd_usb.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-openbsd_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo -c -o libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-openbsd_usb.Tpo $(DEPDIR)/libusb_1_0_la-openbsd_usb.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os/openbsd_usb.c' object='libusb_1_0_la-openbsd_usb.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-openbsd_usb.lo `test -f 'os/openbsd_usb.c' || echo '$(srcdir)/'`os/openbsd_usb.c
libusb_1_0_la-poll_windows.lo: os/poll_windows.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-poll_windows.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-poll_windows.Tpo -c -o libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-poll_windows.Tpo $(DEPDIR)/libusb_1_0_la-poll_windows.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os/poll_windows.c' object='libusb_1_0_la-poll_windows.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-poll_windows.lo `test -f 'os/poll_windows.c' || echo '$(srcdir)/'`os/poll_windows.c
libusb_1_0_la-windows_usb.lo: os/windows_usb.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-windows_usb.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-windows_usb.Tpo -c -o libusb_1_0_la-windows_usb.lo `test -f 'os/windows_usb.c' || echo '$(srcdir)/'`os/windows_usb.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-windows_usb.Tpo $(DEPDIR)/libusb_1_0_la-windows_usb.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os/windows_usb.c' object='libusb_1_0_la-windows_usb.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-windows_usb.lo `test -f 'os/windows_usb.c' || echo '$(srcdir)/'`os/windows_usb.c
libusb_1_0_la-threads_windows.lo: os/threads_windows.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-threads_windows.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-threads_windows.Tpo -c -o libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_windows.Tpo $(DEPDIR)/libusb_1_0_la-threads_windows.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os/threads_windows.c' object='libusb_1_0_la-threads_windows.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-threads_windows.lo `test -f 'os/threads_windows.c' || echo '$(srcdir)/'`os/threads_windows.c
libusb_1_0_la-threads_posix.lo: os/threads_posix.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -MT libusb_1_0_la-threads_posix.lo -MD -MP -MF $(DEPDIR)/libusb_1_0_la-threads_posix.Tpo -c -o libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libusb_1_0_la-threads_posix.Tpo $(DEPDIR)/libusb_1_0_la-threads_posix.Plo
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os/threads_posix.c' object='libusb_1_0_la-threads_posix.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libusb_1_0_la_CFLAGS) $(CFLAGS) -c -o libusb_1_0_la-threads_posix.lo `test -f 'os/threads_posix.c' || echo '$(srcdir)/'`os/threads_posix.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-hdrHEADERS: $(hdr_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(hdrdir)" || $(MKDIR_P) "$(DESTDIR)$(hdrdir)"
@list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(hdrdir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(hdrdir)" || exit $$?; \
done
uninstall-hdrHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(hdr_HEADERS)'; test -n "$(hdrdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(hdrdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(hdrdir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
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"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(hdrdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-hdrHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-hdrHEADERS uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-hdrHEADERS \
install-html install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-hdrHEADERS \
uninstall-libLTLIBRARIES
@OS_WINDOWS_TRUE@.rc.lo:
@OS_WINDOWS_TRUE@ $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
@OS_WINDOWS_TRUE@libusb-1.0.rc: version.h
# 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:

View File

@@ -1,730 +0,0 @@
/*
* USB descriptor handling functions for libusb
* Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
* Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "libusbi.h"
#define DESC_HEADER_LENGTH 2
#define DEVICE_DESC_LENGTH 18
#define CONFIG_DESC_LENGTH 9
#define INTERFACE_DESC_LENGTH 9
#define ENDPOINT_DESC_LENGTH 7
#define ENDPOINT_AUDIO_DESC_LENGTH 9
/** @defgroup desc USB descriptors
* This page details how to examine the various standard USB descriptors
* for detected devices
*/
/* set host_endian if the w values are already in host endian format,
* as opposed to bus endian. */
int usbi_parse_descriptor(unsigned char *source, const char *descriptor,
void *dest, int host_endian)
{
unsigned char *sp = source, *dp = dest;
uint16_t w;
const char *cp;
for (cp = descriptor; *cp; cp++) {
switch (*cp) {
case 'b': /* 8-bit byte */
*dp++ = *sp++;
break;
case 'w': /* 16-bit word, convert from little endian to CPU */
dp += ((uintptr_t)dp & 1); /* Align to word boundary */
if (host_endian) {
memcpy(dp, sp, 2);
} else {
w = (sp[1] << 8) | sp[0];
*((uint16_t *)dp) = w;
}
sp += 2;
dp += 2;
break;
}
}
return (int) (sp - source);
}
static void clear_endpoint(struct libusb_endpoint_descriptor *endpoint)
{
if (endpoint->extra)
free((unsigned char *) endpoint->extra);
}
static int parse_endpoint(struct libusb_context *ctx,
struct libusb_endpoint_descriptor *endpoint, unsigned char *buffer,
int size, int host_endian)
{
struct usb_descriptor_header header;
unsigned char *extra;
unsigned char *begin;
int parsed = 0;
int len;
usbi_parse_descriptor(buffer, "bb", &header, 0);
/* Everything should be fine being passed into here, but we sanity */
/* check JIC */
if (header.bLength > size) {
usbi_err(ctx, "ran out of descriptors parsing");
return -1;
}
if (header.bDescriptorType != LIBUSB_DT_ENDPOINT) {
usbi_err(ctx, "unexpected descriptor %x (expected %x)",
header.bDescriptorType, LIBUSB_DT_ENDPOINT);
return parsed;
}
if (header.bLength >= ENDPOINT_AUDIO_DESC_LENGTH)
usbi_parse_descriptor(buffer, "bbbbwbbb", endpoint, host_endian);
else if (header.bLength >= ENDPOINT_DESC_LENGTH)
usbi_parse_descriptor(buffer, "bbbbwb", endpoint, host_endian);
buffer += header.bLength;
size -= header.bLength;
parsed += header.bLength;
/* Skip over the rest of the Class Specific or Vendor Specific */
/* descriptors */
begin = buffer;
while (size >= DESC_HEADER_LENGTH) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
if (header.bLength < 2) {
usbi_err(ctx, "invalid descriptor length %d", header.bLength);
return -1;
}
/* If we find another "proper" descriptor then we're done */
if ((header.bDescriptorType == LIBUSB_DT_ENDPOINT) ||
(header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
(header.bDescriptorType == LIBUSB_DT_CONFIG) ||
(header.bDescriptorType == LIBUSB_DT_DEVICE))
break;
usbi_dbg("skipping descriptor %x", header.bDescriptorType);
buffer += header.bLength;
size -= header.bLength;
parsed += header.bLength;
}
/* Copy any unknown descriptors into a storage area for drivers */
/* to later parse */
len = (int)(buffer - begin);
if (!len) {
endpoint->extra = NULL;
endpoint->extra_length = 0;
return parsed;
}
extra = malloc(len);
endpoint->extra = extra;
if (!extra) {
endpoint->extra_length = 0;
return LIBUSB_ERROR_NO_MEM;
}
memcpy(extra, begin, len);
endpoint->extra_length = len;
return parsed;
}
static void clear_interface(struct libusb_interface *usb_interface)
{
int i;
int j;
if (usb_interface->altsetting) {
for (i = 0; i < usb_interface->num_altsetting; i++) {
struct libusb_interface_descriptor *ifp =
(struct libusb_interface_descriptor *)
usb_interface->altsetting + i;
if (ifp->extra)
free((void *) ifp->extra);
if (ifp->endpoint) {
for (j = 0; j < ifp->bNumEndpoints; j++)
clear_endpoint((struct libusb_endpoint_descriptor *)
ifp->endpoint + j);
free((void *) ifp->endpoint);
}
}
free((void *) usb_interface->altsetting);
usb_interface->altsetting = NULL;
}
}
static int parse_interface(libusb_context *ctx,
struct libusb_interface *usb_interface, unsigned char *buffer, int size,
int host_endian)
{
int i;
int len;
int r;
int parsed = 0;
size_t tmp;
struct usb_descriptor_header header;
struct libusb_interface_descriptor *ifp;
unsigned char *begin;
usb_interface->num_altsetting = 0;
while (size >= INTERFACE_DESC_LENGTH) {
struct libusb_interface_descriptor *altsetting =
(struct libusb_interface_descriptor *) usb_interface->altsetting;
altsetting = realloc(altsetting,
sizeof(struct libusb_interface_descriptor) *
(usb_interface->num_altsetting + 1));
if (!altsetting) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
}
usb_interface->altsetting = altsetting;
ifp = altsetting + usb_interface->num_altsetting;
usb_interface->num_altsetting++;
usbi_parse_descriptor(buffer, "bbbbbbbbb", ifp, 0);
ifp->extra = NULL;
ifp->extra_length = 0;
ifp->endpoint = NULL;
/* Skip over the interface */
buffer += ifp->bLength;
parsed += ifp->bLength;
size -= ifp->bLength;
begin = buffer;
/* Skip over any interface, class or vendor descriptors */
while (size >= DESC_HEADER_LENGTH) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
if (header.bLength < 2) {
usbi_err(ctx, "invalid descriptor of length %d",
header.bLength);
r = LIBUSB_ERROR_IO;
goto err;
}
/* If we find another "proper" descriptor then we're done */
if ((header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
(header.bDescriptorType == LIBUSB_DT_ENDPOINT) ||
(header.bDescriptorType == LIBUSB_DT_CONFIG) ||
(header.bDescriptorType == LIBUSB_DT_DEVICE))
break;
buffer += header.bLength;
parsed += header.bLength;
size -= header.bLength;
}
/* Copy any unknown descriptors into a storage area for */
/* drivers to later parse */
len = (int)(buffer - begin);
if (len) {
ifp->extra = malloc(len);
if (!ifp->extra) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
}
memcpy((unsigned char *) ifp->extra, begin, len);
ifp->extra_length = len;
}
/* Did we hit an unexpected descriptor? */
if (size >= DESC_HEADER_LENGTH) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
if ((header.bDescriptorType == LIBUSB_DT_CONFIG) ||
(header.bDescriptorType == LIBUSB_DT_DEVICE)) {
return parsed;
}
}
if (ifp->bNumEndpoints > USB_MAXENDPOINTS) {
usbi_err(ctx, "too many endpoints (%d)", ifp->bNumEndpoints);
r = LIBUSB_ERROR_IO;
goto err;
}
if (ifp->bNumEndpoints > 0) {
struct libusb_endpoint_descriptor *endpoint;
tmp = ifp->bNumEndpoints * sizeof(struct libusb_endpoint_descriptor);
endpoint = malloc(tmp);
ifp->endpoint = endpoint;
if (!endpoint) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
}
memset(endpoint, 0, tmp);
for (i = 0; i < ifp->bNumEndpoints; i++) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
if (header.bLength > size) {
usbi_err(ctx, "ran out of descriptors parsing");
r = LIBUSB_ERROR_IO;
goto err;
}
r = parse_endpoint(ctx, endpoint + i, buffer, size,
host_endian);
if (r < 0)
goto err;
buffer += r;
parsed += r;
size -= r;
}
}
/* We check to see if it's an alternate to this one */
ifp = (struct libusb_interface_descriptor *) buffer;
if (size < LIBUSB_DT_INTERFACE_SIZE ||
ifp->bDescriptorType != LIBUSB_DT_INTERFACE ||
!ifp->bAlternateSetting)
return parsed;
}
return parsed;
err:
clear_interface(usb_interface);
return r;
}
static void clear_configuration(struct libusb_config_descriptor *config)
{
if (config->interface) {
int i;
for (i = 0; i < config->bNumInterfaces; i++)
clear_interface((struct libusb_interface *)
config->interface + i);
free((void *) config->interface);
}
if (config->extra)
free((void *) config->extra);
}
static int parse_configuration(struct libusb_context *ctx,
struct libusb_config_descriptor *config, unsigned char *buffer,
int host_endian)
{
int i;
int r;
int size;
size_t tmp;
struct usb_descriptor_header header;
struct libusb_interface *usb_interface;
usbi_parse_descriptor(buffer, "bbwbbbbb", config, host_endian);
size = config->wTotalLength;
if (config->bNumInterfaces > USB_MAXINTERFACES) {
usbi_err(ctx, "too many interfaces (%d)", config->bNumInterfaces);
return LIBUSB_ERROR_IO;
}
tmp = config->bNumInterfaces * sizeof(struct libusb_interface);
usb_interface = malloc(tmp);
config->interface = usb_interface;
if (!config->interface)
return LIBUSB_ERROR_NO_MEM;
memset(usb_interface, 0, tmp);
buffer += config->bLength;
size -= config->bLength;
config->extra = NULL;
config->extra_length = 0;
for (i = 0; i < config->bNumInterfaces; i++) {
int len;
unsigned char *begin;
/* Skip over the rest of the Class Specific or Vendor */
/* Specific descriptors */
begin = buffer;
while (size >= DESC_HEADER_LENGTH) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
if ((header.bLength > size) ||
(header.bLength < DESC_HEADER_LENGTH)) {
usbi_err(ctx, "invalid descriptor length of %d",
header.bLength);
r = LIBUSB_ERROR_IO;
goto err;
}
/* If we find another "proper" descriptor then we're done */
if ((header.bDescriptorType == LIBUSB_DT_ENDPOINT) ||
(header.bDescriptorType == LIBUSB_DT_INTERFACE) ||
(header.bDescriptorType == LIBUSB_DT_CONFIG) ||
(header.bDescriptorType == LIBUSB_DT_DEVICE))
break;
usbi_dbg("skipping descriptor 0x%x\n", header.bDescriptorType);
buffer += header.bLength;
size -= header.bLength;
}
/* Copy any unknown descriptors into a storage area for */
/* drivers to later parse */
len = (int)(buffer - begin);
if (len) {
/* FIXME: We should realloc and append here */
if (!config->extra_length) {
config->extra = malloc(len);
if (!config->extra) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
}
memcpy((unsigned char *) config->extra, begin, len);
config->extra_length = len;
}
}
r = parse_interface(ctx, usb_interface + i, buffer, size, host_endian);
if (r < 0)
goto err;
buffer += r;
size -= r;
}
return size;
err:
clear_configuration(config);
return r;
}
/** \ingroup desc
* Get the USB device descriptor for a given device.
*
* This is a non-blocking function; the device descriptor is cached in memory.
*
* \param dev the device
* \param desc output location for the descriptor data
* \returns 0 on success or a LIBUSB_ERROR code on failure
*/
int API_EXPORTED libusb_get_device_descriptor(libusb_device *dev,
struct libusb_device_descriptor *desc)
{
unsigned char raw_desc[DEVICE_DESC_LENGTH];
int host_endian = 0;
int r;
usbi_dbg("");
r = usbi_backend->get_device_descriptor(dev, raw_desc, &host_endian);
if (r < 0)
return r;
memcpy((unsigned char *) desc, raw_desc, sizeof(raw_desc));
if (!host_endian) {
desc->bcdUSB = libusb_le16_to_cpu(desc->bcdUSB);
desc->idVendor = libusb_le16_to_cpu(desc->idVendor);
desc->idProduct = libusb_le16_to_cpu(desc->idProduct);
desc->bcdDevice = libusb_le16_to_cpu(desc->bcdDevice);
}
return 0;
}
/** \ingroup desc
* Get the USB configuration descriptor for the currently active configuration.
* This is a non-blocking function which does not involve any requests being
* sent to the device.
*
* \param dev a device
* \param config output location for the USB configuration descriptor. Only
* valid if 0 was returned. Must be freed with libusb_free_config_descriptor()
* after use.
* \returns 0 on success
* \returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state
* \returns another LIBUSB_ERROR code on error
* \see libusb_get_config_descriptor
*/
int API_EXPORTED libusb_get_active_config_descriptor(libusb_device *dev,
struct libusb_config_descriptor **config)
{
struct libusb_config_descriptor *_config = malloc(sizeof(*_config));
unsigned char tmp[8];
unsigned char *buf = NULL;
int host_endian = 0;
int r;
usbi_dbg("");
if (!_config)
return LIBUSB_ERROR_NO_MEM;
r = usbi_backend->get_active_config_descriptor(dev, tmp, sizeof(tmp),
&host_endian);
if (r < 0)
goto err;
usbi_parse_descriptor(tmp, "bbw", _config, host_endian);
buf = malloc(_config->wTotalLength);
if (!buf) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
}
r = usbi_backend->get_active_config_descriptor(dev, buf,
_config->wTotalLength, &host_endian);
if (r < 0)
goto err;
r = parse_configuration(dev->ctx, _config, buf, host_endian);
if (r < 0) {
usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
goto err;
} else if (r > 0) {
usbi_warn(dev->ctx, "descriptor data still left");
}
free(buf);
*config = _config;
return 0;
err:
free(_config);
if (buf)
free(buf);
return r;
}
/** \ingroup desc
* Get a USB configuration descriptor based on its index.
* This is a non-blocking function which does not involve any requests being
* sent to the device.
*
* \param dev a device
* \param config_index the index of the configuration you wish to retrieve
* \param config output location for the USB configuration descriptor. Only
* valid if 0 was returned. Must be freed with libusb_free_config_descriptor()
* after use.
* \returns 0 on success
* \returns LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
* \returns another LIBUSB_ERROR code on error
* \see libusb_get_active_config_descriptor()
* \see libusb_get_config_descriptor_by_value()
*/
int API_EXPORTED libusb_get_config_descriptor(libusb_device *dev,
uint8_t config_index, struct libusb_config_descriptor **config)
{
struct libusb_config_descriptor *_config;
unsigned char tmp[8];
unsigned char *buf = NULL;
int host_endian = 0;
int r;
usbi_dbg("index %d", config_index);
if (config_index >= dev->num_configurations)
return LIBUSB_ERROR_NOT_FOUND;
_config = malloc(sizeof(*_config));
if (!_config)
return LIBUSB_ERROR_NO_MEM;
r = usbi_backend->get_config_descriptor(dev, config_index, tmp,
sizeof(tmp), &host_endian);
if (r < 0)
goto err;
usbi_parse_descriptor(tmp, "bbw", _config, host_endian);
buf = malloc(_config->wTotalLength);
if (!buf) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
}
host_endian = 0;
r = usbi_backend->get_config_descriptor(dev, config_index, buf,
_config->wTotalLength, &host_endian);
if (r < 0)
goto err;
r = parse_configuration(dev->ctx, _config, buf, host_endian);
if (r < 0) {
usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
goto err;
} else if (r > 0) {
usbi_warn(dev->ctx, "descriptor data still left");
}
free(buf);
*config = _config;
return 0;
err:
free(_config);
if (buf)
free(buf);
return r;
}
/* iterate through all configurations, returning the index of the configuration
* matching a specific bConfigurationValue in the idx output parameter, or -1
* if the config was not found.
* returns 0 or a LIBUSB_ERROR code
*/
int usbi_get_config_index_by_value(struct libusb_device *dev,
uint8_t bConfigurationValue, int *idx)
{
uint8_t i;
usbi_dbg("value %d", bConfigurationValue);
for (i = 0; i < dev->num_configurations; i++) {
unsigned char tmp[6];
int host_endian;
int r = usbi_backend->get_config_descriptor(dev, i, tmp, sizeof(tmp),
&host_endian);
if (r < 0)
return r;
if (tmp[5] == bConfigurationValue) {
*idx = i;
return 0;
}
}
*idx = -1;
return 0;
}
/** \ingroup desc
* Get a USB configuration descriptor with a specific bConfigurationValue.
* This is a non-blocking function which does not involve any requests being
* sent to the device.
*
* \param dev a device
* \param bConfigurationValue the bConfigurationValue of the configuration you
* wish to retrieve
* \param config output location for the USB configuration descriptor. Only
* valid if 0 was returned. Must be freed with libusb_free_config_descriptor()
* after use.
* \returns 0 on success
* \returns LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
* \returns another LIBUSB_ERROR code on error
* \see libusb_get_active_config_descriptor()
* \see libusb_get_config_descriptor()
*/
int API_EXPORTED libusb_get_config_descriptor_by_value(libusb_device *dev,
uint8_t bConfigurationValue, struct libusb_config_descriptor **config)
{
int idx;
int r = usbi_get_config_index_by_value(dev, bConfigurationValue, &idx);
if (r < 0)
return r;
else if (idx == -1)
return LIBUSB_ERROR_NOT_FOUND;
else
return libusb_get_config_descriptor(dev, (uint8_t) idx, config);
}
/** \ingroup desc
* Free a configuration descriptor obtained from
* libusb_get_active_config_descriptor() or libusb_get_config_descriptor().
* It is safe to call this function with a NULL config parameter, in which
* case the function simply returns.
*
* \param config the configuration descriptor to free
*/
void API_EXPORTED libusb_free_config_descriptor(
struct libusb_config_descriptor *config)
{
if (!config)
return;
clear_configuration(config);
free(config);
}
/** \ingroup desc
* Retrieve a string descriptor in C style ASCII.
*
* Wrapper around libusb_get_string_descriptor(). Uses the first language
* supported by the device.
*
* \param dev a device handle
* \param desc_index the index of the descriptor to retrieve
* \param data output buffer for ASCII string descriptor
* \param length size of data buffer
* \returns number of bytes returned in data, or LIBUSB_ERROR code on failure
*/
int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev,
uint8_t desc_index, unsigned char *data, int length)
{
unsigned char tbuf[255]; /* Some devices choke on size > 255 */
int r, si, di;
uint16_t langid;
/* Asking for the zero'th index is special - it returns a string
* descriptor that contains all the language IDs supported by the
* device. Typically there aren't many - often only one. Language
* IDs are 16 bit numbers, and they start at the third byte in the
* descriptor. There's also no point in trying to read descriptor 0
* with this function. See USB 2.0 specification section 9.6.7 for
* more information.
*/
if (desc_index == 0)
return LIBUSB_ERROR_INVALID_PARAM;
r = libusb_get_string_descriptor(dev, 0, 0, tbuf, sizeof(tbuf));
if (r < 0)
return r;
if (r < 4)
return LIBUSB_ERROR_IO;
langid = tbuf[2] | (tbuf[3] << 8);
r = libusb_get_string_descriptor(dev, desc_index, langid, tbuf,
sizeof(tbuf));
if (r < 0)
return r;
if (tbuf[1] != LIBUSB_DT_STRING)
return LIBUSB_ERROR_IO;
if (tbuf[0] > r)
return LIBUSB_ERROR_IO;
for (di = 0, si = 2; si < tbuf[0]; si += 2) {
if (di >= (length - 1))
break;
if (tbuf[si + 1]) /* high byte */
data[di++] = '?';
else
data[di++] = tbuf[si];
}
data[di] = 0;
return di;
}

View File

@@ -1,120 +0,0 @@
LIBRARY
EXPORTS
libusb_alloc_transfer
libusb_alloc_transfer@4 = libusb_alloc_transfer
libusb_attach_kernel_driver
libusb_attach_kernel_driver@8 = libusb_attach_kernel_driver
libusb_bulk_transfer
libusb_bulk_transfer@24 = libusb_bulk_transfer
libusb_cancel_transfer
libusb_cancel_transfer@4 = libusb_cancel_transfer
libusb_claim_interface
libusb_claim_interface@8 = libusb_claim_interface
libusb_clear_halt
libusb_clear_halt@8 = libusb_clear_halt
libusb_close
libusb_close@4 = libusb_close
libusb_control_transfer
libusb_control_transfer@32 = libusb_control_transfer
libusb_detach_kernel_driver
libusb_detach_kernel_driver@8 = libusb_detach_kernel_driver
libusb_error_name
libusb_error_name@4 = libusb_error_name
libusb_event_handler_active
libusb_event_handler_active@4 = libusb_event_handler_active
libusb_event_handling_ok
libusb_event_handling_ok@4 = libusb_event_handling_ok
libusb_exit
libusb_exit@4 = libusb_exit
libusb_free_config_descriptor
libusb_free_config_descriptor@4 = libusb_free_config_descriptor
libusb_free_device_list
libusb_free_device_list@8 = libusb_free_device_list
libusb_free_transfer
libusb_free_transfer@4 = libusb_free_transfer
libusb_get_active_config_descriptor
libusb_get_active_config_descriptor@8 = libusb_get_active_config_descriptor
libusb_get_bus_number
libusb_get_bus_number@4 = libusb_get_bus_number
libusb_get_config_descriptor
libusb_get_config_descriptor@12 = libusb_get_config_descriptor
libusb_get_config_descriptor_by_value
libusb_get_config_descriptor_by_value@12 = libusb_get_config_descriptor_by_value
libusb_get_configuration
libusb_get_configuration@8 = libusb_get_configuration
libusb_get_device
libusb_get_device@4 = libusb_get_device
libusb_get_device_address
libusb_get_device_address@4 = libusb_get_device_address
libusb_get_device_descriptor
libusb_get_device_descriptor@8 = libusb_get_device_descriptor
libusb_get_device_list
libusb_get_device_list@8 = libusb_get_device_list
libusb_get_device_speed
libusb_get_device_speed@4 = libusb_get_device_speed
libusb_get_max_iso_packet_size
libusb_get_max_iso_packet_size@8 = libusb_get_max_iso_packet_size
libusb_get_max_packet_size
libusb_get_max_packet_size@8 = libusb_get_max_packet_size
libusb_get_next_timeout
libusb_get_next_timeout@8 = libusb_get_next_timeout
libusb_get_pollfds
libusb_get_pollfds@4 = libusb_get_pollfds
libusb_get_string_descriptor_ascii
libusb_get_string_descriptor_ascii@16 = libusb_get_string_descriptor_ascii
libusb_get_version
libusb_get_version@0 = libusb_get_version
libusb_handle_events
libusb_handle_events@4 = libusb_handle_events
libusb_handle_events_completed
libusb_handle_events_completed@8 = libusb_handle_events_completed
libusb_handle_events_locked
libusb_handle_events_locked@8 = libusb_handle_events_locked
libusb_handle_events_timeout
libusb_handle_events_timeout@8 = libusb_handle_events_timeout
libusb_handle_events_timeout_completed
libusb_handle_events_timeout_completed@12 = libusb_handle_events_timeout_completed
libusb_has_capability
libusb_has_capability@4 = libusb_has_capability
libusb_init
libusb_init@4 = libusb_init
libusb_interrupt_transfer
libusb_interrupt_transfer@24 = libusb_interrupt_transfer
libusb_kernel_driver_active
libusb_kernel_driver_active@8 = libusb_kernel_driver_active
libusb_lock_event_waiters
libusb_lock_event_waiters@4 = libusb_lock_event_waiters
libusb_lock_events
libusb_lock_events@4 = libusb_lock_events
libusb_open
libusb_open@8 = libusb_open
libusb_open_device_with_vid_pid
libusb_open_device_with_vid_pid@12 = libusb_open_device_with_vid_pid
libusb_pollfds_handle_timeouts
libusb_pollfds_handle_timeouts@4 = libusb_pollfds_handle_timeouts
libusb_ref_device
libusb_ref_device@4 = libusb_ref_device
libusb_release_interface
libusb_release_interface@8 = libusb_release_interface
libusb_reset_device
libusb_reset_device@4 = libusb_reset_device
libusb_set_configuration
libusb_set_configuration@8 = libusb_set_configuration
libusb_set_debug
libusb_set_debug@8 = libusb_set_debug
libusb_set_interface_alt_setting
libusb_set_interface_alt_setting@12 = libusb_set_interface_alt_setting
libusb_set_pollfd_notifiers
libusb_set_pollfd_notifiers@16 = libusb_set_pollfd_notifiers
libusb_submit_transfer
libusb_submit_transfer@4 = libusb_submit_transfer
libusb_try_lock_events
libusb_try_lock_events@4 = libusb_try_lock_events
libusb_unlock_event_waiters
libusb_unlock_event_waiters@4 = libusb_unlock_event_waiters
libusb_unlock_events
libusb_unlock_events@4 = libusb_unlock_events
libusb_unref_device
libusb_unref_device@4 = libusb_unref_device
libusb_wait_for_event
libusb_wait_for_event@8 = libusb_wait_for_event

View File

@@ -1,41 +0,0 @@
# libusb-1.0.la - a libtool library file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libusb-1.0.so.0'
# Names of this library.
library_names='libusb-1.0.so.0.1.0 libusb-1.0.so.0 libusb-1.0.so'
# The name of the static archive.
old_library='libusb-1.0.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' -lrt'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libusb-1.0.
current=1
age=1
revision=0
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'

View File

@@ -1,56 +0,0 @@
/*
* For Windows: input this file to the Resoure Compiler to produce a binary
* .res file. This is then embedded in the resultant library (like any other
* compilation object).
* The information can then be queried using standard APIs and can also be
* viewed with utilities such as Windows Explorer.
*/
#include "winresrc.h"
#include "version.h"
#ifndef LIBUSB_VERSIONSTRING
#define LU_STR(s) #s
#define LU_XSTR(s) LU_STR(s)
#if LIBUSB_NANO > 0
#define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0"
#else
#define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0"
#endif
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO
PRODUCTVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "libusb.org\0"
VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0"
VALUE "FileVersion", LIBUSB_VERSIONSTRING
VALUE "InternalName", "libusb\0"
VALUE "LegalCopyright", "See individual source files, GNU LGPL v2.1 or later.\0"
VALUE "LegalTrademarks", "http://www.gnu.org/licenses/lgpl-2.1.html\0"
VALUE "OriginalFilename", "libusb-1.0.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "libusb-1.0\0"
VALUE "ProductVersion", LIBUSB_VERSIONSTRING
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -1,12 +0,0 @@
# libusb_1_0_la-core.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/libusb_1_0_la-core.o'
# Name of the non-PIC object
non_pic_object='libusb_1_0_la-core.o'

View File

@@ -1,12 +0,0 @@
# libusb_1_0_la-descriptor.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/libusb_1_0_la-descriptor.o'
# Name of the non-PIC object
non_pic_object='libusb_1_0_la-descriptor.o'

View File

@@ -1,12 +0,0 @@
# libusb_1_0_la-io.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/libusb_1_0_la-io.o'
# Name of the non-PIC object
non_pic_object='libusb_1_0_la-io.o'

View File

@@ -1,12 +0,0 @@
# libusb_1_0_la-linux_usbfs.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/libusb_1_0_la-linux_usbfs.o'
# Name of the non-PIC object
non_pic_object='libusb_1_0_la-linux_usbfs.o'

View File

@@ -1,12 +0,0 @@
# libusb_1_0_la-sync.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/libusb_1_0_la-sync.o'
# Name of the non-PIC object
non_pic_object='libusb_1_0_la-sync.o'

View File

@@ -1,12 +0,0 @@
# libusb_1_0_la-threads_posix.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/libusb_1_0_la-threads_posix.o'
# Name of the non-PIC object
non_pic_object='libusb_1_0_la-threads_posix.o'

View File

@@ -1,935 +0,0 @@
/*
* Internal header for libusb
* Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LIBUSBI_H
#define LIBUSBI_H
#include <config.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include <stdarg.h>
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#include <libusb.h>
#include <version.h>
/* Inside the libusb code, mark all public functions as follows:
* return_type API_EXPORTED function_name(params) { ... }
* But if the function returns a pointer, mark it as follows:
* DEFAULT_VISIBILITY return_type * LIBUSB_CALL function_name(params) { ... }
* In the libusb public header, mark all declarations as:
* return_type LIBUSB_CALL function_name(params);
*/
#define API_EXPORTED LIBUSB_CALL DEFAULT_VISIBILITY
#define DEVICE_DESC_LENGTH 18
#define USB_MAXENDPOINTS 32
#define USB_MAXINTERFACES 32
#define USB_MAXCONFIG 8
struct list_head {
struct list_head *prev, *next;
};
/* Get an entry from the list
* ptr - the address of this list_head element in "type"
* type - the data type that contains "member"
* member - the list_head element in "type"
*/
#define list_entry(ptr, type, member) \
((type *)((uintptr_t)(ptr) - (uintptr_t)(&((type *)0L)->member)))
/* Get each entry from a list
* pos - A structure pointer has a "member" element
* head - list head
* member - the list_head element in "pos"
* type - the type of the first parameter
*/
#define list_for_each_entry(pos, head, member, type) \
for (pos = list_entry((head)->next, type, member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, type, member))
#define list_for_each_entry_safe(pos, n, head, member, type) \
for (pos = list_entry((head)->next, type, member), \
n = list_entry(pos->member.next, type, member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, type, member))
#define list_empty(entry) ((entry)->next == (entry))
static inline void list_init(struct list_head *entry)
{
entry->prev = entry->next = entry;
}
static inline void list_add(struct list_head *entry, struct list_head *head)
{
entry->next = head->next;
entry->prev = head;
head->next->prev = entry;
head->next = entry;
}
static inline void list_add_tail(struct list_head *entry,
struct list_head *head)
{
entry->next = head;
entry->prev = head->prev;
head->prev->next = entry;
head->prev = entry;
}
static inline void list_del(struct list_head *entry)
{
entry->next->prev = entry->prev;
entry->prev->next = entry->next;
}
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *mptr = (ptr); \
(type *)( (char *)mptr - offsetof(type,member) );})
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define TIMESPEC_IS_SET(ts) ((ts)->tv_sec != 0 || (ts)->tv_nsec != 0)
enum usbi_log_level {
LOG_LEVEL_DEBUG,
LOG_LEVEL_INFO,
LOG_LEVEL_WARNING,
LOG_LEVEL_ERROR,
};
void usbi_log(struct libusb_context *ctx, enum usbi_log_level level,
const char *function, const char *format, ...);
void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level,
const char *function, const char *format, va_list args);
#if !defined(_MSC_VER) || _MSC_VER >= 1400
#ifdef ENABLE_LOGGING
#define _usbi_log(ctx, level, ...) usbi_log(ctx, level, __FUNCTION__, __VA_ARGS__)
#else
#define _usbi_log(ctx, level, ...) do { (void)(ctx); } while(0)
#endif
#ifdef ENABLE_DEBUG_LOGGING
#define usbi_dbg(...) _usbi_log(NULL, LOG_LEVEL_DEBUG, __VA_ARGS__)
#else
#define usbi_dbg(...) do {} while(0)
#endif
#define usbi_info(ctx, ...) _usbi_log(ctx, LOG_LEVEL_INFO, __VA_ARGS__)
#define usbi_warn(ctx, ...) _usbi_log(ctx, LOG_LEVEL_WARNING, __VA_ARGS__)
#define usbi_err(ctx, ...) _usbi_log(ctx, LOG_LEVEL_ERROR, __VA_ARGS__)
#else /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
/* Old MS compilers don't support variadic macros. The code is simple, so we
* repeat it for each loglevel. Note that the debug case is special.
*
* Support for variadic macros was introduced in Visual C++ 2005.
* http://msdn.microsoft.com/en-us/library/ms177415%28v=VS.80%29.aspx
*/
static inline void usbi_info(struct libusb_context *ctx, const char *fmt, ...)
{
#ifdef ENABLE_LOGGING
va_list args;
va_start(args, fmt);
usbi_log_v(ctx, LOG_LEVEL_INFO, "", fmt, args);
va_end(args);
#else
(void)ctx;
#endif
}
static inline void usbi_warn(struct libusb_context *ctx, const char *fmt, ...)
{
#ifdef ENABLE_LOGGING
va_list args;
va_start(args, fmt);
usbi_log_v(ctx, LOG_LEVEL_WARNING, "", fmt, args);
va_end(args);
#else
(void)ctx;
#endif
}
static inline void usbi_err(struct libusb_context *ctx, const char *fmt, ...)
{
#ifdef ENABLE_LOGGING
va_list args;
va_start(args, fmt);
usbi_log_v(ctx, LOG_LEVEL_ERROR, "", fmt, args);
va_end(args);
#else
(void)ctx;
#endif
}
static inline void usbi_dbg(const char *fmt, ...)
{
#ifdef ENABLE_DEBUG_LOGGING
va_list args;
va_start(args, fmt);
usbi_log_v(NULL, LOG_LEVEL_DEBUG, "", fmt, args);
va_end(args);
#else
(void)fmt;
#endif
}
#endif /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
#define USBI_GET_CONTEXT(ctx) if (!(ctx)) (ctx) = usbi_default_context
#define DEVICE_CTX(dev) ((dev)->ctx)
#define HANDLE_CTX(handle) (DEVICE_CTX((handle)->dev))
#define TRANSFER_CTX(transfer) (HANDLE_CTX((transfer)->dev_handle))
#define ITRANSFER_CTX(transfer) \
(TRANSFER_CTX(USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)))
#define IS_EPIN(ep) (0 != ((ep) & LIBUSB_ENDPOINT_IN))
#define IS_EPOUT(ep) (!IS_EPIN(ep))
#define IS_XFERIN(xfer) (0 != ((xfer)->endpoint & LIBUSB_ENDPOINT_IN))
#define IS_XFEROUT(xfer) (!IS_XFERIN(xfer))
/* Internal abstractions for thread synchronization and poll */
#if defined(THREADS_POSIX)
#include <os/threads_posix.h>
#elif defined(OS_WINDOWS)
#include <os/threads_windows.h>
#endif
#if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD)
#include <unistd.h>
#include <os/poll_posix.h>
#elif defined(OS_WINDOWS)
#include <os/poll_windows.h>
#endif
#if defined(OS_WINDOWS) && !defined(__GCC__)
#undef HAVE_GETTIMEOFDAY
int usbi_gettimeofday(struct timeval *tp, void *tzp);
#define LIBUSB_GETTIMEOFDAY_WIN32
#define HAVE_USBI_GETTIMEOFDAY
#else
#ifdef HAVE_GETTIMEOFDAY
#define usbi_gettimeofday(tv, tz) gettimeofday((tv), (tz))
#define HAVE_USBI_GETTIMEOFDAY
#endif
#endif
extern struct libusb_context *usbi_default_context;
struct libusb_context {
int debug;
int debug_fixed;
/* internal control pipe, used for interrupting event handling when
* something needs to modify poll fds. */
int ctrl_pipe[2];
struct list_head usb_devs;
usbi_mutex_t usb_devs_lock;
/* A list of open handles. Backends are free to traverse this if required.
*/
struct list_head open_devs;
usbi_mutex_t open_devs_lock;
/* this is a list of in-flight transfer handles, sorted by timeout
* expiration. URBs to timeout the soonest are placed at the beginning of
* the list, URBs that will time out later are placed after, and urbs with
* infinite timeout are always placed at the very end. */
struct list_head flying_transfers;
usbi_mutex_t flying_transfers_lock;
/* list of poll fds */
struct list_head pollfds;
usbi_mutex_t pollfds_lock;
/* a counter that is set when we want to interrupt event handling, in order
* to modify the poll fd set. and a lock to protect it. */
unsigned int pollfd_modify;
usbi_mutex_t pollfd_modify_lock;
/* user callbacks for pollfd changes */
libusb_pollfd_added_cb fd_added_cb;
libusb_pollfd_removed_cb fd_removed_cb;
void *fd_cb_user_data;
/* ensures that only one thread is handling events at any one time */
usbi_mutex_t events_lock;
/* used to see if there is an active thread doing event handling */
int event_handler_active;
/* used to wait for event completion in threads other than the one that is
* event handling */
usbi_mutex_t event_waiters_lock;
usbi_cond_t event_waiters_cond;
#ifdef USBI_TIMERFD_AVAILABLE
/* used for timeout handling, if supported by OS.
* this timerfd is maintained to trigger on the next pending timeout */
int timerfd;
#endif
};
#ifdef USBI_TIMERFD_AVAILABLE
#define usbi_using_timerfd(ctx) ((ctx)->timerfd >= 0)
#else
#define usbi_using_timerfd(ctx) (0)
#endif
struct libusb_device {
/* lock protects refcnt, everything else is finalized at initialization
* time */
usbi_mutex_t lock;
int refcnt;
struct libusb_context *ctx;
uint8_t bus_number;
uint8_t device_address;
uint8_t num_configurations;
enum libusb_speed speed;
struct list_head list;
unsigned long session_data;
unsigned char os_priv[0];
};
struct libusb_device_handle {
/* lock protects claimed_interfaces */
usbi_mutex_t lock;
unsigned long claimed_interfaces;
struct list_head list;
struct libusb_device *dev;
unsigned char os_priv[0];
};
enum {
USBI_CLOCK_MONOTONIC,
USBI_CLOCK_REALTIME
};
/* in-memory transfer layout:
*
* 1. struct usbi_transfer
* 2. struct libusb_transfer (which includes iso packets) [variable size]
* 3. os private data [variable size]
*
* from a libusb_transfer, you can get the usbi_transfer by rewinding the
* appropriate number of bytes.
* the usbi_transfer includes the number of allocated packets, so you can
* determine the size of the transfer and hence the start and length of the
* OS-private data.
*/
struct usbi_transfer {
int num_iso_packets;
struct list_head list;
struct timeval timeout;
int transferred;
uint8_t flags;
/* this lock is held during libusb_submit_transfer() and
* libusb_cancel_transfer() (allowing the OS backend to prevent duplicate
* cancellation, submission-during-cancellation, etc). the OS backend
* should also take this lock in the handle_events path, to prevent the user
* cancelling the transfer from another thread while you are processing
* its completion (presumably there would be races within your OS backend
* if this were possible). */
usbi_mutex_t lock;
};
enum usbi_transfer_flags {
/* The transfer has timed out */
USBI_TRANSFER_TIMED_OUT = 1 << 0,
/* Set by backend submit_transfer() if the OS handles timeout */
USBI_TRANSFER_OS_HANDLES_TIMEOUT = 1 << 1,
/* Cancellation was requested via libusb_cancel_transfer() */
USBI_TRANSFER_CANCELLING = 1 << 2,
/* Operation on the transfer failed because the device disappeared */
USBI_TRANSFER_DEVICE_DISAPPEARED = 1 << 3,
};
#define USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer) \
((struct libusb_transfer *)(((unsigned char *)(transfer)) \
+ sizeof(struct usbi_transfer)))
#define LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer) \
((struct usbi_transfer *)(((unsigned char *)(transfer)) \
- sizeof(struct usbi_transfer)))
static inline void *usbi_transfer_get_os_priv(struct usbi_transfer *transfer)
{
return ((unsigned char *)transfer) + sizeof(struct usbi_transfer)
+ sizeof(struct libusb_transfer)
+ (transfer->num_iso_packets
* sizeof(struct libusb_iso_packet_descriptor));
}
/* bus structures */
/* All standard descriptors have these 2 fields in common */
struct usb_descriptor_header {
uint8_t bLength;
uint8_t bDescriptorType;
};
/* shared data and functions */
int usbi_io_init(struct libusb_context *ctx);
void usbi_io_exit(struct libusb_context *ctx);
struct libusb_device *usbi_alloc_device(struct libusb_context *ctx,
unsigned long session_id);
struct libusb_device *usbi_get_device_by_session_id(struct libusb_context *ctx,
unsigned long session_id);
int usbi_sanitize_device(struct libusb_device *dev);
void usbi_handle_disconnect(struct libusb_device_handle *handle);
int usbi_handle_transfer_completion(struct usbi_transfer *itransfer,
enum libusb_transfer_status status);
int usbi_handle_transfer_cancellation(struct usbi_transfer *transfer);
int usbi_parse_descriptor(unsigned char *source, const char *descriptor,
void *dest, int host_endian);
int usbi_get_config_index_by_value(struct libusb_device *dev,
uint8_t bConfigurationValue, int *idx);
/* polling */
struct usbi_pollfd {
/* must come first */
struct libusb_pollfd pollfd;
struct list_head list;
};
int usbi_add_pollfd(struct libusb_context *ctx, int fd, short events);
void usbi_remove_pollfd(struct libusb_context *ctx, int fd);
void usbi_fd_notification(struct libusb_context *ctx);
/* device discovery */
/* we traverse usbfs without knowing how many devices we are going to find.
* so we create this discovered_devs model which is similar to a linked-list
* which grows when required. it can be freed once discovery has completed,
* eliminating the need for a list node in the libusb_device structure
* itself. */
struct discovered_devs {
size_t len;
size_t capacity;
struct libusb_device *devices[0];
};
struct discovered_devs *discovered_devs_append(
struct discovered_devs *discdevs, struct libusb_device *dev);
/* OS abstraction */
/* This is the interface that OS backends need to implement.
* All fields are mandatory, except ones explicitly noted as optional. */
struct usbi_os_backend {
/* A human-readable name for your backend, e.g. "Linux usbfs" */
const char *name;
/* Perform initialization of your backend. You might use this function
* to determine specific capabilities of the system, allocate required
* data structures for later, etc.
*
* This function is called when a libusb user initializes the library
* prior to use.
*
* Return 0 on success, or a LIBUSB_ERROR code on failure.
*/
int (*init)(struct libusb_context *ctx);
/* Deinitialization. Optional. This function should destroy anything
* that was set up by init.
*
* This function is called when the user deinitializes the library.
*/
void (*exit)(void);
/* Enumerate all the USB devices on the system, returning them in a list
* of discovered devices.
*
* Your implementation should enumerate all devices on the system,
* regardless of whether they have been seen before or not.
*
* When you have found a device, compute a session ID for it. The session
* ID should uniquely represent that particular device for that particular
* connection session since boot (i.e. if you disconnect and reconnect a
* device immediately after, it should be assigned a different session ID).
* If your OS cannot provide a unique session ID as described above,
* presenting a session ID of (bus_number << 8 | device_address) should
* be sufficient. Bus numbers and device addresses wrap and get reused,
* but that is an unlikely case.
*
* After computing a session ID for a device, call
* usbi_get_device_by_session_id(). This function checks if libusb already
* knows about the device, and if so, it provides you with a libusb_device
* structure for it.
*
* If usbi_get_device_by_session_id() returns NULL, it is time to allocate
* a new device structure for the device. Call usbi_alloc_device() to
* obtain a new libusb_device structure with reference count 1. Populate
* the bus_number and device_address attributes of the new device, and
* perform any other internal backend initialization you need to do. At
* this point, you should be ready to provide device descriptors and so
* on through the get_*_descriptor functions. Finally, call
* usbi_sanitize_device() to perform some final sanity checks on the
* device. Assuming all of the above succeeded, we can now continue.
* If any of the above failed, remember to unreference the device that
* was returned by usbi_alloc_device().
*
* At this stage we have a populated libusb_device structure (either one
* that was found earlier, or one that we have just allocated and
* populated). This can now be added to the discovered devices list
* using discovered_devs_append(). Note that discovered_devs_append()
* may reallocate the list, returning a new location for it, and also
* note that reallocation can fail. Your backend should handle these
* error conditions appropriately.
*
* This function should not generate any bus I/O and should not block.
* If I/O is required (e.g. reading the active configuration value), it is
* OK to ignore these suggestions :)
*
* This function is executed when the user wishes to retrieve a list
* of USB devices connected to the system.
*
* Return 0 on success, or a LIBUSB_ERROR code on failure.
*/
int (*get_device_list)(struct libusb_context *ctx,
struct discovered_devs **discdevs);
/* Open a device for I/O and other USB operations. The device handle
* is preallocated for you, you can retrieve the device in question
* through handle->dev.
*
* Your backend should allocate any internal resources required for I/O
* and other operations so that those operations can happen (hopefully)
* without hiccup. This is also a good place to inform libusb that it
* should monitor certain file descriptors related to this device -
* see the usbi_add_pollfd() function.
*
* This function should not generate any bus I/O and should not block.
*
* This function is called when the user attempts to obtain a device
* handle for a device.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_ACCESS if the user has insufficient permissions
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since
* discovery
* - another LIBUSB_ERROR code on other failure
*
* Do not worry about freeing the handle on failed open, the upper layers
* do this for you.
*/
int (*open)(struct libusb_device_handle *handle);
/* Close a device such that the handle cannot be used again. Your backend
* should destroy any resources that were allocated in the open path.
* This may also be a good place to call usbi_remove_pollfd() to inform
* libusb of any file descriptors associated with this device that should
* no longer be monitored.
*
* This function is called when the user closes a device handle.
*/
void (*close)(struct libusb_device_handle *handle);
/* Retrieve the device descriptor from a device.
*
* The descriptor should be retrieved from memory, NOT via bus I/O to the
* device. This means that you may have to cache it in a private structure
* during get_device_list enumeration. Alternatively, you may be able
* to retrieve it from a kernel interface (some Linux setups can do this)
* still without generating bus I/O.
*
* This function is expected to write DEVICE_DESC_LENGTH (18) bytes into
* buffer, which is guaranteed to be big enough.
*
* This function is called when sanity-checking a device before adding
* it to the list of discovered devices, and also when the user requests
* to read the device descriptor.
*
* This function is expected to return the descriptor in bus-endian format
* (LE). If it returns the multi-byte values in host-endian format,
* set the host_endian output parameter to "1".
*
* Return 0 on success or a LIBUSB_ERROR code on failure.
*/
int (*get_device_descriptor)(struct libusb_device *device,
unsigned char *buffer, int *host_endian);
/* Get the ACTIVE configuration descriptor for a device.
*
* The descriptor should be retrieved from memory, NOT via bus I/O to the
* device. This means that you may have to cache it in a private structure
* during get_device_list enumeration. You may also have to keep track
* of which configuration is active when the user changes it.
*
* This function is expected to write len bytes of data into buffer, which
* is guaranteed to be big enough. If you can only do a partial write,
* return an error code.
*
* This function is expected to return the descriptor in bus-endian format
* (LE). If it returns the multi-byte values in host-endian format,
* set the host_endian output parameter to "1".
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state
* - another LIBUSB_ERROR code on other failure
*/
int (*get_active_config_descriptor)(struct libusb_device *device,
unsigned char *buffer, size_t len, int *host_endian);
/* Get a specific configuration descriptor for a device.
*
* The descriptor should be retrieved from memory, NOT via bus I/O to the
* device. This means that you may have to cache it in a private structure
* during get_device_list enumeration.
*
* The requested descriptor is expressed as a zero-based index (i.e. 0
* indicates that we are requesting the first descriptor). The index does
* not (necessarily) equal the bConfigurationValue of the configuration
* being requested.
*
* This function is expected to write len bytes of data into buffer, which
* is guaranteed to be big enough. If you can only do a partial write,
* return an error code.
*
* This function is expected to return the descriptor in bus-endian format
* (LE). If it returns the multi-byte values in host-endian format,
* set the host_endian output parameter to "1".
*
* Return 0 on success or a LIBUSB_ERROR code on failure.
*/
int (*get_config_descriptor)(struct libusb_device *device,
uint8_t config_index, unsigned char *buffer, size_t len,
int *host_endian);
/* Get the bConfigurationValue for the active configuration for a device.
* Optional. This should only be implemented if you can retrieve it from
* cache (don't generate I/O).
*
* If you cannot retrieve this from cache, either do not implement this
* function, or return LIBUSB_ERROR_NOT_SUPPORTED. This will cause
* libusb to retrieve the information through a standard control transfer.
*
* This function must be non-blocking.
* Return:
* - 0 on success
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - LIBUSB_ERROR_NOT_SUPPORTED if the value cannot be retrieved without
* blocking
* - another LIBUSB_ERROR code on other failure.
*/
int (*get_configuration)(struct libusb_device_handle *handle, int *config);
/* Set the active configuration for a device.
*
* A configuration value of -1 should put the device in unconfigured state.
*
* This function can block.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
* - LIBUSB_ERROR_BUSY if interfaces are currently claimed (and hence
* configuration cannot be changed)
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - another LIBUSB_ERROR code on other failure.
*/
int (*set_configuration)(struct libusb_device_handle *handle, int config);
/* Claim an interface. When claimed, the application can then perform
* I/O to an interface's endpoints.
*
* This function should not generate any bus I/O and should not block.
* Interface claiming is a logical operation that simply ensures that
* no other drivers/applications are using the interface, and after
* claiming, no other drivers/applicatiosn can use the interface because
* we now "own" it.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if the interface does not exist
* - LIBUSB_ERROR_BUSY if the interface is in use by another driver/app
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - another LIBUSB_ERROR code on other failure
*/
int (*claim_interface)(struct libusb_device_handle *handle, int interface_number);
/* Release a previously claimed interface.
*
* This function should also generate a SET_INTERFACE control request,
* resetting the alternate setting of that interface to 0. It's OK for
* this function to block as a result.
*
* You will only ever be asked to release an interface which was
* successfully claimed earlier.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - another LIBUSB_ERROR code on other failure
*/
int (*release_interface)(struct libusb_device_handle *handle, int interface_number);
/* Set the alternate setting for an interface.
*
* You will only ever be asked to set the alternate setting for an
* interface which was successfully claimed earlier.
*
* It's OK for this function to block.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if the alternate setting does not exist
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - another LIBUSB_ERROR code on other failure
*/
int (*set_interface_altsetting)(struct libusb_device_handle *handle,
int interface_number, int altsetting);
/* Clear a halt/stall condition on an endpoint.
*
* It's OK for this function to block.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - another LIBUSB_ERROR code on other failure
*/
int (*clear_halt)(struct libusb_device_handle *handle,
unsigned char endpoint);
/* Perform a USB port reset to reinitialize a device.
*
* If possible, the handle should still be usable after the reset
* completes, assuming that the device descriptors did not change during
* reset and all previous interface state can be restored.
*
* If something changes, or you cannot easily locate/verify the resetted
* device, return LIBUSB_ERROR_NOT_FOUND. This prompts the application
* to close the old handle and re-enumerate the device.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if re-enumeration is required, or if the device
* has been disconnected since it was opened
* - another LIBUSB_ERROR code on other failure
*/
int (*reset_device)(struct libusb_device_handle *handle);
/* Determine if a kernel driver is active on an interface. Optional.
*
* The presence of a kernel driver on an interface indicates that any
* calls to claim_interface would fail with the LIBUSB_ERROR_BUSY code.
*
* Return:
* - 0 if no driver is active
* - 1 if a driver is active
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - another LIBUSB_ERROR code on other failure
*/
int (*kernel_driver_active)(struct libusb_device_handle *handle,
int interface_number);
/* Detach a kernel driver from an interface. Optional.
*
* After detaching a kernel driver, the interface should be available
* for claim.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if no kernel driver was active
* - LIBUSB_ERROR_INVALID_PARAM if the interface does not exist
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - another LIBUSB_ERROR code on other failure
*/
int (*detach_kernel_driver)(struct libusb_device_handle *handle,
int interface_number);
/* Attach a kernel driver to an interface. Optional.
*
* Reattach a kernel driver to the device.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NOT_FOUND if no kernel driver was active
* - LIBUSB_ERROR_INVALID_PARAM if the interface does not exist
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected since it
* was opened
* - LIBUSB_ERROR_BUSY if a program or driver has claimed the interface,
* preventing reattachment
* - another LIBUSB_ERROR code on other failure
*/
int (*attach_kernel_driver)(struct libusb_device_handle *handle,
int interface_number);
/* Destroy a device. Optional.
*
* This function is called when the last reference to a device is
* destroyed. It should free any resources allocated in the get_device_list
* path.
*/
void (*destroy_device)(struct libusb_device *dev);
/* Submit a transfer. Your implementation should take the transfer,
* morph it into whatever form your platform requires, and submit it
* asynchronously.
*
* This function must not block.
*
* Return:
* - 0 on success
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* - another LIBUSB_ERROR code on other failure
*/
int (*submit_transfer)(struct usbi_transfer *itransfer);
/* Cancel a previously submitted transfer.
*
* This function must not block. The transfer cancellation must complete
* later, resulting in a call to usbi_handle_transfer_cancellation()
* from the context of handle_events.
*/
int (*cancel_transfer)(struct usbi_transfer *itransfer);
/* Clear a transfer as if it has completed or cancelled, but do not
* report any completion/cancellation to the library. You should free
* all private data from the transfer as if you were just about to report
* completion or cancellation.
*
* This function might seem a bit out of place. It is used when libusb
* detects a disconnected device - it calls this function for all pending
* transfers before reporting completion (with the disconnect code) to
* the user. Maybe we can improve upon this internal interface in future.
*/
void (*clear_transfer_priv)(struct usbi_transfer *itransfer);
/* Handle any pending events. This involves monitoring any active
* transfers and processing their completion or cancellation.
*
* The function is passed an array of pollfd structures (size nfds)
* as a result of the poll() system call. The num_ready parameter
* indicates the number of file descriptors that have reported events
* (i.e. the poll() return value). This should be enough information
* for you to determine which actions need to be taken on the currently
* active transfers.
*
* For any cancelled transfers, call usbi_handle_transfer_cancellation().
* For completed transfers, call usbi_handle_transfer_completion().
* For control/bulk/interrupt transfers, populate the "transferred"
* element of the appropriate usbi_transfer structure before calling the
* above functions. For isochronous transfers, populate the status and
* transferred fields of the iso packet descriptors of the transfer.
*
* This function should also be able to detect disconnection of the
* device, reporting that situation with usbi_handle_disconnect().
*
* When processing an event related to a transfer, you probably want to
* take usbi_transfer.lock to prevent races. See the documentation for
* the usbi_transfer structure.
*
* Return 0 on success, or a LIBUSB_ERROR code on failure.
*/
int (*handle_events)(struct libusb_context *ctx,
struct pollfd *fds, POLL_NFDS_TYPE nfds, int num_ready);
/* Get time from specified clock. At least two clocks must be implemented
by the backend: USBI_CLOCK_REALTIME, and USBI_CLOCK_MONOTONIC.
Description of clocks:
USBI_CLOCK_REALTIME : clock returns time since system epoch.
USBI_CLOCK_MONOTONIC: clock returns time since unspecified start
time (usually boot).
*/
int (*clock_gettime)(int clkid, struct timespec *tp);
#ifdef USBI_TIMERFD_AVAILABLE
/* clock ID of the clock that should be used for timerfd */
clockid_t (*get_timerfd_clockid)(void);
#endif
/* Number of bytes to reserve for per-device private backend data.
* This private data area is accessible through the "os_priv" field of
* struct libusb_device. */
size_t device_priv_size;
/* Number of bytes to reserve for per-handle private backend data.
* This private data area is accessible through the "os_priv" field of
* struct libusb_device. */
size_t device_handle_priv_size;
/* Number of bytes to reserve for per-transfer private backend data.
* This private data area is accessible by calling
* usbi_transfer_get_os_priv() on the appropriate usbi_transfer instance.
*/
size_t transfer_priv_size;
/* Mumber of additional bytes for os_priv for each iso packet.
* Can your backend use this? */
/* FIXME: linux can't use this any more. if other OS's cannot either,
* then remove this */
size_t add_iso_packet_size;
};
extern const struct usbi_os_backend * const usbi_backend;
extern const struct usbi_os_backend linux_usbfs_backend;
extern const struct usbi_os_backend darwin_backend;
extern const struct usbi_os_backend openbsd_backend;
extern const struct usbi_os_backend windows_backend;
#endif

View File

@@ -1,169 +0,0 @@
/*
* darwin backend for libusb 1.0
* Copyright (C) 2008-2009 Nathan Hjelm <hjelmn@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(LIBUSB_DARWIN_H)
#define LIBUSB_DARWIN_H
#include "libusbi.h"
#include <IOKit/IOTypes.h>
#include <IOKit/IOCFBundle.h>
#include <IOKit/usb/IOUSBLib.h>
#include <IOKit/IOCFPlugIn.h>
/* IOUSBInterfaceInferface */
#if defined (kIOUSBInterfaceInterfaceID300)
#define usb_interface_t IOUSBInterfaceInterface300
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID300
#define InterfaceVersion 300
#elif defined (kIOUSBInterfaceInterfaceID245)
#define usb_interface_t IOUSBInterfaceInterface245
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID245
#define InterfaceVersion 245
#elif defined (kIOUSBInterfaceInterfaceID220)
#define usb_interface_t IOUSBInterfaceInterface220
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID220
#define InterfaceVersion 220
#elif defined (kIOUSBInterfaceInterfaceID197)
#define usb_interface_t IOUSBInterfaceInterface197
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID197
#define InterfaceVersion 197
#elif defined (kIOUSBInterfaceInterfaceID190)
#define usb_interface_t IOUSBInterfaceInterface190
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID190
#define InterfaceVersion 190
#elif defined (kIOUSBInterfaceInterfaceID182)
#define usb_interface_t IOUSBInterfaceInterface182
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID182
#define InterfaceVersion 182
#else
#error "IOUSBFamily is too old. Please upgrade your OS"
#endif
/* IOUSBDeviceInterface */
#if defined (kIOUSBDeviceInterfaceID320)
#define usb_device_t IOUSBDeviceInterface320
#define DeviceInterfaceID kIOUSBDeviceInterfaceID320
#define DeviceVersion 320
#elif defined (kIOUSBDeviceInterfaceID300)
#define usb_device_t IOUSBDeviceInterface300
#define DeviceInterfaceID kIOUSBDeviceInterfaceID300
#define DeviceVersion 300
#elif defined (kIOUSBDeviceInterfaceID245)
#define usb_device_t IOUSBDeviceInterface245
#define DeviceInterfaceID kIOUSBDeviceInterfaceID245
#define DeviceVersion 245
#elif defined (kIOUSBDeviceInterfaceID197)
#define usb_device_t IOUSBDeviceInterface197
#define DeviceInterfaceID kIOUSBDeviceInterfaceID197
#define DeviceVersion 197
#elif defined (kIOUSBDeviceInterfaceID187)
#define usb_device_t IOUSBDeviceInterface187
#define DeviceInterfaceID kIOUSBDeviceInterfaceID187
#define DeviceVersion 187
#elif defined (kIOUSBDeviceInterfaceID182)
#define usb_device_t IOUSBDeviceInterface182
#define DeviceInterfaceID kIOUSBDeviceInterfaceID182
#define DeviceVersion 182
#else
#error "IOUSBFamily is too old. Please upgrade your OS"
#endif
#if !defined(IO_OBJECT_NULL)
#define IO_OBJECT_NULL ((io_object_t) 0)
#endif
typedef IOCFPlugInInterface *io_cf_plugin_ref_t;
typedef IONotificationPortRef io_notification_port_t;
/* private structures */
struct darwin_device_priv {
IOUSBDeviceDescriptor dev_descriptor;
UInt32 location;
char sys_path[21];
usb_device_t **device;
int open_count;
UInt8 first_config, active_config;
};
struct darwin_device_handle_priv {
int is_open;
CFRunLoopSourceRef cfSource;
int fds[2];
struct darwin_interface {
usb_interface_t **interface;
uint8_t num_endpoints;
CFRunLoopSourceRef cfSource;
uint64_t frames[256];
uint8_t endpoint_addrs[USB_MAXENDPOINTS];
} interfaces[USB_MAXINTERFACES];
};
struct darwin_transfer_priv {
/* Isoc */
IOUSBIsocFrame *isoc_framelist;
size_t num_iso_packets;
/* Control */
#if !defined (LIBUSB_NO_TIMEOUT_DEVICE)
IOUSBDevRequestTO req;
#else
IOUSBDevRequest req;
#endif
/* Bulk */
};
enum {
MESSAGE_DEVICE_GONE,
MESSAGE_ASYNC_IO_COMPLETE
};
#endif

View File

@@ -1,139 +0,0 @@
/*
* usbfs header structures
* Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
* Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LIBUSB_USBFS_H
#define LIBUSB_USBFS_H
#define SYSFS_DEVICE_PATH "/sys/bus/usb/devices"
struct usbfs_ctrltransfer {
/* keep in sync with usbdevice_fs.h:usbdevfs_ctrltransfer */
uint8_t bmRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
uint32_t timeout; /* in milliseconds */
/* pointer to data */
void *data;
};
struct usbfs_bulktransfer {
/* keep in sync with usbdevice_fs.h:usbdevfs_bulktransfer */
unsigned int ep;
unsigned int len;
unsigned int timeout; /* in milliseconds */
/* pointer to data */
void *data;
};
struct usbfs_setinterface {
/* keep in sync with usbdevice_fs.h:usbdevfs_setinterface */
unsigned int interface;
unsigned int altsetting;
};
#define USBFS_MAXDRIVERNAME 255
struct usbfs_getdriver {
unsigned int interface;
char driver[USBFS_MAXDRIVERNAME + 1];
};
#define USBFS_URB_SHORT_NOT_OK 0x01
#define USBFS_URB_ISO_ASAP 0x02
#define USBFS_URB_BULK_CONTINUATION 0x04
#define USBFS_URB_QUEUE_BULK 0x10
#define USBFS_URB_ZERO_PACKET 0x40
enum usbfs_urb_type {
USBFS_URB_TYPE_ISO = 0,
USBFS_URB_TYPE_INTERRUPT = 1,
USBFS_URB_TYPE_CONTROL = 2,
USBFS_URB_TYPE_BULK = 3,
};
struct usbfs_iso_packet_desc {
unsigned int length;
unsigned int actual_length;
unsigned int status;
};
#define MAX_ISO_BUFFER_LENGTH 32768
#define MAX_BULK_BUFFER_LENGTH 16384
#define MAX_CTRL_BUFFER_LENGTH 4096
struct usbfs_urb {
unsigned char type;
unsigned char endpoint;
int status;
unsigned int flags;
void *buffer;
int buffer_length;
int actual_length;
int start_frame;
int number_of_packets;
int error_count;
unsigned int signr;
void *usercontext;
struct usbfs_iso_packet_desc iso_frame_desc[0];
};
struct usbfs_connectinfo {
unsigned int devnum;
unsigned char slow;
};
struct usbfs_ioctl {
int ifno; /* interface 0..N ; negative numbers reserved */
int ioctl_code; /* MUST encode size + direction of data so the
* macros in <asm/ioctl.h> give correct values */
void *data; /* param buffer (in, or out) */
};
struct usbfs_hub_portinfo {
unsigned char numports;
unsigned char port[127]; /* port to device num mapping */
};
#define IOCTL_USBFS_CONTROL _IOWR('U', 0, struct usbfs_ctrltransfer)
#define IOCTL_USBFS_BULK _IOWR('U', 2, struct usbfs_bulktransfer)
#define IOCTL_USBFS_RESETEP _IOR('U', 3, unsigned int)
#define IOCTL_USBFS_SETINTF _IOR('U', 4, struct usbfs_setinterface)
#define IOCTL_USBFS_SETCONFIG _IOR('U', 5, unsigned int)
#define IOCTL_USBFS_GETDRIVER _IOW('U', 8, struct usbfs_getdriver)
#define IOCTL_USBFS_SUBMITURB _IOR('U', 10, struct usbfs_urb)
#define IOCTL_USBFS_DISCARDURB _IO('U', 11)
#define IOCTL_USBFS_REAPURB _IOW('U', 12, void *)
#define IOCTL_USBFS_REAPURBNDELAY _IOW('U', 13, void *)
#define IOCTL_USBFS_CLAIMINTF _IOR('U', 15, unsigned int)
#define IOCTL_USBFS_RELEASEINTF _IOR('U', 16, unsigned int)
#define IOCTL_USBFS_CONNECTINFO _IOW('U', 17, struct usbfs_connectinfo)
#define IOCTL_USBFS_IOCTL _IOWR('U', 18, struct usbfs_ioctl)
#define IOCTL_USBFS_HUB_PORTINFO _IOR('U', 19, struct usbfs_hub_portinfo)
#define IOCTL_USBFS_RESET _IO('U', 20)
#define IOCTL_USBFS_CLEAR_HALT _IOR('U', 21, unsigned int)
#define IOCTL_USBFS_DISCONNECT _IO('U', 22)
#define IOCTL_USBFS_CONNECT _IO('U', 23)
#endif

View File

@@ -1,727 +0,0 @@
/*
* Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dev/usb/usb.h>
#include "libusb.h"
#include "libusbi.h"
struct device_priv {
char devnode[16];
int fd;
unsigned char *cdesc; /* active config descriptor */
usb_device_descriptor_t ddesc; /* usb device descriptor */
};
struct handle_priv {
int pipe[2]; /* for event notification */
int endpoints[USB_MAX_ENDPOINTS];
};
/*
* Backend functions
*/
static int obsd_get_device_list(struct libusb_context *,
struct discovered_devs **);
static int obsd_open(struct libusb_device_handle *);
static void obsd_close(struct libusb_device_handle *);
static int obsd_get_device_descriptor(struct libusb_device *, unsigned char *,
int *);
static int obsd_get_active_config_descriptor(struct libusb_device *,
unsigned char *, size_t, int *);
static int obsd_get_config_descriptor(struct libusb_device *, uint8_t,
unsigned char *, size_t, int *);
static int obsd_get_configuration(struct libusb_device_handle *, int *);
static int obsd_set_configuration(struct libusb_device_handle *, int);
static int obsd_claim_interface(struct libusb_device_handle *, int);
static int obsd_release_interface(struct libusb_device_handle *, int);
static int obsd_set_interface_altsetting(struct libusb_device_handle *, int,
int);
static int obsd_clear_halt(struct libusb_device_handle *, unsigned char);
static int obsd_reset_device(struct libusb_device_handle *);
static void obsd_destroy_device(struct libusb_device *);
static int obsd_submit_transfer(struct usbi_transfer *);
static int obsd_cancel_transfer(struct usbi_transfer *);
static void obsd_clear_transfer_priv(struct usbi_transfer *);
static int obsd_handle_events(struct libusb_context *ctx, struct pollfd *,
nfds_t, int);
static int obsd_clock_gettime(int, struct timespec *);
/*
* Private functions
*/
static int _errno_to_libusb(int);
static int _cache_active_config_descriptor(struct libusb_device *, int);
static int _sync_control_transfer(struct usbi_transfer *);
static int _sync_gen_transfer(struct usbi_transfer *);
static int _access_endpoint(struct libusb_transfer *);
const struct usbi_os_backend openbsd_backend = {
"Synchronous OpenBSD backend",
NULL, /* init() */
NULL, /* exit() */
obsd_get_device_list,
obsd_open,
obsd_close,
obsd_get_device_descriptor,
obsd_get_active_config_descriptor,
obsd_get_config_descriptor,
obsd_get_configuration,
obsd_set_configuration,
obsd_claim_interface,
obsd_release_interface,
obsd_set_interface_altsetting,
obsd_clear_halt,
obsd_reset_device,
NULL, /* kernel_driver_active() */
NULL, /* detach_kernel_driver() */
NULL, /* attach_kernel_driver() */
obsd_destroy_device,
obsd_submit_transfer,
obsd_cancel_transfer,
obsd_clear_transfer_priv,
obsd_handle_events,
obsd_clock_gettime,
sizeof(struct device_priv),
sizeof(struct handle_priv),
0, /* transfer_priv_size */
0, /* add_iso_packet_size */
};
int
obsd_get_device_list(struct libusb_context * ctx,
struct discovered_devs **discdevs)
{
struct libusb_device *dev;
struct device_priv *dpriv;
struct usb_device_info di;
unsigned long session_id;
char devnode[16];
int fd, err, i;
usbi_dbg("");
/* Only ugen(4) is supported */
for (i = 0; i < USB_MAX_DEVICES; i++) {
/* Control endpoint is always .00 */
snprintf(devnode, sizeof(devnode), "/dev/ugen%d.00", i);
if ((fd = open(devnode, O_RDONLY)) < 0) {
if (errno != ENOENT && errno != ENXIO)
usbi_err(ctx, "could not open %s", devnode);
continue;
}
if (ioctl(fd, USB_GET_DEVICEINFO, &di) < 0)
continue;
session_id = (di.udi_bus << 8 | di.udi_addr);
dev = usbi_get_device_by_session_id(ctx, session_id);
if (dev == NULL) {
dev = usbi_alloc_device(ctx, session_id);
if (dev == NULL)
return (LIBUSB_ERROR_NO_MEM);
dev->bus_number = di.udi_bus;
dev->device_address = di.udi_addr;
dev->speed = di.udi_speed;
dpriv = (struct device_priv *)dev->os_priv;
strlcpy(dpriv->devnode, devnode, sizeof(devnode));
dpriv->fd = -1;
if (ioctl(fd, USB_GET_DEVICE_DESC, &dpriv->ddesc) < 0) {
err = errno;
goto error;
}
dpriv->cdesc = NULL;
if (_cache_active_config_descriptor(dev, fd)) {
err = errno;
goto error;
}
if ((err = usbi_sanitize_device(dev)))
goto error;
}
close(fd);
if (discovered_devs_append(*discdevs, dev) == NULL)
return (LIBUSB_ERROR_NO_MEM);
}
return (LIBUSB_SUCCESS);
error:
close(fd);
libusb_unref_device(dev);
return _errno_to_libusb(err);
}
int
obsd_open(struct libusb_device_handle *handle)
{
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
dpriv->fd = open(dpriv->devnode, O_RDWR);
if (dpriv->fd < 0) {
dpriv->fd = open(dpriv->devnode, O_RDONLY);
if (dpriv->fd < 0)
return _errno_to_libusb(errno);
}
usbi_dbg("open %s: fd %d", dpriv->devnode, dpriv->fd);
if (pipe(hpriv->pipe) < 0)
return _errno_to_libusb(errno);
return usbi_add_pollfd(HANDLE_CTX(handle), hpriv->pipe[0], POLLIN);
}
void
obsd_close(struct libusb_device_handle *handle)
{
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
usbi_dbg("close: fd %d", dpriv->fd);
close(dpriv->fd);
dpriv->fd = -1;
usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->pipe[0]);
close(hpriv->pipe[0]);
close(hpriv->pipe[1]);
}
int
obsd_get_device_descriptor(struct libusb_device *dev, unsigned char *buf,
int *host_endian)
{
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
usbi_dbg("");
memcpy(buf, &dpriv->ddesc, DEVICE_DESC_LENGTH);
*host_endian = 0;
return (LIBUSB_SUCCESS);
}
int
obsd_get_active_config_descriptor(struct libusb_device *dev,
unsigned char *buf, size_t len, int *host_endian)
{
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
usb_config_descriptor_t *ucd;
ucd = (usb_config_descriptor_t *) dpriv->cdesc;
len = MIN(len, UGETW(ucd->wTotalLength));
usbi_dbg("len %d", len);
memcpy(buf, dpriv->cdesc, len);
*host_endian = 0;
return (LIBUSB_SUCCESS);
}
int
obsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
unsigned char *buf, size_t len, int *host_endian)
{
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
struct usb_full_desc ufd;
int fd, err;
usbi_dbg("index %d, len %d", idx, len);
/* A config descriptor may be requested before opening the device */
if (dpriv->fd >= 0) {
fd = dpriv->fd;
} else {
fd = open(dpriv->devnode, O_RDONLY);
if (fd < 0)
return _errno_to_libusb(errno);
}
ufd.ufd_config_index = idx;
ufd.ufd_size = len;
ufd.ufd_data = buf;
if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
err = errno;
if (dpriv->fd < 0)
close(fd);
return _errno_to_libusb(err);
}
if (dpriv->fd < 0)
close(fd);
*host_endian = 0;
return (LIBUSB_SUCCESS);
}
int
obsd_get_configuration(struct libusb_device_handle *handle, int *config)
{
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
usbi_dbg("");
if (ioctl(dpriv->fd, USB_GET_CONFIG, config) < 0)
return _errno_to_libusb(errno);
usbi_dbg("configuration %d", *config);
return (LIBUSB_SUCCESS);
}
int
obsd_set_configuration(struct libusb_device_handle *handle, int config)
{
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
usbi_dbg("configuration %d", config);
if (ioctl(dpriv->fd, USB_SET_CONFIG, &config) < 0)
return _errno_to_libusb(errno);
return _cache_active_config_descriptor(handle->dev, dpriv->fd);
}
int
obsd_claim_interface(struct libusb_device_handle *handle, int iface)
{
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
int i;
for (i = 0; i < USB_MAX_ENDPOINTS; i++)
hpriv->endpoints[i] = -1;
return (LIBUSB_SUCCESS);
}
int
obsd_release_interface(struct libusb_device_handle *handle, int iface)
{
struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
int i;
for (i = 0; i < USB_MAX_ENDPOINTS; i++)
if (hpriv->endpoints[i] >= 0)
close(hpriv->endpoints[i]);
return (LIBUSB_SUCCESS);
}
int
obsd_set_interface_altsetting(struct libusb_device_handle *handle, int iface,
int altsetting)
{
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
struct usb_alt_interface intf;
usbi_dbg("iface %d, setting %d", iface, altsetting);
memset(&intf, 0, sizeof(intf));
intf.uai_interface_index = iface;
intf.uai_alt_no = altsetting;
if (ioctl(dpriv->fd, USB_SET_ALTINTERFACE, &intf) < 0)
return _errno_to_libusb(errno);
return (LIBUSB_SUCCESS);
}
int
obsd_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
{
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
struct usb_ctl_request req;
usbi_dbg("");
req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT;
req.ucr_request.bRequest = UR_CLEAR_FEATURE;
USETW(req.ucr_request.wValue, UF_ENDPOINT_HALT);
USETW(req.ucr_request.wIndex, endpoint);
USETW(req.ucr_request.wLength, 0);
if (ioctl(dpriv->fd, USB_DO_REQUEST, &req) < 0)
return _errno_to_libusb(errno);
return (LIBUSB_SUCCESS);
}
int
obsd_reset_device(struct libusb_device_handle *handle)
{
usbi_dbg("");
return (LIBUSB_ERROR_NOT_SUPPORTED);
}
void
obsd_destroy_device(struct libusb_device *dev)
{
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
usbi_dbg("");
free(dpriv->cdesc);
}
int
obsd_submit_transfer(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer;
struct handle_priv *hpriv;
int err = 0;
usbi_dbg("");
transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
hpriv = (struct handle_priv *)transfer->dev_handle->os_priv;
switch (transfer->type) {
case LIBUSB_TRANSFER_TYPE_CONTROL:
err = _sync_control_transfer(itransfer);
break;
case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
if (IS_XFEROUT(transfer)) {
/* Isochronous write is not supported */
err = LIBUSB_ERROR_NOT_SUPPORTED;
break;
}
err = _sync_gen_transfer(itransfer);
break;
case LIBUSB_TRANSFER_TYPE_BULK:
case LIBUSB_TRANSFER_TYPE_INTERRUPT:
if (IS_XFEROUT(transfer) &&
transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) {
err = LIBUSB_ERROR_NOT_SUPPORTED;
break;
}
err = _sync_gen_transfer(itransfer);
break;
}
if (err)
return (err);
if (write(hpriv->pipe[1], &itransfer, sizeof(itransfer)) < 0)
return _errno_to_libusb(errno);
return (LIBUSB_SUCCESS);
}
int
obsd_cancel_transfer(struct usbi_transfer *itransfer)
{
usbi_dbg("");
return (LIBUSB_ERROR_NOT_SUPPORTED);
}
void
obsd_clear_transfer_priv(struct usbi_transfer *itransfer)
{
usbi_dbg("");
/* Nothing to do */
}
int
obsd_handle_events(struct libusb_context *ctx, struct pollfd *fds, nfds_t nfds,
int num_ready)
{
struct libusb_device_handle *handle;
struct handle_priv *hpriv = NULL;
struct usbi_transfer *itransfer;
struct pollfd *pollfd;
int i, err = 0;
usbi_dbg("");
pthread_mutex_lock(&ctx->open_devs_lock);
for (i = 0; i < nfds && num_ready > 0; i++) {
pollfd = &fds[i];
if (!pollfd->revents)
continue;
hpriv = NULL;
num_ready--;
list_for_each_entry(handle, &ctx->open_devs, list,
struct libusb_device_handle) {
hpriv = (struct handle_priv *)handle->os_priv;
if (hpriv->pipe[0] == pollfd->fd)
break;
hpriv = NULL;
}
if (NULL == hpriv) {
usbi_dbg("fd %d is not an event pipe!", pollfd->fd);
err = ENOENT;
break;
}
if (pollfd->revents & POLLERR) {
usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->pipe[0]);
usbi_handle_disconnect(handle);
continue;
}
if (read(hpriv->pipe[0], &itransfer, sizeof(itransfer)) < 0) {
err = errno;
break;
}
if ((err = usbi_handle_transfer_completion(itransfer,
LIBUSB_TRANSFER_COMPLETED)))
break;
}
pthread_mutex_unlock(&ctx->open_devs_lock);
if (err)
return _errno_to_libusb(err);
return (LIBUSB_SUCCESS);
}
int
obsd_clock_gettime(int clkid, struct timespec *tp)
{
usbi_dbg("clock %d", clkid);
if (clkid == USBI_CLOCK_REALTIME)
return clock_gettime(CLOCK_REALTIME, tp);
if (clkid == USBI_CLOCK_MONOTONIC)
return clock_gettime(CLOCK_MONOTONIC, tp);
return (LIBUSB_ERROR_INVALID_PARAM);
}
int
_errno_to_libusb(int err)
{
switch (err) {
case EIO:
return (LIBUSB_ERROR_IO);
case EACCES:
return (LIBUSB_ERROR_ACCESS);
case ENOENT:
return (LIBUSB_ERROR_NO_DEVICE);
case ENOMEM:
return (LIBUSB_ERROR_NO_MEM);
}
usbi_dbg("error: %s", strerror(err));
return (LIBUSB_ERROR_OTHER);
}
int
_cache_active_config_descriptor(struct libusb_device *dev, int fd)
{
struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
struct usb_config_desc ucd;
struct usb_full_desc ufd;
unsigned char* buf;
int len;
usbi_dbg("fd %d", fd);
ucd.ucd_config_index = USB_CURRENT_CONFIG_INDEX;
if ((ioctl(fd, USB_GET_CONFIG_DESC, &ucd)) < 0)
return _errno_to_libusb(errno);
usbi_dbg("active bLength %d", ucd.ucd_desc.bLength);
len = UGETW(ucd.ucd_desc.wTotalLength);
buf = malloc(len);
if (buf == NULL)
return (LIBUSB_ERROR_NO_MEM);
ufd.ufd_config_index = ucd.ucd_config_index;
ufd.ufd_size = len;
ufd.ufd_data = buf;
usbi_dbg("index %d, len %d", ufd.ufd_config_index, len);
if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
free(buf);
return _errno_to_libusb(errno);
}
if (dpriv->cdesc)
free(dpriv->cdesc);
dpriv->cdesc = buf;
return (0);
}
int
_sync_control_transfer(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer;
struct libusb_control_setup *setup;
struct device_priv *dpriv;
struct usb_ctl_request req;
transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
setup = (struct libusb_control_setup *)transfer->buffer;
usbi_dbg("type %d request %d value %d index %d length %d timeout %d",
setup->bmRequestType, setup->bRequest,
libusb_le16_to_cpu(setup->wValue),
libusb_le16_to_cpu(setup->wIndex),
libusb_le16_to_cpu(setup->wLength), transfer->timeout);
req.ucr_request.bmRequestType = setup->bmRequestType;
req.ucr_request.bRequest = setup->bRequest;
/* Don't use USETW, libusb already deals with the endianness */
(*(uint16_t *)req.ucr_request.wValue) = setup->wValue;
(*(uint16_t *)req.ucr_request.wIndex) = setup->wIndex;
(*(uint16_t *)req.ucr_request.wLength) = setup->wLength;
req.ucr_data = transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
req.ucr_flags = USBD_SHORT_XFER_OK;
if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
return _errno_to_libusb(errno);
if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
return _errno_to_libusb(errno);
itransfer->transferred = req.ucr_actlen;
usbi_dbg("transferred %d", itransfer->transferred);
return (0);
}
int
_access_endpoint(struct libusb_transfer *transfer)
{
struct handle_priv *hpriv;
struct device_priv *dpriv;
char *s, devnode[16];
int fd, endpt;
mode_t mode;
hpriv = (struct handle_priv *)transfer->dev_handle->os_priv;
dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
endpt = UE_GET_ADDR(transfer->endpoint);
mode = IS_XFERIN(transfer) ? O_RDONLY : O_WRONLY;
usbi_dbg("endpoint %d mode %d", endpt, mode);
if (hpriv->endpoints[endpt] < 0) {
/* Pick the right node given the control one */
strlcpy(devnode, dpriv->devnode, sizeof(devnode));
s = strchr(devnode, '.');
snprintf(s, 4, ".%02d", endpt);
/* We may need to read/write to the same endpoint later. */
if (((fd = open(devnode, O_RDWR)) < 0) && (errno == ENXIO))
if ((fd = open(devnode, mode)) < 0)
return (-1);
hpriv->endpoints[endpt] = fd;
}
return (hpriv->endpoints[endpt]);
}
int
_sync_gen_transfer(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer;
int fd, nr = 1;
transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
/*
* Bulk, Interrupt or Isochronous transfer depends on the
* endpoint and thus the node to open.
*/
if ((fd = _access_endpoint(transfer)) < 0)
return _errno_to_libusb(errno);
if ((ioctl(fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
return _errno_to_libusb(errno);
if (IS_XFERIN(transfer)) {
if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
if ((ioctl(fd, USB_SET_SHORT_XFER, &nr)) < 0)
return _errno_to_libusb(errno);
nr = read(fd, transfer->buffer, transfer->length);
} else {
nr = write(fd, transfer->buffer, transfer->length);
}
if (nr < 0)
return _errno_to_libusb(errno);
itransfer->transferred = nr;
return (0);
}

View File

@@ -1,10 +0,0 @@
#ifndef LIBUSB_POLL_POSIX_H
#define LIBUSB_POLL_POSIX_H
#define usbi_write write
#define usbi_read read
#define usbi_close close
#define usbi_pipe pipe
#define usbi_poll poll
#endif /* LIBUSB_POLL_POSIX_H */

View File

@@ -1,745 +0,0 @@
/*
* poll_windows: poll compatibility wrapper for Windows
* Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* poll() and pipe() Windows compatibility layer for libusb 1.0
*
* The way this layer works is by using OVERLAPPED with async I/O transfers, as
* OVERLAPPED have an associated event which is flagged for I/O completion.
*
* For USB pollable async I/O, you would typically:
* - obtain a Windows HANDLE to a file or device that has been opened in
* OVERLAPPED mode
* - call usbi_create_fd with this handle to obtain a custom fd.
* Note that if you need simultaneous R/W access, you need to call create_fd
* twice, once in _O_RDONLY and once in _O_WRONLY mode to obtain 2 separate
* pollable fds
* - leave the core functions call the poll routine and flag POLLIN/POLLOUT
*
* The pipe pollable synchronous I/O works using the overlapped event associated
* with a fake pipe. The read/write functions are only meant to be used in that
* context.
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <libusbi.h>
// Uncomment to debug the polling layer
//#define DEBUG_POLL_WINDOWS
#if defined(DEBUG_POLL_WINDOWS)
#define poll_dbg usbi_dbg
#else
// MSVC++ < 2005 cannot use a variadic argument and non MSVC
// compilers produce warnings if parenthesis are omitted.
#if defined(_MSC_VER) && _MSC_VER < 1400
#define poll_dbg
#else
#define poll_dbg(...)
#endif
#endif
#if defined(_PREFAST_)
#pragma warning(disable:28719)
#endif
#if defined(__CYGWIN__)
// cygwin produces a warning unless these prototypes are defined
extern int _open(char* name, int flags);
extern int _close(int fd);
extern int _snprintf(char *buffer, size_t count, const char *format, ...);
#define NUL_DEVICE "/dev/null"
#else
#define NUL_DEVICE "NUL"
#endif
#define CHECK_INIT_POLLING do {if(!is_polling_set) init_polling();} while(0)
// public fd data
const struct winfd INVALID_WINFD = {-1, INVALID_HANDLE_VALUE, NULL, RW_NONE};
struct winfd poll_fd[MAX_FDS];
// internal fd data
struct {
CRITICAL_SECTION mutex; // lock for fds
// Additional variables for XP CancelIoEx partial emulation
HANDLE original_handle;
DWORD thread_id;
} _poll_fd[MAX_FDS];
// globals
BOOLEAN is_polling_set = FALSE;
LONG pipe_number = 0;
static volatile LONG compat_spinlock = 0;
// CancelIoEx, available on Vista and later only, provides the ability to cancel
// a single transfer (OVERLAPPED) when used. As it may not be part of any of the
// platform headers, we hook into the Kernel32 system DLL directly to seek it.
static BOOL (__stdcall *pCancelIoEx)(HANDLE, LPOVERLAPPED) = NULL;
#define CancelIoEx_Available (pCancelIoEx != NULL)
static __inline BOOL cancel_io(int _index)
{
if ((_index < 0) || (_index >= MAX_FDS)) {
return FALSE;
}
if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
|| (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
return TRUE;
}
if (CancelIoEx_Available) {
return (*pCancelIoEx)(poll_fd[_index].handle, poll_fd[_index].overlapped);
}
if (_poll_fd[_index].thread_id == GetCurrentThreadId()) {
return CancelIo(poll_fd[_index].handle);
}
usbi_warn(NULL, "Unable to cancel I/O that was started from another thread");
return FALSE;
}
// Init
void init_polling(void)
{
int i;
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
SleepEx(0, TRUE);
}
if (!is_polling_set) {
pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED))
GetProcAddress(GetModuleHandleA("KERNEL32"), "CancelIoEx");
usbi_dbg("Will use CancelIo%s for I/O cancellation",
CancelIoEx_Available?"Ex":"");
for (i=0; i<MAX_FDS; i++) {
poll_fd[i] = INVALID_WINFD;
_poll_fd[i].original_handle = INVALID_HANDLE_VALUE;
_poll_fd[i].thread_id = 0;
InitializeCriticalSection(&_poll_fd[i].mutex);
}
is_polling_set = TRUE;
}
compat_spinlock = 0;
}
// Internal function to retrieve the table index (and lock the fd mutex)
int _fd_to_index_and_lock(int fd)
{
int i;
if (fd <= 0)
return -1;
for (i=0; i<MAX_FDS; i++) {
if (poll_fd[i].fd == fd) {
EnterCriticalSection(&_poll_fd[i].mutex);
// fd might have changed before we got to critical
if (poll_fd[i].fd != fd) {
LeaveCriticalSection(&_poll_fd[i].mutex);
continue;
}
return i;
}
}
return -1;
}
OVERLAPPED *create_overlapped(void)
{
OVERLAPPED *overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
if (overlapped == NULL) {
return NULL;
}
overlapped->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if(overlapped->hEvent == NULL) {
free (overlapped);
return NULL;
}
return overlapped;
}
void free_overlapped(OVERLAPPED *overlapped)
{
if (overlapped == NULL)
return;
if ( (overlapped->hEvent != 0)
&& (overlapped->hEvent != INVALID_HANDLE_VALUE) ) {
CloseHandle(overlapped->hEvent);
}
free(overlapped);
}
void reset_overlapped(OVERLAPPED *overlapped)
{
HANDLE event_handle;
if (overlapped == NULL)
return;
event_handle = overlapped->hEvent;
if (event_handle != NULL) {
ResetEvent(event_handle);
}
memset(overlapped, 0, sizeof(OVERLAPPED));
overlapped->hEvent = event_handle;
}
void exit_polling(void)
{
int i;
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
SleepEx(0, TRUE);
}
if (is_polling_set) {
is_polling_set = FALSE;
for (i=0; i<MAX_FDS; i++) {
// Cancel any async I/O (handle can be invalid)
cancel_io(i);
// If anything was pending on that I/O, it should be
// terminating, and we should be able to access the fd
// mutex lock before too long
EnterCriticalSection(&_poll_fd[i].mutex);
if ( (poll_fd[i].fd > 0) && (poll_fd[i].handle != INVALID_HANDLE_VALUE) && (poll_fd[i].handle != 0)
&& (GetFileType(poll_fd[i].handle) == FILE_TYPE_UNKNOWN) ) {
_close(poll_fd[i].fd);
}
free_overlapped(poll_fd[i].overlapped);
if (!CancelIoEx_Available) {
// Close duplicate handle
if (_poll_fd[i].original_handle != INVALID_HANDLE_VALUE) {
CloseHandle(poll_fd[i].handle);
}
}
poll_fd[i] = INVALID_WINFD;
LeaveCriticalSection(&_poll_fd[i].mutex);
DeleteCriticalSection(&_poll_fd[i].mutex);
}
}
compat_spinlock = 0;
}
/*
* Create a fake pipe.
* As libusb only uses pipes for signaling, all we need from a pipe is an
* event. To that extent, we create a single wfd and overlapped as a means
* to access that event.
*/
int usbi_pipe(int filedes[2])
{
int i;
OVERLAPPED* overlapped;
CHECK_INIT_POLLING;
overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
if (overlapped == NULL) {
return -1;
}
// The overlapped must have status pending for signaling to work in poll
overlapped->Internal = STATUS_PENDING;
overlapped->InternalHigh = 0;
// Read end of the "pipe"
filedes[0] = _open(NUL_DEVICE, _O_WRONLY);
if (filedes[0] < 0) {
usbi_err(NULL, "could not create pipe: errno %d", errno);
goto out1;
}
// We can use the same handle for both ends
filedes[1] = filedes[0];
poll_dbg("pipe filedes = %d", filedes[0]);
// Note: manual reset must be true (second param) as the reset occurs in read
overlapped->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if(!overlapped->hEvent) {
goto out2;
}
for (i=0; i<MAX_FDS; i++) {
if (poll_fd[i].fd < 0) {
EnterCriticalSection(&_poll_fd[i].mutex);
// fd might have been allocated before we got to critical
if (poll_fd[i].fd >= 0) {
LeaveCriticalSection(&_poll_fd[i].mutex);
continue;
}
poll_fd[i].fd = filedes[0];
poll_fd[i].handle = DUMMY_HANDLE;
poll_fd[i].overlapped = overlapped;
// There's no polling on the write end, so we just use READ for our needs
poll_fd[i].rw = RW_READ;
_poll_fd[i].original_handle = INVALID_HANDLE_VALUE;
LeaveCriticalSection(&_poll_fd[i].mutex);
return 0;
}
}
CloseHandle(overlapped->hEvent);
out2:
_close(filedes[0]);
out1:
free(overlapped);
return -1;
}
/*
* Create both an fd and an OVERLAPPED from an open Windows handle, so that
* it can be used with our polling function
* The handle MUST support overlapped transfers (usually requires CreateFile
* with FILE_FLAG_OVERLAPPED)
* Return a pollable file descriptor struct, or INVALID_WINFD on error
*
* Note that the fd returned by this function is a per-transfer fd, rather
* than a per-session fd and cannot be used for anything else but our
* custom functions (the fd itself points to the NUL: device)
* if you plan to do R/W on the same handle, you MUST create 2 fds: one for
* read and one for write. Using a single R/W fd is unsupported and will
* produce unexpected results
*/
struct winfd usbi_create_fd(HANDLE handle, int access_mode)
{
int i, fd;
struct winfd wfd = INVALID_WINFD;
OVERLAPPED* overlapped = NULL;
CHECK_INIT_POLLING;
if ((handle == 0) || (handle == INVALID_HANDLE_VALUE)) {
return INVALID_WINFD;
}
if ((access_mode != _O_RDONLY) && (access_mode != _O_WRONLY)) {
usbi_warn(NULL, "only one of _O_RDONLY or _O_WRONLY are supported.\n"
"If you want to poll for R/W simultaneously, create multiple fds from the same handle.");
return INVALID_WINFD;
}
if (access_mode == _O_RDONLY) {
wfd.rw = RW_READ;
} else {
wfd.rw = RW_WRITE;
}
// Ensure that we get a non system conflicting unique fd, using
// the same fd attribution system as the pipe ends
fd = _open(NUL_DEVICE, _O_WRONLY);
if (fd < 0) {
return INVALID_WINFD;
}
overlapped = create_overlapped();
if(overlapped == NULL) {
_close(fd);
return INVALID_WINFD;
}
for (i=0; i<MAX_FDS; i++) {
if (poll_fd[i].fd < 0) {
EnterCriticalSection(&_poll_fd[i].mutex);
// fd might have been removed before we got to critical
if (poll_fd[i].fd >= 0) {
LeaveCriticalSection(&_poll_fd[i].mutex);
continue;
}
wfd.fd = fd;
// Attempt to emulate some of the CancelIoEx behaviour on platforms
// that don't have it
if (!CancelIoEx_Available) {
_poll_fd[i].thread_id = GetCurrentThreadId();
if (!DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(),
&wfd.handle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
usbi_dbg("could not duplicate handle for CancelIo - using original one");
wfd.handle = handle;
// Make sure we won't close the original handle on fd deletion then
_poll_fd[i].original_handle = INVALID_HANDLE_VALUE;
} else {
_poll_fd[i].original_handle = handle;
}
} else {
wfd.handle = handle;
}
wfd.overlapped = overlapped;
memcpy(&poll_fd[i], &wfd, sizeof(struct winfd));
LeaveCriticalSection(&_poll_fd[i].mutex);
return wfd;
}
}
free_overlapped(overlapped);
_close(fd);
return INVALID_WINFD;
}
void _free_index(int _index)
{
// Cancel any async IO (Don't care about the validity of our handles for this)
cancel_io(_index);
// close fake handle for devices
if ( (poll_fd[_index].handle != INVALID_HANDLE_VALUE) && (poll_fd[_index].handle != 0)
&& (GetFileType(poll_fd[_index].handle) == FILE_TYPE_UNKNOWN) ) {
_close(poll_fd[_index].fd);
}
// close the duplicate handle (if we have an actual duplicate)
if (!CancelIoEx_Available) {
if (_poll_fd[_index].original_handle != INVALID_HANDLE_VALUE) {
CloseHandle(poll_fd[_index].handle);
}
_poll_fd[_index].original_handle = INVALID_HANDLE_VALUE;
_poll_fd[_index].thread_id = 0;
}
free_overlapped(poll_fd[_index].overlapped);
poll_fd[_index] = INVALID_WINFD;
}
/*
* Release a pollable file descriptor.
*
* Note that the associated Windows handle is not closed by this call
*/
void usbi_free_fd(int fd)
{
int _index;
CHECK_INIT_POLLING;
_index = _fd_to_index_and_lock(fd);
if (_index < 0) {
return;
}
_free_index(_index);
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
/*
* The functions below perform various conversions between fd, handle and OVERLAPPED
*/
struct winfd fd_to_winfd(int fd)
{
int i;
struct winfd wfd;
CHECK_INIT_POLLING;
if (fd <= 0)
return INVALID_WINFD;
for (i=0; i<MAX_FDS; i++) {
if (poll_fd[i].fd == fd) {
EnterCriticalSection(&_poll_fd[i].mutex);
// fd might have been deleted before we got to critical
if (poll_fd[i].fd != fd) {
LeaveCriticalSection(&_poll_fd[i].mutex);
continue;
}
memcpy(&wfd, &poll_fd[i], sizeof(struct winfd));
LeaveCriticalSection(&_poll_fd[i].mutex);
return wfd;
}
}
return INVALID_WINFD;
}
struct winfd handle_to_winfd(HANDLE handle)
{
int i;
struct winfd wfd;
CHECK_INIT_POLLING;
if ((handle == 0) || (handle == INVALID_HANDLE_VALUE))
return INVALID_WINFD;
for (i=0; i<MAX_FDS; i++) {
if (poll_fd[i].handle == handle) {
EnterCriticalSection(&_poll_fd[i].mutex);
// fd might have been deleted before we got to critical
if (poll_fd[i].handle != handle) {
LeaveCriticalSection(&_poll_fd[i].mutex);
continue;
}
memcpy(&wfd, &poll_fd[i], sizeof(struct winfd));
LeaveCriticalSection(&_poll_fd[i].mutex);
return wfd;
}
}
return INVALID_WINFD;
}
struct winfd overlapped_to_winfd(OVERLAPPED* overlapped)
{
int i;
struct winfd wfd;
CHECK_INIT_POLLING;
if (overlapped == NULL)
return INVALID_WINFD;
for (i=0; i<MAX_FDS; i++) {
if (poll_fd[i].overlapped == overlapped) {
EnterCriticalSection(&_poll_fd[i].mutex);
// fd might have been deleted before we got to critical
if (poll_fd[i].overlapped != overlapped) {
LeaveCriticalSection(&_poll_fd[i].mutex);
continue;
}
memcpy(&wfd, &poll_fd[i], sizeof(struct winfd));
LeaveCriticalSection(&_poll_fd[i].mutex);
return wfd;
}
}
return INVALID_WINFD;
}
/*
* POSIX poll equivalent, using Windows OVERLAPPED
* Currently, this function only accepts one of POLLIN or POLLOUT per fd
* (but you can create multiple fds from the same handle for read and write)
*/
int usbi_poll(struct pollfd *fds, unsigned int nfds, int timeout)
{
unsigned i;
int _index, object_index, triggered;
HANDLE *handles_to_wait_on;
int *handle_to_index;
DWORD nb_handles_to_wait_on = 0;
DWORD ret;
CHECK_INIT_POLLING;
triggered = 0;
handles_to_wait_on = (HANDLE*) calloc(nfds+1, sizeof(HANDLE)); // +1 for fd_update
handle_to_index = (int*) calloc(nfds, sizeof(int));
if ((handles_to_wait_on == NULL) || (handle_to_index == NULL)) {
errno = ENOMEM;
triggered = -1;
goto poll_exit;
}
for (i = 0; i < nfds; ++i) {
fds[i].revents = 0;
// Only one of POLLIN or POLLOUT can be selected with this version of poll (not both)
if ((fds[i].events & ~POLLIN) && (!(fds[i].events & POLLOUT))) {
fds[i].revents |= POLLERR;
errno = EACCES;
usbi_warn(NULL, "unsupported set of events");
triggered = -1;
goto poll_exit;
}
_index = _fd_to_index_and_lock(fds[i].fd);
poll_dbg("fd[%d]=%d: (overlapped=%p) got events %04X", i, poll_fd[_index].fd, poll_fd[_index].overlapped, fds[i].events);
if ( (_index < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
|| (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL)) {
fds[i].revents |= POLLNVAL | POLLERR;
errno = EBADF;
if (_index >= 0) {
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
usbi_warn(NULL, "invalid fd");
triggered = -1;
goto poll_exit;
}
// IN or OUT must match our fd direction
if ((fds[i].events & POLLIN) && (poll_fd[_index].rw != RW_READ)) {
fds[i].revents |= POLLNVAL | POLLERR;
errno = EBADF;
usbi_warn(NULL, "attempted POLLIN on fd without READ access");
LeaveCriticalSection(&_poll_fd[_index].mutex);
triggered = -1;
goto poll_exit;
}
if ((fds[i].events & POLLOUT) && (poll_fd[_index].rw != RW_WRITE)) {
fds[i].revents |= POLLNVAL | POLLERR;
errno = EBADF;
usbi_warn(NULL, "attempted POLLOUT on fd without WRITE access");
LeaveCriticalSection(&_poll_fd[_index].mutex);
triggered = -1;
goto poll_exit;
}
// The following macro only works if overlapped I/O was reported pending
if ( (HasOverlappedIoCompleted(poll_fd[_index].overlapped))
|| (HasOverlappedIoCompletedSync(poll_fd[_index].overlapped)) ) {
poll_dbg(" completed");
// checks above should ensure this works:
fds[i].revents = fds[i].events;
triggered++;
} else {
handles_to_wait_on[nb_handles_to_wait_on] = poll_fd[_index].overlapped->hEvent;
handle_to_index[nb_handles_to_wait_on] = i;
nb_handles_to_wait_on++;
}
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
// If nothing was triggered, wait on all fds that require it
if ((timeout != 0) && (triggered == 0) && (nb_handles_to_wait_on != 0)) {
if (timeout < 0) {
poll_dbg("starting infinite wait for %d handles...", (int)nb_handles_to_wait_on);
} else {
poll_dbg("starting %d ms wait for %d handles...", timeout, (int)nb_handles_to_wait_on);
}
ret = WaitForMultipleObjects(nb_handles_to_wait_on, handles_to_wait_on,
FALSE, (timeout<0)?INFINITE:(DWORD)timeout);
object_index = ret-WAIT_OBJECT_0;
if ((object_index >= 0) && ((DWORD)object_index < nb_handles_to_wait_on)) {
poll_dbg(" completed after wait");
i = handle_to_index[object_index];
_index = _fd_to_index_and_lock(fds[i].fd);
fds[i].revents = fds[i].events;
triggered++;
if (_index >= 0) {
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
} else if (ret == WAIT_TIMEOUT) {
poll_dbg(" timed out");
triggered = 0; // 0 = timeout
} else {
errno = EIO;
triggered = -1; // error
}
}
poll_exit:
if (handles_to_wait_on != NULL) {
free(handles_to_wait_on);
}
if (handle_to_index != NULL) {
free(handle_to_index);
}
return triggered;
}
/*
* close a fake pipe fd
*/
int usbi_close(int fd)
{
int _index;
int r = -1;
CHECK_INIT_POLLING;
_index = _fd_to_index_and_lock(fd);
if (_index < 0) {
errno = EBADF;
} else {
if (poll_fd[_index].overlapped != NULL) {
// Must be a different event for each end of the pipe
CloseHandle(poll_fd[_index].overlapped->hEvent);
free(poll_fd[_index].overlapped);
}
r = _close(poll_fd[_index].fd);
if (r != 0) {
errno = EIO;
}
poll_fd[_index] = INVALID_WINFD;
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
return r;
}
/*
* synchronous write for fake "pipe" signaling
*/
ssize_t usbi_write(int fd, const void *buf, size_t count)
{
int _index;
CHECK_INIT_POLLING;
if (count != sizeof(unsigned char)) {
usbi_err(NULL, "this function should only used for signaling");
return -1;
}
_index = _fd_to_index_and_lock(fd);
if ( (_index < 0) || (poll_fd[_index].overlapped == NULL) ) {
errno = EBADF;
if (_index >= 0) {
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
return -1;
}
poll_dbg("set pipe event (fd = %d, thread = %08X)", _index, GetCurrentThreadId());
SetEvent(poll_fd[_index].overlapped->hEvent);
poll_fd[_index].overlapped->Internal = STATUS_WAIT_0;
// If two threads write on the pipe at the same time, we need to
// process two separate reads => use the overlapped as a counter
poll_fd[_index].overlapped->InternalHigh++;
LeaveCriticalSection(&_poll_fd[_index].mutex);
return sizeof(unsigned char);
}
/*
* synchronous read for fake "pipe" signaling
*/
ssize_t usbi_read(int fd, void *buf, size_t count)
{
int _index;
ssize_t r = -1;
CHECK_INIT_POLLING;
if (count != sizeof(unsigned char)) {
usbi_err(NULL, "this function should only used for signaling");
return -1;
}
_index = _fd_to_index_and_lock(fd);
if (_index < 0) {
errno = EBADF;
return -1;
}
if (WaitForSingleObject(poll_fd[_index].overlapped->hEvent, INFINITE) != WAIT_OBJECT_0) {
usbi_warn(NULL, "waiting for event failed: %d", (int)GetLastError());
errno = EIO;
goto out;
}
poll_dbg("clr pipe event (fd = %d, thread = %08X)", _index, GetCurrentThreadId());
poll_fd[_index].overlapped->InternalHigh--;
// Don't reset unless we don't have any more events to process
if (poll_fd[_index].overlapped->InternalHigh <= 0) {
ResetEvent(poll_fd[_index].overlapped->hEvent);
poll_fd[_index].overlapped->Internal = STATUS_PENDING;
}
r = sizeof(unsigned char);
out:
LeaveCriticalSection(&_poll_fd[_index].mutex);
return r;
}

View File

@@ -1,115 +0,0 @@
/*
* Windows compat: POSIX compatibility wrapper
* Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#pragma once
#if defined(_MSC_VER)
// disable /W4 MSVC warnings that are benign
#pragma warning(disable:4127) // conditional expression is constant
#endif
// Handle synchronous completion through the overlapped structure
#if !defined(STATUS_REPARSE) // reuse the REPARSE status code
#define STATUS_REPARSE ((LONG)0x00000104L)
#endif
#define STATUS_COMPLETED_SYNCHRONOUSLY STATUS_REPARSE
#define HasOverlappedIoCompletedSync(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) == STATUS_COMPLETED_SYNCHRONOUSLY)
#define DUMMY_HANDLE ((HANDLE)(LONG_PTR)-2)
enum windows_version {
WINDOWS_UNSUPPORTED,
WINDOWS_XP,
WINDOWS_2003, // also includes XP 64
WINDOWS_VISTA_AND_LATER,
};
extern enum windows_version windows_version;
#define MAX_FDS 256
#define POLLIN 0x0001 /* There is data to read */
#define POLLPRI 0x0002 /* There is urgent data to read */
#define POLLOUT 0x0004 /* Writing now will not block */
#define POLLERR 0x0008 /* Error condition */
#define POLLHUP 0x0010 /* Hung up */
#define POLLNVAL 0x0020 /* Invalid request: fd not open */
struct pollfd {
int fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
};
// access modes
enum rw_type {
RW_NONE,
RW_READ,
RW_WRITE,
};
// fd struct that can be used for polling on Windows
struct winfd {
int fd; // what's exposed to libusb core
HANDLE handle; // what we need to attach overlapped to the I/O op, so we can poll it
OVERLAPPED* overlapped; // what will report our I/O status
enum rw_type rw; // I/O transfer direction: read *XOR* write (NOT BOTH)
};
extern const struct winfd INVALID_WINFD;
int usbi_pipe(int pipefd[2]);
int usbi_poll(struct pollfd *fds, unsigned int nfds, int timeout);
ssize_t usbi_write(int fd, const void *buf, size_t count);
ssize_t usbi_read(int fd, void *buf, size_t count);
int usbi_close(int fd);
void init_polling(void);
void exit_polling(void);
struct winfd usbi_create_fd(HANDLE handle, int access_mode);
void usbi_free_fd(int fd);
struct winfd fd_to_winfd(int fd);
struct winfd handle_to_winfd(HANDLE handle);
struct winfd overlapped_to_winfd(OVERLAPPED* overlapped);
/*
* Timeval operations
*/
#if defined(DDKBUILD)
#include <winsock.h> // defines timeval functions on DDK
#endif
#if !defined(TIMESPEC_TO_TIMEVAL)
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (long)(ts)->tv_sec; \
(tv)->tv_usec = (long)(ts)->tv_nsec / 1000; \
}
#endif
#if !defined(timersub)
#define timersub(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)
#endif

View File

@@ -1,55 +0,0 @@
/*
* libusb synchronization using POSIX Threads
*
* Copyright (C) 2011 Vitali Lovich <vlovich@aliph.com>
* Copyright (C) 2011 Peter Stuge <peter@stuge.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef _XOPEN_SOURCE
# if _XOPEN_SOURCE < 500
# undef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
# endif
#else
#define _XOPEN_SOURCE 500
#endif /* _XOPEN_SOURCE */
#include "threads_posix.h"
int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
{
int err;
pthread_mutexattr_t stack_attr;
if (!attr) {
attr = &stack_attr;
err = pthread_mutexattr_init(&stack_attr);
if (err != 0)
return err;
}
err = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
if (err != 0)
goto finish;
err = pthread_mutex_init(mutex, attr);
finish:
if (attr == &stack_attr)
pthread_mutexattr_destroy(&stack_attr);
return err;
}

View File

@@ -1,48 +0,0 @@
/*
* libusb synchronization using POSIX Threads
*
* Copyright (C) 2010 Peter Stuge <peter@stuge.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LIBUSB_THREADS_POSIX_H
#define LIBUSB_THREADS_POSIX_H
#include <pthread.h>
#define usbi_mutex_static_t pthread_mutex_t
#define USBI_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#define usbi_mutex_static_lock pthread_mutex_lock
#define usbi_mutex_static_unlock pthread_mutex_unlock
#define usbi_mutex_t pthread_mutex_t
#define usbi_mutex_init pthread_mutex_init
#define usbi_mutex_lock pthread_mutex_lock
#define usbi_mutex_unlock pthread_mutex_unlock
#define usbi_mutex_trylock pthread_mutex_trylock
#define usbi_mutex_destroy pthread_mutex_destroy
#define usbi_cond_t pthread_cond_t
#define usbi_cond_init pthread_cond_init
#define usbi_cond_wait pthread_cond_wait
#define usbi_cond_timedwait pthread_cond_timedwait
#define usbi_cond_broadcast pthread_cond_broadcast
#define usbi_cond_destroy pthread_cond_destroy
#define usbi_cond_signal pthread_cond_signal
extern int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
#endif /* LIBUSB_THREADS_POSIX_H */

View File

@@ -1,207 +0,0 @@
/*
* libusb synchronization on Microsoft Windows
*
* Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
#include <objbase.h>
#include <errno.h>
#include <stdarg.h>
#include "libusbi.h"
int usbi_mutex_init(usbi_mutex_t *mutex,
const usbi_mutexattr_t *attr) {
if(! mutex) return ((errno=EINVAL));
*mutex = CreateMutex(NULL, FALSE, NULL);
if(!*mutex) return ((errno=ENOMEM));
return 0;
}
int usbi_mutex_destroy(usbi_mutex_t *mutex) {
// It is not clear if CloseHandle failure is due to failure to unlock.
// If so, this should be errno=EBUSY.
if(!mutex || !CloseHandle(*mutex)) return ((errno=EINVAL));
*mutex = NULL;
return 0;
}
int usbi_mutex_trylock(usbi_mutex_t *mutex) {
DWORD result;
if(!mutex) return ((errno=EINVAL));
result = WaitForSingleObject(*mutex, 0);
if(result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
return 0; // acquired (ToDo: check that abandoned is ok)
if(result == WAIT_TIMEOUT)
return ((errno=EBUSY));
return ((errno=EINVAL)); // don't know how this would happen
// so don't know proper errno
}
int usbi_mutex_lock(usbi_mutex_t *mutex) {
DWORD result;
if(!mutex) return ((errno=EINVAL));
result = WaitForSingleObject(*mutex, INFINITE);
if(result == WAIT_OBJECT_0 || result == WAIT_ABANDONED)
return 0; // acquired (ToDo: check that abandoned is ok)
return ((errno=EINVAL)); // don't know how this would happen
// so don't know proper errno
}
int usbi_mutex_unlock(usbi_mutex_t *mutex) {
if(!mutex) return ((errno=EINVAL));
if(!ReleaseMutex(*mutex)) return ((errno=EPERM ));
return 0;
}
int usbi_mutex_static_lock(usbi_mutex_static_t *mutex) {
if(!mutex) return ((errno=EINVAL));
while (InterlockedExchange((LONG *)mutex, 1) == 1) {
SleepEx(0, TRUE);
}
return 0;
}
int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex) {
if(!mutex) return ((errno=EINVAL));
*mutex = 0;
return 0;
}
int usbi_cond_init(usbi_cond_t *cond,
const usbi_condattr_t *attr) {
if(!cond) return ((errno=EINVAL));
list_init(&cond->waiters );
list_init(&cond->not_waiting);
return 0;
}
int usbi_cond_destroy(usbi_cond_t *cond) {
// This assumes no one is using this anymore. The check MAY NOT BE safe.
struct usbi_cond_perthread *pos, *prev_pos = NULL;
if(!cond) return ((errno=EINVAL));
if(!list_empty(&cond->waiters)) return ((errno=EBUSY )); // (!see above!)
list_for_each_entry(pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
free(prev_pos);
list_del(&pos->list);
prev_pos = pos;
}
free(prev_pos);
return 0;
}
int usbi_cond_broadcast(usbi_cond_t *cond) {
// Assumes mutex is locked; this is not in keeping with POSIX spec, but
// libusb does this anyway, so we simplify by not adding more sync
// primitives to the CV definition!
int fail = 0;
struct usbi_cond_perthread *pos;
if(!cond) return ((errno=EINVAL));
list_for_each_entry(pos, &cond->waiters, list, struct usbi_cond_perthread) {
if(!SetEvent(pos->event))
fail = 1;
}
// The wait function will remove its respective item from the list.
return fail ? ((errno=EINVAL)) : 0;
}
int usbi_cond_signal(usbi_cond_t *cond) {
// Assumes mutex is locked; this is not in keeping with POSIX spec, but
// libusb does this anyway, so we simplify by not adding more sync
// primitives to the CV definition!
struct usbi_cond_perthread *pos;
if(!cond) return ((errno=EINVAL));
if(list_empty(&cond->waiters)) return 0; // no one to wakeup.
pos = list_entry(&cond->waiters.next, struct usbi_cond_perthread, list);
// The wait function will remove its respective item from the list.
return SetEvent(pos->event) ? 0 : ((errno=EINVAL));
}
static int __inline usbi_cond_intwait(usbi_cond_t *cond,
usbi_mutex_t *mutex,
DWORD timeout_ms) {
struct usbi_cond_perthread *pos;
int found = 0, r;
DWORD r2,tid = GetCurrentThreadId();
if(!cond || !mutex) return ((errno=EINVAL));
list_for_each_entry(pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
if(tid == pos->tid) {
found = 1;
break;
}
}
if(!found) {
pos = (struct usbi_cond_perthread*) calloc(1, sizeof(struct usbi_cond_perthread));
if(!pos) return ((errno=ENOMEM)); // This errno is not POSIX-allowed.
pos->tid = tid;
pos->event = CreateEvent(NULL, FALSE, FALSE, NULL); // auto-reset.
if(!pos->event) {
free(pos);
return ((errno=ENOMEM));
}
list_add(&pos->list, &cond->not_waiting);
}
list_del(&pos->list); // remove from not_waiting list.
list_add(&pos->list, &cond->waiters);
r = usbi_mutex_unlock(mutex);
if(r) return r;
r2 = WaitForSingleObject(pos->event, timeout_ms);
r = usbi_mutex_lock(mutex);
if(r) return r;
list_del(&pos->list);
list_add(&pos->list, &cond->not_waiting);
if(r2 == WAIT_TIMEOUT) return ((errno=ETIMEDOUT));
return 0;
}
// N.B.: usbi_cond_*wait() can also return ENOMEM, even though pthread_cond_*wait cannot!
int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex) {
return usbi_cond_intwait(cond, mutex, INFINITE);
}
int usbi_cond_timedwait(usbi_cond_t *cond,
usbi_mutex_t *mutex,
const struct timespec *abstime) {
FILETIME filetime;
ULARGE_INTEGER rtime;
struct timeval targ_time, cur_time, delta_time;
struct timespec cur_time_ns;
DWORD millis;
extern const uint64_t epoch_time;
GetSystemTimeAsFileTime(&filetime);
rtime.LowPart = filetime.dwLowDateTime;
rtime.HighPart = filetime.dwHighDateTime;
rtime.QuadPart -= epoch_time;
cur_time_ns.tv_sec = (long)(rtime.QuadPart / 10000000);
cur_time_ns.tv_nsec = (long)((rtime.QuadPart % 10000000)*100);
TIMESPEC_TO_TIMEVAL(&cur_time, &cur_time_ns);
TIMESPEC_TO_TIMEVAL(&targ_time, abstime);
timersub(&targ_time, &cur_time, &delta_time);
if(delta_time.tv_sec < 0) // abstime already passed?
millis = 0;
else {
millis = delta_time.tv_usec/1000;
millis += delta_time.tv_sec *1000;
if (delta_time.tv_usec % 1000) // round up to next millisecond
millis++;
}
return usbi_cond_intwait(cond, mutex, millis);
}

View File

@@ -1,86 +0,0 @@
/*
* libusb synchronization on Microsoft Windows
*
* Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LIBUSB_THREADS_WINDOWS_H
#define LIBUSB_THREADS_WINDOWS_H
#define usbi_mutex_static_t volatile LONG
#define USBI_MUTEX_INITIALIZER 0
#define usbi_mutex_t HANDLE
struct usbi_cond_perthread {
struct list_head list;
DWORD tid;
HANDLE event;
};
struct usbi_cond_t_ {
// Every time a thread touches the CV, it winds up in one of these lists.
// It stays there until the CV is destroyed, even if the thread
// terminates.
struct list_head waiters;
struct list_head not_waiting;
};
typedef struct usbi_cond_t_ usbi_cond_t;
// We *were* getting timespec from pthread.h:
#if (!defined(HAVE_STRUCT_TIMESPEC) && !defined(_TIMESPEC_DEFINED))
#define HAVE_STRUCT_TIMESPEC 1
#define _TIMESPEC_DEFINED 1
struct timespec {
long tv_sec;
long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC | _TIMESPEC_DEFINED */
// We *were* getting ETIMEDOUT from pthread.h:
#ifndef ETIMEDOUT
# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
#endif
#define usbi_mutexattr_t void
#define usbi_condattr_t void
// all Windows mutexes are recursive
#define usbi_mutex_init_recursive(mutex, attr) usbi_mutex_init((mutex), (attr))
int usbi_mutex_static_lock(usbi_mutex_static_t *mutex);
int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex);
int usbi_mutex_init(usbi_mutex_t *mutex,
const usbi_mutexattr_t *attr);
int usbi_mutex_lock(usbi_mutex_t *mutex);
int usbi_mutex_unlock(usbi_mutex_t *mutex);
int usbi_mutex_trylock(usbi_mutex_t *mutex);
int usbi_mutex_destroy(usbi_mutex_t *mutex);
int usbi_cond_init(usbi_cond_t *cond,
const usbi_condattr_t *attr);
int usbi_cond_destroy(usbi_cond_t *cond);
int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex);
int usbi_cond_timedwait(usbi_cond_t *cond,
usbi_mutex_t *mutex,
const struct timespec *abstime);
int usbi_cond_broadcast(usbi_cond_t *cond);
int usbi_cond_signal(usbi_cond_t *cond);
#endif /* LIBUSB_THREADS_WINDOWS_H */

View File

@@ -1,608 +0,0 @@
/*
* Windows backend for libusb 1.0
* Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
* Major code testing contribution by Xiaofan Chen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#if defined(_MSC_VER)
// disable /W4 MSVC warnings that are benign
#pragma warning(disable:4127) // conditional expression is constant
#pragma warning(disable:4100) // unreferenced formal parameter
#pragma warning(disable:4214) // bit field types other than int
#pragma warning(disable:4201) // nameless struct/union
#endif
// Windows API default is uppercase - ugh!
#if !defined(bool)
#define bool BOOL
#endif
#if !defined(true)
#define true TRUE
#endif
#if !defined(false)
#define false FALSE
#endif
// Missing from MSVC6 setupapi.h
#if !defined(SPDRP_ADDRESS)
#define SPDRP_ADDRESS 28
#endif
#if !defined(SPDRP_INSTALL_STATE)
#define SPDRP_INSTALL_STATE 34
#endif
#if defined(__CYGWIN__ )
// cygwin produces a warning unless these prototypes are defined
extern int _snprintf(char *buffer, size_t count, const char *format, ...);
extern char *_strdup(const char *strSource);
// _beginthreadex is MSVCRT => unavailable for cygwin. Fallback to using CreateThread
#define _beginthreadex(a, b, c, d, e, f) CreateThread(a, b, (LPTHREAD_START_ROUTINE)c, d, e, f)
#endif
#define safe_free(p) do {if (p != NULL) {free((void*)p); p = NULL;}} while(0)
#define safe_closehandle(h) do {if (h != INVALID_HANDLE_VALUE) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0)
#define safe_min(a, b) min((size_t)(a), (size_t)(b))
#define safe_strcp(dst, dst_max, src, count) do {memcpy(dst, src, safe_min(count, dst_max)); \
((char*)dst)[safe_min(count, dst_max)-1] = 0;} while(0)
#define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1)
#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1))
#define safe_strcat(dst, dst_max, src) safe_strncat(dst, dst_max, src, safe_strlen(src)+1)
#define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
#define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count)
#define safe_strlen(str) ((str==NULL)?0:strlen(str))
#define safe_sprintf _snprintf
#define safe_unref_device(dev) do {if (dev != NULL) {libusb_unref_device(dev); dev = NULL;}} while(0)
#define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL)
static inline void upperize(char* str) {
size_t i;
if (str == NULL) return;
for (i=0; i<safe_strlen(str); i++)
str[i] = (char)toupper((int)str[i]);
}
#define MAX_CTRL_BUFFER_LENGTH 4096
#define MAX_USB_DEVICES 256
#define MAX_USB_STRING_LENGTH 128
#define MAX_GUID_STRING_LENGTH 40
#define MAX_PATH_LENGTH 128
#define MAX_KEY_LENGTH 256
#define MAX_TIMER_SEMAPHORES 128
#define TIMER_REQUEST_RETRY_MS 100
#define ERR_BUFFER_SIZE 256
#define LIST_SEPARATOR ';'
#define HTAB_SIZE 1021
// http://msdn.microsoft.com/en-us/library/ff545978.aspx
// http://msdn.microsoft.com/en-us/library/ff545972.aspx
// http://msdn.microsoft.com/en-us/library/ff545982.aspx
#if !defined(GUID_DEVINTERFACE_USB_HOST_CONTROLLER)
const GUID GUID_DEVINTERFACE_USB_HOST_CONTROLLER = { 0x3ABF6F2D, 0x71C4, 0x462A, {0x8A, 0x92, 0x1E, 0x68, 0x61, 0xE6, 0xAF, 0x27} };
#endif
#if !defined(GUID_DEVINTERFACE_USB_DEVICE)
const GUID GUID_DEVINTERFACE_USB_DEVICE = { 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED} };
#endif
#if !defined(GUID_DEVINTERFACE_USB_HUB)
const GUID GUID_DEVINTERFACE_USB_HUB = { 0xF18A0E88, 0xC30C, 0x11D0, {0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8} };
#endif
const GUID GUID_NULL = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
/*
* Multiple USB API backend support
*/
#define USB_API_UNSUPPORTED 0
#define USB_API_HUB 1
#define USB_API_COMPOSITE 2
#define USB_API_WINUSB 3
#define USB_API_MAX 4
#define CLASS_GUID_UNSUPPORTED GUID_NULL
const GUID CLASS_GUID_LIBUSB_WINUSB = { 0x78A1C341, 0x4539, 0x11D3, {0xB8, 0x8D, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71} };
const GUID CLASS_GUID_COMPOSITE = { 0x36FC9E60, 0xC465, 0x11cF, {0x80, 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} };
struct windows_usb_api_backend {
const uint8_t id;
const char* designation;
const GUID *class_guid; // The Class GUID (for fallback in case the driver name cannot be read)
const char **driver_name_list; // Driver name, without .sys, e.g. "usbccgp"
const uint8_t nb_driver_names;
int (*init)(struct libusb_context *ctx);
int (*exit)(void);
int (*open)(struct libusb_device_handle *dev_handle);
void (*close)(struct libusb_device_handle *dev_handle);
int (*claim_interface)(struct libusb_device_handle *dev_handle, int iface);
int (*set_interface_altsetting)(struct libusb_device_handle *dev_handle, int iface, int altsetting);
int (*release_interface)(struct libusb_device_handle *dev_handle, int iface);
int (*clear_halt)(struct libusb_device_handle *dev_handle, unsigned char endpoint);
int (*reset_device)(struct libusb_device_handle *dev_handle);
int (*submit_bulk_transfer)(struct usbi_transfer *itransfer);
int (*submit_iso_transfer)(struct usbi_transfer *itransfer);
int (*submit_control_transfer)(struct usbi_transfer *itransfer);
int (*abort_control)(struct usbi_transfer *itransfer);
int (*abort_transfers)(struct usbi_transfer *itransfer);
int (*copy_transfer_data)(struct usbi_transfer *itransfer, uint32_t io_size);
};
extern const struct windows_usb_api_backend usb_api_backend[USB_API_MAX];
#define PRINT_UNSUPPORTED_API(fname) \
usbi_dbg("unsupported API call for '" \
#fname "' (unrecognized device driver)"); \
return LIBUSB_ERROR_NOT_SUPPORTED;
/*
* private structures definition
* with inline pseudo constructors/destructors
*/
typedef struct libusb_device_descriptor USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
struct windows_device_priv {
uint8_t depth; // distance to HCD
uint8_t port; // port number on the hub
struct libusb_device *parent_dev; // access to parent is required for usermode ops
char *path; // device interface path
struct windows_usb_api_backend const *apib;
struct {
char *path; // each interface needs a device interface path,
struct windows_usb_api_backend const *apib; // an API backend (multiple drivers support),
int8_t nb_endpoints; // and a set of endpoint addresses (USB_MAXENDPOINTS)
uint8_t *endpoint;
} usb_interface[USB_MAXINTERFACES];
uint8_t composite_api_flags; // composite devices require additional data
uint8_t active_config;
USB_DEVICE_DESCRIPTOR dev_descriptor;
unsigned char **config_descriptor; // list of pointers to the cached config descriptors
};
static inline struct windows_device_priv *_device_priv(struct libusb_device *dev) {
return (struct windows_device_priv *)dev->os_priv;
}
static inline void windows_device_priv_init(libusb_device* dev) {
struct windows_device_priv* p = _device_priv(dev);
int i;
p->depth = 0;
p->port = 0;
p->parent_dev = NULL;
p->path = NULL;
p->apib = &usb_api_backend[USB_API_UNSUPPORTED];
p->composite_api_flags = 0;
p->active_config = 0;
p->config_descriptor = NULL;
memset(&(p->dev_descriptor), 0, sizeof(USB_DEVICE_DESCRIPTOR));
for (i=0; i<USB_MAXINTERFACES; i++) {
p->usb_interface[i].path = NULL;
p->usb_interface[i].apib = &usb_api_backend[USB_API_UNSUPPORTED];
p->usb_interface[i].nb_endpoints = 0;
p->usb_interface[i].endpoint = NULL;
}
}
static inline void windows_device_priv_release(libusb_device* dev) {
struct windows_device_priv* p = _device_priv(dev);
int i;
safe_free(p->path);
if ((dev->num_configurations > 0) && (p->config_descriptor != NULL)) {
for (i=0; i < dev->num_configurations; i++)
safe_free(p->config_descriptor[i]);
}
safe_free(p->config_descriptor);
for (i=0; i<USB_MAXINTERFACES; i++) {
safe_free(p->usb_interface[i].path);
safe_free(p->usb_interface[i].endpoint);
}
}
struct interface_handle_t {
HANDLE dev_handle; // WinUSB needs an extra handle for the file
HANDLE api_handle; // used by the API to communicate with the device
};
struct windows_device_handle_priv {
int active_interface;
struct interface_handle_t interface_handle[USB_MAXINTERFACES];
int autoclaim_count[USB_MAXINTERFACES]; // For auto-release
};
static inline struct windows_device_handle_priv *_device_handle_priv(
struct libusb_device_handle *handle)
{
return (struct windows_device_handle_priv *) handle->os_priv;
}
// used for async polling functions
struct windows_transfer_priv {
struct winfd pollable_fd;
uint8_t interface_number;
};
// used to match a device driver (including filter drivers) against a supported API
struct driver_lookup {
char list[MAX_KEY_LENGTH+1];// REG_MULTI_SZ list of services (driver) names
const DWORD reg_prop; // SPDRP registry key to use to retreive list
const char* designation; // internal designation (for debug output)
};
/*
* API macros - from libusb-win32 1.x
*/
#define DLL_DECLARE_PREFIXNAME(api, ret, prefixname, name, args) \
typedef ret (api * __dll_##name##_t)args; \
static __dll_##name##_t prefixname = NULL
#define DLL_LOAD_PREFIXNAME(dll, prefixname, name, ret_on_failure) \
do { \
HMODULE h = GetModuleHandleA(#dll); \
if (!h) \
h = LoadLibraryA(#dll); \
if (!h) { \
if (ret_on_failure) { return LIBUSB_ERROR_NOT_FOUND; }\
else { break; } \
} \
prefixname = (__dll_##name##_t)GetProcAddress(h, #name); \
if (prefixname) break; \
prefixname = (__dll_##name##_t)GetProcAddress(h, #name "A"); \
if (prefixname) break; \
prefixname = (__dll_##name##_t)GetProcAddress(h, #name "W"); \
if (prefixname) break; \
if(ret_on_failure) \
return LIBUSB_ERROR_NOT_FOUND; \
} while(0)
#define DLL_DECLARE(api, ret, name, args) DLL_DECLARE_PREFIXNAME(api, ret, name, name, args)
#define DLL_LOAD(dll, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, name, name, ret_on_failure)
#define DLL_DECLARE_PREFIXED(api, ret, prefix, name, args) DLL_DECLARE_PREFIXNAME(api, ret, prefix##name, name, args)
#define DLL_LOAD_PREFIXED(dll, prefix, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, prefix##name, name, ret_on_failure)
/* OLE32 dependency */
DLL_DECLARE_PREFIXED(WINAPI, HRESULT, p, CLSIDFromString, (LPCOLESTR, LPCLSID));
/* SetupAPI dependencies */
DLL_DECLARE_PREFIXED(WINAPI, HDEVINFO, p, SetupDiGetClassDevsA, (const GUID*, PCSTR, HWND, DWORD));
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiEnumDeviceInfo, (HDEVINFO, DWORD, PSP_DEVINFO_DATA));
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiEnumDeviceInterfaces, (HDEVINFO, PSP_DEVINFO_DATA,
const GUID*, DWORD, PSP_DEVICE_INTERFACE_DATA));
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiGetDeviceInterfaceDetailA, (HDEVINFO, PSP_DEVICE_INTERFACE_DATA,
PSP_DEVICE_INTERFACE_DETAIL_DATA_A, DWORD, PDWORD, PSP_DEVINFO_DATA));
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiDestroyDeviceInfoList, (HDEVINFO));
DLL_DECLARE_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDevRegKey, (HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM));
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiGetDeviceRegistryPropertyA, (HDEVINFO,
PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD));
DLL_DECLARE_PREFIXED(WINAPI, LONG, p, RegQueryValueExW, (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD));
DLL_DECLARE_PREFIXED(WINAPI, LONG, p, RegCloseKey, (HKEY));
/*
* Windows DDK API definitions. Most of it copied from MinGW's includes
*/
typedef DWORD DEVNODE, DEVINST;
typedef DEVNODE *PDEVNODE, *PDEVINST;
typedef DWORD RETURN_TYPE;
typedef RETURN_TYPE CONFIGRET;
#define CR_SUCCESS 0x00000000
#define CR_NO_SUCH_DEVNODE 0x0000000D
#define USB_DEVICE_DESCRIPTOR_TYPE LIBUSB_DT_DEVICE
#define USB_CONFIGURATION_DESCRIPTOR_TYPE LIBUSB_DT_CONFIG
#define USB_STRING_DESCRIPTOR_TYPE LIBUSB_DT_STRING
#define USB_INTERFACE_DESCRIPTOR_TYPE LIBUSB_DT_INTERFACE
#define USB_ENDPOINT_DESCRIPTOR_TYPE LIBUSB_DT_ENDPOINT
#define USB_REQUEST_GET_STATUS LIBUSB_REQUEST_GET_STATUS
#define USB_REQUEST_CLEAR_FEATURE LIBUSB_REQUEST_CLEAR_FEATURE
#define USB_REQUEST_SET_FEATURE LIBUSB_REQUEST_SET_FEATURE
#define USB_REQUEST_SET_ADDRESS LIBUSB_REQUEST_SET_ADDRESS
#define USB_REQUEST_GET_DESCRIPTOR LIBUSB_REQUEST_GET_DESCRIPTOR
#define USB_REQUEST_SET_DESCRIPTOR LIBUSB_REQUEST_SET_DESCRIPTOR
#define USB_REQUEST_GET_CONFIGURATION LIBUSB_REQUEST_GET_CONFIGURATION
#define USB_REQUEST_SET_CONFIGURATION LIBUSB_REQUEST_SET_CONFIGURATION
#define USB_REQUEST_GET_INTERFACE LIBUSB_REQUEST_GET_INTERFACE
#define USB_REQUEST_SET_INTERFACE LIBUSB_REQUEST_SET_INTERFACE
#define USB_REQUEST_SYNC_FRAME LIBUSB_REQUEST_SYNCH_FRAME
#define USB_GET_NODE_INFORMATION 258
#define USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION 260
#define USB_GET_NODE_CONNECTION_NAME 261
#define USB_GET_HUB_CAPABILITIES 271
#if !defined(USB_GET_NODE_CONNECTION_INFORMATION_EX)
#define USB_GET_NODE_CONNECTION_INFORMATION_EX 274
#endif
#if !defined(USB_GET_HUB_CAPABILITIES_EX)
#define USB_GET_HUB_CAPABILITIES_EX 276
#endif
#ifndef METHOD_BUFFERED
#define METHOD_BUFFERED 0
#endif
#ifndef FILE_ANY_ACCESS
#define FILE_ANY_ACCESS 0x00000000
#endif
#ifndef FILE_DEVICE_UNKNOWN
#define FILE_DEVICE_UNKNOWN 0x00000022
#endif
#ifndef FILE_DEVICE_USB
#define FILE_DEVICE_USB FILE_DEVICE_UNKNOWN
#endif
#ifndef CTL_CODE
#define CTL_CODE(DeviceType, Function, Method, Access)( \
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
#endif
typedef enum USB_CONNECTION_STATUS {
NoDeviceConnected,
DeviceConnected,
DeviceFailedEnumeration,
DeviceGeneralFailure,
DeviceCausedOvercurrent,
DeviceNotEnoughPower,
DeviceNotEnoughBandwidth,
DeviceHubNestedTooDeeply,
DeviceInLegacyHub
} USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;
typedef enum USB_HUB_NODE {
UsbHub,
UsbMIParent
} USB_HUB_NODE;
/* Cfgmgr32.dll interface */
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Parent, (PDEVINST, DEVINST, ULONG));
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Child, (PDEVINST, DEVINST, ULONG));
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Sibling, (PDEVINST, DEVINST, ULONG));
DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Device_IDA, (DEVINST, PCHAR, ULONG, ULONG));
#define IOCTL_USB_GET_HUB_CAPABILITIES_EX \
CTL_CODE( FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES_EX, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_USB_GET_HUB_CAPABILITIES \
CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION \
CTL_CODE(FILE_DEVICE_USB, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_USB_GET_ROOT_HUB_NAME \
CTL_CODE(FILE_DEVICE_USB, HCD_GET_ROOT_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_USB_GET_NODE_INFORMATION \
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX \
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION_EX, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES \
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_ATTRIBUTES, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_USB_GET_NODE_CONNECTION_NAME \
CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
// Most of the structures below need to be packed
#pragma pack(push, 1)
typedef struct USB_INTERFACE_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bInterfaceNumber;
UCHAR bAlternateSetting;
UCHAR bNumEndpoints;
UCHAR bInterfaceClass;
UCHAR bInterfaceSubClass;
UCHAR bInterfaceProtocol;
UCHAR iInterface;
} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
typedef struct USB_CONFIGURATION_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT wTotalLength;
UCHAR bNumInterfaces;
UCHAR bConfigurationValue;
UCHAR iConfiguration;
UCHAR bmAttributes;
UCHAR MaxPower;
} USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
typedef struct USB_CONFIGURATION_DESCRIPTOR_SHORT {
struct {
ULONG ConnectionIndex;
struct {
UCHAR bmRequest;
UCHAR bRequest;
USHORT wValue;
USHORT wIndex;
USHORT wLength;
} SetupPacket;
} req;
USB_CONFIGURATION_DESCRIPTOR data;
} USB_CONFIGURATION_DESCRIPTOR_SHORT;
typedef struct USB_ENDPOINT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bEndpointAddress;
UCHAR bmAttributes;
USHORT wMaxPacketSize;
UCHAR bInterval;
} USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
typedef struct USB_DESCRIPTOR_REQUEST {
ULONG ConnectionIndex;
struct {
UCHAR bmRequest;
UCHAR bRequest;
USHORT wValue;
USHORT wIndex;
USHORT wLength;
} SetupPacket;
// UCHAR Data[0];
} USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST;
typedef struct USB_HUB_DESCRIPTOR {
UCHAR bDescriptorLength;
UCHAR bDescriptorType;
UCHAR bNumberOfPorts;
USHORT wHubCharacteristics;
UCHAR bPowerOnToPowerGood;
UCHAR bHubControlCurrent;
UCHAR bRemoveAndPowerMask[64];
} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
typedef struct USB_ROOT_HUB_NAME {
ULONG ActualLength;
WCHAR RootHubName[1];
} USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME;
typedef struct USB_ROOT_HUB_NAME_FIXED {
ULONG ActualLength;
WCHAR RootHubName[MAX_PATH_LENGTH];
} USB_ROOT_HUB_NAME_FIXED;
typedef struct USB_NODE_CONNECTION_NAME {
ULONG ConnectionIndex;
ULONG ActualLength;
WCHAR NodeName[1];
} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
typedef struct USB_NODE_CONNECTION_NAME_FIXED {
ULONG ConnectionIndex;
ULONG ActualLength;
WCHAR NodeName[MAX_PATH_LENGTH];
} USB_NODE_CONNECTION_NAME_FIXED;
typedef struct USB_HUB_NAME_FIXED {
union {
USB_ROOT_HUB_NAME_FIXED root;
USB_NODE_CONNECTION_NAME_FIXED node;
} u;
} USB_HUB_NAME_FIXED;
typedef struct USB_HUB_INFORMATION {
USB_HUB_DESCRIPTOR HubDescriptor;
BOOLEAN HubIsBusPowered;
} USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION;
typedef struct USB_MI_PARENT_INFORMATION {
ULONG NumberOfInterfaces;
} USB_MI_PARENT_INFORMATION, *PUSB_MI_PARENT_INFORMATION;
typedef struct USB_NODE_INFORMATION {
USB_HUB_NODE NodeType;
union {
USB_HUB_INFORMATION HubInformation;
USB_MI_PARENT_INFORMATION MiParentInformation;
} u;
} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;
typedef struct USB_PIPE_INFO {
USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
ULONG ScheduleOffset;
} USB_PIPE_INFO, *PUSB_PIPE_INFO;
typedef struct USB_NODE_CONNECTION_INFORMATION_EX {
ULONG ConnectionIndex;
USB_DEVICE_DESCRIPTOR DeviceDescriptor;
UCHAR CurrentConfigurationValue;
UCHAR Speed;
BOOLEAN DeviceIsHub;
USHORT DeviceAddress;
ULONG NumberOfOpenPipes;
USB_CONNECTION_STATUS ConnectionStatus;
// USB_PIPE_INFO PipeList[0];
} USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX;
typedef struct USB_HUB_CAP_FLAGS {
ULONG HubIsHighSpeedCapable:1;
ULONG HubIsHighSpeed:1;
ULONG HubIsMultiTtCapable:1;
ULONG HubIsMultiTt:1;
ULONG HubIsRoot:1;
ULONG HubIsArmedWakeOnConnect:1;
ULONG ReservedMBZ:26;
} USB_HUB_CAP_FLAGS, *PUSB_HUB_CAP_FLAGS;
typedef struct USB_HUB_CAPABILITIES {
ULONG HubIs2xCapable : 1;
} USB_HUB_CAPABILITIES, *PUSB_HUB_CAPABILITIES;
typedef struct USB_HUB_CAPABILITIES_EX {
USB_HUB_CAP_FLAGS CapabilityFlags;
} USB_HUB_CAPABILITIES_EX, *PUSB_HUB_CAPABILITIES_EX;
#pragma pack(pop)
/* winusb.dll interface */
#define SHORT_PACKET_TERMINATE 0x01
#define AUTO_CLEAR_STALL 0x02
#define PIPE_TRANSFER_TIMEOUT 0x03
#define IGNORE_SHORT_PACKETS 0x04
#define ALLOW_PARTIAL_READS 0x05
#define AUTO_FLUSH 0x06
#define RAW_IO 0x07
#define MAXIMUM_TRANSFER_SIZE 0x08
#define AUTO_SUSPEND 0x81
#define SUSPEND_DELAY 0x83
#define DEVICE_SPEED 0x01
#define LowSpeed 0x01
#define FullSpeed 0x02
#define HighSpeed 0x03
typedef enum USBD_PIPE_TYPE {
UsbdPipeTypeControl,
UsbdPipeTypeIsochronous,
UsbdPipeTypeBulk,
UsbdPipeTypeInterrupt
} USBD_PIPE_TYPE;
typedef struct {
USBD_PIPE_TYPE PipeType;
UCHAR PipeId;
USHORT MaximumPacketSize;
UCHAR Interval;
} WINUSB_PIPE_INFORMATION, *PWINUSB_PIPE_INFORMATION;
#pragma pack(1)
typedef struct {
UCHAR request_type;
UCHAR request;
USHORT value;
USHORT index;
USHORT length;
} WINUSB_SETUP_PACKET, *PWINUSB_SETUP_PACKET;
#pragma pack()
typedef void *WINUSB_INTERFACE_HANDLE, *PWINUSB_INTERFACE_HANDLE;
DLL_DECLARE(WINAPI, BOOL, WinUsb_Initialize, (HANDLE, PWINUSB_INTERFACE_HANDLE));
DLL_DECLARE(WINAPI, BOOL, WinUsb_Free, (WINUSB_INTERFACE_HANDLE));
DLL_DECLARE(WINAPI, BOOL, WinUsb_GetAssociatedInterface, (WINUSB_INTERFACE_HANDLE, UCHAR, PWINUSB_INTERFACE_HANDLE));
DLL_DECLARE(WINAPI, BOOL, WinUsb_GetDescriptor, (WINUSB_INTERFACE_HANDLE, UCHAR, UCHAR, USHORT, PUCHAR, ULONG, PULONG));
DLL_DECLARE(WINAPI, BOOL, WinUsb_QueryInterfaceSettings, (WINUSB_INTERFACE_HANDLE, UCHAR, PUSB_INTERFACE_DESCRIPTOR));
DLL_DECLARE(WINAPI, BOOL, WinUsb_QueryDeviceInformation, (WINUSB_INTERFACE_HANDLE, ULONG, PULONG, PVOID));
DLL_DECLARE(WINAPI, BOOL, WinUsb_SetCurrentAlternateSetting, (WINUSB_INTERFACE_HANDLE, UCHAR));
DLL_DECLARE(WINAPI, BOOL, WinUsb_GetCurrentAlternateSetting, (WINUSB_INTERFACE_HANDLE, PUCHAR));
DLL_DECLARE(WINAPI, BOOL, WinUsb_QueryPipe, (WINUSB_INTERFACE_HANDLE, UCHAR, UCHAR, PWINUSB_PIPE_INFORMATION));
DLL_DECLARE(WINAPI, BOOL, WinUsb_SetPipePolicy, (WINUSB_INTERFACE_HANDLE, UCHAR, ULONG, ULONG, PVOID));
DLL_DECLARE(WINAPI, BOOL, WinUsb_GetPipePolicy, (WINUSB_INTERFACE_HANDLE, UCHAR, ULONG, PULONG, PVOID));
DLL_DECLARE(WINAPI, BOOL, WinUsb_ReadPipe, (WINUSB_INTERFACE_HANDLE, UCHAR, PUCHAR, ULONG, PULONG, LPOVERLAPPED));
DLL_DECLARE(WINAPI, BOOL, WinUsb_WritePipe, (WINUSB_INTERFACE_HANDLE, UCHAR, PUCHAR, ULONG, PULONG, LPOVERLAPPED));
DLL_DECLARE(WINAPI, BOOL, WinUsb_ControlTransfer, (WINUSB_INTERFACE_HANDLE, WINUSB_SETUP_PACKET, PUCHAR, ULONG, PULONG, LPOVERLAPPED));
DLL_DECLARE(WINAPI, BOOL, WinUsb_ResetPipe, (WINUSB_INTERFACE_HANDLE, UCHAR));
DLL_DECLARE(WINAPI, BOOL, WinUsb_AbortPipe, (WINUSB_INTERFACE_HANDLE, UCHAR));
DLL_DECLARE(WINAPI, BOOL, WinUsb_FlushPipe, (WINUSB_INTERFACE_HANDLE, UCHAR));

View File

@@ -1,314 +0,0 @@
/*
* Synchronous I/O functions for libusb
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "libusbi.h"
/**
* @defgroup syncio Synchronous device I/O
*
* This page documents libusb's synchronous (blocking) API for USB device I/O.
* This interface is easy to use but has some limitations. More advanced users
* may wish to consider using the \ref asyncio "asynchronous I/O API" instead.
*/
static void LIBUSB_CALL ctrl_transfer_cb(struct libusb_transfer *transfer)
{
int *completed = transfer->user_data;
*completed = 1;
usbi_dbg("actual_length=%d", transfer->actual_length);
/* caller interprets result and frees transfer */
}
/** \ingroup syncio
* Perform a USB control transfer.
*
* The direction of the transfer is inferred from the bmRequestType field of
* the setup packet.
*
* The wValue, wIndex and wLength fields values should be given in host-endian
* byte order.
*
* \param dev_handle a handle for the device to communicate with
* \param bmRequestType the request type field for the setup packet
* \param bRequest the request field for the setup packet
* \param wValue the value field for the setup packet
* \param wIndex the index field for the setup packet
* \param data a suitably-sized data buffer for either input or output
* (depending on direction bits within bmRequestType)
* \param wLength the length field for the setup packet. The data buffer should
* be at least this size.
* \param timeout timeout (in millseconds) that this function should wait
* before giving up due to no response being received. For an unlimited
* timeout, use value 0.
* \returns on success, the number of bytes actually transferred
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
* \returns LIBUSB_ERROR_PIPE if the control request was not supported by the
* device
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other failures
*/
int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
unsigned char *data, uint16_t wLength, unsigned int timeout)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *buffer;
int completed = 0;
int r;
if (!transfer)
return LIBUSB_ERROR_NO_MEM;
buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
if (!buffer) {
libusb_free_transfer(transfer);
return LIBUSB_ERROR_NO_MEM;
}
libusb_fill_control_setup(buffer, bmRequestType, bRequest, wValue, wIndex,
wLength);
if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_OUT)
memcpy(buffer + LIBUSB_CONTROL_SETUP_SIZE, data, wLength);
libusb_fill_control_transfer(transfer, dev_handle, buffer,
ctrl_transfer_cb, &completed, timeout);
transfer->flags = LIBUSB_TRANSFER_FREE_BUFFER;
r = libusb_submit_transfer(transfer);
if (r < 0) {
libusb_free_transfer(transfer);
return r;
}
while (!completed) {
r = libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed);
if (r < 0) {
if (r == LIBUSB_ERROR_INTERRUPTED)
continue;
libusb_cancel_transfer(transfer);
while (!completed)
if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < 0)
break;
libusb_free_transfer(transfer);
return r;
}
}
if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
memcpy(data, libusb_control_transfer_get_data(transfer),
transfer->actual_length);
switch (transfer->status) {
case LIBUSB_TRANSFER_COMPLETED:
r = transfer->actual_length;
break;
case LIBUSB_TRANSFER_TIMED_OUT:
r = LIBUSB_ERROR_TIMEOUT;
break;
case LIBUSB_TRANSFER_STALL:
r = LIBUSB_ERROR_PIPE;
break;
case LIBUSB_TRANSFER_NO_DEVICE:
r = LIBUSB_ERROR_NO_DEVICE;
break;
case LIBUSB_TRANSFER_OVERFLOW:
r = LIBUSB_ERROR_OVERFLOW;
break;
default:
usbi_warn(HANDLE_CTX(dev_handle),
"unrecognised status code %d", transfer->status);
r = LIBUSB_ERROR_OTHER;
}
libusb_free_transfer(transfer);
return r;
}
static void LIBUSB_CALL bulk_transfer_cb(struct libusb_transfer *transfer)
{
int *completed = transfer->user_data;
*completed = 1;
usbi_dbg("actual_length=%d", transfer->actual_length);
/* caller interprets results and frees transfer */
}
static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
unsigned char endpoint, unsigned char *buffer, int length,
int *transferred, unsigned int timeout, unsigned char type)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
int completed = 0;
int r;
if (!transfer)
return LIBUSB_ERROR_NO_MEM;
libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, length,
bulk_transfer_cb, &completed, timeout);
transfer->type = type;
r = libusb_submit_transfer(transfer);
if (r < 0) {
libusb_free_transfer(transfer);
return r;
}
while (!completed) {
r = libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed);
if (r < 0) {
if (r == LIBUSB_ERROR_INTERRUPTED)
continue;
libusb_cancel_transfer(transfer);
while (!completed)
if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < 0)
break;
libusb_free_transfer(transfer);
return r;
}
}
*transferred = transfer->actual_length;
switch (transfer->status) {
case LIBUSB_TRANSFER_COMPLETED:
r = 0;
break;
case LIBUSB_TRANSFER_TIMED_OUT:
r = LIBUSB_ERROR_TIMEOUT;
break;
case LIBUSB_TRANSFER_STALL:
r = LIBUSB_ERROR_PIPE;
break;
case LIBUSB_TRANSFER_OVERFLOW:
r = LIBUSB_ERROR_OVERFLOW;
break;
case LIBUSB_TRANSFER_NO_DEVICE:
r = LIBUSB_ERROR_NO_DEVICE;
break;
default:
usbi_warn(HANDLE_CTX(dev_handle),
"unrecognised status code %d", transfer->status);
r = LIBUSB_ERROR_OTHER;
}
libusb_free_transfer(transfer);
return r;
}
/** \ingroup syncio
* Perform a USB bulk transfer. The direction of the transfer is inferred from
* the direction bits of the endpoint address.
*
* For bulk reads, the <tt>length</tt> field indicates the maximum length of
* data you are expecting to receive. If less data arrives than expected,
* this function will return that data, so be sure to check the
* <tt>transferred</tt> output parameter.
*
* You should also check the <tt>transferred</tt> parameter for bulk writes.
* Not all of the data may have been written.
*
* Also check <tt>transferred</tt> when dealing with a timeout error code.
* libusb may have to split your transfer into a number of chunks to satisfy
* underlying O/S requirements, meaning that the timeout may expire after
* the first few chunks have completed. libusb is careful not to lose any data
* that may have been transferred; do not assume that timeout conditions
* indicate a complete lack of I/O.
*
* \param dev_handle a handle for the device to communicate with
* \param endpoint the address of a valid endpoint to communicate with
* \param data a suitably-sized data buffer for either input or output
* (depending on endpoint)
* \param length for bulk writes, the number of bytes from data to be sent. for
* bulk reads, the maximum number of bytes to receive into the data buffer.
* \param transferred output location for the number of bytes actually
* transferred.
* \param timeout timeout (in millseconds) that this function should wait
* before giving up due to no response being received. For an unlimited
* timeout, use value 0.
*
* \returns 0 on success (and populates <tt>transferred</tt>)
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates
* <tt>transferred</tt>)
* \returns LIBUSB_ERROR_PIPE if the endpoint halted
* \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
* \ref packetoverflow
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other failures
*/
int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
unsigned char endpoint, unsigned char *data, int length, int *transferred,
unsigned int timeout)
{
return do_sync_bulk_transfer(dev_handle, endpoint, data, length,
transferred, timeout, LIBUSB_TRANSFER_TYPE_BULK);
}
/** \ingroup syncio
* Perform a USB interrupt transfer. The direction of the transfer is inferred
* from the direction bits of the endpoint address.
*
* For interrupt reads, the <tt>length</tt> field indicates the maximum length
* of data you are expecting to receive. If less data arrives than expected,
* this function will return that data, so be sure to check the
* <tt>transferred</tt> output parameter.
*
* You should also check the <tt>transferred</tt> parameter for interrupt
* writes. Not all of the data may have been written.
*
* Also check <tt>transferred</tt> when dealing with a timeout error code.
* libusb may have to split your transfer into a number of chunks to satisfy
* underlying O/S requirements, meaning that the timeout may expire after
* the first few chunks have completed. libusb is careful not to lose any data
* that may have been transferred; do not assume that timeout conditions
* indicate a complete lack of I/O.
*
* The default endpoint bInterval value is used as the polling interval.
*
* \param dev_handle a handle for the device to communicate with
* \param endpoint the address of a valid endpoint to communicate with
* \param data a suitably-sized data buffer for either input or output
* (depending on endpoint)
* \param length for bulk writes, the number of bytes from data to be sent. for
* bulk reads, the maximum number of bytes to receive into the data buffer.
* \param transferred output location for the number of bytes actually
* transferred.
* \param timeout timeout (in millseconds) that this function should wait
* before giving up due to no response being received. For an unlimited
* timeout, use value 0.
*
* \returns 0 on success (and populates <tt>transferred</tt>)
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
* \returns LIBUSB_ERROR_PIPE if the endpoint halted
* \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
* \ref packetoverflow
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other error
*/
int API_EXPORTED libusb_interrupt_transfer(
struct libusb_device_handle *dev_handle, unsigned char endpoint,
unsigned char *data, int length, int *transferred, unsigned int timeout)
{
return do_sync_bulk_transfer(dev_handle, endpoint, data, length,
transferred, timeout, LIBUSB_TRANSFER_TYPE_INTERRUPT);
}

View File

@@ -1,18 +0,0 @@
/* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */
#ifndef LIBUSB_MAJOR
#define LIBUSB_MAJOR 1
#endif
#ifndef LIBUSB_MINOR
#define LIBUSB_MINOR 0
#endif
#ifndef LIBUSB_MICRO
#define LIBUSB_MICRO 9
#endif
/* LIBUSB_NANO may be used for Windows internal versioning. 0 means unused. */
#ifndef LIBUSB_NANO
#define LIBUSB_NANO 0
#endif
/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
#ifndef LIBUSB_RC
#define LIBUSB_RC ""
#endif

View File

@@ -1,376 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
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
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,24 +0,0 @@
/* config.h. Manual config for MSVC. */
#ifndef _MSC_VER
#warn "msvc/config.h shouldn't be included for your development environment."
#error "Please make sure the msvc/ directory is removed from your build path."
#endif
/* Default visibility */
#define DEFAULT_VISIBILITY /**/
/* Debug message logging */
//#define ENABLE_DEBUG_LOGGING 1
/* Message logging */
#define ENABLE_LOGGING 1
/* Windows backend */
#define OS_WINDOWS 1
/* type of second poll() argument */
#define POLL_NFDS_TYPE unsigned int
/* no way to run git describe from MSVC? */
#define LIBUSB_DESCRIBE ""

View File

@@ -1,106 +0,0 @@
@rem default builds static library.
@rem you can pass the following arguments (case insensitive):
@rem - "DLL" to build a DLL instead of a static library
@rem - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
@echo off
if Test%BUILD_ALT_DIR%==Test goto usage
rem process commandline parameters
set TARGET=LIBRARY
set STATIC_LIBC=
set version=1.0
if "%1" == "" goto no_more_args
rem /I for case insensitive
if /I Test%1==TestDLL set TARGET=DYNLINK
if /I Test%1==Test/MT set STATIC_LIBC=1
:no_more_args
cd ..\libusb\os
echo TARGETTYPE=%TARGET% > target
copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
del target
@echo on
build -cwgZ
@echo off
if errorlevel 1 goto builderror
cd ..\..
set cpudir=i386
set destType=Win32
if %_BUILDARCH%==x86 goto isI386
set cpudir=amd64
set destType=x64
:isI386
set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir%
set dstPath=%destType%\Debug
if %DDKBUILDENV%==chk goto isDebug
set dstPath=%destType%\Release
:isDebug
if exist %destType% goto md2
mkdir %destType%
:md2
if exist %dstPath% goto md3
mkdir %dstPath%
:md3
if exist %dstPath%\dll goto md4
mkdir %dstPath%\dll
:md4
if exist %dstPath%\lib goto md5
md %dstPath%\lib
:md5
if exist %dstPath%\examples goto md6
md %dstPath%\examples
:md6
@echo on
@if /I NOT Test%1==TestDLL goto copylib
copy %srcPath%\libusb-%version%.dll %dstPath%\dll
copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
:copylib
copy %srcPath%\libusb-%version%.lib %dstPath%\lib
@echo off
if exist examples\listdevs_ddkbuild goto md7
md examples\listdevs_ddkbuild
:md7
cd examples\listdevs_ddkbuild
copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
@echo on
build -cwgZ
@echo off
if errorlevel 1 goto buildlistdevserror
cd ..\..
set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
@echo on
copy %srcPath%\listdevs.exe %dstPath%\examples
copy %srcPath%\listdevs.pdb %dstPath%\examples
cd msvc
goto done
:builderror
cd ..\..\msvc
echo Build failed
goto done
:buildlistdevserror
cd ..\..\msvc
echo listdevs build failed
goto done
:usage
echo ddk_build must be run in a WDK build environment
pause
goto done
:done

View File

@@ -1,295 +0,0 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file was original part of the w64 mingw-runtime package.
*/
/*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com>
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Date: 2010-04-02
*/
#ifndef _MSC_VER
#error This header should only be used with Microsoft compilers
#endif
/* 7.8 Format conversion of integer types <inttypes.h> */
#ifndef _INTTYPES_H_
#define _INTTYPES_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
/* 7.8.1 Macros for format specifiers
*
* MS runtime does not yet understand C9x standard "ll"
* length specifier. It appears to treat "ll" as "l".
* The non-standard I64 length specifier causes warning in GCC,
* but understood by MS runtime functions.
*/
/* fprintf macros for signed types */
#define PRId8 "d"
#define PRId16 "d"
#define PRId32 "d"
#define PRId64 "I64d"
#define PRIdLEAST8 "d"
#define PRIdLEAST16 "d"
#define PRIdLEAST32 "d"
#define PRIdLEAST64 "I64d"
#define PRIdFAST8 "d"
#define PRIdFAST16 "d"
#define PRIdFAST32 "d"
#define PRIdFAST64 "I64d"
#define PRIdMAX "I64d"
#define PRIi8 "i"
#define PRIi16 "i"
#define PRIi32 "i"
#define PRIi64 "I64i"
#define PRIiLEAST8 "i"
#define PRIiLEAST16 "i"
#define PRIiLEAST32 "i"
#define PRIiLEAST64 "I64i"
#define PRIiFAST8 "i"
#define PRIiFAST16 "i"
#define PRIiFAST32 "i"
#define PRIiFAST64 "I64i"
#define PRIiMAX "I64i"
#define PRIo8 "o"
#define PRIo16 "o"
#define PRIo32 "o"
#define PRIo64 "I64o"
#define PRIoLEAST8 "o"
#define PRIoLEAST16 "o"
#define PRIoLEAST32 "o"
#define PRIoLEAST64 "I64o"
#define PRIoFAST8 "o"
#define PRIoFAST16 "o"
#define PRIoFAST32 "o"
#define PRIoFAST64 "I64o"
#define PRIoMAX "I64o"
/* fprintf macros for unsigned types */
#define PRIu8 "u"
#define PRIu16 "u"
#define PRIu32 "u"
#define PRIu64 "I64u"
#define PRIuLEAST8 "u"
#define PRIuLEAST16 "u"
#define PRIuLEAST32 "u"
#define PRIuLEAST64 "I64u"
#define PRIuFAST8 "u"
#define PRIuFAST16 "u"
#define PRIuFAST32 "u"
#define PRIuFAST64 "I64u"
#define PRIuMAX "I64u"
#define PRIx8 "x"
#define PRIx16 "x"
#define PRIx32 "x"
#define PRIx64 "I64x"
#define PRIxLEAST8 "x"
#define PRIxLEAST16 "x"
#define PRIxLEAST32 "x"
#define PRIxLEAST64 "I64x"
#define PRIxFAST8 "x"
#define PRIxFAST16 "x"
#define PRIxFAST32 "x"
#define PRIxFAST64 "I64x"
#define PRIxMAX "I64x"
#define PRIX8 "X"
#define PRIX16 "X"
#define PRIX32 "X"
#define PRIX64 "I64X"
#define PRIXLEAST8 "X"
#define PRIXLEAST16 "X"
#define PRIXLEAST32 "X"
#define PRIXLEAST64 "I64X"
#define PRIXFAST8 "X"
#define PRIXFAST16 "X"
#define PRIXFAST32 "X"
#define PRIXFAST64 "I64X"
#define PRIXMAX "I64X"
/*
* fscanf macros for signed int types
* NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
* (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
* no length identifiers
*/
#define SCNd16 "hd"
#define SCNd32 "d"
#define SCNd64 "I64d"
#define SCNdLEAST16 "hd"
#define SCNdLEAST32 "d"
#define SCNdLEAST64 "I64d"
#define SCNdFAST16 "hd"
#define SCNdFAST32 "d"
#define SCNdFAST64 "I64d"
#define SCNdMAX "I64d"
#define SCNi16 "hi"
#define SCNi32 "i"
#define SCNi64 "I64i"
#define SCNiLEAST16 "hi"
#define SCNiLEAST32 "i"
#define SCNiLEAST64 "I64i"
#define SCNiFAST16 "hi"
#define SCNiFAST32 "i"
#define SCNiFAST64 "I64i"
#define SCNiMAX "I64i"
#define SCNo16 "ho"
#define SCNo32 "o"
#define SCNo64 "I64o"
#define SCNoLEAST16 "ho"
#define SCNoLEAST32 "o"
#define SCNoLEAST64 "I64o"
#define SCNoFAST16 "ho"
#define SCNoFAST32 "o"
#define SCNoFAST64 "I64o"
#define SCNoMAX "I64o"
#define SCNx16 "hx"
#define SCNx32 "x"
#define SCNx64 "I64x"
#define SCNxLEAST16 "hx"
#define SCNxLEAST32 "x"
#define SCNxLEAST64 "I64x"
#define SCNxFAST16 "hx"
#define SCNxFAST32 "x"
#define SCNxFAST64 "I64x"
#define SCNxMAX "I64x"
/* fscanf macros for unsigned int types */
#define SCNu16 "hu"
#define SCNu32 "u"
#define SCNu64 "I64u"
#define SCNuLEAST16 "hu"
#define SCNuLEAST32 "u"
#define SCNuLEAST64 "I64u"
#define SCNuFAST16 "hu"
#define SCNuFAST32 "u"
#define SCNuFAST64 "I64u"
#define SCNuMAX "I64u"
#ifdef _WIN64
#define PRIdPTR "I64d"
#define PRIiPTR "I64i"
#define PRIoPTR "I64o"
#define PRIuPTR "I64u"
#define PRIxPTR "I64x"
#define PRIXPTR "I64X"
#define SCNdPTR "I64d"
#define SCNiPTR "I64i"
#define SCNoPTR "I64o"
#define SCNxPTR "I64x"
#define SCNuPTR "I64u"
#else
#define PRIdPTR "d"
#define PRIiPTR "i"
#define PRIoPTR "o"
#define PRIuPTR "u"
#define PRIxPTR "x"
#define PRIXPTR "X"
#define SCNdPTR "d"
#define SCNiPTR "i"
#define SCNoPTR "o"
#define SCNxPTR "x"
#define SCNuPTR "u"
#endif
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/*
* no length modifier for char types prior to C9x
* MS runtime scanf appears to treat "hh" as "h"
*/
/* signed char */
#define SCNd8 "hhd"
#define SCNdLEAST8 "hhd"
#define SCNdFAST8 "hhd"
#define SCNi8 "hhi"
#define SCNiLEAST8 "hhi"
#define SCNiFAST8 "hhi"
#define SCNo8 "hho"
#define SCNoLEAST8 "hho"
#define SCNoFAST8 "hho"
#define SCNx8 "hhx"
#define SCNxLEAST8 "hhx"
#define SCNxFAST8 "hhx"
/* unsigned char */
#define SCNu8 "hhu"
#define SCNuLEAST8 "hhu"
#define SCNuFAST8 "hhu"
#endif /* __STDC_VERSION__ >= 199901 */
#ifdef __cplusplus
}
#endif
#endif /* ndef _INTTYPES_H */

View File

@@ -1,56 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "libusb_dll"=".\libusb_dll.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "libusb_static"=".\libusb_static.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "listdevs"=".\listdevs.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libusb_static
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -1,190 +0,0 @@
# Microsoft Developer Studio Project File - Name="libusb_dll" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=libusb_dll - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libusb_dll.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libusb_dll.mak" CFG="libusb_dll - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libusb_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libusb_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "libusb_dll - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../Win32/Release/dll"
# PROP Intermediate_Dir "../Win32/Release/dll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Win32/Release/dll/libusb-1.0.dll"
!ELSEIF "$(CFG)" == "libusb_dll - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../Win32/Debug/dll"
# PROP Intermediate_Dir "../Win32/Debug/dll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo /n
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Win32/Debug/dll/libusb-1.0.dll"
# SUBTRACT LINK32 /pdb:none /incremental:no
!ENDIF
# Begin Target
# Name "libusb_dll - Win32 Release"
# Name "libusb_dll - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\libusb\core.c
# End Source File
# Begin Source File
SOURCE=..\libusb\os\darwin_usb.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\libusb\descriptor.c
# End Source File
# Begin Source File
SOURCE=..\libusb\io.c
# End Source File
# Begin Source File
SOURCE="..\libusb\libusb-1.0.rc"
# End Source File
# Begin Source File
SOURCE="..\libusb\libusb-1.0.def"
# End Source File
# Begin Source File
SOURCE=..\libusb\os\linux_usbfs.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\libusb\os\poll_windows.c
# End Source File
# Begin Source File
SOURCE=..\libusb\sync.c
# End Source File
# Begin Source File
SOURCE=..\libusb\os\threads_windows.c
# End Source File
# Begin Source File
SOURCE=..\libusb\os\windows_usb.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\config.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\darwin_usb.h
# End Source File
# Begin Source File
SOURCE=..\libusb\libusb.h
# End Source File
# Begin Source File
SOURCE=..\libusb\libusbi.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\linux_usbfs.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\poll_posix.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\poll_windows.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\threads_posix.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\threads_windows.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\windows_usb.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@@ -1,421 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libusb-1.0 (dll)"
ProjectGUID="{8224C054-5968-4238-832C-167155E7ECC3}"
RootNamespace="libusbdll"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="2"
ModuleDefinitionFile="..\libusb\libusb-1.0.def"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="1"
ModuleDefinitionFile="..\libusb\libusb-1.0.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="2"
ModuleDefinitionFile="..\libusb\libusb-1.0.def"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="1"
ModuleDefinitionFile="..\libusb\libusb-1.0.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\libusb\core.c"
>
</File>
<File
RelativePath="..\libusb\descriptor.c"
>
</File>
<File
RelativePath="..\libusb\io.c"
>
</File>
<File
RelativePath="..\libusb\libusb-1.0.def"
>
</File>
<File
RelativePath="..\libusb\sync.c"
>
</File>
<File
RelativePath="..\libusb\os\threads_windows.c"
>
</File>
<File
RelativePath="..\libusb\os\poll_windows.c"
>
</File>
<File
RelativePath="..\libusb\os\windows_usb.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\config.h"
>
</File>
<File
RelativePath="..\libusb\libusb.h"
>
</File>
<File
RelativePath="..\libusb\libusbi.h"
>
</File>
<File
RelativePath="..\libusb\os\threads_windows.h"
>
</File>
<File
RelativePath="..\libusb\os\poll_windows.h"
>
</File>
<File
RelativePath="..\libusb\os\windows_usb.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\libusb\libusb-1.0.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,166 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>libusb-1.0 (dll)</ProjectName>
<ProjectGuid>{349EE8FA-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
<RootNamespace>libusbdll</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
<ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
<EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
<ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
<EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
<ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
<EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
<ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
<EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\libusb\core.c" />
<ClCompile Include="..\libusb\descriptor.c" />
<ClCompile Include="..\libusb\io.c" />
<ClCompile Include="..\libusb\os\poll_windows.c" />
<ClCompile Include="..\libusb\sync.c" />
<ClCompile Include="..\libusb\os\threads_windows.c" />
<ClCompile Include="..\libusb\os\windows_usb.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include=".\config.h" />
<ClInclude Include="..\libusb\libusb.h" />
<ClInclude Include="..\libusb\libusbi.h" />
<ClInclude Include="..\libusb\os\poll_windows.h" />
<ClInclude Include="..\libusb\os\threads_windows.h" />
<ClInclude Include="..\libusb\os\windows_usb.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\libusb\libusb-1.0.def" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\libusb\libusb-1.0.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{d81e81ca-b13e-4a15-b54b-b12b41361e6b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\libusb\core.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\descriptor.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\io.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\os\poll_windows.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\sync.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\os\threads_windows.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\os\windows_usb.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include=".\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\libusb.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\libusbi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\os\poll_windows.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\os\threads_windows.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\os\windows_usb.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\libusb\libusb-1.0.def">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\libusb\libusb-1.0.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@@ -1,36 +0,0 @@
#TARGETTYPE is not defined, to allow selection between static lib or DLL with ddk_build
TARGETNAME=libusb-1.0
DLLDEF=..\libusb-1.0.def
!IFNDEF MSC_WARNING_LEVEL
MSC_WARNING_LEVEL=/W3
!ENDIF
!IFDEF STATIC_LIBC
USE_LIBCMT=1
!ELSE
USE_MSVCRT=1
!ENDIF
INCLUDES=..;..\..\msvc;$(DDK_INC_PATH)
C_DEFINES= $(C_DEFINES) $(LIBUSB_DEFINES) /DDDKBUILD
# http://jpassing.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/
# prevents the following error when using the 64 bit static lib with Visual Studio 2010:
# "fatal error C1001: An internal error has occurred in the compiler.
# (compiler file 'f:\dd\vctools\compiler\utc\src\p2\p2symtab.c', line 1823)"
# and the following with Visual Studio 2010:
# "fatal error C1047: The object or library file 'libusb-1.0.lib' was created with
# an older compiler than other objects; rebuild old objects and libraries"
USER_C_FLAGS=/GL-
TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib
SOURCES=..\core.c \
..\descriptor.c \
..\io.c \
..\sync.c \
threads_windows.c \
poll_windows.c \
windows_usb.c \
..\libusb-1.0.rc

View File

@@ -1,170 +0,0 @@
# Microsoft Developer Studio Project File - Name="libusb_static" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libusb_static - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libusb_static.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libusb_static.mak" CFG="libusb_static - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libusb_static - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libusb_static - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libusb_static - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../Win32/Release/lib"
# PROP Intermediate_Dir "../Win32/Release/lib"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /EHsc /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"../Win32/Release/lib/libusb-1.0.lib"
!ELSEIF "$(CFG)" == "libusb_static - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../Win32/Debug/lib"
# PROP Intermediate_Dir "../Win32/Debug/lib"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /GZ /EHsc /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo /n
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"../Win32/Debug/lib/libusb-1.0.lib"
!ENDIF
# Begin Target
# Name "libusb_static - Win32 Release"
# Name "libusb_static - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\libusb\core.c
# End Source File
# Begin Source File
SOURCE=..\libusb\os\darwin_usb.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\libusb\descriptor.c
# End Source File
# Begin Source File
SOURCE=..\libusb\io.c
# End Source File
# Begin Source File
SOURCE=..\libusb\os\linux_usbfs.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\libusb\os\poll_windows.c
# End Source File
# Begin Source File
SOURCE=..\libusb\sync.c
# End Source File
# Begin Source File
SOURCE=..\libusb\os\threads_windows.c
# End Source File
# Begin Source File
SOURCE=..\libusb\os\windows_usb.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\config.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\darwin_usb.h
# End Source File
# Begin Source File
SOURCE=..\libusb\libusb.h
# End Source File
# Begin Source File
SOURCE=..\libusb\libusbi.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\linux_usbfs.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\poll_posix.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\poll_windows.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\threads_posix.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\threads_windows.h
# End Source File
# Begin Source File
SOURCE=..\libusb\os\windows_usb.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -1,346 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libusb-1.0 (static)"
ProjectGUID="{5AB6B770-1925-48D5-ABC2-930F3259C020}"
RootNamespace="libusb"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\libusb-1.0.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\libusb-1.0.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\libusb-1.0.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\libusb"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\libusb-1.0.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\libusb\core.c"
>
</File>
<File
RelativePath="..\libusb\descriptor.c"
>
</File>
<File
RelativePath="..\libusb\io.c"
>
</File>
<File
RelativePath="..\libusb\sync.c"
>
</File>
<File
RelativePath="..\libusb\os\threads_windows.c"
>
</File>
<File
RelativePath="..\libusb\os\poll_windows.c"
>
</File>
<File
RelativePath="..\libusb\os\windows_usb.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\config.h"
>
</File>
<File
RelativePath="..\libusb\libusb.h"
>
</File>
<File
RelativePath="..\libusb\libusbi.h"
>
</File>
<File
RelativePath="..\libusb\os\threads_windows.h"
>
</File>
<File
RelativePath="..\libusb\os\poll_windows.h"
>
</File>
<File
RelativePath="..\libusb\os\windows_usb.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,150 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>libusb-1.0 (static)</ProjectName>
<ProjectGuid>{349EE8F9-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
<RootNamespace>libusb</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\libusb\core.c" />
<ClCompile Include="..\libusb\descriptor.c" />
<ClCompile Include="..\libusb\io.c" />
<ClCompile Include="..\libusb\os\poll_windows.c" />
<ClCompile Include="..\libusb\sync.c" />
<ClCompile Include="..\libusb\os\threads_windows.c" />
<ClCompile Include="..\libusb\os\windows_usb.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include=".\config.h" />
<ClInclude Include="..\libusb\libusb.h" />
<ClInclude Include="..\libusb\libusbi.h" />
<ClInclude Include="..\libusb\os\poll_windows.h" />
<ClInclude Include="..\libusb\os\threads_windows.h" />
<ClInclude Include="..\libusb\os\windows_usb.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\libusb\core.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\descriptor.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\io.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\os\poll_windows.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\sync.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\os\threads_windows.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\libusb\os\windows_usb.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include=".\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\libusb.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\libusbi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\os\poll_windows.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\os\threads_windows.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libusb\os\windows_usb.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -1,61 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static.vcproj", "{5AB6B770-1925-48D5-ABC2-930F3259C020}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll.vcproj", "{8224C054-5968-4238-832C-167155E7ECC3}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs.vcproj", "{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{5AB6B770-1925-48D5-ABC2-930F3259C020} = {5AB6B770-1925-48D5-ABC2-930F3259C020}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|Win32.ActiveCfg = Debug|Win32
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|Win32.Build.0 = Debug|Win32
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|x64.ActiveCfg = Debug|x64
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|x64.Build.0 = Debug|x64
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|Win32.ActiveCfg = Release|Win32
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|Win32.Build.0 = Release|Win32
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|x64.ActiveCfg = Release|x64
{5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|x64.Build.0 = Release|x64
{8224C054-5968-4238-832C-167155E7ECC3}.Debug|Win32.ActiveCfg = Debug|Win32
{8224C054-5968-4238-832C-167155E7ECC3}.Debug|Win32.Build.0 = Debug|Win32
{8224C054-5968-4238-832C-167155E7ECC3}.Debug|x64.ActiveCfg = Debug|x64
{8224C054-5968-4238-832C-167155E7ECC3}.Debug|x64.Build.0 = Debug|x64
{8224C054-5968-4238-832C-167155E7ECC3}.Release|Win32.ActiveCfg = Release|Win32
{8224C054-5968-4238-832C-167155E7ECC3}.Release|Win32.Build.0 = Release|Win32
{8224C054-5968-4238-832C-167155E7ECC3}.Release|x64.ActiveCfg = Release|x64
{8224C054-5968-4238-832C-167155E7ECC3}.Release|x64.Build.0 = Release|x64
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|Win32.ActiveCfg = Debug|Win32
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|Win32.Build.0 = Debug|Win32
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|x64.ActiveCfg = Debug|x64
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|x64.Build.0 = Debug|x64
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|Win32.ActiveCfg = Release|Win32
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|Win32.Build.0 = Release|Win32
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|x64.ActiveCfg = Release|x64
{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,49 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll.vcxproj", "{349EE8FA-7D25-4909-AAF5-FF3FADE72187}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs.vcxproj", "{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64
{349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32
{349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
{349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32
{349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.ActiveCfg = Debug|Win32
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.Build.0 = Debug|Win32
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.ActiveCfg = Debug|x64
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.Build.0 = Debug|x64
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.ActiveCfg = Release|Win32
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.Build.0 = Release|Win32
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.ActiveCfg = Release|x64
{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.Build.0 = Release|x64
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.ActiveCfg = Debug|Win32
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.Build.0 = Debug|Win32
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.ActiveCfg = Debug|x64
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.Build.0 = Debug|x64
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.ActiveCfg = Release|Win32
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.Build.0 = Release|Win32
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.ActiveCfg = Release|x64
{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,103 +0,0 @@
# Microsoft Developer Studio Project File - Name="listdevs" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=listdevs - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "listdevs.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "listdevs.mak" CFG="listdevs - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "listdevs - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "listdevs - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "listdevs - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../Win32/Release/examples"
# PROP Intermediate_Dir "../Win32/Release/examples/listdevs"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../libusb" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /EHsc /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "listdevs - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../Win32/Debug/examples"
# PROP Intermediate_Dir "../Win32/Debug/examples/listdevs"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../libusb" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /GZ /EHsc /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/threads_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr"
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "listdevs - Win32 Release"
# Name "listdevs - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\examples\listdevs.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@@ -1,360 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="listdevs"
ProjectGUID="{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}"
RootNamespace="examples"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\libusb"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\libusb"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\libusb"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\libusb"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\examples\listdevs.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Detect64BitPortabilityProblems="false"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Detect64BitPortabilityProblems="false"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,165 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>listdevs</ProjectName>
<ProjectGuid>{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}</ProjectGuid>
<RootNamespace>examples</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<BuildLog>
<Path>$(IntDir)$(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<BuildLog>
<Path>$(IntDir)$(ProjectName).htm</Path>
</BuildLog>
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<BuildLog>
<Path>$(IntDir)$(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<BuildLog>
<Path>$(IntDir)$(ProjectName).htm</Path>
</BuildLog>
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\examples\listdevs.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include=".\libusb_static.vcxproj">
<Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\examples\listdevs.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -1,19 +0,0 @@
TARGETNAME=listdevs
TARGETTYPE=PROGRAM
386_STDCALL=0
_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
!IFNDEF MSC_WARNING_LEVEL
MSC_WARNING_LEVEL=/W3
!ENDIF
!IFDEF STATIC_LIBC
USE_LIBCMT=1
!ELSE
USE_MSVCRT=1
!ENDIF
UMTYPE=console
INCLUDES=..\..\libusb;$(DDK_INC_PATH)
UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib
SOURCES=..\listdevs.c

View File

@@ -1,256 +0,0 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file was originally part of the w64 mingw-runtime package.
*/
/* ISO C9x 7.18 Integer types <stdint.h>
* Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
* Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com>
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Date: 2010-04-02
*/
#ifndef _MSC_VER
#error This header should only be used with Microsoft compilers
#endif
#ifndef _STDINT_H
#define _STDINT_H
#ifndef _INTPTR_T_DEFINED
#define _INTPTR_T_DEFINED
#ifndef __intptr_t_defined
#define __intptr_t_defined
#undef intptr_t
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef int intptr_t;
#endif /* _WIN64 */
#endif /* __intptr_t_defined */
#endif /* _INTPTR_T_DEFINED */
#ifndef _UINTPTR_T_DEFINED
#define _UINTPTR_T_DEFINED
#ifndef __uintptr_t_defined
#define __uintptr_t_defined
#undef uintptr_t
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
#endif /* __uintptr_t_defined */
#endif /* _UINTPTR_T_DEFINED */
#ifndef _PTRDIFF_T_DEFINED
#define _PTRDIFF_T_DEFINED
#ifndef _PTRDIFF_T_
#define _PTRDIFF_T_
#undef ptrdiff_t
#ifdef _WIN64
typedef __int64 ptrdiff_t;
#else
typedef int ptrdiff_t;
#endif /* _WIN64 */
#endif /* _PTRDIFF_T_ */
#endif /* _PTRDIFF_T_DEFINED */
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#ifndef __cplusplus
typedef unsigned short wchar_t;
#endif /* C++ */
#endif /* _WCHAR_T_DEFINED */
#ifndef _WCTYPE_T_DEFINED
#define _WCTYPE_T_DEFINED
#ifndef _WINT_T
#define _WINT_T
typedef unsigned short wint_t;
typedef unsigned short wctype_t;
#endif /* _WINT_T */
#endif /* _WCTYPE_T_DEFINED */
/* 7.18.1.1 Exact-width integer types */
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
/* 7.18.1.2 Minimum-width integer types */
typedef signed char int_least8_t;
typedef unsigned char uint_least8_t;
typedef short int_least16_t;
typedef unsigned short uint_least16_t;
typedef int int_least32_t;
typedef unsigned uint_least32_t;
typedef __int64 int_least64_t;
typedef unsigned __int64 uint_least64_t;
/* 7.18.1.3 Fastest minimum-width integer types
* Not actually guaranteed to be fastest for all purposes
* Here we use the exact-width types for 8 and 16-bit ints.
*/
typedef __int8 int_fast8_t;
typedef unsigned __int8 uint_fast8_t;
typedef __int16 int_fast16_t;
typedef unsigned __int16 uint_fast16_t;
typedef __int32 int_fast32_t;
typedef unsigned __int32 uint_fast32_t;
typedef __int64 int_fast64_t;
typedef unsigned __int64 uint_fast64_t;
/* 7.18.1.5 Greatest-width integer types */
typedef __int64 intmax_t;
typedef unsigned __int64 uintmax_t;
/* 7.18.2 Limits of specified-width integer types */
/* 7.18.2.1 Limits of exact-width integer types */
#define INT8_MIN (-128)
#define INT16_MIN (-32768)
#define INT32_MIN (-2147483647 - 1)
#define INT64_MIN (-9223372036854775807LL - 1)
#define INT8_MAX 127
#define INT16_MAX 32767
#define INT32_MAX 2147483647
#define INT64_MAX 9223372036854775807LL
#define UINT8_MAX 255
#define UINT16_MAX 65535
#define UINT32_MAX 0xffffffffU /* 4294967295U */
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
/* 7.18.2.2 Limits of minimum-width integer types */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
/* 7.18.2.3 Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
/* 7.18.2.4 Limits of integer types capable of holding
object pointers */
#ifdef _WIN64
#define INTPTR_MIN INT64_MIN
#define INTPTR_MAX INT64_MAX
#define UINTPTR_MAX UINT64_MAX
#else
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
#endif
/* 7.18.2.5 Limits of greatest-width integer types */
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
/* 7.18.3 Limits of other integer types */
#ifdef _WIN64
#define PTRDIFF_MIN INT64_MIN
#define PTRDIFF_MAX INT64_MAX
#else
#define PTRDIFF_MIN INT32_MIN
#define PTRDIFF_MAX INT32_MAX
#endif
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
#ifndef SIZE_MAX
#ifdef _WIN64
#define SIZE_MAX UINT64_MAX
#else
#define SIZE_MAX UINT32_MAX
#endif
#endif
#ifndef WCHAR_MIN /* also in wchar.h */
#define WCHAR_MIN 0U
#define WCHAR_MAX 0xffffU
#endif
/*
* wint_t is unsigned short for compatibility with MS runtime
*/
#define WINT_MIN 0U
#define WINT_MAX 0xffffU
/* 7.18.4 Macros for integer constants */
/* 7.18.4.1 Macros for minimum-width integer constants
Accoding to Douglas Gwyn <gwyn@arl.mil>:
"This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
9899:1999 as initially published, the expansion was required
to be an integer constant of precisely matching type, which
is impossible to accomplish for the shorter types on most
platforms, because C99 provides no standard way to designate
an integer constant with width less than that of type int.
TC1 changed this to require just an integer constant
*expression* with *promoted* type."
The trick used here is from Clive D W Feather.
*/
#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val))
#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val))
#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val))
/* The 'trick' doesn't work in C89 for long long because, without
suffix, (val) will be evaluated as int, not intmax_t */
#define INT64_C(val) val##i64
#define UINT8_C(val) (val)
#define UINT16_C(val) (val)
#define UINT32_C(val) (val##i32)
#define UINT64_C(val) val##ui64
/* 7.18.4.2 Macros for greatest-width integer constants */
#define INTMAX_C(val) val##i64
#define UINTMAX_C(val) val##ui64
#endif

View File

@@ -1 +0,0 @@
timestamp for config.h

View File

@@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -1,5 +0,0 @@
# Cypress USB driver for FX2 and FX3 (C) Cypress Semiconductor Corporation / ATR-LABS
# Rules written by V. Radhakrishnan ( rk@atr-labs.com )
# Cypress USB vendor ID = 0x04b4
KERNEL=="*", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ACTION=="add", ATTR{idVendor}=="04b4", MODE="666"
KERNEL=="*", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ACTION=="remove", TAG=="cyusb_dev"

View File

@@ -1,222 +0,0 @@
/*
* Common header file of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <pthread.h>
#include <libusb-1.0/libusb.h>
#include "../../common/header/CyUSBSerial.h"
#ifdef __x86_64__
#pragma pack(1)
#else
#endif
typedef struct CY_DEVICE {
unsigned char inEndpoint;
unsigned char outEndpoint;
unsigned char interruptEndpoint;
unsigned char interfaceNum;
bool i2cCancelEvent;
bool spiCancelEvent;
bool uartCancelEvent;
bool rtsValue;
bool dtrValue;
unsigned short numEndpoints;
CY_FLOW_CONTROL_MODES uartFlowControlMode;
struct libusb_transfer *spiTransfer;
struct libusb_transfer *uartTransfer;
libusb_device_handle *devHandle;
pthread_t spiThreadId;
pthread_t uartThreadId;
pthread_mutex_t readLock;
pthread_mutex_t writeLock;
pthread_mutex_t notificationLock;
CY_DEVICE_TYPE deviceType;
}CY_DEVICE,*PCY_DEVICE;
#pragma pack()
CY_RETURN_STATUS CyResetPipe (CY_HANDLE handl, UINT8);
#define CY_DEBUG_PRINT_INFO(...) //User need to enable this
#define CY_DEBUG_PRINT_ERROR(...) //printf
#define DUMP_DATA 1
#ifdef DUMP_DATA
#define CY_DUMP_DATA(INPUT,LEN)\
{\
int i = 0, len = LEN;\
while ((len)) {\
printf ("%x ", (INPUT)[i++]);\
len--;\
}\
printf ("\n");\
}
#else
#define CY_DUMP_DATA (INPUT, LEN) do { }while (0);
#endif
#define CY_USB_SERIAL_TIMEOUT 5000
#define CY_EVENT_NOTIFICATION_TIMEOUT 0 //This will make the transfer infinite
#define CY_VENDOR_REQUEST_DEVICE_TO_HOST 0xC0
#define CY_VENDOR_REQUEST_HOST_TO_DEVICE 0x40
#define CY_CLASS_INTERFACE_REQUEST_DEVICE_TO_HOST 0XA1
#define CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE 0x21
//I2C related macros
#define CY_SCB_INDEX_POS 15
#define CY_I2C_CONFIG_LENGTH 16
#define CY_I2C_WRITE_COMMAND_POS 3
#define CY_I2C_WRITE_COMMAND_LEN_POS 4
#define CY_I2C_GET_STATUS_LEN 3
#define CY_I2C_MODE_WRITE 1
#define CY_I2C_MODE_READ 0
#define CY_I2C_ERROR_BIT (1)
#define CY_I2C_ARBITRATION_ERROR_BIT (1 << 1)
#define CY_I2C_NAK_ERROR_BIT (1 << 2)
#define CY_I2C_BUS_ERROR_BIT (1 << 3)
#define CY_I2C_STOP_BIT_ERROR (1 << 4)
#define CY_I2C_BUS_BUSY_ERROR (1 << 5)
#define CY_I2C_ENABLE_PRECISE_TIMING 1
#define CY_I2C_EVENT_NOTIFICATION_LEN 3
//SPI related Macros
#define CY_SPI_CONFIG_LEN 16
#define CY_SPI_EVENT_NOTIFICATION_LEN 2
#define CY_SPI_READ_BIT (1)
#define CY_SPI_WRITE_BIT (1 << 1)
#define CY_SPI_SCB_INDEX_BIT (1 << 15)
#define CY_SPI_GET_STATUS_LEN 4
#define CY_SPI_UNDERFLOW_ERROR (1)
#define CY_SPI_BUS_ERROR (1 << 1)
//Vendor UART related macros
#define CY_UART_SET_FLOW_CONTROL_CMD 0x60
#define CY_UART_SEND_BREAK_CMD 0x23
#define CY_UART_CONFIG_LEN 16
#define CY_SET_LINE_CONTROL_STATE_CMD 0x22
#define CY_UART_EVENT_NOTIFICATION_LEN 10
#define CY_UART_SERIAL_STATE_CARRIER_DETECT 1
#define CY_UART_SERIAL_STATE_TRANSMISSION_CARRIER (1 << 1)
#define CY_UART_SERIAL_STATE_BREAK_DETECTION (1<< 2)
#define CY_UART_SERIAL_STATE_RING_SIGNAL_DETECTION (1 << 3)
#define CY_UART_SERIAL_STATE_FRAMING_ERROR (1 << 4)
#define CY_UART_SERIAL_STATE_PARITY_ERROR (1 << 5)
#define CY_UART_SERIAL_STATUE_OVERRUN (1 << 6)
//Bootloader related macros
#define CY_BOOT_CONFIG_SIZE 64
#define CY_DEVICE_CONFIG_SIZE 512
#define CY_FIRMWARE_BREAKUP_SIZE 4096
#define CY_GET_SILICON_ID_LEN 4
#define CY_GET_FIRMWARE_VERSION_LEN 8
#define CY_GET_SIGNATURE_LEN 4
//PHDC related macros
#define CY_PHDC_SET_FEATURE 0X03
#define CY_PHDC_CLR_FEATURE 0X01
#define CY_PHDC_GET_DATA_STATUS 0x00
typedef enum CY_VENDOR_CMDS
{
CY_GET_VERSION_CMD = 0xB0, /* Get the version of the boot-loader.
value = 0, index = 0, length = 4;
data_in = 32 bit version. */
CY_GET_SIGNATURE_CMD = 0xBD, /*Get the signature of the firmware
It is suppose to be 'CYUS' for normal firmware
and 'CYBL' for Bootloader.*/
CY_UART_GET_CONFIG_CMD = 0xC0, /* Retreive the 16 byte UART configuration information.
MS bit of value indicates the SCB index.
length = 16, data_in = 16 byte configuration. */
CY_UART_SET_CONFIG_CMD, /* Update the 16 byte UART configuration information.
MS bit of value indicates the SCB index.
length = 16, data_out = 16 byte configuration information. */
CY_SPI_GET_CONFIG_CMD, /* Retreive the 16 byte SPI configuration information.
MS bit of value indicates the SCB index.
length = 16, data_in = 16 byte configuration. */
CY_SPI_SET_CONFIG_CMD, /* Update the 16 byte SPI configuration information.
MS bit of value indicates the SCB index.
length = 16, data_out = 16 byte configuration information. */
CY_I2C_GET_CONFIG_CMD, /* Retreive the 16 byte I2C configuration information.
MS bit of value indicates the SCB index.
length = 16, data_in = 16 byte configuration. */
CY_I2C_SET_CONFIG_CMD = 0xC5, /* Update the 16 byte I2C configuration information.
MS bit of value indicates the SCB index.
length = 16, data_out = 16 byte configuration information. */
CY_I2C_WRITE_CMD, /* Perform I2C write operation.
value = bit0 - start, bit1 - stop, bit3 - start on idle,
bits[14:8] - slave address, bit15 - scbIndex. length = 0. The
data is provided over the bulk endpoints. */
CY_I2C_READ_CMD, /* Perform I2C read operation.
value = bit0 - start, bit1 - stop, bit2 - Nak last byte,
bit3 - start on idle, bits[14:8] - slave address, bit15 - scbIndex,
length = 0. The data is provided over the bulk endpoints. */
CY_I2C_GET_STATUS_CMD, /* Retreive the I2C bus status.
value = bit0 - 0: TX 1: RX, bit15 - scbIndex, length = 3,
data_in = byte0: bit0 - flag, bit1 - bus_state, bit2 - SDA state,
bit3 - TX underflow, bit4 - arbitration error, bit5 - NAK
bit6 - bus error,
byte[2:1] Data count remaining. */
CY_I2C_RESET_CMD, /* The command cleans up the I2C state machine and frees the bus.
value = bit0 - 0: TX path, 1: RX path; bit15 - scbIndex,
length = 0. */
CY_SPI_READ_WRITE_CMD = 0xCA, /* The command starts a read / write operation at SPI.
value = bit 0 - RX enable, bit 1 - TX enable, bit 15 - scbIndex;
index = length of transfer. */
CY_SPI_RESET_CMD, /* The command resets the SPI pipes and allows it to receive new
request.
value = bit 15 - scbIndex */
CY_SPI_GET_STATUS_CMD, /* The command returns the current transfer status. The count will match
the TX pipe status at SPI end. For completion of read, read all data
at the USB end signifies the end of transfer.
value = bit 15 - scbIndex */
CY_JTAG_ENABLE_CMD = 0xD0, /* Enable JTAG module */
CY_JTAG_DISABLE_CMD, /* Disable JTAG module */
CY_JTAG_READ_CMD, /* JTAG read vendor command */
CY_JTAG_WRITE_CMD, /* JTAG write vendor command */
CY_GPIO_GET_CONFIG_CMD = 0xD8, /* Get the GPIO configuration: */
CY_GPIO_SET_CONFIG_CMD, /* Set the GPIO configuration */
CY_GPIO_GET_VALUE_CMD, /* Get GPIO value: */
CY_GPIO_SET_VALUE_CMD, /* Set the GPIO value:*/
CY_PROG_USER_FLASH_CMD = 0xE0, /*Program user flash area. The total space available is 512 bytes.
This can be accessed by the user from USB. The flash area
address offset is from 0x0000 to 0x00200 and can be written to
page wise (128 byte).*/
CY_READ_USER_FLASH_CMD, /*Read user flash area. The total space available is 512 bytes.
This can be accessed by the user from USB. The flash area
address offset is from 0x0000 to 0x00200 and can be written to
page wise (128 byte).*/
CY_DEVICE_RESET_CMD = 0xE3, /*Performs a device reset from firmware*/
} CY_VENDOR_CMDS;
//JTAG related Macros
#define CY_JTAG_OUT_EP 0x04
#define CY_JTAG_IN_EP 0x85
//GPIO related Macros
#define CY_GPIO_GET_LEN 2
#define CY_GPIO_SET_LEN 1
//PHDC related macros
#define CY_PHDC_GET_STATUS_LEN 2
#define CY_PHDC_CLR_FEATURE_WVALUE 0x1
#define CY_PHDC_SET_FEATURE_WVALUE 0x0101

View File

@@ -1,18 +0,0 @@
all:
gcc -fPIC -g -Wall -o libcyusb.o -c cyusb.c -I ../../common/header
gcc -fPIC -g -Wall -o libcyuart.o -c cyuart.c -I ../../common/header
gcc -fPIC -g -Wall -o libcyi2c.o -c cyi2c.c -I ../../common/header
gcc -fPIC -g -Wall -o libcyspi.o -c cyspi.c -I ../../common/header
gcc -fPIC -g -Wall -o libcyphdc.o -c cyphdc.c -I ../../common/header
gcc -fPIC -g -Wall -o libcyjtag.o -c cyjtag.c -I ../../common/header
gcc -fPIC -g -Wall -o libcymisc.o -c cymisc.c -I ../../common/header
gcc -shared -g -Wl,-soname,libcyusbserial.so -o libcyusbserial.so.1 libcyusb.o libcyuart.o libcyi2c.o libcyspi.o libcyphdc.o libcyjtag.o libcymisc.o -l usb-1.0
cp libcyusbserial.so.1 /usr/local/lib
ln -sf /usr/local/lib/libcyusbserial.so.1 /usr/local/lib/libcyusbserial.so
ldconfig
rm -f libcyusb.o libcyuart.o libcyspi.o libcyi2c.o libcyphdc.o libcyjtag.o libcymisc.o
clean:
rm -f libcyusbserial.so libcyusbserial.so.1
help:
@echo 'make would compile and create the library and create a link'
@echo 'make clean would remove the library and the soft link to the library (soname)'

View File

@@ -1,29 +0,0 @@
========================================================================================
Cypress Semiconductor Corporation
CyUSB Serial library.
=========================================================================================
Pre-requisite:
1. libusb-1.0.9 is required for compilation and functioning of the APIs in the library.
2. GNU Make and the GCC tool-chain are used for the build process.
Installation steps:
1.cd to the main directory where library source files are extracted and type
'sudo make'
2.This will generate shared library libcyusbserial.so.1 and its soft link libcyusbserial.so.
Both of them will be copied/installed to /usr/local/lib.
3.Application can link and start using the library.
Changing USB device node permission:
**Note:
By default the USB device node created in linux do not have read/write permission
for normal user. In order to make the USB device node accessable, copy 90-cyusb.rules
which is inside the library folder of release package to /etc/udev/rules.d folder (Default VID mentioned is Cypress VID
which is 0x4B4, if VID is changed then update it in ATTR{idVendor} section of rules file).

View File

@@ -1,690 +0,0 @@
/*
* I2C routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
#pragma pack(1)
typedef struct
{
UINT32 frequency; /* Frequency of operation. Only valid values are
100KHz and 400KHz. */
UINT8 sAddress; /* Slave address to be used when in slave mode. */
BOOL isMsbFirst; /* Whether to transmit most significant bit first. */
BOOL isMaster; /* Whether to block is to be configured as a master:
CyTrue - The block functions as I2C master;
CyFalse - The block functions as I2C slave. */
BOOL sIgnore; /* Ignore general call in slave mode. */
BOOL clockStretch; /* Wheteher to stretch clock in case of no FIFO availability. */
BOOL isLoopback; /* Whether to loop back TX data to RX. Valid only
for debug purposes. */
UCHAR reserved[6]; /*Reserved for future use*/
} CyUsI2cConfig_t;
#pragma pack()
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
struct timeval startTimeWrite, endTimeWrite, startTimeRead, endTimeRead;
//Timer helper functions for proper timing
void startI2cTick (bool isWrite) {
if (isWrite)
gettimeofday (&startTimeWrite, NULL);
else
gettimeofday (&startTimeRead, NULL);
}
UINT32 getI2cLapsedTime (bool isWrite){
signed int currentTime_sec, currentTime_usec, currentTime;
if (isWrite){
gettimeofday (&endTimeWrite, NULL);
currentTime_sec = (endTimeWrite.tv_sec - startTimeWrite.tv_sec) * 1000;
currentTime_usec = ((endTimeWrite.tv_usec - startTimeWrite.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
else{
gettimeofday (&endTimeRead, NULL);
currentTime_sec = (endTimeRead.tv_sec - startTimeRead.tv_sec) * 1000;
currentTime_usec = ((endTimeRead.tv_usec - startTimeRead.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
}
#endif
CY_RETURN_STATUS handleI2cError (UINT8 i2cStatus){
if (i2cStatus & CY_I2C_NAK_ERROR_BIT){
CY_DEBUG_PRINT_ERROR ("CY:Error Nacked by device ...Function is %s\n", __func__);
return CY_ERROR_I2C_NAK_ERROR;
}
if (i2cStatus & CY_I2C_BUS_ERROR_BIT){
CY_DEBUG_PRINT_ERROR ("CY:Error bus error occured... Function is %s\n", __func__);
return CY_ERROR_I2C_BUS_ERROR;
}
if (i2cStatus & CY_I2C_ARBITRATION_ERROR_BIT){
CY_DEBUG_PRINT_ERROR ("CY:Error Arbitration error occured.. Function is %s\n", __func__);
return CY_ERROR_I2C_ARBITRATION_ERROR;
}
if (i2cStatus & CY_I2C_STOP_BIT_ERROR){
CY_DEBUG_PRINT_ERROR ("CY:Error Stop bit set by master..Function is %s\n", __func__);
return CY_ERROR_I2C_STOP_BIT_SET;
}
else {
//We should never hit this case!!!!
CY_DEBUG_PRINT_ERROR ("CY:Unknown error..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
//Used internally by read and write API to check if data is received at the I2C end.
CY_RETURN_STATUS CyI2cGetStatus (CY_HANDLE handle, bool mode, UCHAR *i2cStatus);
CY_RETURN_STATUS waitForNotification (CY_HANDLE handle, UINT16 *bytesPending, UINT32 ioTimeout);
/*
This API gets the current I2C config
for the particluar interface of the device
*/
CY_RETURN_STATUS CyGetI2cConfig (
CY_HANDLE handle,
CY_I2C_CONFIG *i2cConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CyUsI2cConfig_t localI2cConfig;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (i2cConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_I2C_GET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0x00;
wLength = CY_I2C_CONFIG_LENGTH;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localI2cConfig, wLength, ioTimeout);
if (rStatus == CY_I2C_CONFIG_LENGTH){
CY_DEBUG_PRINT_INFO ("CY: Read I2C config ...size is %d \n", rStatus);
i2cConfig->frequency = localI2cConfig.frequency;
i2cConfig->slaveAddress = localI2cConfig.sAddress;
i2cConfig->isMaster = localI2cConfig.isMaster;
i2cConfig->isClockStretch = localI2cConfig.clockStretch;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error time out ....Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API sets I2C config of the device for that
interface
*/
CY_RETURN_STATUS CySetI2cConfig (
CY_HANDLE handle,
CY_I2C_CONFIG *i2cConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
CyUsI2cConfig_t localI2cConfig;
int rStatus;
CY_DEVICE *device = NULL;
libusb_device_handle *devHandle;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (i2cConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (i2cConfig->frequency < 1000 || i2cConfig->frequency > 400000){
CY_DEBUG_PRINT_ERROR ("CY:Error frequency trying to set in out of ..range Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if ((i2cConfig->slaveAddress % 2) != 0){
CY_DEBUG_PRINT_ERROR ("CY:Error slave address needs to even..Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
scbIndex = device->interfaceNum;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_SET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0x00;
wLength = CY_I2C_CONFIG_LENGTH;
//We need to pass entire 16 bytes config structure to firmware
//but we will not expose all the structure elements to user.
//so filling some of the values.
memset (&localI2cConfig, 0, CY_I2C_CONFIG_LENGTH);
localI2cConfig.frequency = i2cConfig->frequency;
localI2cConfig.sAddress = i2cConfig->slaveAddress;
localI2cConfig.isMaster = i2cConfig->isMaster;
localI2cConfig.clockStretch = i2cConfig->isClockStretch;
localI2cConfig.isMsbFirst = 1;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localI2cConfig, wLength, ioTimeout);
if (rStatus == CY_I2C_CONFIG_LENGTH){
CY_DEBUG_PRINT_INFO ("CY: Setting I2C config successful ...\n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error time out ....Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API reads I2C data from the specified interface of the device
interface
*/
CY_RETURN_STATUS CyI2cRead (
CY_HANDLE handle,
CY_I2C_DATA_CONFIG *i2cDataConfig,
CY_DATA_BUFFER *readBuffer,
UINT32 ioTimeout
)
{
int rStatus;
CY_DEVICE *device = NULL;
libusb_device_handle *devHandle;
UINT16 wValue = 0, wIndex, wLength, bytesPending = 0;
UINT8 bmRequestType, bmRequest;
UCHAR i2cStatus[CY_I2C_GET_STATUS_LEN];
UINT16 scbIndex = 0;
bool mode = CY_I2C_MODE_READ;
UINT32 elapsedTime;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((readBuffer == NULL) || (readBuffer->buffer == NULL) || (readBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
readBuffer->transferCount = 0;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_trylock (&device->readLock) == 0){
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
i2cDataConfig->slaveAddress = ((i2cDataConfig->slaveAddress & 0x7F) | (scbIndex << 7));
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_READ_CMD;
wValue = ((i2cDataConfig->isStopBit) | (i2cDataConfig->isNakBit << 1));
wValue |= (((i2cDataConfig->slaveAddress) << 8));
wIndex = readBuffer->length;
wLength = 0;
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_ERROR ("CY:Error device busy ... function is %s \n", __func__);
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
}
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == LIBUSB_ERROR_NO_DEVICE){
CY_DEBUG_PRINT_ERROR ("CY:Error device disconnected ... \n");
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending Read vendor command ... Libusb Error is %d .. Function is %s \n", rStatus, __func__);
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
//Hoping that previous calls do not take much time!!
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
startI2cTick(false);
#endif
rStatus = libusb_bulk_transfer (devHandle, device->inEndpoint, readBuffer->buffer, readBuffer->length,
(int*)&readBuffer->transferCount, ioTimeout);
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
elapsedTime = getI2cLapsedTime(false);
//Giving an extra 10 msec to notification to findout the status
ioTimeout = (ioTimeout - elapsedTime);
if (ioTimeout == 0)
ioTimeout = 10;
#endif
if (rStatus == LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY: Successfully read i2c data.. %d bytes Read ...\n", readBuffer->transferCount);
bytesPending = readBuffer->length;
rStatus = waitForNotification (handle, &bytesPending, ioTimeout);
if (rStatus)
readBuffer->transferCount = (readBuffer->length - bytesPending);
else
readBuffer->transferCount = readBuffer->length;
pthread_mutex_unlock (&device->readLock);
return rStatus;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Timeout error ..Function is %s\n", __func__);
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_INFO ("Pipe Error \n");
rStatus = CyResetPipe (handle, device->outEndpoint);
if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("Error in reseting the pipe \n");
}
else
CY_DEBUG_PRINT_INFO ("Reset pipe succeded \n");
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
CyI2cReset (handle, mode);
rStatus = handleI2cError (i2cStatus[0]);
pthread_mutex_unlock (&device->readLock);
return rStatus;
}
else {
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
pthread_mutex_unlock (&device->readLock);
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
pthread_mutex_unlock (&device->readLock);
CY_DEBUG_PRINT_ERROR ("CY:Error time out ....Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
pthread_mutex_unlock (&device->readLock);
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
else{
CY_DEBUG_PRINT_ERROR ("CY: Error API busy in servicing previous request... function is %s!\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API writes I2C data into the specified interface of the device
*/
CY_RETURN_STATUS CyI2cWrite (
CY_HANDLE handle,
CY_I2C_DATA_CONFIG *i2cDataConfig,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout
)
{
int rStatus;
UCHAR i2cStatus[CY_I2C_GET_STATUS_LEN];
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue = 0, wIndex, wLength, bytesPending = 0;
UINT8 bmRequestType, bmRequest;
UINT16 scbIndex = 0;
BOOL mode = CY_I2C_MODE_WRITE;
UINT32 elapsedTime;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((writeBuffer == NULL) || (writeBuffer->buffer == NULL) || (writeBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
writeBuffer->transferCount = 0;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
scbIndex = device->interfaceNum;
if (device->deviceType != CY_TYPE_I2C){
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_trylock (&device->writeLock) == 0){
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_WRITE_CMD;
i2cDataConfig->slaveAddress = ((i2cDataConfig->slaveAddress & 0x7F) | (scbIndex << 7));
wValue = ((i2cDataConfig->isStopBit));
wValue |= (((i2cDataConfig->slaveAddress) << 8));
wIndex = (UINT16)(writeBuffer->length);
wLength = 0;
CY_DEBUG_PRINT_INFO ("wValue is %x \n", wValue);
//Send I2C write vendor command before actually sending the data over bulk ep
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Device busy ... function is %s \n", __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE){
CY_DEBUG_PRINT_ERROR ("CY:Error device not found \n");
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == LIBUSB_ERROR_NO_DEVICE){
CY_DEBUG_PRINT_ERROR ("CY:Error device not found \n");
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending write vendor command ... Libusb Error is %d \n", rStatus);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
//After vendor command is sent send the actual data to be sent to i2c devic
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
startI2cTick(true);
#endif
rStatus = libusb_bulk_transfer (devHandle, device->outEndpoint, writeBuffer->buffer, writeBuffer->length,
(int*)&(writeBuffer->transferCount), ioTimeout);
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
elapsedTime = getI2cLapsedTime(true);
ioTimeout = (ioTimeout - elapsedTime);
//Giving an extra 10 msec to notification to findout the status
if (ioTimeout == 0)
ioTimeout = 10;
#endif
//Once the data is sent to usbserial, check if it was actually written to i2c device.
if (rStatus == LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY: Successfully written i2c data.. %d bytes written ...\n", writeBuffer->transferCount);
bytesPending = writeBuffer->length;
rStatus = waitForNotification (handle, &bytesPending, ioTimeout);
if (rStatus)
writeBuffer->transferCount = (writeBuffer->length - bytesPending);
else
writeBuffer->transferCount = writeBuffer->length;
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
//Transaction is stallled when we hit some I2C error while the transfer
//was going on. After we hit this error clear stall and check why we hit this by
//CyGetStatus.
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_INFO ("CY:Pipe Error ... Function is %s\n", __func__);
rStatus = CyResetPipe (handle, device->outEndpoint);
if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in reseting the pipe ..Function is %s\n", __func__);
}
else
CY_DEBUG_PRINT_INFO ("Reset pipe succeded \n");
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
CyI2cReset (handle, mode);
rStatus = handleI2cError (i2cStatus[0]);
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error time out ....Function is %s\n", __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_IO_TIMEOUT;
}
else{
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_REQUEST_FAILED;
}
}
else{
CY_DEBUG_PRINT_ERROR ("CY:API busy with servicing previous request... function is %s!\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
return CY_ERROR_REQUEST_FAILED;
}
/*
This Api gets the current status of the I2C data transaction
*/
CY_RETURN_STATUS CyI2cGetStatus (
CY_HANDLE handle,
bool mode,
UCHAR *i2cStatus
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
if (i2cStatus == NULL)
return CY_ERROR_INVALID_PARAMETER;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c .. \n");
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_I2C_GET_STATUS_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS) | mode);
wIndex = 0;
wLength = CY_I2C_GET_STATUS_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, (UCHAR*)i2cStatus, wLength, ioTimeout);
if (rStatus < CY_I2C_GET_STATUS_LEN){
CY_DEBUG_PRINT_INFO ("CY:Error in sending I2C Get Status command...Libusb error is %d\n", rStatus);
return rStatus;
}
return CY_SUCCESS;
}
/*
This Api resets the I2C module
*/
CY_RETURN_STATUS CyI2cReset (
CY_HANDLE handle,
BOOL resetMode
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c .. \n");
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_RESET_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS) | resetMode );
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending I2C Reset command ..libusb error is %d\n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
static void LIBUSB_CALL i2c_notification_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
CY_RETURN_STATUS waitForNotification (CY_HANDLE handle, UINT16 *bytesPending, UINT32 ioTimeout){
UINT32 transferCompleted = 0, length = CY_I2C_EVENT_NOTIFICATION_LEN;
CY_DEVICE *device;
libusb_device_handle *devHandle;
struct libusb_transfer *transfer;
CY_RETURN_STATUS errorStatus, rStatus;
UCHAR i2cStatus[CY_I2C_EVENT_NOTIFICATION_LEN];
struct timeval time;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
transfer = libusb_alloc_transfer(0);
if (transfer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error in allocating trasnfer \n");
errorStatus = CY_ERROR_ALLOCATION_FAILED;
(*bytesPending) = 0;
return errorStatus;
//callbackFn (errorStatus, 0);
}
libusb_fill_interrupt_transfer (transfer, devHandle, device->interruptEndpoint, i2cStatus, length,
i2c_notification_cb, &transferCompleted, ioTimeout);
if (libusb_submit_transfer (transfer)){
CY_DEBUG_PRINT_ERROR ("CY:Error in submitting interrupt transfer ...\n");
libusb_cancel_transfer (transfer);
libusb_free_transfer (transfer);
(*bytesPending) = 0;
//callbackFn (CY_ERROR_REQUEST_FAILED, 0);
return CY_ERROR_REQUEST_FAILED;
}
time.tv_sec = 0;
time.tv_usec = 50;//polling timeout.
while (transferCompleted == 0){
libusb_handle_events_timeout (NULL, &time);
}
transferCompleted = 0;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_INFO ("CY:Info successfully recieved data on interrupt pipe length is %d \n", transfer->actual_length);
if (i2cStatus[0] & 0x80){ //Error notification is for write
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_INFO ("Bytes pending is %x %x %x", i2cStatus[0], i2cStatus[1], i2cStatus[2]);
if (i2cStatus[0] & 0x1E){
//There was some error, so reset the i2c module and usb module
//of the device, so branch out of the loop(Check below for the errors reported).
rStatus = CyI2cReset (device, CY_I2C_MODE_WRITE);
if (rStatus != CY_SUCCESS)
CY_DEBUG_PRINT_INFO ("CY:i2c reset failed \n");
//Report the amount of byte that were actually written
memcpy(bytesPending, &i2cStatus[1], 2);
errorStatus = handleI2cError (i2cStatus[0]);
}
}
else
errorStatus = CY_SUCCESS;
}
else //Error notification is for read
{
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_INFO ("Bytes pending is %x %x %x", i2cStatus[0], i2cStatus[1], i2cStatus[2]);
if (i2cStatus[0] & 0x1E){
rStatus = CyI2cReset (device, CY_I2C_MODE_READ);
if (rStatus != CY_SUCCESS)
CY_DEBUG_PRINT_INFO ("CY:i2c reset failed \n");
//Report the amount of byte that were actually written
memcpy(bytesPending, &i2cStatus[1], 2);
errorStatus = handleI2cError (i2cStatus[0]);
}
}
else
errorStatus = CY_SUCCESS;
}
libusb_free_transfer (transfer);
return errorStatus;
}
else{
libusb_cancel_transfer (transfer);
if (transfer->status == LIBUSB_TRANSFER_TIMED_OUT){
CY_DEBUG_PRINT_ERROR ("CY:Error Timeout in getting i2c transfer status ....\n");
CyI2cGetStatus (handle, 1, (UCHAR *)&errorStatus);
errorStatus = CY_ERROR_IO_TIMEOUT;
}
if (transfer->status == LIBUSB_TRANSFER_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error buffer overFlow in i2c transfer status ....\n");
errorStatus = CY_ERROR_BUFFER_OVERFLOW;
}
if (transfer->status != LIBUSB_TRANSFER_COMPLETED || transfer->status != LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_ERROR ("CY:Error in i2c transfer status ... Libusb transfer error is %d \n", transfer->status);
errorStatus = CY_ERROR_REQUEST_FAILED;
}
libusb_free_transfer (transfer);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,247 +0,0 @@
/*
* JTAG routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
/*
* This API enables the Jtag module
*/
CY_RETURN_STATUS CyJtagEnable (
CY_HANDLE handle
)
{
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_ENABLE_CMD;
wValue = 0x00;
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus >= 0){
CY_DEBUG_PRINT_INFO ("CY: JTAG enable successfully \n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
* This API disables the Jtag module
*/
CY_RETURN_STATUS CyJtagDisable (
CY_HANDLE handle
)
{
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_DISABLE_CMD;
wValue = 0x00;
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus >= 0){
CY_DEBUG_PRINT_INFO ("CY: JTAG disable successfully \n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error while enabling JTAG ..\n");
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error while enabling JTAG ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
* This API is used to do jtag write
*/
CY_RETURN_STATUS CyJtagWrite (
CY_HANDLE handle,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout
)
{
int rStatus = 0;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((writeBuffer == NULL) || (writeBuffer->buffer == NULL) || (writeBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_WRITE_CMD;
wValue = writeBuffer->length;
wIndex = 0;
wLength = 0;
writeBuffer->transferCount = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY: JTAG Vendor command failed %d...function is %s \n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = libusb_bulk_transfer (devHandle, CY_JTAG_OUT_EP, writeBuffer->buffer, writeBuffer->length,
(int*)&(writeBuffer->transferCount), ioTimeout);
if ((rStatus == CY_SUCCESS)) {
CY_DEBUG_PRINT_ERROR ("CY: Number of bytes written is .... %d \n", writeBuffer->transferCount);
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error ...Function is %s %d\n", __func__, writeBuffer->transferCount);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Pipe error Function is %s \n", __func__);
CyResetPipe (handle, CY_JTAG_OUT_EP);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow..Function is %s \n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s \n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in Function %s...Libusb Error is %d !\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API is used to read JTAG data from device interface
*/
CY_RETURN_STATUS CyJtagRead (
CY_HANDLE handle,
CY_DATA_BUFFER *readBuffer,
UINT32 ioTimeout
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_READ_CMD;
wValue = readBuffer->length;
wIndex = 0;
wLength = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((readBuffer == NULL) || (readBuffer->buffer == NULL) || (readBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
readBuffer->transferCount = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_INFO ("CY: JTAG Vendor Command failed %d.. Function is %s \n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = libusb_bulk_transfer (devHandle, CY_JTAG_IN_EP, readBuffer->buffer, readBuffer->length,
(int*)&(readBuffer->transferCount), ioTimeout);
if (rStatus == CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY: Number of bytes read is .... %d \n", readBuffer->transferCount);
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error ...Function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Pipe error Function is %s \n", __func__);
CyResetPipe (handle, CY_JTAG_IN_EP);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow..Function is %s \n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s \n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function is %s ...Libusb Error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,584 +0,0 @@
/*
* Miscellaneous routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
typedef struct NOTIFICATION_CB_PARAM{
CY_HANDLE handle;
CY_EVENT_NOTIFICATION_CB_FN notificationCbFn;
}NOTIFICATION_CB_PARAM;
/*
This API is used to Read the Bootloder version
*/
CY_RETURN_STATUS CyGetFirmwareVersion(
CY_HANDLE handle,
CY_FIRMWARE_VERSION *firmwareVersion
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GET_VERSION_CMD;
wValue = 0x00;
wIndex = 0x00;
wLength = CY_GET_FIRMWARE_VERSION_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)firmwareVersion, wLength, ioTimeout);
if (rStatus > 0){
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
The API resets the device
*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyResetDevice (
CY_HANDLE handle /*Valid device handle*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle \n");
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_DEVICE_RESET_CMD;
wValue = 0xA6B6;
wIndex = 0xADBA;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
//return buffer will tell the status of the command
if (rStatus == LIBUSB_SUCCESS)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CySetGpioValue (
CY_HANDLE handle, /*Valid device handle*/
UINT8 gpioNumber, /*GPIO configuration value*/
UINT8 value /*Value that needs to be set*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest, buffer[CY_GPIO_SET_LEN];
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (value)
value = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GPIO_SET_VALUE_CMD;
wValue = gpioNumber;
wIndex = value;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, buffer, wLength, ioTimeout);
if (rStatus >= 0){
CY_DEBUG_PRINT_INFO ("CY: Get Configuration of GPIO succedded...size is %d \n", rStatus);
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyGetGpioValue (
CY_HANDLE handle, /*Valid device handle*/
UINT8 gpioNumber, /*GPIO configuration value*/
UINT8 *value /*Value that needs to be set*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest, buffer[CY_GPIO_GET_LEN];
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GPIO_GET_VALUE_CMD;
wValue = gpioNumber;
wIndex = 0x00;
wLength = CY_GPIO_GET_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, buffer, wLength, ioTimeout);
if (rStatus == CY_GPIO_GET_LEN){
CY_DEBUG_PRINT_INFO ("CY: Get GPIO Configuration succedded...size is %d \n", rStatus);
//return buffer will tell the status of the command
if (buffer[0] == 0){
(*value) = buffer[1];
return CY_SUCCESS;
}
else
return CY_ERROR_REQUEST_FAILED;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
static void LIBUSB_CALL uart_notification_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
void* uartSetEventNotifcation (void *inputParameters)
{
int rStatus, transferCompleted = 0, length = CY_UART_EVENT_NOTIFICATION_LEN;
CY_DEVICE *device;
libusb_device_handle *devHandle;
struct libusb_transfer *transfer;
UINT16 errorStatus = 0;
UCHAR uartStatus[CY_UART_EVENT_NOTIFICATION_LEN];
struct timeval time;
CY_EVENT_NOTIFICATION_CB_FN callbackFn;
NOTIFICATION_CB_PARAM *cbParameters = (NOTIFICATION_CB_PARAM*)inputParameters;
callbackFn = cbParameters->notificationCbFn;
device = (CY_DEVICE *)cbParameters->handle;
devHandle = device->devHandle;
callbackFn = cbParameters->notificationCbFn;
device->uartTransfer = transfer = libusb_alloc_transfer(0);
if (transfer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error in allocating trasnfer \n");
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn(errorStatus);
goto END;
}
while (device->uartCancelEvent == false){
libusb_fill_interrupt_transfer (transfer, devHandle, device->interruptEndpoint, uartStatus, length,
uart_notification_cb, &transferCompleted, CY_EVENT_NOTIFICATION_TIMEOUT);
rStatus = libusb_submit_transfer (transfer);
if (rStatus){
CY_DEBUG_PRINT_ERROR ("CY:Error submitting uart interrupt token ... Libusb error is %d\n", rStatus);
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn(errorStatus);
break;
}
time.tv_sec = 0;
time.tv_usec = 50;//polling timeout.
while (transferCompleted == 0){
libusb_handle_events_timeout (NULL, &time);
}
transferCompleted = 0;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_INFO ("Successfully read and recieved data %d \n", transfer->actual_length);
memcpy (&errorStatus, &uartStatus[8], 2);
printf ("%x %x ", uartStatus[8], uartStatus[9]);
callbackFn (errorStatus);
errorStatus = 0;
}
else{
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
if (device->uartCancelEvent == false){
CY_DEBUG_PRINT_ERROR ("CY:Error uart interrupt thread encountered error... Libusb transmission error is %d \n", transfer->status);
device->uartThreadId = 0;
callbackFn(errorStatus);
}
break;
}
}
CY_DEBUG_PRINT_INFO ("Exiting notification thread \n");
libusb_free_transfer (transfer);
END:
free (inputParameters);
return NULL;
}
static void LIBUSB_CALL spi_notification_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
void* spiSetEventNotifcation (void *inputParameters)
{
int transferCompleted = 0, length = CY_SPI_EVENT_NOTIFICATION_LEN;
CY_DEVICE *device;
libusb_device_handle *devHandle;
struct libusb_transfer *transfer;
UINT8 spiStatus = 0;
UINT16 errorStatus = 0;
struct timeval time;
CY_EVENT_NOTIFICATION_CB_FN callbackFn;
NOTIFICATION_CB_PARAM *cbParameters = (NOTIFICATION_CB_PARAM*)inputParameters;
callbackFn = cbParameters->notificationCbFn;
device = (CY_DEVICE *)cbParameters->handle;
devHandle = device->devHandle;
callbackFn = cbParameters->notificationCbFn;
device->spiTransfer = transfer = libusb_alloc_transfer(0);
if (transfer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error in allocating trasnfer \n");
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn (errorStatus);
goto END;
}
libusb_fill_interrupt_transfer (transfer, devHandle, device->interruptEndpoint, &spiStatus, length,
spi_notification_cb, &transferCompleted, CY_EVENT_NOTIFICATION_TIMEOUT);
while (device->spiCancelEvent == false){
if (libusb_submit_transfer (transfer)){
CY_DEBUG_PRINT_ERROR ("CY:Error submitting spi interrupt token ... \n");
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn(errorStatus);
break;
}
time.tv_sec = 0;
time.tv_usec = 50;//polling timeout.
while (transferCompleted == 0){
libusb_handle_events_timeout (NULL, &time);
}
transferCompleted = 0;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_INFO ("Successfully read and recieved data %d \n", transfer->actual_length);
if (spiStatus & CY_SPI_UNDERFLOW_ERROR){
errorStatus |= (CY_SPI_TX_UNDERFLOW_BIT);
}
if (spiStatus & CY_SPI_BUS_ERROR){
errorStatus |= (CY_SPI_BUS_ERROR_BIT);
}
callbackFn (errorStatus);
errorStatus = 0;
}
else{
spiStatus |= CY_ERROR_EVENT_FAILED_BIT;
if (device->spiCancelEvent == false){
device->spiThreadId = 0;
CY_DEBUG_PRINT_ERROR ("CY:Error spi interrupt thread was cancelled... Libusb transmission error is %d \n", transfer->status);
callbackFn (spiStatus);
}
break;
}
}
libusb_free_transfer (transfer);
END:
free (inputParameters);
pthread_exit (NULL);
return NULL;
}
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CySetEventNotification(
CY_HANDLE handle, /*Valid handle to communicate with device*/
CY_EVENT_NOTIFICATION_CB_FN notificationCbFn /*Call back function in case on error during Uart data transfers*/
)
{
CY_DEVICE *device;
NOTIFICATION_CB_PARAM *args = NULL;
int ret;
pthread_t threadID;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (notificationCbFn == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE*)handle;
pthread_mutex_lock (&device->notificationLock);
args = (NOTIFICATION_CB_PARAM *)malloc (sizeof (NOTIFICATION_CB_PARAM));
args->handle = handle;
args->notificationCbFn = notificationCbFn;
if (device->deviceType == CY_TYPE_SPI){
if (device->spiThreadId != 0) {
CY_DEBUG_PRINT_ERROR ("CY:Error already notification thread exists ... Function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_STATUS_MONITOR_EXIST;
}
ret = pthread_create (&threadID, NULL, spiSetEventNotifcation, (void *) args);
if (ret == 0){
device->spiThreadId = threadID;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else {
device->spiThreadId = 0;
free (args);
pthread_mutex_unlock (&device->notificationLock);
CY_DEBUG_PRINT_ERROR ("CY:Error creating spi notification thread ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
else if (device->deviceType == CY_TYPE_UART){
if (device->uartThreadId != 0) {
CY_DEBUG_PRINT_ERROR ("CY:Error already notification thread exists ... Function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_STATUS_MONITOR_EXIST;
}
ret = pthread_create (&threadID, NULL, uartSetEventNotifcation, (void *) args);
if (ret == 0){
device->uartThreadId = threadID;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else {
device->uartThreadId = 0;
free (args);
pthread_mutex_unlock (&device->notificationLock);
CY_DEBUG_PRINT_ERROR ("CY:Error creating uart notification thread ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error unknown device type ....Function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
}
/*The API is used to cancel the uart Event notification*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyAbortEventNotification(
CY_HANDLE handle /*Valid handle to communicate with device*/
)
{
CY_DEVICE *device;
device = (CY_DEVICE*)handle;
pthread_mutex_lock (&device->notificationLock);
if (device->deviceType == CY_TYPE_UART){
if ((device->uartThreadId == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error uart event notification not created ....function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
device->uartCancelEvent = true;
libusb_cancel_transfer (device->uartTransfer);
pthread_join (device->uartThreadId, NULL);
device->uartThreadId = 0;
device->uartCancelEvent = false;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else if (device->deviceType == CY_TYPE_SPI){
if ((device->spiThreadId == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error spi event notification not created ....function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
device->spiCancelEvent = true;
libusb_cancel_transfer (device->spiTransfer);
pthread_join (device->spiThreadId, NULL);
device->spiThreadId = 0;
device->spiCancelEvent = false;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error.. unknown device type ....function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
The API is used to programme user flash area
*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyProgUserFlash (
CY_HANDLE handle, /*Valid device handle*/
CY_DATA_BUFFER *progBuffer, /*data buffer containing buffer address, length to write*/
UINT32 flashAddress, /*Address to the data is written*/
UINT32 ioTimeout /*Timeout value of the API*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
if ((progBuffer == NULL) || (progBuffer->buffer == NULL))
return CY_ERROR_INVALID_PARAMETER;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_PROG_USER_FLASH_CMD;
wValue = 0;
wIndex = flashAddress;
wLength = progBuffer->length;
CY_DEBUG_PRINT_INFO ("CY:The Length is %d , Value is %d and index is %d\n", wLength, wValue, wIndex);
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, progBuffer->buffer, wLength, ioTimeout);
if (rStatus > 0){
(progBuffer->transferCount) = rStatus;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
(progBuffer->transferCount) = 0;
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
(progBuffer->transferCount) = 0;
return CY_ERROR_REQUEST_FAILED;
}
}
/*
The API is used to programme user flash area
*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyReadUserFlash (
CY_HANDLE handle, /*Valid device handle*/
CY_DATA_BUFFER *readBuffer, /*data buffer containing buffer address, length to write*/
UINT32 flashAddress, /*Address to the data is written*/
UINT32 ioTimeout /*Timeout value of the API*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
if ((readBuffer == NULL) || (readBuffer == NULL))
return CY_ERROR_INVALID_PARAMETER;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_READ_USER_FLASH_CMD;
wValue = 0;
wIndex = flashAddress;
wLength = readBuffer->length;
CY_DEBUG_PRINT_INFO ("CY:The Length is %d , Value is %d and index is %d\n", wLength, wValue, wIndex);
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, readBuffer->buffer, wLength, ioTimeout);
if (rStatus > 0){
(readBuffer->transferCount) = rStatus;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
(readBuffer->transferCount) = 0;
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
(readBuffer->transferCount) = 0;
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api is used to get the signature of the device. It would be CYUS when we are in actual device mode
and CYBL when we are bootloader modeñ
*/
CY_RETURN_STATUS CyGetSignature (
CY_HANDLE handle,
UCHAR *signature
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GET_SIGNATURE_CMD;
wValue = 0x00;
wIndex = 0x00;
wLength = CY_GET_SIGNATURE_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)signature, wLength, ioTimeout);
if (rStatus > 0){
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,130 +0,0 @@
/*
* PHDC routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
/*
PHDC clear feature
*/
CY_RETURN_STATUS CyPhdcClrFeature (CY_HANDLE handle)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_PHDC_CLR_FEATURE;
wValue = CY_PHDC_CLR_FEATURE_WVALUE;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == 0)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/*
PHDC set feature
*/
CY_RETURN_STATUS CyPhdcSetFeature (CY_HANDLE handle)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_PHDC_SET_FEATURE;
wValue = CY_PHDC_SET_FEATURE_WVALUE;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == 0)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
PHDC clear feature
*/
CY_RETURN_STATUS CyPhdcGetStatus (CY_HANDLE handle, UINT16 *dataStatus)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_CLASS_INTERFACE_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_PHDC_GET_DATA_STATUS;
wValue = 0x00;
wIndex = device->interfaceNum;
wLength = CY_PHDC_GET_STATUS_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)dataStatus, wLength, ioTimeout);
if (rStatus > 0)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,644 +0,0 @@
/*
* SPI routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
#include <signal.h>
#include <sys/time.h>
#pragma pack (1)
typedef struct args {
CY_HANDLE handle;
UCHAR *readBuffer;
UINT32 length;
UINT32 ioTimeout;
CY_RETURN_STATUS rStatus;
UINT32 transferCount;
}args;
typedef struct
{
UINT32 frequency;
UINT8 dataWidth;
UCHAR mode;
UCHAR xferMode;
BOOL isMsbFirst;
BOOL isMaster;
BOOL isContinuous;
BOOL isSelectPrecede;
BOOL cpha;
BOOL cpol;
BOOL isLoopback;
UCHAR reserver[2];
} CyUsSpiConfig_t;
#pragma pack()
struct timeval startSpiTimeWrite, endSpiTimeWrite, startSpiTimeRead, endSpiTimeRead;
//Timer helper functions for proper timing
void startSpiTick (bool isWrite) {
if (isWrite)
gettimeofday (&startSpiTimeWrite, NULL);
else
gettimeofday (&startSpiTimeRead, NULL);
}
UINT32 getSpiLapsedTime (bool isWrite){
signed int currentTime_sec, currentTime_usec, currentTime;
if (isWrite){
gettimeofday (&endSpiTimeWrite, NULL);
currentTime_sec = (endSpiTimeWrite.tv_sec - startSpiTimeWrite.tv_sec) * 1000;
currentTime_usec = ((endSpiTimeWrite.tv_usec - startSpiTimeWrite.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
else{
gettimeofday (&endSpiTimeRead, NULL);
currentTime_sec = (endSpiTimeRead.tv_sec - startSpiTimeRead.tv_sec) * 1000;
currentTime_usec = ((endSpiTimeRead.tv_usec - startSpiTimeRead.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
}
/*
This API gets the current SPI config
for the particluar interface of the device
*/
CY_RETURN_STATUS CyGetSpiConfig (
CY_HANDLE handle,
CY_SPI_CONFIG *spiConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
CyUsSpiConfig_t localSpiConfig;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (spiConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not spi ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (device->interfaceNum > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_SPI_GET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_SPI_CONFIG_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localSpiConfig, wLength, ioTimeout);
if (rStatus == CY_SPI_CONFIG_LEN){
//CY_DUMP_DATA ((unsigned char*)&localSpiConfig, wLength);
CY_DEBUG_PRINT_INFO ("CY: Read SPI config successfully %d\n", rStatus);
spiConfig->frequency = localSpiConfig.frequency;
spiConfig->dataWidth = localSpiConfig.dataWidth;
spiConfig->protocol = localSpiConfig.mode;
spiConfig->isMsbFirst = localSpiConfig.isMsbFirst;
spiConfig->isMaster = localSpiConfig.isMaster;
spiConfig->isContinuousMode = localSpiConfig.isContinuous;
spiConfig->isSelectPrecede = localSpiConfig.isSelectPrecede;
spiConfig->isCpha = localSpiConfig.cpha;
spiConfig->isCpol = localSpiConfig.cpol;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ... Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s...libusb error is %d !\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API sets SPI config of the device for that
interface
*/
CY_RETURN_STATUS CySetSpiConfig (
CY_HANDLE handle,
CY_SPI_CONFIG *spiConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
CyUsSpiConfig_t localSpiConfig;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (spiConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (spiConfig->frequency < 1000 || spiConfig->frequency > 3000000){
CY_DEBUG_PRINT_ERROR ("CY:Error frequency trying to set in out of range ... Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (spiConfig->protocol == CY_SPI_TI){
if (!(spiConfig->isCpol == false && spiConfig->isCpha == true && spiConfig->isContinuousMode == false)){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Wrong configuration for SPI TI mode \n");
return CY_ERROR_REQUEST_FAILED;
}
}
if (spiConfig->protocol == CY_SPI_NS){
if (!(spiConfig->isCpol == false && spiConfig->isCpha == false && spiConfig->isSelectPrecede == false)){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Wrong configuration for SPI ti mode \n");
return CY_ERROR_REQUEST_FAILED;
}
}
else{
if (spiConfig->isSelectPrecede != false){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Wrong configuration for SPI motorola mode \n");
return CY_ERROR_REQUEST_FAILED;
}
}
if (device->interfaceNum > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SPI_SET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_SPI_CONFIG_LEN;
//We will not expose all the spi config structure elements to user.
//Fill in rest of the values.
memset (&localSpiConfig, 0, CY_SPI_CONFIG_LEN);
localSpiConfig.frequency = spiConfig->frequency;
localSpiConfig.dataWidth = spiConfig->dataWidth;
localSpiConfig.mode = spiConfig->protocol;
localSpiConfig.isMsbFirst = spiConfig->isMsbFirst;
localSpiConfig.isMaster = spiConfig->isMaster;
localSpiConfig.isContinuous = spiConfig->isContinuousMode;
localSpiConfig.isSelectPrecede = spiConfig->isSelectPrecede;
localSpiConfig.cpha = spiConfig->isCpha;
localSpiConfig.cpol = spiConfig->isCpol;
//CY_DUMP_DATA ((unsigned char*)&localSpiConfig, wLength);
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localSpiConfig, wLength, ioTimeout);
if (rStatus == CY_SPI_CONFIG_LEN){
CY_DEBUG_PRINT_INFO ("CY: Setting SPI config success ...\n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ... !libusb error is %d\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*Api will reset the spi module*/
CY_RETURN_STATUS CySpiReset (CY_HANDLE handle)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_SPI_RESET_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS));
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending spi reset command...Libusb error is %d\n", rStatus);
return rStatus;
}
return CY_SUCCESS;
}
/*
This API reads SPI data from the specified interface of the device
interface
*/
static void LIBUSB_CALL spi_read_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
//We adopted for async method here because there are 2 thread polling same fd
// i.e both read and write are polling same fd when one event triggers and other one is
//not completed then another thread will wait for more than 60sec.
CY_RETURN_STATUS CySpiRead (
CY_HANDLE handle,
CY_DATA_BUFFER *readBuffer,
UINT32 ioTimeout
)
{
struct libusb_transfer *readTransfer;
CY_DEVICE *device;
libusb_device_handle *devHandle;
int readCompleted = 0;
struct timeval time;
int r;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
readBuffer->transferCount = 0;
readTransfer = libusb_alloc_transfer(0);
if (readTransfer == NULL){
CY_DEBUG_PRINT_ERROR("CY:Error in allocating transfers \n");
return CY_ERROR_ALLOCATION_FAILED;
}
libusb_fill_bulk_transfer(readTransfer, devHandle, device->inEndpoint, readBuffer->buffer, readBuffer->length,
spi_read_cb, &readCompleted, ioTimeout);
libusb_submit_transfer (readTransfer);
time.tv_sec = (ioTimeout / 1000);
time.tv_usec = ((ioTimeout % 1000) * 1000);//polling timeout.
while (readCompleted == 0){
r = libusb_handle_events_timeout_completed(NULL, &time, &readCompleted);
if (r < 0) {
if (r == LIBUSB_ERROR_INTERRUPTED)
continue;
libusb_cancel_transfer(readTransfer);
while (!readCompleted)
if (libusb_handle_events_completed(NULL, &readCompleted) < 0)
break;
readBuffer->transferCount = readTransfer->actual_length;
libusb_free_transfer(readTransfer);
return r;
}
}
if ((readTransfer->status == LIBUSB_TRANSFER_COMPLETED)){
readBuffer->transferCount = readTransfer->actual_length;
libusb_free_transfer (readTransfer);
return CY_SUCCESS;
}
else{
if (readTransfer->status == LIBUSB_TRANSFER_TIMED_OUT){
//We should not be hitting this case.. As the time out is infinite!!
CY_DEBUG_PRINT_ERROR ("CY:Timeout error in doing SPI read/write .... %d Libusb errors %d\n",
readTransfer->actual_length,readTransfer->status);
readBuffer->transferCount = readTransfer->actual_length;
CySpiReset (handle);
libusb_free_transfer (readTransfer);
return CY_ERROR_IO_TIMEOUT;
}
if (readTransfer->status == LIBUSB_TRANSFER_OVERFLOW){
//Need to handle this properly!
CY_DEBUG_PRINT_ERROR ("CY:OverFlow error in doing SPI read/write .... Libusb errors %d %d \n",
readTransfer->status, readTransfer->actual_length);
readBuffer->transferCount = readTransfer->actual_length;
CySpiReset (handle);
libusb_free_transfer (readTransfer);
return CY_ERROR_BUFFER_OVERFLOW;
}
if (readTransfer->status != LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_ERROR ("CY:Error in doing SPI read/write .... Libusb errors are %d %d\n",
readTransfer->status, readTransfer->actual_length);
readBuffer->transferCount = readTransfer->actual_length;
CySpiReset (handle);
libusb_free_transfer (readTransfer);
//If timer is not completed then it implies we have timeout error
return CY_ERROR_REQUEST_FAILED;
}
}
return CY_ERROR_REQUEST_FAILED;
}
/*Internal SPI get status API for Write operation*/
CY_RETURN_STATUS CyGetSpiStatus (CY_HANDLE handle,
int *spiStatus
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;;
UINT16 scbIndex = 0;
UINT32 ioTimeout = 0;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_SPI_GET_STATUS_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS));
wIndex = 0;
wLength = CY_SPI_GET_STATUS_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, (UCHAR*)spiStatus, wLength, ioTimeout);
if (rStatus < CY_SPI_GET_STATUS_LEN){
CY_DEBUG_PRINT_INFO ("CY:Error in sending spi Get Status command...Libusb error is %d\n", rStatus);
return rStatus;
}
return CY_SUCCESS;
}
/* Function to write on to SPI alone*/
CY_RETURN_STATUS CySpiWrite (
CY_HANDLE handle,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
int spiStatus = 1;
UINT32 newIoTimeout = ioTimeout, elapsedTime = 0, loopCount = 1;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
startSpiTick (true);
rStatus = libusb_bulk_transfer (devHandle, device->outEndpoint, writeBuffer->buffer, writeBuffer->length,
(int*)&(writeBuffer->transferCount), newIoTimeout);
elapsedTime = getSpiLapsedTime(true);
newIoTimeout = ioTimeout - elapsedTime;
//because we have a sleep of 1 msec after every getstatus
if (newIoTimeout)
loopCount = (newIoTimeout);
if ((rStatus == LIBUSB_SUCCESS)){
CY_DEBUG_PRINT_INFO ("CY: Successfully written SPI data.. %d bytes Read ...\n", writeBuffer->transferCount);
while (loopCount){
usleep (1000);
rStatus = CyGetSpiStatus (handle, &spiStatus);
if (rStatus == CY_SUCCESS){
if (spiStatus == 0){
return CY_SUCCESS;
}
}
else {
//Should never hit this case
CY_DEBUG_PRINT_ERROR ("CY:Error in getting spi status \n");
return CY_ERROR_REQUEST_FAILED;
}
if (ioTimeout)
loopCount--;
}
if (loopCount == 0 && spiStatus > 0){
writeBuffer->length = 0;
CySpiReset (handle);
return CY_ERROR_IO_TIMEOUT;
}
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error TimeOut ...function is %s\n", __func__);
CySpiReset (handle);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Error Pipe error..function is %s\n", __func__);
CySpiReset (handle);
CyResetPipe (handle, device->outEndpoint);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow...function is %s\n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY:Error Device Disconnected ...function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in writing SPI data ...Libusb Error is %d and bytes read is %d!\n", rStatus, writeBuffer->transferCount);
return CY_ERROR_REQUEST_FAILED;
}
return CY_ERROR_REQUEST_FAILED;
}/*
API to wrap up the data
*/
void spiCollectData (void *inputParameters) {
UINT32 readLength = 0, length;
CY_DATA_BUFFER readBuffer;
args *inputData = (args *) inputParameters;
UCHAR *buffer;
CY_RETURN_STATUS rStatus = CY_SUCCESS;
buffer = readBuffer.buffer = inputData->readBuffer;
length = readBuffer.length = inputData->length;
CY_HANDLE handle = inputData->handle;
int newTimeout = inputData->ioTimeout, elapsedTime;
while (readLength != length && newTimeout >= 0 && rStatus == CY_SUCCESS){
//Get current time
//Buffer is pointing to next address where we are suppose to fill the data
readBuffer.buffer = &buffer[readLength];
//Updated length which total length minus the total length of data read
readBuffer.length = length - readLength;
//Libusb fix for mac os!!
//ISSUE:when api times out in MAC it comes back and say read length = 0!!
#ifdef __APPLE__
if (readBuffer.length > 64)
readBuffer.length = 64;
#endif
startSpiTick (false);
rStatus = CySpiRead (handle, &readBuffer, newTimeout);
elapsedTime = getSpiLapsedTime (false);
//Do this only when newTimeout is non zero
if (newTimeout){
newTimeout = newTimeout - elapsedTime;
//If timeout is 0 then libusb considers that as infinite
//So forcefully make the loop to comeout
if (newTimeout <= 0)
rStatus = CY_ERROR_IO_TIMEOUT;
}
if (rStatus != CY_SUCCESS){
readLength += readBuffer.transferCount;
break;
}
readLength += readBuffer.transferCount;
}
if (readLength != length && rStatus == CY_ERROR_IO_TIMEOUT){
CySpiReset (handle);
}
inputData->transferCount = readLength;
inputData->rStatus = rStatus;
}
/*
* Api used to do read as well as write on spi
*/
CY_RETURN_STATUS CySpiReadWrite (CY_HANDLE handle,
CY_DATA_BUFFER *readBuffer,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout)
{
struct args threadParameter;
UINT32 ret;
pthread_t readThreadID = (pthread_t)0;
CY_DEVICE *device;
libusb_device_handle *devHandle;
CY_RETURN_STATUS rStatus;
unsigned short spiTransferMode = 0, scbIndex = 0;
UINT16 wValue, wIndex = 0, wLength;
UINT16 bmRequestType, bmRequest;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (readBuffer == NULL && writeBuffer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not spi .. \n");
return CY_ERROR_REQUEST_FAILED;
}
//Set both the bits and change it accordingly based on parameters parameters
spiTransferMode |= ((CY_SPI_READ_BIT) | (CY_SPI_WRITE_BIT));
if ((readBuffer == NULL || readBuffer->length == 0 || readBuffer->buffer == NULL))
spiTransferMode &= ~(CY_SPI_READ_BIT);
if ((writeBuffer == NULL || writeBuffer->length == 0 || writeBuffer->buffer == NULL))
spiTransferMode &= ~(CY_SPI_WRITE_BIT);
//if none of the bit is set it implies parameters sent is wrong
if (spiTransferMode == 0){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (device->interfaceNum > 0)
scbIndex = 1;
//In read only case we take length to be equal to readBuffer length.
//But in write or in write/read case we take length = writeBuffer length.
if (spiTransferMode == 0x1)
wIndex = readBuffer->length;
else
wIndex = writeBuffer->length;
spiTransferMode |= (scbIndex << 15);
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SPI_READ_WRITE_CMD;
wValue = (spiTransferMode);
wLength = 0;
if (pthread_mutex_trylock (&device->writeLock) == 0){
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, 5000);
if (rStatus){
CY_DEBUG_PRINT_ERROR ("CY:Error Sending spi read write vendor command failed ... Libusb error is %d\n", rStatus);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_REQUEST_FAILED;
}
//Read Bit is not set then write Only
if (!(spiTransferMode & CY_SPI_READ_BIT)) {
writeBuffer->transferCount = 0;
if (readBuffer)
readBuffer->transferCount = 0;
rStatus = CySpiWrite (handle, writeBuffer, ioTimeout);
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
//Write Bit is not set then read only
if (!(spiTransferMode & CY_SPI_WRITE_BIT)) {
// We are starting a thread so that we can collect all the data
// FIX for short length packet issue on SPI.
readBuffer->transferCount = 0;
if (writeBuffer)
writeBuffer->transferCount = 0;
threadParameter.handle = handle;
threadParameter.readBuffer = readBuffer->buffer;
threadParameter.length = readBuffer->length;
threadParameter.ioTimeout = ioTimeout;
ret = pthread_create (&readThreadID, NULL, (void *)spiCollectData, (void *)&threadParameter);
if (ret){
CY_DEBUG_PRINT_ERROR ("CY:Error in creating read thread ... Reading failed \n");
pthread_mutex_unlock (&device->writeLock);
readBuffer->transferCount = 0;
return CY_ERROR_REQUEST_FAILED;
}
pthread_join (readThreadID, NULL);
readBuffer->transferCount = threadParameter.transferCount;
pthread_mutex_unlock (&device->writeLock);
return threadParameter.rStatus;
}
writeBuffer->transferCount = 0;
readBuffer->transferCount = 0;
threadParameter.handle = handle;
threadParameter.readBuffer = readBuffer->buffer;
threadParameter.length = readBuffer->length;
threadParameter.ioTimeout = ioTimeout;
ret = pthread_create (&readThreadID, NULL, (void *)spiCollectData, (void *)&threadParameter);
if (ret){
CY_DEBUG_PRINT_ERROR ("CY:Error in creating read thread ... Reading failed \n");
readBuffer->transferCount = 0;
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = CySpiWrite (handle, writeBuffer, ioTimeout);
if (rStatus == CY_SUCCESS) {
pthread_join (readThreadID, NULL);
rStatus = threadParameter.rStatus;
readBuffer->transferCount = threadParameter.transferCount;
}
else {
pthread_join (readThreadID, NULL);
readBuffer->transferCount = threadParameter.transferCount;
}
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error API busy in service previous request ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
return rStatus;
}

View File

@@ -1,755 +0,0 @@
/*
* UART routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
#pragma pack(1)
typedef struct {
CY_UART_BAUD_RATE baudRate;
UINT8 pinType;
UINT8 dataWidth;
UINT8 stopBits;
UINT8 mode;
UINT8 parity;
UINT8 isMsbFirst;
UINT8 txRetry;;
UINT8 rxInvertPolarity;
UINT8 rxIgnoreError;
UINT8 isFlowControl;
UINT8 isLoopBack;
UINT8 flags;
}CyUsUartConfig_t;
#pragma pack()
#define MAX_DEVICE_EP_SIZE 64
/*
There is no way in the current library architecture
Data Queue size can exceed 4 Max EP size Pages.
*/
#define NO_DATA_QUEUE_PAGES 4
#define NUM_MAX_UART_SCB 2
typedef struct dtQueue{
UINT8 cyDataQueue[NO_DATA_QUEUE_PAGES * MAX_DEVICE_EP_SIZE];
UINT8 pHeadPosition;
UINT8 pTailPosition;
UINT16 nTotalAvailableData;
}CyDataQueue;
CyDataQueue gSimpleDataQueue[NUM_MAX_UART_SCB];
//Timer helper functions for proper timing
UINT32 getUartLapsedTime (struct timeval startTime){
signed int currentTime_sec, currentTime_usec, currentTime;
struct timeval endTime;
gettimeofday (&endTime, NULL);
currentTime_sec = (endTime.tv_sec - startTime.tv_sec) * 1000;
currentTime_usec = ((endTime.tv_usec - startTime.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
// Queue Helper Functions....
void GetDataFromTheQueue(
UINT8 scbIndex,
PCY_DATA_BUFFER cyDataBuffer
)
{
UINT16 headPos = gSimpleDataQueue[scbIndex].pHeadPosition;
UINT16 nCheckForWrapAround = 0;
UINT8* buffer = &gSimpleDataQueue[scbIndex].cyDataQueue[headPos];
UINT16 nMaxBufferSize = (NO_DATA_QUEUE_PAGES * MAX_DEVICE_EP_SIZE);
// Parameter Validation.
if (gSimpleDataQueue[scbIndex].nTotalAvailableData == 0 ) return; // No data in the queue to return.
// Is there any Memory space in the queue to add more.
if (gSimpleDataQueue[scbIndex].pHeadPosition == gSimpleDataQueue[scbIndex].pTailPosition ) return;
// Is this Invalid Parameters?
if (scbIndex > 1 || cyDataBuffer == NULL || cyDataBuffer->length == 0) return;
// Now make the transfer from the queue.
if (cyDataBuffer->length >= gSimpleDataQueue[scbIndex].nTotalAvailableData ) {
nCheckForWrapAround = (gSimpleDataQueue[scbIndex].pHeadPosition +
gSimpleDataQueue[scbIndex].nTotalAvailableData);
// Copy the data.
if (nCheckForWrapAround <= nMaxBufferSize )
{
memcpy(cyDataBuffer->buffer, buffer, gSimpleDataQueue[scbIndex].nTotalAvailableData);
cyDataBuffer->transferCount = gSimpleDataQueue[scbIndex].nTotalAvailableData;
}
else {
// Queue Wrap around occurred.
UINT16 bufferLen1 = nMaxBufferSize - (gSimpleDataQueue[scbIndex].pHeadPosition);
UINT16 bufferLen2 = gSimpleDataQueue[scbIndex].pTailPosition;
memcpy(cyDataBuffer->buffer, buffer, bufferLen1);
buffer = &gSimpleDataQueue[scbIndex].cyDataQueue[0];
memcpy(cyDataBuffer->buffer+bufferLen1, buffer, bufferLen2);
cyDataBuffer->transferCount = (bufferLen1 + bufferLen2);
}
// Reset the queue.
gSimpleDataQueue[scbIndex].pHeadPosition = 0;
gSimpleDataQueue[scbIndex].pTailPosition = 0;
gSimpleDataQueue[scbIndex].nTotalAvailableData = 0;
return;
}
// Here the available data buffer length is more than the requested
// transfer size.
nCheckForWrapAround = (gSimpleDataQueue[scbIndex].pHeadPosition +
cyDataBuffer->length);
// Copy the data.
if (nCheckForWrapAround <= nMaxBufferSize )
{
memcpy(cyDataBuffer->buffer, buffer, cyDataBuffer->length);
cyDataBuffer->transferCount = cyDataBuffer->length;
gSimpleDataQueue[scbIndex].pHeadPosition += cyDataBuffer->length;
}
else {
// Queue Wrap around occurred.
UINT16 bufferLen1 = nMaxBufferSize - (gSimpleDataQueue[scbIndex].pHeadPosition);
UINT16 bufferLen2 = cyDataBuffer->length - bufferLen1;
memcpy(cyDataBuffer->buffer, buffer, bufferLen1);
buffer = &gSimpleDataQueue[scbIndex].cyDataQueue[0];
memcpy(cyDataBuffer->buffer+bufferLen1, buffer, bufferLen2);
cyDataBuffer->transferCount = (bufferLen1 + bufferLen2);
gSimpleDataQueue[scbIndex].pHeadPosition = (UINT8)bufferLen2;
}
gSimpleDataQueue[scbIndex].nTotalAvailableData -= cyDataBuffer->length;
}
void AddDataToQueue(
UINT8 scbIndex,
UINT8* buffer,
UINT8 length
)
{
UINT16 tailPos = gSimpleDataQueue[scbIndex].pTailPosition;
UINT8* bufQueue = &gSimpleDataQueue[scbIndex].cyDataQueue[tailPos];
UINT16 nMaxBufferSize = (NO_DATA_QUEUE_PAGES * MAX_DEVICE_EP_SIZE);
// Parameter Validation.
if (gSimpleDataQueue[scbIndex].nTotalAvailableData >= nMaxBufferSize ) return; // No space in the queue.
// Is this Invalid Parameters?
if (scbIndex > 1 || buffer == NULL || length == 0) return;
// Can this new data addition happens?
if ( (gSimpleDataQueue[scbIndex].nTotalAvailableData + length) > nMaxBufferSize ) return;
if ((tailPos + length) <= nMaxBufferSize )
{
// Queue doesn't need wrap around for this new data addition.
memcpy(bufQueue, buffer, length);
gSimpleDataQueue[scbIndex].nTotalAvailableData += length;
gSimpleDataQueue[scbIndex].pTailPosition += length;
return;
}
else {
// Queue Wrap around occurred.
UINT16 bufferLen1 = nMaxBufferSize - (gSimpleDataQueue[scbIndex].pTailPosition);
UINT16 bufferLen2 = length - bufferLen1;
memcpy(bufQueue, buffer, bufferLen1);
bufQueue = &gSimpleDataQueue[scbIndex].cyDataQueue[0];
memcpy(bufQueue, buffer+bufferLen1, bufferLen2);
gSimpleDataQueue[scbIndex].pTailPosition = (UINT8)bufferLen2;
gSimpleDataQueue[scbIndex].nTotalAvailableData += length;
}
}
/*
This API gets the current UART configuration of the
device.Such as GPIO's assigned, flowcontrol, BaudRate
etc.
*/
CY_RETURN_STATUS CyGetUartConfig (
CY_HANDLE handle,
PCY_UART_CONFIG uartConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
CyUsUartConfig_t localUartConfig;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (uartConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (device->interfaceNum > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_UART_GET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_UART_CONFIG_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localUartConfig, wLength, ioTimeout);
//Since we are not exposing all the configuration elements
//parse and fill only relevant elements.
if (rStatus == CY_UART_CONFIG_LEN){
uartConfig->dataWidth = localUartConfig.dataWidth;
uartConfig->baudRate = localUartConfig.baudRate;
uartConfig->stopBits = localUartConfig.stopBits;
uartConfig->parityMode = (CY_UART_PARITY_MODE)localUartConfig.parity;;
uartConfig->isDropOnRxErrors = localUartConfig.rxIgnoreError;
//We are currently ignoring rest of the bits
CY_DEBUG_PRINT_INFO ("CY:Successfully read UART Config\n");
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error in reading UART config ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API sets the current UART configuration of the
device.Such as GPIO's assigned, flowcontrol, BaudRate
etc.
*/
CY_RETURN_STATUS CySetUartConfig (
CY_HANDLE handle,
CY_UART_CONFIG *uartConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CyUsUartConfig_t localUartConfig;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (uartConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (uartConfig->dataWidth < 7 || uartConfig->dataWidth > 8){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (uartConfig->stopBits < 1 || uartConfig->stopBits > 2){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->interfaceNum > 0)
scbIndex = 1;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_UART_SET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_UART_CONFIG_LEN;
memset(&gSimpleDataQueue[scbIndex], 0, sizeof(CyDataQueue));
memset (&localUartConfig, 0, CY_UART_CONFIG_LEN);
//Fill in rest of the UART config structure elements
//that are not exposed in API with default values
localUartConfig.baudRate = uartConfig->baudRate;
localUartConfig.dataWidth = uartConfig->dataWidth;
localUartConfig.stopBits = uartConfig->stopBits;
localUartConfig.parity = (UCHAR) uartConfig->parityMode;
localUartConfig.rxIgnoreError = uartConfig->isDropOnRxErrors;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localUartConfig, wLength, ioTimeout);
if (rStatus == CY_UART_CONFIG_LEN){
CY_DEBUG_PRINT_INFO ("CY:Successfully Set UART Config \n");
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error in Setting UART config ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api writes the Data to UART block of the
device.
*/
CY_RETURN_STATUS CyUartWrite (
CY_HANDLE handle,
CY_DATA_BUFFER* writeBuffer,
unsigned int ioTimeOut
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((writeBuffer == NULL) || (writeBuffer->buffer == NULL) || (writeBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameters..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
writeBuffer->transferCount = 0;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = libusb_bulk_transfer (devHandle, device->outEndpoint, writeBuffer->buffer, writeBuffer->length,
(int *)&((writeBuffer->transferCount)), ioTimeOut);
if ((rStatus == CY_SUCCESS)) {
CY_DEBUG_PRINT_INFO ("CY: SuccessFull in Wrting Data,%d bytes were transfered \n", (writeBuffer->transferCount));
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error ...Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Pipe error endpoint Halted ...Function is %s\n", __func__);
CyResetPipe (handle, device->outEndpoint);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow occured ...Function is %s\n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected .... Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Unknown error ....Libusb error is %d Function is %s\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api Reads the Data from UART block of the
device.
*/
CY_RETURN_STATUS CyUartRead (
CY_HANDLE handle,
CY_DATA_BUFFER* readBuffer,
unsigned int ioTimeOut
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 length, totalRead = 0, newIoTimeout = ioTimeOut, elapsedTime;
int transferCount;
UCHAR *buffer;
struct timeval startTime;
UINT8 scbIndex = 0;
UINT8 cyTempBuffer[64];
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((readBuffer == NULL) || (readBuffer->buffer == NULL) || (readBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameters..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
length = readBuffer->length;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
readBuffer->transferCount = 0;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (device->interfaceNum > 0)
scbIndex = 1;
if (gSimpleDataQueue[scbIndex].nTotalAvailableData > 0 )
{
// We already have the data read from the device.
// Provide this data to the API.
GetDataFromTheQueue(scbIndex, readBuffer);
if (readBuffer->length == readBuffer->transferCount) return CY_SUCCESS;
totalRead = readBuffer->transferCount;
length = (length - totalRead);
}
//Collect all the data in low baud rate for uart. As we get data in short packet
do {
// buffer will be pointing to new pointer
buffer = &(readBuffer->buffer[totalRead]);
//Start the tick
gettimeofday(&startTime, NULL);
rStatus = libusb_bulk_transfer (devHandle, device->inEndpoint, cyTempBuffer, MAX_DEVICE_EP_SIZE,
&transferCount, newIoTimeout);
elapsedTime = getUartLapsedTime(startTime);
//Get the new timeout.
newIoTimeout = newIoTimeout - elapsedTime;
if (transferCount <= length ) {
//Initialise totalRead to initially read + bytes returned now
totalRead += transferCount;
//length will initial length - transferCount
length = (length - transferCount);
memcpy(buffer, cyTempBuffer, transferCount);
}
else {
totalRead += length;
memcpy(buffer, cyTempBuffer, length);
AddDataToQueue(scbIndex, cyTempBuffer+length, (transferCount - length));
length = 0;
}
}while ((rStatus == CY_SUCCESS) && (totalRead != readBuffer->length) && (newIoTimeout > 0));
if (newIoTimeout <= 0 && totalRead != readBuffer->length)
rStatus = LIBUSB_ERROR_TIMEOUT;
if (rStatus == CY_SUCCESS){
//CY_DUMP_DATA (readBuffer->buffer, readBuffer->transferCount);
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_INFO ("CY: SuccessFull in Reading Data,%d bytes were transfered \n", (readBuffer->transferCount));
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error... Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY:Pipe error endpoint Halted ...Function is %s\n", __func__);
CyResetPipe (handle, device->inEndpoint);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow occured ...Function is %s\n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY: Unknown error ....Libusb error is %d Function is %s\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api sets the hardware flow control
*/
CY_RETURN_STATUS CyUartSetHwFlowControl (
CY_HANDLE handle,
CY_FLOW_CONTROL_MODES mode
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (mode < 0 || mode > 3){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_UART_SET_FLOW_CONTROL_CMD;
wValue |= mode;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in setting uart flow control ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
device->uartFlowControlMode = mode;
return CY_SUCCESS;
}
/*
Api gets the current flow control mode
*/
CY_RETURN_STATUS CyUartGetHwFlowControl (
CY_HANDLE handle,
CY_FLOW_CONTROL_MODES *mode
)
{
CY_DEVICE *device;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (mode == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameters..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
(*mode) = device->uartFlowControlMode;
return CY_SUCCESS;
}
/* The API is used to break
*/
CYWINEXPORT CY_RETURN_STATUS CyUartSetBreak(
CY_HANDLE handle, /*Valid handle to communicate with device*/
UINT16 timeout /*Break timeout value in milliseconds */
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_UART_SEND_BREAK_CMD;
wValue = timeout;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in setting break ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/*
This Api sets the RTS UART pins High
*/
CY_RETURN_STATUS CyUartSetRts (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue |= (1 << 1) | (device->dtrValue);
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->rtsValue = 1;
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in setting RTS of UART ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api clears the RTS UART pin and makes it low
*/
CY_RETURN_STATUS CyUartClearRts (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue = (device->dtrValue);
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->rtsValue = 0;
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in clearing RTS of UART ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api sets the DTR UART pin High
*/
CY_RETURN_STATUS CyUartSetDtr (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue = ((device->rtsValue) << 1) | 1;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->dtrValue = 1;
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in setting DTR of UART ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api clears the DTR UART pin and makes it low
*/
CY_RETURN_STATUS CyUartClearDtr (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue = ((device->rtsValue) << 1);
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->dtrValue = 0;
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error in function %s... Libusb Error is %d \n",__func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,630 +0,0 @@
/*
* USB routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
static bool glDriverInit = false;
static libusb_device **glDeviceList;
static UINT32 glNumDevices;
/*The API initializes the Libusb library
*/
pthread_mutex_t criticalSection;
CY_RETURN_STATUS CyLibraryInit ()
{
UINT32 rStatus;
rStatus = libusb_init (NULL);
if (glDriverInit != true){
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Driver Init Failed ...\n");
return CY_ERROR_DRIVER_INIT_FAILED;
}
glNumDevices = libusb_get_device_list (NULL, &glDeviceList);
if (glNumDevices < 0){
CY_DEBUG_PRINT_ERROR ("CY:Building device list Failed ...\n");
glNumDevices = -1;
return CY_ERROR_DRIVER_INIT_FAILED;
}
pthread_mutex_init (&criticalSection, NULL);
glDriverInit = true;
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error ... library already initialized \n");
return CY_ERROR_DRIVER_INIT_FAILED;
}
}
/*
This API needs to be called after Calling CyGetListofDevices.
*/
CY_RETURN_STATUS CyLibraryExit ()
{
if (glDriverInit == true){
if (glNumDevices >= 0)
libusb_free_device_list (glDeviceList, 1);
//This is to avoid loss of device handle issue with respect to libusb context.
//libusb_exit (NULL);
glDriverInit = false;
pthread_mutex_destroy (&criticalSection);
return CY_SUCCESS;
}
CY_DEBUG_PRINT_ERROR ("CY:Error ... Library not initialized \n");
return CY_ERROR_REQUEST_FAILED;
}
/*
* This function Gets the number of all the devices currently
* Connected to the host (It includes Cypress Device as well as
* no Cypress Devices connected)
*/
CY_RETURN_STATUS CyGetListofDevices (
UINT8 *numDevices
)
{
// Use this variable to call libusb_close and exit of the application
if (numDevices == NULL)
return CY_ERROR_INVALID_PARAMETER;
if (!glDriverInit){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
pthread_mutex_lock (&criticalSection);
libusb_free_device_list (glDeviceList, 1);
glNumDevices = (*numDevices) = libusb_get_device_list (NULL, &glDeviceList);
pthread_mutex_unlock (&criticalSection);
if (glNumDevices < 0){
CY_DEBUG_PRINT_ERROR ("CY:Building device list Failed ...function is %s\n", __func__);
glNumDevices = -1;
(*numDevices) = -1;
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/* This function gets all the neccessary info such as VID,PID,
String Descriptors and if is a cypress serial device you will
get the info on class and device type
*/
CY_RETURN_STATUS CyGetDeviceInfo (
UINT8 deviceNumber,
CY_DEVICE_INFO *deviceInfo
)
{
struct libusb_device_descriptor deviceDesc;
UINT32 rStatus, numInterfaces;
UINT8 iManufacturer, iProduct, iSerial;
libusb_device *usbDevice;;
struct libusb_config_descriptor *configDesc;
libusb_device_handle *devHandle;
// Get the list of descriptor info for the device
if (glDriverInit == false){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (deviceInfo == NULL)
return CY_ERROR_INVALID_PARAMETER;
pthread_mutex_lock (&criticalSection);
if (deviceNumber >= glNumDevices){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device number... \n");
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_INVALID_PARAMETER;
}
usbDevice = glDeviceList[deviceNumber];
rStatus = libusb_get_device_descriptor (usbDevice, &deviceDesc);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error ... unable to retrieve device descriptor \n");
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
deviceInfo->vidPid.vid = deviceDesc.idVendor;
deviceInfo->vidPid.pid = deviceDesc.idProduct;
// Get the all the index of the String descriptors so that it can be used
// to retrieve the string descriptor info.
iManufacturer = deviceDesc.iManufacturer;
iProduct = deviceDesc.iProduct;
iSerial = deviceDesc.iSerialNumber;
//Get the Device handle so that we can communicate with the device retreiving
// descriptor info
deviceInfo->manufacturerName[0] = '\0';
deviceInfo->productName[0] = '\0';
deviceInfo->serialNum[0] = '\0';
rStatus = libusb_open (usbDevice, &devHandle);
if (rStatus == LIBUSB_ERROR_ACCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error ...Insufficient permission... Libusb error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ACCESS_DENIED;
}
else if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in opening the device... Libusb error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
if (iManufacturer > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iManufacturer, deviceInfo->manufacturerName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting Manufacturer name Error is <%x> \n", rStatus);
}
}
if (iProduct > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iProduct, deviceInfo->productName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting product name Error is <%d> \n", rStatus);
}
}
if (iSerial > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iSerial, deviceInfo->serialNum, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting Serial name <%d>\n", rStatus);
}
}
rStatus = libusb_get_config_descriptor (usbDevice, 0, &configDesc);
if (rStatus == LIBUSB_SUCCESS){
UINT32 index_i = 0;
const struct libusb_interface *interface;
numInterfaces = configDesc->bNumInterfaces;
deviceInfo->numInterfaces = numInterfaces;
interface = configDesc->interface;
while ((numInterfaces) && (index_i < CY_MAX_DEVICE_INTERFACE)){
deviceInfo->deviceClass[index_i] = (CY_DEVICE_CLASS)interface->altsetting->bInterfaceClass;
if (deviceInfo->deviceClass[index_i] == CY_CLASS_VENDOR){
deviceInfo->deviceType[index_i] = (CY_DEVICE_CLASS)interface->altsetting->bInterfaceSubClass;
}
else
deviceInfo->deviceType[index_i] = CY_TYPE_DISABLED;
index_i++;
numInterfaces--;
interface++;
}
libusb_free_config_descriptor(configDesc);
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in Getting config descriptor ...Libusb error is %d \n", rStatus);
if (devHandle)
libusb_close (devHandle);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
if (devHandle)
libusb_close (devHandle);
pthread_mutex_unlock (&criticalSection);
return CY_SUCCESS;
}
/* This function gets all the neccessary info such as VID,PID,
String Descriptors and if is a cypress serial device you will
get the info on class and device type
*/
CY_RETURN_STATUS CyGetDeviceInfoVidPid (
CY_VID_PID vidPid,
UINT8 *deviceNumber,
PCY_DEVICE_INFO deviceInfoList,
UINT8 *deviceCount,
UINT8 infoListLength
)
{
struct libusb_device_descriptor deviceDesc;
UINT32 rStatus = CY_ERROR_DRIVER_INIT_FAILED, numInterfaces, index = 0, devNum;
uint8_t iManufacturer, iProduct, iSerial;
libusb_device *usbDevice;
struct libusb_config_descriptor *configDesc;
libusb_device_handle *devHandle = NULL;
PCY_DEVICE_INFO deviceInfo;
if (glDriverInit == false){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if ((infoListLength) < 1){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device info list length specified should be > 0 .. function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (deviceNumber == NULL || deviceInfoList == NULL || deviceCount == NULL)
return CY_ERROR_INVALID_PARAMETER;
// Get the list of descriptor info for the device
(*deviceCount) = 0;
pthread_mutex_lock (&criticalSection);
for (devNum = 0; devNum < glNumDevices; devNum++) {
//We are making sure that we do not overrun
//the list.
deviceInfo = &(deviceInfoList [index]);
usbDevice = glDeviceList[devNum];
rStatus = libusb_get_device_descriptor (usbDevice, &deviceDesc);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in getting device descriptor for device-%d... Libusb Error is %d \n", devNum, rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
if ((deviceDesc.idVendor != vidPid.vid) || (deviceDesc.idProduct != vidPid.pid)){
continue;
}
(*deviceCount)++;
if (index > infoListLength){
continue;
}
rStatus = libusb_open (usbDevice, &devHandle);
if (rStatus == LIBUSB_ERROR_ACCESS){
CY_DEBUG_PRINT_ERROR ("CY:Insufficient permission ... Libusb error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ACCESS_DENIED;
}
else if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Opening the Device ...Error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
deviceNumber[index] = devNum;
index++;
deviceInfo->vidPid.vid = deviceDesc.idVendor;
deviceInfo->vidPid.pid = deviceDesc.idProduct;
// Get all the index of the String descriptors so that it can be used
// to retrieve the string descriptor info.
iManufacturer = deviceDesc.iManufacturer;
iProduct = deviceDesc.iProduct;
iSerial = deviceDesc.iSerialNumber;
//Get the Device handle so that we can communicate with the device retreiving
// descriptor info
//Initialise manufacturer, product and serial names
deviceInfo->manufacturerName[0] = '\0';
deviceInfo->productName[0] = '\0';
deviceInfo->serialNum[0] = '\0';
if (iManufacturer > 0) {
rStatus = libusb_get_string_descriptor_ascii (devHandle, iManufacturer, deviceInfo->manufacturerName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:Error in Getting Manufacturer name Error is <%d> \n",rStatus);
}
}
if (iProduct > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iProduct, deviceInfo->productName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:Error in Getting product name Error is <%d> \n", rStatus);
}
}
if (iSerial > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iSerial, deviceInfo->serialNum, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:Error in Getting Serial name <%d>\n", rStatus);
}
}
CY_DEBUG_PRINT_INFO ("Manufacturer name <%s> \nProduct Name <%s> \nserial number <%s> \n",
deviceInfo->manufacturerName,deviceInfo->productName,deviceInfo->serialNum);
rStatus = libusb_get_config_descriptor (usbDevice, 0, &configDesc);
if (rStatus == LIBUSB_SUCCESS){
int index_i = 0;
const struct libusb_interface *interfaceDesc;
numInterfaces = configDesc->bNumInterfaces;
deviceInfo->numInterfaces = numInterfaces;
interfaceDesc = configDesc->interface;
while ((numInterfaces) && (index_i < CY_MAX_DEVICE_INTERFACE)){
deviceInfo->deviceClass[index_i] = (CY_DEVICE_CLASS)interfaceDesc->altsetting->bInterfaceClass;
if (deviceInfo->deviceClass[index_i] == CY_CLASS_VENDOR)
deviceInfo->deviceType[index_i] = (CY_DEVICE_CLASS)interfaceDesc->altsetting->bInterfaceSubClass;
else
deviceInfo->deviceType[index_i] = CY_TYPE_DISABLED;
index_i++;
numInterfaces--;
interfaceDesc++;
}
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in Getting config descriptor ... Libusb Error is %d\n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
libusb_free_config_descriptor (configDesc);
libusb_close (devHandle);
}
if ((*deviceCount) == 0)
rStatus = CY_ERROR_DEVICE_NOT_FOUND;
pthread_mutex_unlock (&criticalSection);
return rStatus;
}
/*
This API will claim the interface in the device
To make sure only claimed application speaks to device.
*/
CY_RETURN_STATUS CySelectInterface (
CY_HANDLE handle,
UINT8 interfaceNum
)
{
UINT32 rStatus, numEP;
CY_DEVICE *device;
libusb_device_handle *devHandle;
libusb_device *usbDev;
struct libusb_config_descriptor *configDesc;
const struct libusb_interface *interfaceDesc;
const struct libusb_endpoint_descriptor *epDesc;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
usbDev = libusb_get_device (devHandle);
if (usbDev == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error Invalide handle ..function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
//Get the config descriptor and parse it to get the
//interface and endpoint descriptor
rStatus = libusb_get_config_descriptor (usbDev, 0, &configDesc);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting Config Desc ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
interfaceDesc = configDesc->interface;
//Interface Number should be a valid one and should not exceed
// total number of interfaces
if (interfaceNum >= configDesc->bNumInterfaces){
CY_DEBUG_PRINT_ERROR ("CY:Interface Number not valid... \n");
libusb_free_config_descriptor (configDesc);
return CY_ERROR_REQUEST_FAILED;
}
if (libusb_kernel_driver_active (devHandle, interfaceNum)){
CY_DEBUG_PRINT_ERROR ("CY:Kernel driver active on the interface number %d \n", interfaceNum);;
//User can uncomment this section if needed.
#ifdef CY_DETACH_KERNEL_DRIVER
if (!libusb_detach_kernel_driver (devHandle, interfaceNum)){
CY_DEBUG_PRINT_ERROR ("CY:Kernel driver detach failed %d\n", interfaceNum);
return CY_ERROR_REQUEST_FAILED;
}
#else
return CY_ERROR_REQUEST_FAILED;
#endif
}
rStatus = libusb_claim_interface (devHandle, interfaceNum);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in claiming interface -interface num %d... Libusb error is %d \n", interfaceNum, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
device->interfaceNum = interfaceNum;
while (interfaceNum--)
interfaceDesc++;
epDesc = interfaceDesc->altsetting->endpoint;
numEP = interfaceDesc->altsetting->bNumEndpoints;
device->numEndpoints = numEP;
// Check the total number of endpoints interface has
// and get all the endpoint add
CY_DEBUG_PRINT_INFO ("CY:Info The total number of endpoints are %d \n", numEP);
while (numEP){
if (epDesc->bmAttributes == 0x2){ //Bulk EP checking
if (epDesc->bEndpointAddress & 0x80)
device->inEndpoint = epDesc->bEndpointAddress;
else
device->outEndpoint = epDesc->bEndpointAddress;
}
else if (epDesc->bmAttributes == 0x3) //Interrupt EP checking (We have only one interrupt EP)
device->interruptEndpoint = epDesc->bEndpointAddress;
epDesc++;
numEP--;
}
CY_DEBUG_PRINT_INFO ("CY:Info The Endpoints are in %d and out %d and interrup %d\n",
device->inEndpoint, device->outEndpoint, device->interruptEndpoint);
libusb_free_config_descriptor (configDesc);
return CY_SUCCESS;
}
/*
* This API selects the type of the device
*/
void CySelectDeviceType (CY_DEVICE *device, libusb_device *libUsbdev, unsigned char interfaceNum)
{
int rStatus, numInterfaces;
struct libusb_config_descriptor *configDesc;
int index = 0;
const struct libusb_interface *interfaceDesc;
device->deviceType = CY_TYPE_DISABLED;
rStatus = libusb_get_config_descriptor (libUsbdev, 0, &configDesc);
if (0 == rStatus){
interfaceDesc = configDesc->interface;
numInterfaces = configDesc->bNumInterfaces;
if (interfaceNum >= numInterfaces)
return;
while (index != interfaceNum) {
index++;
interfaceDesc++;
}
if (interfaceDesc->altsetting->bInterfaceClass == CY_CLASS_VENDOR)
device->deviceType = (CY_DEVICE_CLASS)interfaceDesc->altsetting->bInterfaceSubClass;
libusb_free_config_descriptor (configDesc);
}
CY_DEBUG_PRINT_INFO ("CY:Info The device type is %d \n", device->deviceType);
}
/*
The Api Gets the handle for the specified device number
(refer to usage guide and example for usage)
and this handle should be called for further communication
with the device
*/
CY_RETURN_STATUS CyOpen (
unsigned char deviceNumber,
unsigned char interfaceNum,
CY_HANDLE *handle
)
{
libusb_device_handle *devHandle;
libusb_device *dev;
CY_DEVICE *device;
UINT32 rStatus;
if (glDriverInit == false){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
pthread_mutex_lock (&criticalSection);
if (glDriverInit == true){
if (deviceNumber >= glNumDevices){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Invalid device number ... \n");
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_INVALID_PARAMETER;
}
dev = glDeviceList [deviceNumber];
rStatus = libusb_open (dev, &devHandle);
if (rStatus == LIBUSB_ERROR_ACCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in opening the device ..Access denied \n");
handle = NULL;
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ACCESS_DENIED;
}
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Opening the Device ...Error is %d \n", rStatus);
handle = NULL;
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
device = (CY_DEVICE *)malloc(sizeof (CY_DEVICE));
if (device == NULL){
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ALLOCATION_FAILED;
}
device->devHandle = devHandle;
(*handle) = device;
rStatus = CySelectInterface (device, interfaceNum);
if (rStatus != CY_SUCCESS){
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
CySelectDeviceType (device, dev, interfaceNum);
if (device->deviceType == CY_TYPE_UART) {
CyUartSetRts (*handle);
CyUartSetDtr (*handle);
if (!CyUartSetHwFlowControl (*handle, CY_UART_FLOW_CONTROL_DISABLE))
device->uartFlowControlMode = CY_UART_FLOW_CONTROL_DISABLE;
}
//initialising structure elements
device->spiThreadId = (pthread_t)0;
device->uartThreadId = (pthread_t)0;
device->spiCancelEvent = false;
device->uartCancelEvent = false;
device->spiTransfer = NULL;
device->uartTransfer = NULL;
if (pthread_mutex_init (&device->readLock, NULL)){
CY_DEBUG_PRINT_ERROR ("CY:Error initializing the read mutex .. Function is %s \n", __func__);
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
if (pthread_mutex_init (&device->writeLock, NULL)){
CY_DEBUG_PRINT_ERROR ("CY:Error initializing the write mutex .. Function is %s \n", __func__);
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
if (pthread_mutex_init (&device->notificationLock, NULL)){
CY_DEBUG_PRINT_ERROR ("CY:Error initializing the write mutex .. Function is %s \n", __func__);
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
pthread_mutex_unlock (&criticalSection);
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error iniitalise library by calling CyLibraryInit()....function is %s\n", __func__);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
}
/*
The Api Closes the handle and needs to be called only if CyGetNumDevices
or CyOpen is called
*/
CY_RETURN_STATUS CyClose (
CY_HANDLE handle
)
{
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType == CY_TYPE_UART) {
CyUartClearRts (handle);
CyUartClearDtr (handle);
CyUartSetHwFlowControl (handle, CY_UART_FLOW_CONTROL_DISABLE);
}
if (glDriverInit == true){
if (device->deviceType == CY_TYPE_SPI || device->deviceType == CY_TYPE_UART){
if (device->spiThreadId != 0 || device->uartThreadId != 0){
CyAbortEventNotification(handle);
}
}
if (pthread_mutex_destroy (&device->readLock)){
CY_DEBUG_PRINT_ERROR ("CY:Error de initializing the read mutex .. Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_destroy (&device->writeLock)){
CY_DEBUG_PRINT_ERROR ("CY:Error de initializing the write mutex .. Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_destroy (&device->notificationLock)){
CY_DEBUG_PRINT_ERROR ("CY:Error de initializing the write mutex .. Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
libusb_close ((libusb_device_handle*)devHandle);
free (device);
}
return CY_SUCCESS;
}
/*
This Api will reset the pipe and clears the endpoint
*/
CY_RETURN_STATUS CyResetPipe (
CY_HANDLE handle,
UINT8 endPointAddress
)
{
UINT32 rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
rStatus = libusb_clear_halt ((libusb_device_handle *)devHandle, endPointAddress);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in resetting the pipe ... \n");
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/*
This Api will get the library version,patch
and build number
*/
CY_RETURN_STATUS CyGetLibraryVersion (
CY_HANDLE handle,
PCY_LIBRARY_VERSION version
)
{
version->majorVersion = CY_US_VERSION_MAJOR;
version->minorVersion = CY_US_VERSION_MINOR;
version->patch = CY_US_VERSION_PATCH;
version->buildNumber = CY_US_VERSION_BUILD;
return CY_SUCCESS;
}

View File

@@ -1 +0,0 @@
libcyusbserial.so.1

View File

@@ -1,5 +0,0 @@
# Cypress USB driver for FX2 and FX3 (C) Cypress Semiconductor Corporation / ATR-LABS
# Rules written by V. Radhakrishnan ( rk@atr-labs.com )
# Cypress USB vendor ID = 0x04b4
KERNEL=="*", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ACTION=="add", ATTR{idVendor}=="04b4", MODE="666", TAG="cyusb_dev", RUN+="/usr/bin/CyUSBSerial.sh A"
KERNEL=="*", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ACTION=="remove", TAG=="cyusb_dev", RUN+="/usr/bin/CyUSBSerial.sh R"

View File

@@ -1,7 +0,0 @@
#!/bin/bash
pid=`pidof CyUSBSerialTestUtility`
if [ "$pid" ]; then
kill -s SIGUSR1 $pid
fi

View File

@@ -1,11 +0,0 @@
all:
gcc -g -o CyUSBSerialTestUtility Test_Utility.c -lcyusbserial -w
cp 90-cyusb.rules /etc/udev/rules.d
cp CyUSBSerialTestUtility /usr/bin
cp CyUSBSerial.sh /usr/bin
chmod 777 /usr/bin/CyUSBSerial.sh
clean:
rm -f CyUSBSerialTestUtility
help:
@echo 'make would compile and create the library and create a link'
@echo 'make clean would remove the library and the soft link to the library (soname)'

View File

@@ -1,137 +0,0 @@
================================================================================
Cypress Semiconductor Corporation
CyUSB Serial DVK test utility for I2C/SPI
================================================================================
This utility is used for testing I2C/SPI master mode functionality on the
Cypress CyUSBSerial DVK.
The utility writes to I2C/SPI flash devices on the DVK, reads the data back
and verifies the data read for integrity.
Release components:
================================================================================
1. Test_Utility.c ==> Source file of the command line test utility
2. 90-cyusb.rules ==> udev rules for changing the mode of usb device node.
3. CyUSBSerial.sh ==> Script file for implementing hotplug feature in linux.
4. Makefile ==> make file for compiling and installing the application.
================================================================================
Pre-requisites:
================================================================================
1. libusb-1.0.9 is required for compilation and functioning of the APIs in the
USB Serial library.
2. The CyUSBSerial library (libcyusbserial.so) should be compiled and installed
on the test machine.
3. GNU Make and the GCC tool-chain are used for the build process.
================================================================================
Installation steps:
================================================================================
1. Change to the folder where the utility source files are extracted.
2. Invoke 'make' to build compile the utility, and to install the configuration
files at the appropriate locations. This should be done from a super-user
(sudo) shell, because the configuration files need to be copied into system
folders (/usr/local/bin).
3. Use the CyUSBSerial command to start the test utility.
Note:
The udev daemon needs to be restarted to reflect the udev rule changes that
are installed as part of the make command.
================================================================================
Using the test utility:
================================================================================
1. On starting the utility, the Cypress USB Serial devices that are connected
are listed along with their device numbers, interface numbers and
functionalities (SPI or I2C).
$ CyUSBSerial
----------------------------------------------------------------------
Device Number | VID | PID | INTERFACE NUMBER | FUNCTIONALITY
----------------------------------------------------------------------
0 |4b4 |a | 0 | VENDOR_I2C
0 |4b4 |a | 1 | VENDOR_SPI
0 |4b4 |a | 2 | NA
----------------------------------------------------------------------
2. A menu providing the various operations is also printed:
----------------------------------------------------------------------
1: Print list of devices
2: Select device...No device selected !!
3: Enter I2C/SPI Flash page address and length to write/read.
4: Verify data
5: Exit
----------------------------------------------------------------------
3. On selecting option 2, the utility prompts for the device and interface
number to be selected for testing.
-----------------------------------
Enter Device number to select:
0
Enter interface number:
1
-----------------------------------
Once the selections are made, the menu will be updated with the details.
----------------------------------------------------------------------
1: Print list of devices
2: Change device selection--selected device: [Device number 0] : [Interface No 1] : SPI
3: Enter I2C/SPI Flash page address and length to write/read.
4: Verify data
5: Exit
----------------------------------------------------------------------
4. Option 3 can be selected now to do data read/write to the I2C/SPI flash
device. The utility prompts for the page address to be written as well as
the length of data to be written.
------------------------------------------------
Enter Page address ... (less than 65536)
1234
Enter length to read/write ... (less than 256)
32
------------------------------------------------
Length needs to be less than or equal to 256 bytes in the case of SPI access,
and less than or equal to 64 bytes in the case of I2C access. Page address
needs to be less than 65536 in case of SPI and 256 in case of I2C.
Once the values are selected, the menu is updated with the details as below:
-------------------------------------------------------------------
1: Print list of devices
2: Change device selection--selected device: [Device number 0] : [Interface No 1] : SPI
3: Change Flash page address and length ...Entered is page address 1234 and length 123
4: Verify data
5: Exit
-------------------------------------------------------------------
5. Selecting option 4 causes the utility to write a randomly generated data
sequence to the flash device, read it back, and verify the data read back.
The data pattern written and read back will be displayed as shown below:
--------------------------------------------------------------------
67 c6 69 73 51 ff 4a ec 29 cd ba ab f2 fb e3 46 7c c2 54 f8 1b e8 e7 8d 76 5a 2e 63 33 9f c9 9a
--------------------------------------------------------------------
Data Read back is:
---------------------------------------------------------------------
67 c6 69 73 51 ff 4a ec 29 cd ba ab f2 fb e3 46 7c c2 54 f8 1b e8 e7 8d 76 5a 2e 63 33 9f c9 9a
---------------------------------------------------------------------
Data verified successfully
-------------------------------------------------------------------
6. The utility runs through these menu options until the user selects the
exit option (5).
7. If a new Cypress USB Serial device is attached or an existing device is
removed while the utility is running, a notification is printed on the
console.
---------------------------------------
Device of interest Removed/Added
---------------------------------------
================================================================================
EOF

View File

@@ -1,605 +0,0 @@
/*
* Test utility
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include <signal.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/time.h>
#include <pthread.h>
#include <ctype.h>
#include "../../common/header/CyUSBSerial.h"
#define CY_MAX_DEVICES 30
#define CY_MAX_INTERFACES 4
typedef struct _CY_DEVICE_STRUCT {
int deviceNumber;
int interfaceFunctionality[CY_MAX_INTERFACES];
bool isI2c;
bool isSpi;
int numInterface;
}CY_DEVICE_STRUCT;
CY_DEVICE_STRUCT *glDevice;
int i2cDeviceIndex[CY_MAX_DEVICES][CY_MAX_INTERFACES];
unsigned char *deviceNumber = NULL;
int cyDevices, i2cDevices = 0, numDevices = 0;
int selectedDeviceNum = -1, selectedInterfaceNum = -1;
bool exitApp = false;
unsigned short pageAddress = -1;
short readWriteLength = -1;
bool deviceAddedRemoved = false;
int getUserInput()
{
char userInput[6], x;
int output,i = 0;
bool isDigit = true;
x = getchar();
while (x != '\n'){
if (i < 5){
userInput[i] = x;
i++;
}
if (!isdigit(x))
isDigit = false;
x = getchar();
}
userInput[i] = '\0';
if (isDigit == false)
return -1;
output = atoi(userInput);
return output;
}
void deviceHotPlug () {
CY_RETURN_STATUS rStatus;
deviceAddedRemoved = true;
selectedDeviceNum = -1;
selectedInterfaceNum = -1;
printf ("Device of interest Removed/Added \n");
rStatus = CyGetListofDevices (&numDevices);
if (rStatus != CY_SUCCESS) {
printf ("CY:Error in Getting List of Devices: Error NO:<%d> \n", rStatus);
return rStatus;
}
printListOfDevices (false);
}
int main (int argc, char **agrv)
{
int index = 0, i, j, userInput;
int tempSelectedDeviceNum, tempSelectedInterfaceNum, tempPageAddress, tempLength;
CY_RETURN_STATUS rStatus;
signal (SIGUSR1, deviceHotPlug);
glDevice = (CY_DEVICE_STRUCT *)malloc (CY_MAX_DEVICES *sizeof (CY_DEVICE_STRUCT));
if (glDevice == NULL){
printf ("Memory allocation failed ...!! \n");
return -1;
}
rStatus = CyLibraryInit ();
if (rStatus != CY_SUCCESS) {
printf ("CY:Error in Doing library init Error NO:<%d> \n", rStatus);
return rStatus;
}
rStatus = CyGetListofDevices (&numDevices);
if (rStatus != CY_SUCCESS) {
printf ("CY:Error in Getting List of Devices: Error NO:<%d> \n", rStatus);
return rStatus;
}
printListOfDevices(true);
do {
printf ("-------------------------------------------------------------------\n");
printf ("1: Print list of devices \n");
if (selectedDeviceNum != -1 && selectedInterfaceNum != -1){
printf ("2: Change device selection--selected device: [Device number %d] : [Interface No %d]",\
selectedDeviceNum, selectedInterfaceNum);
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C)
printf (" : I2C\n");
else if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI)
printf (" : SPI\n");
else
printf (" : NA\n");
}
else
printf ("2: Select device...No device selected !!\n");
if (readWriteLength != -1 && pageAddress != -1){
printf ("3: Change Flash page address and length ...Entered is page address %d and length %d\n", pageAddress, readWriteLength);
printf ("4: Verify data\n5: Exit\n");
}
else
printf ("3: Enter I2C/SPI Flash page address and length to write/read.\n4: Verify data\n5: Exit\n");
printf ("-------------------------------------------------------------------\n");
userInput = getUserInput();
if (userInput < 1 || userInput > 5){
printf ("Wrong selection code ... Enter again \n");
continue;
}
switch (userInput){
case 1:
printListOfDevices(true);
break;
case 2:
if (cyDevices == 0) {
printf ("No device of interest connected ...!!\n");
continue;
}
printf ("Enter Device number to be selected.. \n");
tempSelectedDeviceNum = getUserInput();
//printf ("Selected device number is %d \n",tempSelectedDeviceNum);
if (tempSelectedDeviceNum >= cyDevices || tempSelectedDeviceNum == -1){
printf ("Wrong device selection \n");
continue;
}
printf ("Enter interface number..\n");
tempSelectedInterfaceNum = getUserInput();
//printf ("Selected device number is %d %d\n",tempSelectedInterfaceNum, glDevice[tempSelectedDeviceNum].numInterface);
if (tempSelectedInterfaceNum >= glDevice[tempSelectedDeviceNum].numInterface ||
tempSelectedInterfaceNum == -1) {
printf ("Wrong interface Selection selection \n");
continue;
}
if ((glDevice[tempSelectedDeviceNum].interfaceFunctionality[tempSelectedInterfaceNum] == -1)){
printf ("Selected device does not have I2C or SPI !!! \n");
continue;
}
if (deviceAddedRemoved == true) {
printf ("Device of interest was added/removed .... Print and select from new list\n");
continue;
}
selectedDeviceNum = tempSelectedDeviceNum;
selectedInterfaceNum = tempSelectedInterfaceNum;
//pageAddress = -1;
//readWriteLength = -1;
break;
case 3:
if (selectedDeviceNum == -1) {
printf ("Select proper device!!! \n");
continue;
}
if (selectedDeviceNum >= cyDevices){
printf ("Select proper device!!! \n");
continue;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C){
printf ("Enter Page address... (less than 256)\n");
tempPageAddress = getUserInput();
printf ("Enter length to read/write...(less than 64)\n");
tempLength = getUserInput();
if (deviceAddedRemoved == true) {
printf ("Device of interest was added/removed .... Print and select from new list\n");
continue;
}
if (tempPageAddress > 256){
printf ("Invalid page address ..Enter page address less than 256 (1 bytes len)\n");
continue;
}
if (tempLength < 0 || tempLength > 64){
printf ("Invalid Length ..Enter length less than 64 bytes\n");
continue;
}
pageAddress = tempPageAddress;
readWriteLength = tempLength;
break;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI){
printf ("Enter Page address... (less than 65536)\n");
tempPageAddress = getUserInput();
printf ("Enter length to read/write...(less than 256)\n");
tempLength = getUserInput();
if (deviceAddedRemoved == true) {
printf ("Device of interest was added/removed .... Print and select from new list\n");
continue;
}
if (tempPageAddress > 65536){
printf ("Invalid page address ..Enter page address less than 65536 (1 bytes len)\n");
continue;
}
if (tempLength < 0 || tempLength > 256){
printf ("Invalid Length ..Enter length less than 256 bytes\n");
continue;
}
pageAddress = tempPageAddress;
readWriteLength = tempLength;
break;
}
case 4:
if (selectedDeviceNum == -1) {
printf ("Select proper device!!! \n");
continue;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == -1){
printf ("Selected device does not have I2C or SPI !!! \n");
continue;
}
if ((pageAddress == -1) || (readWriteLength == -1)){
printf ("Select proper page address and length !!! \n");
continue;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C){
if (pageAddress > 256){
printf ("Invalid Page address for I2C .. need to be less than 256\n");
continue;
}
if (readWriteLength > 64){
printf ("Invalid read write length for I2C .. need to be less than 64\n");
continue;
}
printf ("Calling I2C \n");
i2cVerifyData(glDevice[selectedDeviceNum].deviceNumber, selectedInterfaceNum);
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI){
spiVerifyData(glDevice[selectedDeviceNum].deviceNumber, selectedInterfaceNum);
}
break;
case 5:
exitApp = true;
CyLibraryExit ();
break;
}
}while (exitApp == false);
free (glDevice);
}
int spiWriteEnable (CY_HANDLE handle)
{
unsigned char wr_data,rd_data;
CY_RETURN_STATUS status = CY_SUCCESS;
CY_DATA_BUFFER writeBuf;
CY_DATA_BUFFER readBuf;
writeBuf.buffer = &wr_data;
writeBuf.length = 1;
readBuf.buffer = &rd_data;
readBuf.length = 1;
wr_data = 0x06; /* Write enable */
status = CySpiReadWrite (handle, &readBuf, &writeBuf, 5000);
if (status != CY_SUCCESS)
{
return status;
}
return status;
}
//Helper functions for doing data transfer to/from SPI flash
int spiWaitForIdle (CY_HANDLE handle)
{
char rd_data[2], wr_data[2];
CY_DATA_BUFFER writeBuf, readBuf;
writeBuf.length = 2;
writeBuf.buffer = (unsigned char *)wr_data;
int timeout = 0xFFFF;
CY_RETURN_STATUS status;
readBuf.length = 2;
readBuf.buffer = (unsigned char *)rd_data;
do
{
wr_data[0] = 0x05; /* Status */
status = CySpiReadWrite (handle, &readBuf, &writeBuf, 5000);
if (status != CY_SUCCESS)
{
break;
}
timeout--;
if (timeout == 0)
{
status = CY_ERROR_IO_TIMEOUT;
return status;
}
} while (rd_data[1] & 0x01);
return status;
}
int spiVerifyData (int deviceNumber, int interfaceNum)
{
CY_DATA_BUFFER dataBufferWrite,dataBufferRead;
CY_HANDLE handle;
bool isVerify = true;
unsigned char wbuffer[256 + 4], rbuffer[256 + 4];
int rStatus, length;
memset (rbuffer, 0x00, 256);
memset (wbuffer, 0x00, 256);
rStatus = CyOpen (deviceNumber, interfaceNum, &handle);
if (rStatus != CY_SUCCESS){
printf ("CY_SPI: Open failed \n");
return rStatus;
}
dataBufferWrite.buffer = wbuffer;
dataBufferRead.buffer = rbuffer;
rStatus = spiWaitForIdle (handle);
if (rStatus){
printf("Error in Waiting for EEPOM active state %d \n", rStatus);
CyClose (handle);
return CY_ERROR_REQUEST_FAILED;
}
printf ("Calling spi write enable \n");
rStatus = spiWriteEnable (handle);
if (rStatus){
printf("Error in setting Write Enable %d \n", rStatus);
CyClose (handle);
return CY_ERROR_REQUEST_FAILED;
}
//Write SPI write command
wbuffer[0] = 0x02;
//SPI flash address
wbuffer[1] = (pageAddress >> 8);
wbuffer[2] = (pageAddress) & 0x00FF;
wbuffer[3] = 0;
printf ("The Data written is ...\n");
printf ("\n--------------------------------------------------------------------\n");
for (rStatus = 4; rStatus < (readWriteLength + 4); rStatus++){
wbuffer[rStatus] = rand() % 256;
printf ("%x ",wbuffer[rStatus]);
}
printf ("\n--------------------------------------------------------------------\n");
dataBufferRead.length = (4 + readWriteLength);
dataBufferWrite.length = (4 + readWriteLength);
rStatus = CySpiReadWrite (handle , &dataBufferRead, &dataBufferWrite, 5000);
if (rStatus != CY_SUCCESS){
CyClose (handle);
printf ("Error in doing SPI data write data Write is %d data read is %d\n" , dataBufferWrite.transferCount,dataBufferRead.transferCount);
return CY_ERROR_REQUEST_FAILED;
}
spiWaitForIdle (handle);
//Write SPI read command
wbuffer[0] = 0x03;
dataBufferRead.length = (4 + readWriteLength);
dataBufferWrite.length = (4 + readWriteLength);
rStatus = CySpiReadWrite (handle, &dataBufferRead, &dataBufferWrite, 5000);
if (rStatus != CY_SUCCESS){
CyClose (handle);
printf ("The Error is %d \n", rStatus);
printf ("Error in doing SPI data write data Write is %d data read is %d\n" , dataBufferWrite.transferCount,dataBufferRead.transferCount);
return CY_ERROR_REQUEST_FAILED;
}
printf ("Data Read back is \n");
printf ("\n---------------------------------------------------------------------\n");
for (rStatus = 4; rStatus < (readWriteLength + 4); rStatus++){
printf ("%x ",rbuffer[rStatus]);
if (rbuffer[rStatus] != wbuffer[rStatus]){
isVerify = false;
}
}
printf ("\n---------------------------------------------------------------------\n");
if (isVerify)
printf ("Data verified successfully \n");
else
printf ("Data corruption occured!!\n");
CyClose (handle);
return CY_SUCCESS;
}
int i2cVerifyData (int deviceNumber, int interfaceNum)
{
CY_DATA_BUFFER dataBufferWrite, dataBufferRead;
CY_HANDLE handle;
int length = 0;
bool isVerify = true;
int loopCount = 100, i;
CY_RETURN_STATUS rStatus;
unsigned char bytesPending = 0, address[2], wbuffer[66], rbuffer[66];
CY_I2C_DATA_CONFIG i2cDataConfig;
memset (wbuffer, 0, 66);
memset (rbuffer, 0, 66);
i2cDataConfig.isStopBit = true;
i2cDataConfig.slaveAddress = 0x51;
rStatus = CyOpen (deviceNumber, interfaceNum, &handle);
if (rStatus != CY_SUCCESS){
printf("CY_I2C: Open failed \n");
return rStatus;
}
loopCount = 100;
length = readWriteLength;
wbuffer[0]= pageAddress;
wbuffer[1] = 0;
dataBufferWrite.buffer = wbuffer;
i2cDataConfig.isStopBit = true;
dataBufferWrite.length = (length + 2);
printf ("\n Data that is written on to i2c ...\n");
printf ("\n-----------------------------------------------------------------\n");
for (i = 2; i < (length +2); i++){
wbuffer[i] = rand() % 256;
printf ("%x ", wbuffer[i]);
}
printf ("\n-----------------------------------------------------------------\n");
rStatus = CyI2cWrite (handle, &i2cDataConfig, &dataBufferWrite, 5000);
if (rStatus != CY_SUCCESS){
printf ("Error in doing i2c write \n");
CyClose (handle);
return -1;
}
//We encountered a error in I2C read repeat the procedure again
//Loop here untill Read vendor command passes
i2cDataConfig.isStopBit = false;
dataBufferWrite.length = 2;
do {
rStatus = CyI2cWrite (handle, &i2cDataConfig, &dataBufferWrite, 5000);
loopCount--;
}while (rStatus != CY_SUCCESS && loopCount != 0);
if (loopCount == 0 && rStatus != CY_SUCCESS){
printf ("Error in sending read command \n");
CyClose (handle);
return -1;
}
dataBufferRead.buffer = rbuffer;
rbuffer[0]= address[0];
rbuffer[1] = 0;
i2cDataConfig.isStopBit = true;
i2cDataConfig.isNakBit = true;
dataBufferRead.length = length;
dataBufferRead.buffer = rbuffer;
memset (rbuffer, 0, 64);
rStatus = CyI2cRead (handle, &i2cDataConfig, &dataBufferRead, 5000);
if (rStatus != CY_SUCCESS){
printf ("Error in doing i2c read ... Error is %d \n", rStatus);
CyClose (handle);
return -1;
}
printf ("\n Data that is read from i2c ...\n");
printf ("\n-----------------------------------------------------------------\n");
for (rStatus = 0; rStatus < length; rStatus++){
printf ("%x ", rbuffer[rStatus]);
if (rbuffer[rStatus] != wbuffer[rStatus + 2]){
isVerify = false;
}
}
printf ("\n-----------------------------------------------------------------\n");
if (!isVerify)
printf ("Data corruption occured ..!!!\n");
else
printf ("Data verified successfully \n");
CyClose (handle);
}
bool isCypressDevice (int deviceNum) {
CY_HANDLE handle;
unsigned char interfaceNum = 0;
unsigned char sig[6];
CY_RETURN_STATUS rStatus;
rStatus = CyOpen (deviceNum, interfaceNum, &handle);
if (rStatus == CY_SUCCESS){
rStatus = CyGetSignature (handle, sig);
if (rStatus == CY_SUCCESS){
CyClose (handle);
return true;
}
else {
CyClose (handle);
return false;
}
}
else
return false;
}
void printListOfDevices (bool isPrint)
{
int index_i = 0, index_j = 0, i, j, countOfDevice = 0, devNum;
int length, index = 0, numInterfaces, interfaceNum;
bool set1 = false;
unsigned char deviceID[CY_MAX_DEVICES];
unsigned char functionality[64];
CY_DEVICE_INFO deviceInfo;
CY_DEVICE_CLASS deviceClass[CY_MAX_INTERFACES];
CY_DEVICE_TYPE deviceType[CY_MAX_INTERFACES];
CY_RETURN_STATUS rStatus;
deviceAddedRemoved = false;
CyGetListofDevices (&numDevices);
//printf ("The number of devices is %d \n", numDevices);
for (i = 0; i < numDevices; i++){
for (j = 0; j< CY_MAX_INTERFACES; j++)
glDevice[i].interfaceFunctionality[j] = -1;
}
if (isPrint){
printf ("\n\n---------------------------------------------------------------------------------\n");
printf ("Device Number | VID | PID | INTERFACE NUMBER | FUNCTIONALITY \n");
printf ("---------------------------------------------------------------------------------\n");
}
cyDevices = 0;
for (devNum = 0; devNum < numDevices; devNum++){
rStatus = CyGetDeviceInfo (devNum, &deviceInfo);
interfaceNum = 0;
if (!rStatus)
{
if (!isCypressDevice (devNum)){
continue;
}
strcpy (functionality, "NA");
numInterfaces = deviceInfo.numInterfaces;
glDevice[index].numInterface = numInterfaces;
cyDevices++;
while (numInterfaces){
if (deviceInfo.deviceClass[interfaceNum] == CY_CLASS_VENDOR)
{
glDevice[index].deviceNumber = devNum;
switch (deviceInfo.deviceType[interfaceNum]){
case CY_TYPE_I2C:
glDevice[index].interfaceFunctionality[interfaceNum] = CY_TYPE_I2C;
strcpy (functionality, "VENDOR_I2C");
glDevice[index].isI2c = true;
break;
case CY_TYPE_SPI:
glDevice[index].interfaceFunctionality[interfaceNum] = CY_TYPE_SPI;
strcpy (functionality, "VENDOR_SPI");
glDevice[index].isSpi = true;
break;
default:
strcpy (functionality, "NA");
break;
}
}
else if (deviceInfo.deviceClass[interfaceNum] == CY_CLASS_CDC){
strcpy (functionality, "NA");
}
if (isPrint) {
printf ("%d |%x |%x | %d | %s\n", \
index, \
deviceInfo.vidPid.vid, \
deviceInfo.vidPid.pid, \
interfaceNum, \
functionality \
);
}
interfaceNum++;
numInterfaces--;
}
index++;
}
}
if (isPrint){
printf ("---------------------------------------------------------------------------------\n\n");
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,59 +0,0 @@
cmake_minimum_required(VERSION 2.8)
project(libcyusbserial C)
set(CMAKE_HELPERS_BINARY_DIR ${PROJECT_SOURCE_DIR}/cmake/helpers)
set(CMAKE_HELPERS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/cmake/helpers)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
include(FindLibUSB)
if(WIN32)
include(FindLibPThreadsWin32)
endif()
################################################################################
# System configuration
################################################################################
# OSX
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if(${isSystemDir} STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
endif()
################################################################################
# GCC and Clang
################################################################################
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_definitions(-Wall)
add_definitions(-Wextra)
add_definitions(-Wno-unused-parameter)
if(TREAT_WARNINGS_AS_ERRORS)
add_definitions(-Werror)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG=1)
add_definitions(-O0)
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang")
################################################################################
# Process subdirectories
################################################################################
include_directories(${PROJECT_SOURCE_DIR}/include)
add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(tools)

View File

@@ -1,18 +0,0 @@
platform:
- x86
- x64
install:
- ps: (new-object System.Net.WebClient).Downloadfile("https://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.19/libusb-1.0.19-rc1-win.7z", "$($env:APPVEYOR_BUILD_FOLDER)\\libusb-1.0.19-rc1-win.7z")
- cmd: 7z x -y "%APPVEYOR_BUILD_FOLDER%\libusb-1.0.19-rc1-win.7z" -o"C:\Program Files\libusb-1.0.19"
- ps: (new-object System.Net.WebClient).Downloadfile("ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip", "$($env:APPVEYOR_BUILD_FOLDER)\\pthreads-w32-2-9-1-release.zip")
- cmd: 7z x -y "%APPVEYOR_BUILD_FOLDER%\pthreads-w32-2-9-1-release.zip" -o"%APPVEYOR_BUILD_FOLDER%\pthreads-w32-2-9-1-release"
- cmd: mv "%APPVEYOR_BUILD_FOLDER%\pthreads-w32-2-9-1-release\Pre-built.2" "C:\Program Files\pthreads-win32"
before_build:
- cmd: mkdir build
- cmd: chdir build
build_script:
- cmd: cmake ..
- cmd: cmake --build .

View File

@@ -1,30 +0,0 @@
set(VERSION_INFO_MAJOR 1)
set(VERSION_INFO_MINOR 0)
set(VERSION_INFO_PATCH 0)
include(GNUInstallDirs)
set(LIBCYUSBSERIAL_SOURCE cyusb.c cyuart.c cyi2c.c cyspi.c cyphdc.c cyjtag.c cymisc.c)
# Fall back to just "lib" if the item provided by GNUInstallDirs doesn't exist
# For example, on Ubuntu 13.10 with CMake 2.8.11.2,
# /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} doesn't exist.
if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
message(STATUS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} does not exist. Defaulting libcyusbserial install location to ${CMAKE_INSTALL_PREFIX}/lib.")
set(CMAKE_INSTALL_LIBDIR lib)
endif()
add_library(cyusbserial SHARED ${LIBCYUSBSERIAL_SOURCE})
target_link_libraries(cyusbserial ${LIBUSB_LIBRARIES})
set_target_properties(cyusbserial PROPERTIES SOVERSION ${VERSION_INFO_MAJOR})
################################################################################
# Library installation information
################################################################################
install(TARGETS cyusbserial
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .a/.lib
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} # .dll
)

View File

@@ -1,253 +0,0 @@
/*
* Common header file of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** \file CyUSBCommon.h
* \brief Common header file of Cypress USB Serial
*/
#include <stdio.h>
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <pthread.h>
#include <libusb-1.0/libusb.h>
#include "CyUSBSerial.h"
typedef struct CY_DEVICE {
#pragma pack(1)
unsigned char inEndpoint;
unsigned char outEndpoint;
unsigned char interruptEndpoint;
unsigned char interfaceNum;
bool i2cCancelEvent;
bool spiCancelEvent;
bool uartCancelEvent;
bool rtsValue;
bool dtrValue;
unsigned short numEndpoints;
CY_FLOW_CONTROL_MODES uartFlowControlMode;
struct libusb_transfer *spiTransfer;
struct libusb_transfer *uartTransfer;
libusb_device_handle *devHandle;
pthread_t spiThreadId;
pthread_t uartThreadId;
#pragma pack()
pthread_mutex_t readLock;
pthread_mutex_t writeLock;
pthread_mutex_t notificationLock;
#pragma pack(1)
CY_DEVICE_TYPE deviceType;
#pragma pack()
}CY_DEVICE,*PCY_DEVICE;
CY_RETURN_STATUS CyResetPipe (CY_HANDLE handl, UINT8);
#define CY_DEBUG_PRINT_INFO(...) //User need to enable this
#define CY_DEBUG_PRINT_ERROR(...) //printf
#define DUMP_DATA 1
#ifdef DUMP_DATA
#define CY_DUMP_DATA(INPUT,LEN)\
{\
int i = 0, len = LEN;\
while ((len)) {\
printf ("%x ", (INPUT)[i++]);\
len--;\
}\
printf ("\n");\
}
#else
#define CY_DUMP_DATA (INPUT, LEN) do { }while (0);
#endif
#define CY_USB_SERIAL_TIMEOUT 5000
#define CY_EVENT_NOTIFICATION_TIMEOUT 0 //This will make the transfer infinite
#define CY_VENDOR_REQUEST_DEVICE_TO_HOST 0xC0
#define CY_VENDOR_REQUEST_HOST_TO_DEVICE 0x40
#define CY_CLASS_INTERFACE_REQUEST_DEVICE_TO_HOST 0XA1
#define CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE 0x21
//I2C related macros
#define CY_SCB_INDEX_POS 15
#define CY_I2C_CONFIG_LENGTH 16
#define CY_I2C_WRITE_COMMAND_POS 3
#define CY_I2C_WRITE_COMMAND_LEN_POS 4
#define CY_I2C_GET_STATUS_LEN 3
#define CY_I2C_MODE_WRITE 1
#define CY_I2C_MODE_READ 0
#define CY_I2C_ERROR_BIT (1)
#define CY_I2C_ARBITRATION_ERROR_BIT (1 << 1)
#define CY_I2C_NAK_ERROR_BIT (1 << 2)
#define CY_I2C_BUS_ERROR_BIT (1 << 3)
#define CY_I2C_STOP_BIT_ERROR (1 << 4)
#define CY_I2C_BUS_BUSY_ERROR (1 << 5)
#define CY_I2C_ENABLE_PRECISE_TIMING 1
#define CY_I2C_EVENT_NOTIFICATION_LEN 3
//SPI related Macros
#define CY_SPI_CONFIG_LEN 16
#define CY_SPI_EVENT_NOTIFICATION_LEN 2
#define CY_SPI_READ_BIT (1)
#define CY_SPI_WRITE_BIT (1 << 1)
#define CY_SPI_SCB_INDEX_BIT (1 << 15)
#define CY_SPI_GET_STATUS_LEN 4
#define CY_SPI_UNDERFLOW_ERROR (1)
#define CY_SPI_BUS_ERROR (1 << 1)
//Vendor UART related macros
#define CY_UART_SET_FLOW_CONTROL_CMD 0x60
#define CY_UART_SEND_BREAK_CMD 0x17
#define CY_UART_CONFIG_LEN 16
#define CY_SET_LINE_CONTROL_STATE_CMD 0x22
#define CY_UART_EVENT_NOTIFICATION_LEN 10
#define CY_UART_SERIAL_STATE_CARRIER_DETECT 1
#define CY_UART_SERIAL_STATE_TRANSMISSION_CARRIER (1 << 1)
#define CY_UART_SERIAL_STATE_BREAK_DETECTION (1<< 2)
#define CY_UART_SERIAL_STATE_RING_SIGNAL_DETECTION (1 << 3)
#define CY_UART_SERIAL_STATE_FRAMING_ERROR (1 << 4)
#define CY_UART_SERIAL_STATE_PARITY_ERROR (1 << 5)
#define CY_UART_SERIAL_STATUE_OVERRUN (1 << 6)
//Bootloader related macros
#define CY_BOOT_CONFIG_SIZE 64
#define CY_DEVICE_CONFIG_SIZE 512
#define CY_FIRMWARE_BREAKUP_SIZE 4096
#define CY_GET_SILICON_ID_LEN 4
#define CY_GET_FIRMWARE_VERSION_LEN 8
#define CY_GET_SIGNATURE_LEN 4
//JTAG related Macros
#define CY_JTAG_OUT_EP 0x04
#define CY_JTAG_IN_EP 0x85
//GPIO related Macros
#define CY_GPIO_GET_LEN 2
#define CY_GPIO_SET_LEN 1
//PHDC related macros
#define CY_PHDC_SET_FEATURE 0X03
#define CY_PHDC_SET_FEATURE_WVALUE 0x0101
#define CY_PHDC_CLR_FEATURE 0X01
#define CY_PHDC_CLR_FEATURE_WVALUE 0x1
#define CY_PHDC_GET_DATA_STATUS 0x00
#define CY_PHDC_GET_STATUS_LEN 2
typedef enum CY_VENDOR_CMDS
{
CY_GET_VERSION_CMD = 0xB0, /**< Get the version of the boot-loader.
* value = 0, index = 0, length = 4;
* data_in = 32 bit version.
*/
CY_GET_SIGNATURE_CMD = 0xBD, /**< Get the signature of the firmware
* It is suppose to be 'CYUS' for normal firmware
* and 'CYBL' for Bootloader.
*/
CY_UART_GET_CONFIG_CMD = 0xC0, /**< Retreive the 16 byte UART configuration information.
* MS bit of value indicates the SCB index.
* length = 16, data_in = 16 byte configuration.
*/
CY_UART_SET_CONFIG_CMD, /**< Update the 16 byte UART configuration information.
* MS bit of value indicates the SCB index.
* length = 16, data_out = 16 byte configuration information.
*/
CY_SPI_GET_CONFIG_CMD, /**< Retreive the 16 byte SPI configuration information.
* MS bit of value indicates the SCB index.
* length = 16, data_in = 16 byte configuration.
*/
CY_SPI_SET_CONFIG_CMD, /**< Update the 16 byte SPI configuration information.
* MS bit of value indicates the SCB index.
* length = 16, data_out = 16 byte configuration information.
*/
CY_I2C_GET_CONFIG_CMD, /**< Retreive the 16 byte I2C configuration information.
* MS bit of value indicates the SCB index.
* length = 16, data_in = 16 byte configuration.
*/
CY_I2C_SET_CONFIG_CMD = 0xC5, /**< Update the 16 byte I2C configuration information.
* MS bit of value indicates the SCB index.
* length = 16, data_out = 16 byte configuration information.
*/
CY_I2C_WRITE_CMD, /**< Perform I2C write operation.
* value = bit0 - start, bit1 - stop, bit3 - start on idle,
* bits[14:8] - slave address, bit15 - scbIndex. length = 0. The
* data is provided over the bulk endpoints.
*/
CY_I2C_READ_CMD, /**< Perform I2C read operation.
* value = bit0 - start, bit1 - stop, bit2 - Nak last byte,
* bit3 - start on idle, bits[14:8] - slave address, bit15 - scbIndex,
* length = 0. The data is provided over the bulk endpoints.
*/
CY_I2C_GET_STATUS_CMD, /**< Retreive the I2C bus status.
* value = bit0 - 0: TX 1: RX, bit15 - scbIndex, length = 3,
* data_in = byte0: bit0 - flag, bit1 - bus_state, bit2 - SDA state,
* bit3 - TX underflow, bit4 - arbitration error, bit5 - NAK
* bit6 - bus error,
* byte[2:1] Data count remaining.
*/
CY_I2C_RESET_CMD, /**< The command cleans up the I2C state machine and frees the bus.
* value = bit0 - 0: TX path, 1: RX path; bit15 - scbIndex,
* length = 0.
*/
CY_SPI_READ_WRITE_CMD = 0xCA, /**< The command starts a read / write operation at SPI.
* value = bit 0 - RX enable, bit 1 - TX enable, bit 15 - scbIndex;
* index = length of transfer.
*/
CY_SPI_RESET_CMD, /**< The command resets the SPI pipes and allows it to receive new
* request.
* value = bit 15 - scbIndex
*/
CY_SPI_GET_STATUS_CMD, /**< The command returns the current transfer status. The count will match
* the TX pipe status at SPI end. For completion of read, read all data
* at the USB end signifies the end of transfer.
* value = bit 15 - scbIndex
*/
CY_JTAG_ENABLE_CMD = 0xD0, /**< Enable JTAG module */
CY_JTAG_DISABLE_CMD, /**< Disable JTAG module */
CY_JTAG_READ_CMD, /**< JTAG read vendor command */
CY_JTAG_WRITE_CMD, /**< JTAG write vendor command */
CY_GPIO_GET_CONFIG_CMD = 0xD8, /**< Get the GPIO configuration */
CY_GPIO_SET_CONFIG_CMD, /**< Set the GPIO configuration */
CY_GPIO_GET_VALUE_CMD, /**< Get GPIO value */
CY_GPIO_SET_VALUE_CMD, /**< Set the GPIO value */
CY_PROG_USER_FLASH_CMD = 0xE0, /**< Program user flash area. The total space available is 512 bytes.
* This can be accessed by the user from USB. The flash area
* address offset is from 0x0000 to 0x00200 and can be written to
* page wise (128 byte).
*/
CY_READ_USER_FLASH_CMD, /**< Read user flash area. The total space available is 512 bytes.
* This can be accessed by the user from USB. The flash area
* address offset is from 0x0000 to 0x00200 and can be written to
* page wise (128 byte).
*/
CY_DEVICE_RESET_CMD = 0xE3, /**< Performs a device reset from firmware */
} CY_VENDOR_CMDS;
extern libusb_context *glContext;

View File

@@ -1,586 +0,0 @@
/*
* Miscellaneous routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
typedef struct NOTIFICATION_CB_PARAM{
CY_HANDLE handle;
CY_EVENT_NOTIFICATION_CB_FN notificationCbFn;
}NOTIFICATION_CB_PARAM;
/*
This API is used to Read the Bootloder version
*/
CY_RETURN_STATUS CyGetFirmwareVersion(
CY_HANDLE handle,
CY_FIRMWARE_VERSION *firmwareVersion
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GET_VERSION_CMD;
wValue = 0x00;
wIndex = 0x00;
wLength = CY_GET_FIRMWARE_VERSION_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)firmwareVersion, wLength, ioTimeout);
if (rStatus > 0){
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
The API resets the device
*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyResetDevice (
CY_HANDLE handle /*Valid device handle*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle \n");
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_DEVICE_RESET_CMD;
wValue = 0xA6B6;
wIndex = 0xADBA;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
//return buffer will tell the status of the command
if (rStatus == LIBUSB_SUCCESS)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CySetGpioValue (
CY_HANDLE handle, /*Valid device handle*/
UINT8 gpioNumber, /*GPIO configuration value*/
UINT8 value /*Value that needs to be set*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest, buffer[CY_GPIO_SET_LEN];
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (value)
value = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GPIO_SET_VALUE_CMD;
wValue = gpioNumber;
wIndex = value;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, buffer, wLength, ioTimeout);
if (rStatus >= 0){
CY_DEBUG_PRINT_INFO ("CY: Get Configuration of GPIO succedded...size is %d \n", rStatus);
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyGetGpioValue (
CY_HANDLE handle, /*Valid device handle*/
UINT8 gpioNumber, /*GPIO configuration value*/
UINT8 *value /*Value that needs to be set*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest, buffer[CY_GPIO_GET_LEN];
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GPIO_GET_VALUE_CMD;
wValue = gpioNumber;
wIndex = 0x00;
wLength = CY_GPIO_GET_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, buffer, wLength, ioTimeout);
if (rStatus == CY_GPIO_GET_LEN){
CY_DEBUG_PRINT_INFO ("CY: Get GPIO Configuration succedded...size is %d \n", rStatus);
//return buffer will tell the status of the command
if (buffer[0] == 0){
(*value) = buffer[1];
return CY_SUCCESS;
}
else
return CY_ERROR_REQUEST_FAILED;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
static void LIBUSB_CALL uart_notification_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
void* uartSetEventNotifcation (void *inputParameters)
{
int rStatus, transferCompleted = 0, length = CY_UART_EVENT_NOTIFICATION_LEN;
CY_DEVICE *device;
libusb_device_handle *devHandle;
struct libusb_transfer *transfer;
UINT16 errorStatus = 0;
UCHAR uartStatus[CY_UART_EVENT_NOTIFICATION_LEN];
struct timeval time;
CY_EVENT_NOTIFICATION_CB_FN callbackFn;
NOTIFICATION_CB_PARAM *cbParameters = (NOTIFICATION_CB_PARAM*)inputParameters;
callbackFn = cbParameters->notificationCbFn;
device = (CY_DEVICE *)cbParameters->handle;
devHandle = device->devHandle;
callbackFn = cbParameters->notificationCbFn;
device->uartTransfer = transfer = libusb_alloc_transfer(0);
if (transfer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error in allocating trasnfer \n");
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn(errorStatus);
goto END;
}
while (device->uartCancelEvent == false){
libusb_fill_interrupt_transfer (transfer, devHandle, device->interruptEndpoint, uartStatus, length,
uart_notification_cb, &transferCompleted, CY_EVENT_NOTIFICATION_TIMEOUT);
rStatus = libusb_submit_transfer (transfer);
if (rStatus){
CY_DEBUG_PRINT_ERROR ("CY:Error submitting uart interrupt token ... Libusb error is %d\n", rStatus);
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn(errorStatus);
break;
}
time.tv_sec = 0;
time.tv_usec = 50;//polling timeout.
while (transferCompleted == 0){
libusb_handle_events_timeout (glContext, &time);
}
transferCompleted = 0;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_INFO ("Successfully read and recieved data %d \n", transfer->actual_length);
memcpy (&errorStatus, &uartStatus[8], 2);
printf ("%x %x ", uartStatus[8], uartStatus[9]);
callbackFn (errorStatus);
errorStatus = 0;
}
else{
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
if (device->uartCancelEvent == false){
CY_DEBUG_PRINT_ERROR ("CY:Error uart interrupt thread encountered error... Libusb transmission error is %d \n", transfer->status);
device->uartThreadId = 0;
callbackFn(errorStatus);
}
break;
}
}
CY_DEBUG_PRINT_INFO ("Exiting notification thread \n");
libusb_free_transfer (transfer);
END:
free (inputParameters);
return NULL;
}
static void LIBUSB_CALL spi_notification_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
void* spiSetEventNotifcation (void *inputParameters)
{
int transferCompleted = 0, length = CY_SPI_EVENT_NOTIFICATION_LEN;
CY_DEVICE *device;
libusb_device_handle *devHandle;
struct libusb_transfer *transfer;
UINT16 spiStatus = 0;
UINT16 errorStatus = 0;
struct timeval time;
CY_EVENT_NOTIFICATION_CB_FN callbackFn;
NOTIFICATION_CB_PARAM *cbParameters = (NOTIFICATION_CB_PARAM*)inputParameters;
callbackFn = cbParameters->notificationCbFn;
device = (CY_DEVICE *)cbParameters->handle;
devHandle = device->devHandle;
callbackFn = cbParameters->notificationCbFn;
device->spiTransfer = transfer = libusb_alloc_transfer(0);
if (transfer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error in allocating trasnfer \n");
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn (errorStatus);
goto END;
}
libusb_fill_interrupt_transfer (transfer, devHandle, device->interruptEndpoint, &spiStatus, length,
spi_notification_cb, &transferCompleted, CY_EVENT_NOTIFICATION_TIMEOUT);
while (device->spiCancelEvent == false){
if (libusb_submit_transfer (transfer)){
CY_DEBUG_PRINT_ERROR ("CY:Error submitting spi interrupt token ... \n");
errorStatus |= CY_ERROR_EVENT_FAILED_BIT;
callbackFn(errorStatus);
break;
}
time.tv_sec = 0;
time.tv_usec = 50;//polling timeout.
while (transferCompleted == 0){
libusb_handle_events_timeout (glContext, &time);
}
transferCompleted = 0;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_INFO ("Successfully read and recieved data %d \n", transfer->actual_length);
if (spiStatus & CY_SPI_UNDERFLOW_ERROR){
errorStatus |= (CY_SPI_TX_UNDERFLOW_BIT);
}
if (spiStatus & CY_SPI_BUS_ERROR){
errorStatus |= (CY_SPI_BUS_ERROR_BIT);
}
callbackFn (errorStatus);
errorStatus = 0;
}
else{
spiStatus |= CY_ERROR_EVENT_FAILED_BIT;
if (device->spiCancelEvent == false){
device->spiThreadId = 0;
CY_DEBUG_PRINT_ERROR ("CY:Error spi interrupt thread was cancelled... Libusb transmission error is %d \n", transfer->status);
callbackFn (spiStatus);
}
break;
}
}
libusb_free_transfer (transfer);
END:
free (inputParameters);
pthread_exit (NULL);
return NULL;
}
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CySetEventNotification(
CY_HANDLE handle, /*Valid handle to communicate with device*/
CY_EVENT_NOTIFICATION_CB_FN notificationCbFn /*Call back function in case on error during Uart data transfers*/
)
{
CY_DEVICE *device;
NOTIFICATION_CB_PARAM *args = NULL;
int ret;
pthread_t threadID;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (notificationCbFn == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE*)handle;
pthread_mutex_lock (&device->notificationLock);
args = (NOTIFICATION_CB_PARAM *)malloc (sizeof (NOTIFICATION_CB_PARAM));
args->handle = handle;
args->notificationCbFn = notificationCbFn;
if (device->deviceType == CY_TYPE_SPI){
if (device->spiThreadId != 0) {
CY_DEBUG_PRINT_ERROR ("CY:Error already notification thread exists ... Function is %s \n", __func__);
free (args);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_STATUS_MONITOR_EXIST;
}
ret = pthread_create (&threadID, NULL, spiSetEventNotifcation, (void *) args);
if (ret == 0){
device->spiThreadId = threadID;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else {
device->spiThreadId = 0;
free (args);
pthread_mutex_unlock (&device->notificationLock);
CY_DEBUG_PRINT_ERROR ("CY:Error creating spi notification thread ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
else if (device->deviceType == CY_TYPE_UART){
if (device->uartThreadId != 0) {
CY_DEBUG_PRINT_ERROR ("CY:Error already notification thread exists ... Function is %s \n", __func__);
free (args);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_STATUS_MONITOR_EXIST;
}
ret = pthread_create (&threadID, NULL, uartSetEventNotifcation, (void *) args);
if (ret == 0){
device->uartThreadId = threadID;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else {
device->uartThreadId = 0;
free (args);
pthread_mutex_unlock (&device->notificationLock);
CY_DEBUG_PRINT_ERROR ("CY:Error creating uart notification thread ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error unknown device type ....Function is %s \n", __func__);
free (args);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
}
/*The API is used to cancel the uart Event notification*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyAbortEventNotification(
CY_HANDLE handle /*Valid handle to communicate with device*/
)
{
CY_DEVICE *device;
device = (CY_DEVICE*)handle;
pthread_mutex_lock (&device->notificationLock);
if (device->deviceType == CY_TYPE_UART){
if (device->uartThreadId == 0){
CY_DEBUG_PRINT_ERROR ("CY:Error uart event notification not created ....function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
device->uartCancelEvent = true;
libusb_cancel_transfer (device->uartTransfer);
pthread_join (device->uartThreadId, NULL);
device->uartThreadId = 0;
device->uartCancelEvent = false;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else if (device->deviceType == CY_TYPE_SPI){
if (device->spiThreadId == 0){
CY_DEBUG_PRINT_ERROR ("CY:Error spi event notification not created ....function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
device->spiCancelEvent = true;
libusb_cancel_transfer (device->spiTransfer);
pthread_join (device->spiThreadId, NULL);
device->spiThreadId = 0;
device->spiCancelEvent = false;
pthread_mutex_unlock (&device->notificationLock);
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error.. unknown device type ....function is %s \n", __func__);
pthread_mutex_unlock (&device->notificationLock);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
The API is used to programme user flash area
*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyProgUserFlash (
CY_HANDLE handle, /*Valid device handle*/
CY_DATA_BUFFER *progBuffer, /*data buffer containing buffer address, length to write*/
UINT32 flashAddress, /*Address to the data is written*/
UINT32 ioTimeout /*Timeout value of the API*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
if ((progBuffer == NULL) || (progBuffer->buffer == NULL))
return CY_ERROR_INVALID_PARAMETER;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_PROG_USER_FLASH_CMD;
wValue = 0;
wIndex = flashAddress;
wLength = progBuffer->length;
CY_DEBUG_PRINT_INFO ("CY:The Length is %d , Value is %d and index is %d\n", wLength, wValue, wIndex);
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, progBuffer->buffer, wLength, ioTimeout);
if (rStatus > 0){
(progBuffer->transferCount) = rStatus;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
(progBuffer->transferCount) = 0;
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
(progBuffer->transferCount) = 0;
return CY_ERROR_REQUEST_FAILED;
}
}
/*
The API is used to programme user flash area
*/
CYWINEXPORT CY_RETURN_STATUS WINCALLCONVEN CyReadUserFlash (
CY_HANDLE handle, /*Valid device handle*/
CY_DATA_BUFFER *readBuffer, /*data buffer containing buffer address, length to write*/
UINT32 flashAddress, /*Address to the data is written*/
UINT32 ioTimeout /*Timeout value of the API*/
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
if (readBuffer == NULL)
return CY_ERROR_INVALID_PARAMETER;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_READ_USER_FLASH_CMD;
wValue = 0;
wIndex = flashAddress;
wLength = readBuffer->length;
CY_DEBUG_PRINT_INFO ("CY:The Length is %d , Value is %d and index is %d\n", wLength, wValue, wIndex);
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, readBuffer->buffer, wLength, ioTimeout);
if (rStatus > 0){
(readBuffer->transferCount) = rStatus;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
(readBuffer->transferCount) = 0;
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
(readBuffer->transferCount) = 0;
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API is used to get the signature of the device. It would be CYUS when we are in actual device mode
and CYBL when we are bootloader mode
*/
CY_RETURN_STATUS CyGetSignature (
CY_HANDLE handle,
UCHAR *signature
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_GET_SIGNATURE_CMD;
wValue = 0x00;
wIndex = 0x00;
wLength = CY_GET_SIGNATURE_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)signature, wLength, ioTimeout);
if (rStatus > 0){
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,644 +0,0 @@
/*
* SPI routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
#include <signal.h>
#include <sys/time.h>
#pragma pack (1)
typedef struct args {
CY_HANDLE handle;
UCHAR *readBuffer;
UINT32 length;
UINT32 ioTimeout;
CY_RETURN_STATUS rStatus;
UINT32 transferCount;
}args;
typedef struct
{
UINT32 frequency;
UINT8 dataWidth;
UCHAR mode;
UCHAR xferMode;
BOOL isMsbFirst;
BOOL isMaster;
BOOL isContinuous;
BOOL isSelectPrecede;
BOOL cpha;
BOOL cpol;
BOOL isLoopback;
UCHAR reserved[2];
} CyUsSpiConfig_t;
#pragma pack()
struct timeval startSpiTimeWrite, endSpiTimeWrite, startSpiTimeRead, endSpiTimeRead;
//Timer helper functions for proper timing
void startSpiTick (bool isWrite) {
if (isWrite)
gettimeofday (&startSpiTimeWrite, NULL);
else
gettimeofday (&startSpiTimeRead, NULL);
}
UINT32 getSpiLapsedTime (bool isWrite){
signed int currentTime_sec, currentTime_usec, currentTime;
if (isWrite){
gettimeofday (&endSpiTimeWrite, NULL);
currentTime_sec = (endSpiTimeWrite.tv_sec - startSpiTimeWrite.tv_sec) * 1000;
currentTime_usec = ((endSpiTimeWrite.tv_usec - startSpiTimeWrite.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
else{
gettimeofday (&endSpiTimeRead, NULL);
currentTime_sec = (endSpiTimeRead.tv_sec - startSpiTimeRead.tv_sec) * 1000;
currentTime_usec = ((endSpiTimeRead.tv_usec - startSpiTimeRead.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
}
/*
This API gets the current SPI config
for the particluar interface of the device
*/
CY_RETURN_STATUS CyGetSpiConfig (
CY_HANDLE handle,
CY_SPI_CONFIG *spiConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
CyUsSpiConfig_t localSpiConfig;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (spiConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not spi ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (device->interfaceNum > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_SPI_GET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_SPI_CONFIG_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localSpiConfig, wLength, ioTimeout);
if (rStatus == CY_SPI_CONFIG_LEN){
//CY_DUMP_DATA ((unsigned char*)&localSpiConfig, wLength);
CY_DEBUG_PRINT_INFO ("CY: Read SPI config successfully %d\n", rStatus);
spiConfig->frequency = localSpiConfig.frequency;
spiConfig->dataWidth = localSpiConfig.dataWidth;
spiConfig->protocol = localSpiConfig.mode;
spiConfig->isMsbFirst = localSpiConfig.isMsbFirst;
spiConfig->isMaster = localSpiConfig.isMaster;
spiConfig->isContinuousMode = localSpiConfig.isContinuous;
spiConfig->isSelectPrecede = localSpiConfig.isSelectPrecede;
spiConfig->isCpha = localSpiConfig.cpha;
spiConfig->isCpol = localSpiConfig.cpol;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ... Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s...libusb error is %d !\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API sets SPI config of the device for that
interface
*/
CY_RETURN_STATUS CySetSpiConfig (
CY_HANDLE handle,
CY_SPI_CONFIG *spiConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
CyUsSpiConfig_t localSpiConfig;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (spiConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (spiConfig->frequency < 1000 || spiConfig->frequency > 3000000){
CY_DEBUG_PRINT_ERROR ("CY:Error frequency trying to set in out of range ... Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (spiConfig->protocol == CY_SPI_TI){
if (!(spiConfig->isCpol == false && spiConfig->isCpha == true && spiConfig->isContinuousMode == false)){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Wrong configuration for SPI TI mode \n");
return CY_ERROR_REQUEST_FAILED;
}
}
if (spiConfig->protocol == CY_SPI_NS){
if (!(spiConfig->isCpol == false && spiConfig->isCpha == false && spiConfig->isSelectPrecede == false)){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Wrong configuration for SPI ti mode \n");
return CY_ERROR_REQUEST_FAILED;
}
}
else{
if (spiConfig->isSelectPrecede != false){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Wrong configuration for SPI motorola mode \n");
return CY_ERROR_REQUEST_FAILED;
}
}
if (device->interfaceNum > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SPI_SET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_SPI_CONFIG_LEN;
//We will not expose all the spi config structure elements to user.
//Fill in rest of the values.
memset (&localSpiConfig, 0, CY_SPI_CONFIG_LEN);
localSpiConfig.frequency = spiConfig->frequency;
localSpiConfig.dataWidth = spiConfig->dataWidth;
localSpiConfig.mode = spiConfig->protocol;
localSpiConfig.isMsbFirst = spiConfig->isMsbFirst;
localSpiConfig.isMaster = spiConfig->isMaster;
localSpiConfig.isContinuous = spiConfig->isContinuousMode;
localSpiConfig.isSelectPrecede = spiConfig->isSelectPrecede;
localSpiConfig.cpha = spiConfig->isCpha;
localSpiConfig.cpol = spiConfig->isCpol;
//CY_DUMP_DATA ((unsigned char*)&localSpiConfig, wLength);
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localSpiConfig, wLength, ioTimeout);
if (rStatus == CY_SPI_CONFIG_LEN){
CY_DEBUG_PRINT_INFO ("CY: Setting SPI config success ...\n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ... !libusb error is %d\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*Api will reset the spi module*/
CY_RETURN_STATUS CySpiReset (CY_HANDLE handle)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_SPI_RESET_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS));
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending spi reset command...Libusb error is %d\n", rStatus);
return rStatus;
}
return CY_SUCCESS;
}
/*
This API reads SPI data from the specified interface of the device
interface
*/
static void LIBUSB_CALL spi_read_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
//We adopted for async method here because there are 2 thread polling same fd
// i.e both read and write are polling same fd when one event triggers and other one is
//not completed then another thread will wait for more than 60sec.
CY_RETURN_STATUS CySpiRead (
CY_HANDLE handle,
CY_DATA_BUFFER *readBuffer,
UINT32 ioTimeout
)
{
struct libusb_transfer *readTransfer;
CY_DEVICE *device;
libusb_device_handle *devHandle;
int readCompleted = 0;
struct timeval time;
int r;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
readBuffer->transferCount = 0;
readTransfer = libusb_alloc_transfer(0);
if (readTransfer == NULL){
CY_DEBUG_PRINT_ERROR("CY:Error in allocating transfers \n");
return CY_ERROR_ALLOCATION_FAILED;
}
libusb_fill_bulk_transfer(readTransfer, devHandle, device->inEndpoint, readBuffer->buffer, readBuffer->length,
spi_read_cb, &readCompleted, ioTimeout);
libusb_submit_transfer (readTransfer);
time.tv_sec = (ioTimeout / 1000);
time.tv_usec = ((ioTimeout % 1000) * 1000);//polling timeout.
while (readCompleted == 0){
r = libusb_handle_events_timeout_completed(glContext, &time, &readCompleted);
if (r < 0) {
if (r == LIBUSB_ERROR_INTERRUPTED)
continue;
libusb_cancel_transfer(readTransfer);
while (!readCompleted)
if (libusb_handle_events_completed(glContext, &readCompleted) < 0)
break;
readBuffer->transferCount = readTransfer->actual_length;
libusb_free_transfer(readTransfer);
return r;
}
}
if (readTransfer->status == LIBUSB_TRANSFER_COMPLETED){
readBuffer->transferCount = readTransfer->actual_length;
libusb_free_transfer (readTransfer);
return CY_SUCCESS;
}
else{
if (readTransfer->status == LIBUSB_TRANSFER_TIMED_OUT){
//We should not be hitting this case.. As the time out is infinite!!
CY_DEBUG_PRINT_ERROR ("CY:Timeout error in doing SPI read/write .... %d Libusb errors %d\n",
readTransfer->actual_length,readTransfer->status);
readBuffer->transferCount = readTransfer->actual_length;
CySpiReset (handle);
libusb_free_transfer (readTransfer);
return CY_ERROR_IO_TIMEOUT;
}
if (readTransfer->status == LIBUSB_TRANSFER_OVERFLOW){
//Need to handle this properly!
CY_DEBUG_PRINT_ERROR ("CY:OverFlow error in doing SPI read/write .... Libusb errors %d %d \n",
readTransfer->status, readTransfer->actual_length);
readBuffer->transferCount = readTransfer->actual_length;
CySpiReset (handle);
libusb_free_transfer (readTransfer);
return CY_ERROR_BUFFER_OVERFLOW;
}
if (readTransfer->status != LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_ERROR ("CY:Error in doing SPI read/write .... Libusb errors are %d %d\n",
readTransfer->status, readTransfer->actual_length);
readBuffer->transferCount = readTransfer->actual_length;
CySpiReset (handle);
libusb_free_transfer (readTransfer);
//If timer is not completed then it implies we have timeout error
return CY_ERROR_REQUEST_FAILED;
}
}
return CY_ERROR_REQUEST_FAILED;
}
/*Internal SPI get status API for Write operation*/
CY_RETURN_STATUS CyGetSpiStatus (CY_HANDLE handle,
int *spiStatus
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;;
UINT16 scbIndex = 0;
UINT32 ioTimeout = 0;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_SPI_GET_STATUS_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS));
wIndex = 0;
wLength = CY_SPI_GET_STATUS_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, (UCHAR*)spiStatus, wLength, ioTimeout);
if (rStatus < CY_SPI_GET_STATUS_LEN){
CY_DEBUG_PRINT_INFO ("CY:Error in sending spi Get Status command...Libusb error is %d\n", rStatus);
return rStatus;
}
return CY_SUCCESS;
}
/* Function to write on to SPI alone*/
CY_RETURN_STATUS CySpiWrite (
CY_HANDLE handle,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
int spiStatus = 1;
UINT32 newIoTimeout = ioTimeout, elapsedTime = 0, loopCount = 1;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not spi ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
startSpiTick (true);
rStatus = libusb_bulk_transfer (devHandle, device->outEndpoint, writeBuffer->buffer, writeBuffer->length,
(int*)&(writeBuffer->transferCount), newIoTimeout);
elapsedTime = getSpiLapsedTime(true);
newIoTimeout = ioTimeout - elapsedTime;
//because we have a sleep of 1 msec after every getstatus
if (newIoTimeout)
loopCount = (newIoTimeout);
if (rStatus == LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY: Successfully written SPI data.. %d bytes Read ...\n", writeBuffer->transferCount);
while (loopCount){
usleep (1000);
rStatus = CyGetSpiStatus (handle, &spiStatus);
if (rStatus == CY_SUCCESS){
if (spiStatus == 0){
return CY_SUCCESS;
}
}
else {
//Should never hit this case
CY_DEBUG_PRINT_ERROR ("CY:Error in getting spi status \n");
return CY_ERROR_REQUEST_FAILED;
}
if (ioTimeout)
loopCount--;
}
if (loopCount == 0 && spiStatus > 0){
writeBuffer->length = 0;
CySpiReset (handle);
return CY_ERROR_IO_TIMEOUT;
}
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error TimeOut ...function is %s\n", __func__);
CySpiReset (handle);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Error Pipe error..function is %s\n", __func__);
CySpiReset (handle);
CyResetPipe (handle, device->outEndpoint);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow...function is %s\n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY:Error Device Disconnected ...function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in writing SPI data ...Libusb Error is %d and bytes read is %d!\n", rStatus, writeBuffer->transferCount);
return CY_ERROR_REQUEST_FAILED;
}
return CY_ERROR_REQUEST_FAILED;
}/*
API to wrap up the data
*/
void spiCollectData (void *inputParameters) {
UINT32 readLength = 0, length;
CY_DATA_BUFFER readBuffer;
args *inputData = (args *) inputParameters;
UCHAR *buffer;
CY_RETURN_STATUS rStatus = CY_SUCCESS;
buffer = readBuffer.buffer = inputData->readBuffer;
length = readBuffer.length = inputData->length;
CY_HANDLE handle = inputData->handle;
int newTimeout = inputData->ioTimeout, elapsedTime;
while (readLength != length && newTimeout >= 0 && rStatus == CY_SUCCESS){
//Get current time
//Buffer is pointing to next address where we are suppose to fill the data
readBuffer.buffer = &buffer[readLength];
//Updated length which total length minus the total length of data read
readBuffer.length = length - readLength;
//Libusb fix for mac os!!
//ISSUE:when api times out in MAC it comes back and say read length = 0!!
#ifdef __APPLE__
if (readBuffer.length > 64)
readBuffer.length = 64;
#endif
startSpiTick (false);
rStatus = CySpiRead (handle, &readBuffer, newTimeout);
elapsedTime = getSpiLapsedTime (false);
//Do this only when newTimeout is non zero
if (newTimeout){
newTimeout = newTimeout - elapsedTime;
//If timeout is 0 then libusb considers that as infinite
//So forcefully make the loop to comeout
if (newTimeout <= 0)
rStatus = CY_ERROR_IO_TIMEOUT;
}
if (rStatus != CY_SUCCESS){
readLength += readBuffer.transferCount;
break;
}
readLength += readBuffer.transferCount;
}
if (readLength != length && rStatus == CY_ERROR_IO_TIMEOUT){
CySpiReset (handle);
}
inputData->transferCount = readLength;
inputData->rStatus = rStatus;
}
/*
* Api used to do read as well as write on spi
*/
CY_RETURN_STATUS CySpiReadWrite (CY_HANDLE handle,
CY_DATA_BUFFER *readBuffer,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout)
{
struct args threadParameter;
UINT32 ret;
pthread_t readThreadID = (pthread_t)0;
CY_DEVICE *device;
libusb_device_handle *devHandle;
CY_RETURN_STATUS rStatus;
unsigned short spiTransferMode = 0, scbIndex = 0;
UINT16 wValue, wIndex = 0, wLength;
UINT16 bmRequestType, bmRequest;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (readBuffer == NULL && writeBuffer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_SPI) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not spi .. \n");
return CY_ERROR_REQUEST_FAILED;
}
//Set both the bits and change it accordingly based on parameters parameters
spiTransferMode |= ((CY_SPI_READ_BIT) | (CY_SPI_WRITE_BIT));
if ((readBuffer == NULL || readBuffer->length == 0 || readBuffer->buffer == NULL))
spiTransferMode &= ~(CY_SPI_READ_BIT);
if ((writeBuffer == NULL || writeBuffer->length == 0 || writeBuffer->buffer == NULL))
spiTransferMode &= ~(CY_SPI_WRITE_BIT);
//if none of the bit is set it implies parameters sent is wrong
if (spiTransferMode == 0){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (device->interfaceNum > 0)
scbIndex = 1;
//In read only case we take length to be equal to readBuffer length.
//But in write or in write/read case we take length = writeBuffer length.
if (spiTransferMode == 0x1)
wIndex = readBuffer->length;
else
wIndex = writeBuffer->length;
spiTransferMode |= (scbIndex << 15);
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SPI_READ_WRITE_CMD;
wValue = (spiTransferMode);
wLength = 0;
if (pthread_mutex_trylock (&device->writeLock) == 0){
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, 5000);
if (rStatus){
CY_DEBUG_PRINT_ERROR ("CY:Error Sending spi read write vendor command failed ... Libusb error is %d\n", rStatus);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_REQUEST_FAILED;
}
//Read Bit is not set then write Only
if (!(spiTransferMode & CY_SPI_READ_BIT)) {
writeBuffer->transferCount = 0;
if (readBuffer)
readBuffer->transferCount = 0;
rStatus = CySpiWrite (handle, writeBuffer, ioTimeout);
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
//Write Bit is not set then read only
if (!(spiTransferMode & CY_SPI_WRITE_BIT)) {
// We are starting a thread so that we can collect all the data
// FIX for short length packet issue on SPI.
readBuffer->transferCount = 0;
if (writeBuffer)
writeBuffer->transferCount = 0;
threadParameter.handle = handle;
threadParameter.readBuffer = readBuffer->buffer;
threadParameter.length = readBuffer->length;
threadParameter.ioTimeout = ioTimeout;
ret = pthread_create (&readThreadID, NULL, (void *)spiCollectData, (void *)&threadParameter);
if (ret){
CY_DEBUG_PRINT_ERROR ("CY:Error in creating read thread ... Reading failed \n");
pthread_mutex_unlock (&device->writeLock);
readBuffer->transferCount = 0;
return CY_ERROR_REQUEST_FAILED;
}
pthread_join (readThreadID, NULL);
readBuffer->transferCount = threadParameter.transferCount;
pthread_mutex_unlock (&device->writeLock);
return threadParameter.rStatus;
}
writeBuffer->transferCount = 0;
readBuffer->transferCount = 0;
threadParameter.handle = handle;
threadParameter.readBuffer = readBuffer->buffer;
threadParameter.length = readBuffer->length;
threadParameter.ioTimeout = ioTimeout;
ret = pthread_create (&readThreadID, NULL, (void *)spiCollectData, (void *)&threadParameter);
if (ret){
CY_DEBUG_PRINT_ERROR ("CY:Error in creating read thread ... Reading failed \n");
readBuffer->transferCount = 0;
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = CySpiWrite (handle, writeBuffer, ioTimeout);
if (rStatus == CY_SUCCESS) {
pthread_join (readThreadID, NULL);
rStatus = threadParameter.rStatus;
readBuffer->transferCount = threadParameter.transferCount;
}
else {
pthread_join (readThreadID, NULL);
readBuffer->transferCount = threadParameter.transferCount;
}
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error API busy in service previous request ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
return rStatus;
}

View File

@@ -1,588 +0,0 @@
/*
* UART routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
#pragma pack(1)
typedef struct {
CY_UART_BAUD_RATE baudRate;
UINT8 pinType;
UINT8 dataWidth;
UINT8 stopBits;
UINT8 mode;
UINT8 parity;
UINT8 isMsbFirst;
UINT8 txRetry;;
UINT8 rxInvertPolarity;
UINT8 rxIgnoreError;
UINT8 isFlowControl;
UINT8 isLoopBack;
UINT8 flags;
}CyUsUartConfig_t;
#pragma pack()
//Timer helper functions for proper timing
UINT32 getUartLapsedTime (struct timeval startTime){
signed int currentTime_sec, currentTime_usec, currentTime;
struct timeval endTime;
gettimeofday (&endTime, NULL);
currentTime_sec = (endTime.tv_sec - startTime.tv_sec) * 1000;
currentTime_usec = ((endTime.tv_usec - startTime.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
/*
This API gets the current UART configuration of the
device.Such as GPIO's assigned, flowcontrol, BaudRate
etc.
*/
CY_RETURN_STATUS CyGetUartConfig (
CY_HANDLE handle,
PCY_UART_CONFIG uartConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
CyUsUartConfig_t localUartConfig;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (uartConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (device->interfaceNum > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_UART_GET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_UART_CONFIG_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localUartConfig, wLength, ioTimeout);
//Since we are not exposing all the configuration elements
//parse and fill only relevant elements.
if (rStatus == CY_UART_CONFIG_LEN){
uartConfig->dataWidth = localUartConfig.dataWidth;
uartConfig->baudRate = localUartConfig.baudRate;
uartConfig->stopBits = localUartConfig.stopBits;
uartConfig->parityMode = (CY_UART_PARITY_MODE)localUartConfig.parity;;
uartConfig->isDropOnRxErrors = localUartConfig.rxIgnoreError;
//We are currently ignoring rest of the bits
CY_DEBUG_PRINT_INFO ("CY:Successfully read UART Config\n");
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error in reading UART config ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API sets the current UART configuration of the
device.Such as GPIO's assigned, flowcontrol, BaudRate
etc.
*/
CY_RETURN_STATUS CySetUartConfig (
CY_HANDLE handle,
CY_UART_CONFIG *uartConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CyUsUartConfig_t localUartConfig;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
UINT8 scbIndex = 0;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (uartConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (uartConfig->dataWidth < 7 || uartConfig->dataWidth > 8){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (uartConfig->stopBits < 1 || uartConfig->stopBits > 2){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->interfaceNum > 0)
scbIndex = 1;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_UART_SET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0;
wLength = CY_UART_CONFIG_LEN;
memset (&localUartConfig, 0, CY_UART_CONFIG_LEN);
//Fill in rest of the UART config structure elements
//that are not exposed in API with default values
localUartConfig.baudRate = uartConfig->baudRate;
localUartConfig.dataWidth = uartConfig->dataWidth;
localUartConfig.stopBits = uartConfig->stopBits;
localUartConfig.parity = (UCHAR) uartConfig->parityMode;
localUartConfig.rxIgnoreError = uartConfig->isDropOnRxErrors;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localUartConfig, wLength, ioTimeout);
if (rStatus == CY_UART_CONFIG_LEN){
CY_DEBUG_PRINT_INFO ("CY:Successfully Set UART Config \n");
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error in Setting UART config ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api writes the Data to UART block of the
device.
*/
CY_RETURN_STATUS CyUartWrite (
CY_HANDLE handle,
CY_DATA_BUFFER* writeBuffer,
unsigned int ioTimeOut
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((writeBuffer == NULL) || (writeBuffer->buffer == NULL) || (writeBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameters..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
writeBuffer->transferCount = 0;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = libusb_bulk_transfer (devHandle, device->outEndpoint, writeBuffer->buffer, writeBuffer->length,
(int *)&((writeBuffer->transferCount)), ioTimeOut);
if (rStatus == CY_SUCCESS) {
CY_DEBUG_PRINT_INFO ("CY: SuccessFull in Wrting Data,%d bytes were transfered \n", (writeBuffer->transferCount));
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error ...Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Pipe error endpoint Halted ...Function is %s\n", __func__);
CyResetPipe (handle, device->outEndpoint);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow occured ...Function is %s\n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected .... Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Unknown error ....Libusb error is %d Function is %s\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api Reads the Data from UART block of the
device.
*/
CY_RETURN_STATUS CyUartRead (
CY_HANDLE handle,
CY_DATA_BUFFER* readBuffer,
unsigned int ioTimeOut
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 length, totalRead = 0, newIoTimeout = ioTimeOut, elapsedTime;
int transferCount;
UCHAR *buffer;
struct timeval startTime;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((readBuffer == NULL) || (readBuffer->buffer == NULL) || (readBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameters..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
length = readBuffer->length;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
readBuffer->transferCount = 0;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
//Collect all the data in low baud rate for uart. As we get data in short packet
do {
// buffer will be pointing to new pointer
buffer = &(readBuffer->buffer[totalRead]);
//Start the tick
gettimeofday(&startTime, NULL);
rStatus = libusb_bulk_transfer (devHandle, device->inEndpoint, buffer, length,
&transferCount, newIoTimeout);
elapsedTime = getUartLapsedTime(startTime);
//Get the new timeout.
newIoTimeout = newIoTimeout - elapsedTime;
//Initialise totalRead to initially read + bytes returned now
totalRead += transferCount;
//length will initial length - transferCount
length = (length - transferCount);
}while ((rStatus == CY_SUCCESS) && (totalRead != readBuffer->length) && (newIoTimeout > 0));
if (newIoTimeout <= 0 && totalRead != readBuffer->length)
rStatus = LIBUSB_ERROR_TIMEOUT;
if (rStatus == CY_SUCCESS){
//CY_DUMP_DATA (readBuffer->buffer, readBuffer->transferCount);
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_INFO ("CY: SuccessFull in Reading Data,%d bytes were transfered \n", (readBuffer->transferCount));
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error... Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY:Pipe error endpoint Halted ...Function is %s\n", __func__);
CyResetPipe (handle, device->inEndpoint);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow occured ...Function is %s\n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
readBuffer->transferCount = totalRead;
CY_DEBUG_PRINT_ERROR ("CY: Unknown error ....Libusb error is %d Function is %s\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api sets the hardware flow control
*/
CY_RETURN_STATUS CyUartSetHwFlowControl (
CY_HANDLE handle,
CY_FLOW_CONTROL_MODES mode
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (mode > 3){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_UART_SET_FLOW_CONTROL_CMD;
wValue |= mode;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in setting uart flow control ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
device->uartFlowControlMode = mode;
return CY_SUCCESS;
}
/*
Api gets the current flow control mode
*/
CY_RETURN_STATUS CyUartGetHwFlowControl (
CY_HANDLE handle,
CY_FLOW_CONTROL_MODES *mode
)
{
CY_DEVICE *device;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (mode == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid input parameters..Function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
(*mode) = device->uartFlowControlMode;
return CY_SUCCESS;
}
/* The API is used to break
*/
CYWINEXPORT CY_RETURN_STATUS CyUartSetBreak(
CY_HANDLE handle, /*Valid handle to communicate with device*/
UINT16 timeout /*Break timeout value in milliseconds */
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_UART_SEND_BREAK_CMD;
wValue = timeout;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in setting break ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/*
This Api sets the RTS UART pins High
*/
CY_RETURN_STATUS CyUartSetRts (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue |= (1 << 1) | (device->dtrValue);
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->rtsValue = 1;
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in setting RTS of UART ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api clears the RTS UART pin and makes it low
*/
CY_RETURN_STATUS CyUartClearRts (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue = (device->dtrValue);
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->rtsValue = 0;
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in clearing RTS of UART ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api sets the DTR UART pin High
*/
CY_RETURN_STATUS CyUartSetDtr (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue = ((device->rtsValue) << 1) | 1;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->dtrValue = 1;
return CY_SUCCESS;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error in setting DTR of UART ... Libusb Error is %d \n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This Api clears the DTR UART pin and makes it low
*/
CY_RETURN_STATUS CyUartClearDtr (
CY_HANDLE handle
)
{
UINT16 wValue = 0, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle..Function is %s\n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_UART){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device type needs to be uart..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_SET_LINE_CONTROL_STATE_CMD;
wValue = ((device->rtsValue) << 1);
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == CY_SUCCESS){
device->dtrValue = 0;
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error in function %s... Libusb Error is %d \n",__func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,638 +0,0 @@
/*
* USB routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
libusb_context *glContext = NULL;
static bool glDriverInit = false;
static libusb_device **glDeviceList;
static int glNumDevices;
/*The API initializes the Libusb library
*/
pthread_mutex_t criticalSection;
CY_RETURN_STATUS CyLibraryInit ()
{
int rStatus = LIBUSB_SUCCESS;
if (!glContext)
rStatus = libusb_init (&glContext);
if (glDriverInit != true){
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Driver Init Failed ...\n");
return CY_ERROR_DRIVER_INIT_FAILED;
}
glNumDevices = libusb_get_device_list (glContext, &glDeviceList);
if (glNumDevices < 0){
CY_DEBUG_PRINT_ERROR ("CY:Building device list Failed ...\n");
glNumDevices = -1;
return CY_ERROR_DRIVER_INIT_FAILED;
}
pthread_mutex_init (&criticalSection, NULL);
glDriverInit = true;
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error ... library already initialized \n");
return CY_ERROR_DRIVER_INIT_FAILED;
}
}
/*
This API needs to be called after Calling CyGetListofDevices.
*/
CY_RETURN_STATUS CyLibraryExit ()
{
if (glDriverInit == true){
if (glNumDevices >= 0)
libusb_free_device_list (glDeviceList, 1);
if (glContext) {
libusb_exit (glContext);
glContext = NULL;
}
glDriverInit = false;
pthread_mutex_destroy (&criticalSection);
return CY_SUCCESS;
}
CY_DEBUG_PRINT_ERROR ("CY:Error ... Library not initialized \n");
return CY_ERROR_REQUEST_FAILED;
}
/*
* This function Gets the number of all the devices currently
* Connected to the host (It includes Cypress Device as well as
* no Cypress Devices connected)
*/
CY_RETURN_STATUS CyGetListofDevices (
UINT8 *numDevices
)
{
// Use this variable to call libusb_close and exit of the application
if (numDevices == NULL)
return CY_ERROR_INVALID_PARAMETER;
if (!glDriverInit){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
pthread_mutex_lock (&criticalSection);
libusb_free_device_list (glDeviceList, 1);
glNumDevices = (*numDevices) = libusb_get_device_list (glContext, &glDeviceList);
pthread_mutex_unlock (&criticalSection);
if (glNumDevices < 0){
CY_DEBUG_PRINT_ERROR ("CY:Building device list Failed ...function is %s\n", __func__);
glNumDevices = -1;
(*numDevices) = -1;
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/* This function gets all the neccessary info such as VID,PID,
String Descriptors and if is a cypress serial device you will
get the info on class and device type
*/
CY_RETURN_STATUS CyGetDeviceInfo (
UINT8 deviceNumber,
CY_DEVICE_INFO *deviceInfo
)
{
struct libusb_device_descriptor deviceDesc;
int rStatus;
UINT32 numInterfaces;
UINT8 iManufacturer, iProduct, iSerial;
libusb_device *usbDevice;;
struct libusb_config_descriptor *configDesc;
libusb_device_handle *devHandle;
// Get the list of descriptor info for the device
if (glDriverInit == false){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (deviceInfo == NULL)
return CY_ERROR_INVALID_PARAMETER;
pthread_mutex_lock (&criticalSection);
if (deviceNumber >= glNumDevices){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device number... \n");
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_INVALID_PARAMETER;
}
usbDevice = glDeviceList[deviceNumber];
rStatus = libusb_get_device_descriptor (usbDevice, &deviceDesc);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error ... unable to retrieve device descriptor \n");
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
deviceInfo->vidPid.vid = deviceDesc.idVendor;
deviceInfo->vidPid.pid = deviceDesc.idProduct;
// Get the all the index of the String descriptors so that it can be used
// to retrieve the string descriptor info.
iManufacturer = deviceDesc.iManufacturer;
iProduct = deviceDesc.iProduct;
iSerial = deviceDesc.iSerialNumber;
//Get the Device handle so that we can communicate with the device retreiving
// descriptor info
deviceInfo->manufacturerName[0] = '\0';
deviceInfo->productName[0] = '\0';
deviceInfo->serialNum[0] = '\0';
rStatus = libusb_open (usbDevice, &devHandle);
if (rStatus == LIBUSB_ERROR_ACCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error ...Insufficient permission... Libusb error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ACCESS_DENIED;
}
else if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in opening the device... Libusb error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
if (iManufacturer > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iManufacturer, deviceInfo->manufacturerName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting Manufacturer name Error is <%x> \n", rStatus);
}
}
if (iProduct > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iProduct, deviceInfo->productName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting product name Error is <%d> \n", rStatus);
}
}
if (iSerial > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iSerial, deviceInfo->serialNum, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting Serial name <%d>\n", rStatus);
}
}
rStatus = libusb_get_config_descriptor (usbDevice, 0, &configDesc);
if (rStatus == LIBUSB_SUCCESS){
UINT32 index_i = 0;
const struct libusb_interface *interface;
numInterfaces = configDesc->bNumInterfaces;
deviceInfo->numInterfaces = numInterfaces;
interface = configDesc->interface;
while ((numInterfaces) && (index_i < CY_MAX_DEVICE_INTERFACE)){
deviceInfo->deviceClass[index_i] = (CY_DEVICE_CLASS)interface->altsetting->bInterfaceClass;
if (deviceInfo->deviceClass[index_i] == CY_CLASS_VENDOR){
deviceInfo->deviceType[index_i] = (CY_DEVICE_TYPE)interface->altsetting->bInterfaceSubClass;
}
else
deviceInfo->deviceType[index_i] = CY_TYPE_DISABLED;
index_i++;
numInterfaces--;
interface++;
}
libusb_free_config_descriptor(configDesc);
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in Getting config descriptor ...Libusb error is %d \n", rStatus);
if (devHandle)
libusb_close (devHandle);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
if (devHandle)
libusb_close (devHandle);
pthread_mutex_unlock (&criticalSection);
return CY_SUCCESS;
}
/* This function gets all the neccessary info such as VID,PID,
String Descriptors and if is a cypress serial device you will
get the info on class and device type
*/
CY_RETURN_STATUS CyGetDeviceInfoVidPid (
CY_VID_PID vidPid,
UINT8 *deviceNumber,
PCY_DEVICE_INFO deviceInfoList,
UINT8 *deviceCount,
UINT8 infoListLength
)
{
struct libusb_device_descriptor deviceDesc;
int rStatus = CY_ERROR_DRIVER_INIT_FAILED;
UINT32 numInterfaces, index = 0;
int devNum;
UINT8 iManufacturer, iProduct, iSerial;
libusb_device *usbDevice;
struct libusb_config_descriptor *configDesc;
libusb_device_handle *devHandle = NULL;
PCY_DEVICE_INFO deviceInfo;
if (glDriverInit == false){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if ((infoListLength) < 1){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid device info list length specified should be > 0 .. function is %s\n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (deviceNumber == NULL || deviceInfoList == NULL || deviceCount == NULL)
return CY_ERROR_INVALID_PARAMETER;
// Get the list of descriptor info for the device
(*deviceCount) = 0;
pthread_mutex_lock (&criticalSection);
for (devNum = 0; devNum < glNumDevices; devNum++) {
//We are making sure that we do not overrun
//the list.
deviceInfo = &(deviceInfoList [index]);
usbDevice = glDeviceList[devNum];
rStatus = libusb_get_device_descriptor (usbDevice, &deviceDesc);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in getting device descriptor for device-%d... Libusb Error is %d \n", devNum, rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
if ((deviceDesc.idVendor != vidPid.vid) || (deviceDesc.idProduct != vidPid.pid)){
continue;
}
(*deviceCount)++;
if (index > infoListLength){
continue;
}
rStatus = libusb_open (usbDevice, &devHandle);
if (rStatus == LIBUSB_ERROR_ACCESS){
CY_DEBUG_PRINT_ERROR ("CY:Insufficient permission ... Libusb error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ACCESS_DENIED;
}
else if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Opening the Device ...Error is %d \n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
deviceNumber[index] = devNum;
index++;
deviceInfo->vidPid.vid = deviceDesc.idVendor;
deviceInfo->vidPid.pid = deviceDesc.idProduct;
// Get all the index of the String descriptors so that it can be used
// to retrieve the string descriptor info.
iManufacturer = deviceDesc.iManufacturer;
iProduct = deviceDesc.iProduct;
iSerial = deviceDesc.iSerialNumber;
//Get the Device handle so that we can communicate with the device retreiving
// descriptor info
//Initialise manufacturer, product and serial names
deviceInfo->manufacturerName[0] = '\0';
deviceInfo->productName[0] = '\0';
deviceInfo->serialNum[0] = '\0';
if (iManufacturer > 0) {
rStatus = libusb_get_string_descriptor_ascii (devHandle, iManufacturer, deviceInfo->manufacturerName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:Error in Getting Manufacturer name Error is <%d> \n",rStatus);
}
}
if (iProduct > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iProduct, deviceInfo->productName, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:Error in Getting product name Error is <%d> \n", rStatus);
}
}
if (iSerial > 0){
rStatus = libusb_get_string_descriptor_ascii (devHandle, iSerial, deviceInfo->serialNum, 256);
if (rStatus <= LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:Error in Getting Serial name <%d>\n", rStatus);
}
}
CY_DEBUG_PRINT_INFO ("Manufacturer name <%s> \nProduct Name <%s> \nserial number <%s> \n",
deviceInfo->manufacturerName,deviceInfo->productName,deviceInfo->serialNum);
rStatus = libusb_get_config_descriptor (usbDevice, 0, &configDesc);
if (rStatus == LIBUSB_SUCCESS){
int index_i = 0;
const struct libusb_interface *interfaceDesc;
numInterfaces = configDesc->bNumInterfaces;
deviceInfo->numInterfaces = numInterfaces;
interfaceDesc = configDesc->interface;
while ((numInterfaces) && (index_i < CY_MAX_DEVICE_INTERFACE)){
deviceInfo->deviceClass[index_i] = (CY_DEVICE_CLASS)interfaceDesc->altsetting->bInterfaceClass;
if (deviceInfo->deviceClass[index_i] == CY_CLASS_VENDOR)
deviceInfo->deviceType[index_i] = (CY_DEVICE_TYPE)interfaceDesc->altsetting->bInterfaceSubClass;
else
deviceInfo->deviceType[index_i] = CY_TYPE_DISABLED;
index_i++;
numInterfaces--;
interfaceDesc++;
}
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in Getting config descriptor ... Libusb Error is %d\n", rStatus);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DEVICE_INFO_FETCH_FAILED;
}
libusb_free_config_descriptor (configDesc);
libusb_close (devHandle);
}
if ((*deviceCount) == 0)
rStatus = CY_ERROR_DEVICE_NOT_FOUND;
pthread_mutex_unlock (&criticalSection);
return rStatus;
}
/*
This API will claim the interface in the device
To make sure only claimed application speaks to device.
*/
CY_RETURN_STATUS CySelectInterface (
CY_HANDLE handle,
UINT8 interfaceNum
)
{
UINT32 rStatus, numEP;
CY_DEVICE *device;
libusb_device_handle *devHandle;
libusb_device *usbDev;
struct libusb_config_descriptor *configDesc;
const struct libusb_interface *interfaceDesc;
const struct libusb_endpoint_descriptor *epDesc;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
usbDev = libusb_get_device (devHandle);
if (usbDev == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error Invalide handle ..function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
//Get the config descriptor and parse it to get the
//interface and endpoint descriptor
rStatus = libusb_get_config_descriptor (usbDev, 0, &configDesc);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Getting Config Desc ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
interfaceDesc = configDesc->interface;
//Interface Number should be a valid one and should not exceed
// total number of interfaces
if (interfaceNum >= configDesc->bNumInterfaces){
CY_DEBUG_PRINT_ERROR ("CY:Interface Number not valid... \n");
libusb_free_config_descriptor (configDesc);
return CY_ERROR_REQUEST_FAILED;
}
if (libusb_kernel_driver_active (devHandle, interfaceNum)){
CY_DEBUG_PRINT_ERROR ("CY:Kernel driver active on the interface number %d \n", interfaceNum);;
//User can uncomment this section if needed.
#ifdef CY_DETACH_KERNEL_DRIVER
if (!libusb_detach_kernel_driver (devHandle, interfaceNum)){
CY_DEBUG_PRINT_ERROR ("CY:Kernel driver detach failed %d\n", interfaceNum);
return CY_ERROR_REQUEST_FAILED;
}
#else
return CY_ERROR_REQUEST_FAILED;
#endif
}
rStatus = libusb_claim_interface (devHandle, interfaceNum);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in claiming interface -interface num %d... Libusb error is %d \n", interfaceNum, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
device->interfaceNum = interfaceNum;
while (interfaceNum--)
interfaceDesc++;
epDesc = interfaceDesc->altsetting->endpoint;
numEP = interfaceDesc->altsetting->bNumEndpoints;
device->numEndpoints = numEP;
// Check the total number of endpoints interface has
// and get all the endpoint add
CY_DEBUG_PRINT_INFO ("CY:Info The total number of endpoints are %d \n", numEP);
while (numEP){
if (epDesc->bmAttributes == 0x2){ //Bulk EP checking
if (epDesc->bEndpointAddress & 0x80)
device->inEndpoint = epDesc->bEndpointAddress;
else
device->outEndpoint = epDesc->bEndpointAddress;
}
else if (epDesc->bmAttributes == 0x3) //Interrupt EP checking (We have only one interrupt EP)
device->interruptEndpoint = epDesc->bEndpointAddress;
epDesc++;
numEP--;
}
CY_DEBUG_PRINT_INFO ("CY:Info The Endpoints are in %d and out %d and interrup %d\n",
device->inEndpoint, device->outEndpoint, device->interruptEndpoint);
libusb_free_config_descriptor (configDesc);
return CY_SUCCESS;
}
/*
* This API selects the type of the device
*/
void CySelectDeviceType (CY_DEVICE *device, libusb_device *libUsbdev, unsigned char interfaceNum)
{
int rStatus, numInterfaces;
struct libusb_config_descriptor *configDesc;
int index = 0;
const struct libusb_interface *interfaceDesc;
device->deviceType = CY_TYPE_DISABLED;
rStatus = libusb_get_config_descriptor (libUsbdev, 0, &configDesc);
if (0 == rStatus){
interfaceDesc = configDesc->interface;
numInterfaces = configDesc->bNumInterfaces;
if (interfaceNum >= numInterfaces)
return;
while (index != interfaceNum) {
index++;
interfaceDesc++;
}
if (interfaceDesc->altsetting->bInterfaceClass == CY_CLASS_VENDOR)
device->deviceType = (CY_DEVICE_TYPE)interfaceDesc->altsetting->bInterfaceSubClass;
libusb_free_config_descriptor (configDesc);
}
CY_DEBUG_PRINT_INFO ("CY:Info The device type is %d \n", device->deviceType);
}
/*
The Api Gets the handle for the specified device number
(refer to usage guide and example for usage)
and this handle should be called for further communication
with the device
*/
CY_RETURN_STATUS CyOpen (
unsigned char deviceNumber,
unsigned char interfaceNum,
CY_HANDLE *handle
)
{
libusb_device_handle *devHandle;
libusb_device *dev;
CY_DEVICE *device;
int rStatus;
if (glDriverInit == false){
CY_DEBUG_PRINT_ERROR ("CY:Error Library not initialised ...function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
pthread_mutex_lock (&criticalSection);
if (glDriverInit == true){
if (deviceNumber >= glNumDevices){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Invalid device number ... \n");
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_INVALID_PARAMETER;
}
dev = glDeviceList [deviceNumber];
rStatus = libusb_open (dev, &devHandle);
if (rStatus == LIBUSB_ERROR_ACCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in opening the device ..Access denied \n");
handle = NULL;
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ACCESS_DENIED;
}
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in Opening the Device ...Error is %d \n", rStatus);
handle = NULL;
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
device = (CY_DEVICE *)malloc(sizeof (CY_DEVICE));
if (device == NULL){
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_ALLOCATION_FAILED;
}
device->devHandle = devHandle;
(*handle) = device;
rStatus = CySelectInterface (device, interfaceNum);
if (rStatus != CY_SUCCESS){
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
CySelectDeviceType (device, dev, interfaceNum);
if (device->deviceType == CY_TYPE_UART) {
CyUartSetRts (*handle);
CyUartSetDtr (*handle);
if (!CyUartSetHwFlowControl (*handle, CY_UART_FLOW_CONTROL_DISABLE))
device->uartFlowControlMode = CY_UART_FLOW_CONTROL_DISABLE;
}
//initialising structure elements
device->spiThreadId = (pthread_t)0;
device->uartThreadId = (pthread_t)0;
device->spiCancelEvent = false;
device->uartCancelEvent = false;
device->spiTransfer = NULL;
device->uartTransfer = NULL;
if (pthread_mutex_init (&device->readLock, NULL)){
CY_DEBUG_PRINT_ERROR ("CY:Error initializing the read mutex .. Function is %s \n", __func__);
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
if (pthread_mutex_init (&device->writeLock, NULL)){
CY_DEBUG_PRINT_ERROR ("CY:Error initializing the write mutex .. Function is %s \n", __func__);
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
if (pthread_mutex_init (&device->notificationLock, NULL)){
CY_DEBUG_PRINT_ERROR ("CY:Error initializing the write mutex .. Function is %s \n", __func__);
libusb_close (devHandle);
free (device);
pthread_mutex_unlock (&criticalSection);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
pthread_mutex_unlock (&criticalSection);
return CY_SUCCESS;
}
else{
CY_DEBUG_PRINT_ERROR ("CY:Error iniitalise library by calling CyLibraryInit()....function is %s\n", __func__);
return CY_ERROR_DRIVER_OPEN_FAILED;
}
}
/*
The Api Closes the handle and needs to be called only if CyGetNumDevices
or CyOpen is called
*/
CY_RETURN_STATUS CyClose (
CY_HANDLE handle
)
{
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType == CY_TYPE_UART) {
CyUartClearRts (handle);
CyUartClearDtr (handle);
CyUartSetHwFlowControl (handle, CY_UART_FLOW_CONTROL_DISABLE);
}
if (glDriverInit == true){
if (device->deviceType == CY_TYPE_SPI || device->deviceType == CY_TYPE_UART){
if (device->spiThreadId != 0 || device->uartThreadId != 0){
CyAbortEventNotification(handle);
}
}
if (pthread_mutex_destroy (&device->readLock)){
CY_DEBUG_PRINT_ERROR ("CY:Error de initializing the read mutex .. Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_destroy (&device->writeLock)){
CY_DEBUG_PRINT_ERROR ("CY:Error de initializing the write mutex .. Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_destroy (&device->notificationLock)){
CY_DEBUG_PRINT_ERROR ("CY:Error de initializing the write mutex .. Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
libusb_close ((libusb_device_handle*)devHandle);
free (device);
}
return CY_SUCCESS;
}
/*
This Api will reset the pipe and clears the endpoint
*/
CY_RETURN_STATUS CyResetPipe (
CY_HANDLE handle,
UINT8 endPointAddress
)
{
UINT32 rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
rStatus = libusb_clear_halt ((libusb_device_handle *)devHandle, endPointAddress);
if (rStatus != LIBUSB_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in resetting the pipe ... \n");
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/*
This Api will get the library version,patch
and build number
*/
CY_RETURN_STATUS CyGetLibraryVersion (
CY_HANDLE handle,
PCY_LIBRARY_VERSION version
)
{
version->majorVersion = CY_US_VERSION_MAJOR;
version->minorVersion = CY_US_VERSION_MINOR;
version->patch = CY_US_VERSION_PATCH;
version->buildNumber = CY_US_VERSION_BUILD;
return CY_SUCCESS;
}

BIN
package.zip Normal file

Binary file not shown.

View File

@@ -1,502 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
# Cypress Semiconductor Corporation CyUSB Serial Library
[![LGPLv2.1+ License](http://img.shields.io/badge/license-LGPLv2.1+-blue.svg)](https://www.gnu.org/licenses/lgpl-2.1.html)
[![Travis-CI Build Status](https://travis-ci.org/cyrozap/libcyusbserial.svg?branch=master)](https://travis-ci.org/cyrozap/libcyusbserial)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/2c5g7ncuqabs4h6m/branch/master?svg=true)](https://ci.appveyor.com/project/cyrozap/libcyusbserial/branch/master)
[![Coverity Scan](https://img.shields.io/coverity/scan/4500.svg)](https://scan.coverity.com/projects/cyrozap-libcyusbserial)
## Pre-requisites
1. libusb 1.0.9 (or higher) is required for compilation and functioning of the
APIs in the library.
2. GNU Make, the GCC toolchain, and CMake are used for the build process.
## Building the library and the test utility
1. Make a build directory and `cd` to it. Example: `mkdir build && cd build`
2. Run `cmake` on the source directory and then make. Example:
`cmake ../ && make`
3. Run `sudo make install` to install the header file, libraries, and test
utility into `PREFIX` (`/usr/local/` by default).
4. If you're on Linux, you might need to run `ldconfig` now.
5. You can now launch the application and communication with the Cypress
USB-Serial DVK in vendor mode.
## Note
Refer to the [CyUSBSerial API documentation][1] for descriptions of all the
vendor mode APIs. The header file of the library is in
`./include/CyUSBSerial.h`.
[1]: http://www.cypress.com/?docID=45725

View File

@@ -1,46 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libusb.h>
#if WIN32
#include <winbase.h>
typedef const struct libusb_version * (__stdcall * version_fn)(void);
#endif
int main(int argc, char *argv[])
{
int status = 0;
const struct libusb_version *ver;
#if WIN32
if (argc > 1) {
HINSTANCE dll;
version_fn get_version;
dll = LoadLibraryA(argv[1]);
if (!dll) {
fprintf(stderr, "Failed to load %s\n", argv[1]);
return -1;
}
get_version = (version_fn) GetProcAddress(dll, "libusb_get_version");
if (get_version) {
ver = get_version();
printf("%u.%u.%u\n", ver->major, ver->minor, ver->micro);
} else{
fprintf(stderr, "Failed to get address of libusb_get_version()\n");
status = -1;
}
FreeLibrary(dll);
} else {
fprintf(stderr, "Windows usage: %s <libusb.dll>\n", argv[0]);
return -1;
}
#else
ver = libusb_get_version();
printf("%u.%u.%u\n", ver->major, ver->minor, ver->micro);
#endif
return status;
}

View File

@@ -1,97 +0,0 @@
# This is file is based off of the FindLibUSB.cmake file written by Hendrik Sattler,
# from the OpenOBEX project (licensed GPLv2/LGPL). (If this is not correct,
# please contact us so we can attribute the author appropriately.)
#
# https://github.com/zuckschwerdt/openobex/blob/master/CMakeModules/FindLibUSB.cmake
# http://dev.zuckschwerdt.org/openobex/
#
# Find pthreads-win32
#
# This requires the LIBPTHREADSWIN32_PATH variable to be set to the path to the
# a pthreads-win32 release, such as the Pre-built.2 directory from the 2.9.1 release:
# ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
#
# The following standard variables get defined:
# LIBPTHREADSWIN32_FOUND: true if LibUSB was found
# LIBPTHREADSWIN32_HEADER_FILE: the location of the C header file
# LIBPTHREADSWIN32_INCLUDE_DIRS: the directories that contain headers
# LIBPTHREADSWIN32_LIBRARIES: the library files
# LIBPTHREADSWIN32_LIB_COPYING: the license associated with the library
if(DEFINED __INCLUDED_BLADERF_FINDLIBPTHREADSWIN32_CMAKE)
return()
endif()
set(__INCLUDED_BLADERF_FINDLIBPTHREADSWIN32_CMAKE TRUE)
include ( CheckLibraryExists )
include ( CheckIncludeFile )
set(LIBPTHREADSWIN32_PATH
"C:/Program Files/pthreads-win32"
CACHE
PATH
"Path to win-pthreads files. (This is generally only needed for Windows users who downloaded binary distributions.)"
)
find_file ( LIBPTHREADSWIN32_HEADER_FILE
NAMES
pthread.h
PATHS
${LIBPTHREADSWIN32_PATH}
PATH_SUFFIXES
include include
)
mark_as_advanced ( LIBPTHREADSWIN32_HEADER_FILE )
get_filename_component ( LIBPTHREADSWIN32_INCLUDE_DIRS "${LIBPTHREADSWIN32_HEADER_FILE}" PATH )
if ( WIN32 )
if ( MSVC )
if ( CMAKE_CL_64 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x64 )
else ( CMAKE_CL_64 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x86 )
endif ( CMAKE_CL_64 )
elseif ( CMAKE_COMPILER_IS_GNUCC )
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x64 )
else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x86 )
endif ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
endif ( MSVC )
find_library ( PTHREAD_LIBRARY
NAMES
pthreadVC2
PATHS
${LIBPTHREADSWIN32_PATH}
PATH_SUFFIXES
lib/${LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX}
)
mark_as_advanced ( PTHREAD_LIBRARY )
if ( PTHREAD_LIBRARY )
set ( LIBPTHREADSWIN32_LIBRARIES ${PTHREAD_LIBRARY} )
endif ( PTHREAD_LIBRARY )
else ( WIN32 )
message(FATAL_ERROR "This file only supports Windows")
endif ( WIN32 )
set ( LIBPTHREADSWIN32_LIB_COPYING
"${LIBPTHREADSWIN32_PATH}/COPYING.LIB" )
if ( NOT EXISTS "${LIBPTHREADSWIN32_LIB_COPYING}" )
message(FATAL_ERROR "Unable to find pthread-win32 COPYING.LIB file")
endif ()
if ( LIBPTHREADSWIN32_INCLUDE_DIRS AND LIBPTHREADSWIN32_LIBRARIES )
set ( LIBPTHREADSWIN32_FOUND true )
endif ( LIBPTHREADSWIN32_INCLUDE_DIRS AND LIBPTHREADSWIN32_LIBRARIES )
if ( LIBPTHREADSWIN32_FOUND )
set ( CMAKE_REQUIRED_INCLUDES "${LIBPTHREADSWIN32_INCLUDE_DIRS}" )
check_include_file ( "{LIBPTHREADSWIN32_HEADER_FILE}" LIBPTHREADSWIN32_FOUND )
endif ( LIBPTHREADSWIN32_FOUND )
if ( NOT LIBPTHREADSWIN32_FOUND )
message ( FATAL_ERROR "pthreads-win32 not found. If you're using a binary distribution, try setting -DLIBPTHREADSWIN32_PATH=<path_to_win_pthread_files>." )
endif ( NOT LIBPTHREADSWIN32_FOUND )

View File

@@ -1,168 +0,0 @@
# This is a modified version of the file written by Hedrik Sattler,
# from the OpenOBEX project (licensed GPLv2/LGPL). (If this is not correct,
# please contact us so we can attribute the author appropriately.)
#
# https://github.com/zuckschwerdt/openobex/blob/master/CMakeModules/FindLibUSB.cmake
# http://dev.zuckschwerdt.org/openobex/
#
# Find libusb-1.0
#
# It will use PkgConfig if present and supported, otherwise this
# script searches for binary distribution in the path defined by
# the LIBUSB_PATH variable.
#
# Define LIBUSB_SKIP_VERSION_CHECK=Yes to skip the execution of a program to fetch
# libusb's version number. LIBUSB_VERSION will not be set if this if this is used.
# To check the version number, this script expects CMAKE_HELPERS_SOURCE_DIR to
# be defined with the path to libusb_version.c.
#
# The following standard variables get defined:
# LIBUSB_FOUND: true if LibUSB was found
# LIBUSB_HEADER_FILE: the location of the C header file
# LIBUSB_INCLUDE_DIRS: the directorys that contain headers
# LIBUSB_LIBRARIES: the library files
# LIBUSB_VERSION the detected libusb version
# LIBUSB_HAVE_GET_VERSION True if libusb has libusb_get_version()
if(DEFINED __INCLUDED_BLADERF_FINDLIBUSB_CMAKE)
return()
endif()
set(__INCLUDED_BLADERF_FINDLIBUSB_CMAKE TRUE)
include(CheckLibraryExists)
include(CheckIncludeFile)
# In Linux, folks should generally be able to simply fetch the libusb library and
# development packages from their distros package repository. Windows users will
# likely want to fetch a binary distribution, hence the Windows-oriented default.
#
# See http://www.libusb.org/wiki/windows_backend#LatestBinarySnapshots
if(WIN32)
set(LIBUSB_PATH
"C:/Program Files/libusb-1.0.19"
CACHE
PATH
"Path to libusb files. (This is generally only needed for Windows users who downloaded binary distributions.)"
)
endif()
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PKGCONFIG_LIBUSB libusb-1.0 QUIET)
endif(PKG_CONFIG_FOUND)
if(PKGCONFIG_LIBUSB_FOUND)
set(LIBUSB_INCLUDE_DIRS ${PKGCONFIG_LIBUSB_INCLUDE_DIRS})
foreach(i ${PKGCONFIG_LIBUSB_LIBRARIES})
string(REGEX MATCH "[^-]*" ibase "${i}")
find_library(${ibase}_LIBRARY
NAMES ${i}
PATHS ${PKGCONFIG_LIBUSB_LIBRARY_DIRS}
)
if(${ibase}_LIBRARY)
list(APPEND LIBUSB_LIBRARIES ${${ibase}_LIBRARY})
endif(${ibase}_LIBRARY)
mark_as_advanced(${ibase}_LIBRARY)
endforeach(i)
else(PKGCONFIG_LIBUSB_FOUND)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# The libusbx binary distribution contains several libs.
# Use the lib that got compiled with the same compiler.
if(MSVC)
if(CMAKE_CL_64)
set(LIBUSB_LIBRARY_PATH_SUFFIX MS64/dll)
else(CMAKE_CL_64)
set(LIBUSB_LIBRARY_PATH_SUFFIX MS32/dll)
endif(CMAKE_CL_64)
elseif(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(LIBUSB_LIBRARY_PATH_SUFFIX MinGW32/dll)
else(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(LIBUSB_LIBRARY_PATH_SUFFIX MinGW64/dll)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
endif(MSVC)
else()
set(LIBUSB_LIBRARY_PATH_SUFFIX lib)
set(LIBUSB_EXTRA_PATHS /usr /usr/local /opt/local)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_file(LIBUSB_HEADER_FILE
NAMES
libusb.h
PATHS
${LIBUSB_PATH}
${LIBUSB_EXTRA_PATHS}
PATH_SUFFIXES
include include/libusbx-1.0 include/libusb-1.0
)
mark_as_advanced(LIBUSB_HEADER_FILE)
get_filename_component(LIBUSB_INCLUDE_DIRS "${LIBUSB_HEADER_FILE}" PATH)
find_library(usb_LIBRARY
NAMES
libusb-1.0 usb-1.0
PATHS
${LIBUSB_PATH}
${LIBUSB_EXTRA_PATHS}
PATH_SUFFIXES
${LIBUSB_LIBRARY_PATH_SUFFIX}
)
mark_as_advanced(usb_LIBRARY)
if(usb_LIBRARY)
set(LIBUSB_LIBRARIES ${usb_LIBRARY})
endif(usb_LIBRARY)
endif(PKGCONFIG_LIBUSB_FOUND)
if(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
set(LIBUSB_FOUND true)
endif(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
if(LIBUSB_FOUND)
set(CMAKE_REQUIRED_INCLUDES "${LIBUSB_INCLUDE_DIRS}")
check_include_file("{LIBUSB_HEADER_FILE}" LIBUSB_FOUND)
endif(LIBUSB_FOUND)
if(LIBUSB_FOUND AND NOT CMAKE_CROSSCOMPILING)
if(LIBUSB_SKIP_VERSION_CHECK)
message(STATUS "Skipping libusb version number check.")
unset(LIBUSB_VERSION)
else()
message(STATUS "Checking libusb version...")
if(WIN32)
string(REPLACE ".lib" ".dll" LIBUSB_DLL "${LIBUSB_LIBRARIES}")
try_run(LIBUSB_VERCHECK_RUN_RESULT
LIBUSB_VERCHECK_COMPILED
${CMAKE_HELPERS_BINARY_DIR}
${CMAKE_HELPERS_SOURCE_DIR}/libusb_version.c
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBUSB_INCLUDE_DIRS}"
RUN_OUTPUT_VARIABLE LIBUSB_VERSION
ARGS "\"${LIBUSB_DLL}\""
)
else()
try_run(LIBUSB_VERCHECK_RUN_RESULT
LIBUSB_VERCHECK_COMPILED
${CMAKE_HELPERS_BINARY_DIR}
${CMAKE_HELPERS_SOURCE_DIR}/libusb_version.c
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBUSB_INCLUDE_DIRS}" "-DLINK_LIBRARIES=${LIBUSB_LIBRARIES}"
RUN_OUTPUT_VARIABLE LIBUSB_VERSION
)
endif()
if (NOT LIBUSB_VERCHECK_COMPILED OR NOT LIBUSB_VERCHECK_RUN_RESULT EQUAL 0 )
message(STATUS "${LIBUSB_VERSION}")
set(LIBUSB_VERSION "0.0.0")
message(WARNING "\nFailed to compile (compiled=${LIBUSB_VERCHECK_COMPILED}) or run (retval=${LIBUSB_VERCHECK_RUN_RESULT}) libusb version check.\n"
"This may occur if libusb is earlier than v1.0.10.\n"
"Setting LIBUSB_VERSION to ${LIBUSB_VERSION}.\n")
return()
endif()
message(STATUS "libusb version: ${LIBUSB_VERSION}")
endif()
endif(LIBUSB_FOUND AND NOT CMAKE_CROSSCOMPILING)

View File

@@ -1,9 +0,0 @@
cmake_minimum_required(VERSION 2.8)
################################################################################
# Install libbladeRF header files
################################################################################
install(FILES
CyUSBSerial.h
DESTINATION include
)

View File

@@ -1,686 +0,0 @@
/*
* I2C routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
#pragma pack(1)
typedef struct
{
UINT32 frequency; /**< Frequency of operation. Only valid values are
100KHz and 400KHz. */
UINT8 sAddress; /**< Slave address to be used when in slave mode. */
BOOL isMsbFirst; /**< Whether to transmit most significant bit first. */
BOOL isMaster; /**< Whether to block is to be configured as a master:
CyTrue - The block functions as I2C master.
CyFalse - The block functions as I2C slave. */
BOOL sIgnore; /**< Ignore general call in slave mode. */
BOOL clockStretch; /**< Wheteher to stretch clock in case of no FIFO availability. */
BOOL isLoopback; /**< Whether to loop back TX data to RX. Valid only
for debug purposes. */
UCHAR reserved[6]; /**< Reserved for future use */
} CyUsI2cConfig_t;
#pragma pack()
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
struct timeval startTimeWrite, endTimeWrite, startTimeRead, endTimeRead;
//Timer helper functions for proper timing
void startI2cTick (bool isWrite) {
if (isWrite)
gettimeofday (&startTimeWrite, NULL);
else
gettimeofday (&startTimeRead, NULL);
}
UINT32 getI2cLapsedTime (bool isWrite){
signed int currentTime_sec, currentTime_usec, currentTime;
if (isWrite){
gettimeofday (&endTimeWrite, NULL);
currentTime_sec = (endTimeWrite.tv_sec - startTimeWrite.tv_sec) * 1000;
currentTime_usec = ((endTimeWrite.tv_usec - startTimeWrite.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
else{
gettimeofday (&endTimeRead, NULL);
currentTime_sec = (endTimeRead.tv_sec - startTimeRead.tv_sec) * 1000;
currentTime_usec = ((endTimeRead.tv_usec - startTimeRead.tv_usec)) / 1000;
currentTime = currentTime_sec + currentTime_usec;
return (unsigned int)currentTime;
}
}
#endif
CY_RETURN_STATUS handleI2cError (UINT8 i2cStatus){
if (i2cStatus & CY_I2C_NAK_ERROR_BIT){
CY_DEBUG_PRINT_ERROR ("CY:Error Nacked by device ...Function is %s\n", __func__);
return CY_ERROR_I2C_NAK_ERROR;
}
if (i2cStatus & CY_I2C_BUS_ERROR_BIT){
CY_DEBUG_PRINT_ERROR ("CY:Error bus error occured... Function is %s\n", __func__);
return CY_ERROR_I2C_BUS_ERROR;
}
if (i2cStatus & CY_I2C_ARBITRATION_ERROR_BIT){
CY_DEBUG_PRINT_ERROR ("CY:Error Arbitration error occured.. Function is %s\n", __func__);
return CY_ERROR_I2C_ARBITRATION_ERROR;
}
if (i2cStatus & CY_I2C_STOP_BIT_ERROR){
CY_DEBUG_PRINT_ERROR ("CY:Error Stop bit set by master..Function is %s\n", __func__);
return CY_ERROR_I2C_STOP_BIT_SET;
}
else {
//We should never hit this case!!!!
CY_DEBUG_PRINT_ERROR ("CY:Unknown error..Function is %s\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
//Used internally by read and write API to check if data is received at the I2C end.
CY_RETURN_STATUS CyI2cGetStatus (CY_HANDLE handle, bool mode, UCHAR *i2cStatus);
CY_RETURN_STATUS waitForNotification (CY_HANDLE handle, UINT16 *bytesPending, UINT32 ioTimeout);
/*
* This API gets the current I2C config
* for the particluar interface of the device
*/
CY_RETURN_STATUS CyGetI2cConfig (
CY_HANDLE handle,
CY_I2C_CONFIG *i2cConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
CyUsI2cConfig_t localI2cConfig;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (i2cConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_I2C_GET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0x00;
wLength = CY_I2C_CONFIG_LENGTH;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localI2cConfig, wLength, ioTimeout);
if (rStatus == CY_I2C_CONFIG_LENGTH){
CY_DEBUG_PRINT_INFO ("CY: Read I2C config ...size is %d \n", rStatus);
i2cConfig->frequency = localI2cConfig.frequency;
i2cConfig->slaveAddress = localI2cConfig.sAddress;
i2cConfig->isMaster = localI2cConfig.isMaster;
i2cConfig->isClockStretch = localI2cConfig.clockStretch;
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error time out ....Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
* This API sets I2C config of the device for that
* interface
*/
CY_RETURN_STATUS CySetI2cConfig (
CY_HANDLE handle,
CY_I2C_CONFIG *i2cConfig
)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
CyUsI2cConfig_t localI2cConfig;
int rStatus;
CY_DEVICE *device = NULL;
libusb_device_handle *devHandle;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if (i2cConfig == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if (i2cConfig->frequency < 1000 || i2cConfig->frequency > 400000){
CY_DEBUG_PRINT_ERROR ("CY:Error frequency trying to set in out of ..range Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
if ((i2cConfig->slaveAddress % 2) != 0){
CY_DEBUG_PRINT_ERROR ("CY:Error slave address needs to even..Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
scbIndex = device->interfaceNum;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_SET_CONFIG_CMD;
wValue = (scbIndex << CY_SCB_INDEX_POS);
wIndex = 0x00;
wLength = CY_I2C_CONFIG_LENGTH;
//We need to pass entire 16 bytes config structure to firmware
//but we will not expose all the structure elements to user.
//so filling some of the values.
memset (&localI2cConfig, 0, CY_I2C_CONFIG_LENGTH);
localI2cConfig.frequency = i2cConfig->frequency;
localI2cConfig.sAddress = i2cConfig->slaveAddress;
localI2cConfig.isMaster = i2cConfig->isMaster;
localI2cConfig.clockStretch = i2cConfig->isClockStretch;
localI2cConfig.isMsbFirst = 1;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)&localI2cConfig, wLength, ioTimeout);
if (rStatus == CY_I2C_CONFIG_LENGTH){
CY_DEBUG_PRINT_INFO ("CY: Setting I2C config successful ...\n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error time out ....Function is %s\n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
* This API reads I2C data from the specified interface of the device
* interface
*/
CY_RETURN_STATUS CyI2cRead (
CY_HANDLE handle,
CY_I2C_DATA_CONFIG *i2cDataConfig,
CY_DATA_BUFFER *readBuffer,
UINT32 ioTimeout
)
{
int rStatus;
CY_DEVICE *device = NULL;
libusb_device_handle *devHandle;
UINT16 wValue = 0, wIndex, wLength, bytesPending = 0;
UINT8 bmRequestType, bmRequest;
UCHAR i2cStatus[CY_I2C_GET_STATUS_LEN];
UINT16 scbIndex = 0;
bool mode = CY_I2C_MODE_READ;
UINT32 elapsedTime;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((readBuffer == NULL) || (readBuffer->buffer == NULL) || (readBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
readBuffer->transferCount = 0;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_trylock (&device->readLock) == 0){
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
i2cDataConfig->slaveAddress = ((i2cDataConfig->slaveAddress & 0x7F) | (scbIndex << 7));
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_READ_CMD;
wValue = ((i2cDataConfig->isStopBit) | (i2cDataConfig->isNakBit << 1));
wValue |= (((i2cDataConfig->slaveAddress) << 8));
wIndex = readBuffer->length;
wLength = 0;
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_ERROR ("CY:Error device busy ... function is %s \n", __func__);
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
}
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == LIBUSB_ERROR_NO_DEVICE){
CY_DEBUG_PRINT_ERROR ("CY:Error device disconnected ... \n");
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending Read vendor command ... Libusb Error is %d .. Function is %s \n", rStatus, __func__);
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
//Hoping that previous calls do not take much time!!
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
startI2cTick(false);
#endif
rStatus = libusb_bulk_transfer (devHandle, device->inEndpoint, readBuffer->buffer, readBuffer->length,
(int*)&readBuffer->transferCount, ioTimeout);
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
elapsedTime = getI2cLapsedTime(false);
//Giving an extra 10 msec to notification to findout the status
ioTimeout = (ioTimeout - elapsedTime);
if (ioTimeout == 0)
ioTimeout = 10;
#endif
if (rStatus == LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY: Successfully read i2c data.. %d bytes Read ...\n", readBuffer->transferCount);
bytesPending = readBuffer->length;
rStatus = waitForNotification (handle, &bytesPending, ioTimeout);
if (rStatus)
readBuffer->transferCount = (readBuffer->length - bytesPending);
else
readBuffer->transferCount = readBuffer->length;
pthread_mutex_unlock (&device->readLock);
return rStatus;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Timeout error ..Function is %s\n", __func__);
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_INFO ("Pipe Error \n");
rStatus = CyResetPipe (handle, device->outEndpoint);
if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("Error in reseting the pipe \n");
}
else {
CY_DEBUG_PRINT_INFO ("Reset pipe succeded \n");
}
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
CyI2cReset (handle, mode);
rStatus = handleI2cError (i2cStatus[0]);
pthread_mutex_unlock (&device->readLock);
return rStatus;
}
else {
pthread_mutex_unlock (&device->readLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
pthread_mutex_unlock (&device->readLock);
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
pthread_mutex_unlock (&device->readLock);
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
else{
CY_DEBUG_PRINT_ERROR ("CY: Error API busy in servicing previous request... function is %s!\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
* This API writes I2C data into the specified interface of the device
*/
CY_RETURN_STATUS CyI2cWrite (
CY_HANDLE handle,
CY_I2C_DATA_CONFIG *i2cDataConfig,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout
)
{
int rStatus;
UCHAR i2cStatus[CY_I2C_GET_STATUS_LEN];
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue = 0, wIndex, wLength, bytesPending = 0;
UINT8 bmRequestType, bmRequest;
UINT16 scbIndex = 0;
BOOL mode = CY_I2C_MODE_WRITE;
UINT32 elapsedTime;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((writeBuffer == NULL) || (writeBuffer->buffer == NULL) || (writeBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
writeBuffer->transferCount = 0;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
scbIndex = device->interfaceNum;
if (device->deviceType != CY_TYPE_I2C){
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c ..Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
if (pthread_mutex_trylock (&device->writeLock) == 0){
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_WRITE_CMD;
i2cDataConfig->slaveAddress = ((i2cDataConfig->slaveAddress & 0x7F) | (scbIndex << 7));
wValue = ((i2cDataConfig->isStopBit));
wValue |= (((i2cDataConfig->slaveAddress) << 8));
wIndex = (UINT16)(writeBuffer->length);
wLength = 0;
CY_DEBUG_PRINT_INFO ("wValue is %x \n", wValue);
//Send I2C write vendor command before actually sending the data over bulk ep
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_ERROR ("CY:Error ... Device busy ... function is %s \n", __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE){
CY_DEBUG_PRINT_ERROR ("CY:Error device not found \n");
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == LIBUSB_ERROR_NO_DEVICE){
CY_DEBUG_PRINT_ERROR ("CY:Error device not found \n");
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending write vendor command ... Libusb Error is %d \n", rStatus);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_I2C_DEVICE_BUSY;
}
//After vendor command is sent send the actual data to be sent to i2c devic
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
startI2cTick(true);
#endif
rStatus = libusb_bulk_transfer (devHandle, device->outEndpoint, writeBuffer->buffer, writeBuffer->length,
(int*)&(writeBuffer->transferCount), ioTimeout);
#ifdef CY_I2C_ENABLE_PRECISE_TIMING
elapsedTime = getI2cLapsedTime(true);
ioTimeout = (ioTimeout - elapsedTime);
//Giving an extra 10 msec to notification to findout the status
if (ioTimeout == 0)
ioTimeout = 10;
#endif
//Once the data is sent to usbserial, check if it was actually written to i2c device.
if (rStatus == LIBUSB_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY: Successfully written i2c data.. %d bytes written ...\n", writeBuffer->transferCount);
bytesPending = writeBuffer->length;
rStatus = waitForNotification (handle, &bytesPending, ioTimeout);
if (rStatus)
writeBuffer->transferCount = (writeBuffer->length - bytesPending);
else
writeBuffer->transferCount = writeBuffer->length;
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
//Transaction is stallled when we hit some I2C error while the transfer
//was going on. After we hit this error clear stall and check why we hit this by
//CyGetStatus.
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_INFO ("CY:Pipe Error ... Function is %s\n", __func__);
rStatus = CyResetPipe (handle, device->outEndpoint);
if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY:Error in reseting the pipe ..Function is %s\n", __func__);
}
else {
CY_DEBUG_PRINT_INFO ("Reset pipe succeded \n");
}
rStatus = CyI2cGetStatus (handle, mode, (UCHAR *)i2cStatus);
if (rStatus == CY_SUCCESS)
{
CyI2cReset (handle, mode);
rStatus = handleI2cError (i2cStatus[0]);
pthread_mutex_unlock (&device->writeLock);
return rStatus;
}
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s\n", __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Error time out ....Function is %s\n", __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_IO_TIMEOUT;
}
else{
CY_DEBUG_PRINT_ERROR ("CY: Error in doing I2C read ...libusb error is %d function is %s!\n", rStatus, __func__);
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_REQUEST_FAILED;
}
}
else{
CY_DEBUG_PRINT_ERROR ("CY:API busy with servicing previous request... function is %s!\n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
pthread_mutex_unlock (&device->writeLock);
return CY_ERROR_REQUEST_FAILED;
}
/*
* This API gets the current status of the I2C data transaction
*/
CY_RETURN_STATUS CyI2cGetStatus (
CY_HANDLE handle,
bool mode,
UCHAR *i2cStatus
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
if (i2cStatus == NULL)
return CY_ERROR_INVALID_PARAMETER;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c .. \n");
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_I2C_GET_STATUS_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS) | mode);
wIndex = 0;
wLength = CY_I2C_GET_STATUS_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, (UCHAR*)i2cStatus, wLength, ioTimeout);
if (rStatus < CY_I2C_GET_STATUS_LEN){
CY_DEBUG_PRINT_INFO ("CY:Error in sending I2C Get Status command...Libusb error is %d\n", rStatus);
return rStatus;
}
return CY_SUCCESS;
}
/*
* This API resets the I2C module
*/
CY_RETURN_STATUS CyI2cReset (
CY_HANDLE handle,
BOOL resetMode
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength, bmRequestType, bmRequest;
UINT16 scbIndex = 0;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_I2C) {
CY_DEBUG_PRINT_ERROR ("CY:Error opened device is not i2c .. \n");
return CY_ERROR_REQUEST_FAILED;
}
scbIndex = device->interfaceNum;
if (scbIndex > 0)
scbIndex = 1;
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_I2C_RESET_CMD;
wValue = ((scbIndex << CY_SCB_INDEX_POS) | resetMode );
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY:Error in sending I2C Reset command ..libusb error is %d\n", rStatus);
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
static void LIBUSB_CALL i2c_notification_cb(struct libusb_transfer *transfer)
{
UINT32 *completed = transfer->user_data;
*completed = 1;
}
CY_RETURN_STATUS waitForNotification (CY_HANDLE handle, UINT16 *bytesPending, UINT32 ioTimeout){
UINT32 transferCompleted = 0, length = CY_I2C_EVENT_NOTIFICATION_LEN;
CY_DEVICE *device;
libusb_device_handle *devHandle;
struct libusb_transfer *transfer;
CY_RETURN_STATUS errorStatus, rStatus;
UCHAR i2cStatus[CY_I2C_EVENT_NOTIFICATION_LEN];
struct timeval time;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
transfer = libusb_alloc_transfer(0);
if (transfer == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error in allocating trasnfer \n");
errorStatus = CY_ERROR_ALLOCATION_FAILED;
(*bytesPending) = 0;
return errorStatus;
//callbackFn (errorStatus, 0);
}
libusb_fill_interrupt_transfer (transfer, devHandle, device->interruptEndpoint, i2cStatus, length,
i2c_notification_cb, &transferCompleted, ioTimeout);
if (libusb_submit_transfer (transfer)){
CY_DEBUG_PRINT_ERROR ("CY:Error in submitting interrupt transfer ...\n");
libusb_cancel_transfer (transfer);
libusb_free_transfer (transfer);
(*bytesPending) = 0;
//callbackFn (CY_ERROR_REQUEST_FAILED, 0);
return CY_ERROR_REQUEST_FAILED;
}
time.tv_sec = 0;
time.tv_usec = 50;//polling timeout.
while (transferCompleted == 0){
libusb_handle_events_timeout (glContext, &time);
}
transferCompleted = 0;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_INFO ("CY:Info successfully recieved data on interrupt pipe length is %d \n", transfer->actual_length);
if (i2cStatus[0] & 0x80){ //Error notification is for write
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_INFO ("Bytes pending is %x %x %x", i2cStatus[0], i2cStatus[1], i2cStatus[2]);
//There was some error, so reset the i2c module and usb module
//of the device, so branch out of the loop(Check below for the errors reported).
rStatus = CyI2cReset (device, CY_I2C_MODE_WRITE);
if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:i2c reset failed \n");
}
//Report the amount of byte that were actually written
memcpy(bytesPending, &i2cStatus[1], 2);
errorStatus = handleI2cError (i2cStatus[0]);
}
else
errorStatus = CY_SUCCESS;
}
else //Error notification is for read
{
if ((i2cStatus[0] & CY_I2C_ERROR_BIT)){
CY_DEBUG_PRINT_INFO ("Bytes pending is %x %x %x", i2cStatus[0], i2cStatus[1], i2cStatus[2]);
rStatus = CyI2cReset (device, CY_I2C_MODE_READ);
if (rStatus != CY_SUCCESS){
CY_DEBUG_PRINT_INFO ("CY:i2c reset failed \n");
}
//Report the amount of byte that were actually written
memcpy(bytesPending, &i2cStatus[1], 2);
errorStatus = handleI2cError (i2cStatus[0]);
}
else
errorStatus = CY_SUCCESS;
}
libusb_free_transfer (transfer);
return errorStatus;
}
else{
libusb_cancel_transfer (transfer);
if (transfer->status == LIBUSB_TRANSFER_TIMED_OUT){
CY_DEBUG_PRINT_ERROR ("CY:Error Timeout in getting i2c transfer status ....\n");
CyI2cGetStatus (handle, 1, (UCHAR *)&errorStatus);
errorStatus = CY_ERROR_IO_TIMEOUT;
}
if (transfer->status == LIBUSB_TRANSFER_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error buffer overFlow in i2c transfer status ....\n");
errorStatus = CY_ERROR_BUFFER_OVERFLOW;
}
if (transfer->status != LIBUSB_TRANSFER_COMPLETED){
CY_DEBUG_PRINT_ERROR ("CY:Error in i2c transfer status ... Libusb transfer error is %d \n", transfer->status);
errorStatus = CY_ERROR_REQUEST_FAILED;
}
libusb_free_transfer (transfer);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,248 +0,0 @@
/*
* JTAG routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
/*
* This API enables the Jtag module
*/
CY_RETURN_STATUS CyJtagEnable (
CY_HANDLE handle
)
{
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_ENABLE_CMD;
wValue = 0x00;
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus >= 0){
CY_DEBUG_PRINT_INFO ("CY: JTAG enable successfully \n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
* This API disables the Jtag module
*/
CY_RETURN_STATUS CyJtagDisable (
CY_HANDLE handle
)
{
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_DISABLE_CMD;
wValue = 0x00;
wIndex = 0;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus >= 0){
CY_DEBUG_PRINT_INFO ("CY: JTAG disable successfully \n");
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error while enabling JTAG ..\n");
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY:Error while enabling JTAG ...libusb error is %d function is %s!\n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
* This API is used to do jtag write
*/
CY_RETURN_STATUS CyJtagWrite (
CY_HANDLE handle,
CY_DATA_BUFFER *writeBuffer,
UINT32 ioTimeout
)
{
int rStatus = 0;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((writeBuffer == NULL) || (writeBuffer->buffer == NULL) || (writeBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_WRITE_CMD;
wValue = writeBuffer->length;
wIndex = 0;
wLength = 0;
writeBuffer->transferCount = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_ERROR ("CY: JTAG Vendor command failed %d...function is %s \n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = libusb_bulk_transfer (devHandle, CY_JTAG_OUT_EP, writeBuffer->buffer, writeBuffer->length,
(int*)&(writeBuffer->transferCount), ioTimeout);
if (rStatus == CY_SUCCESS) {
CY_DEBUG_PRINT_ERROR ("CY: Number of bytes written is .... %d \n", writeBuffer->transferCount);
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error ...Function is %s %d\n", __func__, writeBuffer->transferCount);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Pipe error Function is %s \n", __func__);
CyResetPipe (handle, CY_JTAG_OUT_EP);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow..Function is %s \n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s \n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in Function %s...Libusb Error is %d !\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
This API is used to read JTAG data from device interface
*/
CY_RETURN_STATUS CyJtagRead (
CY_HANDLE handle,
CY_DATA_BUFFER *readBuffer,
UINT32 ioTimeout
)
{
int rStatus;
CY_DEVICE *device;
libusb_device_handle *devHandle;
UINT16 wValue, wIndex, wLength;
UINT16 bmRequestType, bmRequest;
if (handle == NULL){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid handle.. Function is %s \n", __func__);
return CY_ERROR_INVALID_HANDLE;
}
if ((readBuffer == NULL) || (readBuffer->buffer == NULL) || (readBuffer->length == 0)){
CY_DEBUG_PRINT_ERROR ("CY:Error invalid parameter.. Function is %s \n", __func__);
return CY_ERROR_INVALID_PARAMETER;
}
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
if (device->deviceType != CY_TYPE_JTAG) {
CY_DEBUG_PRINT_ERROR ("CY:Error device type is not jtag ... Function is %s \n", __func__);
return CY_ERROR_REQUEST_FAILED;
}
bmRequestType = CY_VENDOR_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_JTAG_READ_CMD;
wValue = readBuffer->length;
wIndex = 0;
wLength = 0;
readBuffer->transferCount = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus < 0){
CY_DEBUG_PRINT_INFO ("CY: JTAG Vendor Command failed %d.. Function is %s \n", rStatus, __func__);
return CY_ERROR_REQUEST_FAILED;
}
rStatus = libusb_bulk_transfer (devHandle, CY_JTAG_IN_EP, readBuffer->buffer, readBuffer->length,
(int*)&(readBuffer->transferCount), ioTimeout);
if (rStatus == CY_SUCCESS){
CY_DEBUG_PRINT_ERROR ("CY: Number of bytes read is .... %d \n", readBuffer->transferCount);
return CY_SUCCESS;
}
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:TimeOut error ...Function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else if (rStatus == LIBUSB_ERROR_PIPE){
CY_DEBUG_PRINT_ERROR ("CY:Pipe error Function is %s \n", __func__);
CyResetPipe (handle, CY_JTAG_IN_EP);
return CY_ERROR_PIPE_HALTED;
}
else if (rStatus == LIBUSB_ERROR_OVERFLOW){
CY_DEBUG_PRINT_ERROR ("CY:Error Buffer Overflow..Function is %s \n", __func__);
return CY_ERROR_BUFFER_OVERFLOW;
}
else if (rStatus == LIBUSB_ERROR_NO_DEVICE) {
CY_DEBUG_PRINT_ERROR ("CY: Device Disconnected ....Function is %s \n", __func__);
return CY_ERROR_DEVICE_NOT_FOUND;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function is %s ...Libusb Error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,130 +0,0 @@
/*
* PHDC routines of Cypress USB Serial
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "CyUSBCommon.h"
/*
PHDC clear feature
*/
CY_RETURN_STATUS CyPhdcClrFeature (CY_HANDLE handle)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_PHDC_CLR_FEATURE;
wValue = CY_PHDC_CLR_FEATURE_WVALUE;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == 0)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
return CY_SUCCESS;
}
/*
PHDC set feature
*/
CY_RETURN_STATUS CyPhdcSetFeature (CY_HANDLE handle)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_CLASS_INTERFACE_REQUEST_HOST_TO_DEVICE;
bmRequest = CY_PHDC_SET_FEATURE;
wValue = CY_PHDC_SET_FEATURE_WVALUE;
wIndex = device->interfaceNum;
wLength = 0;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, NULL, wLength, ioTimeout);
if (rStatus == 0)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}
/*
PHDC clear feature
*/
CY_RETURN_STATUS CyPhdcGetStatus (CY_HANDLE handle, UINT16 *dataStatus)
{
UINT16 wValue, wIndex, wLength;
UINT8 bmRequestType, bmRequest;
int rStatus;
UINT32 ioTimeout = CY_USB_SERIAL_TIMEOUT ;
CY_DEVICE *device;
libusb_device_handle *devHandle;
if (handle == NULL)
return CY_ERROR_INVALID_HANDLE;
device = (CY_DEVICE *)handle;
devHandle = device->devHandle;
bmRequestType = CY_CLASS_INTERFACE_REQUEST_DEVICE_TO_HOST;
bmRequest = CY_PHDC_GET_DATA_STATUS;
wValue = 0x00;
wIndex = device->interfaceNum;
wLength = CY_PHDC_GET_STATUS_LEN;
rStatus = libusb_control_transfer (devHandle, bmRequestType, bmRequest,
wValue, wIndex, (unsigned char*)dataStatus, wLength, ioTimeout);
if (rStatus > 0)
return CY_SUCCESS;
else if (rStatus == LIBUSB_ERROR_TIMEOUT){
CY_DEBUG_PRINT_ERROR ("CY:Time out error ..function is %s \n", __func__);
return CY_ERROR_IO_TIMEOUT;
}
else {
CY_DEBUG_PRINT_ERROR ("CY: Error in function %s ...libusb error is %d!\n", __func__, rStatus);
return CY_ERROR_REQUEST_FAILED;
}
}

View File

@@ -1,32 +0,0 @@
# Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# CMake build directory
build

View File

@@ -1,72 +0,0 @@
sudo: false
language: c
matrix:
include:
- compiler: gcc
env: ARCH=x86_64
addons:
apt:
packages:
- libusb-1.0-0-dev
coverity_scan:
project:
name: "cyrozap/libcyusbserial"
notification_email: cyrozap@users.noreply.github.com
build_command_prepend: "cmake ../"
build_command: make
branch_pattern: coverity_scan
- compiler: gcc
env: ARCH=i386 CFLAGS="-m32"
addons:
apt:
packages:
- gcc-multilib
- libusb-1.0-0-dev:i386
- pkg-config:i386
- compiler: clang
env: ARCH=x86_64
addons:
apt:
packages:
- libusb-1.0-0-dev
- compiler: clang
env: ARCH=i386 CFLAGS="-m32"
addons:
apt:
packages:
- gcc-multilib
- libusb-1.0-0-dev:i386
- pkg-config:i386
before_script:
- mkdir build && cd build
script:
- cmake ../ && make
before_deploy:
- export RELEASE_NAME=libcyusbserial-$TRAVIS_TAG-$TRAVIS_OS_NAME-$ARCH
- cd -
- mkdir -p $RELEASE_NAME/{include,lib,tools}
- cp ./COPYING.LESSER.txt ./README.md $RELEASE_NAME/
- cp ./include/*.h $RELEASE_NAME/include/
- cp ./build/lib/*.so{,.*} $RELEASE_NAME/lib/
- cp ./build/tools/cyusbserialtest ./tools/README.txt $RELEASE_NAME/tools/
- tar -czf $RELEASE_NAME.tar.gz $RELEASE_NAME
deploy:
provider: releases
api_key:
secure: eYzcv257okDxTohG7njLqRMIjad9ytsxsE0ORqvYBaQRYlOUuG8LXlj7JCmABMXvdWXVmaNbJ4k5o0qN8hiINwIarf14TzkXzfaXnZ6oTkQh4+6QWJudbNo1vGUIHV9ax4gUw4cV/UTKnviceNq82LnCHKa4i9Ts4HrQeKjXdEw=
file: $RELEASE_NAME.tar.gz
on:
repo: cyrozap/libcyusbserial
tags: true
all_branches: true
condition: "$CC = gcc"
env:
global:
- secure: "kS2HsEf1Jwv2mT+QtX+vTNmXiGiR1Bq1iFw7ZTW6o9y/I0xYfQeeZKZSpGLO/WCFyQu4qZvCszTV8A+6JcKx7c0YWvzFoSPCmLxz326N/K+Ml0aTqeUdnWqiShByIdYbnvLfwNhB8GUJQc95dga8KmuWGjT2fl4onMkdONjwHyc="

View File

@@ -1,23 +0,0 @@
add_executable(cyusbserialtest cyusbserialtest.c)
################################################################################
# Version information
################################################################################
set(VERSION_INFO_MAJOR 0)
set(VERSION_INFO_MINOR 0)
set(VERSION_INFO_PATCH 1)
################################################################################
# Link libraries
################################################################################
target_link_libraries(cyusbserialtest LINK_PUBLIC cyusbserial)
################################################################################
# Installation
################################################################################
if(NOT DEFINED BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR bin)
endif()
install(TARGETS cyusbserialtest DESTINATION ${BIN_INSTALL_DIR})

View File

@@ -1,99 +0,0 @@
================================================================================
Cypress Semiconductor Corporation
CyUSB Serial DVK test utility for I2C/SPI
================================================================================
This utility is used for testing I2C/SPI master mode functionality on the
Cypress CyUSBSerial DVK.
The utility writes to I2C/SPI flash devices on the DVK, reads the data back
and verifies the data read for integrity.
Using the test utility:
================================================================================
1. On starting the utility, the Cypress USB Serial devices that are connected
are listed along with their device numbers, interface numbers and
functionalities (SPI or I2C).
$ CyUSBSerial
----------------------------------------------------------------------
Device Number | VID | PID | INTERFACE NUMBER | FUNCTIONALITY
----------------------------------------------------------------------
0 |4b4 |a | 0 | VENDOR_I2C
0 |4b4 |a | 1 | VENDOR_SPI
0 |4b4 |a | 2 | NA
----------------------------------------------------------------------
2. A menu providing the various operations is also printed:
----------------------------------------------------------------------
1: Print list of devices
2: Select device...No device selected !!
3: Enter I2C/SPI Flash page address and length to write/read.
4: Verify data
5: Exit
----------------------------------------------------------------------
3. On selecting option 2, the utility prompts for the device and interface
number to be selected for testing.
-----------------------------------
Enter Device number to select:
0
Enter interface number:
1
-----------------------------------
Once the selections are made, the menu will be updated with the details.
----------------------------------------------------------------------
1: Print list of devices
2: Change device selection--selected device: [Device number 0] : [Interface No 1] : SPI
3: Enter I2C/SPI Flash page address and length to write/read.
4: Verify data
5: Exit
----------------------------------------------------------------------
4. Option 3 can be selected now to do data read/write to the I2C/SPI flash
device. The utility prompts for the page address to be written as well as
the length of data to be written.
------------------------------------------------
Enter Page address ... (less than 65536)
1234
Enter length to read/write ... (less than 256)
32
------------------------------------------------
Length needs to be less than or equal to 256 bytes in the case of SPI access,
and less than or equal to 64 bytes in the case of I2C access. Page address
needs to be less than 65536 in case of SPI and 256 in case of I2C.
Once the values are selected, the menu is updated with the details as below:
-------------------------------------------------------------------
1: Print list of devices
2: Change device selection--selected device: [Device number 0] : [Interface No 1] : SPI
3: Change Flash page address and length ...Entered is page address 1234 and length 123
4: Verify data
5: Exit
-------------------------------------------------------------------
5. Selecting option 4 causes the utility to write a randomly generated data
sequence to the flash device, read it back, and verify the data read back.
The data pattern written and read back will be displayed as shown below:
--------------------------------------------------------------------
67 c6 69 73 51 ff 4a ec 29 cd ba ab f2 fb e3 46 7c c2 54 f8 1b e8 e7 8d 76 5a 2e 63 33 9f c9 9a
--------------------------------------------------------------------
Data Read back is:
---------------------------------------------------------------------
67 c6 69 73 51 ff 4a ec 29 cd ba ab f2 fb e3 46 7c c2 54 f8 1b e8 e7 8d 76 5a 2e 63 33 9f c9 9a
---------------------------------------------------------------------
Data verified successfully
-------------------------------------------------------------------
6. The utility runs through these menu options until the user selects the
exit option (5).
================================================================================
EOF

View File

@@ -1,603 +0,0 @@
/*
* Test utility
* Copyright (C) 2013 Cypress Semiconductor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include <signal.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/time.h>
#include <pthread.h>
#include <ctype.h>
#include "CyUSBSerial.h"
#define CY_MAX_DEVICES 30
#define CY_MAX_INTERFACES 4
typedef struct _CY_DEVICE_STRUCT {
int deviceNumber;
int interfaceFunctionality[CY_MAX_INTERFACES];
bool isI2c;
bool isSpi;
int numInterface;
}CY_DEVICE_STRUCT;
CY_DEVICE_STRUCT *glDevice;
int i2cDeviceIndex[CY_MAX_DEVICES][CY_MAX_INTERFACES];
unsigned char *deviceNumber = NULL;
int cyDevices, i2cDevices = 0;
UINT8 numDevices = 0;
int selectedDeviceNum = -1, selectedInterfaceNum = -1;
bool exitApp = false;
short pageAddress = -1;
short readWriteLength = -1;
bool deviceAddedRemoved = false;
int i2cVerifyData (int deviceNumber, int interfaceNum);
void printListOfDevices (bool isPrint);
int spiVerifyData (int deviceNumber, int interfaceNum);
int getUserInput()
{
char userInput[6], x;
int output,i = 0;
bool isDigit = true;
x = getchar();
while (x != '\n'){
if (i < 5){
userInput[i] = x;
i++;
}
if (!isdigit(x))
isDigit = false;
x = getchar();
}
userInput[i] = '\0';
if (isDigit == false)
return -1;
output = atoi(userInput);
return output;
}
void deviceHotPlug () {
CY_RETURN_STATUS rStatus;
deviceAddedRemoved = true;
selectedDeviceNum = -1;
selectedInterfaceNum = -1;
printf ("Device of interest Removed/Added \n");
rStatus = CyGetListofDevices (&numDevices);
if (rStatus != CY_SUCCESS) {
printf ("CY:Error in Getting List of Devices: Error NO:<%d> \n", rStatus);
}
printListOfDevices (false);
}
int main (int argc, char **agrv)
{
int userInput;
int tempSelectedDeviceNum, tempSelectedInterfaceNum, tempPageAddress, tempLength;
CY_RETURN_STATUS rStatus;
signal (SIGUSR1, deviceHotPlug);
glDevice = (CY_DEVICE_STRUCT *)malloc (CY_MAX_DEVICES *sizeof (CY_DEVICE_STRUCT));
if (glDevice == NULL){
printf ("Memory allocation failed ...!! \n");
return -1;
}
rStatus = CyLibraryInit ();
if (rStatus != CY_SUCCESS) {
printf ("CY:Error in Doing library init Error NO:<%d> \n", rStatus);
return rStatus;
}
rStatus = CyGetListofDevices (&numDevices);
if (rStatus != CY_SUCCESS) {
printf ("CY:Error in Getting List of Devices: Error NO:<%d> \n", rStatus);
return rStatus;
}
printListOfDevices(true);
do {
printf ("-------------------------------------------------------------------\n");
printf ("1: Print list of devices \n");
if (selectedDeviceNum != -1 && selectedInterfaceNum != -1){
printf ("2: Change device selection--selected device: [Device number %d] : [Interface No %d]",\
selectedDeviceNum, selectedInterfaceNum);
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C)
printf (" : I2C\n");
else if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI)
printf (" : SPI\n");
else
printf (" : NA\n");
}
else
printf ("2: Select device...No device selected !!\n");
if (readWriteLength != -1 && pageAddress != -1){
printf ("3: Change Flash page address and length ...Entered is page address %d and length %d\n", pageAddress, readWriteLength);
printf ("4: Verify data\n5: Exit\n");
}
else
printf ("3: Enter I2C/SPI Flash page address and length to write/read.\n4: Verify data\n5: Exit\n");
printf ("-------------------------------------------------------------------\n");
userInput = getUserInput();
if (userInput < 1 || userInput > 5){
printf ("Wrong selection code ... Enter again \n");
continue;
}
switch (userInput){
case 1:
printListOfDevices(true);
break;
case 2:
if (cyDevices == 0) {
printf ("No device of interest connected ...!!\n");
continue;
}
printf ("Enter Device number to be selected.. \n");
tempSelectedDeviceNum = getUserInput();
//printf ("Selected device number is %d \n",tempSelectedDeviceNum);
if (tempSelectedDeviceNum >= cyDevices || tempSelectedDeviceNum == -1){
printf ("Wrong device selection \n");
continue;
}
printf ("Enter interface number..\n");
tempSelectedInterfaceNum = getUserInput();
//printf ("Selected device number is %d %d\n",tempSelectedInterfaceNum, glDevice[tempSelectedDeviceNum].numInterface);
if (tempSelectedInterfaceNum >= glDevice[tempSelectedDeviceNum].numInterface ||
tempSelectedInterfaceNum == -1) {
printf ("Wrong interface Selection selection \n");
continue;
}
if (glDevice[tempSelectedDeviceNum].interfaceFunctionality[tempSelectedInterfaceNum] == -1){
printf ("Selected device does not have I2C or SPI !!! \n");
continue;
}
if (deviceAddedRemoved == true) {
printf ("Device of interest was added/removed .... Print and select from new list\n");
continue;
}
selectedDeviceNum = tempSelectedDeviceNum;
selectedInterfaceNum = tempSelectedInterfaceNum;
//pageAddress = -1;
//readWriteLength = -1;
break;
case 3:
if (selectedDeviceNum == -1) {
printf ("Select proper device!!! \n");
continue;
}
if (selectedDeviceNum >= cyDevices){
printf ("Select proper device!!! \n");
continue;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C){
printf ("Enter Page address... (less than 256)\n");
tempPageAddress = getUserInput();
printf ("Enter length to read/write...(less than 64)\n");
tempLength = getUserInput();
if (deviceAddedRemoved == true) {
printf ("Device of interest was added/removed .... Print and select from new list\n");
continue;
}
if (tempPageAddress > 256){
printf ("Invalid page address ..Enter page address less than 256 (1 bytes len)\n");
continue;
}
if (tempLength < 0 || tempLength > 64){
printf ("Invalid Length ..Enter length less than 64 bytes\n");
continue;
}
pageAddress = tempPageAddress;
readWriteLength = tempLength;
break;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI){
printf ("Enter Page address... (less than 65536)\n");
tempPageAddress = getUserInput();
printf ("Enter length to read/write...(less than 256)\n");
tempLength = getUserInput();
if (deviceAddedRemoved == true) {
printf ("Device of interest was added/removed .... Print and select from new list\n");
continue;
}
if (tempPageAddress > 65536){
printf ("Invalid page address ..Enter page address less than 65536 (1 bytes len)\n");
continue;
}
if (tempLength < 0 || tempLength > 256){
printf ("Invalid Length ..Enter length less than 256 bytes\n");
continue;
}
pageAddress = tempPageAddress;
readWriteLength = tempLength;
break;
}
case 4:
if (selectedDeviceNum == -1) {
printf ("Select proper device!!! \n");
continue;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == -1){
printf ("Selected device does not have I2C or SPI !!! \n");
continue;
}
if ((pageAddress == -1) || (readWriteLength == -1)){
printf ("Select proper page address and length !!! \n");
continue;
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C){
if (pageAddress > 256){
printf ("Invalid Page address for I2C .. need to be less than 256\n");
continue;
}
if (readWriteLength > 64){
printf ("Invalid read write length for I2C .. need to be less than 64\n");
continue;
}
printf ("Calling I2C \n");
i2cVerifyData(glDevice[selectedDeviceNum].deviceNumber, selectedInterfaceNum);
}
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI){
spiVerifyData(glDevice[selectedDeviceNum].deviceNumber, selectedInterfaceNum);
}
break;
case 5:
exitApp = true;
CyLibraryExit ();
break;
}
}while (exitApp == false);
free (glDevice);
return CY_SUCCESS;
}
int spiWriteEnable (CY_HANDLE handle)
{
unsigned char wr_data,rd_data;
CY_RETURN_STATUS status = CY_SUCCESS;
CY_DATA_BUFFER writeBuf;
CY_DATA_BUFFER readBuf;
writeBuf.buffer = &wr_data;
writeBuf.length = 1;
readBuf.buffer = &rd_data;
readBuf.length = 1;
wr_data = 0x06; /* Write enable */
status = CySpiReadWrite (handle, &readBuf, &writeBuf, 5000);
return status;
}
//Helper functions for doing data transfer to/from SPI flash
int spiWaitForIdle (CY_HANDLE handle)
{
char rd_data[2], wr_data[2];
CY_DATA_BUFFER writeBuf, readBuf;
writeBuf.length = 2;
writeBuf.buffer = (unsigned char *)wr_data;
int timeout = 0xFFFF;
CY_RETURN_STATUS status;
readBuf.length = 2;
readBuf.buffer = (unsigned char *)rd_data;
do
{
wr_data[0] = 0x05; /* Status */
status = CySpiReadWrite (handle, &readBuf, &writeBuf, 5000);
if (status != CY_SUCCESS)
{
break;
}
timeout--;
if (timeout == 0)
{
status = CY_ERROR_IO_TIMEOUT;
return status;
}
} while (rd_data[1] & 0x01);
return status;
}
int spiVerifyData (int deviceNumber, int interfaceNum)
{
CY_DATA_BUFFER dataBufferWrite,dataBufferRead;
CY_HANDLE handle;
bool isVerify = true;
unsigned char wbuffer[256 + 4], rbuffer[256 + 4];
int rStatus;
memset (rbuffer, 0x00, 256);
memset (wbuffer, 0x00, 256);
rStatus = CyOpen (deviceNumber, interfaceNum, &handle);
if (rStatus != CY_SUCCESS){
printf ("CY_SPI: Open failed \n");
return rStatus;
}
dataBufferWrite.buffer = wbuffer;
dataBufferRead.buffer = rbuffer;
rStatus = spiWaitForIdle (handle);
if (rStatus){
printf("Error in Waiting for EEPOM active state %d \n", rStatus);
CyClose (handle);
return CY_ERROR_REQUEST_FAILED;
}
printf ("Calling spi write enable \n");
rStatus = spiWriteEnable (handle);
if (rStatus){
printf("Error in setting Write Enable %d \n", rStatus);
CyClose (handle);
return CY_ERROR_REQUEST_FAILED;
}
//Write SPI write command
wbuffer[0] = 0x02;
//SPI flash address
wbuffer[1] = (pageAddress >> 8);
wbuffer[2] = (pageAddress) & 0x00FF;
wbuffer[3] = 0;
printf ("The Data written is ...\n");
printf ("\n--------------------------------------------------------------------\n");
for (rStatus = 4; rStatus < (readWriteLength + 4); rStatus++){
wbuffer[rStatus] = rand() % 256;
printf ("%x ",wbuffer[rStatus]);
}
printf ("\n--------------------------------------------------------------------\n");
dataBufferRead.length = (4 + readWriteLength);
dataBufferWrite.length = (4 + readWriteLength);
rStatus = CySpiReadWrite (handle , &dataBufferRead, &dataBufferWrite, 5000);
if (rStatus != CY_SUCCESS){
CyClose (handle);
printf ("Error in doing SPI data write data Write is %d data read is %d\n" , dataBufferWrite.transferCount,dataBufferRead.transferCount);
return CY_ERROR_REQUEST_FAILED;
}
spiWaitForIdle (handle);
//Write SPI read command
wbuffer[0] = 0x03;
dataBufferRead.length = (4 + readWriteLength);
dataBufferWrite.length = (4 + readWriteLength);
rStatus = CySpiReadWrite (handle, &dataBufferRead, &dataBufferWrite, 5000);
if (rStatus != CY_SUCCESS){
CyClose (handle);
printf ("The Error is %d \n", rStatus);
printf ("Error in doing SPI data write data Write is %d data read is %d\n" , dataBufferWrite.transferCount,dataBufferRead.transferCount);
return CY_ERROR_REQUEST_FAILED;
}
printf ("Data Read back is \n");
printf ("\n---------------------------------------------------------------------\n");
for (rStatus = 4; rStatus < (readWriteLength + 4); rStatus++){
printf ("%x ",rbuffer[rStatus]);
if (rbuffer[rStatus] != wbuffer[rStatus]){
isVerify = false;
}
}
printf ("\n---------------------------------------------------------------------\n");
if (isVerify)
printf ("Data verified successfully \n");
else
printf ("Data corruption occured!!\n");
CyClose (handle);
return CY_SUCCESS;
}
int i2cVerifyData (int deviceNumber, int interfaceNum)
{
CY_DATA_BUFFER dataBufferWrite, dataBufferRead;
CY_HANDLE handle;
int length = 0;
bool isVerify = true;
int loopCount = 100, i;
CY_RETURN_STATUS rStatus;
unsigned char address[2], wbuffer[66], rbuffer[66];
CY_I2C_DATA_CONFIG i2cDataConfig;
memset (wbuffer, 0, 66);
memset (rbuffer, 0, 66);
i2cDataConfig.isStopBit = true;
i2cDataConfig.slaveAddress = 0x51;
rStatus = CyOpen (deviceNumber, interfaceNum, &handle);
if (rStatus != CY_SUCCESS){
printf("CY_I2C: Open failed \n");
return rStatus;
}
loopCount = 100;
length = readWriteLength;
wbuffer[0]= pageAddress;
wbuffer[1] = 0;
dataBufferWrite.buffer = wbuffer;
i2cDataConfig.isStopBit = true;
dataBufferWrite.length = (length + 2);
printf ("\n Data that is written on to i2c ...\n");
printf ("\n-----------------------------------------------------------------\n");
for (i = 2; i < (length +2); i++){
wbuffer[i] = rand() % 256;
printf ("%x ", wbuffer[i]);
}
printf ("\n-----------------------------------------------------------------\n");
rStatus = CyI2cWrite (handle, &i2cDataConfig, &dataBufferWrite, 5000);
if (rStatus != CY_SUCCESS){
printf ("Error in doing i2c write \n");
CyClose (handle);
return -1;
}
//We encountered a error in I2C read repeat the procedure again
//Loop here untill Read vendor command passes
i2cDataConfig.isStopBit = false;
dataBufferWrite.length = 2;
do {
rStatus = CyI2cWrite (handle, &i2cDataConfig, &dataBufferWrite, 5000);
loopCount--;
}while (rStatus != CY_SUCCESS && loopCount != 0);
if (loopCount == 0 && rStatus != CY_SUCCESS){
printf ("Error in sending read command \n");
CyClose (handle);
return -1;
}
dataBufferRead.buffer = rbuffer;
rbuffer[0]= address[0];
rbuffer[1] = 0;
i2cDataConfig.isStopBit = true;
i2cDataConfig.isNakBit = true;
dataBufferRead.length = length;
dataBufferRead.buffer = rbuffer;
memset (rbuffer, 0, 64);
rStatus = CyI2cRead (handle, &i2cDataConfig, &dataBufferRead, 5000);
if (rStatus != CY_SUCCESS){
printf ("Error in doing i2c read ... Error is %d \n", rStatus);
CyClose (handle);
return -1;
}
printf ("\n Data that is read from i2c ...\n");
printf ("\n-----------------------------------------------------------------\n");
for (i = 0; i < length; i++){
printf ("%x ", rbuffer[i]);
if (rbuffer[i] != wbuffer[i + 2]){
isVerify = false;
}
}
printf ("\n-----------------------------------------------------------------\n");
if (!isVerify)
printf ("Data corruption occured ..!!!\n");
else
printf ("Data verified successfully \n");
CyClose (handle);
return CY_SUCCESS;
}
bool isCypressDevice (int deviceNum) {
CY_HANDLE handle;
unsigned char interfaceNum = 0;
unsigned char sig[6];
CY_RETURN_STATUS rStatus;
rStatus = CyOpen (deviceNum, interfaceNum, &handle);
if (rStatus == CY_SUCCESS){
rStatus = CyGetSignature (handle, sig);
if (rStatus == CY_SUCCESS){
CyClose (handle);
return true;
}
else {
CyClose (handle);
return false;
}
}
else
return false;
}
void printListOfDevices (bool isPrint)
{
int i, j, devNum;
int index = 0, numInterfaces, interfaceNum;
char functionality[64];
CY_DEVICE_INFO deviceInfo;
CY_RETURN_STATUS rStatus;
deviceAddedRemoved = false;
CyGetListofDevices (&numDevices);
//printf ("The number of devices is %d \n", numDevices);
for (i = 0; i < numDevices; i++){
for (j = 0; j< CY_MAX_INTERFACES; j++)
glDevice[i].interfaceFunctionality[j] = -1;
}
if (isPrint){
printf ("\n\n---------------------------------------------------------------------------------\n");
printf ("Device Number | VID | PID | INTERFACE NUMBER | FUNCTIONALITY \n");
printf ("---------------------------------------------------------------------------------\n");
}
cyDevices = 0;
for (devNum = 0; devNum < numDevices; devNum++){
rStatus = CyGetDeviceInfo (devNum, &deviceInfo);
interfaceNum = 0;
if (!rStatus)
{
if (!isCypressDevice (devNum)){
continue;
}
strcpy (functionality, "NA");
numInterfaces = deviceInfo.numInterfaces;
glDevice[index].numInterface = numInterfaces;
cyDevices++;
while (numInterfaces){
if (deviceInfo.deviceClass[interfaceNum] == CY_CLASS_VENDOR)
{
glDevice[index].deviceNumber = devNum;
switch (deviceInfo.deviceType[interfaceNum]){
case CY_TYPE_I2C:
glDevice[index].interfaceFunctionality[interfaceNum] = CY_TYPE_I2C;
strcpy (functionality, "VENDOR_I2C");
glDevice[index].isI2c = true;
break;
case CY_TYPE_SPI:
glDevice[index].interfaceFunctionality[interfaceNum] = CY_TYPE_SPI;
strcpy (functionality, "VENDOR_SPI");
glDevice[index].isSpi = true;
break;
default:
strcpy (functionality, "NA");
break;
}
}
else if (deviceInfo.deviceClass[interfaceNum] == CY_CLASS_CDC){
strcpy (functionality, "NA");
}
if (isPrint) {
printf ("%d |%x |%x | %d | %s\n", \
index, \
deviceInfo.vidPid.vid, \
deviceInfo.vidPid.pid, \
interfaceNum, \
functionality \
);
}
interfaceNum++;
numInterfaces--;
}
index++;
}
}
if (isPrint){
printf ("---------------------------------------------------------------------------------\n\n");
}
}

View File

@@ -1,19 +0,0 @@
SHELL = /bin/bash
CC=g++
default: tinio utils
tinio:
echo "Building tinio..."
$(CC) -lcyusbserial main.cpp -o tinio
utils:
$(CC) -lcyusbserial Command_Utility.c -o cy-config
install:
echo "Installing tinio and flasher"
cp tinio /usr/bin
cp cy-config /usr/bin
mkdir /usr/share/tinio
mkdir /usr/share/tinio/flashes
cp flashes/* /usr/share/tinio/flashes

File diff suppressed because it is too large Load Diff

View File

@@ -1,389 +0,0 @@
// Tinio - the Tiny I/O tool
#include "include/CyUSBSerial.h"
#include <ctype.h>
#include <libusb.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// Those are flags used for flow control inside the program
uint16_t whichDev = 0;
uint16_t interfaceNum = 0;
uint16_t pinNumber = 0;
bool valueToWrite=false, writeFlag=false, readFlag=false, exitFlag=false, expertModeFlag=false; // flags
// those vars are to be used with locateDevice function
const uint8_t maxDevs = 16; // 16 connected devices should be enough...
const CY_VID_PID deviceVidPid{UINT16(0x04b4),
UINT16(0x0002)}; // the id for the chip
uint8_t deviceNumList[maxDevs];
uint8_t deviceCount;
CY_DEVICE_INFO deviceInfoList[maxDevs];
// vars for deviceOpen function
CY_HANDLE deviceHandleList[maxDevs];
uint8_t defaultInterfaceNum = 0;
//----ACTUAL CODE BELOW
int verifyArgNum(
const int num) // verifies the number of arguments. minimum is 2
{
if (num < 2) {
return 0;
}
return 1;
}
int initLib() // initializes the cypress library
{
// printf("Initializing library...");
if (CyLibraryInit() != CY_SUCCESS) // if the init procedure fails
{
puts("The library init failed.");
puts("Restarting...");
if (CyLibraryExit() !=
CY_SUCCESS) // try to close the possibly running library
{
return 1; // if even that fails, abort.
}
puts("OK");
initLib(); // if the library closed gracefully
// try to reinitialize
}
// puts("OK");
return 0;
}
void usage() { // prints usage; called when program has no arguments
puts("TinI/0 0.1");
puts("Usage:");
puts("tinio <options>");
puts("The supported options are:");
puts("-d<device number> - specifies the desired device - integer 0 to 15");
puts("-i<interface number - specifies the USB interface number - integer 0 "
"to 255");
puts("-s<pin number> - sets the specified pin to the value specified with -v "
" - integer 0 to 11");
puts("-r<pin number> - reads the specified pin's value and prints it to the "
"stdout - integer 0 to 11");
puts("-v<value> - value for -s option - integer 0 to 1");
puts("-e - enables expert mode (enables additional pins)");
}
// THOSE ARE ALL ARGUMENT ERROR MESSAGES!
// BEGIN
void unknownOptarg(int option, char *argument) {
printf("Error: Unknown option argument -- \'%s\' at option -%c \n", argument,
option);
}
void pinNum2HiLo(int number) {
printf("Error: The specified pin number - %i is too high.\n", number);
puts("Pin numbers must be between 0 and 11");
exit(-1);
}
void rwConflict() { puts("Error: Can't write and read at the same time!"); }
void uselessValue() { puts("Error: -v option can't be used when reading!"); }
void value2Hi(int number) {
printf("Error: The specified value - %i is too big/small.\n", number);
puts("Values can only be zero or one.");
}
void devNum2Hi(int number) {
printf("Error: The specified device number - %i is bigger than 15 or "
"negative!\n",
number);
puts("Note: The number of allowed devices can be adjusted by manipulating "
"maxDevs");
puts("variable in the source code.");
}
void intNum2Hi(int number) {
printf("Error: The specified interface number - %i is too big! \n", number);
puts("Interface numbers must be unsigned 8-bit integers \n (smaller than 256 "
"and bigger or equal than 0).");
}
void notAnExpert(int number) {
printf("Error: The specified pin - %i isn't accessible unless in the "
"expert mode.\n",
number);
puts("Those pins are assigned a special function in the chip's SCB block.");
puts("If you still want to do it, use the -e option");
}
// END
int evalErrors(const CY_RETURN_STATUS error) { // evaluates errors, duh?
int errCast = int(error); // casts the library's error value type into int
switch (errCast) { // evaluates the return status of a function
case 0: // everything goes OK
// puts("OK"); // don't need those debug messages anymore.
return 0;
break;
case 1: // access denied by the OS // an error handler structure:
puts("access denied. Consider sudoing."); // print the error messages
return 1; // return from the function with casted error number
break; // break to assure no errors (in the error function, cynical isn't
// it?)
case 2: // driver init failed. library's fault probably
puts("Library failure. Try to rerun the tinio utility or reinstall the"
"library.");
return 2;
break;
case 3: // CY_DEVICE_INFO_FETCH_FAILED error
puts("Device info fetch failed.");
puts("This should not happen.");
puts("Please send me a bug report to: thecodingkid.devel@gmail.com.");
return 3;
break;
case 4:
puts("Libusb can't open the device."); // another weird driver error
return 4;
break;
case 5: // parameter error. shouldn't happen, but who knows...
puts("Parameter error!");
puts("This should not happen.");
puts("Please send me a bug report to: thecodingkid.devel@gmail.com.");
return 5;
break;
case 6: // library request failed. The cypress or libusb lib may be
// uninitialized
puts("Request failed. Check if you passed the right interface");
puts("number and if the library is set up correctly.");
return 6;
break;
case 10: // device not found. nothing special, just exit
puts("Device not found. Is the target device conected?");
return 10;
break;
default: // if everything else fails, there is a generic error message that
// saves the day ;)
printf("Error no. %i!\n", errCast);
puts("This should definitely not happen.");
puts("Please send me a bug report to: thecodingkid.devel@gmail.com");
return errCast;
}
}
int locateDevice() // locate the device and verify it's the right one
{
// printf("Locating devices..."); //debug, not needed
try {
CY_RETURN_STATUS retVal;
retVal = CyGetDeviceInfoVidPid(
deviceVidPid, deviceNumList,
deviceInfoList, //--searches for the device with given VID/PID
&deviceCount, maxDevs); //--and stores them into lists
//--refer to lib docs for more info
throw retVal; // throws the return value of the func
} catch (CY_RETURN_STATUS errVal) {
int r = evalErrors(errVal); // evaluate the errors
if (r != 0) { // exit on error
return r;
}
if (deviceCount > 1) { // those tiny ifs make the function dummy-proof
return 0;
}
if (deviceCount == 0) {
puts("No devices found!");
return 10;
}
return 0;
}
}
int attachDevices() { // loops through devices and attaches them to handles
for (int i = 0; i < deviceCount; i++) {
int rs = evalErrors(
CyOpen(deviceNumList[i], interfaceNum, &deviceHandleList[i]));
if (rs != 0) { // exit on error
return rs;
}
}
return 0;
}
int setGPIO() { // sets the chosen gpio. arguments are taken from the global
// flags
// and vars at the top of the file
if (writeFlag == false) // error checking;
return -1;
if (expertModeFlag == false &&
(pinNumber == 6 || pinNumber == 5))
// if expert mode isn't enabled you can't mess with some pins
{
notAnExpert(pinNumber);
return -1;
}
int errval = evalErrors( // real code here
CySetGpioValue(deviceHandleList[whichDev], pinNumber,
uint8_t(valueToWrite)));
return errval;
}
int readGPIO() { // similiar to setGPIO just it reads
if (readFlag == false)
return -1;
if (expertModeFlag == false &&
(pinNumber == 6 || pinNumber == 5))
// if expert mode isn't enabled you can't mess with some pins
{
notAnExpert(pinNumber);
return -1;
}
uint8_t value;
int errval =
evalErrors(CyGetGpioValue(deviceHandleList[whichDev], pinNumber, &value));
printf("%i\n", value); // print value to stdout
return errval;
}
int isstrdigit(const char *str) { // a helper function for argument parser
for (; *str != '\0'; str++) {
if (!(isdigit(*str))) {
return 0;
}
}
return 1;
}
void test() { // a pretty good debug function
printf("read: %i | write: %i | pinNumber: %i | valueToWrite: %i \n", readFlag,
writeFlag, pinNumber, uint8_t(valueToWrite));
printf("whichDev: %i | interfaceNum: %i \n \n", whichDev, interfaceNum);
}
int parseCmdLine(int acount, char **arglist) { // the command line parser
int opt; // a wide character for getopt
opt = getopt(acount, arglist, "d:s:r:v:i:u"); // getopts from parameters
while (opt != -1) { // cycle if there are still options the command line
switch (opt) {
case 'd': // specifies the desired device
if (!isstrdigit(optarg)) { // if the opt's parameter isn't a number...
unknownOptarg(opt, optarg); //...tell that to the user
exitFlag = true; // exit
return -1;
}
whichDev = atoi(optarg); // set the target device var
if (whichDev > 15 ||
whichDev < 0) { // if the specified device number is too high...
devNum2Hi(whichDev); // error message
whichDev = 0; // reset the device number
exitFlag = true; // then exit
return -1; // return with error
}
break;
case 's': // set a pin to value, value is specified with -v
if (!isstrdigit(optarg)) { // argument has to be a digit
unknownOptarg(opt, optarg); // error message
exitFlag = true; // exit
return -1;
}
pinNumber = atoi(optarg); // set target var
if (pinNumber > 11 || pinNumber < 0) { // pin num checks
pinNum2HiLo(pinNumber);
pinNumber = 0;
exitFlag = true;
return -1;
}
if (readFlag == true) { // for preventing read/write conflicts
rwConflict();
pinNumber = 0;
exitFlag = true;
return -1;
}
writeFlag = true; // enable write
readFlag = false; // disable read
break;
case 'r': // reads a pin, value is printed to stdout
if (!isstrdigit(optarg)) {
unknownOptarg(opt, optarg);
exitFlag = true;
return -1;
}
pinNumber = atoi(optarg);
if (pinNumber > 11 || pinNumber < 0) {
pinNum2HiLo(pinNumber);
exitFlag = true;
pinNumber = 0;
return -1;
}
if (writeFlag == true) {
rwConflict();
pinNumber = 0;
return -1;
}
readFlag = true;
writeFlag = false;
break;
case 'i': // used to specify USB interface number
if (!isstrdigit(optarg)) { // if argument not a number
unknownOptarg(opt, optarg);
exitFlag = true;
return -1;
}
interfaceNum = atoi(optarg);
if (interfaceNum > 255 || interfaceNum < 0) { // if argument to high/low
intNum2Hi(interfaceNum); // err message
exitFlag = true; // exit
interfaceNum = 0; // reset the var
return -1; // return
}
break;
case 'v': // the value to write to a pin
if (!isstrdigit(optarg)) { // number check
unknownOptarg(opt, optarg);
valueToWrite = false;
exitFlag = true;
writeFlag = false;
return -1;
}
if (readFlag == true) { //conflict check
uselessValue();
valueToWrite = false;
exitFlag = true;
writeFlag = false;
return -1;
}
(atoi(optarg) == 0) ? valueToWrite = false : valueToWrite = true; // set the value
case 'e':
expertModeFlag=true;
}
opt = getopt(acount, arglist, "d:s:r:v:i:e");
}
return 0;
}
int exitOnError() { //this function exits
if (exitFlag == true) { //if the exit flag is on
puts("Exiting");
exit(-1);
return -1;
}
if ((writeFlag | readFlag) == 0) { // or if nothing is ordered to do
usage();
exit(-1);
return -1;
}
return 0;
}
int main(int argc, char **argv) {
parseCmdLine(argc, argv);
// test();
exitOnError();
initLib();
locateDevice();
attachDevices();
setGPIO();
readGPIO();
return 0;
}

View File

@@ -1,2 +1,19 @@
SHELL = /bin/bash
CC=g++
default: tinio utils
tinio:
g++ -lcyusbserial tinio.cpp
echo "Building tinio..."
$(CC) -lcyusbserial main.cpp -o tinio
utils:
$(CC) -lcyusbserial Command_Utility.c -o cy-config
install:
echo "Installing tinio and flasher"
cp tinio /usr/bin
cp cy-config /usr/bin
mkdir /usr/share/tinio
mkdir /usr/share/tinio/flashes
cp flashes/* /usr/share/tinio/flashes

View File

@@ -1,5 +1,5 @@
// Tinio - the Tiny I/O tool
#include <CyUSBCommon.h>
#include "include/CyUSBSerial.h"
#include <ctype.h>
#include <libusb.h>
#include <stdint.h>